gemi 0.49.0 → 0.49.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_options","C","#i","#t","#n","#e","#s","#o","#b","#f","#r","#h","#u","#d","#A","#T","#P","#C","#E","#g","#S","#x","#O","#y","#p","#w","#k","#c","#R","#l","#m","#a","URLPattern","l","y","d"],"sources":["../../utils/Subject.ts","../../client/QueryError.ts","../../client/QueryResource.ts","../../client/QueryManagerContext.tsx","../../client/ServerQueryContext.tsx","../../utils/applyParams.ts","../../utils/omitNullishValues.ts","../../client/RouteStateContext.tsx","../../client/useParams.ts","../../client/useRouteData.ts","../../client/isPlainObject.ts","../../client/useQuery.ts","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/.bun/history@5.3.0/node_modules/history/index.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js","../../utils/sleep.ts","../../client/ProgressManager.ts","../../client/useLocation.ts","../../client/ServerDataProvider.tsx","../../client/I18nContext.tsx","../../client/useNavigate.ts","../../client/useSearchParams.ts","../../client/useRoute.ts","../../client/HttpReload.tsx","../../client/PrefetchCache.ts","../../client/helpers/routeDataUrl.ts","../../client/helpers/readRoutePayload.ts","../../client/helpers/flattenComponentTree.ts","../../client/ComponentContext.tsx","../../client/ClientRouterContext.tsx","../../client/useMutation.ts","../../client/useMutate.ts","../../client/Mutation.tsx","../../client/useIsNavigationPending.ts","../../client/useNavigationProgress.ts","../../client/usePrefetch.ts","../../client/useBreadcrumbs.ts","../../client/RouteTransitionProvider.tsx","../../client/Link.tsx","../../client/Redirect.tsx","../../../../node_modules/.bun/react-error-boundary@6.1.1+83d5fd7b249dbeef/node_modules/react-error-boundary/dist/react-error-boundary.js","../../client/WebsocketContext.tsx","../../client/Head.tsx","../../client/ThemeProvider.tsx","../../utils/partialRender.ts","../../client/helpers/mergeCarriedSegments.ts","../../client/helpers/loadRoutePayload.ts","../../client/ClientRouter.tsx","../../client/init.tsx","../../client/createRoot.tsx","../../client/Image.tsx","../../client/auth/useForgotPassword.ts","../../client/auth/useSignIn.tsx","../../client/auth/useSignUp.ts","../../client/auth/useSignOut.ts","../../client/auth/useResetPassword.ts","../../client/auth/useUser.ts","../../utils/parseTranslation.tsx","../../client/useTranslator.ts","../../client/useLocale.ts","../../client/useSubscription.ts","../../client/useBroadcast.ts","../../client/OpenGraphImage.tsx","../../client/useAppIdMissmatch.ts"],"sourcesContent":["export class Subject<T> {\n subscribers = new Set<(value: T) => void>();\n value: T;\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n public subscribe(subscriber: (value: T) => void) {\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n }\n\n public next(value: T) {\n this.value = value;\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n public getValue() {\n return this.value;\n }\n}\n","/**\n * An HTTP failure from a query endpoint, in a shape an error boundary can\n * work with. `resolveVariant` used to store the parsed response body as the\n * error; boundaries expect an `Error`, so the body moves to a field.\n */\nexport class QueryError extends Error {\n constructor(\n public path: string,\n public variantKey: string,\n public status: number,\n public body: any,\n ) {\n super(\n typeof body?.message === \"string\"\n ? body.message\n : `Request to /api${path} failed with status ${status}`,\n );\n this.name = \"QueryError\";\n }\n}\n","import { Subject } from \"../utils/Subject\";\nimport { QueryError } from \"./QueryError\";\n\ntype State = {\n loading: boolean;\n data: any;\n /**\n * Whether `data` is a value the server actually produced — `null`, `0`,\n * `false` and `\"\"` are all legitimate response bodies. Every presence check\n * in the cache goes through this flag, never through `data`'s truthiness:\n * inferring presence from the value made a falsy body look permanently\n * unfetched, which under suspense meant an unbounded fetch/suspend loop.\n */\n hasData: boolean;\n error: any;\n version: number;\n};\n\ntype Deferred = { promise: Promise<void>; resolve: () => void };\n\nexport const DEFAULT_STALE_TIME = 5000;\n\nexport class QueryResource {\n store: Subject<Map<string, State>>;\n staleVariants = new Set<string>();\n lastFetchRecord = new Map<string, number>();\n key: string;\n /**\n * Variants with a request on the wire. React discards and retries a\n * suspended render, so `read` runs many times for one commit — this is what\n * collapses those attempts onto a single fetch. The `loading` flag can't do\n * it: render-initiated fetches are silent and never write to the store.\n */\n private inflight = new Set<string>();\n /**\n * One promise per suspended variant, handed to `use()`. Settled by whatever\n * write lands first — the variant's own fetch or a `hydrate` from a route\n * payload — so a prefetch that arrives mid-suspension wakes the reader\n * without waiting on the wire.\n */\n private pending = new Map<string, Deferred>();\n\n constructor(key: string, initialState: Record<string, any>) {\n this.key = key;\n this.store = new Subject(new Map());\n this.hydrate(initialState);\n }\n\n /**\n * Adopt server-prefetched data into the cache.\n *\n * Called once from the constructor for the SSR payload, and again on every\n * client-side navigation with the `prefetchedData` the server just produced —\n * otherwise the resource cache (which is keyed by path for the lifetime of\n * the app) would keep serving the first payload and revalidate it over `/api`.\n */\n hydrate(initialState: Record<string, any> | null | undefined) {\n const store = this.store.getValue();\n const now = Date.now();\n let changed = false;\n\n for (const [variantKey, data] of Object.entries(initialState ?? {})) {\n // `undefined` means \"no value\" (JSON can't produce it); everything else\n // — including `null`, `0`, `false`, `\"\"` — is a real response body, and\n // a suspended reader may be waiting on exactly this write to settle.\n if (data === undefined) continue;\n const current = store.get(variantKey);\n // Never clobber an in-flight fetch — `resolveVariant` flips `loading`\n // before its first await, so this also covers an optimistic `mutate`\n // whose refetch hasn't landed yet.\n if (current?.loading) continue;\n // Idempotent re-hydration (e.g. StrictMode's double invoke).\n if (current?.hasData && current.data === data) continue;\n\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: now,\n });\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, now);\n // Wake a reader suspended on this variant — the payload the server just\n // shipped is the answer it was waiting on.\n this.settle(variantKey);\n changed = true;\n }\n\n if (changed) {\n this.store.next(store);\n }\n }\n\n private pendingFor(variantKey: string): Deferred {\n let deferred = this.pending.get(variantKey);\n if (!deferred) {\n let resolve!: () => void;\n const promise = new Promise<void>((r) => {\n resolve = r;\n });\n deferred = { promise, resolve };\n this.pending.set(variantKey, deferred);\n }\n return deferred;\n }\n\n private settle(variantKey: string) {\n const deferred = this.pending.get(variantKey);\n if (deferred) {\n this.pending.delete(variantKey);\n deferred.resolve();\n }\n }\n\n private isStale(variantKey: string, staleTime: number) {\n if (this.staleVariants.has(variantKey)) return true;\n const now = Date.now();\n // `>=` so `staleTime: 0` means \"always revalidate\" and\n // `staleTime: Infinity` means \"never\".\n return now - (this.lastFetchRecord.get(variantKey) ?? now) >= staleTime;\n }\n\n /**\n * The cached state for a variant, or `undefined` — a plain read that never\n * fetches and never revalidates.\n *\n * `getVariant` is the read that keeps the cache honest, and it starts a\n * request when it has to. That makes it the wrong thing to call while\n * rendering: React throws away a render whose subtree suspends and retries\n * it, so every discarded attempt would leak a request. Renders read with\n * this; effects, which only run for a render that committed, use\n * `getVariant`.\n */\n peek(variantKey: string) {\n return this.store.getValue().get(variantKey);\n }\n\n /**\n * The read a render performs. Never suspends when data is in hand (stale\n * data revalidates in the background instead), dedupes across the render\n * attempts React throws away, and hands back a promise that resolves off\n * any write to the variant — its own fetch or a `hydrate`.\n *\n * Safe during render: it never writes to the store synchronously, so the\n * snapshot `useSyncExternalStore` read stays valid for the whole attempt.\n */\n read(\n variantKey: string,\n staleTime: number = DEFAULT_STALE_TIME,\n ): { state?: State; promise?: Promise<void> } {\n const state = this.peek(variantKey);\n\n // Data in hand: stale-while-revalidate, never suspend.\n if (state?.hasData) {\n if (\n !this.inflight.has(variantKey) &&\n this.isStale(variantKey, staleTime)\n ) {\n this.lastFetchRecord.set(variantKey, Date.now());\n this.resolveVariant(variantKey, true);\n }\n return { state };\n }\n if (state?.error) {\n // The caller throws it into the nearest error boundary.\n return { state };\n }\n if (typeof window === \"undefined\") {\n // SSR never fetches and never suspends; the server renders whatever the\n // prefetch payload seeded.\n return { state };\n }\n\n const deferred = this.pendingFor(variantKey);\n if (!this.inflight.has(variantKey)) {\n this.resolveVariant(variantKey, true);\n }\n return { state, promise: deferred.promise };\n }\n\n getVariant(variantKey: string, staleTime: number = DEFAULT_STALE_TIME) {\n const store = this.store.getValue();\n if (!store.has(variantKey)) {\n // Join a render-initiated fetch instead of racing it — silent reads\n // never flip `loading`, so the flag alone can't dedupe here.\n if (!this.inflight.has(variantKey)) {\n this.resolveVariant(variantKey);\n }\n } else {\n const variant = store.get(variantKey);\n\n if (!variant.loading && !this.inflight.has(variantKey)) {\n // Don't have data\n if (!variant.hasData) {\n this.resolveVariant(variantKey);\n return store.get(variantKey);\n }\n if (this.isStale(variantKey, staleTime)) {\n this.lastFetchRecord.set(variantKey, Date.now());\n this.resolveVariant(variantKey, true);\n return store.get(variantKey);\n }\n }\n }\n return store.get(variantKey);\n }\n\n /**\n * Drop the error for one variant (or every variant when omitted), so an\n * error boundary reset re-renders into a clean read instead of instantly\n * re-throwing the stored failure.\n */\n clearError(variantKey?: string) {\n const store = this.store.getValue();\n let changed = false;\n for (const [key, state] of store) {\n if (variantKey !== undefined && key !== variantKey) continue;\n if (state.error) {\n store.set(key, { ...state, error: null });\n changed = true;\n }\n }\n if (changed) {\n this.store.next(store);\n }\n }\n\n mutate(variantKey: string, fn: (data: any) => any = (data) => data) {\n const cacheKey = [\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : \"\",\n this.key,\n variantKey,\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n try {\n if (caches) {\n caches?.delete(cacheKey);\n }\n } catch (err) {}\n\n const store = this.store.getValue();\n const state = store.get(variantKey);\n if (!state || !state.hasData) {\n // Nothing is cached yet to update optimistically — e.g. a lazy query, or\n // one that hasn't resolved. Fall through to a refetch so `mutate(fn)` is\n // not a silent no-op (it still means \"go get the latest data\").\n this.resolveVariant(variantKey, false, false);\n return;\n }\n const data = fn(state.data);\n\n this.staleVariants.add(variantKey);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: state.version,\n }),\n );\n this.resolveVariant(variantKey, false, false);\n }\n\n refetch(variantKey: string) {\n this.resolveVariant(variantKey, false, false);\n }\n\n private async resolveVariant(\n variantKey: string,\n silent = false,\n cache = true,\n ) {\n if (typeof window === \"undefined\") {\n return;\n }\n // Synchronous with the call, so every read in the same render pass sees\n // the request as already on the wire.\n this.inflight.add(variantKey);\n try {\n const store = this.store.getValue();\n const previousState = store.get(variantKey);\n\n if (!silent) {\n store.set(variantKey, {\n loading: true,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error: previousState?.error,\n version: previousState?.version,\n });\n }\n\n let data = null;\n let response: Response | null = null;\n const fullUrl = [this.key, variantKey].filter((s) => s.length).join(\"?\");\n try {\n response = await fetch(`/api${fullUrl}`, {\n cache: cache ? \"default\" : \"reload\",\n });\n data = await response.json();\n } catch (error) {\n console.error(`Error fetching url /api${fullUrl}`, error);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error,\n version: previousState?.version,\n }),\n );\n return;\n }\n\n if (response!.ok) {\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: Date.now(),\n }),\n );\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, Date.now());\n } else {\n // this.lastFetchRecord.set(variantKey, 0);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error: new QueryError(this.key, variantKey, response!.status, data),\n version: previousState?.version,\n }),\n );\n }\n } finally {\n this.inflight.delete(variantKey);\n // Settle on failure too — a suspended reader has to wake up to throw.\n this.settle(variantKey);\n }\n }\n}\n","import {\n createContext,\n type PropsWithChildren,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { QueryResource } from \"./QueryResource\";\n\n/** One streamed query payload: `[path, variantKey, data]`. */\ntype StreamedQueryPayload = [string, string, any];\n\nexport type PrefetchedData = Record<string, Record<string, any>>;\n\nexport interface QueryManagerContextValue {\n getResource: (\n key: string,\n initialState?: Record<string, any>,\n ) => QueryResource;\n hydrate: (prefetchedData?: PrefetchedData | null) => void;\n clearErrors: () => void;\n}\n\nexport const QueryManagerContext = createContext<QueryManagerContextValue>({\n getResource: (key: string, initialState: Record<string, any> = {}) => {\n return new QueryResource(key, initialState);\n },\n hydrate: () => {},\n clearErrors: () => {},\n});\n\nexport const QueryManagerProvider = ({ children }: PropsWithChildren<{}>) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n\n const getResource = useCallback(\n (key: string, initialState?: Record<string, any>) => {\n let resource = resourcesRef.current.get(key);\n if (!resource) {\n resource = new QueryResource(key, initialState ?? {});\n resourcesRef.current.set(key, resource);\n }\n return resource;\n },\n [],\n );\n\n // Resources are cached by path for the lifetime of the app, so `initialState`\n // above only ever applies to the first load. Every navigation ships a fresh\n // `prefetchedData` payload that has to be pushed into the existing resources,\n // otherwise the components mounting on the new surface refetch it over `/api`.\n const hydrate = useCallback((prefetchedData?: PrefetchedData | null) => {\n if (!prefetchedData) return;\n for (const [key, initialState] of Object.entries(prefetchedData)) {\n if (!initialState || typeof initialState !== \"object\") continue;\n const resource = resourcesRef.current.get(key);\n if (resource) {\n resource.hydrate(initialState);\n } else {\n resourcesRef.current.set(key, new QueryResource(key, initialState));\n }\n }\n }, []);\n\n // Used by the route-level error boundary's reset: without this, the retried\n // render would read the stored failure back out of the cache and re-throw.\n const clearErrors = useCallback(() => {\n for (const resource of resourcesRef.current.values()) {\n resource.clearError();\n }\n }, []);\n\n // Streaming SSR delivers late-resolving queries as inline\n // `__GEMI_STREAM__.push([path, variant, data])` scripts interleaved with\n // React's chunks. Payloads that ran before this rendered sit buffered in a\n // plain array; from here on, `push` hydrates directly — and `hydrate`\n // settles any reader suspended on that variant.\n //\n // Drained synchronously during the FIRST render, not in an effect:\n // suspension happens during the render phase, so a segment hydrating in\n // this very pass must already find its streamed data in the cache — an\n // effect-timed drain would let it suspend and start a duplicate `/api`\n // fetch for data the document already carries. Safe here: it runs once\n // (idempotent under StrictMode's double-invoke), and nothing is subscribed\n // to the store yet, so no render is invalidated mid-pass.\n const drainedStreamRef = useRef(false);\n if (typeof window !== \"undefined\" && !drainedStreamRef.current) {\n drainedStreamRef.current = true;\n const w = window as unknown as {\n __GEMI_STREAM__?:\n | StreamedQueryPayload[]\n | { push: (p: StreamedQueryPayload) => void };\n };\n const adopt = ([path, variantKey, data]: StreamedQueryPayload) => {\n hydrate({ [path]: { [variantKey]: data } });\n };\n const buffered = Array.isArray(w.__GEMI_STREAM__) ? w.__GEMI_STREAM__ : [];\n w.__GEMI_STREAM__ = { push: adopt };\n for (const payload of buffered) {\n adopt(payload);\n }\n }\n\n const value = useMemo(\n () => ({ getResource, hydrate, clearErrors }),\n [getResource, hydrate, clearErrors],\n );\n\n return (\n <QueryManagerContext.Provider value={value}>\n {children}\n </QueryManagerContext.Provider>\n );\n};\n","import { createContext } from \"react\";\n\n/**\n * The structural slice of the server's `ServerQueryStore` that `useQuery`\n * needs during a streaming server render. Declared here — not imported from\n * `services/router` — because this file ships in the browser bundle; only the\n * shape crosses over, never the implementation.\n */\nexport interface ServerQueryEntryLike {\n status: \"pending\" | \"resolved\" | \"rejected\";\n data?: any;\n error?: any;\n promise: Promise<void>;\n}\n\nexport interface ServerQueriesLike {\n ensure(\n path: string,\n options?: {\n params?: Record<string, any>;\n search?: Record<string, string | number | boolean | null>;\n },\n source?: \"prefetch\" | \"render\",\n ): ServerQueryEntryLike;\n}\n\n/**\n * Populated only during a streaming server render (`createRoot` threads the\n * request's store through); always `null` in the browser, where suspension\n * runs on `QueryResource` instead.\n */\nexport const ServerQueryContext = createContext<ServerQueriesLike | null>(null);\n","export function applyParams<T extends string>(\n url: T,\n params: Record<string, string | number | undefined>,\n): string {\n return (\n url\n .replace(/:([^/]+[*?]?)/g, (_, key) => {\n const hasSuffix = key.endsWith(\"?\") || key.endsWith(\"*\");\n const paramName = hasSuffix ? key.slice(0, -1) : key;\n const value = params[paramName];\n\n if (value === undefined) {\n if (hasSuffix) {\n return \"\"; // Remove the optional segment if no value is provided\n }\n // @ts-ignore\n if (import.meta.env.DEV) {\n throw new Error(`Missing parameter: ${paramName}`);\n }\n console.error(`Missing parameter: ${paramName} in URL: ${url}`);\n }\n\n return String(value);\n })\n // remove double slashes\n .replace(/\\/\\//g, \"/\")\n // remove trailing slash\n .replace(/\\/$/, \"\")\n );\n}\n","export function omitNullishValues<T>(input: T) {\n return Object.fromEntries(\n Object.entries(input).filter(([, value]) => {\n return value !== null && value !== undefined;\n }),\n ) as T;\n}\n","import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n pathname: string;\n hash: string;\n action: Action | null;\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useRouteData() {\n const { data, i18n, prefetchedData, breadcrumbs } =\n useContext(RouteStateContext);\n\n return { data, i18n, prefetchedData, breadcrumbs };\n}\n","export function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useSyncExternalStore,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { NestedPrettify } from \"../utils/type\";\n\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport { ServerQueryContext } from \"./ServerQueryContext\";\nimport { DEFAULT_STALE_TIME } from \"./QueryResource\";\nimport { applyParams } from \"../utils/applyParams\";\nimport type { UrlParser } from \"./types\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ninterface Config<T> {\n fallbackData?: T;\n keepPreviousData?: boolean;\n retryIntervalOnError?: number;\n refreshInterval?: number;\n /** How long cached data stays fresh before a read revalidates it, in ms. */\n staleTime?: number;\n debug?: boolean;\n lazy?: boolean;\n /**\n * When true (the default), a query with no cached data suspends the nearest\n * `Suspense` boundary instead of returning `loading: true`, and an HTTP\n * failure throws into the nearest error boundary. `lazy: true` implies\n * `suspense: false`.\n */\n suspense?: boolean;\n refetchUntil?: (data: T, duration: number) => number;\n}\n\ntype WithOptionalValues<T> = {\n [K in keyof T]: T[K] | null;\n};\n\nconst defaultConfig: Config<any> = {\n fallbackData: null,\n keepPreviousData: true,\n retryIntervalOnError: 10000,\n refreshInterval: 999999,\n staleTime: DEFAULT_STALE_TIME,\n debug: false,\n lazy: false,\n suspense: true,\n};\n\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<any, infer Data, any>\n ? UnwrapPromise<Data>\n : never;\n\ntype Input<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<infer I, any, any> ? I : never;\n\ntype QueryOptions<T extends keyof GetRPC> = {\n search?: Partial<WithOptionalValues<Input<T>>>;\n};\n\ntype Error = Record<string, unknown>;\n\nconst defaultOptions: QueryOptions<any> & { params?: Record<string, any> } = {\n params: {} as Record<string, string>,\n search: {} as Record<string, string>,\n};\n\nexport type QueryResult<T extends keyof GetRPC> = NestedPrettify<Data<T> & {}>;\n\ntype Options<T extends keyof GetRPC> = {\n search?: Record<string, string | number | boolean | null>;\n params?: Partial<UrlParser<`${T & string}`>>;\n};\n\ninterface QueryReturn<T extends keyof GetRPC, D> {\n data: D;\n loading: boolean;\n error: Error;\n mutate: {\n (fn?: NestedPrettify<Data<T>>): void;\n (fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>): void;\n };\n trigger: () => void;\n prefetch: () => void;\n refetch: () => void;\n version: number;\n}\n\n/**\n * A suspense-enabled query never renders without data, so `data` is\n * non-nullable. Opting out — `suspense: false` or `lazy: true` — brings back\n * the `loading` flag and with it a `data` that can be `undefined`.\n */\ninterface SuspenseConfig<T> extends Omit<Config<T>, \"suspense\" | \"lazy\"> {\n suspense?: true;\n lazy?: false;\n}\n\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n options?: Options<T>,\n config?: SuspenseConfig<Data<T>>,\n): QueryReturn<T, NestedPrettify<Data<T>>>;\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n options?: Options<T>,\n config?: Config<Data<T>>,\n): QueryReturn<T, NestedPrettify<Data<T>> | undefined>;\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n ...args: [options?: Options<T>, config?: Config<Data<T>>]\n) {\n const _params = useParams();\n const [_options = defaultOptions, _config = defaultConfig] = args;\n const options = { ...defaultOptions, ..._options };\n const config = { ...defaultConfig, ..._config };\n const suspense = config.suspense !== false && !config.lazy;\n const params =\n \"params\" in options ? { ..._params, ...options.params } : _params;\n const search = \"search\" in options ? (options.search ?? {}) : {};\n const { getResource } = useContext(QueryManagerContext);\n const serverQueries = useContext(ServerQueryContext);\n const normalPath = applyParams(url, params);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n const { prefetchedData } = useRouteData();\n // `fallbackData` is a single variant's value, so it seeds under this\n // query's variant key; `prefetchedData[normalPath]` is already the full\n // `{ [variantKey]: data }` map the server produced.\n const seed =\n config.fallbackData != null\n ? { [variantKey]: config.fallbackData }\n : prefetchedData?.[normalPath];\n // A memoized map lookup on the provider's ref: stable and cheap, so the\n // resource is derived every render — a params change swaps it in the same\n // render pass instead of flashing through an effect.\n const resource = getResource(normalPath, seed ?? undefined);\n const lazy = config.lazy;\n\n const configRef = useRef(config);\n configRef.current = config;\n\n const refreshIntervalRef = useRef<ReturnType<typeof setInterval> | null>(\n null,\n );\n const retryIntervalRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const retryingMap = useRef<Map<string, boolean>>(new Map());\n const fetchedRef = useRef(!lazy);\n const refetchUntilTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const refetchUntilDurationRef = useRef(0);\n const prefetchedRef = useRef(false);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => resource.store.subscribe(onStoreChange),\n [resource],\n );\n // `peek` hands back the object stored in the map — its identity only\n // changes on a real write, so the snapshot is stable across render\n // attempts. Also the server snapshot: SSR renders whatever the prefetch\n // payload seeded, and never fetches.\n //\n // uSES and transitions: store updates are always urgent, so a write landing\n // mid-transition restarts the pending transition — wasted work, never wrong\n // UI. Exposure is kept small by design: render-phase reads never write the\n // store synchronously (fetches are silent), and a suspended component has no\n // subscription — it is woken by its thrown promise, not the store. The\n // navigation-shaped consequences are pinned in `useQuery.transition.test.tsx`.\n const getSnapshot = useCallback(\n () => resource.peek(variantKey),\n [resource, variantKey],\n );\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n\n // `keepPreviousData`: remember the last snapshot that had data, and show it\n // whenever the current one is loading without data (e.g. a variant change\n // with `suspense: false`). Presence is `hasData`, never `data`'s truthiness\n // — `null`/`0`/`false`/`\"\"` are legitimate response bodies.\n const lastDataRef = useRef(snapshot?.hasData ? snapshot : null);\n useEffect(() => {\n if (snapshot?.hasData) {\n lastDataRef.current = snapshot;\n }\n }, [snapshot]);\n\n let state = snapshot;\n if (\n config.keepPreviousData &&\n !snapshot?.hasData &&\n snapshot?.loading &&\n lastDataRef.current\n ) {\n state = { ...lastDataRef.current, loading: true };\n }\n\n // The render-phase read for the suspense path. Only when there is nothing\n // to show — data in hand always renders, and revalidation stays where it\n // was (the mount effect below). Both reads dedupe across the render\n // attempts React discards, so this is safe to hit on every attempt.\n //\n // On a streaming server render the read goes to the request's\n // `ServerQueryStore` instead of the client resource: a prefetched query is\n // already in flight there and is joined, an undiscovered one starts now\n // (the store logs the late-discovery hint when that cost something).\n let readPromise: Promise<void> | undefined;\n let serverError: unknown;\n if (suspense && !state?.hasData && !state?.error) {\n if (typeof window === \"undefined\") {\n if (serverQueries) {\n const entry = serverQueries.ensure(url, { params, search });\n if (entry.status === \"resolved\") {\n state = {\n loading: false,\n data: entry.data,\n hasData: true,\n error: null,\n version: 0,\n };\n } else if (entry.status === \"rejected\") {\n serverError = entry.error;\n } else {\n readPromise = entry.promise;\n }\n }\n } else {\n readPromise = resource.read(variantKey, config.staleTime).promise;\n }\n }\n\n if (\n suspense &&\n typeof window === \"undefined\" &&\n !serverQueries &&\n !state?.hasData &&\n process.env.NODE_ENV !== \"production\"\n ) {\n const searchHint = variantKey\n ? `, { search: ${JSON.stringify(Object.fromEntries(searchParams))} }`\n : \"\";\n console.warn(\n `[gemi] useQuery(\"${url}\") rendered on the server without data. ` +\n `The server never fetches, so this page ships without it and the ` +\n `client suspends after hydration. Add ` +\n `\\`Query.prefetch(\"${url}\"${searchHint})\\` to the route's view handler.`,\n );\n }\n\n const retry = useCallback(\n (vk: string) => {\n if (!retryingMap.current.get(vk)) {\n if (configRef.current.debug) console.log(\"retrying\", vk);\n retryingMap.current.set(vk, true);\n retryIntervalRef.current = setTimeout(() => {\n resource.getVariant(vk, configRef.current.staleTime);\n retryingMap.current.set(vk, false);\n }, configRef.current.retryIntervalOnError);\n }\n },\n [resource],\n );\n\n // Mount / variant-change revalidation — unchanged semantics: `getVariant`\n // fetches when the variant is missing or stale, and now joins an in-flight\n // render-initiated read instead of racing it.\n useEffect(() => {\n if (fetchedRef.current) {\n resource.getVariant(variantKey, configRef.current.staleTime);\n }\n return () => {\n clearTimeout(retryIntervalRef.current);\n };\n }, [variantKey, resource]);\n\n // With `suspense: false` an error is returned and retried in the\n // background; under suspense it throws below instead.\n useEffect(() => {\n if (!suspense && snapshot?.error) {\n retry(variantKey);\n }\n }, [snapshot, suspense, retry, variantKey]);\n\n useEffect(() => {\n const cfg = configRef.current;\n if (!cfg.refetchUntil) return;\n if (snapshot && !snapshot.loading && snapshot.hasData && !snapshot.error) {\n const nextDuration = cfg.refetchUntil(\n snapshot.data,\n refetchUntilDurationRef.current,\n );\n if (nextDuration > 0) {\n refetchUntilDurationRef.current = nextDuration;\n refetchUntilTimerRef.current = setTimeout(() => {\n resource.refetch(variantKey);\n }, nextDuration);\n } else {\n refetchUntilDurationRef.current = 0;\n }\n }\n return () => {\n if (refetchUntilTimerRef.current) {\n clearTimeout(refetchUntilTimerRef.current);\n }\n };\n }, [snapshot, resource, variantKey]);\n\n const handleReload = useCallback(() => {\n if (configRef.current.debug) {\n console.log(\"Reloading query for\", variantKey);\n }\n const data = resource.getVariant(\n variantKey,\n configRef.current.staleTime,\n ).data;\n resource.mutate(variantKey, () => data);\n }, [variantKey, resource]);\n\n useEffect(() => {\n if (!fetchedRef.current) return;\n refreshIntervalRef.current = setInterval(() => {\n handleReload();\n }, config.refreshInterval);\n\n return () => {\n if (refreshIntervalRef.current) {\n clearInterval(refreshIntervalRef.current);\n }\n };\n }, [config.refreshInterval, handleReload]);\n\n useEffect(() => {\n // Feature-checked per method: vitest's `import.meta.hot` shim has `on`\n // but not `off`.\n // @ts-ignore\n if (typeof import.meta.hot?.on === \"function\") {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (typeof import.meta.hot?.off === \"function\") {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n const trigger = useCallback(() => {\n fetchedRef.current = true;\n const store = resource.store.getValue();\n const variant = store.get(variantKey);\n if (!variant || (!variant.loading && !variant.hasData)) {\n resource.refetch(variantKey);\n }\n }, [resource, variantKey]);\n\n const prefetch = useCallback(() => {\n if (prefetchedRef.current) return;\n prefetchedRef.current = true;\n fetchedRef.current = true;\n // `read`, not `refetch`: a suspending read that follows joins this\n // request instead of racing it, and fresh data is a no-op.\n resource.read(variantKey, configRef.current.staleTime);\n }, [resource, variantKey]);\n\n const refetch = useCallback(() => {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n function mutate(fn?: NestedPrettify<Data<T>>): void;\n function mutate(\n fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>,\n ): void;\n function mutate(fn?: any) {\n if (!fn) {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n return;\n }\n return resource.mutate(variantKey, (data: any) => {\n // `null` is a legitimate cached body; only `undefined` means the query\n // hasn't produced anything (and `mutate` refetches instead of calling\n // this in that case).\n if (data === undefined) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches so a stray value can't corrupt the\n // cache; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n }\n\n // Suspend last, after every hook has run: the attempt React discards ran\n // them all, and the retry re-runs them identically. The promise is *thrown*\n // rather than passed to `use()` — the thenable-throw protocol is what\n // React's ping-and-retry machinery is built around (React.lazy, SWR, React\n // Query), whereas `use()` on a client-created promise is documented as\n // unsupported outside a Suspense-compatible framework and React never\n // retries it. A streaming server render takes the same paths: a pending\n // entry suspends (React streams the fallback and resumes on settle), and a\n // rejected one throws so the segment falls back to client rendering, where\n // the browser's own fetch surfaces the error into the boundary.\n if (suspense) {\n if (serverError) {\n throw serverError;\n }\n if (state?.error && !state?.hasData) {\n throw state.error;\n }\n if (!state?.hasData && readPromise) {\n throw readPromise;\n }\n }\n\n return {\n data: state?.data as NestedPrettify<Data<T>>,\n loading: state?.loading ?? !lazy,\n error: state?.error as Error,\n mutate,\n trigger,\n prefetch,\n refetch,\n version: state?.version as number,\n };\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","var Pe=Object.defineProperty;var a=(e,t)=>Pe(e,\"name\",{value:t,configurable:!0});var P=class{type=3;name=\"\";prefix=\"\";value=\"\";suffix=\"\";modifier=3;constructor(t,r,n,c,l,f){this.type=t,this.name=r,this.prefix=n,this.value=c,this.suffix=l,this.modifier=f}hasCustomName(){return this.name!==\"\"&&typeof this.name!=\"number\"}};a(P,\"Part\");var Re=/[$_\\p{ID_Start}]/u,Ee=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,v=\".*\";function Oe(e,t){return(t?/^[\\x00-\\xFF]*$/:/^[\\x00-\\x7F]*$/).test(e)}a(Oe,\"isASCII\");function D(e,t=!1){let r=[],n=0;for(;n<e.length;){let c=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:\"INVALID_CHAR\",index:n,value:e[n++]})},\"ErrorOrInvalid\");if(c===\"*\"){r.push({type:\"ASTERISK\",index:n,value:e[n++]});continue}if(c===\"+\"||c===\"?\"){r.push({type:\"OTHER_MODIFIER\",index:n,value:e[n++]});continue}if(c===\"\\\\\"){r.push({type:\"ESCAPED_CHAR\",index:n++,value:e[n++]});continue}if(c===\"{\"){r.push({type:\"OPEN\",index:n,value:e[n++]});continue}if(c===\"}\"){r.push({type:\"CLOSE\",index:n,value:e[n++]});continue}if(c===\":\"){let f=\"\",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&Re.test(i)||s!==n+1&&Ee.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:\"NAME\",index:n,value:f}),n=s;continue}if(c===\"(\"){let f=1,s=\"\",i=n+1,o=!1;if(e[i]===\"?\"){l(`Pattern cannot start with \"?\" at ${i}`);continue}for(;i<e.length;){if(!Oe(e[i],!1)){l(`Invalid character '${e[i]}' at ${i}.`),o=!0;break}if(e[i]===\"\\\\\"){s+=e[i++]+e[i++];continue}if(e[i]===\")\"){if(f--,f===0){i++;break}}else if(e[i]===\"(\"&&(f++,e[i+1]!==\"?\")){l(`Capturing groups are not allowed at ${i}`),o=!0;break}s+=e[i++]}if(o)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:\"REGEX\",index:n,value:s}),n=i;continue}r.push({type:\"CHAR\",index:n,value:e[n++]})}return r.push({type:\"END\",index:n,value:\"\"}),r}a(D,\"lexer\");function F(e,t={}){let r=D(e);t.delimiter??=\"/#?\",t.prefixes??=\"./\";let n=`[^${x(t.delimiter)}]+?`,c=[],l=0,f=0,s=\"\",i=new Set,o=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},\"tryConsume\"),h=a(()=>o(\"OTHER_MODIFIER\")??o(\"ASTERISK\"),\"tryConsumeModifier\"),p=a(u=>{let d=o(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},\"mustConsume\"),A=a(()=>{let u=\"\",d;for(;d=o(\"CHAR\")??o(\"ESCAPED_CHAR\");)u+=d;return u},\"consumeText\"),xe=a(u=>u,\"DefaultEncodePart\"),N=t.encodePart||xe,H=\"\",$=a(u=>{H+=u},\"appendToPendingFixedValue\"),M=a(()=>{H.length&&(c.push(new P(3,\"\",\"\",N(H),\"\",3)),H=\"\")},\"maybeAddPartFromPendingFixedValue\"),X=a((u,d,g,y,Z)=>{let m=3;switch(Z){case\"?\":m=1;break;case\"*\":m=0;break;case\"+\":m=2;break}if(!d&&!g&&m===3){$(u);return}if(M(),!d&&!g){if(!u)return;c.push(new P(3,\"\",\"\",N(u),\"\",m));return}let S;g?g===\"*\"?S=v:S=g:S=n;let k=2;S===n?(k=1,S=\"\"):S===v&&(k=0,S=\"\");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),c.push(new P(k,E,N(u),S,N(y),m))},\"addPart\");for(;f<r.length;){let u=o(\"CHAR\"),d=o(\"NAME\"),g=o(\"REGEX\");if(!d&&!g&&(g=o(\"ASTERISK\")),d||g){let m=u??\"\";t.prefixes.indexOf(m)===-1&&($(m),m=\"\"),M();let S=h();X(m,d,g,\"\",S);continue}let y=u??o(\"ESCAPED_CHAR\");if(y){$(y);continue}if(o(\"OPEN\")){let m=A(),S=o(\"NAME\"),k=o(\"REGEX\");!S&&!k&&(k=o(\"ASTERISK\"));let E=A();p(\"CLOSE\");let be=h();X(m,S,k,E,be);continue}M(),p(\"END\")}return c}a(F,\"parse\");function x(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(x,\"escapeString\");function B(e){return e&&e.ignoreCase?\"ui\":\"u\"}a(B,\"flags\");function q(e,t,r){return W(F(e,r),t,r)}a(q,\"stringToRegexp\");function T(e){switch(e){case 0:return\"*\";case 1:return\"?\";case 2:return\"+\";case 3:return\"\"}}a(T,\"modifierToString\");function W(e,t,r={}){r.delimiter??=\"/#?\",r.prefixes??=\"./\",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith=\"\";let n=r.start?\"^\":\"\";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,o=s.value;if(s.type===1?o=i:s.type===0&&(o=v),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${o})${T(s.modifier)}`:n+=`((?:${o})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${o})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${o})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${o}))*)${x(s.suffix)})`,s.modifier===0&&(n+=\"?\")}let c=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${c})`:n+=\"$\",new RegExp(n,B(r));r.strict||(n+=`(?:${l}(?=${c}))?`);let f=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1)}return f||(n+=`(?=${l}|${c})`),new RegExp(n,B(r))}a(W,\"partsToRegexp\");var b={delimiter:\"\",prefixes:\"\",sensitive:!0,strict:!0},J={delimiter:\".\",prefixes:\"\",sensitive:!0,strict:!0},Q={delimiter:\"/\",prefixes:\"/\",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]===\"/\"?!0:!t||e.length<2?!1:(e[0]==\"\\\\\"||e[0]==\"{\")&&e[1]==\"/\":!1}a(ee,\"isAbsolutePathname\");function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(te,\"maybeStripPrefix\");function ke(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(ke,\"maybeStripSuffix\");function _(e){return!e||e.length<2?!1:e[0]===\"[\"||(e[0]===\"\\\\\"||e[0]===\"{\")&&e[1]===\"[\"}a(_,\"treatAsIPv6Hostname\");var re=[\"ftp\",\"file\",\"http\",\"https\",\"ws\",\"wss\"];function U(e){if(!e)return!0;for(let t of re)if(e.test(t))return!0;return!1}a(U,\"isSpecialScheme\");function ne(e,t){if(e=te(e,\"#\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):\"\"}a(ne,\"canonicalizeHash\");function se(e,t){if(e=te(e,\"?\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.search=e,r.search?r.search.substring(1,r.search.length):\"\"}a(se,\"canonicalizeSearch\");function ie(e,t){return t||e===\"\"?e:_(e)?K(e):j(e)}a(ie,\"canonicalizeHostname\");function ae(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.password=e,r.password}a(ae,\"canonicalizePassword\");function oe(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.username=e,r.username}a(oe,\"canonicalizeUsername\");function ce(e,t,r){if(r||e===\"\")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]==\"/\";return e=new URL(n?e:\"/-\"+e,\"https://example.com\").pathname,n||(e=e.substring(2,e.length)),e}a(ce,\"canonicalizePathname\");function le(e,t,r){return z(t)===e&&(e=\"\"),r||e===\"\"?e:G(e)}a(le,\"canonicalizePort\");function fe(e,t){return e=ke(e,\":\"),t||e===\"\"?e:w(e)}a(fe,\"canonicalizeProtocol\");function z(e){switch(e){case\"ws\":case\"http\":return\"80\";case\"wws\":case\"https\":return\"443\";case\"ftp\":return\"21\";default:return\"\"}}a(z,\"defaultPortForProtocol\");function w(e){if(e===\"\")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,\"protocolEncodeCallback\");function he(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.username=e,t.username}a(he,\"usernameEncodeCallback\");function ue(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.password=e,t.password}a(ue,\"passwordEncodeCallback\");function j(e){if(e===\"\")return e;if(/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL(\"https://example.com\");return t.hostname=e,t.hostname}a(j,\"hostnameEncodeCallback\");function K(e){if(e===\"\")return e;if(/[^0-9a-fA-F[\\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(K,\"ipv6HostnameEncodeCallback\");function G(e){if(e===\"\"||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(G,\"portEncodeCallback\");function de(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.pathname=e[0]!==\"/\"?\"/-\"+e:e,e[0]!==\"/\"?t.pathname.substring(2,t.pathname.length):t.pathname}a(de,\"standardURLPathnameEncodeCallback\");function pe(e){return e===\"\"?e:new URL(`data:${e}`).pathname}a(pe,\"pathURLPathnameEncodeCallback\");function ge(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.search=e,t.search.substring(1,t.search.length)}a(ge,\"searchEncodeCallback\");function me(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.hash=e,t.hash.substring(1,t.hash.length)}a(me,\"hashEncodeCallback\");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type===\"END\"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r)}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port=\"\")}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;case 10:break}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=\"\"),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?\"/\":\"\"),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??=\"\")),this.#R(t,r)}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0}#b(){this.#e=this.#l,this.#s=0}#u(t){this.#b(),this.#o=t}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type===\"CHAR\"||n.type===\"ESCAPED_CHAR\"||n.type===\"INVALID_CHAR\")}#P(){return this.#a(this.#e,\":\")}#E(){return this.#a(this.#e+1,\"/\")&&this.#a(this.#e+2,\"/\")}#S(){return this.#a(this.#e,\"@\")}#O(){return this.#a(this.#e,\":\")}#k(){return this.#a(this.#e,\":\")}#x(){return this.#a(this.#e,\"/\")}#h(){if(this.#a(this.#e,\"?\"))return!0;if(this.#n[this.#e].value!==\"?\")return!1;let t=this.#m(this.#e-1);return t.type!==\"NAME\"&&t.type!==\"REGEX\"&&t.type!==\"CLOSE\"&&t.type!==\"ASTERISK\"}#f(){return this.#a(this.#e,\"#\")}#T(){return this.#n[this.#e].type==\"OPEN\"}#A(){return this.#n[this.#e].type==\"CLOSE\"}#y(){return this.#a(this.#e,\"[\")}#w(){return this.#a(this.#e,\"]\")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=q(this.#c(),void 0,t);this.#g=U(r)}};a(C,\"Parser\");var V=[\"protocol\",\"username\",\"password\",\"hostname\",\"port\",\"pathname\",\"search\",\"hash\"],O=\"*\";function Se(e,t){if(typeof e!=\"string\")throw new TypeError(\"parameter 1 is not of type 'string'.\");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==\"\"?r.search.substring(1,r.search.length):void 0,hash:r.hash!==\"\"?r.hash.substring(1,r.hash.length):void 0}}a(Se,\"extractValues\");function R(e,t){return t?I(e):e}a(R,\"processBaseURLString\");function L(e,t,r){let n;if(typeof t.baseURL==\"string\")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==\"string\"&&(e.protocol=fe(t.protocol,r)),typeof t.username==\"string\"&&(e.username=oe(t.username,r)),typeof t.password==\"string\"&&(e.password=ae(t.password,r)),typeof t.hostname==\"string\"&&(e.hostname=ie(t.hostname,r)),typeof t.port==\"string\"&&(e.port=le(t.port,e.protocol,r)),typeof t.pathname==\"string\"){if(e.pathname=t.pathname,n&&!ee(e.pathname,r)){let c=n.pathname.lastIndexOf(\"/\");c>=0&&(e.pathname=R(n.pathname.substring(0,c+1),r)+e.pathname)}e.pathname=ce(e.pathname,e.protocol,r)}return typeof t.search==\"string\"&&(e.search=se(t.search,r)),typeof t.hash==\"string\"&&(e.hash=ne(t.hash,r)),e}a(L,\"applyInit\");function I(e){return e.replace(/([+*?:{}()\\\\])/g,\"\\\\$1\")}a(I,\"escapePatternString\");function Te(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(Te,\"escapeRegexpString\");function Ae(e,t){t.delimiter??=\"/#?\",t.prefixes??=\"./\",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=\"\";let r=\".*\",n=`[^${Te(t.delimiter)}]+?`,c=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,l=\"\";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),o=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!o&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:\"\";o=c.test(A)}else o=!p.hasCustomName();if(!o&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];o=t.prefixes.includes(A)}o&&(l+=\"{\"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||o||s.prefix!==\"\")?l+=\"*\":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&c.test(s.suffix[0])&&(l+=\"\\\\\"),l+=I(s.suffix),o&&(l+=\"}\"),s.modifier!==3&&(l+=T(s.modifier))}return l}a(Ae,\"partsToPattern\");var Y=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let c;if(typeof r==\"string\"?c=r:n=r,typeof t==\"string\"){let i=new C(t);if(i.parse(),t=i.result,c===void 0&&typeof t.protocol!=\"string\")throw new TypeError(\"A base URL must be provided for a relative constructor string.\");t.baseURL=c}else{if(!t||typeof t!=\"object\")throw new TypeError(\"parameter 1 is not of type 'string' and cannot convert to dictionary.\");if(c)throw new TypeError(\"parameter 1 is not of type 'string'.\")}typeof n>\"u\"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port=\"\");let s;for(s of V){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case\"protocol\":Object.assign(i,b),i.encodePart=w;break;case\"username\":Object.assign(i,b),i.encodePart=he;break;case\"password\":Object.assign(i,b),i.encodePart=ue;break;case\"hostname\":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case\"port\":Object.assign(i,b),i.encodePart=G;break;case\"pathname\":U(this.#n.protocol)?(Object.assign(i,Q,l),i.encodePart=de):(Object.assign(i,b,l),i.encodePart=pe);break;case\"search\":Object.assign(i,b,l),i.encodePart=ge;break;case\"hash\":Object.assign(i,b,l),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ae(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2)}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(c){throw new TypeError(`Failed to construct 'URLPattern': ${c.message}`)}}get[Symbol.toStringTag](){return\"URLPattern\"}test(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return!1;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return!1}let c;for(c of V)if(!this.#n[c].exec(n[c]))return!1;return!0}exec(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return null}let c={};r?c.inputs=[t,r]:c.inputs=[t];let l;for(l of V){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,o]of this.#t[l].entries())if(typeof o==\"string\"||typeof o==\"number\"){let h=f[i+1];s[o]=h}c[l]={input:n[l]??\"\",groups:s}}return c}static compareComponent(t,r,n){let c=a((i,o)=>{for(let h of[\"type\",\"modifier\",\"prefix\",\"value\",\"suffix\"]){if(i[h]<o[h])return-1;if(i[h]===o[h])continue;return 1}return 0},\"comparePart\"),l=new P(3,\"\",\"\",\"\",\"\",3),f=new P(0,\"\",\"\",\"\",\"\",3),s=a((i,o)=>{let h=0;for(;h<Math.min(i.length,o.length);++h){let p=c(i[h],o[h]);if(p)return p}return i.length===o.length?0:c(i[h]??l,o[h]??l)},\"comparePartList\");return!r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(Y,\"URLPattern\");export{Y as URLPattern};\n","import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n","export function sleep(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n","import { Subject } from \"../utils/Subject\";\nimport { sleep } from \"../utils/sleep\";\n\nexport class ProgressManager {\n state = new Subject(100);\n unsubscribe: ReturnType<InstanceType<typeof Subject>[\"subscribe\"]>;\n timer: ReturnType<typeof setInterval>;\n tick = 0;\n isTicking = false;\n\n constructor(subject: Subject<boolean>) {\n this.unsubscribe = subject.subscribe((state) => {\n if (state) {\n this.start();\n } else {\n this.end();\n }\n });\n }\n\n getNextIncrement() {\n const current = this.state.getValue();\n if (current === 100) {\n return Math.ceil(Math.random() * 10);\n }\n\n if (current <= 20) {\n if (Math.ceil(Math.random() * 100) > 80) {\n return current;\n }\n return current + Math.ceil(Math.random() * 5) + 1;\n }\n\n if (current <= 50) {\n if (Math.ceil(Math.random() * 100) > 50) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 10), 70);\n }\n\n if (current <= 70) {\n if (Math.ceil(Math.random() * 100) > 60) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 3), 80);\n }\n\n if (current <= 80) {\n return Math.min(current + Math.ceil(Math.random() * 1), 90);\n }\n\n if (current <= 90) {\n const x = Math.ceil(Math.random() * 100) > 50 ? 0 : 1;\n return Math.min(current + x, 94);\n }\n\n if (current <= 94) {\n const x = Math.ceil(Math.random() * 100) > 20 ? 0 : 1;\n return Math.min(current + x, 99);\n }\n }\n\n getNextInterval() {\n if (this.tick === 0) {\n this.tick = 1;\n return 200;\n }\n const current = this.state.getValue();\n\n if (current >= 88) {\n return 400;\n }\n if (current >= 94) {\n return 1000;\n }\n if (current >= 98) {\n return 2000;\n }\n return 100;\n }\n\n async nextTick() {\n if (!this.isTicking) {\n return;\n }\n await sleep(this.getNextInterval());\n\n if (!this.isTicking) {\n return;\n }\n\n const increment = this.getNextIncrement();\n this.state.next(Math.min(increment, 96));\n\n await this.nextTick();\n }\n\n start() {\n this.isTicking = true;\n this.nextTick();\n }\n\n end() {\n this.state.next(99);\n this.isTicking = false;\n this.tick = 0;\n setTimeout(() => {\n this.state.next(100);\n }, 200);\n }\n\n destroy() {\n this.end();\n this.unsubscribe();\n }\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useLocation() {\n const ctx = useContext(RouteStateContext);\n if (!ctx) {\n throw new Error(\"Router context not found\");\n }\n const { hash, pathname, search, state, locale } = ctx;\n return {\n hash,\n key: pathname,\n pathname,\n search,\n state,\n locale,\n };\n}\n","import { createContext, type PropsWithChildren } from \"react\";\nimport type { Translations } from \"./I18nContext\";\nimport type { ComponentTree } from \"./types\";\nimport type { User } from \"../auth/adapters/types\";\n\ntype Data = Record<string, any>;\n\nexport interface ServerDataContextValue {\n routeManifest: Record<string, string[]>;\n pageData: Record<string, Record<string, Data>>;\n breadcrumbs: Record<string, { label: string; href: string }>;\n prefetchedData: Record<string, Data>;\n router: {\n pathname: string;\n params: Record<string, any>;\n currentPath: string;\n is404: boolean;\n searchParams: string;\n urlLocaleSegment: string | null;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n defaultLocale: string;\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n __csrf: string;\n cssManifest: Record<string, string[]>;\n meta: any;\n appId: string;\n}\n\nexport const ServerDataContext = createContext({} as ServerDataContextValue);\n\ninterface ServerDataProviderProps {\n value?: ServerDataContextValue;\n}\n\nexport const ServerDataProvider = (\n props: PropsWithChildren<ServerDataProviderProps>,\n) => {\n let _value = props.value;\n // Server\n if (props.value) {\n _value = props.value;\n } else {\n // Client\n _value = (window as any).__GEMI_DATA__;\n }\n\n return (\n <ServerDataContext.Provider value={_value}>\n {props.children}\n </ServerDataContext.Provider>\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\ntype TranslationScope = Record<string, string>;\ntype TranslationScopes = Record<string, TranslationScope>;\nexport type Translations = Record<string, TranslationScopes>;\n\ninterface I18nContextValue {\n locale: string;\n changeLocale: (locale: string) => void;\n updateDictionary: (\n translations: Record<string, Record<string, Record<string, string>>>,\n locale?: string,\n ) => void;\n fetchTranslations: (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => Promise<void>;\n getComponentTranslations: (key: string) => Record<string, string>;\n supportedLocales: string[];\n defaultLocale: string;\n}\n\nexport type CreateI18nDictionary<T> = {\n [K in keyof T]: T[K];\n};\n\nexport const I18nContext = createContext({} as I18nContextValue);\n\nexport type Dictionary = Map<string, Map<string, Record<string, string>>>;\n\nexport const I18nProvider = (props: PropsWithChildren) => {\n const { i18n } = useContext(ServerDataContext);\n\n const [currentLocale, setCurrentLocale] = useState(i18n.currentLocale);\n\n const dictionary = useRef<Dictionary>(\n (() => {\n const dictionary = new Map();\n for (const [locale, value] of Object.entries(i18n?.dictionary ?? {})) {\n const components = new Map();\n for (const [component, translations] of Object.entries(value)) {\n components.set(component, translations);\n }\n dictionary.set(locale, components);\n }\n return dictionary;\n })(),\n );\n\n function updateDictionary(\n translations: Record<string, Record<string, Record<string, string>>> = {},\n locale?: string,\n ) {\n for (const [locale, value] of Object.entries(translations)) {\n if (!dictionary.current.has(locale)) {\n dictionary.current.set(locale, new Map());\n }\n const scopes = dictionary.current.get(locale);\n for (const [scope, translations] of Object.entries(value)) {\n if (!scopes.has(scope)) {\n scopes.set(scope, {});\n }\n scopes.set(scope, translations);\n }\n }\n changeLocale(locale);\n }\n\n const changeLocale = (locale: string) => {\n if (dictionary.current.has(locale)) {\n setCurrentLocale(locale);\n }\n };\n\n const getTranslations = (locale: string) => {\n return (component: string) => {\n return dictionary.current.get(locale).get(component);\n };\n };\n\n const fetchTranslations = async (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => {\n if (Object.keys(i18n).length === 0) {\n return;\n }\n const response = await fetch(\n `/api/__gemi__/services/i18n/translations/${\n locale || currentLocale\n }${pathname === \"/\" ? \"\" : pathname}`,\n {\n signal,\n },\n );\n const translations = await response.json();\n updateDictionary(translations);\n };\n\n return (\n <I18nContext.Provider\n value={{\n getComponentTranslations: getTranslations(currentLocale),\n locale: currentLocale,\n changeLocale,\n updateDictionary,\n fetchTranslations,\n supportedLocales: i18n.supportedLocales,\n defaultLocale: i18n.defaultLocale,\n }}\n >\n {props.children}\n </I18nContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport type { UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport { I18nContext } from \"./I18nContext\";\n\ntype Options<T extends ViewPaths> = UrlParser<T> extends Record<string, never>\n ? {\n search?: Record<string, string | number | boolean | undefined | null>;\n shallow?: boolean;\n hash?: string;\n locale?: string;\n }\n : {\n search?: Record<string, string | number | boolean | undefined | null>;\n params: UrlParser<T>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n };\n\nexport function useNavigate() {\n const { history, setNavigationAbortController } =\n useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n function action(pushOrReplace: \"push\" | \"replace\") {\n return async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n const navigationAbortController = new AbortController();\n if (setNavigationAbortController) {\n setNavigationAbortController(navigationAbortController);\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n shallow,\n locale,\n hash,\n } = {\n params: {},\n shallow: false,\n locale: null,\n hash: \"\",\n ...options,\n };\n\n const urlSearchParams = new URLSearchParams(search);\n let localeSegment = location.locale;\n if (locale) {\n localeSegment = locale;\n }\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const routePath = applyParams(path, params);\n const navigationPath = [\n `${localeSegment ? `/${localeSegment}` : \"\"}${routePath === \"/\" ? \"\" : routePath}`,\n urlSearchParams.toString(),\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n\n const finalPath = [navigationPath, hash].filter(Boolean).join(\"\");\n\n if (shallow) {\n history?.[pushOrReplace](finalPath, { shallow });\n return;\n }\n\n history?.[pushOrReplace](finalPath === '' ? '/' : finalPath);\n };\n }\n\n return {\n push: action(\"push\"),\n replace: action(\"replace\"),\n };\n}\n","import { useContext } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { RouteStateContext } from \"./RouteStateContext\";\nimport { useParams } from \"./useParams\";\n\ntype SearchParamsCallback = (\n search: Record<string, any>,\n shallow: boolean,\n) => void;\n\nclass SearchParams {\n constructor(\n private searchParams: URLSearchParams,\n private callback: SearchParamsCallback,\n ) {}\n\n get(key: string) {\n return this.searchParams.get(key);\n }\n\n set(key: Record<string, string | ((state: string) => string)>): SearchParams;\n set(key: string, value: string | ((state: string) => string)): SearchParams;\n set(key: any, value?: any) {\n let entries: Record<string, any> = {};\n if (typeof key === \"string\") {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n entries[key] = _value;\n } else {\n entries = (key as any) ?? {};\n }\n for (const [key, value] of Object.entries(entries)) {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n this.searchParams.set(key, _value);\n }\n return this;\n }\n\n append(key: string, value: string) {\n this.searchParams.append(key, value);\n return this;\n }\n\n sort() {\n this.searchParams.sort();\n return this;\n }\n\n clear() {\n this.searchParams = new URLSearchParams();\n return this;\n }\n\n delete(key: string | string[]) {\n const keys = Array.isArray(key) ? key : [key];\n for (const key of keys) {\n this.searchParams.delete(key);\n }\n return this;\n }\n\n toJSON() {\n const map = new Map<string, string | string[]>();\n // @ts-ignore\n for (const [key, value] of this.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n\n return Object.fromEntries(map.entries());\n }\n\n toString() {\n return this.searchParams.toString();\n }\n\n push(mode: \"soft\" | \"hard\" = \"soft\") {\n this.callback(this.toJSON(), mode === \"soft\");\n }\n}\n\nexport function useSearchParams() {\n const { push } = useNavigate();\n const { search, pathname } = useContext(RouteStateContext);\n const params = useParams();\n\n const callback = (search: Record<string, never>, shallow: boolean) => {\n push(\n pathname as never,\n {\n params,\n search,\n shallow,\n } as any,\n );\n };\n\n const searchParams = new SearchParams(new URLSearchParams(search), callback);\n\n return searchParams;\n}\n","import { useContext } from \"react\";\nimport type { ViewPaths } from \"./types\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\ntype Pathname = ViewPaths;\n\nexport function useRoute() {\n const { pathname: _pathname } = useContext(RouteStateContext);\n return {\n pathname: _pathname,\n startsWith: (pathname: Pathname) => {\n return _pathname.startsWith(pathname);\n },\n };\n}\n","import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useSearchParams } from \"./useSearchParams\";\nimport { useRoute } from \"./useRoute\";\nimport { useParams } from \"./useParams\";\nimport { createPortal } from \"react-dom\";\n\nexport const HttpReload = () => {\n const { replace } = useNavigate();\n const searchParams = useSearchParams();\n const { pathname } = useRoute();\n const params = useParams();\n const [reloading, setReloading] = useState(false);\n\n const handleReload = () => {\n // The server recovered, so dismiss any Vite error overlay left on the page\n // (each element exposes a `close()` that also tears down its listeners).\n if (typeof document !== \"undefined\") {\n document.querySelectorAll(\"vite-error-overlay\").forEach((el: any) => {\n if (typeof el.close === \"function\") el.close();\n else el.remove();\n });\n }\n setReloading(true);\n // replace(pathname, {\n // params: params,\n // search: searchParams.toJSON(),\n // } as any)\n // .catch(console.log)\n // .finally(() => {\n // setReloading(false);\n // });\n };\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n if (!reloading || typeof document === \"undefined\") {\n return null;\n }\n return createPortal(\n <div className=\"fixed z-[1000] bottom-0 right-0 p-2\">\n <div className=\"p-2 bg-white text-black rounded-md shadow-md\">...</div>\n </div>,\n document.body,\n );\n};\n","/**\n * How long a prefetched payload stays usable. Long enough to cover the gap\n * between hovering a link and clicking it, short enough that a navigation is\n * not served a snapshot the visitor would notice as out of date.\n *\n * A payload cached here is committed wholesale on navigation — including into\n * the query cache via `hydrate` — so anything that invalidates page data has to\n * `clear()` this too. `useMutation` does exactly that on every successful\n * write; locale needs no such call, since the locale segment is part of the key.\n */\nexport const PREFETCH_TTL = 10_000;\n\n/**\n * Ceiling on retained payloads. Entries only leave on their own when a\n * navigation consumes them, and `viewport`/`render` on a long list warms links\n * that are mostly never clicked — each one a full page payload. Oldest goes\n * first, which is also the one closest to expiry.\n */\nexport const PREFETCH_MAX_ENTRIES = 12;\n\ninterface Entry {\n promise: Promise<unknown>;\n createdAt: number;\n}\n\n/**\n * Payloads fetched ahead of a navigation, keyed by the `.json` URL that\n * navigation would request. Entries are handed over once — a navigation that\n * consumes one becomes the live route data, so keeping a copy around would only\n * let a later visit render from a stale snapshot.\n */\nexport class PrefetchCache {\n private entries = new Map<string, Entry>();\n\n private isFresh(entry: Entry) {\n return Date.now() - entry.createdAt < PREFETCH_TTL;\n }\n\n /** Drops what has expired, then the oldest of whatever is still over budget. */\n private evict() {\n for (const [url, entry] of this.entries) {\n if (!this.isFresh(entry)) {\n this.entries.delete(url);\n }\n }\n while (this.entries.size >= PREFETCH_MAX_ENTRIES) {\n const oldest = this.entries.keys().next().value;\n if (oldest === undefined) {\n return;\n }\n this.entries.delete(oldest);\n }\n }\n\n /**\n * Runs `load` unless the same URL is already in flight or freshly cached, so\n * a link hovered repeatedly — or a screenful of eagerly prefetched links\n * pointing at one route — costs a single request.\n */\n prime(url: string, load: () => Promise<unknown>): Promise<unknown> {\n const existing = this.entries.get(url);\n if (existing && this.isFresh(existing)) {\n return existing.promise;\n }\n\n this.evict();\n\n const entry: Entry = { createdAt: Date.now(), promise: null as never };\n entry.promise = load()\n .catch(() => null)\n .then((payload) => {\n // A failed prefetch is dropped rather than remembered: the navigation\n // falls back to its own request and the next hover gets to retry.\n if (payload == null && this.entries.get(url) === entry) {\n this.entries.delete(url);\n }\n return payload;\n });\n\n this.entries.set(url, entry);\n return entry.promise;\n }\n\n /**\n * Hands the payload for `url` to a navigation, if one was prefetched and is\n * still fresh. Resolves to `null` when the prefetch failed, which callers\n * must treat as a miss.\n */\n take(url: string): Promise<unknown> | null {\n const entry = this.entries.get(url);\n if (!entry) {\n return null;\n }\n this.entries.delete(url);\n return this.isFresh(entry) ? entry.promise : null;\n }\n\n /**\n * Drops everything, for when the data behind these payloads may have moved\n * on. In-flight loads still settle; their entries are simply gone by then.\n */\n clear() {\n this.entries.clear();\n }\n\n /** Retained entries, fresh or not. Exposed for tests. */\n get size() {\n return this.entries.size;\n }\n}\n","/**\n * The `.json` URL a route's page data is served from.\n *\n * Prefetching and navigation have to agree on this string exactly — the\n * prefetch cache is keyed by it, and any disagreement silently turns every\n * prefetch into a wasted request plus a full fetch on click.\n */\nexport function routeDataUrl(options: {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Query string including the leading `?`, or empty. */\n search?: string;\n /** `/tr-TR` style prefix, or empty for the default locale. */\n localeSegment?: string;\n}) {\n const { pathname, search = \"\", localeSegment = \"\" } = options;\n // `/tr-TR/.json` names nothing — the locale segment is the whole path there.\n const path = localeSegment.length > 0 && pathname === \"/\" ? \"\" : pathname;\n return `${localeSegment}${path}.json${search}`;\n}\n","/** One streamed query result: `[path, variantKey, data]`. */\nexport type RouteQueryPayload = [string, string, any];\n\n/**\n * Reads a navigation payload response (#290).\n *\n * The body is NDJSON: the first line is the envelope (route data, meta,\n * partial info, already-resolved `prefetchedData`), later lines are\n * `[path, variantKey, data]` query results streamed as they settle\n * server-side. The returned promise resolves with the envelope as soon as\n * its line arrives — the caller commits the navigation immediately — while\n * the remaining lines keep draining in the background into `onQueryPayload`,\n * whose `hydrate()` settles any segment that suspended on that variant.\n *\n * Tolerates two other body shapes so every producer keeps working: a plain\n * single-JSON body with no trailing newline (error-path responses, buffering\n * proxies) parses as the envelope at end-of-stream, and a `Response` without\n * a readable `body` (test doubles) falls back to `.json()`.\n */\nexport async function readRoutePayload(\n response: Response,\n onQueryPayload?: (payload: RouteQueryPayload) => void,\n): Promise<any | null> {\n const reader = response.body?.getReader?.();\n if (!reader) {\n try {\n return await response.json();\n } catch {\n return null;\n }\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n return await new Promise<any | null>((resolve) => {\n let envelopeResolved = false;\n const emitEnvelope = (value: any | null) => {\n if (envelopeResolved) return;\n envelopeResolved = true;\n resolve(value);\n };\n\n const handleLine = (line: string) => {\n if (line.trim().length === 0) return;\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch (error) {\n console.error(\"[gemi] Unparseable route payload line\", error);\n emitEnvelope(null);\n return;\n }\n if (!envelopeResolved) {\n emitEnvelope(value);\n return;\n }\n if (Array.isArray(value) && value.length === 3) {\n onQueryPayload?.(value as RouteQueryPayload);\n }\n };\n\n (async () => {\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n let newline = buffer.indexOf(\"\\n\");\n while (newline !== -1) {\n const line = buffer.slice(0, newline);\n buffer = buffer.slice(newline + 1);\n handleLine(line);\n newline = buffer.indexOf(\"\\n\");\n }\n }\n buffer += decoder.decode();\n // A plain-JSON body has no trailing newline: the whole buffer is the\n // envelope. (For NDJSON bodies the buffer is empty here.)\n handleLine(buffer);\n emitEnvelope(null);\n } catch (error) {\n console.error(\"[gemi] Route payload stream failed\", error);\n emitEnvelope(null);\n }\n })();\n });\n}\n\n/**\n * Reads the response to the very end and returns the envelope with every\n * streamed query result merged into its `prefetchedData` — the settled\n * aggregate a `<Link prefetch>` warms ahead of a click, equivalent to what\n * the old blocking payload contained. Buffering is the point here: a hover\n * prefetch has time, and the cache stores one complete payload.\n */\nexport async function readSettledRoutePayload(\n response: Response,\n): Promise<any | null> {\n if (typeof response.text !== \"function\") {\n // Test doubles that only implement `.json()`.\n try {\n return await response.json();\n } catch {\n return null;\n }\n }\n\n let text: string;\n try {\n text = await response.text();\n } catch {\n return null;\n }\n\n const lines = text.split(\"\\n\").filter((line) => line.trim().length > 0);\n if (lines.length === 0) return null;\n\n let envelope: any;\n try {\n envelope = JSON.parse(lines[0]);\n } catch {\n return null;\n }\n\n for (const line of lines.slice(1)) {\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch {\n continue;\n }\n if (Array.isArray(value) && value.length === 3) {\n const [path, variantKey, data] = value as RouteQueryPayload;\n envelope.prefetchedData ??= {};\n envelope.prefetchedData[path] ??= {};\n envelope.prefetchedData[path][variantKey] = data;\n }\n }\n return envelope;\n}\n","import type { ComponentTree } from \"../types\";\n\nexport function flattenComponentTree(componentTree: ComponentTree): string[] {\n let out: string[] = [];\n for (const [root, branches] of componentTree) {\n out.push(root, ...flattenComponentTree(branches).flat());\n }\n return Array.from(new Set(out));\n}\n","import { createContext, lazy, useMemo, type PropsWithChildren } from \"react\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\nimport type { ServerDataContextValue } from \"./ServerDataProvider\";\n\ndeclare const window: {\n __GEMI_DATA__: ServerDataContextValue;\n loaders: Record<\n string,\n () => Promise<{\n default: React.ComponentType<unknown>;\n }>\n >;\n} & Window;\n\n/**\n * Resolved view modules, not just their default exports. A route segment's\n * `Suspense` fallback and error UI come from optional named exports\n * (`Loading`, `Error`), and those have to be readable synchronously\n * while rendering — so every path that loads a view chunk records the module\n * here. Browsers dedupe the underlying dynamic import, so calling\n * `loadViewModule` repeatedly is free.\n */\nconst viewModules = new Map<string, Record<string, any>>();\nconst viewModuleListeners = new Set<() => void>();\n\nexport function loadViewModule(name: string): Promise<any> {\n const loader =\n typeof window !== \"undefined\" ? window.loaders?.[name] : undefined;\n if (!loader) return Promise.resolve(null);\n return Promise.resolve(loader()).then((mod) => {\n const isNew = !viewModules.has(name);\n viewModules.set(name, mod);\n // Notify on first registration so a `Route` that rendered before its\n // module arrived re-reads it — otherwise a hard load could suspend into\n // a `null` fallback while the view's `Loading` export sits in the module.\n if (isNew) {\n for (const listener of viewModuleListeners) listener();\n }\n return mod;\n });\n}\n\nexport function subscribeViewModules(listener: () => void) {\n viewModuleListeners.add(listener);\n return () => {\n viewModuleListeners.delete(listener);\n };\n}\n\nexport function getViewModule(name: string) {\n return viewModules.get(name);\n}\n\nlet viewImportMap: Record<string, ReturnType<typeof lazy>> | null = null;\nif (typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\") {\n viewImportMap = {};\n const { componentTree = [] } = window.__GEMI_DATA__ ?? {};\n\n for (const viewName of flattenComponentTree(componentTree)) {\n viewImportMap[viewName] = lazy(() => loadViewModule(viewName));\n }\n}\n\nexport const ComponentsContext = createContext({\n viewImportMap,\n getViewModule,\n});\n\nexport const ComponentsProvider = (\n props: PropsWithChildren<{\n viewImportMap: typeof viewImportMap;\n /**\n * Server only: the fully-loaded view modules, so `Loading`/`Error`\n * exports resolve during a streaming render. The browser leaves this\n * unset and reads the registry `loadViewModule` fills instead.\n */\n modules?: Record<string, Record<string, any>>;\n }>,\n) => {\n const { modules } = props;\n const value = useMemo(\n () => ({\n viewImportMap: props.viewImportMap ?? viewImportMap,\n getViewModule: modules\n ? (name: string) => modules[name] ?? getViewModule(name)\n : getViewModule,\n }),\n [props.viewImportMap, modules],\n );\n return (\n <ComponentsContext.Provider value={value}>\n {props.children}\n </ComponentsContext.Provider>\n );\n};\n","import { type Action, type History, createBrowserHistory } from \"history\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n} from \"react\";\nimport { Subject } from \"../utils/Subject\";\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { ProgressManager } from \"./ProgressManager\";\nimport { HttpReload } from \"./HttpReload\";\nimport type { Breadcrumb } from \"./useBreadcrumbs\";\nimport type { RouteState } from \"./RouteStateContext\";\nimport { I18nContext } from \"./I18nContext\";\nimport { PrefetchCache } from \"./PrefetchCache\";\nimport { routeDataUrl } from \"./helpers/routeDataUrl\";\nimport { readSettledRoutePayload } from \"./helpers/readRoutePayload\";\nimport { loadViewModule } from \"./ComponentContext\";\n\nexport interface PrefetchTarget {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Query string including the leading `?`, or empty. */\n search?: string;\n /** `/tr-TR` style prefix, or empty for the default locale. */\n localeSegment?: string;\n}\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n }\n}\n\ninterface ClientRouterContextValue {\n viewEntriesSubject: Subject<string[]>;\n history: History | null;\n updatePageData: (\n pageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => void;\n getPageData: (key: string, pathname: string) => Record<string, unknown>;\n getScrollPosition: (path: string) => number;\n getViewPathsFromPathname: (pathname: string) => string[];\n getRoutePathnameFromHref: (href: string) => string | null;\n isNavigatingSubject: Subject<boolean>;\n setNavigationAbortController: (controller: AbortController) => void;\n progressManager: ProgressManager;\n fetchRouteCSS: (routePath: string) => Promise<void>;\n prefetchRoute: (target: PrefetchTarget) => Promise<void>;\n takePrefetched: (url: string) => Promise<unknown> | null;\n clearPrefetchCache: () => void;\n breadcrumbsCache: Map<string, Breadcrumb>;\n routerSubject: Subject<RouteState>;\n urlLocaleSegment: string | null;\n}\n\nexport const ClientRouterContext = createContext(\n {} as ClientRouterContextValue,\n);\n\ninterface ClientRouterProviderProps {\n pathname: string;\n routeManifest: Record<string, string[]>;\n cssManifest: Record<string, string[]>;\n pageData: Record<string, unknown>;\n currentPath: string;\n urlLocaleSegment: string | null;\n params: Record<string, string>;\n searchParams: string;\n is404: boolean;\n is500: boolean;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\nexport const ClientRouterProvider = (\n props: PropsWithChildren<ClientRouterProviderProps>,\n) => {\n const {\n children,\n pathname,\n currentPath,\n is404,\n is500,\n routeManifest,\n cssManifest,\n pageData,\n params,\n searchParams,\n breadcrumbs,\n urlLocaleSegment,\n } = props;\n const navigationAbortControllerRef = useRef(new AbortController());\n const [isNavigatingSubject] = useState(() => {\n return new Subject<boolean>(false);\n });\n\n const { supportedLocales = [], locale } = useContext(I18nContext);\n\n const [progressManager] = useState(new ProgressManager(isNavigatingSubject));\n const [prefetchCache] = useState(() => new PrefetchCache());\n const pageDataRef = useRef(structuredClone(pageData));\n const scrollHistoryRef = useRef<Map<string, number>>(new Map());\n const breadcrumbsCache = useRef<Map<string, Breadcrumb>>(\n new Map(Object.entries(breadcrumbs)),\n );\n\n const initalViewEntries = is404\n ? [\"404\"]\n : is500\n ? [\"500\"]\n : (routeManifest[pathname] ?? [\"404\"]);\n const viewEntriesSubject = useRef(new Subject<string[]>(initalViewEntries));\n\n const [routerSubject] = useState(() => {\n return new Subject<RouteState>({\n views: initalViewEntries,\n params,\n search: searchParams,\n state: {},\n pathname,\n hash: \"\",\n action: null as Action | null,\n routePath: currentPath,\n locale,\n });\n });\n\n const [history] = useState<History | null>(() => {\n let history: History | null = null;\n\n if (typeof window !== \"undefined\") {\n history = createBrowserHistory();\n }\n return history;\n });\n\n const findMatchingRouteFromParams = useMemo(\n () => (pathname: string) => {\n let routePath = pathname.replace(\"/en-US\", \"\").replace(\"/tr-TR\", \"\");\n routePath = routePath === \"\" ? \"/\" : routePath;\n const candidates: string[] = [];\n for (const route of Object.keys(routeManifest)) {\n const urlPattern = new URLPattern({ pathname: route });\n if (urlPattern.test({ pathname: routePath })) {\n candidates.push(route);\n }\n }\n const sortedCandidates = candidates.sort((a, b) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n });\n\n return (sortedCandidates ?? [])[0];\n },\n [routeManifest],\n );\n\n const getViewPathsFromPathname = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n return routeManifest[route] ?? [];\n },\n [findMatchingRouteFromParams, routeManifest],\n );\n\n const getRoutePathnameFromHref = useMemo(\n () => (href: string) => {\n const route = findMatchingRouteFromParams(href);\n return route;\n },\n [findMatchingRouteFromParams],\n );\n\n const getParams = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n const urlPattern = new URLPattern({ pathname: route });\n return urlPattern.exec({ pathname })?.pathname.groups ?? {};\n },\n [findMatchingRouteFromParams],\n );\n\n useEffect(() => {\n history?.listen(({ location, action }) => {\n if (!window.scrollHistory) {\n window.scrollHistory = new Map();\n }\n const { hash, pathname, search } = routerSubject.getValue();\n const key = [pathname, search, hash].join(\"\");\n window.scrollHistory.set(key, window.scrollY);\n let _pathname = location.pathname;\n let _locale = null;\n for (const locale of supportedLocales) {\n if (_pathname.startsWith(`/${locale}`)) {\n _locale = locale;\n _pathname = _pathname.replace(`/${locale}`, \"\");\n break;\n }\n }\n _pathname = _pathname === \"\" ? \"/\" : _pathname;\n const routePath = getRoutePathnameFromHref(_pathname);\n routerSubject.next({\n views: getViewPathsFromPathname(_pathname),\n params: getParams(_pathname),\n search: location.search,\n state: location.state as Record<string, unknown>,\n pathname: _pathname,\n action,\n routePath,\n hash: location.hash,\n locale: _locale,\n });\n });\n }, [\n supportedLocales,\n history,\n routerSubject,\n getParams,\n getRoutePathnameFromHref,\n getViewPathsFromPathname,\n ]);\n\n const updatePageData = (\n newPageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => {\n const [key, value] = Object.entries(newPageData)[0];\n if (!pageDataRef.current?.[key]) {\n pageDataRef.current[key] = {};\n }\n for (const b in breadcrumbs) {\n breadcrumbsCache.current.set(b, breadcrumbs[b]);\n }\n\n pageDataRef.current[key] = value;\n };\n\n const getPageData = (key: string, pathname: string) => {\n return pageDataRef.current[pathname]?.[key];\n };\n\n const setNavigationAbortController = (controller: AbortController) => {\n navigationAbortControllerRef.current.abort();\n navigationAbortControllerRef.current = controller;\n };\n\n const fetchRouteCSS = async (routePath: string) => {\n const views = routeManifest[routePath];\n if (!views) {\n return;\n }\n const cssFiles = views\n .flatMap((view) => {\n return cssManifest?.[view];\n })\n .filter(Boolean)\n .filter((file) => !document.getElementById(file));\n\n if (cssFiles.length === 0) {\n return;\n }\n\n async function fetchCSS(path: string) {\n const response = await fetch(`/${path}`);\n const content = response.text();\n return {\n content,\n id: path,\n };\n }\n const result = await Promise.all(cssFiles?.map((file) => fetchCSS(file)));\n for (const { content, id } of result) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = await content;\n document.head.appendChild(style);\n }\n };\n\n /**\n * Warms everything a navigation to `target` would need: the route's page\n * data, its stylesheets and its component chunks.\n *\n * The payload is requested *without* the partial-render header, because the\n * route on screen when the link is prefetched is not necessarily the one it\n * will be clicked from — a partial response computed against the wrong base\n * has nothing sound to merge onto. A full payload is always safe to commit.\n *\n * It carries `Purpose: prefetch` so applications can tell speculative traffic\n * from a real visit — a route's handlers run either way, and a `viewport`\n * page multiplies that by the number of links on it.\n */\n const prefetchRoute = async (target: PrefetchTarget) => {\n if (typeof window === \"undefined\") {\n return;\n }\n const { pathname, search = \"\", localeSegment = \"\" } = target;\n const routePath = getRoutePathnameFromHref(pathname);\n if (!routePath) {\n return;\n }\n\n const url = routeDataUrl({ pathname, search, localeSegment });\n\n // Alongside the payload rather than joined to it: a stylesheet that 404s\n // must not throw away page data that arrived perfectly well.\n fetchRouteCSS(routePath).catch(() => {});\n // Through `loadViewModule` so each view's `Loading`/`Error`\n // exports are registered by the time the route commits.\n for (const view of routeManifest[routePath] ?? []) {\n loadViewModule(view);\n }\n\n await prefetchCache.prime(url, async () => {\n const response = await fetch(url, {\n headers: { Purpose: \"prefetch\" },\n });\n if (!response.ok) {\n return null;\n }\n // The settled aggregate: every streamed query result merged back into\n // the envelope's `prefetchedData` — a warmed payload is stored whole,\n // exactly as the blocking response used to arrive (#290).\n return await readSettledRoutePayload(response);\n });\n };\n\n return (\n <ClientRouterContext.Provider\n value={{\n isNavigatingSubject,\n prefetchRoute,\n takePrefetched: (url: string) => prefetchCache.take(url),\n clearPrefetchCache: () => prefetchCache.clear(),\n getViewPathsFromPathname,\n history,\n getScrollPosition: (path: string) => {\n return scrollHistoryRef.current.get(path) || 0;\n },\n viewEntriesSubject: viewEntriesSubject.current,\n updatePageData,\n getPageData,\n getRoutePathnameFromHref,\n setNavigationAbortController,\n progressManager,\n fetchRouteCSS,\n breadcrumbsCache: breadcrumbsCache.current,\n routerSubject,\n urlLocaleSegment,\n }}\n >\n {children}\n {/* @ts-ignore */}\n {import.meta.hot && <HttpReload />}\n </ClientRouterContext.Provider>\n );\n};\n","import { useContext, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\ntype Methods = {\n POST: {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: RPC[K];\n };\n PUT: {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: RPC[K];\n };\n PATCH: {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: RPC[K];\n };\n DELETE: {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: RPC[K];\n };\n};\n\nfunction applyParams(url: string, params: Record<string, any> = {}) {\n let out = url;\n\n for (const [key, value] of Object.entries(params)) {\n out = out.replace(`:${key}?`, value).replace(`:${key}`, value);\n }\n return out;\n}\n\ntype Config<T> = {\n autoInvalidate?: boolean;\n onSuccess: (data: T) => void;\n onError: (error: MutationError) => void;\n onCanceled?: () => void;\n};\n\nconst defaultOptions: Config<any> = {\n autoInvalidate: false,\n onSuccess: () => {},\n onError: (_: MutationError) => {},\n onCanceled: () => {},\n};\n\ntype Data<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<any, infer T, any>\n ? UnwrapPromise<T>\n : never;\n\ntype Body<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<infer T, any, any> ? T : never;\n\ntype MutationError =\n | {\n kind: \"validation_error\";\n messages: Record<string, any>;\n }\n | {\n kind: \"form_error\";\n message: string;\n }\n | {\n kind: \"server_error\";\n message: string;\n }\n | {\n kind: \"not_authorized\";\n message: string;\n }\n | {\n kind: \"insufficient_permissions\";\n message: string;\n };\n\ntype ParseParams<T> = UrlParser<`${T & string}`>;\n\ntype State<T> = {\n data: T | null;\n error: MutationError | null;\n loading: boolean;\n};\n\nexport function useMutation<\n M extends keyof Methods,\n K extends keyof Methods[M],\n T = Data<M, K>,\n U = Body<M, K>,\n>(\n method: M,\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>>, search?: Record<string, string> },\n config?: Partial<Config<T>>,\n ]\n) {\n const _params = useParams();\n // A write may have moved the data behind any page warmed ahead of a click,\n // and a prefetched payload is committed wholesale — into the query cache too.\n const { clearPrefetchCache } = useContext(ClientRouterContext);\n const [state, setState] = useState<State<T>>({\n data: null,\n error: null,\n loading: false,\n });\n\n const [abortController, setAbortController] = useState(\n () => new AbortController(),\n );\n\n const formData = useRef(new FormData());\n\n async function trigger(input?: U): Promise<T> {\n setState({\n data: state.data,\n error: state.error,\n loading: true,\n });\n const [inputs = {}, options = defaultOptions] = args ?? [];\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const search = \"search\" in inputs ? inputs.search : {};\n const searchParams = new URLSearchParams(search);\n const finalUrl = [applyParams(String(url).replace(`${method}:`, \"\"), params), searchParams.toString()].filter(Boolean).join(\"?\");\n\n let body = null;\n\n const contentType =\n typeof input === \"undefined\" || input instanceof FormData\n ? {}\n : { \"Content-Type\": \"application/json\" };\n\n if (input instanceof FormData) {\n body = input;\n } else if (typeof input === \"undefined\") {\n body = formData.current;\n } else if (input) {\n body = JSON.stringify(input);\n }\n\n try {\n const response = await fetch(`/api${finalUrl}`, {\n method,\n headers: {\n ...contentType,\n },\n ...(body ? { body } : {}),\n signal: abortController.signal,\n });\n\n formData.current = new FormData();\n\n const data = await response.json();\n\n if (!response.ok) {\n setState({\n data: null,\n error: data.error,\n loading: false,\n });\n\n options?.onError?.(data);\n return;\n }\n\n clearPrefetchCache?.();\n options.onSuccess(data);\n\n setState({\n data,\n error: null,\n loading: false,\n });\n\n return data as any;\n } catch (error) {\n formData.current = new FormData();\n options?.onError?.(error);\n setState({\n data: null,\n error,\n loading: false,\n });\n }\n }\n\n trigger.formData = (formData: FormData) => {\n return trigger(formData as U);\n };\n\n return {\n data: state.data as T,\n error: state.error as any,\n loading: state.loading,\n formData: formData.current,\n cancel: () => {\n const [, options = defaultOptions] = args ?? [];\n abortController.abort();\n setAbortController(new AbortController());\n setState({\n data: state.data,\n error: state.error,\n loading: false,\n });\n\n formData.current = new FormData();\n options.onCanceled();\n },\n trigger,\n };\n}\n\nexport function usePost<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"POST\", url, ...(args as any));\n}\n\nexport function usePut<K extends keyof Methods[\"PUT\"], T = Data<\"PUT\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PUT\", url, ...(args as any));\n}\n\nexport function usePatch<\n K extends keyof Methods[\"PATCH\"],\n T = Data<\"PATCH\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PATCH\", url, ...(args as any));\n}\n\nexport function useDelete<\n K extends keyof Methods[\"DELETE\"],\n T = Data<\"DELETE\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"DELETE\", url, ...(args as any));\n}\n\nexport function useUpload<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n const [state, setState] = useState<\"idle\" | \"uploading\" | \"done\" | \"error\">(\n \"idle\",\n );\n const [progress, setProgress] = useState(0);\n const _params = useParams();\n const { clearPrefetchCache } = useContext(ClientRouterContext);\n const abortRef = useRef<VoidFunction | null>(null);\n\n const [inputs = {}, options = defaultOptions] = args ?? [];\n\n const cancel = () => {\n if (abortRef.current) {\n abortRef.current();\n options.onCanceled?.();\n setState(\"idle\");\n setProgress(0);\n }\n };\n\n const trigger = async (fileList: FileList | null | File): Promise<T> => {\n if (!fileList) {\n return;\n }\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const finalUrl = applyParams(String(url).replace(\"POST:\", \"\"), params);\n\n const method = \"POST\";\n const action = `/api${finalUrl}`;\n const data = new FormData();\n if (fileList instanceof FileList) {\n for (const file of Array.from(fileList)) {\n data.append(\"file\", file);\n }\n } else {\n data.append(\"file\", fileList);\n }\n const xhr = new XMLHttpRequest();\n abortRef.current = () => {\n xhr.abort();\n };\n\n try {\n const result = await new Promise<Response>((resolve, reject) => {\n xhr.responseType = \"blob\";\n xhr.onreadystatechange = async () => {\n if (xhr.readyState !== 4) {\n // done\n return;\n }\n\n const response = new Response(xhr.response, {\n status: xhr.status,\n statusText: xhr.statusText,\n });\n\n resolve(response);\n };\n\n xhr.addEventListener(\"error\", () => {\n reject(new TypeError(\"Failed to fetch\"));\n });\n\n xhr.upload.addEventListener(\"loadstart\", () => {\n setProgress(0);\n });\n xhr.upload.addEventListener(\"loadend\", () => {\n setProgress(1);\n });\n\n xhr.upload.addEventListener(\"progress\", (event) => {\n setProgress(event.loaded / event.total);\n });\n\n xhr.open(method, action, true);\n xhr.send(data);\n });\n setState(\"uploading\");\n if (!result.ok) {\n let error: MutationError = {\n kind: \"server_error\",\n message: result.statusText,\n };\n try {\n const data = await result.json();\n error = data.error;\n } catch (e) {\n // do nothing\n }\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n const json = await result.json();\n clearPrefetchCache?.();\n options?.onSuccess?.(json);\n return json;\n } catch (error) {\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n };\n\n return {\n state,\n progress,\n trigger,\n cancel,\n };\n}\n","import { useContext } from \"react\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { NestedPrettify, UnwrapPromise } from \"../utils/type\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nimport type { RPC } from \"./rpc\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport type { UrlParser } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> = GetRPC[T] extends ApiRouterHandler<\n any,\n infer Data,\n any\n>\n ? UnwrapPromise<Data>\n : never;\n\nexport function useMutate() {\n const { getResource } = useContext(QueryManagerContext);\n return function mutate<T extends keyof GetRPC>(\n options: {\n path: T;\n params?: UrlParser<`${T & string}`>;\n search?: Record<string, any>;\n },\n fn?:\n | ((data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>)\n | NestedPrettify<Data<T>>,\n ) {\n const { path, params = {}, search = {} } = options ?? {};\n const normalPath = applyParams(path, params);\n const resource = getResource(normalPath);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n return resource.mutate.call(resource, variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n if (!fn) {\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n };\n}\n","import {\n createContext,\n useContext,\n type ComponentProps,\n type FormEvent,\n useRef,\n useEffect,\n useSyncExternalStore,\n useCallback,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport { useMutation } from \"./useMutation\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { Subject } from \"../utils/Subject\";\n\ntype Any = any;\n\ninterface MutationContextValue {\n isPending: boolean;\n result: null | Any;\n validationErrors: Record<string, string[]>;\n formError: null | string;\n formDataSubject: React.RefObject<Subject<FormData>>;\n}\n\nconst MutationContext = createContext({\n isPending: false,\n result: null,\n} as MutationContextValue);\n\ntype GetResult<T> =\n T extends ApiRouterHandler<Any, infer Result, Any>\n ? UnwrapPromise<Result>\n : never;\n\ntype PostRequests = {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PutRequests = {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: GetResult<RPC[K]>;\n};\n\ntype DeleteRequests = {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PatchRequests = {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype Methods = {\n POST: PostRequests;\n PUT: PutRequests;\n DELETE: DeleteRequests;\n PATCH: PatchRequests;\n};\n\ninterface FormProps<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> extends Omit<ComponentProps<\"form\">, \"action\" | \"onError\"> {\n method?: M;\n action: K;\n onSuccess?: (result: Methods[M][K], form: HTMLFormElement) => void;\n onError?: (error: Any, form: HTMLFormElement) => void;\n params?: Partial<UrlParser<`${K & string}`>>;\n search?: Record<string, string>;\n dynamicInputs?: (formData: FormData) => Record<string, any>;\n}\n\nexport function Form<\n K extends keyof Methods[T],\n T extends keyof Methods = \"POST\",\n>(props: FormProps<T, K>) {\n const _params = useParams();\n const {\n method = \"POST\",\n action,\n onSuccess = () => {},\n onError = () => {},\n params,\n search = {},\n className,\n dynamicInputs = () => ({}),\n ...formProps\n } = \"params\" in props\n ? { ...props, params: { ..._params, ...props.params } }\n : { ...props, params: _params };\n const formRef = useRef<HTMLFormElement>(null);\n const { __csrf } = useContext(ServerDataContext);\n const formDataSubject = useRef(new Subject(new FormData()));\n\n const updateFormData = useCallback(() => {\n formDataSubject.current.next(new FormData(formRef.current));\n }, []);\n\n useEffect(() => {\n if (!formRef.current) return;\n\n formRef.current.addEventListener(\"input\", updateFormData);\n\n const observer = new MutationObserver(() => {\n const formData = new FormData(formRef.current);\n formDataSubject.current.next(formData);\n });\n\n formRef.current.querySelectorAll(\"input\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"select\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"textarea\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n return () => {\n observer.disconnect();\n if (formRef.current) {\n formRef.current.removeEventListener(\"input\", updateFormData);\n }\n };\n }, [updateFormData]);\n\n const { trigger, data, error, loading } = useMutation(\n method,\n String(action) as Any,\n {\n params,\n search,\n } as Any,\n {\n onSuccess: (data) => onSuccess(data as Any, formRef.current),\n onError: (error) => onError(error, formRef.current),\n },\n );\n\n const handleSubmit = async (e: FormEvent) => {\n if (loading) {\n return;\n }\n e.preventDefault();\n if (!formRef.current) {\n return;\n }\n const formData = new FormData(formRef.current);\n for (const [key, value] of Object.entries(dynamicInputs(formData))) {\n formData.append(key, value as any);\n }\n trigger(formData as any);\n };\n\n const validationErrors =\n error?.kind === \"validation_error\" ? error.messages : {};\n\n const formError = error?.kind === \"form_error\" ? error.message : null;\n\n return (\n <MutationContext.Provider\n value={{\n isPending: loading,\n result: data,\n validationErrors,\n formError,\n formDataSubject,\n }}\n >\n <form\n className={[\"group\", className].filter(Boolean).join(\" \")}\n data-loading={loading}\n ref={formRef}\n onSubmit={handleSubmit}\n {...formProps}\n >\n <input type=\"hidden\" name=\"__csrf\" value={__csrf} />\n {props.children}\n </form>\n </MutationContext.Provider>\n );\n}\n\nexport function useMutationStatus() {\n const { isPending } = useContext(MutationContext);\n\n return { isPending };\n}\n\nexport function useFormStatus() {\n const { isPending, validationErrors, formError } =\n useContext(MutationContext);\n\n return { isPending, validationErrors, formError };\n}\n\nexport function useFormData() {\n const context = useContext(MutationContext);\n\n const { formDataSubject } = context;\n\n return useSyncExternalStore(\n formDataSubject.current.subscribe.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n );\n}\n\nexport const ValidationErrors = (props: {\n name: string;\n className?: string;\n render?: (props: ComponentProps<\"div\">) => React.JSX.Element;\n}) => {\n const {\n render = (props: ComponentProps<\"div\">) => <div {...props} />,\n name,\n } = props;\n const { validationErrors } = useContext(MutationContext);\n\n const Comp = render;\n\n if (validationErrors[name]?.length > 0) {\n return (\n <>\n {validationErrors[name].map((error) => {\n return (\n <Comp className={props.className} key={error}>\n {error}\n </Comp>\n );\n })}\n </>\n );\n }\n\n return null;\n};\n\nexport const FormFieldContainer = (\n props: ComponentProps<\"div\"> & { name: string },\n) => {\n const { name, children, ...rest } = props;\n const { validationErrors } = useContext(MutationContext);\n const errors = validationErrors[name] || [];\n return (\n <div data-has-error={errors.length > 0} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const FormError = (props: ComponentProps<\"div\">) => {\n const { formError } = useContext(MutationContext);\n\n if (formError) {\n return <div {...props}>{formError}</div>;\n }\n\n return null;\n};\n","import { useContext, useSyncExternalStore } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useIsNavigationPending() {\n const { isNavigatingSubject } = useContext(ClientRouterContext);\n const isNavigating = useSyncExternalStore(\n isNavigatingSubject.subscribe,\n isNavigatingSubject.getValue,\n isNavigatingSubject.getValue,\n );\n\n return isNavigating;\n}\n","import { useContext, useEffect, useState } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useNavigationProgress() {\n const { progressManager } = useContext(ClientRouterContext);\n const [progress, setProgress] = useState(progressManager.state.getValue());\n\n useEffect(() => {\n const unsub = progressManager.state.subscribe((p) => setProgress(p));\n return () => {\n unsub();\n };\n }, [progressManager.state]);\n\n return progress;\n}\n","import { useCallback, useContext } from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewPaths } from \"./types\";\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\n/**\n * A prefetch spends the visitor's data on a page they may never open, so it\n * stands down when they have asked for less of that or the connection cannot\n * spare it. `navigator.connection` only exists in Chromium — everywhere else\n * there is nothing to go on and prefetching proceeds.\n */\nfunction connectionRefusesPrefetch() {\n const connection = (navigator as any)?.connection;\n if (!connection) {\n return false;\n }\n if (connection.saveData) {\n return true;\n }\n return [\"slow-2g\", \"2g\"].includes(connection.effectiveType);\n}\n\ntype Options<T extends ViewPaths> =\n UrlParser<T> extends Record<string, never>\n ? {\n search?: Search;\n locale?: string;\n }\n : {\n search?: Search;\n params: UrlParser<T>;\n locale?: string;\n };\n\n/**\n * Warms a route ahead of the navigation to it: its page data, its stylesheets\n * and its component chunks. A navigation that lands on a prefetched route\n * renders from the cached payload instead of waiting on a request.\n *\n * The URL is built exactly the way `useNavigate` builds it — the prefetch is\n * only ever used by a navigation that asks for the same one.\n */\nexport function usePrefetch() {\n const { prefetchRoute } = useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n const currentPathname = location.pathname;\n const currentSearch = location.search;\n const currentLocale = location.locale;\n\n return useCallback(\n async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n if (typeof window === \"undefined\" || !prefetchRoute) {\n return;\n }\n\n if (connectionRefusesPrefetch()) {\n return;\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n locale = null,\n } = { params: {}, search: {}, locale: null, ...options };\n\n let localeSegment = locale ?? currentLocale;\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const pathname = applyParams(path, params) || \"/\";\n // Matches `useNavigate`, which hands the search object straight to\n // `URLSearchParams` — the query string a click produces has to be the one\n // the payload was cached under.\n const queryString = new URLSearchParams(search as any).toString();\n const searchSegment = queryString.length > 0 ? `?${queryString}` : \"\";\n\n // The route already on screen has nothing to warm, and eagerly prefetched\n // links pointing back at it would just replay the current page's queries.\n if (pathname === currentPathname && searchSegment === currentSearch) {\n return;\n }\n\n await prefetchRoute({\n pathname,\n search: searchSegment,\n localeSegment: localeSegment ? `/${localeSegment}` : \"\",\n });\n },\n [\n prefetchRoute,\n defaultLocale,\n currentLocale,\n currentPathname,\n currentSearch,\n ],\n );\n}\n","import { useContext } from \"react\";\nimport { useRoute } from \"./useRoute\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport type Breadcrumb = {\n label: string;\n href: string;\n};\n\nexport function useBreadcrumbs() {\n const { pathname } = useRoute();\n const { getViewPathsFromPathname, breadcrumbsCache } =\n useContext(ClientRouterContext);\n\n let breadcrumbs: Breadcrumb[] = [];\n const viewPaths = getViewPathsFromPathname(pathname);\n for (const viewPath of viewPaths) {\n if (breadcrumbsCache.has(`${viewPath}:${pathname}`)) {\n breadcrumbs.push(breadcrumbsCache.get(`${viewPath}:${pathname}`));\n }\n }\n\n return breadcrumbs.filter((breadcrumb) => breadcrumb?.label.length > 0);\n}\n","import { createContext, useContext, type PropsWithChildren } from \"react\";\n\nconst RouteTransitionContext = createContext<{\n isTransitioning: boolean;\n targetPath: string;\n currentPath: string;\n}>({\n isTransitioning: false,\n targetPath: \"\",\n currentPath: \"\",\n});\n\ninterface RouteTransitionProviderProps {\n isPending: boolean;\n isFetching: boolean;\n transitionPath: [string, string];\n}\n\nexport const RouteTransitionProvider = (\n props: PropsWithChildren<RouteTransitionProviderProps>,\n) => {\n const { isPending, isFetching, transitionPath } = props;\n\n return (\n <RouteTransitionContext.Provider\n value={{\n isTransitioning: isPending || isFetching,\n targetPath: transitionPath[1],\n currentPath: transitionPath[0] || \"\",\n }}\n >\n {props.children}\n </RouteTransitionContext.Provider>\n );\n};\n\nexport function useRouteTransition() {\n const context = useContext(RouteTransitionContext);\n if (!context) {\n throw new Error(\n \"useRouteTransition must be used within a RouteTransitionProvider\",\n );\n }\n return context;\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n memo,\n type ComponentProps,\n type SyntheticEvent,\n} from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewResult } from \"./types\";\nimport { useNavigate } from \"./useNavigate\";\nimport type { ViewRPC } from \"./rpc\";\nimport type { Prettify } from \"../utils/type\";\nimport { useParams } from \"./useParams\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useRouteTransition } from \"./RouteTransitionProvider\";\nimport { usePrefetch } from \"./usePrefetch\";\n\ntype Views = {\n [K in keyof ViewRPC as K extends `view:${infer P}`\n ? P\n : never]: ViewResult<K>;\n};\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\n/**\n * When to warm the target route's data, styles and chunks.\n *\n * - `hover` — the moment the pointer arrives, or on touch or keyboard focus.\n * - `intent` — hover held long enough to read as intent, so a cursor sweeping\n * across a nav bar does not fire a request per link it crosses.\n * - `viewport` — as the link comes into view.\n * - `render` — as soon as the link renders.\n *\n * Several can be combined. The useful pairing is a bulk strategy with an\n * interactive one — `[\"viewport\", \"intent\"]` warms the link on the way past and\n * warms it again on approach if the cached payload has since gone stale.\n * `hover` and `intent` together is just `hover`, since it fires first.\n *\n * Every strategy stands down on metered or very slow connections.\n */\nexport type PrefetchStrategy = \"hover\" | \"intent\" | \"viewport\" | \"render\";\n\n/** How long the pointer has to rest on an `intent` link before it counts. */\nconst INTENT_DELAY = 100;\n\n/** How far ahead of the viewport a `viewport` link starts warming. */\nconst VIEWPORT_MARGIN = \"200px\";\n\ntype LinkBaseProps<T extends keyof Views> = Omit<\n ComponentProps<\"a\">,\n \"href\"\n> & {\n active?: boolean;\n href: T;\n hash?: string;\n /** Off unless set. `false` is accepted so it can be driven by a variable. */\n prefetch?: PrefetchStrategy | readonly PrefetchStrategy[] | false;\n params: UrlParser<T>;\n search?: T extends keyof Views\n ? Views[T][\"input\"] extends Record<string, never>\n ? Search\n : Prettify<Partial<Views[T][\"input\"]> & Search>\n : Search;\n};\n\ntype LinkProps<T extends keyof Views, U = UrlParser<T>> = U extends Record<\n string,\n never\n>\n ? Omit<LinkBaseProps<T>, \"params\">\n : LinkBaseProps<T>;\n\nfunction normalizeSearch(search: Search): Record<string, string> {\n return Object.fromEntries(\n Object.entries(search)\n .filter(([_k, v]) => v !== undefined && v !== null)\n .map(([k, v]) => [k, String(v)]),\n ) as Record<string, string>;\n}\n\nexport const Link = memo(<T extends keyof Views>(props: LinkProps<T>) => {\n const _params = useParams();\n const { isTransitioning, targetPath } = useRouteTransition();\n const {\n href,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onFocus,\n onBlur,\n ref,\n hash = \"\",\n active = false,\n prefetch,\n params = {},\n search = {},\n ...rest\n } = { params: _params, search: {}, ...props };\n const { defaultLocale } = useContext(I18nContext);\n const { push } = useNavigate();\n const location = useLocation();\n const prefetchRoute = usePrefetch();\n const searchParams = new URLSearchParams(normalizeSearch(search));\n\n const path = applyParams(href, params);\n // `applyParams` drops the trailing slash, so the root route comes back empty\n // where every pathname the router reports says `/`.\n const resolvedPath = path || \"/\";\n let urlLocaleSegment = location.locale;\n if (urlLocaleSegment === defaultLocale) {\n urlLocaleSegment = \"\";\n }\n\n const localeSegment = urlLocaleSegment ? `/${urlLocaleSegment}` : \"\";\n\n const targetHref = [\n [`${localeSegment}${path}`, searchParams.toString()]\n .filter((s) => s.length > 0)\n .join(\"?\"),\n hash,\n ].join(\"\");\n\n const currentHref = [location.pathname, location.search, location.hash]\n .filter((item) => !!item)\n .join(\"\");\n\n // Held in a ref because the prefetch callback is rebuilt on every router\n // render — an effect that depended on it would re-fire on renders that have\n // nothing to do with this link.\n const prefetchRouteRef = useRef(prefetchRoute);\n useEffect(() => {\n prefetchRouteRef.current = prefetchRoute;\n });\n\n // Clicking through to the path we are already on is a shallow navigation —\n // it moves the URL without fetching, so there is nothing to warm.\n const isShallowTarget = resolvedPath === location.pathname;\n\n const strategies = !prefetch\n ? []\n : Array.isArray(prefetch)\n ? prefetch\n : [prefetch];\n const uses = (strategy: PrefetchStrategy) => strategies.includes(strategy);\n // Effects below key off the strategies, which arrive as an array literal with\n // a fresh identity on every render. The names are what actually matters.\n const strategyKey = strategies.join(\",\");\n\n // Repeats are the cache's problem, not this component's: it collapses a\n // hover storm into one request and lets a hover past the TTL refresh a\n // payload that has gone stale.\n const runPrefetch = () => {\n if (strategies.length === 0 || isShallowTarget) {\n return;\n }\n prefetchRouteRef.current(href, { params, search } as never);\n };\n\n useEffect(() => {\n if (uses(\"render\")) {\n runPrefetch();\n }\n }, [strategyKey, targetHref]);\n\n const anchorRef = useRef<HTMLAnchorElement | null>(null);\n // A caller's own `ref` still has to reach them — under React 19 it arrives as\n // a plain prop, and the spread below would otherwise hand the element to one\n // of us and null to the other.\n //\n // Memoised because `Link` re-renders on every navigation in the app: a fresh\n // callback identity would have React detach and reattach the element each\n // time, handing a caller's ref callback a null it never asked for.\n const setAnchorRef = useCallback(\n (node: HTMLAnchorElement | null) => {\n anchorRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n useEffect(() => {\n if (!uses(\"viewport\")) {\n return;\n }\n const element = anchorRef.current;\n if (!element || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n // One shot: a link scrolled past and back is already warm, and if its entry\n // has expired the next hover or click pays for a fresh one.\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n observer.disconnect();\n runPrefetch();\n }\n },\n { rootMargin: VIEWPORT_MARGIN },\n );\n observer.observe(element);\n return () => observer.disconnect();\n }, [strategyKey, targetHref]);\n\n const intentTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const cancelIntent = () => {\n if (intentTimerRef.current !== null) {\n clearTimeout(intentTimerRef.current);\n intentTimerRef.current = null;\n }\n };\n useEffect(() => cancelIntent, []);\n\n /** A pointer arriving — the one signal `intent` waits on before believing. */\n const pointerArrived = () => {\n if (uses(\"hover\")) {\n runPrefetch();\n } else if (uses(\"intent\")) {\n cancelIntent();\n intentTimerRef.current = setTimeout(runPrefetch, INTENT_DELAY);\n }\n };\n\n /** Focus and touch are deliberate, so neither strategy makes them wait. */\n const linkTargeted = () => {\n if (uses(\"hover\") || uses(\"intent\")) {\n runPrefetch();\n }\n };\n\n /** Runs the caller's own handler first, then the prefetch trigger. */\n const prefetchOn =\n <E extends SyntheticEvent>(\n handler: ((event: E) => void) | undefined,\n trigger: () => void,\n ) =>\n (event: E) => {\n handler?.(event);\n trigger();\n };\n\n return (\n <a\n ref={setAnchorRef}\n data-active={active || currentHref === targetHref}\n // The resolved path, not the template: one template can back a whole list\n // of rows, and only the row that was clicked is heading anywhere.\n data-pending={isTransitioning && resolvedPath === targetPath}\n href={targetHref === '' ? '/' : targetHref}\n onClick={(e) => {\n if (typeof window !== \"undefined\") {\n if (currentHref === targetHref) {\n e.preventDefault();\n return;\n }\n }\n let currentPath = window.location.pathname.replace(localeSegment, \"\");\n currentPath = currentPath === \"\" ? \"/\" : currentPath;\n onClick?.(e);\n\n if (hash === \"\") {\n e.preventDefault();\n }\n push(href, {\n hash,\n search,\n params,\n shallow: path === currentPath,\n } as unknown as never);\n }}\n onMouseEnter={prefetchOn(onMouseEnter, pointerArrived)}\n onMouseLeave={prefetchOn(onMouseLeave, cancelIntent)}\n onTouchStart={prefetchOn(onTouchStart, linkTargeted)}\n onFocus={prefetchOn(onFocus, linkTargeted)}\n onBlur={prefetchOn(onBlur, cancelIntent)}\n {...rest}\n />\n );\n});\n","import { type ComponentProps, useEffect } from \"react\";\nimport type { Link } from \"./Link\";\n\nimport { useNavigate } from \"./useNavigate\";\n\nexport const Redirect = (\n props: ComponentProps<typeof Link> & { action: \"push\" | \"replace\" },\n) => {\n const { href, params = {}, search = {}, action = \"replace\" } = props;\n const { push, replace } = useNavigate();\n\n useEffect(() => {\n if (action === \"replace\") {\n replace(href, { params, search } as any);\n } else {\n push(href, { params, search } as any);\n }\n }, [replace, action, push, params, search, href]);\n\n return <></>;\n};\n","\"use client\";\nimport { createContext as l, Component as y, createElement as d, useContext as f, useState as p, useMemo as E, forwardRef as B } from \"react\";\nconst h = l(null), c = {\n didCatch: !1,\n error: null\n};\nclass m extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = c;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { error: t } = this.state;\n t !== null && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(c));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: s } = this.props;\n o && t.error !== null && C(e.resetKeys, s) && (this.props.onReset?.({\n next: s,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(c));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: s } = this.props, { didCatch: n, error: a } = this.state;\n let i = e;\n if (n) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n i = t(u);\n else if (o)\n i = d(o, u);\n else if (s !== void 0)\n i = s;\n else\n throw a;\n }\n return d(\n h.Provider,\n {\n value: {\n didCatch: n,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n }\n },\n i\n );\n }\n}\nfunction C(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction g(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction x(r) {\n if (!g(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction k() {\n const r = f(h);\n x(r);\n const { error: e, resetErrorBoundary: t } = r, [o, s] = p({\n error: null,\n hasError: !1\n }), n = E(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), s({ error: null, hasError: !1 });\n },\n showBoundary: (a) => s({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return n;\n}\nfunction S(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction w(r, e) {\n const t = B(\n (s, n) => d(\n m,\n e,\n d(r, { ...s, ref: n })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n m as ErrorBoundary,\n h as ErrorBoundaryContext,\n S as getErrorMessage,\n k as useErrorBoundary,\n w as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import {\n createContext,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from \"react\";\n\ntype Subscribe = (\n topic: string,\n handler: (event: any) => void,\n) => Promise<void>;\n\nexport const WebSocketContext = createContext(\n {} as {\n broadcast: (topic: string, payload: Record<string, any>) => void;\n subscribe: Subscribe;\n unsubscribe: (\n topic: string,\n handler: (event: any) => void,\n ) => Promise<void>;\n },\n);\n\nexport const WebSocketContextProvider = (props: PropsWithChildren) => {\n const wsRef = useRef<WebSocket>(null);\n\n function getWS() {\n return new Promise<WebSocket>((resolve) => {\n if (wsRef.current) {\n resolve(wsRef.current);\n } else {\n const ws = new WebSocket(\"ws://localhost:5173/\");\n ws.onopen = () => {\n wsRef.current = ws;\n console.log(\"ws opened\");\n ws.addEventListener(\"close\", () => {\n console.log(\"ws closed\");\n wsRef.current = null;\n });\n resolve(ws);\n };\n }\n });\n }\n\n const subscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"subscribe\", topic }));\n ws.addEventListener(\"message\", handler);\n };\n\n const unsubscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"unsubscribe\", topic }));\n ws.removeEventListener(\"message\", handler);\n };\n\n const broadcast = async (topic: string, payload = {}) => {\n const ws = await getWS();\n ws.send(\n JSON.stringify({\n type: \"broadcast\",\n topic,\n payload,\n }),\n );\n };\n\n useEffect(() => {\n return () => {\n if (wsRef.current) {\n wsRef.current.close();\n wsRef.current = null;\n }\n };\n }, []);\n\n return (\n <WebSocketContext.Provider value={{ subscribe, unsubscribe, broadcast }}>\n {props.children}\n </WebSocketContext.Provider>\n );\n};\n","import { type ReactNode, useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\nexport function updateMeta(meta: any) {\n // A partially rendered response whose segments set no metadata sends none —\n // what is on the page belongs to the segments that were skipped.\n if (!meta) {\n return;\n }\n const { title, description } = meta;\n if (title) {\n document.title = title;\n }\n if (description) {\n const desc = document.querySelector(\"meta[name='description']\");\n if (desc) {\n desc.setAttribute(\"content\", description);\n } else {\n const newDesc = document.createElement(\"meta\");\n newDesc.setAttribute(\"name\", \"description\");\n newDesc.setAttribute(\"content\", description);\n document.head.appendChild(newDesc);\n }\n }\n}\n\nconst OpenGraph = (props: {\n title: string;\n type: string;\n url: string;\n image: string;\n description?: string;\n imageAlt?: string;\n imageWidth?: number;\n imageHeight?: number;\n twitterImage?: string;\n twitterImageAlt?: string;\n twitterImageWidth?: number;\n twitterImageHeight?: number;\n}) => {\n const {\n title,\n description,\n type,\n url,\n image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage,\n twitterImageAlt,\n twitterImageWidth,\n twitterImageHeight,\n } = props;\n\n return (\n <>\n <meta property=\"og:title\" content={title} />\n <meta property=\"og:type\" content={type} />\n <meta property=\"og:url\" content={url} />\n <meta property=\"og:image\" content={image} />\n {description && <meta property=\"og:description\" content={description} />}\n {imageAlt && <meta property=\"og:image:alt\" content={imageAlt} />}\n {imageWidth && (\n <meta property=\"og:image:width\" content={String(imageWidth)} />\n )}\n {imageHeight && (\n <meta property=\"og:image:height\" content={String(imageHeight)} />\n )}\n {twitterImage && (\n <>\n <meta name=\"twitter:image\" content={twitterImage} />\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n </>\n )}\n {twitterImageAlt && (\n <meta name=\"twitter:image:alt\" content={twitterImageAlt} />\n )}\n {twitterImageWidth && (\n <meta name=\"twitter:image:width\" content={String(twitterImageWidth)} />\n )}\n {twitterImageHeight && (\n <meta\n name=\"twitter:image:height\"\n content={String(twitterImageHeight)}\n />\n )}\n </>\n );\n};\n\nexport const Head = ({\n children = null,\n charSet = \"utf-8\",\n}: { children?: ReactNode; charSet?: string }) => {\n const { meta } = useContext(ServerDataContext);\n return (\n <head>\n <meta charSet={charSet} />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {/*\n Disable browser auto-translation (Chrome/Google Translate). Gemi apps do\n their own i18n, and a translator that rewrites text nodes *before* React\n hydrates mutates the SSR DOM — which React rejects as a hydration\n mismatch (Minified React error #418) and then regenerates the tree,\n dropping the server-injected <style> and leaving the page unstyled.\n Pair this with `translate=\"no\"` on the <html> element in RootLayout.\n */}\n <meta name=\"google\" content=\"notranslate\" />\n <title>{meta?.title}</title>\n {meta?.description && (\n <meta name=\"description\" content={meta.description} />\n )}\n {meta?.openGraph && <OpenGraph {...meta.openGraph} />}\n {children}\n </head>\n );\n};\n","import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\n\nconst ThemeContext = createContext({\n theme: \"light\" as Theme,\n setTheme: (theme: Theme) => {}, // Function to set the theme\n});\n\nfunction storeTheme(theme: string) {\n try {\n localStorage.setItem(\"theme\", theme);\n } catch (error) {\n console.error(\"Failed to store theme in localStorage:\", error);\n }\n}\n\nexport const ThemeProvider = (props: { children: ReactNode }) => {\n const [theme, setTheme] = useState(() => {\n if (typeof window === \"undefined\") {\n return \"light\"; // Default theme for server-side rendering\n }\n return localStorage.getItem(\"theme\") || \"light\";\n });\n\n useEffect(() => {\n if (theme === \"system\") {\n window\n .matchMedia(\"(prefers-color-scheme: dark)\")\n .addEventListener(\"change\", ({ matches }) => {\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(matches ? \"dark\" : \"light\");\n });\n }\n }, [theme]);\n\n return (\n <ThemeContext.Provider\n value={{\n theme: theme as Theme,\n setTheme: (newTheme: Theme) => {\n setTheme(newTheme);\n storeTheme(newTheme);\n\n let documentTheme = newTheme as Theme;\n if (newTheme === \"system\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n documentTheme = media.matches ? \"dark\" : \"light\";\n }\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(documentTheme);\n },\n }}\n >\n {props.children}\n </ThemeContext.Provider>\n );\n};\n\nexport function useTheme() {\n const context = useContext(ThemeContext);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n","import { applyParams } from \"./applyParams\";\n\n/**\n * Route the client is currently rendering, sent on `.json` navigations so the\n * server can skip the handlers of the segments that route already has mounted.\n * Value is a locale-less pathname plus search, e.g. `/app/A/chat?tab=2`.\n */\nexport const PARTIAL_RENDER_HEADER = \"x-gemi-from\";\n\n/** What the server reports back about the skip it performed, if any. */\nexport interface PartialRenderInfo {\n /** The `x-gemi-from` value the plan was computed against. */\n from: string;\n /** View paths of the skipped segments, in order. Their data is carried forward. */\n carriedViews: string[];\n}\n\n/**\n * The `x-gemi-from` value for the route the client starts on.\n *\n * On the first render the router's `pathname` is still the route *pattern* the\n * server matched — it only becomes a resolved path once the history listener\n * has run — so this has to apply the params. Sending `/app/:orgId/chat` names\n * no route the server can resolve, and the first navigation after every full\n * page load would skip nothing.\n */\nexport function initialRenderedRoute(route: {\n pathname?: string;\n params?: Record<string, string>;\n search?: string;\n}) {\n // `applyParams` strips the trailing slash, so the root route resolves to the\n // empty string — which the server reads as \"no header\" and renders in full.\n const pathname = applyParams(route.pathname ?? \"/\", route.params ?? {}) || \"/\";\n return `${pathname}${route.search ?? \"\"}`;\n}\n","import type { Breadcrumb } from \"../useBreadcrumbs\";\n\ninterface RouteSnapshot {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Route pattern the data was produced for — part of every breadcrumb key. */\n routePath: string;\n data: Record<string, any>;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\n/**\n * A partially rendered response only carries the segments the server actually\n * ran. Everything is keyed by the *new* pathname, so a carried layout would\n * render with empty props unless the data it already had is copied across.\n *\n * Data the server sent always wins: a carried view is only filled in where the\n * response has nothing for it.\n */\nexport function mergeCarriedSegments(\n previous: RouteSnapshot,\n next: RouteSnapshot,\n carriedViews: string[],\n) {\n if (carriedViews.length === 0) {\n return { data: next.data, breadcrumbs: next.breadcrumbs };\n }\n\n // Page data is keyed by the pathname it was fetched for, and a shallow\n // navigation moves the pathname on without fetching — so fall back to the key\n // the data is actually under. The server sends exactly one.\n const previousData = previous.data ?? {};\n const previousViewData =\n previousData[previous.pathname] ?? previousData[Object.keys(previousData)[0]] ?? {};\n const previousBreadcrumbs = previous.breadcrumbs ?? {};\n\n const carriedViewData: Record<string, unknown> = {};\n const carriedBreadcrumbs: Record<string, Breadcrumb> = {};\n\n for (const viewPath of carriedViews) {\n if (viewPath in previousViewData) {\n carriedViewData[viewPath] = previousViewData[viewPath];\n }\n // Breadcrumbs are keyed by route pattern, and that changed even though the\n // segment did not, so they have to be re-keyed rather than copied.\n const previousKey = `${viewPath}:${previous.routePath}`;\n if (previousKey in previousBreadcrumbs) {\n carriedBreadcrumbs[`${viewPath}:${next.routePath}`] = previousBreadcrumbs[previousKey];\n }\n }\n\n // The server sends page data under exactly one key. Take it from the payload\n // rather than recomputing it, so the two never disagree on spelling.\n const [nextKey = next.pathname] = Object.keys(next.data ?? {});\n\n return {\n data: {\n ...next.data,\n [nextKey]: { ...carriedViewData, ...next.data?.[nextKey] },\n },\n breadcrumbs: { ...carriedBreadcrumbs, ...next.breadcrumbs },\n };\n}\n","import {\n PARTIAL_RENDER_HEADER,\n type PartialRenderInfo,\n} from \"../../utils/partialRender\";\nimport { readRoutePayload, type RouteQueryPayload } from \"./readRoutePayload\";\n\ninterface LoadRoutePayloadOptions {\n /** The `.json` URL for the route being navigated to. */\n url: string;\n /** `x-gemi-from` value for the route currently on screen. */\n from: string;\n /** Hands over a payload warmed ahead of this navigation, if there is one. */\n takePrefetched?: (url: string) => Promise<unknown> | null;\n /**\n * The route that is on screen *now*, re-read at the moment a response lands.\n * A navigation that committed while this one was in flight invalidates the\n * partial-render plan the server computed.\n */\n renderedRoute: () => string;\n /**\n * Receives each query result the server streams behind the envelope\n * (#290) — the caller hydrates it into the cache, which settles any\n * segment suspended on that variant.\n */\n onQueryPayload?: (payload: RouteQueryPayload) => void;\n}\n\n/**\n * The page data for a navigation, from whichever source can produce it.\n *\n * A prefetched payload is always a full render, so it can be committed as-is\n * and the `x-gemi-from` round trip skipped entirely. Everything else — no\n * prefetch, a prefetch that failed, a partial response computed against a route\n * that has since been navigated away from — falls through to a request.\n *\n * Returns `null` when nothing usable came back; the caller leaves the current\n * route on screen.\n */\nexport async function loadRoutePayload(\n options: LoadRoutePayloadOptions,\n): Promise<any> {\n const { url, from, takePrefetched, renderedRoute, onQueryPayload } = options;\n\n const prefetched = takePrefetched?.(url);\n if (prefetched) {\n const payload = await prefetched;\n if (payload) {\n return payload;\n }\n }\n\n let response = { ok: false, json: async () => ({}) } as Response;\n try {\n response = await fetch(url, { headers: { [PARTIAL_RENDER_HEADER]: from } });\n } catch (e) {\n console.error(e);\n return null;\n }\n\n if (!response.ok) {\n return null;\n }\n\n // Resolves with the envelope as soon as its line arrives; query results\n // streaming behind it keep draining into `onQueryPayload`.\n const payload = await readRoutePayload(response, onQueryPayload);\n\n // The segments the server carried forward were computed against a route that\n // is no longer on screen. Nothing sound to merge onto — ask for the whole\n // tree instead.\n const claimed: PartialRenderInfo | null = payload?.partial ?? null;\n if (claimed && claimed.from !== renderedRoute()) {\n try {\n const full = await fetch(url);\n if (full.ok) {\n return await readRoutePayload(full, onQueryPayload);\n }\n } catch (e) {\n console.error(e);\n }\n }\n\n return payload;\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n StrictMode,\n memo,\n useTransition,\n Suspense,\n useSyncExternalStore,\n} from \"react\";\n\nimport type { PropsWithChildren, ReactNode, ComponentType, lazy } from \"react\";\nimport { ErrorBoundary, type FallbackProps } from \"react-error-boundary\";\n\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n ClientRouterContext,\n ClientRouterProvider,\n} from \"./ClientRouterContext\";\nimport type { ComponentTree } from \"./types\";\nimport {\n ComponentsContext,\n ComponentsProvider,\n loadViewModule,\n subscribeViewModules,\n} from \"./ComponentContext\";\nimport {\n QueryManagerContext,\n QueryManagerProvider,\n} from \"./QueryManagerContext\";\nimport { I18nProvider } from \"./I18nContext\";\nimport { WebSocketContextProvider } from \"./WebsocketContext\";\nimport { useNavigate } from \"./useNavigate\";\nimport {\n type PageData,\n type RouteState,\n RouteStateProvider,\n} from \"./RouteStateContext\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { Action } from \"history\";\nimport { useRouteData } from \"./useRouteData\";\nimport { updateMeta } from \"./Head\";\nimport { RouteTransitionProvider } from \"./RouteTransitionProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { initialRenderedRoute } from \"../utils/partialRender\";\nimport { mergeCarriedSegments } from \"./helpers/mergeCarriedSegments\";\nimport { routeDataUrl } from \"./helpers/routeDataUrl\";\nimport { loadRoutePayload } from \"./helpers/loadRoutePayload\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n loaders: Record<string, () => void>;\n }\n}\n\nfunction restoreScroll(action: Action | null = null, _pathname = \"no path\") {\n if (action === null) {\n return;\n }\n\n const { pathname, search, hash } = window.location;\n\n const key = [pathname, search, hash].join(\"\");\n const sh = window.scrollHistory;\n\n const scrollPosition = sh?.get(key);\n\n if (action !== Action.Pop) {\n window.scrollTo(0, 0);\n } else {\n // In dev mode the effect runs scroll restoration\n // will be called twice, this if statement prevents\n // scroll to top\n if (!scrollPosition) {\n return;\n }\n window.scrollTo(0, scrollPosition ?? 0);\n }\n\n sh?.delete(key);\n}\n\ninterface RouteProps {\n componentPath: string;\n pathname: string;\n action: Action | null;\n}\n\nconst DefaultQueryErrorFallback = (props: FallbackProps) => {\n return (\n <div role=\"alert\">\n <p>Something went wrong.</p>\n <button type=\"button\" onClick={() => props.resetErrorBoundary()}>\n Try again\n </button>\n </div>\n );\n};\n\nconst Route = memo((props: PropsWithChildren<RouteProps>) => {\n const { componentPath, pathname, action, children } = props;\n const { viewImportMap, getViewModule } = useContext(ComponentsContext);\n const { clearErrors } = useContext(QueryManagerContext);\n const { data } = useRouteData();\n\n // `Loading` / `Error` are optional named exports of the view module,\n // subscribed so a Route that rendered before its chunk arrived re-reads\n // the registry once it lands. On the server `getViewModule` reads the\n // eagerly-loaded modules the http server passed in — a streaming render\n // suspends for real, so the `Loading` fallback it puts in the shell must be\n // the same one the client hydrates.\n const getModule = useCallback(\n () => getViewModule?.(componentPath),\n [getViewModule, componentPath],\n );\n const mod = useSyncExternalStore(subscribeViewModules, getModule, getModule);\n\n const componentData = data?.[pathname]?.[componentPath] ?? {};\n const Component = viewImportMap[componentPath];\n\n useEffect(() => {\n if (!children) {\n restoreScroll(action, componentPath);\n }\n }, [action, children, componentPath]);\n\n if (!Component) {\n const NotFound = viewImportMap[\"404\"];\n return <NotFound />;\n }\n const Loading = mod?.Loading;\n const ErrorFallback = mod?.Error ?? DefaultQueryErrorFallback;\n\n return (\n <ErrorBoundary\n FallbackComponent={ErrorFallback}\n resetKeys={[pathname]}\n onReset={clearErrors}\n >\n <Suspense fallback={Loading ? <Loading /> : null}>\n {/* Keyed by view path so swapping views remounts the view (fresh\n state), while the boundary above — keyed by tree slot in `Tree` —\n stays revealed across the swap. */}\n <Component key={componentPath} {...componentData}>\n {props.children}\n </Component>\n </Suspense>\n </ErrorBoundary>\n );\n});\n\nexport const Tree = memo(\n (props: {\n action: Action;\n tree: ComponentTree;\n entries: string[];\n pathname: string;\n }) => {\n const { entries, tree, pathname, action } = props;\n\n return (\n <>\n {tree\n .filter(([path]) => entries.includes(path))\n .map((node, slot) => {\n const [path, subtree] = node;\n // Keyed by tree SLOT, not by view path: the Suspense/error\n // boundary inside `Route` must survive a sibling swap (Home →\n // Pricing under the same layout), so React treats it as already\n // revealed and a suspending navigation keeps the previous page on\n // screen. A path key would remount the boundary every navigation,\n // and a brand-new boundary commits its fallback the moment any\n // sibling content (the layout's re-rendered chrome) commits —\n // blanking the outgoing page. The view itself still remounts when\n // the path changes: `Route` keys its Component render.\n if (subtree.length > 0) {\n return (\n <Route\n action={action}\n key={`slot-${slot}`}\n componentPath={path}\n pathname={pathname}\n >\n <Tree\n action={action}\n tree={subtree}\n entries={entries}\n pathname={pathname}\n />\n </Route>\n );\n }\n return (\n <Route\n action={action}\n key={`slot-${slot}`}\n componentPath={path}\n pathname={pathname}\n />\n );\n })}\n </>\n );\n },\n);\n\nconst Routes = (props: { componentTree: ComponentTree }) => {\n const { componentTree } = props;\n const [isPending, startTransition] = useTransition();\n const [isFetching, setIsFetching] = useState(false);\n const { routerSubject, fetchRouteCSS, takePrefetched } =\n useContext(ClientRouterContext);\n const { hydrate } = useContext(QueryManagerContext);\n\n const [transitionPath, setTransitionPath] = useState<[string, string]>([\n null,\n routerSubject?.getValue().pathname,\n ]);\n\n const {\n breadcrumbs,\n pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n } = useContext(ServerDataContext);\n\n const [routeState, setRouteState] = useState<RouteState & PageData>({\n params: routerSubject?.getValue().params,\n search: routerSubject?.getValue().search,\n pathname: routerSubject?.getValue().pathname,\n views: routerSubject?.getValue().views,\n action: null,\n hash: routerSubject?.getValue().hash,\n state: routerSubject?.getValue().state,\n routePath: routerSubject?.getValue().routePath,\n locale: routerSubject?.getValue().locale,\n breadcrumbs,\n data: pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n });\n\n const { replace } = useNavigate();\n\n // Adopt what the document was rendered with. Without this the initial payload\n // only ever reaches a component that mounts on the first render, and one that\n // mounts on a later navigation — into a route whose layout has since been\n // carried forward rather than re-run — would fetch it over `/api` instead.\n useEffect(() => {\n hydrate(prefetchedData);\n }, [hydrate, prefetchedData]);\n\n // The route currently on screen, in `x-gemi-from` form. Updated when a\n // response is committed, never when one is merely requested — a navigation\n // that fails must leave the base the server carries segments from intact.\n const renderedRouteRef = useRef(initialRenderedRoute(routeState));\n\n useEffect(() => {\n return routerSubject?.subscribe(async (routerState) => {\n const { pathname, search, state, views } = routerState;\n setTransitionPath((current) => {\n const [, prevTarget] = current;\n return [prevTarget, pathname];\n });\n if (routerState.views.length === 0) {\n setRouteState((routerState) => ({\n ...routerState,\n views: [\"404\"],\n }));\n return;\n }\n\n if (state?.shallow) {\n setRouteState((state) => ({\n ...state,\n ...routerState,\n }));\n return;\n }\n\n const localeSegment = routerState.locale ? `/${routerState.locale}` : \"\";\n\n const url = routeDataUrl({ pathname, search, localeSegment });\n const from = renderedRouteRef.current;\n setIsFetching(true);\n\n // `fetchRouteCSS` keys off the route manifest, so it needs the pattern\n // rather than the concrete path — `/posts/:id`, not `/posts/123`.\n fetchRouteCSS(routerState.routePath).catch((e) => console.error(e));\n // Through `loadViewModule` so the module registry — and with it each\n // view's `Loading`/`Error` exports — is populated before the\n // transition commits the new surface.\n for (const component of views) {\n loadViewModule(component);\n }\n\n const payload = await loadRoutePayload({\n url,\n from,\n takePrefetched,\n renderedRoute: () => renderedRouteRef.current,\n // Query results streaming behind the envelope (#290): hydrating each\n // settles the segment suspended on it — the same wake path streamed\n // documents use.\n onQueryPayload: ([path, variantKey, data]) => {\n hydrate({ [path]: { [variantKey]: data } });\n },\n });\n\n if (payload) {\n const {\n data,\n i18n,\n prefetchedData,\n breadcrumbs,\n meta,\n directive = {},\n is404 = false,\n appId,\n } = payload;\n updateMeta(meta);\n if (directive?.kind === \"Redirect\") {\n if (directive?.path) {\n replace(directive.path, { params: {} } as unknown);\n }\n\n return;\n }\n\n if (is404) {\n startTransition(() => {\n setRouteState((state) => ({\n ...state,\n appId,\n views: [\"404\"],\n }));\n });\n }\n\n const carriedViews: string[] = payload.partial?.carriedViews ?? [];\n renderedRouteRef.current = `${pathname}${search}`;\n\n // Adopt what the server just prefetched before the new surface mounts\n // and its queries read the cache, otherwise they refetch it over /api.\n // Safe here: this callback is async, so we are past the render phase.\n hydrate(prefetchedData);\n\n startTransition(() => {\n setRouteState((state) => ({\n ...routerState,\n appId,\n i18n,\n prefetchedData,\n ...mergeCarriedSegments(\n state,\n { pathname, routePath: routerState.routePath, data, breadcrumbs },\n carriedViews,\n ),\n }));\n });\n }\n setIsFetching(false);\n });\n }, [routerSubject, fetchRouteCSS, takePrefetched, replace, hydrate]);\n\n return (\n <RouteTransitionProvider\n isPending={isPending}\n isFetching={isFetching}\n transitionPath={transitionPath}\n >\n <RouteStateProvider state={routeState}>\n <Tree\n action={routeState.action}\n pathname={applyParams(routeState.pathname ?? \"/\", routeState.params)}\n tree={componentTree}\n entries={routeState.pathname ? routeState.views : [\"404\"]}\n />\n </RouteStateProvider>\n </RouteTransitionProvider>\n );\n};\n\nexport const ClientRouter = (props: {\n viewImportMap?: Record<string, ReturnType<typeof lazy>>;\n /** Server only: full view modules for `Loading`/`Error` fallbacks. */\n viewModules?: Record<string, Record<string, any>>;\n RootLayout: ComponentType<{ children: ReactNode; locale: string }>;\n}) => {\n const { RootLayout } = props;\n const {\n routeManifest,\n router,\n componentTree,\n pageData,\n cssManifest,\n breadcrumbs,\n i18n,\n } = useContext(ServerDataContext);\n\n return (\n <ThemeProvider>\n <I18nProvider>\n <WebSocketContextProvider>\n <QueryManagerProvider>\n <ComponentsProvider\n viewImportMap={props.viewImportMap}\n modules={props.viewModules}\n >\n <ClientRouterProvider\n cssManifest={cssManifest}\n searchParams={router.searchParams}\n params={router.params}\n pageData={pageData}\n is404={router.is404}\n is500={false}\n pathname={router.pathname}\n currentPath={router.currentPath}\n routeManifest={routeManifest}\n breadcrumbs={breadcrumbs}\n urlLocaleSegment={router.urlLocaleSegment}\n >\n <StrictMode>\n <RootLayout locale={i18n.currentLocale}>\n <Routes componentTree={componentTree} />\n </RootLayout>\n </StrictMode>\n </ClientRouterProvider>\n </ComponentsProvider>\n </QueryManagerProvider>\n </WebSocketContextProvider>\n </I18nProvider>\n </ThemeProvider>\n );\n};\n","import { useEffect, type ComponentType } from \"react\";\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nconst StackTrace = () => {\n useEffect(() => {\n window.addEventListener(\"load\", () => {\n const container = document.getElementById(\"overlay\");\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (window as any).error,\n stack: (window as any).stack_trace || \"\",\n });\n container.appendChild(overlay);\n }\n });\n }, []);\n\n return <div id=\"overlay\" />;\n};\n\nexport function init(RootLayout: ComponentType<any>) {\n if (typeof window !== \"undefined\" && (window as any).render_error) {\n createRoot(document.body).render(<StackTrace />);\n } else {\n hydrateRoot(\n document,\n <>\n <></>\n <></>\n <ErrorBoundary fallback={<div />}>\n <ServerDataProvider>\n <ClientRouter RootLayout={RootLayout} />\n </ServerDataProvider>\n </ErrorBoundary>\n </>,\n {\n onCaughtError: (error) => {\n console.error(error);\n // @ts-ignore\n if (import.meta.env.DEV) {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (error as any).message,\n stack: (error as any).stack || \"\",\n });\n document.body.appendChild(overlay);\n }\n }\n },\n },\n );\n }\n}\n\nexport function create(\n RootLayout: ComponentType<any>,\n { componentTree, loaders, routeManifest, router, i18n, auth, prefetchedData, viewImportMap }: any,\n) {\n (window as any).__GEMI_DATA__ = {\n componentTree,\n loaders,\n routeManifest,\n router,\n i18n,\n auth,\n prefetchedData,\n pageData: {},\n };\n createRoot(document.getElementById(\"root\")).render(\n <ServerDataProvider>\n <ClientRouter viewImportMap={viewImportMap} RootLayout={RootLayout} />\n </ServerDataProvider>,\n );\n}\n","import type { ComponentType } from \"react\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ServerQueryContext } from \"./ServerQueryContext\";\n\nexport function createRoot(\n RootLayout: ComponentType<{ children: React.ReactNode; locale: string }>,\n) {\n // `serverQueries` and `viewModules` exist only when the view router renders\n // this on the server — the browser mounts with both absent.\n return (props: any) => (\n <ServerDataProvider value={props.data}>\n <ServerQueryContext.Provider value={props.serverQueries ?? null}>\n <ClientRouter\n RootLayout={RootLayout}\n viewImportMap={props.viewImportMap}\n viewModules={props.viewModules}\n />\n </ServerQueryContext.Provider>\n </ServerDataProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nconst defaultScreen = [390, 768, 1024];\nconst defaultContainer = [100, 100, 100, 100];\n\nfunction generateImageProps(\n src: string,\n width: number,\n container = defaultContainer,\n screen = defaultScreen,\n quality = 80,\n) {\n const baseUrl = src;\n\n const widths = [...container.map((c, i) => (screen[i] * c) / 100), width * 2];\n\n return {\n srcSet: [\n ...screen.map((size, i) => {\n return `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${widths[i]} ${size}${isNaN(Number(size)) ? \"\" : \"w\"}`;\n }),\n `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${width * 2} 2x`,\n ].join(\", \"),\n sources: [\n ...container.map((c, i) => {\n if (!screen[i]) {\n return `${c}vw`;\n }\n return `(max-width: ${screen[i]}px) ${c}vw`;\n }),\n ].join(\", \"),\n };\n}\n\nfunction fillRestWithLast<T>(arr: T[], length: number): T[] {\n return [\n ...arr,\n ...Array.from({ length: length - arr.length }).fill(arr[arr.length - 1]),\n ] as T[];\n}\n\ninterface ImageProps {\n src: string;\n width: number;\n container?: number[];\n screen?: number[];\n quality?: number;\n}\n\nexport const Image = (props: ComponentProps<\"img\"> & ImageProps) => {\n const {\n screen = defaultScreen,\n container = defaultContainer,\n src,\n width,\n quality = 80,\n srcSet: __,\n ...rest\n } = props;\n\n if (!src) {\n return null;\n }\n\n const srcProps = generateImageProps(\n src,\n width,\n fillRestWithLast(container, 4),\n screen,\n quality,\n );\n\n return <img {...srcProps} width={width} {...rest} />;\n};\n","import { usePost } from \"../useMutation\";\n\ninterface UseForgotPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseForgotPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useForgotPassword(args: UseForgotPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/forgot-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\nimport { useQuery } from \"../useQuery\";\n\ninterface UseSignInArgs {\n onSuccess?: (data: any) => void;\n}\n\nconst defaultArgs: UseSignInArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignIn(args: UseSignInArgs = defaultArgs) {\n // Only here for `mutate` — `lazy` so the sign-in form neither fetches nor\n // suspends on a user it does not have yet.\n const { mutate } = useQuery(\"/auth/me\", {}, { lazy: true });\n return usePost(\n \"/auth/sign-in\",\n {},\n {\n onSuccess: (user) => {\n args.onSuccess(user);\n mutate(user as any);\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\nexport function useSignUp() {\n return usePost(\"/auth/sign-up\");\n}\n","import { useMutate } from \"../useMutate\";\nimport { usePost } from \"../useMutation\";\n\ninterface UseSignOutArgs {\n onSuccess?: () => void;\n}\n\nconst defaultArgs: UseSignOutArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignOut(args: UseSignOutArgs = defaultArgs) {\n const mutator = useMutate();\n return usePost(\n \"/auth/sign-out\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n mutator({ path: \"/auth/me\" });\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\ninterface UseResetPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseResetPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useResetPassword(args: UseResetPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/reset-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"../ServerDataProvider\";\nimport { useQuery } from \"../useQuery\";\n\nexport function useUser() {\n const { auth } = useContext(ServerDataContext);\n const {\n data: user,\n loading,\n error,\n } = useQuery(\n \"/auth/me\",\n {},\n {\n fallbackData: auth?.user ? auth.user : null,\n // An anonymous visitor has no `/auth/me` data and never will — this\n // must resolve to `user: null`, not suspend the page behind a 401.\n suspense: false,\n },\n );\n\n if (loading && !user) {\n return { user: null, loading, error };\n }\n\n return { user: user, loading, error };\n}\n","import { createElement, Fragment, isValidElement, type JSX } from \"react\";\n\ntype TemplateParams = Record<\n string,\n string | ((p: unknown) => string | JSX.Element)\n>;\n\nexport function parseTranslation(template: string, params: TemplateParams) {\n // Check if we have any JSX in our parameters\n const hasJSX = Object.values(params).some(\n (value) =>\n typeof value === \"function\" &&\n isValidElement((value as (p: unknown) => unknown)(\"\")),\n );\n\n // Regular expression to match template variables:\n // {{name}} - simple variable\n // {{name:type}} - variable with type casting\n // {{name:[content]}} - variable with interpolated content\n const regex = /{{([^{}]+?)(?::([^{}\\[\\]]+?))?(?:\\[(.*?)\\])?}}/g;\n\n if (!hasJSX) {\n // Simple string replacement\n const result = template.replace(regex, (match, name, type, content) => {\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n const value = params[cleanName];\n if (value === undefined) {\n return match; // Return original match if no parameter found\n }\n\n if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n // Check if function returned JSX - this shouldn't happen in the string branch\n if (isValidElement(functionResult)) {\n throw new Error(\"JSX returned in string context\");\n }\n return String(functionResult);\n }\n\n // Handle type casting if specified\n if (type) {\n switch (type.toLowerCase()) {\n case \"number\":\n return Number(value).toString();\n case \"string\":\n return String(value);\n case \"boolean\":\n return Boolean(value).toString();\n default:\n return String(value);\n }\n }\n return String(value);\n });\n return result as any;\n } else {\n // JSX replacement - we'll split the template into parts\n const parts: Array<string | JSX.Element> = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null = null;\n\n while ((match = regex.exec(template)) !== null) {\n const [fullMatch, name, type, content] = match;\n const matchIndex = match.index;\n\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n // Add text before the match\n if (matchIndex > lastIndex) {\n parts.push(template.substring(lastIndex, matchIndex));\n }\n\n const value = params[cleanName];\n if (value === undefined) {\n // Keep original template variable if no parameter found\n parts.push(fullMatch);\n } else if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n parts.push(functionResult);\n } else if (type) {\n // Handle type casting if specified\n switch (type.toLowerCase()) {\n case \"number\":\n parts.push(Number(value).toString());\n break;\n case \"string\":\n parts.push(String(value));\n break;\n case \"boolean\":\n parts.push(Boolean(value).toString());\n break;\n default:\n parts.push(String(value));\n }\n } else {\n parts.push(String(value));\n }\n\n lastIndex = matchIndex + fullMatch.length;\n }\n\n // Add any remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Convert the parts array to JSX\n return createElement(Fragment, {}, ...parts) as any;\n }\n}\n","import type { I18nDictionary } from \"./rpc\";\nimport type { ParseTranslationParams, Prettify } from \"../utils/type\";\nimport type { JSX } from \"react\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport { useRouteData } from \"./useRouteData\";\n\ntype Parser<T extends Record<string, string>> = Prettify<\n {\n [K in keyof T]: ParseTranslationParams<T[K]>;\n }[keyof T]\n>;\n\ntype ParamsOrNever<T> = T extends Record<string, never>\n ? [params?: never]\n : [params: T];\n\nexport function useTranslator<T extends keyof I18nDictionary>(component: T) {\n const { i18n } = useRouteData();\n\n function parse<\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(key: K, ...args: ParamsOrNever<Parser<U>>) {\n try {\n const translations = i18n.dictionary[i18n.currentLocale][component];\n const [params = {}] = args;\n return parseTranslation(translations[key as any], params);\n } catch (err) {\n console.error(\n `Unresolved translation Component:${component} key:${String(key)}`,\n );\n return String(key);\n }\n }\n\n parse.jsx = <\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(\n key: K,\n ...args: ParamsOrNever<Parser<U>>\n ) => {\n return parse(key, ...(args as any)) as unknown as JSX.Element;\n };\n\n return parse;\n}\n","import { useLocation } from \"./useLocation\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\n\nconst setCookie = async (locale: string) => {\n try {\n return await globalThis.cookieStore.set(\"i18n-locale\", locale);\n } catch (err) {\n return await fetch(`/api/__gemi__/services/i18n/set-locale/${locale}`);\n // TODO: show unsuported browser error\n // console.log(err);\n }\n};\n\nexport function useLocale() {\n const { i18n } = useRouteData();\n const { pathname, search } = useLocation();\n const { replace } = useNavigate();\n const params = useParams();\n\n const setLocale = async (locale: string) => {\n const urlSearchParams = new URLSearchParams(search);\n setCookie(locale).then(() => {\n replace(pathname, {\n locale,\n // TODO: fix: this conversion is wrong, because there can be multiple\n // search params with the same name\n search: Object.fromEntries(urlSearchParams.entries()),\n params,\n } as any);\n });\n };\n\n return [i18n.currentLocale, setLocale] as const;\n}\n","import { useCallback, useContext, useEffect, useMemo } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useSubscription(\n route: string,\n options: { params: {}; cb: (data: any) => void },\n) {\n const { cb, params } = options;\n const { subscribe, unsubscribe } = useContext(WebSocketContext);\n\n const topic = useMemo(\n () => applyParams(route, options.params),\n [route, params],\n );\n\n const handler = (event: MessageEvent<any>) => {\n const message = JSON.parse(event.data);\n if (topic === message.topic) {\n cb(message.data);\n }\n };\n\n useEffect(() => {\n subscribe(topic, handler);\n\n return () => {\n unsubscribe(topic, handler);\n };\n }, [topic]);\n}\n","import { useContext } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useBroadcast(\n path: string,\n options: { params: Record<string, string | number> },\n) {\n const { params = {} } = options;\n const { broadcast } = useContext(WebSocketContext);\n\n const topic = applyParams(path, params);\n\n return (payload: Record<string, any>) => broadcast(topic, payload);\n}\n","import { createElement, Fragment, type ReactNode } from \"react\";\nimport type { SatoriOptions } from \"satori\";\n\ntype Font = Omit<SatoriOptions[\"fonts\"][number], \"data\">;\ntype Options = Omit<SatoriOptions, \"fonts\"> & {\n fonts: Font[];\n} & { width: number; height: number };\n\nexport const OpenGraphImage = ({\n children,\n ...satoriOptions\n}: Options & { children: ReactNode }) => {\n return (\n <>\n {(() => {\n throw {\n jsx: createElement(Fragment, { children }),\n satoriOptions,\n };\n })()}\n </>\n );\n};\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useAppIdMissmatch() {\n const { appId: next } = useContext(RouteStateContext);\n const { appId: current } = useContext(ServerDataContext);\n\n return current !== next;\n}\n"],"x_google_ignoreList":[12,13,14,15,41],"mappings":";;;;;AAAA,IAAa,UAAb,MAAwB;CACtB,8BAAc,IAAI,IAAwB;CAC1C;CAEA,YAAY,cAAiB;EAC3B,KAAK,QAAQ;CACf;CAEA,UAAiB,YAAgC;EAC/C,KAAK,YAAY,IAAI,UAAU;EAC/B,aAAa;GACX,KAAK,YAAY,OAAO,UAAU;EACpC;CACF;CAEA,KAAY,OAAU;EACpB,KA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,UAAU,OAAO,OAAO;EAExB,aAAa;GACX,YAAY,OAAO,OAAO;EAC5B;CACF,GAAG,CAAC,KAAK,CAAC;AACZ;;;AC1BA,SAAgB,aACd,MACA,SACA;CACA,MAAM,EAAE,SAAS,CAAC,MAAM;CACxB,MAAM,EAAE,cAAc,WAAW,gBAAgB;CAEjD,MAAM,QAAQ,cAAY,MAAM,MAAM;CAEtC,QAAQ,YAAiC,UAAU,OAAO,OAAO;AACnE;;;ACNA,IAAa,kBAAkB,EAC7B,UACA,GAAG,oBACoC;CACvC,OACE,oBAAA,YAAA,EAAA,iBACU;EACN,MAAM;GACJ,KAAK,cAAc,UAAU,EAAE,SAAS,CAAC;GACzC;EACF;CACF,EAAA,CAAG,EACH,CAAA;AAEN;;;AClBA,SAAgB,oBAAoB;CAClC,MAAM,EAAE,OAAO,SAAS,WAAW,iBAAiB;CACpD,MAAM,EAAE,OAAO,YAAY,WAAW,iBAAiB;CAEvD,OAAO,YAAY;AACrB"}
1
+ {"version":3,"file":"index.js","names":["_options","C","#i","#t","#n","#e","#s","#o","#b","#f","#r","#h","#u","#d","#A","#T","#P","#C","#E","#g","#S","#x","#O","#y","#p","#w","#k","#c","#R","#l","#m","#a","URLPattern","l","y","d"],"sources":["../../utils/Subject.ts","../../client/QueryError.ts","../../client/QueryResource.ts","../../client/QueryManagerContext.tsx","../../client/ServerQueryContext.tsx","../../utils/applyParams.ts","../../utils/omitNullishValues.ts","../../client/RouteStateContext.tsx","../../client/useParams.ts","../../client/useRouteData.ts","../../client/isPlainObject.ts","../../client/useQuery.ts","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/.bun/history@5.3.0/node_modules/history/index.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js","../../utils/sleep.ts","../../client/ProgressManager.ts","../../client/useLocation.ts","../../client/ServerDataProvider.tsx","../../client/I18nContext.tsx","../../client/useNavigate.ts","../../client/useSearchParams.ts","../../client/useRoute.ts","../../client/HttpReload.tsx","../../client/PrefetchCache.ts","../../client/helpers/routeDataUrl.ts","../../client/helpers/readRoutePayload.ts","../../client/helpers/flattenComponentTree.ts","../../client/ComponentContext.tsx","../../client/ClientRouterContext.tsx","../../client/useMutation.ts","../../client/useMutate.ts","../../client/Mutation.tsx","../../client/useIsNavigationPending.ts","../../client/useNavigationProgress.ts","../../client/usePrefetch.ts","../../client/useBreadcrumbs.ts","../../client/RouteTransitionProvider.tsx","../../client/Link.tsx","../../client/Redirect.tsx","../../../../node_modules/.bun/react-error-boundary@6.1.1+83d5fd7b249dbeef/node_modules/react-error-boundary/dist/react-error-boundary.js","../../client/WebsocketContext.tsx","../../client/Head.tsx","../../client/ThemeProvider.tsx","../../utils/partialRender.ts","../../client/helpers/mergeCarriedSegments.ts","../../client/helpers/loadRoutePayload.ts","../../client/ClientRouter.tsx","../../client/init.tsx","../../client/createRoot.tsx","../../client/Image.tsx","../../client/auth/useForgotPassword.ts","../../client/auth/useSignIn.tsx","../../client/auth/useSignUp.ts","../../client/auth/useSignOut.ts","../../client/auth/useResetPassword.ts","../../client/auth/useUser.ts","../../utils/parseTranslation.tsx","../../client/useTranslator.ts","../../client/useLocale.ts","../../client/useSubscription.ts","../../client/useBroadcast.ts","../../client/OpenGraphImage.tsx","../../client/useAppIdMissmatch.ts"],"sourcesContent":["export class Subject<T> {\n subscribers = new Set<(value: T) => void>();\n value: T;\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n public subscribe(subscriber: (value: T) => void) {\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n }\n\n public next(value: T) {\n this.value = value;\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n public getValue() {\n return this.value;\n }\n}\n","/**\n * An HTTP failure from a query endpoint, in a shape an error boundary can\n * work with. `resolveVariant` used to store the parsed response body as the\n * error; boundaries expect an `Error`, so the body moves to a field.\n */\nexport class QueryError extends Error {\n constructor(\n public path: string,\n public variantKey: string,\n public status: number,\n public body: any,\n ) {\n super(\n typeof body?.message === \"string\"\n ? body.message\n : `Request to /api${path} failed with status ${status}`,\n );\n this.name = \"QueryError\";\n }\n}\n","import { Subject } from \"../utils/Subject\";\nimport { QueryError } from \"./QueryError\";\n\ntype State = {\n loading: boolean;\n data: any;\n /**\n * Whether `data` is a value the server actually produced — `null`, `0`,\n * `false` and `\"\"` are all legitimate response bodies. Every presence check\n * in the cache goes through this flag, never through `data`'s truthiness:\n * inferring presence from the value made a falsy body look permanently\n * unfetched, which under suspense meant an unbounded fetch/suspend loop.\n */\n hasData: boolean;\n error: any;\n version: number;\n};\n\ntype Deferred = { promise: Promise<void>; resolve: () => void };\n\nexport const DEFAULT_STALE_TIME = 5000;\n\nexport class QueryResource {\n store: Subject<Map<string, State>>;\n staleVariants = new Set<string>();\n lastFetchRecord = new Map<string, number>();\n key: string;\n /**\n * Variants with a request on the wire. React discards and retries a\n * suspended render, so `read` runs many times for one commit — this is what\n * collapses those attempts onto a single fetch. The `loading` flag can't do\n * it: render-initiated fetches are silent and never write to the store.\n */\n private inflight = new Set<string>();\n /**\n * One promise per suspended variant, handed to `use()`. Settled by whatever\n * write lands first — the variant's own fetch or a `hydrate` from a route\n * payload — so a prefetch that arrives mid-suspension wakes the reader\n * without waiting on the wire.\n */\n private pending = new Map<string, Deferred>();\n\n constructor(key: string, initialState: Record<string, any>) {\n this.key = key;\n this.store = new Subject(new Map());\n this.hydrate(initialState);\n }\n\n /**\n * Adopt server-prefetched data into the cache.\n *\n * Called once from the constructor for the SSR payload, and again on every\n * client-side navigation with the `prefetchedData` the server just produced —\n * otherwise the resource cache (which is keyed by path for the lifetime of\n * the app) would keep serving the first payload and revalidate it over `/api`.\n */\n hydrate(initialState: Record<string, any> | null | undefined) {\n const store = this.store.getValue();\n const now = Date.now();\n let changed = false;\n\n for (const [variantKey, data] of Object.entries(initialState ?? {})) {\n // `undefined` means \"no value\" (JSON can't produce it); everything else\n // — including `null`, `0`, `false`, `\"\"` — is a real response body, and\n // a suspended reader may be waiting on exactly this write to settle.\n if (data === undefined) continue;\n const current = store.get(variantKey);\n // Never clobber an in-flight fetch — `resolveVariant` flips `loading`\n // before its first await, so this also covers an optimistic `mutate`\n // whose refetch hasn't landed yet.\n if (current?.loading) continue;\n // Idempotent re-hydration (e.g. StrictMode's double invoke).\n if (current?.hasData && current.data === data) continue;\n\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: now,\n });\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, now);\n // Wake a reader suspended on this variant — the payload the server just\n // shipped is the answer it was waiting on.\n this.settle(variantKey);\n changed = true;\n }\n\n if (changed) {\n this.store.next(store);\n }\n }\n\n private pendingFor(variantKey: string): Deferred {\n let deferred = this.pending.get(variantKey);\n if (!deferred) {\n let resolve!: () => void;\n const promise = new Promise<void>((r) => {\n resolve = r;\n });\n deferred = { promise, resolve };\n this.pending.set(variantKey, deferred);\n }\n return deferred;\n }\n\n private settle(variantKey: string) {\n const deferred = this.pending.get(variantKey);\n if (deferred) {\n this.pending.delete(variantKey);\n deferred.resolve();\n }\n }\n\n private isStale(variantKey: string, staleTime: number) {\n if (this.staleVariants.has(variantKey)) return true;\n const now = Date.now();\n // `>=` so `staleTime: 0` means \"always revalidate\" and\n // `staleTime: Infinity` means \"never\".\n return now - (this.lastFetchRecord.get(variantKey) ?? now) >= staleTime;\n }\n\n /**\n * The cached state for a variant, or `undefined` — a plain read that never\n * fetches and never revalidates.\n *\n * `getVariant` is the read that keeps the cache honest, and it starts a\n * request when it has to. That makes it the wrong thing to call while\n * rendering: React throws away a render whose subtree suspends and retries\n * it, so every discarded attempt would leak a request. Renders read with\n * this; effects, which only run for a render that committed, use\n * `getVariant`.\n */\n peek(variantKey: string) {\n return this.store.getValue().get(variantKey);\n }\n\n /**\n * The read a render performs. Never suspends when data is in hand (stale\n * data revalidates in the background instead), dedupes across the render\n * attempts React throws away, and hands back a promise that resolves off\n * any write to the variant — its own fetch or a `hydrate`.\n *\n * Safe during render: it never writes to the store synchronously, so the\n * snapshot `useSyncExternalStore` read stays valid for the whole attempt.\n */\n read(\n variantKey: string,\n staleTime: number = DEFAULT_STALE_TIME,\n ): { state?: State; promise?: Promise<void> } {\n const state = this.peek(variantKey);\n\n // Data in hand: stale-while-revalidate, never suspend.\n if (state?.hasData) {\n if (\n !this.inflight.has(variantKey) &&\n this.isStale(variantKey, staleTime)\n ) {\n this.lastFetchRecord.set(variantKey, Date.now());\n this.resolveVariant(variantKey, true);\n }\n return { state };\n }\n if (state?.error) {\n // The caller throws it into the nearest error boundary.\n return { state };\n }\n if (typeof window === \"undefined\") {\n // SSR never fetches and never suspends; the server renders whatever the\n // prefetch payload seeded.\n return { state };\n }\n\n const deferred = this.pendingFor(variantKey);\n if (!this.inflight.has(variantKey)) {\n this.resolveVariant(variantKey, true);\n }\n return { state, promise: deferred.promise };\n }\n\n getVariant(variantKey: string, staleTime: number = DEFAULT_STALE_TIME) {\n const store = this.store.getValue();\n if (!store.has(variantKey)) {\n // Join a render-initiated fetch instead of racing it — silent reads\n // never flip `loading`, so the flag alone can't dedupe here.\n if (!this.inflight.has(variantKey)) {\n this.resolveVariant(variantKey);\n }\n } else {\n const variant = store.get(variantKey);\n\n if (!variant.loading && !this.inflight.has(variantKey)) {\n // Don't have data\n if (!variant.hasData) {\n this.resolveVariant(variantKey);\n return store.get(variantKey);\n }\n if (this.isStale(variantKey, staleTime)) {\n this.lastFetchRecord.set(variantKey, Date.now());\n this.resolveVariant(variantKey, true);\n return store.get(variantKey);\n }\n }\n }\n return store.get(variantKey);\n }\n\n /**\n * Drop the error for one variant (or every variant when omitted), so an\n * error boundary reset re-renders into a clean read instead of instantly\n * re-throwing the stored failure.\n */\n clearError(variantKey?: string) {\n const store = this.store.getValue();\n let changed = false;\n for (const [key, state] of store) {\n if (variantKey !== undefined && key !== variantKey) continue;\n if (state.error) {\n store.set(key, { ...state, error: null });\n changed = true;\n }\n }\n if (changed) {\n this.store.next(store);\n }\n }\n\n mutate(variantKey: string, fn: (data: any) => any = (data) => data) {\n const cacheKey = [\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : \"\",\n this.key,\n variantKey,\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n try {\n if (caches) {\n caches?.delete(cacheKey);\n }\n } catch (err) {}\n\n const store = this.store.getValue();\n const state = store.get(variantKey);\n if (!state || !state.hasData) {\n // Nothing is cached yet to update optimistically — e.g. a lazy query, or\n // one that hasn't resolved. Fall through to a refetch so `mutate(fn)` is\n // not a silent no-op (it still means \"go get the latest data\").\n this.resolveVariant(variantKey, false, false);\n return;\n }\n const data = fn(state.data);\n\n this.staleVariants.add(variantKey);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: state.version,\n }),\n );\n this.resolveVariant(variantKey, false, false);\n }\n\n refetch(variantKey: string) {\n this.resolveVariant(variantKey, false, false);\n }\n\n private async resolveVariant(\n variantKey: string,\n silent = false,\n cache = true,\n ) {\n if (typeof window === \"undefined\") {\n return;\n }\n // Synchronous with the call, so every read in the same render pass sees\n // the request as already on the wire.\n this.inflight.add(variantKey);\n try {\n const store = this.store.getValue();\n const previousState = store.get(variantKey);\n\n if (!silent) {\n store.set(variantKey, {\n loading: true,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error: previousState?.error,\n version: previousState?.version,\n });\n }\n\n let data = null;\n let response: Response | null = null;\n const fullUrl = [this.key, variantKey].filter((s) => s.length).join(\"?\");\n try {\n response = await fetch(`/api${fullUrl}`, {\n cache: cache ? \"default\" : \"reload\",\n });\n data = await response.json();\n } catch (error) {\n console.error(`Error fetching url /api${fullUrl}`, error);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error,\n version: previousState?.version,\n }),\n );\n return;\n }\n\n if (response!.ok) {\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n hasData: true,\n error: null,\n version: Date.now(),\n }),\n );\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, Date.now());\n } else {\n // this.lastFetchRecord.set(variantKey, 0);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n hasData: previousState?.hasData ?? false,\n error: new QueryError(this.key, variantKey, response!.status, data),\n version: previousState?.version,\n }),\n );\n }\n } finally {\n this.inflight.delete(variantKey);\n // Settle on failure too — a suspended reader has to wake up to throw.\n this.settle(variantKey);\n }\n }\n}\n","import {\n createContext,\n type PropsWithChildren,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { QueryResource } from \"./QueryResource\";\n\n/** One streamed query payload: `[path, variantKey, data]`. */\ntype StreamedQueryPayload = [string, string, any];\n\nexport type PrefetchedData = Record<string, Record<string, any>>;\n\nexport interface QueryManagerContextValue {\n getResource: (\n key: string,\n initialState?: Record<string, any>,\n ) => QueryResource;\n hydrate: (prefetchedData?: PrefetchedData | null) => void;\n clearErrors: () => void;\n}\n\nexport const QueryManagerContext = createContext<QueryManagerContextValue>({\n getResource: (key: string, initialState: Record<string, any> = {}) => {\n return new QueryResource(key, initialState);\n },\n hydrate: () => {},\n clearErrors: () => {},\n});\n\nexport const QueryManagerProvider = ({ children }: PropsWithChildren<{}>) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n\n const getResource = useCallback(\n (key: string, initialState?: Record<string, any>) => {\n let resource = resourcesRef.current.get(key);\n if (!resource) {\n resource = new QueryResource(key, initialState ?? {});\n resourcesRef.current.set(key, resource);\n }\n return resource;\n },\n [],\n );\n\n // Resources are cached by path for the lifetime of the app, so `initialState`\n // above only ever applies to the first load. Every navigation ships a fresh\n // `prefetchedData` payload that has to be pushed into the existing resources,\n // otherwise the components mounting on the new surface refetch it over `/api`.\n const hydrate = useCallback((prefetchedData?: PrefetchedData | null) => {\n if (!prefetchedData) return;\n for (const [key, initialState] of Object.entries(prefetchedData)) {\n if (!initialState || typeof initialState !== \"object\") continue;\n const resource = resourcesRef.current.get(key);\n if (resource) {\n resource.hydrate(initialState);\n } else {\n resourcesRef.current.set(key, new QueryResource(key, initialState));\n }\n }\n }, []);\n\n // Used by the route-level error boundary's reset: without this, the retried\n // render would read the stored failure back out of the cache and re-throw.\n const clearErrors = useCallback(() => {\n for (const resource of resourcesRef.current.values()) {\n resource.clearError();\n }\n }, []);\n\n // Streaming SSR delivers late-resolving queries as inline\n // `__GEMI_STREAM__.push([path, variant, data])` scripts interleaved with\n // React's chunks. Payloads that ran before this rendered sit buffered in a\n // plain array; from here on, `push` hydrates directly — and `hydrate`\n // settles any reader suspended on that variant.\n //\n // Drained synchronously during the FIRST render, not in an effect:\n // suspension happens during the render phase, so a segment hydrating in\n // this very pass must already find its streamed data in the cache — an\n // effect-timed drain would let it suspend and start a duplicate `/api`\n // fetch for data the document already carries. Safe here: it runs once\n // (idempotent under StrictMode's double-invoke), and nothing is subscribed\n // to the store yet, so no render is invalidated mid-pass.\n const drainedStreamRef = useRef(false);\n if (typeof window !== \"undefined\" && !drainedStreamRef.current) {\n drainedStreamRef.current = true;\n const w = window as unknown as {\n __GEMI_STREAM__?:\n | StreamedQueryPayload[]\n | { push: (p: StreamedQueryPayload) => void };\n };\n const adopt = ([path, variantKey, data]: StreamedQueryPayload) => {\n hydrate({ [path]: { [variantKey]: data } });\n };\n const buffered = Array.isArray(w.__GEMI_STREAM__) ? w.__GEMI_STREAM__ : [];\n w.__GEMI_STREAM__ = { push: adopt };\n for (const payload of buffered) {\n adopt(payload);\n }\n }\n\n const value = useMemo(\n () => ({ getResource, hydrate, clearErrors }),\n [getResource, hydrate, clearErrors],\n );\n\n return (\n <QueryManagerContext.Provider value={value}>\n {children}\n </QueryManagerContext.Provider>\n );\n};\n","import { createContext } from \"react\";\n\n/**\n * The structural slice of the server's `ServerQueryStore` that `useQuery`\n * needs during a streaming server render. Declared here — not imported from\n * `services/router` — because this file ships in the browser bundle; only the\n * shape crosses over, never the implementation.\n */\nexport interface ServerQueryEntryLike {\n status: \"pending\" | \"resolved\" | \"rejected\";\n data?: any;\n error?: any;\n promise: Promise<void>;\n}\n\nexport interface ServerQueriesLike {\n ensure(\n path: string,\n options?: {\n params?: Record<string, any>;\n search?: Record<string, string | number | boolean | null>;\n },\n source?: \"prefetch\" | \"render\",\n ): ServerQueryEntryLike;\n}\n\n/**\n * Populated only during a streaming server render (`createRoot` threads the\n * request's store through); always `null` in the browser, where suspension\n * runs on `QueryResource` instead.\n */\nexport const ServerQueryContext = createContext<ServerQueriesLike | null>(null);\n","export function applyParams<T extends string>(\n url: T,\n params: Record<string, string | number | undefined>,\n): string {\n return (\n url\n .replace(/:([^/]+[*?]?)/g, (_, key) => {\n const hasSuffix = key.endsWith(\"?\") || key.endsWith(\"*\");\n const paramName = hasSuffix ? key.slice(0, -1) : key;\n const value = params[paramName];\n\n if (value === undefined) {\n if (hasSuffix) {\n return \"\"; // Remove the optional segment if no value is provided\n }\n // @ts-ignore\n if (import.meta.env.DEV) {\n throw new Error(`Missing parameter: ${paramName}`);\n }\n console.error(`Missing parameter: ${paramName} in URL: ${url}`);\n }\n\n return String(value);\n })\n // remove double slashes\n .replace(/\\/\\//g, \"/\")\n // remove trailing slash\n .replace(/\\/$/, \"\")\n );\n}\n","export function omitNullishValues<T>(input: T) {\n return Object.fromEntries(\n Object.entries(input).filter(([, value]) => {\n return value !== null && value !== undefined;\n }),\n ) as T;\n}\n","import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n pathname: string;\n hash: string;\n action: Action | null;\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useRouteData() {\n const { data, i18n, prefetchedData, breadcrumbs } =\n useContext(RouteStateContext);\n\n return { data, i18n, prefetchedData, breadcrumbs };\n}\n","export function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useSyncExternalStore,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { NestedPrettify } from \"../utils/type\";\n\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport { ServerQueryContext } from \"./ServerQueryContext\";\nimport { DEFAULT_STALE_TIME } from \"./QueryResource\";\nimport { applyParams } from \"../utils/applyParams\";\nimport type { UrlParser } from \"./types\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ninterface Config<T> {\n fallbackData?: T;\n keepPreviousData?: boolean;\n retryIntervalOnError?: number;\n refreshInterval?: number;\n /** How long cached data stays fresh before a read revalidates it, in ms. */\n staleTime?: number;\n debug?: boolean;\n lazy?: boolean;\n /**\n * When true (the default), a query with no cached data suspends the nearest\n * `Suspense` boundary instead of returning `loading: true`, and an HTTP\n * failure throws into the nearest error boundary. `lazy: true` implies\n * `suspense: false`.\n */\n suspense?: boolean;\n refetchUntil?: (data: T, duration: number) => number;\n}\n\ntype WithOptionalValues<T> = {\n [K in keyof T]: T[K] | null;\n};\n\nconst defaultConfig: Config<any> = {\n fallbackData: null,\n keepPreviousData: true,\n retryIntervalOnError: 10000,\n refreshInterval: 999999,\n staleTime: DEFAULT_STALE_TIME,\n debug: false,\n lazy: false,\n suspense: true,\n};\n\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<any, infer Data, any>\n ? UnwrapPromise<Data>\n : never;\n\ntype Input<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<infer I, any, any> ? I : never;\n\ntype QueryOptions<T extends keyof GetRPC> = {\n search?: Partial<WithOptionalValues<Input<T>>>;\n};\n\ntype Error = Record<string, unknown>;\n\nconst defaultOptions: QueryOptions<any> & { params?: Record<string, any> } = {\n params: {} as Record<string, string>,\n search: {} as Record<string, string>,\n};\n\nexport type QueryResult<T extends keyof GetRPC> = NestedPrettify<Data<T> & {}>;\n\ntype Options<T extends keyof GetRPC> = {\n search?: Record<string, string | number | boolean | null>;\n params?: Partial<UrlParser<`${T & string}`>>;\n};\n\ninterface QueryReturn<T extends keyof GetRPC, D> {\n data: D;\n loading: boolean;\n error: Error;\n mutate: {\n (fn?: NestedPrettify<Data<T>>): void;\n (fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>): void;\n };\n trigger: () => void;\n prefetch: () => void;\n refetch: () => void;\n version: number;\n}\n\n/**\n * A suspense-enabled query never renders without data, so `data` is\n * non-nullable. Opting out — `suspense: false` or `lazy: true` — brings back\n * the `loading` flag and with it a `data` that can be `undefined`.\n */\ninterface SuspenseConfig<T> extends Omit<Config<T>, \"suspense\" | \"lazy\"> {\n suspense?: true;\n lazy?: false;\n}\n\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n options?: Options<T>,\n config?: SuspenseConfig<Data<T>>,\n): QueryReturn<T, NestedPrettify<Data<T>>>;\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n options?: Options<T>,\n config?: Config<Data<T>>,\n): QueryReturn<T, NestedPrettify<Data<T>> | undefined>;\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n ...args: [options?: Options<T>, config?: Config<Data<T>>]\n) {\n const _params = useParams();\n const [_options = defaultOptions, _config = defaultConfig] = args;\n const options = { ...defaultOptions, ..._options };\n const config = { ...defaultConfig, ..._config };\n const suspense = config.suspense !== false && !config.lazy;\n const params =\n \"params\" in options ? { ..._params, ...options.params } : _params;\n const search = \"search\" in options ? (options.search ?? {}) : {};\n const { getResource } = useContext(QueryManagerContext);\n const serverQueries = useContext(ServerQueryContext);\n const normalPath = applyParams(url, params);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n const { prefetchedData } = useRouteData();\n // `fallbackData` is a single variant's value, so it seeds under this\n // query's variant key; `prefetchedData[normalPath]` is already the full\n // `{ [variantKey]: data }` map the server produced.\n const seed =\n config.fallbackData != null\n ? { [variantKey]: config.fallbackData }\n : prefetchedData?.[normalPath];\n // A memoized map lookup on the provider's ref: stable and cheap, so the\n // resource is derived every render — a params change swaps it in the same\n // render pass instead of flashing through an effect.\n const resource = getResource(normalPath, seed ?? undefined);\n const lazy = config.lazy;\n\n const configRef = useRef(config);\n configRef.current = config;\n\n const refreshIntervalRef = useRef<ReturnType<typeof setInterval> | null>(\n null,\n );\n const retryIntervalRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const retryingMap = useRef<Map<string, boolean>>(new Map());\n const fetchedRef = useRef(!lazy);\n const refetchUntilTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const refetchUntilDurationRef = useRef(0);\n const prefetchedRef = useRef(false);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => resource.store.subscribe(onStoreChange),\n [resource],\n );\n // `peek` hands back the object stored in the map — its identity only\n // changes on a real write, so the snapshot is stable across render\n // attempts. Also the server snapshot: SSR renders whatever the prefetch\n // payload seeded, and never fetches.\n //\n // uSES and transitions: store updates are always urgent, so a write landing\n // mid-transition restarts the pending transition — wasted work, never wrong\n // UI. Exposure is kept small by design: render-phase reads never write the\n // store synchronously (fetches are silent), and a suspended component has no\n // subscription — it is woken by its thrown promise, not the store. The\n // navigation-shaped consequences are pinned in `useQuery.transition.test.tsx`.\n const getSnapshot = useCallback(\n () => resource.peek(variantKey),\n [resource, variantKey],\n );\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n\n // `keepPreviousData`: remember the last snapshot that had data, and show it\n // whenever the current one is loading without data (e.g. a variant change\n // with `suspense: false`). Presence is `hasData`, never `data`'s truthiness\n // — `null`/`0`/`false`/`\"\"` are legitimate response bodies.\n const lastDataRef = useRef(snapshot?.hasData ? snapshot : null);\n useEffect(() => {\n if (snapshot?.hasData) {\n lastDataRef.current = snapshot;\n }\n }, [snapshot]);\n\n let state = snapshot;\n if (\n config.keepPreviousData &&\n !snapshot?.hasData &&\n snapshot?.loading &&\n lastDataRef.current\n ) {\n state = { ...lastDataRef.current, loading: true };\n }\n\n // The render-phase read for the suspense path. Only when there is nothing\n // to show — data in hand always renders, and revalidation stays where it\n // was (the mount effect below). Both reads dedupe across the render\n // attempts React discards, so this is safe to hit on every attempt.\n //\n // On a streaming server render the read goes to the request's\n // `ServerQueryStore` instead of the client resource: a prefetched query is\n // already in flight there and is joined, an undiscovered one starts now\n // (the store logs the late-discovery hint when that cost something).\n let readPromise: Promise<void> | undefined;\n let serverError: unknown;\n if (suspense && !state?.hasData && !state?.error) {\n if (typeof window === \"undefined\") {\n if (serverQueries) {\n const entry = serverQueries.ensure(url, { params, search });\n if (entry.status === \"resolved\") {\n state = {\n loading: false,\n data: entry.data,\n hasData: true,\n error: null,\n version: 0,\n };\n } else if (entry.status === \"rejected\") {\n serverError = entry.error;\n } else {\n readPromise = entry.promise;\n }\n }\n } else {\n readPromise = resource.read(variantKey, config.staleTime).promise;\n }\n }\n\n if (\n suspense &&\n typeof window === \"undefined\" &&\n !serverQueries &&\n !state?.hasData &&\n process.env.NODE_ENV !== \"production\"\n ) {\n const searchHint = variantKey\n ? `, { search: ${JSON.stringify(Object.fromEntries(searchParams))} }`\n : \"\";\n console.warn(\n `[gemi] useQuery(\"${url}\") rendered on the server without data. ` +\n `The server never fetches, so this page ships without it and the ` +\n `client suspends after hydration. Add ` +\n `\\`Query.prefetch(\"${url}\"${searchHint})\\` to the route's view handler.`,\n );\n }\n\n const retry = useCallback(\n (vk: string) => {\n if (!retryingMap.current.get(vk)) {\n if (configRef.current.debug) console.log(\"retrying\", vk);\n retryingMap.current.set(vk, true);\n retryIntervalRef.current = setTimeout(() => {\n resource.getVariant(vk, configRef.current.staleTime);\n retryingMap.current.set(vk, false);\n }, configRef.current.retryIntervalOnError);\n }\n },\n [resource],\n );\n\n // Mount / variant-change revalidation — unchanged semantics: `getVariant`\n // fetches when the variant is missing or stale, and now joins an in-flight\n // render-initiated read instead of racing it.\n useEffect(() => {\n if (fetchedRef.current) {\n resource.getVariant(variantKey, configRef.current.staleTime);\n }\n return () => {\n clearTimeout(retryIntervalRef.current);\n };\n }, [variantKey, resource]);\n\n // With `suspense: false` an error is returned and retried in the\n // background; under suspense it throws below instead.\n useEffect(() => {\n if (!suspense && snapshot?.error) {\n retry(variantKey);\n }\n }, [snapshot, suspense, retry, variantKey]);\n\n useEffect(() => {\n const cfg = configRef.current;\n if (!cfg.refetchUntil) return;\n if (snapshot && !snapshot.loading && snapshot.hasData && !snapshot.error) {\n const nextDuration = cfg.refetchUntil(\n snapshot.data,\n refetchUntilDurationRef.current,\n );\n if (nextDuration > 0) {\n refetchUntilDurationRef.current = nextDuration;\n refetchUntilTimerRef.current = setTimeout(() => {\n resource.refetch(variantKey);\n }, nextDuration);\n } else {\n refetchUntilDurationRef.current = 0;\n }\n }\n return () => {\n if (refetchUntilTimerRef.current) {\n clearTimeout(refetchUntilTimerRef.current);\n }\n };\n }, [snapshot, resource, variantKey]);\n\n const handleReload = useCallback(() => {\n if (configRef.current.debug) {\n console.log(\"Reloading query for\", variantKey);\n }\n const data = resource.getVariant(\n variantKey,\n configRef.current.staleTime,\n ).data;\n resource.mutate(variantKey, () => data);\n }, [variantKey, resource]);\n\n useEffect(() => {\n if (!fetchedRef.current) return;\n refreshIntervalRef.current = setInterval(() => {\n handleReload();\n }, config.refreshInterval);\n\n return () => {\n if (refreshIntervalRef.current) {\n clearInterval(refreshIntervalRef.current);\n }\n };\n }, [config.refreshInterval, handleReload]);\n\n useEffect(() => {\n // Feature-checked per method: vitest's `import.meta.hot` shim has `on`\n // but not `off`.\n // @ts-ignore\n if (typeof import.meta.hot?.on === \"function\") {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (typeof import.meta.hot?.off === \"function\") {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n const trigger = useCallback(() => {\n fetchedRef.current = true;\n const store = resource.store.getValue();\n const variant = store.get(variantKey);\n if (!variant || (!variant.loading && !variant.hasData)) {\n resource.refetch(variantKey);\n }\n }, [resource, variantKey]);\n\n const prefetch = useCallback(() => {\n if (prefetchedRef.current) return;\n prefetchedRef.current = true;\n fetchedRef.current = true;\n // `read`, not `refetch`: a suspending read that follows joins this\n // request instead of racing it, and fresh data is a no-op.\n resource.read(variantKey, configRef.current.staleTime);\n }, [resource, variantKey]);\n\n const refetch = useCallback(() => {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n function mutate(fn?: NestedPrettify<Data<T>>): void;\n function mutate(\n fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>,\n ): void;\n function mutate(fn?: any) {\n if (!fn) {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n return;\n }\n return resource.mutate(variantKey, (data: any) => {\n // `null` is a legitimate cached body; only `undefined` means the query\n // hasn't produced anything (and `mutate` refetches instead of calling\n // this in that case).\n if (data === undefined) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches so a stray value can't corrupt the\n // cache; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n }\n\n // Suspend last, after every hook has run: the attempt React discards ran\n // them all, and the retry re-runs them identically. The promise is *thrown*\n // rather than passed to `use()` — the thenable-throw protocol is what\n // React's ping-and-retry machinery is built around (React.lazy, SWR, React\n // Query), whereas `use()` on a client-created promise is documented as\n // unsupported outside a Suspense-compatible framework and React never\n // retries it. A streaming server render takes the same paths: a pending\n // entry suspends (React streams the fallback and resumes on settle), and a\n // rejected one throws so the segment falls back to client rendering, where\n // the browser's own fetch surfaces the error into the boundary.\n if (suspense) {\n if (serverError) {\n throw serverError;\n }\n if (state?.error && !state?.hasData) {\n throw state.error;\n }\n if (!state?.hasData && readPromise) {\n throw readPromise;\n }\n }\n\n return {\n data: state?.data as NestedPrettify<Data<T>>,\n loading: state?.loading ?? !lazy,\n error: state?.error as Error,\n mutate,\n trigger,\n prefetch,\n refetch,\n version: state?.version as number,\n };\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","var Pe=Object.defineProperty;var a=(e,t)=>Pe(e,\"name\",{value:t,configurable:!0});var P=class{type=3;name=\"\";prefix=\"\";value=\"\";suffix=\"\";modifier=3;constructor(t,r,n,c,l,f){this.type=t,this.name=r,this.prefix=n,this.value=c,this.suffix=l,this.modifier=f}hasCustomName(){return this.name!==\"\"&&typeof this.name!=\"number\"}};a(P,\"Part\");var Re=/[$_\\p{ID_Start}]/u,Ee=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,v=\".*\";function Oe(e,t){return(t?/^[\\x00-\\xFF]*$/:/^[\\x00-\\x7F]*$/).test(e)}a(Oe,\"isASCII\");function D(e,t=!1){let r=[],n=0;for(;n<e.length;){let c=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:\"INVALID_CHAR\",index:n,value:e[n++]})},\"ErrorOrInvalid\");if(c===\"*\"){r.push({type:\"ASTERISK\",index:n,value:e[n++]});continue}if(c===\"+\"||c===\"?\"){r.push({type:\"OTHER_MODIFIER\",index:n,value:e[n++]});continue}if(c===\"\\\\\"){r.push({type:\"ESCAPED_CHAR\",index:n++,value:e[n++]});continue}if(c===\"{\"){r.push({type:\"OPEN\",index:n,value:e[n++]});continue}if(c===\"}\"){r.push({type:\"CLOSE\",index:n,value:e[n++]});continue}if(c===\":\"){let f=\"\",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&Re.test(i)||s!==n+1&&Ee.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:\"NAME\",index:n,value:f}),n=s;continue}if(c===\"(\"){let f=1,s=\"\",i=n+1,o=!1;if(e[i]===\"?\"){l(`Pattern cannot start with \"?\" at ${i}`);continue}for(;i<e.length;){if(!Oe(e[i],!1)){l(`Invalid character '${e[i]}' at ${i}.`),o=!0;break}if(e[i]===\"\\\\\"){s+=e[i++]+e[i++];continue}if(e[i]===\")\"){if(f--,f===0){i++;break}}else if(e[i]===\"(\"&&(f++,e[i+1]!==\"?\")){l(`Capturing groups are not allowed at ${i}`),o=!0;break}s+=e[i++]}if(o)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:\"REGEX\",index:n,value:s}),n=i;continue}r.push({type:\"CHAR\",index:n,value:e[n++]})}return r.push({type:\"END\",index:n,value:\"\"}),r}a(D,\"lexer\");function F(e,t={}){let r=D(e);t.delimiter??=\"/#?\",t.prefixes??=\"./\";let n=`[^${x(t.delimiter)}]+?`,c=[],l=0,f=0,s=\"\",i=new Set,o=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},\"tryConsume\"),h=a(()=>o(\"OTHER_MODIFIER\")??o(\"ASTERISK\"),\"tryConsumeModifier\"),p=a(u=>{let d=o(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},\"mustConsume\"),A=a(()=>{let u=\"\",d;for(;d=o(\"CHAR\")??o(\"ESCAPED_CHAR\");)u+=d;return u},\"consumeText\"),xe=a(u=>u,\"DefaultEncodePart\"),N=t.encodePart||xe,H=\"\",$=a(u=>{H+=u},\"appendToPendingFixedValue\"),M=a(()=>{H.length&&(c.push(new P(3,\"\",\"\",N(H),\"\",3)),H=\"\")},\"maybeAddPartFromPendingFixedValue\"),X=a((u,d,g,y,Z)=>{let m=3;switch(Z){case\"?\":m=1;break;case\"*\":m=0;break;case\"+\":m=2;break}if(!d&&!g&&m===3){$(u);return}if(M(),!d&&!g){if(!u)return;c.push(new P(3,\"\",\"\",N(u),\"\",m));return}let S;g?g===\"*\"?S=v:S=g:S=n;let k=2;S===n?(k=1,S=\"\"):S===v&&(k=0,S=\"\");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),c.push(new P(k,E,N(u),S,N(y),m))},\"addPart\");for(;f<r.length;){let u=o(\"CHAR\"),d=o(\"NAME\"),g=o(\"REGEX\");if(!d&&!g&&(g=o(\"ASTERISK\")),d||g){let m=u??\"\";t.prefixes.indexOf(m)===-1&&($(m),m=\"\"),M();let S=h();X(m,d,g,\"\",S);continue}let y=u??o(\"ESCAPED_CHAR\");if(y){$(y);continue}if(o(\"OPEN\")){let m=A(),S=o(\"NAME\"),k=o(\"REGEX\");!S&&!k&&(k=o(\"ASTERISK\"));let E=A();p(\"CLOSE\");let be=h();X(m,S,k,E,be);continue}M(),p(\"END\")}return c}a(F,\"parse\");function x(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(x,\"escapeString\");function B(e){return e&&e.ignoreCase?\"ui\":\"u\"}a(B,\"flags\");function q(e,t,r){return W(F(e,r),t,r)}a(q,\"stringToRegexp\");function T(e){switch(e){case 0:return\"*\";case 1:return\"?\";case 2:return\"+\";case 3:return\"\"}}a(T,\"modifierToString\");function W(e,t,r={}){r.delimiter??=\"/#?\",r.prefixes??=\"./\",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith=\"\";let n=r.start?\"^\":\"\";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,o=s.value;if(s.type===1?o=i:s.type===0&&(o=v),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${o})${T(s.modifier)}`:n+=`((?:${o})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${o})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${o})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${o}))*)${x(s.suffix)})`,s.modifier===0&&(n+=\"?\")}let c=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${c})`:n+=\"$\",new RegExp(n,B(r));r.strict||(n+=`(?:${l}(?=${c}))?`);let f=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1)}return f||(n+=`(?=${l}|${c})`),new RegExp(n,B(r))}a(W,\"partsToRegexp\");var b={delimiter:\"\",prefixes:\"\",sensitive:!0,strict:!0},J={delimiter:\".\",prefixes:\"\",sensitive:!0,strict:!0},Q={delimiter:\"/\",prefixes:\"/\",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]===\"/\"?!0:!t||e.length<2?!1:(e[0]==\"\\\\\"||e[0]==\"{\")&&e[1]==\"/\":!1}a(ee,\"isAbsolutePathname\");function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(te,\"maybeStripPrefix\");function ke(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(ke,\"maybeStripSuffix\");function _(e){return!e||e.length<2?!1:e[0]===\"[\"||(e[0]===\"\\\\\"||e[0]===\"{\")&&e[1]===\"[\"}a(_,\"treatAsIPv6Hostname\");var re=[\"ftp\",\"file\",\"http\",\"https\",\"ws\",\"wss\"];function U(e){if(!e)return!0;for(let t of re)if(e.test(t))return!0;return!1}a(U,\"isSpecialScheme\");function ne(e,t){if(e=te(e,\"#\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):\"\"}a(ne,\"canonicalizeHash\");function se(e,t){if(e=te(e,\"?\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.search=e,r.search?r.search.substring(1,r.search.length):\"\"}a(se,\"canonicalizeSearch\");function ie(e,t){return t||e===\"\"?e:_(e)?K(e):j(e)}a(ie,\"canonicalizeHostname\");function ae(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.password=e,r.password}a(ae,\"canonicalizePassword\");function oe(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.username=e,r.username}a(oe,\"canonicalizeUsername\");function ce(e,t,r){if(r||e===\"\")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]==\"/\";return e=new URL(n?e:\"/-\"+e,\"https://example.com\").pathname,n||(e=e.substring(2,e.length)),e}a(ce,\"canonicalizePathname\");function le(e,t,r){return z(t)===e&&(e=\"\"),r||e===\"\"?e:G(e)}a(le,\"canonicalizePort\");function fe(e,t){return e=ke(e,\":\"),t||e===\"\"?e:w(e)}a(fe,\"canonicalizeProtocol\");function z(e){switch(e){case\"ws\":case\"http\":return\"80\";case\"wws\":case\"https\":return\"443\";case\"ftp\":return\"21\";default:return\"\"}}a(z,\"defaultPortForProtocol\");function w(e){if(e===\"\")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,\"protocolEncodeCallback\");function he(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.username=e,t.username}a(he,\"usernameEncodeCallback\");function ue(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.password=e,t.password}a(ue,\"passwordEncodeCallback\");function j(e){if(e===\"\")return e;if(/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL(\"https://example.com\");return t.hostname=e,t.hostname}a(j,\"hostnameEncodeCallback\");function K(e){if(e===\"\")return e;if(/[^0-9a-fA-F[\\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(K,\"ipv6HostnameEncodeCallback\");function G(e){if(e===\"\"||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(G,\"portEncodeCallback\");function de(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.pathname=e[0]!==\"/\"?\"/-\"+e:e,e[0]!==\"/\"?t.pathname.substring(2,t.pathname.length):t.pathname}a(de,\"standardURLPathnameEncodeCallback\");function pe(e){return e===\"\"?e:new URL(`data:${e}`).pathname}a(pe,\"pathURLPathnameEncodeCallback\");function ge(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.search=e,t.search.substring(1,t.search.length)}a(ge,\"searchEncodeCallback\");function me(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.hash=e,t.hash.substring(1,t.hash.length)}a(me,\"hashEncodeCallback\");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type===\"END\"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r)}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port=\"\")}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;case 10:break}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=\"\"),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?\"/\":\"\"),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??=\"\")),this.#R(t,r)}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0}#b(){this.#e=this.#l,this.#s=0}#u(t){this.#b(),this.#o=t}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type===\"CHAR\"||n.type===\"ESCAPED_CHAR\"||n.type===\"INVALID_CHAR\")}#P(){return this.#a(this.#e,\":\")}#E(){return this.#a(this.#e+1,\"/\")&&this.#a(this.#e+2,\"/\")}#S(){return this.#a(this.#e,\"@\")}#O(){return this.#a(this.#e,\":\")}#k(){return this.#a(this.#e,\":\")}#x(){return this.#a(this.#e,\"/\")}#h(){if(this.#a(this.#e,\"?\"))return!0;if(this.#n[this.#e].value!==\"?\")return!1;let t=this.#m(this.#e-1);return t.type!==\"NAME\"&&t.type!==\"REGEX\"&&t.type!==\"CLOSE\"&&t.type!==\"ASTERISK\"}#f(){return this.#a(this.#e,\"#\")}#T(){return this.#n[this.#e].type==\"OPEN\"}#A(){return this.#n[this.#e].type==\"CLOSE\"}#y(){return this.#a(this.#e,\"[\")}#w(){return this.#a(this.#e,\"]\")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=q(this.#c(),void 0,t);this.#g=U(r)}};a(C,\"Parser\");var V=[\"protocol\",\"username\",\"password\",\"hostname\",\"port\",\"pathname\",\"search\",\"hash\"],O=\"*\";function Se(e,t){if(typeof e!=\"string\")throw new TypeError(\"parameter 1 is not of type 'string'.\");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==\"\"?r.search.substring(1,r.search.length):void 0,hash:r.hash!==\"\"?r.hash.substring(1,r.hash.length):void 0}}a(Se,\"extractValues\");function R(e,t){return t?I(e):e}a(R,\"processBaseURLString\");function L(e,t,r){let n;if(typeof t.baseURL==\"string\")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==\"string\"&&(e.protocol=fe(t.protocol,r)),typeof t.username==\"string\"&&(e.username=oe(t.username,r)),typeof t.password==\"string\"&&(e.password=ae(t.password,r)),typeof t.hostname==\"string\"&&(e.hostname=ie(t.hostname,r)),typeof t.port==\"string\"&&(e.port=le(t.port,e.protocol,r)),typeof t.pathname==\"string\"){if(e.pathname=t.pathname,n&&!ee(e.pathname,r)){let c=n.pathname.lastIndexOf(\"/\");c>=0&&(e.pathname=R(n.pathname.substring(0,c+1),r)+e.pathname)}e.pathname=ce(e.pathname,e.protocol,r)}return typeof t.search==\"string\"&&(e.search=se(t.search,r)),typeof t.hash==\"string\"&&(e.hash=ne(t.hash,r)),e}a(L,\"applyInit\");function I(e){return e.replace(/([+*?:{}()\\\\])/g,\"\\\\$1\")}a(I,\"escapePatternString\");function Te(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(Te,\"escapeRegexpString\");function Ae(e,t){t.delimiter??=\"/#?\",t.prefixes??=\"./\",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=\"\";let r=\".*\",n=`[^${Te(t.delimiter)}]+?`,c=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,l=\"\";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),o=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!o&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:\"\";o=c.test(A)}else o=!p.hasCustomName();if(!o&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];o=t.prefixes.includes(A)}o&&(l+=\"{\"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||o||s.prefix!==\"\")?l+=\"*\":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&c.test(s.suffix[0])&&(l+=\"\\\\\"),l+=I(s.suffix),o&&(l+=\"}\"),s.modifier!==3&&(l+=T(s.modifier))}return l}a(Ae,\"partsToPattern\");var Y=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let c;if(typeof r==\"string\"?c=r:n=r,typeof t==\"string\"){let i=new C(t);if(i.parse(),t=i.result,c===void 0&&typeof t.protocol!=\"string\")throw new TypeError(\"A base URL must be provided for a relative constructor string.\");t.baseURL=c}else{if(!t||typeof t!=\"object\")throw new TypeError(\"parameter 1 is not of type 'string' and cannot convert to dictionary.\");if(c)throw new TypeError(\"parameter 1 is not of type 'string'.\")}typeof n>\"u\"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port=\"\");let s;for(s of V){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case\"protocol\":Object.assign(i,b),i.encodePart=w;break;case\"username\":Object.assign(i,b),i.encodePart=he;break;case\"password\":Object.assign(i,b),i.encodePart=ue;break;case\"hostname\":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case\"port\":Object.assign(i,b),i.encodePart=G;break;case\"pathname\":U(this.#n.protocol)?(Object.assign(i,Q,l),i.encodePart=de):(Object.assign(i,b,l),i.encodePart=pe);break;case\"search\":Object.assign(i,b,l),i.encodePart=ge;break;case\"hash\":Object.assign(i,b,l),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ae(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2)}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(c){throw new TypeError(`Failed to construct 'URLPattern': ${c.message}`)}}get[Symbol.toStringTag](){return\"URLPattern\"}test(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return!1;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return!1}let c;for(c of V)if(!this.#n[c].exec(n[c]))return!1;return!0}exec(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return null}let c={};r?c.inputs=[t,r]:c.inputs=[t];let l;for(l of V){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,o]of this.#t[l].entries())if(typeof o==\"string\"||typeof o==\"number\"){let h=f[i+1];s[o]=h}c[l]={input:n[l]??\"\",groups:s}}return c}static compareComponent(t,r,n){let c=a((i,o)=>{for(let h of[\"type\",\"modifier\",\"prefix\",\"value\",\"suffix\"]){if(i[h]<o[h])return-1;if(i[h]===o[h])continue;return 1}return 0},\"comparePart\"),l=new P(3,\"\",\"\",\"\",\"\",3),f=new P(0,\"\",\"\",\"\",\"\",3),s=a((i,o)=>{let h=0;for(;h<Math.min(i.length,o.length);++h){let p=c(i[h],o[h]);if(p)return p}return i.length===o.length?0:c(i[h]??l,o[h]??l)},\"comparePartList\");return!r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(Y,\"URLPattern\");export{Y as URLPattern};\n","import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n","export function sleep(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n","import { Subject } from \"../utils/Subject\";\nimport { sleep } from \"../utils/sleep\";\n\nexport class ProgressManager {\n state = new Subject(100);\n unsubscribe: ReturnType<InstanceType<typeof Subject>[\"subscribe\"]>;\n timer: ReturnType<typeof setInterval>;\n tick = 0;\n isTicking = false;\n\n constructor(subject: Subject<boolean>) {\n this.unsubscribe = subject.subscribe((state) => {\n if (state) {\n this.start();\n } else {\n this.end();\n }\n });\n }\n\n getNextIncrement() {\n const current = this.state.getValue();\n if (current === 100) {\n return Math.ceil(Math.random() * 10);\n }\n\n if (current <= 20) {\n if (Math.ceil(Math.random() * 100) > 80) {\n return current;\n }\n return current + Math.ceil(Math.random() * 5) + 1;\n }\n\n if (current <= 50) {\n if (Math.ceil(Math.random() * 100) > 50) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 10), 70);\n }\n\n if (current <= 70) {\n if (Math.ceil(Math.random() * 100) > 60) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 3), 80);\n }\n\n if (current <= 80) {\n return Math.min(current + Math.ceil(Math.random() * 1), 90);\n }\n\n if (current <= 90) {\n const x = Math.ceil(Math.random() * 100) > 50 ? 0 : 1;\n return Math.min(current + x, 94);\n }\n\n if (current <= 94) {\n const x = Math.ceil(Math.random() * 100) > 20 ? 0 : 1;\n return Math.min(current + x, 99);\n }\n }\n\n getNextInterval() {\n if (this.tick === 0) {\n this.tick = 1;\n return 200;\n }\n const current = this.state.getValue();\n\n if (current >= 88) {\n return 400;\n }\n if (current >= 94) {\n return 1000;\n }\n if (current >= 98) {\n return 2000;\n }\n return 100;\n }\n\n async nextTick() {\n if (!this.isTicking) {\n return;\n }\n await sleep(this.getNextInterval());\n\n if (!this.isTicking) {\n return;\n }\n\n const increment = this.getNextIncrement();\n this.state.next(Math.min(increment, 96));\n\n await this.nextTick();\n }\n\n start() {\n this.isTicking = true;\n this.nextTick();\n }\n\n end() {\n this.state.next(99);\n this.isTicking = false;\n this.tick = 0;\n setTimeout(() => {\n this.state.next(100);\n }, 200);\n }\n\n destroy() {\n this.end();\n this.unsubscribe();\n }\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useLocation() {\n const ctx = useContext(RouteStateContext);\n if (!ctx) {\n throw new Error(\"Router context not found\");\n }\n const { hash, pathname, search, state, locale } = ctx;\n return {\n hash,\n key: pathname,\n pathname,\n search,\n state,\n locale,\n };\n}\n","import { createContext, type PropsWithChildren } from \"react\";\nimport type { Translations } from \"./I18nContext\";\nimport type { ComponentTree } from \"./types\";\nimport type { User } from \"../auth/adapters/types\";\n\ntype Data = Record<string, any>;\n\nexport interface ServerDataContextValue {\n routeManifest: Record<string, string[]>;\n pageData: Record<string, Record<string, Data>>;\n breadcrumbs: Record<string, { label: string; href: string }>;\n prefetchedData: Record<string, Data>;\n router: {\n pathname: string;\n params: Record<string, any>;\n currentPath: string;\n is404: boolean;\n searchParams: string;\n urlLocaleSegment: string | null;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n defaultLocale: string;\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n __csrf: string;\n cssManifest: Record<string, string[]>;\n meta: any;\n appId: string;\n}\n\nexport const ServerDataContext = createContext({} as ServerDataContextValue);\n\ninterface ServerDataProviderProps {\n value?: ServerDataContextValue;\n}\n\nexport const ServerDataProvider = (\n props: PropsWithChildren<ServerDataProviderProps>,\n) => {\n let _value = props.value;\n // Server\n if (props.value) {\n _value = props.value;\n } else {\n // Client\n _value = (window as any).__GEMI_DATA__;\n }\n\n return (\n <ServerDataContext.Provider value={_value}>\n {props.children}\n </ServerDataContext.Provider>\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\ntype TranslationScope = Record<string, string>;\ntype TranslationScopes = Record<string, TranslationScope>;\nexport type Translations = Record<string, TranslationScopes>;\n\ninterface I18nContextValue {\n locale: string;\n changeLocale: (locale: string) => void;\n updateDictionary: (\n translations: Record<string, Record<string, Record<string, string>>>,\n locale?: string,\n ) => void;\n fetchTranslations: (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => Promise<void>;\n getComponentTranslations: (key: string) => Record<string, string>;\n supportedLocales: string[];\n defaultLocale: string;\n}\n\nexport type CreateI18nDictionary<T> = {\n [K in keyof T]: T[K];\n};\n\nexport const I18nContext = createContext({} as I18nContextValue);\n\nexport type Dictionary = Map<string, Map<string, Record<string, string>>>;\n\nexport const I18nProvider = (props: PropsWithChildren) => {\n const { i18n } = useContext(ServerDataContext);\n\n const [currentLocale, setCurrentLocale] = useState(i18n.currentLocale);\n\n const dictionary = useRef<Dictionary>(\n (() => {\n const dictionary = new Map();\n for (const [locale, value] of Object.entries(i18n?.dictionary ?? {})) {\n const components = new Map();\n for (const [component, translations] of Object.entries(value)) {\n components.set(component, translations);\n }\n dictionary.set(locale, components);\n }\n return dictionary;\n })(),\n );\n\n function updateDictionary(\n translations: Record<string, Record<string, Record<string, string>>> = {},\n locale?: string,\n ) {\n for (const [locale, value] of Object.entries(translations)) {\n if (!dictionary.current.has(locale)) {\n dictionary.current.set(locale, new Map());\n }\n const scopes = dictionary.current.get(locale);\n for (const [scope, translations] of Object.entries(value)) {\n if (!scopes.has(scope)) {\n scopes.set(scope, {});\n }\n scopes.set(scope, translations);\n }\n }\n changeLocale(locale);\n }\n\n const changeLocale = (locale: string) => {\n if (dictionary.current.has(locale)) {\n setCurrentLocale(locale);\n }\n };\n\n const getTranslations = (locale: string) => {\n return (component: string) => {\n return dictionary.current.get(locale).get(component);\n };\n };\n\n const fetchTranslations = async (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => {\n if (Object.keys(i18n).length === 0) {\n return;\n }\n const response = await fetch(\n `/api/__gemi__/services/i18n/translations/${\n locale || currentLocale\n }${pathname === \"/\" ? \"\" : pathname}`,\n {\n signal,\n },\n );\n const translations = await response.json();\n updateDictionary(translations);\n };\n\n return (\n <I18nContext.Provider\n value={{\n getComponentTranslations: getTranslations(currentLocale),\n locale: currentLocale,\n changeLocale,\n updateDictionary,\n fetchTranslations,\n supportedLocales: i18n.supportedLocales,\n defaultLocale: i18n.defaultLocale,\n }}\n >\n {props.children}\n </I18nContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport type { UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport { I18nContext } from \"./I18nContext\";\n\ntype Options<T extends ViewPaths> = UrlParser<T> extends Record<string, never>\n ? {\n search?: Record<string, string | number | boolean | undefined | null>;\n shallow?: boolean;\n hash?: string;\n locale?: string;\n }\n : {\n search?: Record<string, string | number | boolean | undefined | null>;\n params: UrlParser<T>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n };\n\nexport function useNavigate() {\n const { history, setNavigationAbortController } =\n useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n function action(pushOrReplace: \"push\" | \"replace\") {\n return async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n const navigationAbortController = new AbortController();\n if (setNavigationAbortController) {\n setNavigationAbortController(navigationAbortController);\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n shallow,\n locale,\n hash,\n } = {\n params: {},\n shallow: false,\n locale: null,\n hash: \"\",\n ...options,\n };\n\n const urlSearchParams = new URLSearchParams(search);\n let localeSegment = location.locale;\n if (locale) {\n localeSegment = locale;\n }\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const routePath = applyParams(path, params);\n const navigationPath = [\n `${localeSegment ? `/${localeSegment}` : \"\"}${routePath === \"/\" ? \"\" : routePath}`,\n urlSearchParams.toString(),\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n\n const finalPath = [navigationPath, hash].filter(Boolean).join(\"\");\n\n if (shallow) {\n history?.[pushOrReplace](finalPath, { shallow });\n return;\n }\n\n history?.[pushOrReplace](finalPath === '' ? '/' : finalPath);\n };\n }\n\n return {\n push: action(\"push\"),\n replace: action(\"replace\"),\n };\n}\n","import { useContext } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { RouteStateContext } from \"./RouteStateContext\";\nimport { useParams } from \"./useParams\";\n\ntype SearchParamsCallback = (\n search: Record<string, any>,\n shallow: boolean,\n) => void;\n\nclass SearchParams {\n constructor(\n private searchParams: URLSearchParams,\n private callback: SearchParamsCallback,\n ) {}\n\n get(key: string) {\n return this.searchParams.get(key);\n }\n\n set(key: Record<string, string | ((state: string) => string)>): SearchParams;\n set(key: string, value: string | ((state: string) => string)): SearchParams;\n set(key: any, value?: any) {\n let entries: Record<string, any> = {};\n if (typeof key === \"string\") {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n entries[key] = _value;\n } else {\n entries = (key as any) ?? {};\n }\n for (const [key, value] of Object.entries(entries)) {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n this.searchParams.set(key, _value);\n }\n return this;\n }\n\n append(key: string, value: string) {\n this.searchParams.append(key, value);\n return this;\n }\n\n sort() {\n this.searchParams.sort();\n return this;\n }\n\n clear() {\n this.searchParams = new URLSearchParams();\n return this;\n }\n\n delete(key: string | string[]) {\n const keys = Array.isArray(key) ? key : [key];\n for (const key of keys) {\n this.searchParams.delete(key);\n }\n return this;\n }\n\n toJSON() {\n const map = new Map<string, string | string[]>();\n // @ts-ignore\n for (const [key, value] of this.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n\n return Object.fromEntries(map.entries());\n }\n\n toString() {\n return this.searchParams.toString();\n }\n\n push(mode: \"soft\" | \"hard\" = \"soft\") {\n this.callback(this.toJSON(), mode === \"soft\");\n }\n}\n\nexport function useSearchParams() {\n const { push } = useNavigate();\n const { search, pathname } = useContext(RouteStateContext);\n const params = useParams();\n\n const callback = (search: Record<string, never>, shallow: boolean) => {\n push(\n pathname as never,\n {\n params,\n search,\n shallow,\n } as any,\n );\n };\n\n const searchParams = new SearchParams(new URLSearchParams(search), callback);\n\n return searchParams;\n}\n","import { useContext } from \"react\";\nimport type { ViewPaths } from \"./types\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\ntype Pathname = ViewPaths;\n\nexport function useRoute() {\n const { pathname: _pathname } = useContext(RouteStateContext);\n return {\n pathname: _pathname,\n startsWith: (pathname: Pathname) => {\n return _pathname.startsWith(pathname);\n },\n };\n}\n","import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useSearchParams } from \"./useSearchParams\";\nimport { useRoute } from \"./useRoute\";\nimport { useParams } from \"./useParams\";\nimport { createPortal } from \"react-dom\";\n\nexport const HttpReload = () => {\n const { replace } = useNavigate();\n const searchParams = useSearchParams();\n const { pathname } = useRoute();\n const params = useParams();\n const [reloading, setReloading] = useState(false);\n\n const handleReload = () => {\n // The server recovered, so dismiss any Vite error overlay left on the page\n // (each element exposes a `close()` that also tears down its listeners).\n if (typeof document !== \"undefined\") {\n document.querySelectorAll(\"vite-error-overlay\").forEach((el: any) => {\n if (typeof el.close === \"function\") el.close();\n else el.remove();\n });\n }\n setReloading(true);\n // replace(pathname, {\n // params: params,\n // search: searchParams.toJSON(),\n // } as any)\n // .catch(console.log)\n // .finally(() => {\n // setReloading(false);\n // });\n };\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n if (!reloading || typeof document === \"undefined\") {\n return null;\n }\n return createPortal(\n <div className=\"fixed z-[1000] bottom-0 right-0 p-2\">\n <div className=\"p-2 bg-white text-black rounded-md shadow-md\">...</div>\n </div>,\n document.body,\n );\n};\n","/**\n * How long a prefetched payload stays usable. Long enough to cover the gap\n * between hovering a link and clicking it, short enough that a navigation is\n * not served a snapshot the visitor would notice as out of date.\n *\n * A payload cached here is committed wholesale on navigation — including into\n * the query cache via `hydrate` — so anything that invalidates page data has to\n * `clear()` this too. `useMutation` does exactly that on every successful\n * write; locale needs no such call, since the locale segment is part of the key.\n */\nexport const PREFETCH_TTL = 10_000;\n\n/**\n * Ceiling on retained payloads. Entries only leave on their own when a\n * navigation consumes them, and `viewport`/`render` on a long list warms links\n * that are mostly never clicked — each one a full page payload. Oldest goes\n * first, which is also the one closest to expiry.\n */\nexport const PREFETCH_MAX_ENTRIES = 12;\n\ninterface Entry {\n promise: Promise<unknown>;\n createdAt: number;\n}\n\n/**\n * Payloads fetched ahead of a navigation, keyed by the `.json` URL that\n * navigation would request. Entries are handed over once — a navigation that\n * consumes one becomes the live route data, so keeping a copy around would only\n * let a later visit render from a stale snapshot.\n */\nexport class PrefetchCache {\n private entries = new Map<string, Entry>();\n\n private isFresh(entry: Entry) {\n return Date.now() - entry.createdAt < PREFETCH_TTL;\n }\n\n /** Drops what has expired, then the oldest of whatever is still over budget. */\n private evict() {\n for (const [url, entry] of this.entries) {\n if (!this.isFresh(entry)) {\n this.entries.delete(url);\n }\n }\n while (this.entries.size >= PREFETCH_MAX_ENTRIES) {\n const oldest = this.entries.keys().next().value;\n if (oldest === undefined) {\n return;\n }\n this.entries.delete(oldest);\n }\n }\n\n /**\n * Runs `load` unless the same URL is already in flight or freshly cached, so\n * a link hovered repeatedly — or a screenful of eagerly prefetched links\n * pointing at one route — costs a single request.\n */\n prime(url: string, load: () => Promise<unknown>): Promise<unknown> {\n const existing = this.entries.get(url);\n if (existing && this.isFresh(existing)) {\n return existing.promise;\n }\n\n this.evict();\n\n const entry: Entry = { createdAt: Date.now(), promise: null as never };\n entry.promise = load()\n .catch(() => null)\n .then((payload) => {\n // A failed prefetch is dropped rather than remembered: the navigation\n // falls back to its own request and the next hover gets to retry.\n if (payload == null && this.entries.get(url) === entry) {\n this.entries.delete(url);\n }\n return payload;\n });\n\n this.entries.set(url, entry);\n return entry.promise;\n }\n\n /**\n * Hands the payload for `url` to a navigation, if one was prefetched and is\n * still fresh. Resolves to `null` when the prefetch failed, which callers\n * must treat as a miss.\n */\n take(url: string): Promise<unknown> | null {\n const entry = this.entries.get(url);\n if (!entry) {\n return null;\n }\n this.entries.delete(url);\n return this.isFresh(entry) ? entry.promise : null;\n }\n\n /**\n * Drops everything, for when the data behind these payloads may have moved\n * on. In-flight loads still settle; their entries are simply gone by then.\n */\n clear() {\n this.entries.clear();\n }\n\n /** Retained entries, fresh or not. Exposed for tests. */\n get size() {\n return this.entries.size;\n }\n}\n","/**\n * The `.json` URL a route's page data is served from.\n *\n * Prefetching and navigation have to agree on this string exactly — the\n * prefetch cache is keyed by it, and any disagreement silently turns every\n * prefetch into a wasted request plus a full fetch on click.\n */\nexport function routeDataUrl(options: {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Query string including the leading `?`, or empty. */\n search?: string;\n /** `/tr-TR` style prefix, or empty for the default locale. */\n localeSegment?: string;\n}) {\n const { pathname, search = \"\", localeSegment = \"\" } = options;\n // `/tr-TR/.json` names nothing — the locale segment is the whole path there.\n const path = localeSegment.length > 0 && pathname === \"/\" ? \"\" : pathname;\n return `${localeSegment}${path}.json${search}`;\n}\n","/** One streamed query result: `[path, variantKey, data]`. */\nexport type RouteQueryPayload = [string, string, any];\n\n/**\n * Reads a navigation payload response (#290).\n *\n * The body is NDJSON: the first line is the envelope (route data, meta,\n * partial info, already-resolved `prefetchedData`), later lines are\n * `[path, variantKey, data]` query results streamed as they settle\n * server-side. The returned promise resolves with the envelope as soon as\n * its line arrives — the caller commits the navigation immediately — while\n * the remaining lines keep draining in the background into `onQueryPayload`,\n * whose `hydrate()` settles any segment that suspended on that variant.\n *\n * Tolerates two other body shapes so every producer keeps working: a plain\n * single-JSON body with no trailing newline (error-path responses, buffering\n * proxies) parses as the envelope at end-of-stream, and a `Response` without\n * a readable `body` (test doubles) falls back to `.json()`.\n */\nexport async function readRoutePayload(\n response: Response,\n onQueryPayload?: (payload: RouteQueryPayload) => void,\n): Promise<any | null> {\n const reader = response.body?.getReader?.();\n if (!reader) {\n try {\n return await response.json();\n } catch {\n return null;\n }\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n return await new Promise<any | null>((resolve) => {\n let envelopeResolved = false;\n const emitEnvelope = (value: any | null) => {\n if (envelopeResolved) return;\n envelopeResolved = true;\n resolve(value);\n };\n\n const handleLine = (line: string) => {\n if (line.trim().length === 0) return;\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch (error) {\n console.error(\"[gemi] Unparseable route payload line\", error);\n emitEnvelope(null);\n return;\n }\n if (!envelopeResolved) {\n emitEnvelope(value);\n return;\n }\n if (Array.isArray(value) && value.length === 3) {\n onQueryPayload?.(value as RouteQueryPayload);\n }\n };\n\n (async () => {\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n let newline = buffer.indexOf(\"\\n\");\n while (newline !== -1) {\n const line = buffer.slice(0, newline);\n buffer = buffer.slice(newline + 1);\n handleLine(line);\n newline = buffer.indexOf(\"\\n\");\n }\n }\n buffer += decoder.decode();\n // A plain-JSON body has no trailing newline: the whole buffer is the\n // envelope. (For NDJSON bodies the buffer is empty here.)\n handleLine(buffer);\n emitEnvelope(null);\n } catch (error) {\n console.error(\"[gemi] Route payload stream failed\", error);\n emitEnvelope(null);\n }\n })();\n });\n}\n\n/**\n * Reads the response to the very end and returns the envelope with every\n * streamed query result merged into its `prefetchedData` — the settled\n * aggregate a `<Link prefetch>` warms ahead of a click, equivalent to what\n * the old blocking payload contained. Buffering is the point here: a hover\n * prefetch has time, and the cache stores one complete payload.\n */\nexport async function readSettledRoutePayload(\n response: Response,\n): Promise<any | null> {\n if (typeof response.text !== \"function\") {\n // Test doubles that only implement `.json()`.\n try {\n return await response.json();\n } catch {\n return null;\n }\n }\n\n let text: string;\n try {\n text = await response.text();\n } catch {\n return null;\n }\n\n const lines = text.split(\"\\n\").filter((line) => line.trim().length > 0);\n if (lines.length === 0) return null;\n\n let envelope: any;\n try {\n envelope = JSON.parse(lines[0]);\n } catch {\n return null;\n }\n\n for (const line of lines.slice(1)) {\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch {\n continue;\n }\n if (Array.isArray(value) && value.length === 3) {\n const [path, variantKey, data] = value as RouteQueryPayload;\n envelope.prefetchedData ??= {};\n envelope.prefetchedData[path] ??= {};\n envelope.prefetchedData[path][variantKey] = data;\n }\n }\n return envelope;\n}\n","import type { ComponentTree } from \"../types\";\n\nexport function flattenComponentTree(componentTree: ComponentTree): string[] {\n let out: string[] = [];\n for (const [root, branches] of componentTree) {\n out.push(root, ...flattenComponentTree(branches).flat());\n }\n return Array.from(new Set(out));\n}\n","import { createContext, lazy, useMemo, type PropsWithChildren } from \"react\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\nimport type { ServerDataContextValue } from \"./ServerDataProvider\";\n\ndeclare const window: {\n __GEMI_DATA__: ServerDataContextValue;\n loaders: Record<\n string,\n () => Promise<{\n default: React.ComponentType<unknown>;\n }>\n >;\n} & Window;\n\n/**\n * Resolved view modules, not just their default exports. A route segment's\n * `Suspense` fallback and error UI come from optional named exports\n * (`Loading`, `Error`), and those have to be readable synchronously\n * while rendering — so every path that loads a view chunk records the module\n * here. Browsers dedupe the underlying dynamic import, so calling\n * `loadViewModule` repeatedly is free.\n */\nconst viewModules = new Map<string, Record<string, any>>();\nconst viewModuleListeners = new Set<() => void>();\n\nexport function loadViewModule(name: string): Promise<any> {\n const loader =\n typeof window !== \"undefined\" ? window.loaders?.[name] : undefined;\n if (!loader) return Promise.resolve(null);\n return Promise.resolve(loader()).then((mod) => {\n const isNew = !viewModules.has(name);\n viewModules.set(name, mod);\n // Notify on first registration so a `Route` that rendered before its\n // module arrived re-reads it — otherwise a hard load could suspend into\n // a `null` fallback while the view's `Loading` export sits in the module.\n if (isNew) {\n for (const listener of viewModuleListeners) listener();\n }\n return mod;\n });\n}\n\nexport function subscribeViewModules(listener: () => void) {\n viewModuleListeners.add(listener);\n return () => {\n viewModuleListeners.delete(listener);\n };\n}\n\nexport function getViewModule(name: string) {\n return viewModules.get(name);\n}\n\nlet viewImportMap: Record<string, ReturnType<typeof lazy>> | null = null;\nif (typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\") {\n viewImportMap = {};\n const { componentTree = [] } = window.__GEMI_DATA__ ?? {};\n\n for (const viewName of flattenComponentTree(componentTree)) {\n viewImportMap[viewName] = lazy(() => loadViewModule(viewName));\n }\n}\n\nexport const ComponentsContext = createContext({\n viewImportMap,\n getViewModule,\n});\n\nexport const ComponentsProvider = (\n props: PropsWithChildren<{\n viewImportMap: typeof viewImportMap;\n /**\n * Server only: the fully-loaded view modules, so `Loading`/`Error`\n * exports resolve during a streaming render. The browser leaves this\n * unset and reads the registry `loadViewModule` fills instead.\n */\n modules?: Record<string, Record<string, any>>;\n }>,\n) => {\n const { modules } = props;\n const value = useMemo(\n () => ({\n viewImportMap: props.viewImportMap ?? viewImportMap,\n getViewModule: modules\n ? (name: string) => modules[name] ?? getViewModule(name)\n : getViewModule,\n }),\n [props.viewImportMap, modules],\n );\n return (\n <ComponentsContext.Provider value={value}>\n {props.children}\n </ComponentsContext.Provider>\n );\n};\n","import { type Action, type History, createBrowserHistory } from \"history\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n} from \"react\";\nimport { Subject } from \"../utils/Subject\";\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { ProgressManager } from \"./ProgressManager\";\nimport { HttpReload } from \"./HttpReload\";\nimport type { Breadcrumb } from \"./useBreadcrumbs\";\nimport type { RouteState } from \"./RouteStateContext\";\nimport { I18nContext } from \"./I18nContext\";\nimport { PrefetchCache } from \"./PrefetchCache\";\nimport { routeDataUrl } from \"./helpers/routeDataUrl\";\nimport { readSettledRoutePayload } from \"./helpers/readRoutePayload\";\nimport { loadViewModule } from \"./ComponentContext\";\n\nexport interface PrefetchTarget {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Query string including the leading `?`, or empty. */\n search?: string;\n /** `/tr-TR` style prefix, or empty for the default locale. */\n localeSegment?: string;\n}\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n }\n}\n\ninterface ClientRouterContextValue {\n viewEntriesSubject: Subject<string[]>;\n history: History | null;\n updatePageData: (\n pageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => void;\n getPageData: (key: string, pathname: string) => Record<string, unknown>;\n getScrollPosition: (path: string) => number;\n getViewPathsFromPathname: (pathname: string) => string[];\n getRoutePathnameFromHref: (href: string) => string | null;\n isNavigatingSubject: Subject<boolean>;\n setNavigationAbortController: (controller: AbortController) => void;\n progressManager: ProgressManager;\n fetchRouteCSS: (routePath: string) => Promise<void>;\n prefetchRoute: (target: PrefetchTarget) => Promise<void>;\n takePrefetched: (url: string) => Promise<unknown> | null;\n clearPrefetchCache: () => void;\n breadcrumbsCache: Map<string, Breadcrumb>;\n routerSubject: Subject<RouteState>;\n urlLocaleSegment: string | null;\n}\n\nexport const ClientRouterContext = createContext(\n {} as ClientRouterContextValue,\n);\n\ninterface ClientRouterProviderProps {\n pathname: string;\n routeManifest: Record<string, string[]>;\n cssManifest: Record<string, string[]>;\n pageData: Record<string, unknown>;\n currentPath: string;\n urlLocaleSegment: string | null;\n params: Record<string, string>;\n searchParams: string;\n is404: boolean;\n is500: boolean;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\n/**\n * Whether `file`'s CSS is already on the page, in either of the two shapes it\n * can take. A client navigation appends `<style id={file}>`; the styles the\n * document was served with are hoisted into `<head>` by React, which strips\n * their `id` and records the files it merged into one space-separated\n * `data-href` list instead (#328). Missing the second shape means re-fetching\n * and re-appending the CSS the page already has on every navigation.\n */\nfunction isStyleOnPage(file: string) {\n if (document.getElementById(file)) {\n return true;\n }\n // `Array.from` rather than `for...of`: the browser build compiles without\n // `DOM.Iterable`, so a `NodeList` is only an ArrayLike there.\n return Array.from(document.querySelectorAll(\"style[data-href]\")).some(\n (style) => style.getAttribute(\"data-href\").split(\" \").includes(file),\n );\n}\n\nexport const ClientRouterProvider = (\n props: PropsWithChildren<ClientRouterProviderProps>,\n) => {\n const {\n children,\n pathname,\n currentPath,\n is404,\n is500,\n routeManifest,\n cssManifest,\n pageData,\n params,\n searchParams,\n breadcrumbs,\n urlLocaleSegment,\n } = props;\n const navigationAbortControllerRef = useRef(new AbortController());\n const [isNavigatingSubject] = useState(() => {\n return new Subject<boolean>(false);\n });\n\n const { supportedLocales = [], locale } = useContext(I18nContext);\n\n const [progressManager] = useState(new ProgressManager(isNavigatingSubject));\n const [prefetchCache] = useState(() => new PrefetchCache());\n const pageDataRef = useRef(structuredClone(pageData));\n const scrollHistoryRef = useRef<Map<string, number>>(new Map());\n const breadcrumbsCache = useRef<Map<string, Breadcrumb>>(\n new Map(Object.entries(breadcrumbs)),\n );\n\n const initalViewEntries = is404\n ? [\"404\"]\n : is500\n ? [\"500\"]\n : (routeManifest[pathname] ?? [\"404\"]);\n const viewEntriesSubject = useRef(new Subject<string[]>(initalViewEntries));\n\n const [routerSubject] = useState(() => {\n return new Subject<RouteState>({\n views: initalViewEntries,\n params,\n search: searchParams,\n state: {},\n pathname,\n hash: \"\",\n action: null as Action | null,\n routePath: currentPath,\n locale,\n });\n });\n\n const [history] = useState<History | null>(() => {\n let history: History | null = null;\n\n if (typeof window !== \"undefined\") {\n history = createBrowserHistory();\n }\n return history;\n });\n\n const findMatchingRouteFromParams = useMemo(\n () => (pathname: string) => {\n let routePath = pathname.replace(\"/en-US\", \"\").replace(\"/tr-TR\", \"\");\n routePath = routePath === \"\" ? \"/\" : routePath;\n const candidates: string[] = [];\n for (const route of Object.keys(routeManifest)) {\n const urlPattern = new URLPattern({ pathname: route });\n if (urlPattern.test({ pathname: routePath })) {\n candidates.push(route);\n }\n }\n const sortedCandidates = candidates.sort((a, b) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n });\n\n return (sortedCandidates ?? [])[0];\n },\n [routeManifest],\n );\n\n const getViewPathsFromPathname = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n return routeManifest[route] ?? [];\n },\n [findMatchingRouteFromParams, routeManifest],\n );\n\n const getRoutePathnameFromHref = useMemo(\n () => (href: string) => {\n const route = findMatchingRouteFromParams(href);\n return route;\n },\n [findMatchingRouteFromParams],\n );\n\n const getParams = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n const urlPattern = new URLPattern({ pathname: route });\n return urlPattern.exec({ pathname })?.pathname.groups ?? {};\n },\n [findMatchingRouteFromParams],\n );\n\n useEffect(() => {\n history?.listen(({ location, action }) => {\n if (!window.scrollHistory) {\n window.scrollHistory = new Map();\n }\n const { hash, pathname, search } = routerSubject.getValue();\n const key = [pathname, search, hash].join(\"\");\n window.scrollHistory.set(key, window.scrollY);\n let _pathname = location.pathname;\n let _locale = null;\n for (const locale of supportedLocales) {\n if (_pathname.startsWith(`/${locale}`)) {\n _locale = locale;\n _pathname = _pathname.replace(`/${locale}`, \"\");\n break;\n }\n }\n _pathname = _pathname === \"\" ? \"/\" : _pathname;\n const routePath = getRoutePathnameFromHref(_pathname);\n routerSubject.next({\n views: getViewPathsFromPathname(_pathname),\n params: getParams(_pathname),\n search: location.search,\n state: location.state as Record<string, unknown>,\n pathname: _pathname,\n action,\n routePath,\n hash: location.hash,\n locale: _locale,\n });\n });\n }, [\n supportedLocales,\n history,\n routerSubject,\n getParams,\n getRoutePathnameFromHref,\n getViewPathsFromPathname,\n ]);\n\n const updatePageData = (\n newPageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => {\n const [key, value] = Object.entries(newPageData)[0];\n if (!pageDataRef.current?.[key]) {\n pageDataRef.current[key] = {};\n }\n for (const b in breadcrumbs) {\n breadcrumbsCache.current.set(b, breadcrumbs[b]);\n }\n\n pageDataRef.current[key] = value;\n };\n\n const getPageData = (key: string, pathname: string) => {\n return pageDataRef.current[pathname]?.[key];\n };\n\n const setNavigationAbortController = (controller: AbortController) => {\n navigationAbortControllerRef.current.abort();\n navigationAbortControllerRef.current = controller;\n };\n\n const fetchRouteCSS = async (routePath: string) => {\n const views = routeManifest[routePath];\n if (!views) {\n return;\n }\n const cssFiles = views\n .flatMap((view) => {\n return cssManifest?.[view];\n })\n .filter(Boolean)\n .filter((file) => !isStyleOnPage(file));\n\n if (cssFiles.length === 0) {\n return;\n }\n\n async function fetchCSS(path: string) {\n const response = await fetch(`/${path}`);\n const content = response.text();\n return {\n content,\n id: path,\n };\n }\n const result = await Promise.all(cssFiles?.map((file) => fetchCSS(file)));\n for (const { content, id } of result) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = await content;\n document.head.appendChild(style);\n }\n };\n\n /**\n * Warms everything a navigation to `target` would need: the route's page\n * data, its stylesheets and its component chunks.\n *\n * The payload is requested *without* the partial-render header, because the\n * route on screen when the link is prefetched is not necessarily the one it\n * will be clicked from — a partial response computed against the wrong base\n * has nothing sound to merge onto. A full payload is always safe to commit.\n *\n * It carries `Purpose: prefetch` so applications can tell speculative traffic\n * from a real visit — a route's handlers run either way, and a `viewport`\n * page multiplies that by the number of links on it.\n */\n const prefetchRoute = async (target: PrefetchTarget) => {\n if (typeof window === \"undefined\") {\n return;\n }\n const { pathname, search = \"\", localeSegment = \"\" } = target;\n const routePath = getRoutePathnameFromHref(pathname);\n if (!routePath) {\n return;\n }\n\n const url = routeDataUrl({ pathname, search, localeSegment });\n\n // Alongside the payload rather than joined to it: a stylesheet that 404s\n // must not throw away page data that arrived perfectly well.\n fetchRouteCSS(routePath).catch(() => {});\n // Through `loadViewModule` so each view's `Loading`/`Error`\n // exports are registered by the time the route commits.\n for (const view of routeManifest[routePath] ?? []) {\n loadViewModule(view);\n }\n\n await prefetchCache.prime(url, async () => {\n const response = await fetch(url, {\n headers: { Purpose: \"prefetch\" },\n });\n if (!response.ok) {\n return null;\n }\n // The settled aggregate: every streamed query result merged back into\n // the envelope's `prefetchedData` — a warmed payload is stored whole,\n // exactly as the blocking response used to arrive (#290).\n return await readSettledRoutePayload(response);\n });\n };\n\n return (\n <ClientRouterContext.Provider\n value={{\n isNavigatingSubject,\n prefetchRoute,\n takePrefetched: (url: string) => prefetchCache.take(url),\n clearPrefetchCache: () => prefetchCache.clear(),\n getViewPathsFromPathname,\n history,\n getScrollPosition: (path: string) => {\n return scrollHistoryRef.current.get(path) || 0;\n },\n viewEntriesSubject: viewEntriesSubject.current,\n updatePageData,\n getPageData,\n getRoutePathnameFromHref,\n setNavigationAbortController,\n progressManager,\n fetchRouteCSS,\n breadcrumbsCache: breadcrumbsCache.current,\n routerSubject,\n urlLocaleSegment,\n }}\n >\n {children}\n {/* @ts-ignore */}\n {import.meta.hot && <HttpReload />}\n </ClientRouterContext.Provider>\n );\n};\n","import { useContext, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\ntype Methods = {\n POST: {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: RPC[K];\n };\n PUT: {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: RPC[K];\n };\n PATCH: {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: RPC[K];\n };\n DELETE: {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: RPC[K];\n };\n};\n\nfunction applyParams(url: string, params: Record<string, any> = {}) {\n let out = url;\n\n for (const [key, value] of Object.entries(params)) {\n out = out.replace(`:${key}?`, value).replace(`:${key}`, value);\n }\n return out;\n}\n\ntype Config<T> = {\n autoInvalidate?: boolean;\n onSuccess: (data: T) => void;\n onError: (error: MutationError) => void;\n onCanceled?: () => void;\n};\n\nconst defaultOptions: Config<any> = {\n autoInvalidate: false,\n onSuccess: () => {},\n onError: (_: MutationError) => {},\n onCanceled: () => {},\n};\n\ntype Data<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<any, infer T, any>\n ? UnwrapPromise<T>\n : never;\n\ntype Body<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<infer T, any, any> ? T : never;\n\ntype MutationError =\n | {\n kind: \"validation_error\";\n messages: Record<string, any>;\n }\n | {\n kind: \"form_error\";\n message: string;\n }\n | {\n kind: \"server_error\";\n message: string;\n }\n | {\n kind: \"not_authorized\";\n message: string;\n }\n | {\n kind: \"insufficient_permissions\";\n message: string;\n };\n\ntype ParseParams<T> = UrlParser<`${T & string}`>;\n\ntype State<T> = {\n data: T | null;\n error: MutationError | null;\n loading: boolean;\n};\n\nexport function useMutation<\n M extends keyof Methods,\n K extends keyof Methods[M],\n T = Data<M, K>,\n U = Body<M, K>,\n>(\n method: M,\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>>, search?: Record<string, string> },\n config?: Partial<Config<T>>,\n ]\n) {\n const _params = useParams();\n // A write may have moved the data behind any page warmed ahead of a click,\n // and a prefetched payload is committed wholesale — into the query cache too.\n const { clearPrefetchCache } = useContext(ClientRouterContext);\n const [state, setState] = useState<State<T>>({\n data: null,\n error: null,\n loading: false,\n });\n\n const [abortController, setAbortController] = useState(\n () => new AbortController(),\n );\n\n const formData = useRef(new FormData());\n\n async function trigger(input?: U): Promise<T> {\n setState({\n data: state.data,\n error: state.error,\n loading: true,\n });\n const [inputs = {}, options = defaultOptions] = args ?? [];\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const search = \"search\" in inputs ? inputs.search : {};\n const searchParams = new URLSearchParams(search);\n const finalUrl = [applyParams(String(url).replace(`${method}:`, \"\"), params), searchParams.toString()].filter(Boolean).join(\"?\");\n\n let body = null;\n\n const contentType =\n typeof input === \"undefined\" || input instanceof FormData\n ? {}\n : { \"Content-Type\": \"application/json\" };\n\n if (input instanceof FormData) {\n body = input;\n } else if (typeof input === \"undefined\") {\n body = formData.current;\n } else if (input) {\n body = JSON.stringify(input);\n }\n\n try {\n const response = await fetch(`/api${finalUrl}`, {\n method,\n headers: {\n ...contentType,\n },\n ...(body ? { body } : {}),\n signal: abortController.signal,\n });\n\n formData.current = new FormData();\n\n const data = await response.json();\n\n if (!response.ok) {\n setState({\n data: null,\n error: data.error,\n loading: false,\n });\n\n options?.onError?.(data);\n return;\n }\n\n clearPrefetchCache?.();\n options.onSuccess(data);\n\n setState({\n data,\n error: null,\n loading: false,\n });\n\n return data as any;\n } catch (error) {\n formData.current = new FormData();\n options?.onError?.(error);\n setState({\n data: null,\n error,\n loading: false,\n });\n }\n }\n\n trigger.formData = (formData: FormData) => {\n return trigger(formData as U);\n };\n\n return {\n data: state.data as T,\n error: state.error as any,\n loading: state.loading,\n formData: formData.current,\n cancel: () => {\n const [, options = defaultOptions] = args ?? [];\n abortController.abort();\n setAbortController(new AbortController());\n setState({\n data: state.data,\n error: state.error,\n loading: false,\n });\n\n formData.current = new FormData();\n options.onCanceled();\n },\n trigger,\n };\n}\n\nexport function usePost<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"POST\", url, ...(args as any));\n}\n\nexport function usePut<K extends keyof Methods[\"PUT\"], T = Data<\"PUT\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PUT\", url, ...(args as any));\n}\n\nexport function usePatch<\n K extends keyof Methods[\"PATCH\"],\n T = Data<\"PATCH\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PATCH\", url, ...(args as any));\n}\n\nexport function useDelete<\n K extends keyof Methods[\"DELETE\"],\n T = Data<\"DELETE\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"DELETE\", url, ...(args as any));\n}\n\nexport function useUpload<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n const [state, setState] = useState<\"idle\" | \"uploading\" | \"done\" | \"error\">(\n \"idle\",\n );\n const [progress, setProgress] = useState(0);\n const _params = useParams();\n const { clearPrefetchCache } = useContext(ClientRouterContext);\n const abortRef = useRef<VoidFunction | null>(null);\n\n const [inputs = {}, options = defaultOptions] = args ?? [];\n\n const cancel = () => {\n if (abortRef.current) {\n abortRef.current();\n options.onCanceled?.();\n setState(\"idle\");\n setProgress(0);\n }\n };\n\n const trigger = async (fileList: FileList | null | File): Promise<T> => {\n if (!fileList) {\n return;\n }\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const finalUrl = applyParams(String(url).replace(\"POST:\", \"\"), params);\n\n const method = \"POST\";\n const action = `/api${finalUrl}`;\n const data = new FormData();\n if (fileList instanceof FileList) {\n for (const file of Array.from(fileList)) {\n data.append(\"file\", file);\n }\n } else {\n data.append(\"file\", fileList);\n }\n const xhr = new XMLHttpRequest();\n abortRef.current = () => {\n xhr.abort();\n };\n\n try {\n const result = await new Promise<Response>((resolve, reject) => {\n xhr.responseType = \"blob\";\n xhr.onreadystatechange = async () => {\n if (xhr.readyState !== 4) {\n // done\n return;\n }\n\n const response = new Response(xhr.response, {\n status: xhr.status,\n statusText: xhr.statusText,\n });\n\n resolve(response);\n };\n\n xhr.addEventListener(\"error\", () => {\n reject(new TypeError(\"Failed to fetch\"));\n });\n\n xhr.upload.addEventListener(\"loadstart\", () => {\n setProgress(0);\n });\n xhr.upload.addEventListener(\"loadend\", () => {\n setProgress(1);\n });\n\n xhr.upload.addEventListener(\"progress\", (event) => {\n setProgress(event.loaded / event.total);\n });\n\n xhr.open(method, action, true);\n xhr.send(data);\n });\n setState(\"uploading\");\n if (!result.ok) {\n let error: MutationError = {\n kind: \"server_error\",\n message: result.statusText,\n };\n try {\n const data = await result.json();\n error = data.error;\n } catch (e) {\n // do nothing\n }\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n const json = await result.json();\n clearPrefetchCache?.();\n options?.onSuccess?.(json);\n return json;\n } catch (error) {\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n };\n\n return {\n state,\n progress,\n trigger,\n cancel,\n };\n}\n","import { useContext } from \"react\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { NestedPrettify, UnwrapPromise } from \"../utils/type\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nimport type { RPC } from \"./rpc\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport type { UrlParser } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> = GetRPC[T] extends ApiRouterHandler<\n any,\n infer Data,\n any\n>\n ? UnwrapPromise<Data>\n : never;\n\nexport function useMutate() {\n const { getResource } = useContext(QueryManagerContext);\n return function mutate<T extends keyof GetRPC>(\n options: {\n path: T;\n params?: UrlParser<`${T & string}`>;\n search?: Record<string, any>;\n },\n fn?:\n | ((data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>)\n | NestedPrettify<Data<T>>,\n ) {\n const { path, params = {}, search = {} } = options ?? {};\n const normalPath = applyParams(path, params);\n const resource = getResource(normalPath);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n return resource.mutate.call(resource, variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n if (!fn) {\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n };\n}\n","import {\n createContext,\n useContext,\n type ComponentProps,\n type FormEvent,\n useRef,\n useEffect,\n useSyncExternalStore,\n useCallback,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport { useMutation } from \"./useMutation\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { Subject } from \"../utils/Subject\";\n\ntype Any = any;\n\ninterface MutationContextValue {\n isPending: boolean;\n result: null | Any;\n validationErrors: Record<string, string[]>;\n formError: null | string;\n formDataSubject: React.RefObject<Subject<FormData>>;\n}\n\nconst MutationContext = createContext({\n isPending: false,\n result: null,\n} as MutationContextValue);\n\ntype GetResult<T> =\n T extends ApiRouterHandler<Any, infer Result, Any>\n ? UnwrapPromise<Result>\n : never;\n\ntype PostRequests = {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PutRequests = {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: GetResult<RPC[K]>;\n};\n\ntype DeleteRequests = {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PatchRequests = {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype Methods = {\n POST: PostRequests;\n PUT: PutRequests;\n DELETE: DeleteRequests;\n PATCH: PatchRequests;\n};\n\ninterface FormProps<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> extends Omit<ComponentProps<\"form\">, \"action\" | \"onError\"> {\n method?: M;\n action: K;\n onSuccess?: (result: Methods[M][K], form: HTMLFormElement) => void;\n onError?: (error: Any, form: HTMLFormElement) => void;\n params?: Partial<UrlParser<`${K & string}`>>;\n search?: Record<string, string>;\n dynamicInputs?: (formData: FormData) => Record<string, any>;\n}\n\nexport function Form<\n K extends keyof Methods[T],\n T extends keyof Methods = \"POST\",\n>(props: FormProps<T, K>) {\n const _params = useParams();\n const {\n method = \"POST\",\n action,\n onSuccess = () => {},\n onError = () => {},\n params,\n search = {},\n className,\n dynamicInputs = () => ({}),\n ...formProps\n } = \"params\" in props\n ? { ...props, params: { ..._params, ...props.params } }\n : { ...props, params: _params };\n const formRef = useRef<HTMLFormElement>(null);\n const { __csrf } = useContext(ServerDataContext);\n const formDataSubject = useRef(new Subject(new FormData()));\n\n const updateFormData = useCallback(() => {\n formDataSubject.current.next(new FormData(formRef.current));\n }, []);\n\n useEffect(() => {\n if (!formRef.current) return;\n\n formRef.current.addEventListener(\"input\", updateFormData);\n\n const observer = new MutationObserver(() => {\n const formData = new FormData(formRef.current);\n formDataSubject.current.next(formData);\n });\n\n formRef.current.querySelectorAll(\"input\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"select\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"textarea\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n return () => {\n observer.disconnect();\n if (formRef.current) {\n formRef.current.removeEventListener(\"input\", updateFormData);\n }\n };\n }, [updateFormData]);\n\n const { trigger, data, error, loading } = useMutation(\n method,\n String(action) as Any,\n {\n params,\n search,\n } as Any,\n {\n onSuccess: (data) => onSuccess(data as Any, formRef.current),\n onError: (error) => onError(error, formRef.current),\n },\n );\n\n const handleSubmit = async (e: FormEvent) => {\n if (loading) {\n return;\n }\n e.preventDefault();\n if (!formRef.current) {\n return;\n }\n const formData = new FormData(formRef.current);\n for (const [key, value] of Object.entries(dynamicInputs(formData))) {\n formData.append(key, value as any);\n }\n trigger(formData as any);\n };\n\n const validationErrors =\n error?.kind === \"validation_error\" ? error.messages : {};\n\n const formError = error?.kind === \"form_error\" ? error.message : null;\n\n return (\n <MutationContext.Provider\n value={{\n isPending: loading,\n result: data,\n validationErrors,\n formError,\n formDataSubject,\n }}\n >\n <form\n className={[\"group\", className].filter(Boolean).join(\" \")}\n data-loading={loading}\n ref={formRef}\n onSubmit={handleSubmit}\n {...formProps}\n >\n <input type=\"hidden\" name=\"__csrf\" value={__csrf} />\n {props.children}\n </form>\n </MutationContext.Provider>\n );\n}\n\nexport function useMutationStatus() {\n const { isPending } = useContext(MutationContext);\n\n return { isPending };\n}\n\nexport function useFormStatus() {\n const { isPending, validationErrors, formError } =\n useContext(MutationContext);\n\n return { isPending, validationErrors, formError };\n}\n\nexport function useFormData() {\n const context = useContext(MutationContext);\n\n const { formDataSubject } = context;\n\n return useSyncExternalStore(\n formDataSubject.current.subscribe.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n );\n}\n\nexport const ValidationErrors = (props: {\n name: string;\n className?: string;\n render?: (props: ComponentProps<\"div\">) => React.JSX.Element;\n}) => {\n const {\n render = (props: ComponentProps<\"div\">) => <div {...props} />,\n name,\n } = props;\n const { validationErrors } = useContext(MutationContext);\n\n const Comp = render;\n\n if (validationErrors[name]?.length > 0) {\n return (\n <>\n {validationErrors[name].map((error) => {\n return (\n <Comp className={props.className} key={error}>\n {error}\n </Comp>\n );\n })}\n </>\n );\n }\n\n return null;\n};\n\nexport const FormFieldContainer = (\n props: ComponentProps<\"div\"> & { name: string },\n) => {\n const { name, children, ...rest } = props;\n const { validationErrors } = useContext(MutationContext);\n const errors = validationErrors[name] || [];\n return (\n <div data-has-error={errors.length > 0} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const FormError = (props: ComponentProps<\"div\">) => {\n const { formError } = useContext(MutationContext);\n\n if (formError) {\n return <div {...props}>{formError}</div>;\n }\n\n return null;\n};\n","import { useContext, useSyncExternalStore } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useIsNavigationPending() {\n const { isNavigatingSubject } = useContext(ClientRouterContext);\n const isNavigating = useSyncExternalStore(\n isNavigatingSubject.subscribe,\n isNavigatingSubject.getValue,\n isNavigatingSubject.getValue,\n );\n\n return isNavigating;\n}\n","import { useContext, useEffect, useState } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useNavigationProgress() {\n const { progressManager } = useContext(ClientRouterContext);\n const [progress, setProgress] = useState(progressManager.state.getValue());\n\n useEffect(() => {\n const unsub = progressManager.state.subscribe((p) => setProgress(p));\n return () => {\n unsub();\n };\n }, [progressManager.state]);\n\n return progress;\n}\n","import { useCallback, useContext } from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewPaths } from \"./types\";\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\n/**\n * A prefetch spends the visitor's data on a page they may never open, so it\n * stands down when they have asked for less of that or the connection cannot\n * spare it. `navigator.connection` only exists in Chromium — everywhere else\n * there is nothing to go on and prefetching proceeds.\n */\nfunction connectionRefusesPrefetch() {\n const connection = (navigator as any)?.connection;\n if (!connection) {\n return false;\n }\n if (connection.saveData) {\n return true;\n }\n return [\"slow-2g\", \"2g\"].includes(connection.effectiveType);\n}\n\ntype Options<T extends ViewPaths> =\n UrlParser<T> extends Record<string, never>\n ? {\n search?: Search;\n locale?: string;\n }\n : {\n search?: Search;\n params: UrlParser<T>;\n locale?: string;\n };\n\n/**\n * Warms a route ahead of the navigation to it: its page data, its stylesheets\n * and its component chunks. A navigation that lands on a prefetched route\n * renders from the cached payload instead of waiting on a request.\n *\n * The URL is built exactly the way `useNavigate` builds it — the prefetch is\n * only ever used by a navigation that asks for the same one.\n */\nexport function usePrefetch() {\n const { prefetchRoute } = useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n const currentPathname = location.pathname;\n const currentSearch = location.search;\n const currentLocale = location.locale;\n\n return useCallback(\n async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n if (typeof window === \"undefined\" || !prefetchRoute) {\n return;\n }\n\n if (connectionRefusesPrefetch()) {\n return;\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n locale = null,\n } = { params: {}, search: {}, locale: null, ...options };\n\n let localeSegment = locale ?? currentLocale;\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const pathname = applyParams(path, params) || \"/\";\n // Matches `useNavigate`, which hands the search object straight to\n // `URLSearchParams` — the query string a click produces has to be the one\n // the payload was cached under.\n const queryString = new URLSearchParams(search as any).toString();\n const searchSegment = queryString.length > 0 ? `?${queryString}` : \"\";\n\n // The route already on screen has nothing to warm, and eagerly prefetched\n // links pointing back at it would just replay the current page's queries.\n if (pathname === currentPathname && searchSegment === currentSearch) {\n return;\n }\n\n await prefetchRoute({\n pathname,\n search: searchSegment,\n localeSegment: localeSegment ? `/${localeSegment}` : \"\",\n });\n },\n [\n prefetchRoute,\n defaultLocale,\n currentLocale,\n currentPathname,\n currentSearch,\n ],\n );\n}\n","import { useContext } from \"react\";\nimport { useRoute } from \"./useRoute\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport type Breadcrumb = {\n label: string;\n href: string;\n};\n\nexport function useBreadcrumbs() {\n const { pathname } = useRoute();\n const { getViewPathsFromPathname, breadcrumbsCache } =\n useContext(ClientRouterContext);\n\n let breadcrumbs: Breadcrumb[] = [];\n const viewPaths = getViewPathsFromPathname(pathname);\n for (const viewPath of viewPaths) {\n if (breadcrumbsCache.has(`${viewPath}:${pathname}`)) {\n breadcrumbs.push(breadcrumbsCache.get(`${viewPath}:${pathname}`));\n }\n }\n\n return breadcrumbs.filter((breadcrumb) => breadcrumb?.label.length > 0);\n}\n","import { createContext, useContext, type PropsWithChildren } from \"react\";\n\nconst RouteTransitionContext = createContext<{\n isTransitioning: boolean;\n targetPath: string;\n currentPath: string;\n}>({\n isTransitioning: false,\n targetPath: \"\",\n currentPath: \"\",\n});\n\ninterface RouteTransitionProviderProps {\n isPending: boolean;\n isFetching: boolean;\n transitionPath: [string, string];\n}\n\nexport const RouteTransitionProvider = (\n props: PropsWithChildren<RouteTransitionProviderProps>,\n) => {\n const { isPending, isFetching, transitionPath } = props;\n\n return (\n <RouteTransitionContext.Provider\n value={{\n isTransitioning: isPending || isFetching,\n targetPath: transitionPath[1],\n currentPath: transitionPath[0] || \"\",\n }}\n >\n {props.children}\n </RouteTransitionContext.Provider>\n );\n};\n\nexport function useRouteTransition() {\n const context = useContext(RouteTransitionContext);\n if (!context) {\n throw new Error(\n \"useRouteTransition must be used within a RouteTransitionProvider\",\n );\n }\n return context;\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n memo,\n type ComponentProps,\n type SyntheticEvent,\n} from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewResult } from \"./types\";\nimport { useNavigate } from \"./useNavigate\";\nimport type { ViewRPC } from \"./rpc\";\nimport type { Prettify } from \"../utils/type\";\nimport { useParams } from \"./useParams\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useRouteTransition } from \"./RouteTransitionProvider\";\nimport { usePrefetch } from \"./usePrefetch\";\n\ntype Views = {\n [K in keyof ViewRPC as K extends `view:${infer P}`\n ? P\n : never]: ViewResult<K>;\n};\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\n/**\n * When to warm the target route's data, styles and chunks.\n *\n * - `hover` — the moment the pointer arrives, or on touch or keyboard focus.\n * - `intent` — hover held long enough to read as intent, so a cursor sweeping\n * across a nav bar does not fire a request per link it crosses.\n * - `viewport` — as the link comes into view.\n * - `render` — as soon as the link renders.\n *\n * Several can be combined. The useful pairing is a bulk strategy with an\n * interactive one — `[\"viewport\", \"intent\"]` warms the link on the way past and\n * warms it again on approach if the cached payload has since gone stale.\n * `hover` and `intent` together is just `hover`, since it fires first.\n *\n * Every strategy stands down on metered or very slow connections.\n */\nexport type PrefetchStrategy = \"hover\" | \"intent\" | \"viewport\" | \"render\";\n\n/** How long the pointer has to rest on an `intent` link before it counts. */\nconst INTENT_DELAY = 100;\n\n/** How far ahead of the viewport a `viewport` link starts warming. */\nconst VIEWPORT_MARGIN = \"200px\";\n\ntype LinkBaseProps<T extends keyof Views> = Omit<\n ComponentProps<\"a\">,\n \"href\"\n> & {\n active?: boolean;\n href: T;\n hash?: string;\n /** Off unless set. `false` is accepted so it can be driven by a variable. */\n prefetch?: PrefetchStrategy | readonly PrefetchStrategy[] | false;\n params: UrlParser<T>;\n search?: T extends keyof Views\n ? Views[T][\"input\"] extends Record<string, never>\n ? Search\n : Prettify<Partial<Views[T][\"input\"]> & Search>\n : Search;\n};\n\ntype LinkProps<T extends keyof Views, U = UrlParser<T>> = U extends Record<\n string,\n never\n>\n ? Omit<LinkBaseProps<T>, \"params\">\n : LinkBaseProps<T>;\n\nfunction normalizeSearch(search: Search): Record<string, string> {\n return Object.fromEntries(\n Object.entries(search)\n .filter(([_k, v]) => v !== undefined && v !== null)\n .map(([k, v]) => [k, String(v)]),\n ) as Record<string, string>;\n}\n\nexport const Link = memo(<T extends keyof Views>(props: LinkProps<T>) => {\n const _params = useParams();\n const { isTransitioning, targetPath } = useRouteTransition();\n const {\n href,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onFocus,\n onBlur,\n ref,\n hash = \"\",\n active = false,\n prefetch,\n params = {},\n search = {},\n ...rest\n } = { params: _params, search: {}, ...props };\n const { defaultLocale } = useContext(I18nContext);\n const { push } = useNavigate();\n const location = useLocation();\n const prefetchRoute = usePrefetch();\n const searchParams = new URLSearchParams(normalizeSearch(search));\n\n const path = applyParams(href, params);\n // `applyParams` drops the trailing slash, so the root route comes back empty\n // where every pathname the router reports says `/`.\n const resolvedPath = path || \"/\";\n let urlLocaleSegment = location.locale;\n if (urlLocaleSegment === defaultLocale) {\n urlLocaleSegment = \"\";\n }\n\n const localeSegment = urlLocaleSegment ? `/${urlLocaleSegment}` : \"\";\n\n const targetHref = [\n [`${localeSegment}${path}`, searchParams.toString()]\n .filter((s) => s.length > 0)\n .join(\"?\"),\n hash,\n ].join(\"\");\n\n const currentHref = [location.pathname, location.search, location.hash]\n .filter((item) => !!item)\n .join(\"\");\n\n // Held in a ref because the prefetch callback is rebuilt on every router\n // render — an effect that depended on it would re-fire on renders that have\n // nothing to do with this link.\n const prefetchRouteRef = useRef(prefetchRoute);\n useEffect(() => {\n prefetchRouteRef.current = prefetchRoute;\n });\n\n // Clicking through to the path we are already on is a shallow navigation —\n // it moves the URL without fetching, so there is nothing to warm.\n const isShallowTarget = resolvedPath === location.pathname;\n\n const strategies = !prefetch\n ? []\n : Array.isArray(prefetch)\n ? prefetch\n : [prefetch];\n const uses = (strategy: PrefetchStrategy) => strategies.includes(strategy);\n // Effects below key off the strategies, which arrive as an array literal with\n // a fresh identity on every render. The names are what actually matters.\n const strategyKey = strategies.join(\",\");\n\n // Repeats are the cache's problem, not this component's: it collapses a\n // hover storm into one request and lets a hover past the TTL refresh a\n // payload that has gone stale.\n const runPrefetch = () => {\n if (strategies.length === 0 || isShallowTarget) {\n return;\n }\n prefetchRouteRef.current(href, { params, search } as never);\n };\n\n useEffect(() => {\n if (uses(\"render\")) {\n runPrefetch();\n }\n }, [strategyKey, targetHref]);\n\n const anchorRef = useRef<HTMLAnchorElement | null>(null);\n // A caller's own `ref` still has to reach them — under React 19 it arrives as\n // a plain prop, and the spread below would otherwise hand the element to one\n // of us and null to the other.\n //\n // Memoised because `Link` re-renders on every navigation in the app: a fresh\n // callback identity would have React detach and reattach the element each\n // time, handing a caller's ref callback a null it never asked for.\n const setAnchorRef = useCallback(\n (node: HTMLAnchorElement | null) => {\n anchorRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n useEffect(() => {\n if (!uses(\"viewport\")) {\n return;\n }\n const element = anchorRef.current;\n if (!element || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n // One shot: a link scrolled past and back is already warm, and if its entry\n // has expired the next hover or click pays for a fresh one.\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n observer.disconnect();\n runPrefetch();\n }\n },\n { rootMargin: VIEWPORT_MARGIN },\n );\n observer.observe(element);\n return () => observer.disconnect();\n }, [strategyKey, targetHref]);\n\n const intentTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const cancelIntent = () => {\n if (intentTimerRef.current !== null) {\n clearTimeout(intentTimerRef.current);\n intentTimerRef.current = null;\n }\n };\n useEffect(() => cancelIntent, []);\n\n /** A pointer arriving — the one signal `intent` waits on before believing. */\n const pointerArrived = () => {\n if (uses(\"hover\")) {\n runPrefetch();\n } else if (uses(\"intent\")) {\n cancelIntent();\n intentTimerRef.current = setTimeout(runPrefetch, INTENT_DELAY);\n }\n };\n\n /** Focus and touch are deliberate, so neither strategy makes them wait. */\n const linkTargeted = () => {\n if (uses(\"hover\") || uses(\"intent\")) {\n runPrefetch();\n }\n };\n\n /** Runs the caller's own handler first, then the prefetch trigger. */\n const prefetchOn =\n <E extends SyntheticEvent>(\n handler: ((event: E) => void) | undefined,\n trigger: () => void,\n ) =>\n (event: E) => {\n handler?.(event);\n trigger();\n };\n\n return (\n <a\n ref={setAnchorRef}\n data-active={active || currentHref === targetHref}\n // The resolved path, not the template: one template can back a whole list\n // of rows, and only the row that was clicked is heading anywhere.\n data-pending={isTransitioning && resolvedPath === targetPath}\n href={targetHref === '' ? '/' : targetHref}\n onClick={(e) => {\n if (typeof window !== \"undefined\") {\n if (currentHref === targetHref) {\n e.preventDefault();\n return;\n }\n }\n let currentPath = window.location.pathname.replace(localeSegment, \"\");\n currentPath = currentPath === \"\" ? \"/\" : currentPath;\n onClick?.(e);\n\n if (hash === \"\") {\n e.preventDefault();\n }\n push(href, {\n hash,\n search,\n params,\n shallow: path === currentPath,\n } as unknown as never);\n }}\n onMouseEnter={prefetchOn(onMouseEnter, pointerArrived)}\n onMouseLeave={prefetchOn(onMouseLeave, cancelIntent)}\n onTouchStart={prefetchOn(onTouchStart, linkTargeted)}\n onFocus={prefetchOn(onFocus, linkTargeted)}\n onBlur={prefetchOn(onBlur, cancelIntent)}\n {...rest}\n />\n );\n});\n","import { type ComponentProps, useEffect } from \"react\";\nimport type { Link } from \"./Link\";\n\nimport { useNavigate } from \"./useNavigate\";\n\nexport const Redirect = (\n props: ComponentProps<typeof Link> & { action: \"push\" | \"replace\" },\n) => {\n const { href, params = {}, search = {}, action = \"replace\" } = props;\n const { push, replace } = useNavigate();\n\n useEffect(() => {\n if (action === \"replace\") {\n replace(href, { params, search } as any);\n } else {\n push(href, { params, search } as any);\n }\n }, [replace, action, push, params, search, href]);\n\n return <></>;\n};\n","\"use client\";\nimport { createContext as l, Component as y, createElement as d, useContext as f, useState as p, useMemo as E, forwardRef as B } from \"react\";\nconst h = l(null), c = {\n didCatch: !1,\n error: null\n};\nclass m extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = c;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { error: t } = this.state;\n t !== null && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(c));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: s } = this.props;\n o && t.error !== null && C(e.resetKeys, s) && (this.props.onReset?.({\n next: s,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(c));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: s } = this.props, { didCatch: n, error: a } = this.state;\n let i = e;\n if (n) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n i = t(u);\n else if (o)\n i = d(o, u);\n else if (s !== void 0)\n i = s;\n else\n throw a;\n }\n return d(\n h.Provider,\n {\n value: {\n didCatch: n,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n }\n },\n i\n );\n }\n}\nfunction C(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction g(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction x(r) {\n if (!g(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction k() {\n const r = f(h);\n x(r);\n const { error: e, resetErrorBoundary: t } = r, [o, s] = p({\n error: null,\n hasError: !1\n }), n = E(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), s({ error: null, hasError: !1 });\n },\n showBoundary: (a) => s({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return n;\n}\nfunction S(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction w(r, e) {\n const t = B(\n (s, n) => d(\n m,\n e,\n d(r, { ...s, ref: n })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n m as ErrorBoundary,\n h as ErrorBoundaryContext,\n S as getErrorMessage,\n k as useErrorBoundary,\n w as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import {\n createContext,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from \"react\";\n\ntype Subscribe = (\n topic: string,\n handler: (event: any) => void,\n) => Promise<void>;\n\nexport const WebSocketContext = createContext(\n {} as {\n broadcast: (topic: string, payload: Record<string, any>) => void;\n subscribe: Subscribe;\n unsubscribe: (\n topic: string,\n handler: (event: any) => void,\n ) => Promise<void>;\n },\n);\n\nexport const WebSocketContextProvider = (props: PropsWithChildren) => {\n const wsRef = useRef<WebSocket>(null);\n\n function getWS() {\n return new Promise<WebSocket>((resolve) => {\n if (wsRef.current) {\n resolve(wsRef.current);\n } else {\n const ws = new WebSocket(\"ws://localhost:5173/\");\n ws.onopen = () => {\n wsRef.current = ws;\n console.log(\"ws opened\");\n ws.addEventListener(\"close\", () => {\n console.log(\"ws closed\");\n wsRef.current = null;\n });\n resolve(ws);\n };\n }\n });\n }\n\n const subscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"subscribe\", topic }));\n ws.addEventListener(\"message\", handler);\n };\n\n const unsubscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"unsubscribe\", topic }));\n ws.removeEventListener(\"message\", handler);\n };\n\n const broadcast = async (topic: string, payload = {}) => {\n const ws = await getWS();\n ws.send(\n JSON.stringify({\n type: \"broadcast\",\n topic,\n payload,\n }),\n );\n };\n\n useEffect(() => {\n return () => {\n if (wsRef.current) {\n wsRef.current.close();\n wsRef.current = null;\n }\n };\n }, []);\n\n return (\n <WebSocketContext.Provider value={{ subscribe, unsubscribe, broadcast }}>\n {props.children}\n </WebSocketContext.Provider>\n );\n};\n","import { type ReactNode, useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\nexport function updateMeta(meta: any) {\n // A partially rendered response whose segments set no metadata sends none —\n // what is on the page belongs to the segments that were skipped.\n if (!meta) {\n return;\n }\n const { title, description } = meta;\n if (title) {\n document.title = title;\n }\n if (description) {\n const desc = document.querySelector(\"meta[name='description']\");\n if (desc) {\n desc.setAttribute(\"content\", description);\n } else {\n const newDesc = document.createElement(\"meta\");\n newDesc.setAttribute(\"name\", \"description\");\n newDesc.setAttribute(\"content\", description);\n document.head.appendChild(newDesc);\n }\n }\n}\n\nconst OpenGraph = (props: {\n title: string;\n type: string;\n url: string;\n image: string;\n description?: string;\n imageAlt?: string;\n imageWidth?: number;\n imageHeight?: number;\n twitterImage?: string;\n twitterImageAlt?: string;\n twitterImageWidth?: number;\n twitterImageHeight?: number;\n}) => {\n const {\n title,\n description,\n type,\n url,\n image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage,\n twitterImageAlt,\n twitterImageWidth,\n twitterImageHeight,\n } = props;\n\n return (\n <>\n <meta property=\"og:title\" content={title} />\n <meta property=\"og:type\" content={type} />\n <meta property=\"og:url\" content={url} />\n <meta property=\"og:image\" content={image} />\n {description && <meta property=\"og:description\" content={description} />}\n {imageAlt && <meta property=\"og:image:alt\" content={imageAlt} />}\n {imageWidth && (\n <meta property=\"og:image:width\" content={String(imageWidth)} />\n )}\n {imageHeight && (\n <meta property=\"og:image:height\" content={String(imageHeight)} />\n )}\n {twitterImage && (\n <>\n <meta name=\"twitter:image\" content={twitterImage} />\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n </>\n )}\n {twitterImageAlt && (\n <meta name=\"twitter:image:alt\" content={twitterImageAlt} />\n )}\n {twitterImageWidth && (\n <meta name=\"twitter:image:width\" content={String(twitterImageWidth)} />\n )}\n {twitterImageHeight && (\n <meta\n name=\"twitter:image:height\"\n content={String(twitterImageHeight)}\n />\n )}\n </>\n );\n};\n\nexport const Head = ({\n children = null,\n charSet = \"utf-8\",\n}: { children?: ReactNode; charSet?: string }) => {\n const { meta } = useContext(ServerDataContext);\n return (\n <head>\n <meta charSet={charSet} />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {/*\n Disable browser auto-translation (Chrome/Google Translate). Gemi apps do\n their own i18n, and a translator that rewrites text nodes *before* React\n hydrates mutates the SSR DOM — which React rejects as a hydration\n mismatch (Minified React error #418) and then regenerates the tree,\n dropping the server-injected <style> and leaving the page unstyled.\n Pair this with `translate=\"no\"` on the <html> element in RootLayout.\n */}\n <meta name=\"google\" content=\"notranslate\" />\n <title>{meta?.title}</title>\n {meta?.description && (\n <meta name=\"description\" content={meta.description} />\n )}\n {meta?.openGraph && <OpenGraph {...meta.openGraph} />}\n {children}\n </head>\n );\n};\n","import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\n\nconst ThemeContext = createContext({\n theme: \"light\" as Theme,\n setTheme: (theme: Theme) => {}, // Function to set the theme\n});\n\nfunction storeTheme(theme: string) {\n try {\n localStorage.setItem(\"theme\", theme);\n } catch (error) {\n console.error(\"Failed to store theme in localStorage:\", error);\n }\n}\n\nexport const ThemeProvider = (props: { children: ReactNode }) => {\n const [theme, setTheme] = useState(() => {\n if (typeof window === \"undefined\") {\n return \"light\"; // Default theme for server-side rendering\n }\n return localStorage.getItem(\"theme\") || \"light\";\n });\n\n useEffect(() => {\n if (theme === \"system\") {\n window\n .matchMedia(\"(prefers-color-scheme: dark)\")\n .addEventListener(\"change\", ({ matches }) => {\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(matches ? \"dark\" : \"light\");\n });\n }\n }, [theme]);\n\n return (\n <ThemeContext.Provider\n value={{\n theme: theme as Theme,\n setTheme: (newTheme: Theme) => {\n setTheme(newTheme);\n storeTheme(newTheme);\n\n let documentTheme = newTheme as Theme;\n if (newTheme === \"system\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n documentTheme = media.matches ? \"dark\" : \"light\";\n }\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(documentTheme);\n },\n }}\n >\n {props.children}\n </ThemeContext.Provider>\n );\n};\n\nexport function useTheme() {\n const context = useContext(ThemeContext);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n","import { applyParams } from \"./applyParams\";\n\n/**\n * Route the client is currently rendering, sent on `.json` navigations so the\n * server can skip the handlers of the segments that route already has mounted.\n * Value is a locale-less pathname plus search, e.g. `/app/A/chat?tab=2`.\n */\nexport const PARTIAL_RENDER_HEADER = \"x-gemi-from\";\n\n/** What the server reports back about the skip it performed, if any. */\nexport interface PartialRenderInfo {\n /** The `x-gemi-from` value the plan was computed against. */\n from: string;\n /** View paths of the skipped segments, in order. Their data is carried forward. */\n carriedViews: string[];\n}\n\n/**\n * The `x-gemi-from` value for the route the client starts on.\n *\n * On the first render the router's `pathname` is still the route *pattern* the\n * server matched — it only becomes a resolved path once the history listener\n * has run — so this has to apply the params. Sending `/app/:orgId/chat` names\n * no route the server can resolve, and the first navigation after every full\n * page load would skip nothing.\n */\nexport function initialRenderedRoute(route: {\n pathname?: string;\n params?: Record<string, string>;\n search?: string;\n}) {\n // `applyParams` strips the trailing slash, so the root route resolves to the\n // empty string — which the server reads as \"no header\" and renders in full.\n const pathname = applyParams(route.pathname ?? \"/\", route.params ?? {}) || \"/\";\n return `${pathname}${route.search ?? \"\"}`;\n}\n","import type { Breadcrumb } from \"../useBreadcrumbs\";\n\ninterface RouteSnapshot {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Route pattern the data was produced for — part of every breadcrumb key. */\n routePath: string;\n data: Record<string, any>;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\n/**\n * A partially rendered response only carries the segments the server actually\n * ran. Everything is keyed by the *new* pathname, so a carried layout would\n * render with empty props unless the data it already had is copied across.\n *\n * Data the server sent always wins: a carried view is only filled in where the\n * response has nothing for it.\n */\nexport function mergeCarriedSegments(\n previous: RouteSnapshot,\n next: RouteSnapshot,\n carriedViews: string[],\n) {\n if (carriedViews.length === 0) {\n return { data: next.data, breadcrumbs: next.breadcrumbs };\n }\n\n // Page data is keyed by the pathname it was fetched for, and a shallow\n // navigation moves the pathname on without fetching — so fall back to the key\n // the data is actually under. The server sends exactly one.\n const previousData = previous.data ?? {};\n const previousViewData =\n previousData[previous.pathname] ?? previousData[Object.keys(previousData)[0]] ?? {};\n const previousBreadcrumbs = previous.breadcrumbs ?? {};\n\n const carriedViewData: Record<string, unknown> = {};\n const carriedBreadcrumbs: Record<string, Breadcrumb> = {};\n\n for (const viewPath of carriedViews) {\n if (viewPath in previousViewData) {\n carriedViewData[viewPath] = previousViewData[viewPath];\n }\n // Breadcrumbs are keyed by route pattern, and that changed even though the\n // segment did not, so they have to be re-keyed rather than copied.\n const previousKey = `${viewPath}:${previous.routePath}`;\n if (previousKey in previousBreadcrumbs) {\n carriedBreadcrumbs[`${viewPath}:${next.routePath}`] = previousBreadcrumbs[previousKey];\n }\n }\n\n // The server sends page data under exactly one key. Take it from the payload\n // rather than recomputing it, so the two never disagree on spelling.\n const [nextKey = next.pathname] = Object.keys(next.data ?? {});\n\n return {\n data: {\n ...next.data,\n [nextKey]: { ...carriedViewData, ...next.data?.[nextKey] },\n },\n breadcrumbs: { ...carriedBreadcrumbs, ...next.breadcrumbs },\n };\n}\n","import {\n PARTIAL_RENDER_HEADER,\n type PartialRenderInfo,\n} from \"../../utils/partialRender\";\nimport { readRoutePayload, type RouteQueryPayload } from \"./readRoutePayload\";\n\ninterface LoadRoutePayloadOptions {\n /** The `.json` URL for the route being navigated to. */\n url: string;\n /** `x-gemi-from` value for the route currently on screen. */\n from: string;\n /** Hands over a payload warmed ahead of this navigation, if there is one. */\n takePrefetched?: (url: string) => Promise<unknown> | null;\n /**\n * The route that is on screen *now*, re-read at the moment a response lands.\n * A navigation that committed while this one was in flight invalidates the\n * partial-render plan the server computed.\n */\n renderedRoute: () => string;\n /**\n * Receives each query result the server streams behind the envelope\n * (#290) — the caller hydrates it into the cache, which settles any\n * segment suspended on that variant.\n */\n onQueryPayload?: (payload: RouteQueryPayload) => void;\n}\n\n/**\n * The page data for a navigation, from whichever source can produce it.\n *\n * A prefetched payload is always a full render, so it can be committed as-is\n * and the `x-gemi-from` round trip skipped entirely. Everything else — no\n * prefetch, a prefetch that failed, a partial response computed against a route\n * that has since been navigated away from — falls through to a request.\n *\n * Returns `null` when nothing usable came back; the caller leaves the current\n * route on screen.\n */\nexport async function loadRoutePayload(\n options: LoadRoutePayloadOptions,\n): Promise<any> {\n const { url, from, takePrefetched, renderedRoute, onQueryPayload } = options;\n\n const prefetched = takePrefetched?.(url);\n if (prefetched) {\n const payload = await prefetched;\n if (payload) {\n return payload;\n }\n }\n\n let response = { ok: false, json: async () => ({}) } as Response;\n try {\n response = await fetch(url, { headers: { [PARTIAL_RENDER_HEADER]: from } });\n } catch (e) {\n console.error(e);\n return null;\n }\n\n if (!response.ok) {\n return null;\n }\n\n // Resolves with the envelope as soon as its line arrives; query results\n // streaming behind it keep draining into `onQueryPayload`.\n const payload = await readRoutePayload(response, onQueryPayload);\n\n // The segments the server carried forward were computed against a route that\n // is no longer on screen. Nothing sound to merge onto — ask for the whole\n // tree instead.\n const claimed: PartialRenderInfo | null = payload?.partial ?? null;\n if (claimed && claimed.from !== renderedRoute()) {\n try {\n const full = await fetch(url);\n if (full.ok) {\n return await readRoutePayload(full, onQueryPayload);\n }\n } catch (e) {\n console.error(e);\n }\n }\n\n return payload;\n}\n","import {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n StrictMode,\n memo,\n useTransition,\n Suspense,\n useSyncExternalStore,\n} from \"react\";\n\nimport type { PropsWithChildren, ReactNode, ComponentType, lazy } from \"react\";\nimport { ErrorBoundary, type FallbackProps } from \"react-error-boundary\";\n\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n ClientRouterContext,\n ClientRouterProvider,\n} from \"./ClientRouterContext\";\nimport type { ComponentTree } from \"./types\";\nimport {\n ComponentsContext,\n ComponentsProvider,\n loadViewModule,\n subscribeViewModules,\n} from \"./ComponentContext\";\nimport {\n QueryManagerContext,\n QueryManagerProvider,\n} from \"./QueryManagerContext\";\nimport { I18nProvider } from \"./I18nContext\";\nimport { WebSocketContextProvider } from \"./WebsocketContext\";\nimport { useNavigate } from \"./useNavigate\";\nimport {\n type PageData,\n type RouteState,\n RouteStateProvider,\n} from \"./RouteStateContext\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { Action } from \"history\";\nimport { useRouteData } from \"./useRouteData\";\nimport { updateMeta } from \"./Head\";\nimport { RouteTransitionProvider } from \"./RouteTransitionProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport { initialRenderedRoute } from \"../utils/partialRender\";\nimport { mergeCarriedSegments } from \"./helpers/mergeCarriedSegments\";\nimport { routeDataUrl } from \"./helpers/routeDataUrl\";\nimport { loadRoutePayload } from \"./helpers/loadRoutePayload\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n loaders: Record<string, () => void>;\n }\n}\n\nfunction restoreScroll(action: Action | null = null, _pathname = \"no path\") {\n if (action === null) {\n return;\n }\n\n const { pathname, search, hash } = window.location;\n\n const key = [pathname, search, hash].join(\"\");\n const sh = window.scrollHistory;\n\n const scrollPosition = sh?.get(key);\n\n if (action !== Action.Pop) {\n window.scrollTo(0, 0);\n } else {\n // In dev mode the effect runs scroll restoration\n // will be called twice, this if statement prevents\n // scroll to top\n if (!scrollPosition) {\n return;\n }\n window.scrollTo(0, scrollPosition ?? 0);\n }\n\n sh?.delete(key);\n}\n\ninterface RouteProps {\n componentPath: string;\n pathname: string;\n action: Action | null;\n}\n\nconst DefaultQueryErrorFallback = (props: FallbackProps) => {\n return (\n <div role=\"alert\">\n <p>Something went wrong.</p>\n <button type=\"button\" onClick={() => props.resetErrorBoundary()}>\n Try again\n </button>\n </div>\n );\n};\n\nconst Route = memo((props: PropsWithChildren<RouteProps>) => {\n const { componentPath, pathname, action, children } = props;\n const { viewImportMap, getViewModule } = useContext(ComponentsContext);\n const { clearErrors } = useContext(QueryManagerContext);\n const { data } = useRouteData();\n\n // `Loading` / `Error` are optional named exports of the view module,\n // subscribed so a Route that rendered before its chunk arrived re-reads\n // the registry once it lands. On the server `getViewModule` reads the\n // eagerly-loaded modules the http server passed in — a streaming render\n // suspends for real, so the `Loading` fallback it puts in the shell must be\n // the same one the client hydrates.\n const getModule = useCallback(\n () => getViewModule?.(componentPath),\n [getViewModule, componentPath],\n );\n const mod = useSyncExternalStore(subscribeViewModules, getModule, getModule);\n\n const componentData = data?.[pathname]?.[componentPath] ?? {};\n const Component = viewImportMap[componentPath];\n\n useEffect(() => {\n if (!children) {\n restoreScroll(action, componentPath);\n }\n }, [action, children, componentPath]);\n\n if (!Component) {\n const NotFound = viewImportMap[\"404\"];\n return <NotFound />;\n }\n const Loading = mod?.Loading;\n const ErrorFallback = mod?.Error ?? DefaultQueryErrorFallback;\n\n return (\n <ErrorBoundary\n FallbackComponent={ErrorFallback}\n resetKeys={[pathname]}\n onReset={clearErrors}\n >\n <Suspense fallback={Loading ? <Loading /> : null}>\n {/* Keyed by view path so swapping views remounts the view (fresh\n state), while the boundary above — keyed by tree slot in `Tree` —\n stays revealed across the swap. */}\n <Component key={componentPath} {...componentData}>\n {props.children}\n </Component>\n </Suspense>\n </ErrorBoundary>\n );\n});\n\nexport const Tree = memo(\n (props: {\n action: Action;\n tree: ComponentTree;\n entries: string[];\n pathname: string;\n }) => {\n const { entries, tree, pathname, action } = props;\n\n return (\n <>\n {tree\n .filter(([path]) => entries.includes(path))\n .map((node, slot) => {\n const [path, subtree] = node;\n // Keyed by tree SLOT, not by view path: the Suspense/error\n // boundary inside `Route` must survive a sibling swap (Home →\n // Pricing under the same layout), so React treats it as already\n // revealed and a suspending navigation keeps the previous page on\n // screen. A path key would remount the boundary every navigation,\n // and a brand-new boundary commits its fallback the moment any\n // sibling content (the layout's re-rendered chrome) commits —\n // blanking the outgoing page. The view itself still remounts when\n // the path changes: `Route` keys its Component render.\n if (subtree.length > 0) {\n return (\n <Route\n action={action}\n key={`slot-${slot}`}\n componentPath={path}\n pathname={pathname}\n >\n <Tree\n action={action}\n tree={subtree}\n entries={entries}\n pathname={pathname}\n />\n </Route>\n );\n }\n return (\n <Route\n action={action}\n key={`slot-${slot}`}\n componentPath={path}\n pathname={pathname}\n />\n );\n })}\n </>\n );\n },\n);\n\nconst Routes = (props: { componentTree: ComponentTree }) => {\n const { componentTree } = props;\n const [isPending, startTransition] = useTransition();\n const [isFetching, setIsFetching] = useState(false);\n const { routerSubject, fetchRouteCSS, takePrefetched } =\n useContext(ClientRouterContext);\n const { hydrate } = useContext(QueryManagerContext);\n\n const [transitionPath, setTransitionPath] = useState<[string, string]>([\n null,\n routerSubject?.getValue().pathname,\n ]);\n\n const {\n breadcrumbs,\n pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n } = useContext(ServerDataContext);\n\n const [routeState, setRouteState] = useState<RouteState & PageData>({\n params: routerSubject?.getValue().params,\n search: routerSubject?.getValue().search,\n pathname: routerSubject?.getValue().pathname,\n views: routerSubject?.getValue().views,\n action: null,\n hash: routerSubject?.getValue().hash,\n state: routerSubject?.getValue().state,\n routePath: routerSubject?.getValue().routePath,\n locale: routerSubject?.getValue().locale,\n breadcrumbs,\n data: pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n });\n\n const { replace } = useNavigate();\n\n // Adopt what the document was rendered with. Without this the initial payload\n // only ever reaches a component that mounts on the first render, and one that\n // mounts on a later navigation — into a route whose layout has since been\n // carried forward rather than re-run — would fetch it over `/api` instead.\n useEffect(() => {\n hydrate(prefetchedData);\n }, [hydrate, prefetchedData]);\n\n // The route currently on screen, in `x-gemi-from` form. Updated when a\n // response is committed, never when one is merely requested — a navigation\n // that fails must leave the base the server carries segments from intact.\n const renderedRouteRef = useRef(initialRenderedRoute(routeState));\n\n useEffect(() => {\n return routerSubject?.subscribe(async (routerState) => {\n const { pathname, search, state, views } = routerState;\n setTransitionPath((current) => {\n const [, prevTarget] = current;\n return [prevTarget, pathname];\n });\n if (routerState.views.length === 0) {\n setRouteState((routerState) => ({\n ...routerState,\n views: [\"404\"],\n }));\n return;\n }\n\n if (state?.shallow) {\n setRouteState((state) => ({\n ...state,\n ...routerState,\n }));\n return;\n }\n\n const localeSegment = routerState.locale ? `/${routerState.locale}` : \"\";\n\n const url = routeDataUrl({ pathname, search, localeSegment });\n const from = renderedRouteRef.current;\n setIsFetching(true);\n\n // `fetchRouteCSS` keys off the route manifest, so it needs the pattern\n // rather than the concrete path — `/posts/:id`, not `/posts/123`.\n // Started here so it runs alongside the payload fetch, but awaited\n // before the transition commits: a surface that mounts ahead of its own\n // stylesheet paints unstyled first (#328). Swallowing the rejection is\n // what keeps a CSS failure from stranding the navigation.\n const cssReady = fetchRouteCSS(routerState.routePath).catch((e) =>\n console.error(e),\n );\n // Through `loadViewModule` so the module registry — and with it each\n // view's `Loading`/`Error` exports — is populated before the\n // transition commits the new surface.\n for (const component of views) {\n loadViewModule(component);\n }\n\n const payload = await loadRoutePayload({\n url,\n from,\n takePrefetched,\n renderedRoute: () => renderedRouteRef.current,\n // Query results streaming behind the envelope (#290): hydrating each\n // settles the segment suspended on it — the same wake path streamed\n // documents use.\n onQueryPayload: ([path, variantKey, data]) => {\n hydrate({ [path]: { [variantKey]: data } });\n },\n });\n\n await cssReady;\n\n if (payload) {\n const {\n data,\n i18n,\n prefetchedData,\n breadcrumbs,\n meta,\n directive = {},\n is404 = false,\n appId,\n } = payload;\n updateMeta(meta);\n if (directive?.kind === \"Redirect\") {\n if (directive?.path) {\n replace(directive.path, { params: {} } as unknown);\n }\n\n return;\n }\n\n if (is404) {\n startTransition(() => {\n setRouteState((state) => ({\n ...state,\n appId,\n views: [\"404\"],\n }));\n });\n }\n\n const carriedViews: string[] = payload.partial?.carriedViews ?? [];\n renderedRouteRef.current = `${pathname}${search}`;\n\n // Adopt what the server just prefetched before the new surface mounts\n // and its queries read the cache, otherwise they refetch it over /api.\n // Safe here: this callback is async, so we are past the render phase.\n hydrate(prefetchedData);\n\n startTransition(() => {\n setRouteState((state) => ({\n ...routerState,\n appId,\n i18n,\n prefetchedData,\n ...mergeCarriedSegments(\n state,\n { pathname, routePath: routerState.routePath, data, breadcrumbs },\n carriedViews,\n ),\n }));\n });\n }\n setIsFetching(false);\n });\n }, [routerSubject, fetchRouteCSS, takePrefetched, replace, hydrate]);\n\n return (\n <RouteTransitionProvider\n isPending={isPending}\n isFetching={isFetching}\n transitionPath={transitionPath}\n >\n <RouteStateProvider state={routeState}>\n <Tree\n action={routeState.action}\n pathname={applyParams(routeState.pathname ?? \"/\", routeState.params)}\n tree={componentTree}\n entries={routeState.pathname ? routeState.views : [\"404\"]}\n />\n </RouteStateProvider>\n </RouteTransitionProvider>\n );\n};\n\nexport const ClientRouter = (props: {\n viewImportMap?: Record<string, ReturnType<typeof lazy>>;\n /** Server only: full view modules for `Loading`/`Error` fallbacks. */\n viewModules?: Record<string, Record<string, any>>;\n RootLayout: ComponentType<{ children: ReactNode; locale: string }>;\n}) => {\n const { RootLayout } = props;\n const {\n routeManifest,\n router,\n componentTree,\n pageData,\n cssManifest,\n breadcrumbs,\n i18n,\n } = useContext(ServerDataContext);\n\n return (\n <ThemeProvider>\n <I18nProvider>\n <WebSocketContextProvider>\n <QueryManagerProvider>\n <ComponentsProvider\n viewImportMap={props.viewImportMap}\n modules={props.viewModules}\n >\n <ClientRouterProvider\n cssManifest={cssManifest}\n searchParams={router.searchParams}\n params={router.params}\n pageData={pageData}\n is404={router.is404}\n is500={false}\n pathname={router.pathname}\n currentPath={router.currentPath}\n routeManifest={routeManifest}\n breadcrumbs={breadcrumbs}\n urlLocaleSegment={router.urlLocaleSegment}\n >\n <StrictMode>\n <RootLayout locale={i18n.currentLocale}>\n <Routes componentTree={componentTree} />\n </RootLayout>\n </StrictMode>\n </ClientRouterProvider>\n </ComponentsProvider>\n </QueryManagerProvider>\n </WebSocketContextProvider>\n </I18nProvider>\n </ThemeProvider>\n );\n};\n","import { useEffect, type ComponentType } from \"react\";\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nconst StackTrace = () => {\n useEffect(() => {\n window.addEventListener(\"load\", () => {\n const container = document.getElementById(\"overlay\");\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (window as any).error,\n stack: (window as any).stack_trace || \"\",\n });\n container.appendChild(overlay);\n }\n });\n }, []);\n\n return <div id=\"overlay\" />;\n};\n\nexport function init(RootLayout: ComponentType<any>) {\n if (typeof window !== \"undefined\" && (window as any).render_error) {\n createRoot(document.body).render(<StackTrace />);\n } else {\n hydrateRoot(\n document,\n <>\n <></>\n <></>\n <ErrorBoundary fallback={<div />}>\n <ServerDataProvider>\n <ClientRouter RootLayout={RootLayout} />\n </ServerDataProvider>\n </ErrorBoundary>\n </>,\n {\n onCaughtError: (error) => {\n console.error(error);\n // @ts-ignore\n if (import.meta.env.DEV) {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (error as any).message,\n stack: (error as any).stack || \"\",\n });\n document.body.appendChild(overlay);\n }\n }\n },\n },\n );\n }\n}\n\nexport function create(\n RootLayout: ComponentType<any>,\n { componentTree, loaders, routeManifest, router, i18n, auth, prefetchedData, viewImportMap }: any,\n) {\n (window as any).__GEMI_DATA__ = {\n componentTree,\n loaders,\n routeManifest,\n router,\n i18n,\n auth,\n prefetchedData,\n pageData: {},\n };\n createRoot(document.getElementById(\"root\")).render(\n <ServerDataProvider>\n <ClientRouter viewImportMap={viewImportMap} RootLayout={RootLayout} />\n </ServerDataProvider>,\n );\n}\n","import type { ComponentType } from \"react\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ServerQueryContext } from \"./ServerQueryContext\";\n\nexport function createRoot(\n RootLayout: ComponentType<{ children: React.ReactNode; locale: string }>,\n) {\n // `serverQueries` and `viewModules` exist only when the view router renders\n // this on the server — the browser mounts with both absent.\n return (props: any) => (\n <ServerDataProvider value={props.data}>\n <ServerQueryContext.Provider value={props.serverQueries ?? null}>\n <ClientRouter\n RootLayout={RootLayout}\n viewImportMap={props.viewImportMap}\n viewModules={props.viewModules}\n />\n </ServerQueryContext.Provider>\n </ServerDataProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nconst defaultScreen = [390, 768, 1024];\nconst defaultContainer = [100, 100, 100, 100];\n\nfunction generateImageProps(\n src: string,\n width: number,\n container = defaultContainer,\n screen = defaultScreen,\n quality = 80,\n) {\n const baseUrl = src;\n\n const widths = [...container.map((c, i) => (screen[i] * c) / 100), width * 2];\n\n return {\n srcSet: [\n ...screen.map((size, i) => {\n return `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${widths[i]} ${size}${isNaN(Number(size)) ? \"\" : \"w\"}`;\n }),\n `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${width * 2} 2x`,\n ].join(\", \"),\n sources: [\n ...container.map((c, i) => {\n if (!screen[i]) {\n return `${c}vw`;\n }\n return `(max-width: ${screen[i]}px) ${c}vw`;\n }),\n ].join(\", \"),\n };\n}\n\nfunction fillRestWithLast<T>(arr: T[], length: number): T[] {\n return [\n ...arr,\n ...Array.from({ length: length - arr.length }).fill(arr[arr.length - 1]),\n ] as T[];\n}\n\ninterface ImageProps {\n src: string;\n width: number;\n container?: number[];\n screen?: number[];\n quality?: number;\n}\n\nexport const Image = (props: ComponentProps<\"img\"> & ImageProps) => {\n const {\n screen = defaultScreen,\n container = defaultContainer,\n src,\n width,\n quality = 80,\n srcSet: __,\n ...rest\n } = props;\n\n if (!src) {\n return null;\n }\n\n const srcProps = generateImageProps(\n src,\n width,\n fillRestWithLast(container, 4),\n screen,\n quality,\n );\n\n return <img {...srcProps} width={width} {...rest} />;\n};\n","import { usePost } from \"../useMutation\";\n\ninterface UseForgotPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseForgotPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useForgotPassword(args: UseForgotPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/forgot-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\nimport { useQuery } from \"../useQuery\";\n\ninterface UseSignInArgs {\n onSuccess?: (data: any) => void;\n}\n\nconst defaultArgs: UseSignInArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignIn(args: UseSignInArgs = defaultArgs) {\n // Only here for `mutate` — `lazy` so the sign-in form neither fetches nor\n // suspends on a user it does not have yet.\n const { mutate } = useQuery(\"/auth/me\", {}, { lazy: true });\n return usePost(\n \"/auth/sign-in\",\n {},\n {\n onSuccess: (user) => {\n args.onSuccess(user);\n mutate(user as any);\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\nexport function useSignUp() {\n return usePost(\"/auth/sign-up\");\n}\n","import { useMutate } from \"../useMutate\";\nimport { usePost } from \"../useMutation\";\n\ninterface UseSignOutArgs {\n onSuccess?: () => void;\n}\n\nconst defaultArgs: UseSignOutArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignOut(args: UseSignOutArgs = defaultArgs) {\n const mutator = useMutate();\n return usePost(\n \"/auth/sign-out\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n mutator({ path: \"/auth/me\" });\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\ninterface UseResetPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseResetPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useResetPassword(args: UseResetPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/reset-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"../ServerDataProvider\";\nimport { useQuery } from \"../useQuery\";\n\nexport function useUser() {\n const { auth } = useContext(ServerDataContext);\n const {\n data: user,\n loading,\n error,\n } = useQuery(\n \"/auth/me\",\n {},\n {\n fallbackData: auth?.user ? auth.user : null,\n // An anonymous visitor has no `/auth/me` data and never will — this\n // must resolve to `user: null`, not suspend the page behind a 401.\n suspense: false,\n },\n );\n\n if (loading && !user) {\n return { user: null, loading, error };\n }\n\n return { user: user, loading, error };\n}\n","import { createElement, Fragment, isValidElement, type JSX } from \"react\";\n\ntype TemplateParams = Record<\n string,\n string | ((p: unknown) => string | JSX.Element)\n>;\n\nexport function parseTranslation(template: string, params: TemplateParams) {\n // Check if we have any JSX in our parameters\n const hasJSX = Object.values(params).some(\n (value) =>\n typeof value === \"function\" &&\n isValidElement((value as (p: unknown) => unknown)(\"\")),\n );\n\n // Regular expression to match template variables:\n // {{name}} - simple variable\n // {{name:type}} - variable with type casting\n // {{name:[content]}} - variable with interpolated content\n const regex = /{{([^{}]+?)(?::([^{}\\[\\]]+?))?(?:\\[(.*?)\\])?}}/g;\n\n if (!hasJSX) {\n // Simple string replacement\n const result = template.replace(regex, (match, name, type, content) => {\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n const value = params[cleanName];\n if (value === undefined) {\n return match; // Return original match if no parameter found\n }\n\n if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n // Check if function returned JSX - this shouldn't happen in the string branch\n if (isValidElement(functionResult)) {\n throw new Error(\"JSX returned in string context\");\n }\n return String(functionResult);\n }\n\n // Handle type casting if specified\n if (type) {\n switch (type.toLowerCase()) {\n case \"number\":\n return Number(value).toString();\n case \"string\":\n return String(value);\n case \"boolean\":\n return Boolean(value).toString();\n default:\n return String(value);\n }\n }\n return String(value);\n });\n return result as any;\n } else {\n // JSX replacement - we'll split the template into parts\n const parts: Array<string | JSX.Element> = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null = null;\n\n while ((match = regex.exec(template)) !== null) {\n const [fullMatch, name, type, content] = match;\n const matchIndex = match.index;\n\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n // Add text before the match\n if (matchIndex > lastIndex) {\n parts.push(template.substring(lastIndex, matchIndex));\n }\n\n const value = params[cleanName];\n if (value === undefined) {\n // Keep original template variable if no parameter found\n parts.push(fullMatch);\n } else if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n parts.push(functionResult);\n } else if (type) {\n // Handle type casting if specified\n switch (type.toLowerCase()) {\n case \"number\":\n parts.push(Number(value).toString());\n break;\n case \"string\":\n parts.push(String(value));\n break;\n case \"boolean\":\n parts.push(Boolean(value).toString());\n break;\n default:\n parts.push(String(value));\n }\n } else {\n parts.push(String(value));\n }\n\n lastIndex = matchIndex + fullMatch.length;\n }\n\n // Add any remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Convert the parts array to JSX\n return createElement(Fragment, {}, ...parts) as any;\n }\n}\n","import type { I18nDictionary } from \"./rpc\";\nimport type { ParseTranslationParams, Prettify } from \"../utils/type\";\nimport type { JSX } from \"react\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport { useRouteData } from \"./useRouteData\";\n\ntype Parser<T extends Record<string, string>> = Prettify<\n {\n [K in keyof T]: ParseTranslationParams<T[K]>;\n }[keyof T]\n>;\n\ntype ParamsOrNever<T> = T extends Record<string, never>\n ? [params?: never]\n : [params: T];\n\nexport function useTranslator<T extends keyof I18nDictionary>(component: T) {\n const { i18n } = useRouteData();\n\n function parse<\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(key: K, ...args: ParamsOrNever<Parser<U>>) {\n try {\n const translations = i18n.dictionary[i18n.currentLocale][component];\n const [params = {}] = args;\n return parseTranslation(translations[key as any], params);\n } catch (err) {\n console.error(\n `Unresolved translation Component:${component} key:${String(key)}`,\n );\n return String(key);\n }\n }\n\n parse.jsx = <\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(\n key: K,\n ...args: ParamsOrNever<Parser<U>>\n ) => {\n return parse(key, ...(args as any)) as unknown as JSX.Element;\n };\n\n return parse;\n}\n","import { useLocation } from \"./useLocation\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\n\nconst setCookie = async (locale: string) => {\n try {\n return await globalThis.cookieStore.set(\"i18n-locale\", locale);\n } catch (err) {\n return await fetch(`/api/__gemi__/services/i18n/set-locale/${locale}`);\n // TODO: show unsuported browser error\n // console.log(err);\n }\n};\n\nexport function useLocale() {\n const { i18n } = useRouteData();\n const { pathname, search } = useLocation();\n const { replace } = useNavigate();\n const params = useParams();\n\n const setLocale = async (locale: string) => {\n const urlSearchParams = new URLSearchParams(search);\n setCookie(locale).then(() => {\n replace(pathname, {\n locale,\n // TODO: fix: this conversion is wrong, because there can be multiple\n // search params with the same name\n search: Object.fromEntries(urlSearchParams.entries()),\n params,\n } as any);\n });\n };\n\n return [i18n.currentLocale, setLocale] as const;\n}\n","import { useCallback, useContext, useEffect, useMemo } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useSubscription(\n route: string,\n options: { params: {}; cb: (data: any) => void },\n) {\n const { cb, params } = options;\n const { subscribe, unsubscribe } = useContext(WebSocketContext);\n\n const topic = useMemo(\n () => applyParams(route, options.params),\n [route, params],\n );\n\n const handler = (event: MessageEvent<any>) => {\n const message = JSON.parse(event.data);\n if (topic === message.topic) {\n cb(message.data);\n }\n };\n\n useEffect(() => {\n subscribe(topic, handler);\n\n return () => {\n unsubscribe(topic, handler);\n };\n }, [topic]);\n}\n","import { useContext } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useBroadcast(\n path: string,\n options: { params: Record<string, string | number> },\n) {\n const { params = {} } = options;\n const { broadcast } = useContext(WebSocketContext);\n\n const topic = applyParams(path, params);\n\n return (payload: Record<string, any>) => broadcast(topic, payload);\n}\n","import { createElement, Fragment, type ReactNode } from \"react\";\nimport type { SatoriOptions } from \"satori\";\n\ntype Font = Omit<SatoriOptions[\"fonts\"][number], \"data\">;\ntype Options = Omit<SatoriOptions, \"fonts\"> & {\n fonts: Font[];\n} & { width: number; height: number };\n\nexport const OpenGraphImage = ({\n children,\n ...satoriOptions\n}: Options & { children: ReactNode }) => {\n return (\n <>\n {(() => {\n throw {\n jsx: createElement(Fragment, { children }),\n satoriOptions,\n };\n })()}\n </>\n );\n};\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useAppIdMissmatch() {\n const { appId: next } = useContext(RouteStateContext);\n const { appId: current } = useContext(ServerDataContext);\n\n return current !== next;\n}\n"],"x_google_ignoreList":[12,13,14,15,41],"mappings":";;;;;AAAA,IAAa,UAAb,MAAwB;CACtB,8BAAc,IAAI,IAAwB;CAC1C;CAEA,YAAY,cAAiB;EAC3B,KAAK,QAAQ;CACf;CAEA,UAAiB,YAAgC;EAC/C,KAAK,YAAY,IAAI,UAAU;EAC/B,aAAa;GACX,KAAK,YAAY,OAAO,UAAU;EACpC;CACF;CAEA,KAAY,OAAU;EACpB,KAAK,QAAQ;EACb,KAAK,YAAY,SAAS,eAAe,WAAW,KAAK,CAAC;CAC5D;CAEA,WAAkB;EAChB,OAAO,KAAK;CACd;AACF;;;;;;;;AClBA,IAAa,aAAb,cAAgC,MAAM;CAE3B;CACA;CACA;CACA;CAJT,YACE,MACA,YACA,QACA,MACA;EAC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