gemi 0.140.0 → 0.141.0

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.
Files changed (49) hide show
  1. package/dist/auth/AuthController.d.ts +2 -0
  2. package/dist/auth/AuthController.d.ts.map +1 -1
  3. package/dist/auth/types.d.ts +5 -0
  4. package/dist/auth/types.d.ts.map +1 -1
  5. package/dist/chunk-03qkwjvy.js +24 -0
  6. package/dist/{chunk-gx202f9t.js.map → chunk-03qkwjvy.js.map} +3 -3
  7. package/dist/{chunk-mxqnrn1k.js → chunk-0540ptgm.js} +1 -1
  8. package/dist/{chunk-d7a092vd.js → chunk-1axhttzr.js} +1 -1
  9. package/dist/{chunk-ny01tp0y.js → chunk-akahs8fn.js} +25 -25
  10. package/dist/{chunk-ny01tp0y.js.map → chunk-akahs8fn.js.map} +6 -5
  11. package/dist/{chunk-ygyjtrzb.js → chunk-b97tpvet.js} +2 -2
  12. package/dist/{chunk-ygyjtrzb.js.map → chunk-b97tpvet.js.map} +1 -1
  13. package/dist/chunks/{RealtimeClient-B345JtXu.js → RealtimeClient-D8AB_ksF.js} +2 -2
  14. package/dist/chunks/{RealtimeClient-B345JtXu.js.map → RealtimeClient-D8AB_ksF.js.map} +1 -1
  15. package/dist/chunks/{ThemeProvider-BwlMubvu.js → ThemeProvider-BV3tyt_8.js} +27 -13
  16. package/dist/chunks/ThemeProvider-BV3tyt_8.js.map +1 -0
  17. package/dist/chunks/{fetchFileRequest-DKKdn8Yp.js → fetchFileRequest-B2rjj_hy.js} +2 -2
  18. package/dist/chunks/{fetchFileRequest-DKKdn8Yp.js.map → fetchFileRequest-B2rjj_hy.js.map} +1 -1
  19. package/dist/chunks/{live-Cq65lqVg.js → live-COU4GpXn.js} +3 -3
  20. package/dist/chunks/{live-Cq65lqVg.js.map → live-COU4GpXn.js.map} +1 -1
  21. package/dist/chunks/{mutationExtras-KMQj-GZD.js → mutationExtras-idr-Ane0.js} +2 -2
  22. package/dist/chunks/{mutationExtras-KMQj-GZD.js.map → mutationExtras-idr-Ane0.js.map} +1 -1
  23. package/dist/client/ClientRouter.d.ts.map +1 -1
  24. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  25. package/dist/client/Link.d.ts.map +1 -1
  26. package/dist/client/auth/useSignIn.d.ts +4 -0
  27. package/dist/client/auth/useSignIn.d.ts.map +1 -1
  28. package/dist/client/auth/useUser.d.ts +1 -0
  29. package/dist/client/auth/useUser.d.ts.map +1 -1
  30. package/dist/client/index.js +8 -9
  31. package/dist/client/index.js.map +1 -1
  32. package/dist/facades/index.js +1 -1
  33. package/dist/http/index.js +1 -1
  34. package/dist/i18n/index.js +1 -1
  35. package/dist/i18n/localePrefix.d.ts +13 -0
  36. package/dist/i18n/localePrefix.d.ts.map +1 -0
  37. package/dist/kernel/index.js +1 -1
  38. package/dist/server/httpProd.d.ts.map +1 -1
  39. package/dist/server/index.js +1 -1
  40. package/dist/services/index.js +1 -1
  41. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  42. package/dist/services/router/config.d.ts +12 -0
  43. package/dist/services/router/config.d.ts.map +1 -1
  44. package/dist/testing/index.js +2 -2
  45. package/package.json +1 -1
  46. package/dist/chunk-gx202f9t.js +0 -24
  47. package/dist/chunks/ThemeProvider-BwlMubvu.js.map +0 -1
  48. /package/dist/{chunk-mxqnrn1k.js.map → chunk-0540ptgm.js.map} +0 -0
  49. /package/dist/{chunk-d7a092vd.js.map → chunk-1axhttzr.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeProvider-BwlMubvu.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/retryPolicy.ts","../../client/QueryResource.ts","../../client/QueryManagerContext.tsx","../../utils/applyParams.ts","../../utils/omitNullishValues.ts","../../utils/variantKey.ts","../../client/lazyModule.ts","../../client/realtime/loader.ts","../../client/realtime/RealtimeContext.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","../../utils/domainUrl.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","../../i18n/dictionaryRegistry.ts","../../client/helpers/flattenComponentTree.ts","../../client/chunkLoadRecovery.ts","../../client/ComponentContext.tsx","../../client/ClientRouterContext.tsx","../../client/realtime/useChannelSubscription.ts","../../client/RouteTransitionProvider.tsx","../../../../node_modules/.bun/react-error-boundary@6.1.1+83d5fd7b249dbeef/node_modules/react-error-boundary/dist/react-error-boundary.js","../../client/theme.ts","../../client/ThemeProvider.tsx"],"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 // Bound once, per instance, because these are read as plain functions:\n // `useSyncExternalStore(subject.subscribe, subject.getValue, …)` calls them\n // with no receiver, and an unbound method throws on `this.value`.\n //\n // Here rather than at each call site, and that part matters. Binding in a\n // hook body allocates a fresh function every render, and\n // `useSyncExternalStore` tears down and re-creates its subscription\n // whenever `subscribe` changes identity — so a component rendering a\n // navigation spinner would churn its entry in `subscribers` on every pass.\n // `next` iterates that set, and `Set.forEach` visits entries inserted\n // during iteration, so a value landing mid-resubscribe could notify both\n // the outgoing and the incoming subscriber. Binding here keeps the stable\n // prototype-method identity the call sites used to rely on.\n this.subscribe = this.subscribe.bind(this);\n this.next = this.next.bind(this);\n this.getValue = this.getValue.bind(this);\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 *\n * `body` is `null` when the error response was not JSON (a proxy's HTML 502\n * page, a CDN's 404). `retryAfter` is the response's `Retry-After` header in\n * ms, when it sent one — background retries wait that long.\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 public retryAfter?: number,\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 { QueryError } from \"./QueryError\";\n\n/**\n * What a failed query stores as its `error`: a `QueryError` when the server\n * answered with a non-2xx status, or the `Error` the browser raised when it\n * got no usable answer — a `TypeError` for a network failure, a `SyntaxError`\n * for a 2xx body that is not JSON.\n */\nexport type QueryFailure = QueryError | Error;\n\n/**\n * Whether a failed query is retried in the background (`suspense: false`\n * queries only — under suspense the error goes to the error boundary).\n *\n * - a number: retry transient failures (see `isRetryableQueryError`) up to that\n * many times in a row;\n * - `true`: retry transient failures with no cap;\n * - `false` / `0`: never retry;\n * - a function: called after every failure with the number of consecutive\n * failures so far (1 for the first) and the error. It decides alone, so it\n * can retry a status the default never does.\n */\nexport type RetryOption =\n | boolean\n | number\n | ((failureCount: number, error: QueryFailure) => boolean);\n\n/**\n * The wait before a retry, in ms: a number, or a function of the consecutive\n * failure count (1 for the first) and the error. A `Retry-After` header on the\n * failed response wins over either.\n */\nexport type RetryDelayOption =\n | number\n | ((failureCount: number, error: QueryFailure) => number);\n\nexport const DEFAULT_RETRY = 3;\nexport const DEFAULT_RETRY_BASE_DELAY = 1000;\nexport const MAX_RETRY_DELAY = 30_000;\n\n/**\n * A failure that another attempt might fix: no answer at all (offline, a\n * dropped connection), a 2xx body that failed to parse, 408, 429 or any 5xx.\n * Every other status — 400, 401, 403, 404, 410, 422, … — says the request\n * itself is the problem, so sending it again gets the same answer.\n */\nexport function isRetryableQueryError(error: unknown): boolean {\n if (error instanceof QueryError) {\n return error.status === 408 || error.status === 429 || error.status >= 500;\n }\n return error != null;\n}\n\nexport function shouldRetryQuery(\n failureCount: number,\n error: QueryFailure,\n retry: RetryOption | undefined = DEFAULT_RETRY,\n): boolean {\n if (typeof retry === \"function\") return retry(failureCount, error);\n if (retry === false || !isRetryableQueryError(error)) return false;\n if (retry === true) return true;\n return failureCount <= retry;\n}\n\n/**\n * `baseDelay * 2^(failureCount - 1)`, capped at 30s: 1s, 2s, 4s, … by default.\n * A `Retry-After` the server sent (a 429 or 503) is honoured as is.\n */\nexport function retryDelayFor(\n failureCount: number,\n error: QueryFailure,\n retryDelay: RetryDelayOption | undefined,\n baseDelay: number = DEFAULT_RETRY_BASE_DELAY,\n): number {\n if (error instanceof QueryError && error.retryAfter !== undefined) {\n return error.retryAfter;\n }\n if (typeof retryDelay === \"function\") return retryDelay(failureCount, error);\n if (typeof retryDelay === \"number\") return retryDelay;\n return Math.min(\n baseDelay * 2 ** Math.max(0, failureCount - 1),\n Math.max(MAX_RETRY_DELAY, baseDelay),\n );\n}\n\n/**\n * A `Retry-After` header value in ms: delta-seconds or an HTTP date.\n * `undefined` when absent or unreadable.\n */\nexport function parseRetryAfter(\n value: string | null | undefined,\n now: number = Date.now(),\n): number | undefined {\n if (value == null) return undefined;\n const trimmed = value.trim();\n if (trimmed === \"\") return undefined;\n if (/^\\d+$/.test(trimmed)) return Number(trimmed) * 1000;\n const date = Date.parse(trimmed);\n if (Number.isNaN(date)) return undefined;\n return Math.max(0, date - now);\n}\n","import { Subject } from \"../utils/Subject\";\nimport { QueryError } from \"./QueryError\";\nimport { parseRetryAfter } from \"./retryPolicy\";\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;\nconst MAX_TIMEOUT = 2 ** 31 - 1;\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 * How many mounted readers are rendering each variant. A mounted variant is\n * on screen, so an invalidation refetches it now; one nobody renders is only\n * marked stale and revalidates when something reads it next — invalidating\n * every search variant a user browsed through must not put each of them on\n * the wire at once.\n */\n private watchers = new Map<string, number>();\n /**\n * Consecutive failed fetches per variant. A background retry adds to the\n * count; any other fetch that fails starts it again at 1, and a success\n * clears it. `useQuery`'s retry policy reads it to decide whether to go\n * again and how long to wait.\n */\n private failures = new Map<string, number>();\n /**\n * At most one scheduled retry per variant, however many mounted readers\n * render it — each of them sees the same failure and asks for one.\n */\n private retryTimers = new Map<string, ReturnType<typeof setTimeout>>();\n /**\n * Request ordering (#677). Every fetch takes the next number from `seq`\n * when it is sent; `issued` holds the newest one per variant, and `applied`\n * the number of the newest write that landed — a response, or an\n * optimistic `mutate`/`invalidate` update, which takes the current `seq` and\n * so supersedes every request already on the wire. A response whose number\n * is not above `applied` is dropped, so overlapping refetches can no longer\n * land an older body over a newer one just because it arrived last.\n */\n private seq = 0;\n private issued = new Map<string, number>();\n private applied = new Map<string, number>();\n /**\n * The abort controller of every request on the wire, per variant (#659).\n * When the last mounted reader of a variant lets go of it, its requests are\n * aborted: nobody is left to render the answer, and the server sees the\n * disconnect through `req.signal`.\n */\n private controllers = new Map<string, Set<AbortController>>();\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 this.fill(store, variantKey, data, now);\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 * A background revalidation: the staleness gate `getVariant` applies, but\n * the fetch is *always* silent — `loading: true` is never written to the\n * cache, so what the caller renders is untouched until the new data lands.\n *\n * That is the difference from `getVariant`, which only takes the silent path\n * for a variant that already `hasData`: a variant sitting on a failed fetch\n * (`hasData: false`, an error stored) would otherwise flip `loading` on for\n * the duration of the request. Focus revalidation reads through here so its\n * \"never changes what's on screen\" contract holds in that case too.\n */\n revalidate(variantKey: string, staleTime: number = DEFAULT_STALE_TIME) {\n if (typeof window === \"undefined\") return;\n // Joining beats racing — a render-initiated read or the mount effect may\n // already have this variant on the wire.\n if (this.inflight.has(variantKey)) return;\n const state = this.peek(variantKey);\n if (state?.loading) return;\n if (state?.hasData) {\n if (!this.isStale(variantKey, staleTime)) return;\n this.lastFetchRecord.set(variantKey, Date.now());\n }\n this.resolveVariant(variantKey, true);\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 /**\n * Mark a variant as rendered by a mounted reader until the returned release\n * runs. `useQuery` and `useInfiniteQuery` hold one for every variant they\n * put on screen.\n */\n retain(variantKey: string): () => void {\n this.watchers.set(variantKey, (this.watchers.get(variantKey) ?? 0) + 1);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const count = (this.watchers.get(variantKey) ?? 1) - 1;\n if (count > 0) {\n this.watchers.set(variantKey, count);\n } else {\n this.watchers.delete(variantKey);\n // Nobody renders it any more: a retry would fetch for no one.\n this.cancelRetry(variantKey);\n this.scheduleAbort(variantKey);\n }\n };\n }\n\n /**\n * Abort the variant's requests on the wire once nobody renders it (#659) —\n * e.g. a `search` that changed again before its answer landed. Deferred a\n * task so a reader that lets go and takes hold again in the same commit\n * (StrictMode's double effects, a resubscribe) never cancels anything.\n *\n * A request with no mounted reader at all — a hover `prefetch`, a render\n * that suspended for the first time — is never aborted here: only losing\n * the *last* reader does that.\n */\n private scheduleAbort(variantKey: string) {\n if (!this.controllers.has(variantKey)) return;\n setTimeout(() => {\n if (this.watchers.has(variantKey)) return;\n this.abort(variantKey);\n }, 0);\n }\n\n /** Abort every request on the wire for this variant. */\n private abort(variantKey: string) {\n const controllers = this.controllers.get(variantKey);\n if (!controllers) return;\n this.controllers.delete(variantKey);\n for (const controller of controllers) {\n controller.abort();\n }\n }\n\n /** How many fetches of this variant have failed in a row (0 after a success). */\n failureCount(variantKey: string): number {\n return this.failures.get(variantKey) ?? 0;\n }\n\n /**\n * Retry a failed variant after `delay` ms. A no-op while a retry is already\n * scheduled or a request is on the wire. When the timer fires, the retry\n * only goes out if the variant still sits on an error and is still\n * rendered by someone.\n */\n scheduleRetry(variantKey: string, delay: number) {\n if (typeof window === \"undefined\") return;\n if (this.retryTimers.has(variantKey) || this.inflight.has(variantKey)) {\n return;\n }\n // `setTimeout` fires at once for a delay past 2^31 - 1 ms (~24.8 days), so\n // a far-off `Retry-After` is clamped rather than retried immediately.\n const wait = Math.min(Math.max(0, delay || 0), MAX_TIMEOUT);\n const timer = setTimeout(() => {\n this.retryTimers.delete(variantKey);\n if (!this.watchers.has(variantKey)) return;\n if (this.inflight.has(variantKey)) return;\n const state = this.peek(variantKey);\n if (!state?.error || state.loading) return;\n // Loud (`loading: true`) only when there is no data to keep showing —\n // the same choice `getVariant` makes.\n this.resolveVariant(variantKey, state.hasData, true, true);\n }, wait);\n this.retryTimers.set(variantKey, timer);\n }\n\n cancelRetry(variantKey: string) {\n const timer = this.retryTimers.get(variantKey);\n if (timer !== undefined) {\n clearTimeout(timer);\n this.retryTimers.delete(variantKey);\n }\n }\n\n /**\n * Refetch a failed variant now, silently — the browser came back online.\n * Starts a fresh run of failures, so the retry policy applies in full again.\n */\n retryNow(variantKey: string) {\n if (typeof window === \"undefined\") return;\n if (this.inflight.has(variantKey)) return;\n const state = this.peek(variantKey);\n if (!state?.error || state.loading) return;\n this.resolveVariant(variantKey, true);\n }\n\n /** Every variant key this resource holds state for, in insertion order. */\n variantKeys(): string[] {\n return [...this.store.getValue().keys()];\n }\n\n /**\n * The many-variant counterpart of `mutate`. The update (when given) is\n * applied to the variant's cached data right away, but only a variant a\n * mounted reader is rendering refetches now; any other one is marked stale\n * and revalidates — bypassing the HTTP cache — the next time it is read.\n */\n invalidate(variantKey: string, fn?: (data: any) => any) {\n this.dropHttpCache(variantKey);\n const store = this.store.getValue();\n const state = store.get(variantKey);\n if (fn && state?.hasData) {\n this.markApplied(variantKey);\n this.store.next(\n store.set(variantKey, { ...state, data: fn(state.data), error: null }),\n );\n }\n this.staleVariants.add(variantKey);\n if (this.watchers.has(variantKey)) {\n this.resolveVariant(variantKey, false, false);\n }\n }\n\n dropHttpCache(variantKey: string) {\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 {}\n }\n\n mutate(variantKey: string, fn: (data: any) => any = (data) => data) {\n this.dropHttpCache(variantKey);\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 // The optimistic value reflects the change being made; a request sent\n // before it can only carry the old data, so it must not land over it.\n this.markApplied(variantKey);\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 // `data` straight from the server into `store` (the caller publishes it):\n // fresh as of `now`, with no failures or retry left, and a reader suspended\n // on the variant woken up, since this is the answer it was waiting on.\n // Not private: `setVariant` in `./queryUpdates` uses it, and the two below.\n fill(store: Map<string, State>, variantKey: string, data: any, now: number) {\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 this.failures.delete(variantKey);\n this.cancelRetry(variantKey);\n this.settle(variantKey);\n }\n\n refetch(variantKey: string) {\n this.resolveVariant(variantKey, false, false);\n }\n\n /** Supersede every request for this variant that is already on the wire. */\n markApplied(variantKey: string) {\n this.applied.set(variantKey, this.seq);\n }\n\n private async resolveVariant(\n variantKey: string,\n silent = false,\n cache = true,\n isRetry = false,\n ) {\n if (typeof window === \"undefined\") {\n return;\n }\n // Whatever triggered this fetch, a scheduled retry would only repeat it.\n this.cancelRetry(variantKey);\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 const seq = ++this.seq;\n this.issued.set(variantKey, seq);\n const controller =\n typeof AbortController === \"undefined\" ? null : new AbortController();\n if (controller) {\n let set = this.controllers.get(variantKey);\n if (!set) {\n set = new Set();\n this.controllers.set(variantKey, set);\n }\n set.add(controller);\n }\n // No newer request for this variant has been sent since this one.\n const isLatest = () => this.issued.get(variantKey) === seq;\n // A newer response, or an optimistic update made after this request was\n // sent, already landed.\n const isSuperseded = () => (this.applied.get(variantKey) ?? 0) >= seq;\n const recordFailure = () => {\n this.failures.set(\n variantKey,\n isRetry ? (this.failures.get(variantKey) ?? 0) + 1 : 1,\n );\n };\n const store = this.store.getValue();\n /**\n * Write a failure. Only the latest request reports one: an older request\n * failing says nothing about the request that replaced it, which will\n * answer for the variant itself. The current state is read at write time,\n * not when the request was sent — a newer response may have landed since.\n */\n const writeError = (error: unknown) => {\n if (!isLatest()) return;\n recordFailure();\n const current = store.get(variantKey);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: current?.data,\n hasData: current?.hasData ?? false,\n error,\n version: current?.version,\n }),\n );\n };\n try {\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 // A variant marked stale by `mutate`/`invalidate` is known to be out\n // of date, so the browser's HTTP cache must not answer for it.\n cache:\n cache && !this.staleVariants.has(variantKey) ? \"default\" : \"reload\",\n signal: controller?.signal,\n });\n try {\n data = await response.json();\n } catch (parseError) {\n // A 2xx that isn't JSON is a broken response. An error status with\n // a non-JSON body (a proxy's HTML 502, a CDN's 404) is still that\n // status — the retry policy needs it — so it becomes a\n // `QueryError` with a `null` body.\n if (response.ok) throw parseError;\n data = null;\n }\n } catch (error) {\n if (controller?.signal.aborted) {\n // Aborted because nobody renders the variant any more — not a\n // failure: no error is stored, the retry policy never sees it, and\n // whatever data was cached stays. If this request turned `loading`\n // on and nothing newer is on the wire, turn it back off so the next\n // reader starts from a clean slate.\n const current = store.get(variantKey);\n if (isLatest() && current?.loading) {\n this.store.next(\n store.set(variantKey, { ...current, loading: false }),\n );\n }\n return;\n }\n console.error(`Error fetching url /api${fullUrl}`, error);\n writeError(error);\n return;\n }\n\n if (response!.ok) {\n if (isSuperseded()) {\n // Older than what is on screen: drop it. If nothing newer is on the\n // wire, this request still owns the `loading` flag it may have set.\n const current = store.get(variantKey);\n if (isLatest() && current?.loading) {\n this.store.next(\n store.set(variantKey, { ...current, loading: false }),\n );\n }\n return;\n }\n this.applied.set(variantKey, seq);\n const current = store.get(variantKey);\n this.store.next(\n store.set(variantKey, {\n // A newer request still on the wire keeps a loud fetch loud.\n loading: isLatest() ? false : (current?.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 this.failures.delete(variantKey);\n } else {\n writeError(\n new QueryError(\n this.key,\n variantKey,\n response!.status,\n data,\n parseRetryAfter(response!.headers?.get?.(\"retry-after\")),\n ),\n );\n }\n } finally {\n if (controller) {\n const set = this.controllers.get(variantKey);\n set?.delete(controller);\n if (set?.size === 0) this.controllers.delete(variantKey);\n }\n // An older request finishing must not clear the flag for the newer one\n // still on the wire.\n if (isLatest()) {\n this.inflight.delete(variantKey);\n }\n // Settle on failure and on a dropped response too — a suspended reader\n // has to wake up to throw, or to re-read and wait on the newer request.\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\";\nimport type { RetryDelayOption, RetryOption } from \"./retryPolicy\";\n\n/** One streamed query payload: `[path, variantKey, data]`. */\ntype StreamedQueryPayload = [string, string, any];\n\n/**\n * App-wide `useQuery` defaults, threaded from `createRoot(RootLayout, {\n * queryConfig })` (and `init` on the client). Resolution order is per-call\n * config → these defaults → framework defaults, so a call site always wins.\n * Only keys with app-wide meaning are accepted — `lazy`, `fallbackData` and\n * `refetchUntil` stay call-site-only. Framework-internal hooks (`useUser`,\n * `useSignIn`) never see these — `useUser` has its own `user` key.\n */\nexport interface QueryConfig {\n /**\n * App-wide suspense switch. `suspense: false` makes every unconfigured\n * `useQuery` behave like pre-0.49: `loading` flags instead of suspension,\n * errors returned instead of thrown. Pair it with the `GemiQueryDefaults`\n * module augmentation so `data`'s nullability matches.\n */\n suspense?: boolean;\n /** How long cached data stays fresh before a read revalidates it, in ms. */\n staleTime?: number;\n keepPreviousData?: boolean;\n /**\n * Background retries for failed `suspense: false` queries. Default `3`:\n * network failures, 408, 429 and 5xx, with exponential backoff; other 4xx\n * are never retried. See `useQuery`'s `retry`.\n */\n retry?: RetryOption;\n /** The wait before each retry, in ms, or `(failureCount, error) => ms`. */\n retryDelay?: RetryDelayOption;\n /** @deprecated Use `retryDelay`. The base of the default backoff. */\n retryIntervalOnError?: number;\n refreshInterval?: number;\n /**\n * Revalidate every query when the tab comes back to the foreground, gated by\n * `staleTime`. Off by default.\n */\n revalidateOnFocus?: boolean;\n /**\n * Minimum gap between two focus revalidations of the same query, in ms\n * (default 5000).\n */\n focusThrottleInterval?: number;\n /**\n * Defaults for `useUser()`'s `/auth/me` query, which ignores the keys above.\n * E.g. `{ staleTime: 30 * 60_000 }` to revalidate the signed-in user at most\n * every half hour — `useSignIn`/`useSignOut` still update it immediately.\n */\n user?: UserQueryConfig;\n}\n\n/**\n * The `useUser()` settings an app may change — per call or app-wide through\n * `queryConfig.user`. Its `suspense: false` and `fallbackData` stay pinned.\n */\nexport interface UserQueryConfig {\n staleTime?: number;\n retry?: RetryOption;\n retryDelay?: RetryDelayOption;\n revalidateOnFocus?: boolean;\n focusThrottleInterval?: number;\n refreshInterval?: number;\n}\n\nexport const QueryConfigContext = createContext<QueryConfig | null>(null);\n\n/**\n * The runtime mirror of the `QueryConfig` type: TS excess-property checking\n * only fires on fresh object literals, so a dynamically built (or plain-JS)\n * config could smuggle call-site-only keys (`lazy`, `fallbackData`,\n * `refetchUntil`) into every query. The provider picks these keys — and only\n * these — before the value enters the context. Keys whose value is\n * `undefined` are dropped too, so an absent value (e.g. an unset env-derived\n * `staleTime`) falls through to the framework default instead of shadowing it.\n */\nconst APP_WIDE_QUERY_CONFIG_KEYS = [\n \"suspense\",\n \"staleTime\",\n \"keepPreviousData\",\n \"retry\",\n \"retryDelay\",\n \"retryIntervalOnError\",\n \"refreshInterval\",\n \"revalidateOnFocus\",\n \"focusThrottleInterval\",\n] as const satisfies ReadonlyArray<keyof QueryConfig>;\n\nexport const USER_QUERY_CONFIG_KEYS = [\n \"staleTime\",\n \"retry\",\n \"retryDelay\",\n \"revalidateOnFocus\",\n \"focusThrottleInterval\",\n \"refreshInterval\",\n] as const satisfies ReadonlyArray<keyof UserQueryConfig>;\n\n/** Copy the listed keys whose value is defined. */\nexport function pickDefined<T extends object, K extends keyof T>(\n source: T | null | undefined,\n keys: ReadonlyArray<K>,\n): Pick<T, K> {\n const picked = {} as Pick<T, K>;\n if (!source) return picked;\n for (const key of keys) {\n if (source[key] !== undefined) picked[key] = source[key];\n }\n return picked;\n}\n\nexport function pickAppWideQueryConfig(\n queryConfig: QueryConfig | null | undefined,\n): QueryConfig | null {\n if (!queryConfig) return null;\n const picked: QueryConfig = pickDefined(\n queryConfig,\n APP_WIDE_QUERY_CONFIG_KEYS,\n );\n if (queryConfig.user) {\n picked.user = pickDefined(queryConfig.user, USER_QUERY_CONFIG_KEYS);\n }\n return picked;\n}\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 = ({\n children,\n queryConfig = null,\n}: PropsWithChildren<{ queryConfig?: QueryConfig | null }>) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n\n // Sanitized once at the choke point every query reads through, so the\n // \"only app-wide keys\" contract holds at runtime, not just in the types.\n const appQueryConfig = useMemo(\n () => pickAppWideQueryConfig(queryConfig),\n [queryConfig],\n );\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 <QueryConfigContext.Provider value={appQueryConfig}>\n {children}\n </QueryConfigContext.Provider>\n </QueryManagerContext.Provider>\n );\n};\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 { omitNullishValues } from \"./omitNullishValues\";\n\n/**\n * The key one search-param combination is cached under, inside a query's\n * resource: the params sorted and serialized, empty when there are none.\n *\n * Sorted because `?b=2&a=1` and `?a=1&b=2` are the same request, and a cache\n * that keyed them separately would fetch twice and hydrate one of them from a\n * payload the server produced for the other. Nullish values are dropped for\n * the same reason: an optional filter left `undefined` is absent, not the\n * string `\"undefined\"`.\n *\n * Every site that reads or writes the cache derives its key from here —\n * `useQuery` (the read), `useMutate` (the write), and `gemi/testing`'s `<Page>`\n * (the seed). They used to hold a copy each, which is the kind of duplication\n * that fails quietly: a seed built by an old copy simply misses, and the test\n * that should have read it fetches over the network and asserts an empty state\n * with nothing pointing at the mismatch.\n */\nexport function toVariantKey(\n search: string | Record<string, unknown> | null | undefined,\n): string {\n const searchParams = new URLSearchParams(\n typeof search === \"string\"\n ? search\n : (omitNullishValues(search ?? {}) as Record<string, string>),\n );\n searchParams.sort();\n return searchParams.toString();\n}\n","/**\n * What a lazy `import()` resolved to, or a thrown error when it is missing.\n * Vite's preload helper resolves the `import()` to `undefined` instead of\n * rejecting when a `vite:preloadError` listener handled the failure (`init`'s\n * chunk-load recovery does, as it starts a reload): treated as a failed load.\n */\nexport function loadedModule<T>(module: T | undefined): T {\n if (!module) throw new Error(\"[gemi] A lazily loaded chunk is unavailable.\");\n return module;\n}\n\n/**\n * A module of `gemi/client` loaded with `import()` on first use (#891,\n * #915). An app's bundler places a module by what reaches it statically, and\n * every route's entry chunk reaches all of `gemi/client`, so code that only\n * some pages need stays out of the entry this way.\n *\n * `current` is the module once it has loaded, for callers that must not wait\n * when it is there; `load` is replaceable in tests. Declared as an object\n * literal, never through a call: an app's bundler drops an unused literal and\n * its `import()` with it, while an unused call's `import()` can still emit an\n * orphaned chunk that changes how the app is split.\n */\nexport interface LazyModule<M> {\n current: M | null;\n load: () => Promise<M | undefined>;\n /** The load in flight, shared by every caller until it settles. */\n loading?: Promise<M> | null;\n}\n\n/**\n * The module, loading it if it is not there yet. Callers while it loads share\n * one load, so their callbacks run in call order. A failed load is not kept:\n * the next call runs `import()` again.\n */\nexport function loadLazy<M>(lazy: LazyModule<M>): Promise<M> {\n if (lazy.current) return Promise.resolve(lazy.current);\n return (lazy.loading ??= lazy.load().then(\n (module) => {\n lazy.loading = null;\n return (lazy.current = loadedModule(module));\n },\n (error: unknown) => {\n lazy.loading = null;\n throw error;\n },\n ));\n}\n","import { loadLazy, loadedModule, type LazyModule } from \"../lazyModule\";\nimport type { QueryResource } from \"../QueryResource\";\nimport type { LiveChannel } from \"./live\";\nimport type { RealtimeClient, RealtimeOptions, RealtimeSocket } from \"./RealtimeClient\";\n\n// The part of the realtime client every page carries: `gemi/client` reaches\n// it through `useQuery`, `useMutation`, `init` and the auth hooks. The client\n// itself (`./RealtimeClient`: the socket, the `gemi.v1` protocol, reconnects,\n// heartbeats) and `useQuery`'s live subscription (`./live`) are loaded with a\n// dynamic `import()` the first time something subscribes, so an app or a\n// route that never subscribes downloads none of it (#891). Only type imports\n// from those two here: a value import would put them back in the entry chunk,\n// which \"the published client, built into an app\" in `packaging.test.ts`\n// checks.\n\n/**\n * The tab's client, once loaded and created (`tabClient` in\n * `./RealtimeClient` creates it), and the options it is created with.\n */\nexport const realtime: { client: RealtimeClient | null; options: RealtimeOptions } = {\n client: null,\n options: {},\n};\n\n/**\n * Sets the socket options (`init({ realtime })` calls it). Takes effect on\n * the next connection.\n */\nexport function configureRealtime(options: RealtimeOptions = {}) {\n Object.assign(realtime.options, options);\n realtime.client?.configure(realtime.options);\n}\n\n/** The tab's client if it is already loaded, else `null`. Never loads it. */\nexport function loadedRealtimeClient(): RealtimeClient | null {\n return realtime.client;\n}\n\nlet loading: Promise<RealtimeClient> | null = null;\n\n/** The lazily loaded client. Replaceable in tests, to simulate a failed load. */\nexport const lazyModules = {\n client: () => import(\"./RealtimeClient.js\"),\n};\n\n/**\n * `./live`, loaded by the first live query. `<Page>` in `gemi/testing` sets\n * `current` up front, so a live query on a provided socket subscribes during\n * its effect, as it did before the module was split out.\n */\nexport const liveModule: LazyModule<Pick<typeof import(\"./live\"), \"followLive\">> = {\n current: null,\n load: () => import(\"./live.js\"),\n};\n\n/**\n * The tab's client, loading its module and creating it on first use. `null`\n * on the server. A failed load (a chunk gone after a deploy, the network) is\n * not kept, so a later subscription calls `import()` again; whether that\n * fetches anew is up to the browser, and the usual recovery is `init`'s\n * reload.\n */\nexport function loadRealtimeClient(): Promise<RealtimeClient> | null {\n if (typeof window === \"undefined\") return null;\n if (realtime.client) return Promise.resolve(realtime.client);\n loading ??= lazyModules\n .client()\n .then((module) => loadedModule(module).tabClient())\n .catch((error: unknown) => {\n loading = null;\n throw error;\n });\n return loading;\n}\n\n/**\n * Follows `useQuery`'s `live` channel until the returned function is called.\n * `./live` loads on first use and does the rest, loading the socket client\n * in turn, so `useQuery` carries only this. `setOpen` reports `false` until\n * the channel is open.\n */\nexport function followLive(\n provided: RealtimeSocket | null,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n // `undefined` until it starts, `null` once stopped.\n let stop: (() => void) | null | undefined;\n const start = (module: Pick<typeof import(\"./live\"), \"followLive\">) => {\n if (stop === undefined) stop = module.followLive(provided, live, resource, setOpen);\n };\n if (liveModule.current) start(liveModule.current);\n // A failed load leaves the channel closed, so the query keeps polling.\n else loadLazy(liveModule).then(start).catch(() => {});\n return () => {\n stop?.();\n stop = null;\n setOpen(false);\n };\n}\n\n/**\n * Reconnects the tab's socket, if it has one, so its channels are authorized\n * as the current session. The auth hooks call it after signing in or out.\n * Never loads or creates the client.\n */\nexport function reconnectRealtime() {\n realtime.client?.reconnect();\n}\n\n/**\n * The open socket's id, for the `X-Gemi-Socket` header, or `null`. Never\n * loads or creates the client.\n */\nexport function currentSocketId(): string | null {\n return realtime.client?.socketId ?? null;\n}\n","import { createContext } from \"react\";\nimport type { RealtimeSocket } from \"./RealtimeClient\";\n\n/**\n * The socket the channel hooks subscribe through. `null` (the default) is the\n * tab's own `RealtimeClient`, created on first use in the browser; `<Page>`\n * in `gemi/testing` provides a `FakeSocket`.\n */\nexport const RealtimeContext = createContext<RealtimeSocket | null>(null);\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","/** Which host a cross-domain URL points at. */\nexport interface DomainTarget {\n /** A subdomain of `route.domains.root` — `\"acme\"`, `\"admin\"`. `null` or omitted for the apex. */\n subdomain?: string | null;\n /** A whole hostname instead, for a custom domain. Wins over `subdomain`. */\n host?: string;\n}\n\n/** An `http(s)://` URL — what `domainUrl` returns. */\nexport type AbsoluteUrl = `http://${string}` | `https://${string}`;\n\n/**\n * Whether `href` names a whole URL rather than a path. The client router only\n * handles paths on the current host; anything absolute is a full page load.\n */\nexport function isAbsoluteUrl(href: string): href is AbsoluteUrl {\n return /^https?:\\/\\//i.test(href);\n}\n\n/**\n * An absolute URL for `path` on another host of the same app. The protocol and\n * port come from `origin`, the one the caller is on, so the URL a page on\n * `acme.localhost:5173` builds for `admin` stays on port 5173 in development\n * and on none behind a production proxy.\n */\nexport function domainUrl(\n base: { root: string; origin: string },\n target: DomainTarget,\n path = \"/\",\n): AbsoluteUrl {\n const current = new URL(base.origin);\n const wanted = target.host\n ? target.host\n : target.subdomain\n ? `${target.subdomain}.${base.root}`\n : base.root;\n const url = new URL(path.startsWith(\"/\") ? path : `/${path}`, current);\n // `url.hostname = x` is a WHATWG setter, and it *ignores* a value it cannot\n // parse rather than failing. A stored custom domain that carries a port or a\n // scheme therefore used to return a link to the host the caller is already\n // on — a wrong-tenant link that looks right. Parse it first, and take a port\n // with it, since a custom domain in development often has one.\n const host = asHost(wanted);\n if (!host) {\n throw new Error(\n `\"${wanted}\" is not a hostname, so there is no URL for it. Give a bare host, optionally with a port — no scheme, path or credentials.`,\n );\n }\n url.hostname = host.hostname;\n if (host.port) {\n url.port = host.port;\n }\n return url.toString() as AbsoluteUrl;\n}\n\n/** `value` as a host and port, or `null` if it is anything more than that. */\nfunction asHost(value: string): { hostname: string; port: string } | null {\n try {\n const url = new URL(`http://${value.trim()}`);\n // A scheme leaves a path behind, and credentials leave the host shorter\n // than what was given; either means this is not a hostname.\n return url.host === value.trim().toLowerCase() && url.pathname === \"/\"\n ? { hostname: url.hostname, port: url.port }\n : null;\n } catch {\n return null;\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/types\";\nimport type { ThemeData } from \"./theme\";\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 /** The `route.domains` group the page was served under; `null` without `route.domains`. */\n domain?: {\n host: string;\n group: string;\n params: Record<string, string>;\n custom: boolean;\n root: string;\n origin: string;\n } | null;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n defaultLocale: string;\n /** The IANA zone dates are formatted in, resolved on the server. */\n timeZone?: string;\n /** `\"off\"` when these views are out of locale routing (`ViewRouteConfig.localeRouting`). */\n localeRouting?: \"off\";\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n /**\n * Evaluated features for this request: `key -> boolean`, nothing else.\n *\n * Never the targeting or the reason a feature resolved the way it did — those\n * stay on the server. Read through `useFeature` rather than directly.\n */\n features: Record<string, boolean>;\n /** The theme cookie as the server read it; `null` when these views run no theme script. */\n theme?: ThemeData | null;\n __csrf: string;\n cssManifest: Record<string, string[]>;\n /** Built chunk URLs per view name, for warming a navigation's imports. */\n modulePreloadManifest: Record<string, string[]>;\n /** The client build's asset base, when it is not `/`. */\n assetBase?: string;\n meta: any;\n appId: string;\n /** Route patterns declared `.static()`; absent when the app has none. */\n staticRoutes?: 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 // The payload always carries the formatting zone; a resolved locale is\n // what marks an i18n app.\n if (!i18n?.currentLocale) {\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 { IsViewPath, UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { isAbsoluteUrl } from \"../utils/domainUrl\";\nimport { useLocation } from \"./useLocation\";\nimport { I18nContext } from \"./I18nContext\";\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\n// `string` rather than `ViewPaths`, so the conditional below can name it\n// without intersecting the path type back down first. `UrlParser` has always\n// taken any string.\ntype Options<T extends string> = UrlParser<T> extends Record<string, never>\n ? {\n search?: Search;\n shallow?: boolean;\n hash?: string;\n locale?: string;\n }\n : {\n search?: Search;\n params: UrlParser<T>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n };\n\n/**\n * The options for a path that is not a declared route: a URL built at runtime.\n *\n * `params` is present but optional. A concrete path — what `useIntendedUrl()`\n * returns — has nothing to substitute and should not have to pass an empty\n * object. But a *pattern* held in a `string` variable is the same type to\n * TypeScript and does still need its params, so refusing them here would break\n * a call that works today. `applyParams` ignores what it cannot place.\n */\ntype RuntimeOptions = {\n search?: Search;\n params?: Record<string, string | number | undefined>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n};\n\n/**\n * Required for a declared route that has params, optional for everything else.\n * See `IsViewPath` for why the test is on the path the caller passed rather\n * than on a type parameter constrained to `ViewPaths`.\n */\ntype NavigateArgs<P extends string> = IsViewPath<P> extends true\n ? UrlParser<P> extends Record<string, never>\n ? [options?: Options<P>]\n : [options: Options<P>]\n : [options?: RuntimeOptions];\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 <P extends ViewPaths | (string & {})>(\n path: P,\n ...args: NavigateArgs<P>\n ) => {\n const navigationAbortController = new AbortController();\n if (setNavigationAbortController) {\n setNavigationAbortController(navigationAbortController);\n }\n\n // Another host — `useDomain().url(...)` — is out of this router's reach.\n if (isAbsoluteUrl(path)) {\n window.location[pushOrReplace === \"push\" ? \"assign\" : \"replace\"](path);\n return;\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 // Cast because `URLSearchParams`'s lib type takes `Record<string,\n // string>` while its runtime contract stringifies whatever it is given —\n // and `Options.search` has always accepted numbers and booleans on\n // purpose. Behaviour is unchanged; only the mismatch is now visible,\n // because the argument type above no longer defers this whole block\n // behind an unresolved conditional.\n const urlSearchParams = new URLSearchParams(search as Record<string, string>);\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","/**\n * The process-wide store behind `defineDictionary`.\n *\n * Every handle registers itself here when its module is *evaluated*, not when\n * it is first rendered. That ordering is the whole point: the view router\n * already awaits a view's module import before rendering it, so by the time it\n * calls `preloadDictionaries()` every dictionary reachable from that view has\n * announced itself and can be warmed in one pass. `useDictionary` then reads\n * resolved strings synchronously and the render never suspends — on the server\n * that keeps the SSR stream from fragmenting into a reveal chunk per\n * dictionary, and on the client it keeps navigations flash-free.\n *\n * `use()` in the hook is the correctness net for what a preload pass cannot\n * see: a dictionary inside a `lazy()` subtree, or a locale switch.\n */\n\nimport type { LocaleStrings } from \"./dictionaryShape\";\n\nexport type { LocaleStrings };\n\n/**\n * A dictionary's strings as the render path sees them: always a promise, so\n * the caller's `use()` is never conditional, and pre-tagged fulfilled when the\n * strings are already in hand so that promise costs nothing. See\n * `loadDictionaryForRender` and `resolvedThenable`.\n */\nexport type RenderThenable = Promise<LocaleStrings> & {\n /** Set when the load failed and this settled on no strings instead. */\n degraded?: boolean;\n /**\n * The strings, when they were already in hand as this thenable was made. No\n * render can have suspended on such a thenable, so none can be replayed on\n * it either, and `useDictionary` reads these without calling `use()`.\n */\n inHand?: LocaleStrings;\n};\n\nexport interface RegisteredDictionary {\n id: string;\n /** Locales this dictionary declares. Empty when it is not known up front. */\n locales: string[];\n load: (locale: string) => Promise<LocaleStrings> | LocaleStrings;\n}\n\ninterface RegistryState {\n /** Every handle that has been constructed, by id. */\n registry: Map<string, RegisteredDictionary>;\n /** Resolved strings: id -> locale -> strings. */\n resolved: Map<string, Map<string, LocaleStrings>>;\n /** In-flight loads, so N components sharing a dictionary share one request. */\n inFlight: Map<string, Promise<LocaleStrings>>;\n /**\n * What the render path hands `use()`, one per (dictionary, locale) and\n * always a thenable — never the raw strings, even once they are in hand.\n * `loadDictionaryForRender` explains both halves.\n */\n renderThenables: Map<string, RenderThenable>;\n /**\n * Registration order, so `preloadDictionaries` can warm only what a freshly\n * imported module added instead of re-walking every dictionary in the app on\n * every navigation.\n */\n order: string[];\n /**\n * Per locale, how far into `order` an unmarked `preloadDictionaries` has\n * already warmed. Lets the server's per-request call cost O(newly imported)\n * rather than O(every dictionary in the app).\n */\n warmed: Map<string, number>;\n /**\n * The locale currently being rendered, recorded by `useDictionary`. The\n * initial payload is in `__GEMI_DATA__`, but that snapshot is frozen at the\n * first load — after a locale switch it is stale, and the view loader needs\n * to know which locale's chunks to warm.\n */\n activeLocale: string | null;\n}\n\n/**\n * Parked on `globalThis` rather than in module scope, because this module gets\n * bundled more than once and the copies have to agree.\n *\n * gemi ships `gemi/client` from one Vite lib build and `gemi/dictionary` from a\n * separate Bun build, an SSR view graph externalizes some gemi subpaths and\n * bundles others, and a dictionary imported by both a view and a controller is\n * evaluated on both sides. Every one of those splits would otherwise produce a\n * second registry: views would register into one Map while the view router\n * preloaded and snapshotted from another, and the hydration payload would come\n * out empty. Module identity is not something this can depend on; a global key\n * is.\n */\nconst GLOBAL_KEY = \"__GEMI_DICTIONARY_REGISTRY__\";\n\nconst state: RegistryState = ((globalThis as any)[GLOBAL_KEY] ??= {\n registry: new Map(),\n resolved: new Map(),\n inFlight: new Map(),\n renderThenables: new Map(),\n order: [],\n warmed: new Map(),\n activeLocale: null,\n});\n\nconst { registry, resolved, inFlight, renderThenables, order, warmed } = state;\n\nfunction cacheKey(id: string, locale: string) {\n return `${id}\\0${locale}`;\n}\n\nexport function registerDictionary(entry: RegisteredDictionary) {\n // A dictionary module can be evaluated twice with the same id — e.g. the\n // Vite-processed copy pulled in by a view and the plain copy a controller\n // imports outside the bundler. Same id means same source literal, so the\n // first registration wins and the duplicate is a no-op rather than a reset\n // that would drop already-resolved strings.\n if (registry.has(entry.id)) {\n return;\n }\n registry.set(entry.id, entry);\n order.push(entry.id);\n}\n\n/** A marker for \"everything registered so far\", for `preloadDictionaries`. */\nexport function dictionaryRegistrationMark(): number {\n return order.length;\n}\n\nexport function getResolved(\n id: string,\n locale: string,\n): LocaleStrings | undefined {\n return resolved.get(id)?.get(locale);\n}\n\nfunction putResolved(id: string, locale: string, strings: LocaleStrings) {\n let byLocale = resolved.get(id);\n if (!byLocale) {\n byLocale = new Map();\n resolved.set(id, byLocale);\n }\n byLocale.set(locale, strings);\n}\n\n/**\n * Load one dictionary's locale, de-duplicating concurrent callers. Returns the\n * strings directly (not a promise) when they are already resolved, so the hook\n * can take a synchronous path without a microtask hop.\n */\nexport function loadDictionary(\n id: string,\n locale: string,\n): LocaleStrings | Promise<LocaleStrings> {\n const already = getResolved(id, locale);\n if (already) {\n return already;\n }\n\n const key = cacheKey(id, locale);\n const pending = inFlight.get(key);\n if (pending) {\n return pending;\n }\n\n const entry = registry.get(id);\n if (!entry) {\n throw new Error(\n `Unknown dictionary \"${id}\". A dictionary must be created with defineDictionary() and its module must have been evaluated before it is read.`,\n );\n }\n\n const result = entry.load(locale);\n\n // The untransformed path holds every locale in memory and answers\n // synchronously — no reason to make callers await a resolved promise.\n if (!(result instanceof Promise)) {\n putResolved(id, locale, result);\n return result;\n }\n\n const promise = result.then(\n (strings) => {\n putResolved(id, locale, strings);\n inFlight.delete(key);\n return strings;\n },\n (err) => {\n inFlight.delete(key);\n throw err;\n },\n );\n inFlight.set(key, promise);\n return promise;\n}\n\n/**\n * The same load, but as the exact thing React's `use()` wants.\n *\n * Three properties, each of which has cost a bug:\n *\n * **It never rejects.** A rejecting promise passed to `use()` rethrows during\n * render, which unmounts the whole route into its error boundary — or, before\n * the shell is ready, fails the server render outright. A missing locale chunk\n * is a routine event (a browser holding stale HTML after a rolling deploy\n * requests a hashed filename that no longer exists), and the deprecated\n * `useTranslator` degraded every i18n failure to rendering the raw key. This\n * keeps that behaviour: the thenable resolves to no strings, and the per-key\n * lookup in `useDictionary` then logs and falls back to the key.\n *\n * **It is always a thenable**, even when the strings are already resolved and\n * could be returned raw. Returning them raw is what made #494: the caller's\n * `use()` becomes conditional, and a component whose first pass suspended in\n * `use()` on a cold chunk gets *replayed* by React once that chunk lands\n * mid-yield. React only restores the mount hook dispatcher from inside `use()`\n * itself, so a replay that skips `use()` runs the rest of the component under\n * the update dispatcher against an empty hook list, and the next `useState`\n * throws \"Update hook called on initial render\". A thenable pre-tagged\n * `fulfilled` costs nothing — React reads it synchronously, no suspend, no\n * microtask hop — and keeps `use()` on every path that can be replayed.\n *\n * **But only those paths call `use()` (#542).** Under `act`, any `use()` call\n * flags the render as waiting on a promise, fulfilled or not, and `act` then\n * parks the render task. When the same component really suspends by *throwing*\n * — as `useQuery` does — that task never runs again and the component never\n * commits. A thenable made from strings already in hand carries them as\n * `inHand`: nothing ever suspended on it, so there is nothing to replay, and\n * the hook reads them directly. A thenable that *was* pending keeps going\n * through `use()` for as long as it is cached, so under `act` the hang\n * outlives its first render; tests warm with `preloadDictionaries` instead\n * (docs/testing.md).\n *\n * **There is exactly one per (dictionary, locale).** React tracks the thenable\n * a component suspended on by position, and a later pass arriving at the same\n * position with a different object gets \"A component was suspended by an\n * uncached promise\" — and, for a promise that has not settled, would suspend\n * forever on a fresh one every render.\n */\nexport function loadDictionaryForRender(\n id: string,\n locale: string,\n): RenderThenable {\n const key = cacheKey(id, locale);\n const already = getResolved(id, locale);\n const cached = renderThenables.get(key);\n\n // The cached thenable wins even once the strings are in hand, because it is\n // the object React tracked when the component suspended. The one exception\n // is a thenable that degraded to no strings: it must not shadow a load that\n // later succeeded — a chunk restored after a rolling deploy, which\n // `preloadDictionaries` picks up on the next navigation. Swapping the object\n // is the lesser problem there, and only the failing render pays for it.\n if (cached && !(cached.degraded && already)) {\n return cached;\n }\n\n if (already) {\n // Not `inHand` when it replaces a degraded thenable: a render may have\n // suspended on that one, and its replay has to reach `use()` again.\n return remember(key, resolvedThenable(already, !cached));\n }\n\n const result = loadDictionary(id, locale);\n // The untransformed path holds every locale in memory and answers\n // synchronously. It still goes out as a thenable — see above.\n if (!(result instanceof Promise)) {\n return remember(key, resolvedThenable(result, true));\n }\n\n const safe: RenderThenable = result.then(\n (strings) => strings,\n (err) => {\n console.error(\n `Failed to load dictionary ${id} for locale ${locale}; rendering keys instead.`,\n err,\n );\n safe.degraded = true;\n return EMPTY_STRINGS;\n },\n );\n return remember(key, safe);\n}\n\nfunction remember(key: string, thenable: RenderThenable): RenderThenable {\n renderThenables.set(key, thenable);\n return thenable;\n}\n\n/**\n * Strings in hand, as something `use()` can read without suspending.\n *\n * The `status`/`value` pair is React's own thenable tagging, not an invention\n * here: `trackUsedThenable` returns `value` on the spot for a thenable already\n * marked fulfilled, and only subscribes when it is not. Untagged, this would\n * be a plain resolved promise — which suspends the component for a microtask\n * and costs it a second render pass, exactly what the synchronous return this\n * replaces existed to avoid. The properties are absent from `Promise`, and so\n * from `RenderThenable`, because nothing here reads them back; React does.\n */\nfunction resolvedThenable(\n strings: LocaleStrings,\n inHand: boolean,\n): RenderThenable {\n return Object.assign(Promise.resolve(strings), {\n status: \"fulfilled\",\n value: strings,\n inHand: inHand ? strings : undefined,\n });\n}\n\nconst EMPTY_STRINGS: LocaleStrings = {};\n\n/**\n * Warm dictionaries for `locale`, so a subsequent render reads them\n * synchronously instead of suspending.\n *\n * With a `mark` — the value taken *before* importing a view module — only that\n * view's newly announced dictionaries are loaded. That is the client's use: it\n * knows exactly which chunk just arrived.\n *\n * Without one, it resumes from where this locale last got to. The server calls\n * it per request and has no mark to give (view modules were imported long\n * before the request arrived), so a plain scan from zero would walk every\n * dictionary in the app on every request — re-deriving the per-request cost this\n * whole change exists to remove, just with a smaller constant.\n *\n * An empty `locale` means the app configured none, and each dictionary is warmed\n * under its own source language — the same key `useDictionary` will ask for, so\n * the warmed entry is the one the render actually reads.\n *\n * Failures are swallowed: a dictionary that cannot load should surface at the\n * component that actually reads it, where the error names the key, rather than\n * take down an unrelated navigation.\n */\nexport async function preloadDictionaries(locale: string, mark?: number) {\n const from = mark ?? warmed.get(locale) ?? 0;\n const ids = order.slice(from);\n if (ids.length === 0) {\n return;\n }\n\n const settled = await Promise.all(\n ids.map(async (id) => {\n try {\n await loadDictionary(id, localeFor(id, locale));\n return true;\n } catch {\n // Deliberately ignored — see above.\n return false;\n }\n }),\n );\n\n if (mark === undefined) {\n // Advanced *after* the loads settle, and only across the leading run that\n // resolved. Moving it up front — as this first did — is a correctness bug\n // twice over: a second request arriving mid-flight reads the raised mark,\n // finds an empty slice, returns immediately and then suspends on the\n // in-flight promises anyway, which is the stream fragmentation the preload\n // exists to prevent; and a swallowed failure would be marked warm and never\n // retried. Stopping at the first failure keeps \"below the watermark\" and\n // \"resolved\" the same statement.\n const firstFailure = settled.indexOf(false);\n const reached = firstFailure === -1 ? ids.length : firstFailure;\n warmed.set(locale, Math.max(warmed.get(locale) ?? 0, from + reached));\n }\n}\n\n/**\n * Which locale a given dictionary should be warmed under.\n *\n * `useDictionary` falls back to the dictionary's own source language when the\n * app has no locale configured, so the preload has to make the same choice or\n * it caches under a key no render ever reads — warming `\"\"`, then suspending on\n * `\"en-US\"` a moment later.\n */\nfunction localeFor(id: string, locale: string): string {\n if (locale) {\n return locale;\n }\n return registry.get(id)?.locales[0] ?? locale;\n}\n\n/**\n * Seed already-known strings, skipping the loader entirely. The client calls\n * this with the SSR payload before hydration so the first render matches the\n * server without a single dictionary request.\n */\nexport function seedDictionaries(\n dictionaries: Record<string, LocaleStrings> | undefined,\n locale: string,\n) {\n if (!dictionaries) {\n return;\n }\n for (const [id, strings] of Object.entries(dictionaries)) {\n putResolved(id, locale, strings);\n }\n}\n\nexport function setActiveLocale(locale: string | undefined | null) {\n if (locale) {\n state.activeLocale = locale;\n }\n}\n\nexport function getActiveLocale(): string | null {\n return state.activeLocale;\n}\n\n/**\n * Adopt strings the server streamed into the document.\n *\n * Mirrors `__GEMI_STREAM__` in `QueryManagerContext`: scripts that already ran\n * sit buffered in a plain array, and from here on `push` seeds directly. Both\n * halves are needed because dictionary scripts interleave with React's chunks —\n * a segment that reveals late carries its dictionary late too.\n *\n * Installed at module scope rather than during a render: seeding is idempotent\n * and touches no React state, and doing it here means it is already in place\n * before hydration reads anything.\n */\ntype StreamedDictionary = [id: string, locale: string, strings: LocaleStrings];\n\nif (typeof window !== \"undefined\") {\n const w = window as unknown as {\n __GEMI_DICT__?: StreamedDictionary[] | { push: (p: StreamedDictionary) => void };\n };\n const adopt = ([id, locale, strings]: StreamedDictionary) => {\n putResolved(id, locale, strings);\n };\n const buffered = Array.isArray(w.__GEMI_DICT__) ? w.__GEMI_DICT__ : [];\n w.__GEMI_DICT__ = { push: adopt };\n for (const entry of buffered) {\n adopt(entry);\n }\n}\n\n/** Test-only: drop all state so cases do not leak into one another. */\nexport function __resetDictionaryRegistry() {\n registry.clear();\n resolved.clear();\n inFlight.clear();\n renderThenables.clear();\n warmed.clear();\n order.length = 0;\n state.activeLocale = null;\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","/**\n * Recovery from a chunk that will not load — almost always a document from an\n * earlier release asking for a chunk the server it reached no longer has\n * (#548). The page cannot continue with the module it wanted, and a full load\n * of the URL it was heading to gets it the current release's document.\n *\n * One reload, guarded: a reload that lands on the same failure (a chunk that is\n * genuinely missing, a proxy that keeps refusing it) must not become a loop. A\n * `sessionStorage` marker with a timestamp survives the reload it guards, so a\n * second failure inside the cooldown is left to the route's error boundary.\n *\n * No DOM or React import at module scope: the server's reload stub\n * (`server/staticAssetMiss.ts`) embeds the same guard as a script.\n */\n\n/** The `sessionStorage` key the guard lives under, shared with the reload stub. */\nexport const CHUNK_RELOAD_MARKER = \"gemi:chunk-reload\";\n\n/** How long after one recovery reload another is refused. */\nexport const DEFAULT_CHUNK_RELOAD_COOLDOWN_MS = 30_000;\n\n/**\n * Where the failure surfaced: a route's view chunk during a client-side\n * navigation or hydration, a `vite:preloadError` (a lazy `import()` in app\n * code, through Vite's preload helper), or an app calling\n * `recoverFromChunkLoadError` from its own error boundary.\n */\nexport type ChunkLoadErrorSource = \"navigation\" | \"hydration\" | \"preload\" | \"app\";\n\n/**\n * Why gemi will not reload, or `null` when it will:\n * - `cooldown`: it already reloaded for a chunk failure within `cooldownMs`.\n * - `offline`: `navigator.onLine` is false — a reload would only fail harder.\n * - `storage`: `sessionStorage` cannot be read or written, so the guard cannot\n * survive the reload and the loop it prevents could not be ruled out.\n */\nexport type ChunkReloadBlock = \"cooldown\" | \"offline\" | \"storage\" | null;\n\nexport interface ChunkLoadErrorContext {\n error: unknown;\n /** The URL the reload goes to: the page being navigated to. */\n url: string;\n source: ChunkLoadErrorSource;\n /** Why gemi will not reload, or `null` when it is about to. */\n blocked: ChunkReloadBlock;\n}\n\nexport interface ChunkLoadRecoveryOptions {\n /** Default 30 000 ms. */\n cooldownMs?: number;\n /**\n * Called for every chunk load failure gemi sees, before it reloads — the\n * place to report it, or to veto the reload (unsaved input, a page that\n * would rather show its own \"a new version is available\" prompt). Return\n * `false` to skip the reload; anything else lets gemi proceed. It is called\n * when the reload is blocked too, with `blocked` saying why.\n */\n onChunkLoadError?: (context: ChunkLoadErrorContext) => boolean | void;\n}\n\nlet enabled = true;\nlet options: ChunkLoadRecoveryOptions = {};\nlet reloading = false;\n\n/**\n * Sets how gemi recovers from a failed chunk. `false` turns recovery off: the\n * failure goes to the route's error boundary as it did before. `init` calls\n * this with its `chunkLoadRecovery` option.\n */\nexport function configureChunkLoadRecovery(next: ChunkLoadRecoveryOptions | false | undefined) {\n enabled = next !== false;\n options = next || {};\n}\n\n/** For tests: back to the defaults, with no reload in flight. */\nexport function __resetChunkLoadRecovery() {\n enabled = true;\n options = {};\n reloading = false;\n}\n\n/**\n * Whether `error` is a module that failed to load rather than one that loaded\n * and threw. Each engine words it differently:\n *\n * - Chromium: `Failed to fetch dynamically imported module: <url>`\n * - Firefox: `error loading dynamically imported module: <url>`\n * - Safari: `Importing a module script failed.`, and on iOS 16\n * `Importing module '<specifier>' is not found.` (folio#2117)\n * - Vite's preload helper: `Unable to preload CSS for <url>`\n *\n * A view that throws while evaluating is not one of these, and reloading\n * would only hide it.\n */\nexport function isChunkLoadError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const { name, message } = error as { name?: unknown; message?: unknown };\n if (name === \"ChunkLoadError\") {\n return true;\n }\n if (typeof message !== \"string\") {\n return false;\n }\n return CHUNK_LOAD_MESSAGES.some((pattern) => pattern.test(message));\n}\n\nconst CHUNK_LOAD_MESSAGES = [\n /failed to fetch dynamically imported module/i,\n /error loading dynamically imported module/i,\n /importing a module script failed/i,\n /importing module .* is not found/i,\n /unable to preload css/i,\n /failed to load module script/i,\n];\n\n/**\n * Reloads the page onto `url` once for a chunk that failed to load, unless the\n * guard or the app's `onChunkLoadError` says not to. Returns whether a reload\n * was started.\n *\n * Errors that are not chunk failures are ignored (`false`), so an app's error\n * boundary can pass everything it catches here.\n */\nexport function recoverFromChunkLoadError(\n error: unknown,\n { source = \"app\", url }: { source?: ChunkLoadErrorSource; url?: string } = {},\n): boolean {\n if (typeof window === \"undefined\" || !enabled || !isChunkLoadError(error)) {\n return false;\n }\n if (reloading) {\n // A route with several views fails once per view; the first one reloads.\n return true;\n }\n const target = url ?? window.location.href;\n const cooldownMs = options.cooldownMs ?? DEFAULT_CHUNK_RELOAD_COOLDOWN_MS;\n const blocked = reloadBlock(cooldownMs);\n\n if (options.onChunkLoadError?.({ error, url: target, source, blocked }) === false) {\n return false;\n }\n if (blocked !== null || !markReload(target)) {\n return false;\n }\n\n reloading = true;\n if (target === window.location.href) {\n window.location.reload();\n } else {\n window.location.assign(target);\n }\n return true;\n}\n\nfunction reloadBlock(cooldownMs: number): ChunkReloadBlock {\n if (typeof navigator !== \"undefined\" && navigator.onLine === false) {\n return \"offline\";\n }\n let raw: string | null;\n try {\n raw = window.sessionStorage.getItem(CHUNK_RELOAD_MARKER);\n } catch {\n return \"storage\";\n }\n const at = parseMarker(raw);\n return at !== null && withinCooldown(Date.now() - at, cooldownMs) ? \"cooldown\" : null;\n}\n\n// A marker from the future (the clock was set back since it was written) is\n// stale rather than a cooldown that lasts until the clock catches up.\nfunction withinCooldown(elapsed: number, cooldownMs: number): boolean {\n return elapsed >= 0 && elapsed < cooldownMs;\n}\n\nfunction parseMarker(raw: string | null): number | null {\n if (!raw) {\n return null;\n }\n try {\n const at = JSON.parse(raw)?.at;\n return typeof at === \"number\" ? at : null;\n } catch {\n return null;\n }\n}\n\nfunction markReload(url: string): boolean {\n try {\n window.sessionStorage.setItem(CHUNK_RELOAD_MARKER, JSON.stringify({ url, at: Date.now() }));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The same guard as a classic script body, for the module the server sends in\n * place of a chunk it does not have. It reloads once per cooldown; inside the\n * cooldown (or with no storage) it throws an error `isChunkLoadError`\n * recognises, so the importing page's own recovery and error boundary see the\n * failure instead of a module that silently has no exports.\n */\nexport function chunkReloadStubScript(\n pathname: string,\n cooldownMs: number = DEFAULT_CHUNK_RELOAD_COOLDOWN_MS,\n): string {\n const key = JSON.stringify(CHUNK_RELOAD_MARKER);\n const error = JSON.stringify(`Failed to fetch dynamically imported module: ${pathname}`);\n return (\n `var r=!1;try{var s=window.sessionStorage,m=JSON.parse(s.getItem(${key})||\"null\");` +\n `var d=m?Date.now()-m.at:NaN;` +\n `if(navigator.onLine!==!1&&!(d>=0&&d<${cooldownMs})){` +\n `s.setItem(${key},JSON.stringify({url:window.location.href,at:Date.now()}));r=!0}}catch(e){}` +\n `if(r)window.location.reload();else throw new Error(${error});export {}`\n );\n}\n","import { createContext, lazy, useMemo, type PropsWithChildren } from \"react\";\nimport {\n dictionaryRegistrationMark,\n getActiveLocale,\n preloadDictionaries,\n} from \"../i18n/dictionaryRegistry\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\nimport type { ServerDataContextValue } from \"./ServerDataProvider\";\nimport { recoverFromChunkLoadError } from \"./chunkLoadRecovery\";\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\n/**\n * Why a view chunk is being loaded. A `prefetch` that fails is left alone —\n * nobody is waiting on it, and reloading the page under a hovered link would\n * be the worst way to find out. The `navigation` or `hydration` that needs the\n * same chunk fails the same way a moment later and recovers then.\n */\nexport type ViewModulePurpose = \"navigation\" | \"hydration\" | \"prefetch\";\n\nexport function loadViewModule(\n name: string,\n purpose: ViewModulePurpose = \"navigation\",\n): Promise<any> {\n const loader =\n typeof window !== \"undefined\" ? window.loaders?.[name] : undefined;\n if (!loader) return Promise.resolve(null);\n // Taken before the import starts: a `defineDictionary` handle registers when\n // its module evaluates, so everything past this mark once the chunk lands is\n // exactly what this view brought with it.\n const mark = dictionaryRegistrationMark();\n return Promise.resolve(loader())\n .catch((error) => {\n // A chunk that will not load is usually a document from an earlier\n // release (#548): one guarded full load of the page being navigated to\n // gets the current one. Rethrown either way, so `lazy()` and the route's\n // error boundary see the failure while the reload is under way — or for\n // good, when the guard refuses it.\n if (purpose !== \"prefetch\") {\n recoverFromChunkLoadError(error, { source: purpose });\n }\n throw error;\n })\n .then(async (mod) => {\n const isNew = !viewModules.has(name);\n viewModules.set(name, mod);\n\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 //\n // Before the dictionary await, not after: this exists to surface the view's\n // `Loading` export the moment it lands, and holding it behind a network\n // fetch would put back the very `null` flash it removes.\n //\n // On a cold load this fires at the worst possible moment — the boundary it\n // wakes is still suspended on the very `lazy()` this module is resolving,\n // and an update there costs the boundary its server HTML. Wrapping it in a\n // transition does not help (`hydrationBlank.test.tsx` pins that); what\n // makes it harmless is `initialViewModulesReady`, which puts the initial\n // route's modules in the registry before anything subscribes to it.\n if (isNew) {\n for (const listener of viewModuleListeners) listener();\n }\n\n // The single choke point every view chunk passes through — prefetch,\n // navigation and hydration alike — so it is where a view's dictionaries get\n // warmed. Awaited before the module is handed back, which folds the\n // dictionary fetch into the loading state the route already shows instead\n // of letting the view render and suspend a beat later.\n await preloadDictionaries(currentLocale(), mark);\n\n return mod;\n });\n}\n\nfunction currentLocale(): string {\n // `getActiveLocale` is whatever the last render used, which survives a locale\n // switch; `__GEMI_DATA__` covers the first navigation, before any\n // `useDictionary` has run.\n return (\n getActiveLocale() ??\n (typeof window !== \"undefined\"\n ? (window.__GEMI_DATA__?.i18n?.currentLocale ?? \"\")\n : \"\")\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\n/**\n * How long hydration will wait for those modules before giving up on them.\n *\n * Only a load that never *settles* reaches this — a stalled HTTP/2 stream, a\n * service worker that never answers. A rejection is already handled. Without\n * a deadline that case costs the whole document: nothing hydrates, and\n * nothing is raised. Expiring it just puts the page back on the pre-#352 path\n * for one route, which is a bad outcome and not a dead one.\n */\nconst INITIAL_VIEW_MODULES_DEADLINE_MS = 2000;\n\n/**\n * Resolves once the views the document was server-rendered with are in the\n * registry — which is what `init` waits for before it hydrates.\n *\n * Hydrating before then is what made a cold load blank its own content. The\n * server renders each route segment through a real component, so the shell\n * ships complete `<Suspense>` boundaries; the browser renders the same\n * segments through `lazy()`, so on the first client render every one of them\n * suspends. React keeps the server HTML up while a boundary is merely\n * suspended, but the moment any update reaches one — the module registry\n * announcing the chunk, an effect, a settling query — it gives up on that\n * boundary and shows the fallback instead, which for a view without a\n * `Loading` export is `null`. The page then sits with its layout and no\n * content until the chunk's `import()` and dictionaries resolve.\n *\n * What this buys is NOT a synchronous `lazy()`. `lazy` suspends on its first\n * render no matter what: the initializer calls the ctor, attaches `.then`,\n * and re-reads a status its callback only sets a microtask later, so even an\n * already-settled promise goes to `Pending` and throws. The render still\n * suspends here — it just suspends *untouched*. `loadViewModule` notifies its\n * listeners only on a view's FIRST registration, so once the module is in\n * `viewModules` the call `lazy` makes during hydration is a silent one, the\n * boundary sees no update, and React keeps the server HTML until it settles.\n *\n * The invariant to preserve, then, is \"no first registration for a mounted\n * view happens during hydration\" — not anything about how `lazy` resolves.\n * Notifying on every call, or memoizing the promise so the `isNew` guard\n * stops being the discriminator, would reintroduce the flash while leaving\n * this preload apparently intact.\n *\n * It is not free. The view chunks themselves are already `modulepreload`ed by\n * the shell, but `loadViewModule` also awaits `preloadDictionaries`, and\n * dictionary locale chunks are dynamic imports, which `collectModulePreloads`\n * deliberately leaves out of those hints. So hydration is gated on a\n * serially-discovered round trip — view chunk, parse, dictionary chunk — and\n * the layout's own handlers stay dead across it. That wait is deliberate\n * rather than incidental: a view whose dictionary is still in flight suspends\n * on `use()` inside this same boundary, which is the same blank arriving by a\n * different route. Warming the current locale's dictionaries from the shell\n * would buy the interactivity back; awaiting less here would not.\n *\n * Never rejects and never waits forever: a chunk that fails or hangs must\n * still leave the app to hydrate and surface the error through the route's\n * error boundary.\n */\nexport const initialViewModulesReady: Promise<unknown> =\n typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\"\n ? Promise.race([\n Promise.all(\n initialViewNames(window.__GEMI_DATA__).map((name) =>\n loadViewModule(name, \"hydration\").catch(() => null),\n ),\n ),\n new Promise((resolve) =>\n setTimeout(resolve, INITIAL_VIEW_MODULES_DEADLINE_MS),\n ),\n ])\n : Promise.resolve();\n\n/**\n * The view names the server rendered this document with — the same lookup\n * `ClientRouterProvider` seeds its route state from, so the two agree on what\n * the first render is going to mount.\n */\nfunction initialViewNames(data: ServerDataContextValue | undefined): string[] {\n if (!data?.router) return [];\n if (data.router.is404) return [\"404\"];\n return data.routeManifest?.[data.router.pathname] ?? [\"404\"];\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\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\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 preloadRouteModules: (routePath: string) => 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 modulePreloadManifest: Record<string, string[]>;\n /** The client build's asset base; `/` when the payload carries none. */\n assetBase?: 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/** One instance, so effects keyed on the locale list do not re-run each render. */\nconst NO_LOCALES: string[] = [];\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 modulePreloadManifest,\n assetBase = \"/\",\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 i18nContext = useContext(I18nContext);\n // `.static()` routes: there is no client router on the other side to render\n // them into, so a navigation there is a full page load.\n const { staticRoutes, i18n } = useContext(ServerDataContext);\n // Views out of locale routing (`localeRouting: \"off\"`) have no locale in\n // their URLs: none is read off a path, and links get none prepended.\n const localeRouted = i18n?.localeRouting !== \"off\";\n const supportedLocales = localeRouted ? (i18nContext.supportedLocales ?? NO_LOCALES) : NO_LOCALES;\n const locale = localeRouted ? i18nContext.locale : null;\n const staticRoutesRef = useRef(new Set<string>(staticRoutes ?? []));\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 /** Hrefs already announced; `null` until seeded from the shell's own hints. */\n const preloadedModulesRef = useRef<Set<string> | null>(null);\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 if (routePath && staticRoutesRef.current.has(routePath)) {\n // `replace`, not `assign`: history already holds the entry for this\n // URL, pushed by the navigation that got us here.\n window.location.replace(location.pathname + location.search + location.hash);\n return;\n }\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(`${assetBase}${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 * Announces every chunk a navigation to `routePath` will import.\n *\n * `loadViewModule` starts each view's own chunk, but a chunk's static\n * imports are discoverable only once it has arrived and parsed — so a\n * `layout -> view -> components` route still costs a round trip per level on\n * every navigation, holding the transition open for exactly the interval the\n * shell's head hints remove from the first load (#352). These are the same\n * per-view lists the shell renders, shipped in the document payload.\n *\n * `modulepreload` rather than `import()`: it fills the HTTP cache without\n * evaluating anything, so warming a link that is never clicked costs a\n * download and no side effects.\n */\n const preloadRouteModules = (routePath: string) => {\n if (typeof document === \"undefined\") {\n return;\n }\n if (!preloadedModulesRef.current) {\n // Seeded from the document because the shell already announced the\n // landing route's chunks — re-announcing them would append dead\n // <link> elements on every navigation back to it.\n preloadedModulesRef.current = new Set(\n Array.from(\n document.querySelectorAll('link[rel=\"modulepreload\"]'),\n (link) => link.getAttribute(\"href\") ?? \"\",\n ),\n );\n }\n const preloaded = preloadedModulesRef.current;\n\n for (const view of routeManifest[routePath] ?? []) {\n for (const href of modulePreloadManifest?.[view] ?? []) {\n if (preloaded.has(href)) {\n continue;\n }\n preloaded.add(href);\n const link = document.createElement(\"link\");\n link.rel = \"modulepreload\";\n link.href = href;\n document.head.appendChild(link);\n }\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 || staticRoutesRef.current.has(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 preloadRouteModules(routePath);\n // Through `loadViewModule` so each view's `Loading`/`Error`\n // exports are registered by the time the route commits.\n // A failure here is nobody's yet: the navigation that needs the chunk\n // meets it again and recovers then (see `ViewModulePurpose`).\n for (const view of routeManifest[routePath] ?? []) {\n loadViewModule(view, \"prefetch\").catch(() => {});\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 preloadRouteModules,\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, useEffect, useRef, useState } from \"react\";\nimport type { DeniedCode } from \"../../services/broadcast/protocol\";\nimport type { ChannelParamValues, ChannelStatus, RealtimeSocket } from \"./RealtimeClient\";\nimport { loadedRealtimeClient, loadRealtimeClient } from \"./loader\";\nimport { RealtimeContext } from \"./RealtimeContext\";\n\nexport interface ChannelState {\n status: ChannelStatus;\n /** Why the subscription was refused, while `status` is `denied`. */\n code: DeniedCode | null;\n}\n\nexport interface ChannelHandlers {\n onEvent?: (event: string, data: unknown) => void;\n onResync?: () => void;\n}\n\nconst CLOSED: ChannelState = { status: \"closed\", code: null };\nconst IDLE: ChannelState = { status: \"idle\", code: null };\n\n/**\n * The one subscription primitive the channel hooks share. Subscribes only in\n * an effect, so a server render, a static page or an island that never\n * mounts opens no socket; on the server it reports `closed`. Handlers may\n * change between renders without resubscribing.\n */\nexport function useChannelSubscription(\n pattern: string | null,\n params: ChannelParamValues,\n handlers: ChannelHandlers,\n enabled: boolean,\n): ChannelState {\n const active = enabled && pattern !== null;\n const [state, setState] = useState<ChannelState>(active ? CLOSED : IDLE);\n const provided = useContext(RealtimeContext);\n const handlersRef = useRef(handlers);\n handlersRef.current = handlers;\n const paramsRef = useRef(params);\n paramsRef.current = params;\n // The effect's key for `pattern` and `params`. Not canonical like the\n // client's own (`channelKey`): params in another order only resubscribe.\n const key = pattern === null ? null : JSON.stringify([pattern, params]);\n\n useEffect(() => {\n if (!active || pattern === null) {\n setState(IDLE);\n return;\n }\n let release: (() => void) | null = null;\n let cancelled = false;\n const subscribe = (socket: RealtimeSocket) => {\n if (cancelled) return;\n release = socket.subscribe(pattern, paramsRef.current, {\n onEvent: (event, data) => handlersRef.current.onEvent?.(event, data),\n onResync: () => handlersRef.current.onResync?.(),\n onStatus: (status, code) =>\n setState((previous) =>\n previous.status === status && previous.code === code ? previous : { status, code },\n ),\n });\n };\n // The tab's client is loaded on the first subscription (see `./loader`);\n // once loaded, later ones subscribe synchronously, as a provided socket\n // does. Until it arrives the status stays `closed`.\n const socket = provided ?? loadedRealtimeClient();\n if (socket) {\n subscribe(socket);\n } else {\n const pending = loadRealtimeClient();\n if (!pending) return;\n // A failed load leaves the hook `closed` (see `loadRealtimeClient`).\n pending.then(subscribe, () => {});\n }\n return () => {\n cancelled = true;\n release?.();\n setState(CLOSED);\n };\n // `key` stands for `pattern` and `params`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [provided, key, active]);\n\n if (typeof window === \"undefined\") return active ? CLOSED : IDLE;\n return state;\n}\n\n/**\n * How long an event-driven refetch waits for the events behind it: a burst\n * (a progress tick per second, a bulk update) refetches once per window, not\n * once per event. The window starts at the first event and is never pushed\n * back, so a steady stream still refetches every `EVENT_COALESCE_MS`.\n */\nexport const EVENT_COALESCE_MS = 150;\n\n/**\n * `fn`, run at most once per `ms`: the first call starts the window, and the\n * calls inside it fold into the one run at its end. Stable across renders;\n * a pending run is dropped on unmount.\n */\nexport function useCoalesced(fn: () => void, ms: number = EVENT_COALESCE_MS): () => void {\n const fnRef = useRef(fn);\n fnRef.current = fn;\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n timer.current = null;\n },\n [],\n );\n const coalesced = useRef<() => void>(null as unknown as () => void);\n coalesced.current ??= () => {\n if (timer.current) return;\n timer.current = setTimeout(() => {\n timer.current = null;\n fnRef.current();\n }, ms);\n };\n return coalesced.current;\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","\"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","/**\n * The theme a visitor picked, shared by the server (which reads it from a\n * cookie and renders the inline script) and the browser (`ThemeProvider`).\n *\n * gemi owns the `light`/`dark` classes on `<html>` only while it has a theme\n * to apply: the visitor's stored choice or `ViewRouteConfig.theme.default`.\n * With neither, it leaves `<html>` alone, so an app that sets its own class\n * before paint keeps it (#937).\n */\n\nexport type Theme = \"light\" | \"dark\" | \"system\";\nexport type ResolvedTheme = \"light\" | \"dark\";\n\n/** The cookie gemi stores the choice in unless `theme.cookie` names another. */\nexport const DEFAULT_THEME_COOKIE = \"theme\";\n\n/** What the server hands the browser in `__GEMI_DATA__.theme`. */\nexport type ThemeData = {\n /** The cookie the choice lives in. */\n cookie: string;\n /** `theme.default`, or `null` when the app set none. */\n default: Theme | null;\n /** The visitor's choice, read from the cookie on the server. */\n value: Theme | null;\n};\n\nexport function isTheme(value: unknown): value is Theme {\n return value === \"light\" || value === \"dark\" || value === \"system\";\n}\n\n/** `\"system\"` asks the browser; the other two are already resolved. */\nexport function resolveTheme(theme: Theme, prefersDark: boolean): ResolvedTheme {\n if (theme === \"system\") return prefersDark ? \"dark\" : \"light\";\n return theme;\n}\n\n/**\n * Puts `resolved` on `<html>`: the class, and `color-scheme` for the browser's\n * own widgets. Removes only the other theme class, never anything else.\n */\nexport function applyTheme(root: HTMLElement, resolved: ResolvedTheme): void {\n root.classList.remove(resolved === \"dark\" ? \"light\" : \"dark\");\n root.classList.add(resolved);\n root.style.colorScheme = resolved;\n}\n\n/** One year: the choice should outlive the session, as `localStorage` did. */\nconst COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\n/**\n * Stores the choice where both the server and the inline script read it: the\n * cookie. `localStorage` is still written, so a page from an older build that\n * only reads storage agrees with this one.\n */\nexport function storeTheme(theme: Theme, cookie: string = DEFAULT_THEME_COOKIE): void {\n try {\n document.cookie = `${cookie}=${theme}; path=/; max-age=${COOKIE_MAX_AGE}; samesite=lax`;\n } catch {}\n try {\n localStorage.setItem(\"theme\", theme);\n } catch {}\n}\n\n/** The stored choice in the browser: the cookie, else the legacy `localStorage` key. */\nexport function readStoredTheme(cookie: string = DEFAULT_THEME_COOKIE): Theme | null {\n try {\n for (const part of document.cookie.split(\";\")) {\n const eq = part.indexOf(\"=\");\n if (eq < 0 || part.slice(0, eq).trim() !== cookie) continue;\n const value = decodeURIComponent(part.slice(eq + 1).trim());\n if (isTheme(value)) return value;\n }\n } catch {}\n try {\n const value = localStorage.getItem(\"theme\");\n if (isTheme(value)) return value;\n } catch {}\n return null;\n}\n\n/**\n * The inline script the server renders before the body, so the class is right\n * before first paint. It does what `readStoredTheme` + `applyTheme` do, kept\n * in one self-contained statement because it runs before any module loads.\n * `config` is JSON-encoded by the caller (`htmlSafeJson`), never interpolated\n * raw.\n */\nexport function themeScriptSource(configJson: string): string {\n return `!function(o){try{var e=null,d=document.documentElement,c=d.classList,k=document.cookie.split(';'),i,j,v;\nfor(i=0;i<k.length;i++){j=k[i].indexOf('=');if(j>0&&k[i].slice(0,j).trim()===o.cookie){v=decodeURIComponent(k[i].slice(j+1).trim());break}}\nif(v!=='light'&&v!=='dark'&&v!=='system'){try{v=localStorage.getItem('theme')}catch(x){}}\nif(v==='light'||v==='dark'||v==='system')e=v;else e=o.default;\nif(!e)return;\nif(e==='system')e=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';\nc.remove(e==='dark'?'light':'dark');c.add(e);d.style.colorScheme=e}catch(x){}}(${configJson})`;\n}\n","import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n applyTheme,\n DEFAULT_THEME_COOKIE,\n readStoredTheme,\n resolveTheme,\n storeTheme,\n type ResolvedTheme,\n type Theme,\n} from \"./theme\";\n\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\ntype ThemeContextValue = {\n /** The visitor's choice, `\"system\"` included. */\n theme: Theme;\n /**\n * What `theme` comes out as: `\"light\"` or `\"dark\"`. `null` while `\"system\"`\n * has not been asked of the browser yet — on the server, and in the first\n * render on the client, so hydration matches.\n */\n resolved: ResolvedTheme | null;\n /** Applies the theme to `<html>` and stores it in the theme cookie. */\n setTheme: (theme: Theme) => void;\n};\n\nconst ThemeContext = createContext<ThemeContextValue>({\n theme: \"light\",\n resolved: \"light\",\n setTheme: () => {},\n});\n\nfunction initialResolved(theme: Theme): ResolvedTheme | null {\n return theme === \"system\" ? null : theme;\n}\n\nexport const ThemeProvider = (props: {\n children: ReactNode;\n /**\n * The theme to start on, ahead of the stored one. The app leaves this unset —\n * a visitor's choice comes from the theme cookie, read by the server — but a\n * test has no browser session to have made that choice in, so\n * `gemi/testing`'s `<Page>` passes it through to render a component in a\n * theme without writing to storage.\n */\n theme?: Theme;\n}) => {\n // The server's reading of the cookie, so the first client render matches\n // the server's instead of reading storage the server could not see.\n const data = useContext(ServerDataContext)?.theme;\n const cookie = data?.cookie ?? DEFAULT_THEME_COOKIE;\n const [theme, setThemeState] = useState<Theme>(\n () => props.theme ?? data?.value ?? data?.default ?? \"light\",\n );\n const [resolved, setResolved] = useState<ResolvedTheme | null>(() => initialResolved(theme));\n\n // A choice the server could not read (one only in `localStorage`, from\n // before the cookie) is picked up once mounted. Mount only: later changes\n // go through `setTheme`.\n useEffect(() => {\n if (props.theme || data?.value) return;\n const stored = readStoredTheme(cookie);\n if (stored && stored !== theme) {\n setThemeState(stored);\n setResolved(initialResolved(stored));\n }\n }, []);\n\n // `\"system\"` follows the browser, for as long as it is the choice.\n useEffect(() => {\n if (theme !== \"system\" || typeof window.matchMedia !== \"function\") return;\n const media = window.matchMedia(DARK_QUERY);\n setResolved(resolveTheme(\"system\", media.matches));\n const onChange = ({ matches }: { matches: boolean }) => {\n const next = resolveTheme(\"system\", matches);\n setResolved(next);\n applyTheme(document.documentElement, next);\n };\n media.addEventListener(\"change\", onChange);\n return () => media.removeEventListener(\"change\", onChange);\n }, [theme]);\n\n const setTheme = (next: Theme) => {\n const prefersDark =\n typeof window.matchMedia === \"function\" && window.matchMedia(DARK_QUERY).matches;\n const nextResolved = resolveTheme(next, prefersDark);\n setThemeState(next);\n setResolved(nextResolved);\n storeTheme(next, cookie);\n applyTheme(document.documentElement, nextResolved);\n };\n\n return (\n <ThemeContext.Provider value={{ theme, resolved, setTheme }}>\n {props.children}\n </ThemeContext.Provider>\n );\n};\n\n/**\n * The visitor's theme: `theme` (their choice), `resolved` (`\"light\"` or\n * `\"dark\"`, `null` until `\"system\"` is known) and `setTheme`, which applies it\n * to `<html>` and stores it in the theme cookie the server reads.\n */\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n"],"x_google_ignoreList":[11,12,13,14,35],"mappings":";;;;;AAAA,IAAa,UAAb,MAAwB;CACtB,8BAAc,IAAI,IAAwB;CAC1C;CAEA,YAAY,cAAiB;EAC3B,KAAK,QAAQ;EAcb,KAAK,YAAY,KAAK,UAAU,KAAK,IAAI;EACzC,KAAK,OAAO,KAAK,KAAK,KAAK,IAAI;EAC/B,KAAK,WAAW,KAAK,SAAS,KAAK,IAAI;CACzC;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;;;;;;;;;;;;AC9BA,IAAa,aAAb,cAAgC,MAAM;CAE3B;CACA;CACA;CACA;CACA;CALT,YACE,MACA,YACA,QACA,MACA,YACA;EACA,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