@rpcbase/client 0.372.0 → 0.374.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getServerApiClient.d.ts","sourceRoot":"","sources":["../../src/apiClient/getServerApiClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA8B,MAAM,SAAS,CAAA;AAGjE,KAAK,GAAG,GAAG,GAAG,CAAA;AAGd,eAAO,MAAM,kBAAkB,GAAS,KAAK,WAAW;UAuKtC,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;WAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;UAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;aAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;EAyBxB,CAAA;AAED,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"getServerApiClient.d.ts","sourceRoot":"","sources":["../../src/apiClient/getServerApiClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA8B,MAAM,SAAS,CAAA;AAGjE,KAAK,GAAG,GAAG,GAAG,CAAA;AAGd,eAAO,MAAM,kBAAkB,GAAS,KAAK,WAAW;UA+KtC,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;WAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;UAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;aAJP,SAAS,kCACf,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAC1B,GAAG,KACR,OAAO,CAAC,SAAS,CAAC;EAyBxB,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -2,6 +2,19 @@ const getServerApiClient = async (app) => {
2
2
  const callRoute = async (app2, method, matchPath, requestUrl, req, res) => {
3
3
  return new Promise((resolve, reject) => {
4
4
  let isEnded = false;
5
+ let timeoutId = null;
6
+ const resolveRequest = (data) => {
7
+ if (isEnded) return;
8
+ isEnded = true;
9
+ if (timeoutId) clearTimeout(timeoutId);
10
+ resolve(data);
11
+ };
12
+ const rejectRequest = (error) => {
13
+ if (isEnded) return;
14
+ isEnded = true;
15
+ if (timeoutId) clearTimeout(timeoutId);
16
+ reject(error);
17
+ };
5
18
  const mockReq = {
6
19
  ...req,
7
20
  method: method.toUpperCase(),
@@ -10,10 +23,7 @@ const getServerApiClient = async (app) => {
10
23
  const mockRes = {
11
24
  ...res,
12
25
  json: (data) => {
13
- if (!isEnded) {
14
- isEnded = true;
15
- resolve(data);
16
- }
26
+ resolveRequest(data);
17
27
  },
18
28
  status: (statusCode) => {
19
29
  console.log("Status:", statusCode, mockReq.method, mockReq.url);
@@ -38,10 +48,7 @@ const getServerApiClient = async (app) => {
38
48
  handler(mockReq, mockRes, (err) => {
39
49
  if (err) {
40
50
  console.error("Middleware error:", err);
41
- if (!isEnded) {
42
- isEnded = true;
43
- rejectMiddleware(err);
44
- }
51
+ rejectMiddleware(err);
45
52
  return;
46
53
  }
47
54
  resolveMiddleware();
@@ -63,11 +70,11 @@ const getServerApiClient = async (app) => {
63
70
  await processLayer(index + 1);
64
71
  }
65
72
  };
66
- processLayer(0);
67
- setTimeout(() => {
68
- if (!isEnded) {
69
- reject("Route handler timed out");
70
- }
73
+ void processLayer(0).catch((err) => {
74
+ rejectRequest(err);
75
+ });
76
+ timeoutId = setTimeout(() => {
77
+ rejectRequest(new Error("Route handler timed out"));
71
78
  }, 3e4);
72
79
  });
73
80
  };
@@ -149,4 +156,4 @@ export {
149
156
  getServerApiClient as default,
150
157
  getServerApiClient
151
158
  };
152
- //# sourceMappingURL=getServerApiClient-4RhtHILD.js.map
159
+ //# sourceMappingURL=getServerApiClient-BYu8h5Zd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getServerApiClient-BYu8h5Zd.js","sources":["../src/apiClient/getServerApiClient.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Application, IRouter, Request, Response } from \"express\"\n\n// import { Ctx } from \"@rpcbase/api\"\ntype Ctx = any\n\n\nexport const getServerApiClient = async(app: Application) => {\n const callRoute = async <TResponse = Record<string, unknown>>(\n app: Application,\n method: string,\n matchPath: string,\n requestUrl: string,\n req: Partial<Request>,\n res: Partial<Response>\n ): Promise<TResponse> => {\n return new Promise((resolve, reject) => {\n let isEnded = false\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n\n const resolveRequest = (data: TResponse) => {\n if (isEnded) return\n isEnded = true\n if (timeoutId) clearTimeout(timeoutId)\n resolve(data)\n }\n\n const rejectRequest = (error: unknown) => {\n if (isEnded) return\n isEnded = true\n if (timeoutId) clearTimeout(timeoutId)\n reject(error)\n }\n\n const mockReq = {\n ...req,\n method: method.toUpperCase(),\n url: requestUrl\n } as Request\n\n const mockRes = {\n ...res,\n json: (data: any) => {\n resolveRequest(data)\n },\n status: (statusCode: number) => {\n console.log(\"Status:\", statusCode, mockReq.method, mockReq.url)\n return mockRes\n },\n } as Response\n\n const routerStack: any[] = (app.router as unknown as IRouter).stack\n\n const firstApiMiddlewareIndex = routerStack.findIndex((layer) => layer.name === \"__FIRST_API_MIDDLEWARE__\")\n if (!(firstApiMiddlewareIndex > -1)) {\n throw new Error(\"middleware: __FIRST_API_MIDDLEWARE__ was not found in stack\")\n }\n\n const apiStack = routerStack.slice(firstApiMiddlewareIndex + 1)\n\n const processLayer = async (index: number) => {\n if (index >= apiStack.length || isEnded) return\n\n const layer = apiStack[index]\n\n const isNonMatchingLayer = !layer.match(matchPath)\n if (isNonMatchingLayer) {\n // console.log(\"not machthing route:\", matchPath, \"to layer:\", index, layer.name, layer, \"reason: \", {isNonMatchingLayer})\n await processLayer(index + 1)\n return\n }\n\n const runHandler = async(handler: any) => new Promise<void>((resolveMiddleware, rejectMiddleware) => {\n handler(mockReq, mockRes, (err?: any) => {\n if (err) {\n console.error(\"Middleware error:\", err)\n rejectMiddleware(err)\n return\n }\n resolveMiddleware()\n })\n })\n\n if (layer.route) {\n if (!layer.route.methods[method.toLowerCase()]) {\n // console.log(\"not machthing route:\", matchPath, \"to route layer:\", index, layer.name, layer, \"reason: method not matching\")\n await processLayer(index + 1)\n return\n }\n\n if (layer.route.stack.length !== 1) {\n throw new Error(`expected only one handler per route for route: ${layer.route.path}`)\n }\n\n await runHandler(layer.route.stack[0].handle)\n\n } else {\n await runHandler(layer.handle)\n }\n\n if (!isEnded) {\n await processLayer(index + 1)\n }\n }\n\n void processLayer(0).catch((err) => {\n rejectRequest(err)\n })\n\n // Set a timeout to prevent hanging\n timeoutId = setTimeout(() => {\n rejectRequest(new Error(\"Route handler timed out\"))\n }, 30000)\n })\n }\n\n const mergeQueryValues = (target: Record<string, string | string[]>, key: string, value: string) => {\n const existing = target[key]\n if (Array.isArray(existing)) {\n existing.push(value)\n return\n }\n\n if (typeof existing === \"string\") {\n target[key] = [existing, value]\n return\n }\n\n target[key] = value\n }\n\n const toQueryValue = (value: unknown): string | null => {\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") return Number.isFinite(value) ? String(value) : null\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\"\n if (typeof value === \"bigint\") return String(value)\n if (value instanceof Date) return value.toISOString()\n return null\n }\n\n const buildQuery = (path: string, payload: Record<string, unknown>) => {\n const url = new URL(path, \"http://localhost\")\n\n const query: Record<string, string | string[]> = {}\n for (const [key, value] of url.searchParams) {\n mergeQueryValues(query, key, value)\n }\n\n for (const [key, rawValue] of Object.entries(payload)) {\n if (!key) continue\n\n if (Array.isArray(rawValue)) {\n for (const item of rawValue) {\n const converted = toQueryValue(item)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n continue\n }\n\n const converted = toQueryValue(rawValue)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n\n const searchParams = new URLSearchParams()\n for (const [key, rawValue] of Object.entries(query)) {\n if (Array.isArray(rawValue)) {\n for (const value of rawValue) {\n searchParams.append(key, value)\n }\n continue\n }\n\n searchParams.append(key, rawValue)\n }\n\n const matchPath = url.pathname\n const requestUrl = `${matchPath}${searchParams.toString() ? `?${searchParams.toString()}` : \"\"}`\n\n return { matchPath, requestUrl, query }\n }\n\n const createMethod = (method: string) => {\n return async <TResponse = Record<string, unknown>>(\n path: string,\n payload: Record<string, unknown>,\n ctx?: Ctx,\n ): Promise<TResponse> => {\n if (!ctx) {\n throw new Error(\"Context must be provided in SSR mode\")\n }\n\n const normalizedMethod = method.toLowerCase()\n\n if (normalizedMethod === \"get\") {\n const { matchPath, requestUrl, query } = buildQuery(path, payload)\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: {}, query }, ctx.res)\n }\n\n const { matchPath, requestUrl, query } = buildQuery(path, {})\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: payload, query }, ctx.res)\n }\n }\n\n const apiClient = {\n get: createMethod(\"get\"),\n post: createMethod(\"post\"),\n put: createMethod(\"put\"),\n delete: createMethod(\"delete\")\n }\n\n return apiClient\n}\n\nexport default getServerApiClient\n"],"names":["app","converted","matchPath","requestUrl","query"],"mappings":"AAOO,MAAM,qBAAqB,OAAM,QAAqB;AAC3D,QAAM,YAAY,OAChBA,MACA,QACA,WACA,YACA,KACA,QACuB;AACvB,WAAO,IAAI,QAAQ,CAAC,SAAS,WAA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qBAAqB,OAAO;AAC9B,cAAM,EAAE,WAAAC,YAAW,YAAAC,aAAY,OAAAC,WAAU,WAAW,MAAM,OAAO;AACjE,eAAO,UAAqB,KAAK,QAAQF,YAAWC,aAAY,EAAE,GAAG,IAAI,KAAK,MAAM,CAAA,GAAI,OAAAC,OAAAA,GAAS,IAAI,GAAG;AAAA,MAC1G;AAEA,YAAM,EAAE,WAAW,YAAY,MAAA,IAAU,WAAW,MAAM,EAAE;AAC5D,aAAO,UAAqB,KAAK,QAAQ,WAAW,YAAY,EAAE,GAAG,IAAI,KAAK,MAAM,SAAS,MAAA,GAAS,IAAI,GAAG;AAAA,IAC/G;AAAA,EACF;AAEA,QAAM,YAAY;AAAA,IAChB,KAAK,aAAa,KAAK;AAAA,IACvB,MAAM,aAAa,MAAM;AAAA,IACzB,KAAK,aAAa,KAAK;AAAA,IACvB,QAAQ,aAAa,QAAQ;AAAA,EAAA;AAG/B,SAAO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useThrottledMeasure.d.ts","sourceRoot":"","sources":["../../src/hooks/useThrottledMeasure.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAA;AA+B3H,eAAO,MAAM,mBAAmB,GAAI,yBAAwC,mBAvB7C,WAAW,GAAG,IAAI,aA2DhD,CAAA"}
1
+ {"version":3,"file":"useThrottledMeasure.d.ts","sourceRoot":"","sources":["../../src/hooks/useThrottledMeasure.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAA;AA+B3H,eAAO,MAAM,mBAAmB,GAAI,yBAAwC,mBAzB7C,WAAW,GAAG,IAAI,aA8DhD,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useSyncExternalStore, lazy, useEffect, Suspense, StrictMode, useState, useRef, useCallback, useLayoutEffect, createContext, useMemo, useContext } from "react";
2
+ import { useSyncExternalStore, lazy, useEffect, Suspense, StrictMode, useState, useRef, useCallback, useMemo, useLayoutEffect, createContext, useContext } from "react";
3
3
  import env from "@rpcbase/env";
4
4
  import { getNavigationGuards, createRoutesFromElements, createBrowserRouter, RouterProvider, useLocation, useRouteError, isRouteErrorResponse } from "@rpcbase/router";
5
5
  import { hydrateRoot } from "react-dom/client";
@@ -292,7 +292,7 @@ const initApiClient = async (args) => {
292
292
  if (!args) {
293
293
  throw new Error("Server args must be provided in SSR mode");
294
294
  }
295
- const { getServerApiClient } = await import("./getServerApiClient-4RhtHILD.js");
295
+ const { getServerApiClient } = await import("./getServerApiClient-BYu8h5Zd.js");
296
296
  apiClient = await getServerApiClient(args.app);
297
297
  } else {
298
298
  const axios = (await import("axios/dist/browser/axios.cjs")).default;
@@ -2023,12 +2023,11 @@ function createCustomEqual(options = {}) {
2023
2023
  return createIsEqual({ circular, comparator, createState, equals, strict });
2024
2024
  }
2025
2025
  const defaultRect = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
2026
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
2027
2026
  const useLocalMeasure = () => {
2028
2027
  const [node, setNode] = useState(null);
2029
2028
  const ref = useCallback((el) => setNode(el), []);
2030
2029
  const [rect, setRect] = useState(defaultRect);
2031
- useIsomorphicLayoutEffect(() => {
2030
+ useLayoutEffect(() => {
2032
2031
  if (typeof window === "undefined" || typeof ResizeObserver === "undefined") return;
2033
2032
  if (!node) return;
2034
2033
  const observer = new ResizeObserver((entries) => {
@@ -2047,8 +2046,8 @@ const useThrottledMeasure = (throttleDuration = DEFAULT_THROTTLE_TIME) => {
2047
2046
  const hasInitialMeasure = useRef(false);
2048
2047
  const [ref, measuredRect] = useLocalMeasure();
2049
2048
  const [rect, setRect] = useState(() => defaultRect);
2050
- const throttledSetRect = useCallback(
2051
- _throttle(
2049
+ const throttledSetRect = useMemo(
2050
+ () => _throttle(
2052
2051
  (newRect) => {
2053
2052
  setRect((current) => {
2054
2053
  return deepEqual(current, newRect) ? current : newRect;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/hooks/useMediaQuery.ts","../src/toast.tsx","../src/apiClient/index.ts","../src/cleanupURL.ts","../src/navigationGuard/installGlobalNavigationGuard.ts","../src/ssrErrorState.ts","../src/components/SsrErrorFallback.tsx","../src/initWithRoutes.tsx","../../../node_modules/lodash/_arrayReduce.js","../../../node_modules/lodash/_basePropertyOf.js","../../../node_modules/lodash/_deburrLetter.js","../../../node_modules/lodash/_freeGlobal.js","../../../node_modules/lodash/_root.js","../../../node_modules/lodash/_Symbol.js","../../../node_modules/lodash/_arrayMap.js","../../../node_modules/lodash/isArray.js","../../../node_modules/lodash/_getRawTag.js","../../../node_modules/lodash/_objectToString.js","../../../node_modules/lodash/_baseGetTag.js","../../../node_modules/lodash/isObjectLike.js","../../../node_modules/lodash/isSymbol.js","../../../node_modules/lodash/_baseToString.js","../../../node_modules/lodash/toString.js","../../../node_modules/lodash/deburr.js","../../../node_modules/lodash/_asciiWords.js","../../../node_modules/lodash/_hasUnicodeWord.js","../../../node_modules/lodash/_unicodeWords.js","../../../node_modules/lodash/words.js","../../../node_modules/lodash/_createCompounder.js","../../../node_modules/lodash/snakeCase.js","../src/getFeatureFlag.ts","../src/utils/useApplyScroll.ts","../src/RootProvider/index.tsx","../../../node_modules/lodash/isObject.js","../../../node_modules/lodash/now.js","../../../node_modules/lodash/_trimmedEndIndex.js","../../../node_modules/lodash/_baseTrim.js","../../../node_modules/lodash/toNumber.js","../../../node_modules/lodash/debounce.js","../../../node_modules/lodash/throttle.js","../../../node_modules/fast-equals/dist/es/index.mjs","../src/hooks/useThrottledMeasure.ts","../src/components/RouteErrorBoundary.tsx","../src/notifications.ts","../src/notificationsRealtime.tsx"],"sourcesContent":["import { useSyncExternalStore } from \"react\"\n\n\nconst emptyUnsubscribe = () => {}\n\nexport const useMediaQuery = (query: string): boolean => {\n const isServer = typeof window === \"undefined\"\n\n const subscribe = (callback: () => void) => {\n if (isServer) return emptyUnsubscribe\n\n const mql = window.matchMedia(query)\n\n // Modern browsers\n if (mql.addEventListener) {\n mql.addEventListener(\"change\", callback)\n return () => mql.removeEventListener(\"change\", callback)\n }\n\n // Legacy fallback\n mql.addListener(callback)\n return () => mql.removeListener(callback)\n }\n\n const getSnapshot = () => {\n if (isServer) return false\n return window.matchMedia(query).matches\n }\n\n return useSyncExternalStore(subscribe, getSnapshot, () => false)\n}\n","import { lazy, Suspense, useEffect, useSyncExternalStore } from \"react\"\n\nimport { useMediaQuery } from \"./hooks/useMediaQuery\"\n\n\ntype SonnerModule = typeof import(\"sonner\")\ntype SonnerToast = typeof import(\"sonner\").toast\ntype ToastId = string | number\n\nlet sonner: SonnerModule | null = null\nlet sonnerImport: Promise<SonnerModule> | null = null\nconst queued: Array<(m: SonnerModule) => void> = []\n\nlet toasterRequested = false\nconst toasterListeners = new Set<() => void>()\nlet toasterMounted = false\nlet toasterPreloadStarted = false\n\nlet idCounter = 0\nconst createToastId = (): string => `rb-toast-${++idCounter}`\n\nconst resolveId = (id: unknown): ToastId | undefined => {\n if (typeof id === \"number\") return id\n if (typeof id === \"string\" && id.length > 0) return id\n return undefined\n}\n\nconst requestToasterMount = (): void => {\n if (toasterRequested) return\n toasterRequested = true\n for (const listener of toasterListeners) {\n listener()\n }\n}\n\nconst subscribeToasterRequested = (listener: () => void): (() => void) => {\n toasterListeners.add(listener)\n return () => {\n toasterListeners.delete(listener)\n }\n}\n\nconst getToasterRequested = (): boolean => toasterRequested\n\nconst flushQueue = (): void => {\n if (!sonner) return\n if (typeof document !== \"undefined\" && !toasterMounted) return\n while (queued.length) {\n const fn = queued.shift()\n if (fn) fn(sonner)\n }\n}\n\nconst setToasterMounted = (mounted: boolean): void => {\n toasterMounted = mounted\n if (mounted) flushQueue()\n}\n\nconst loadSonner = (): Promise<SonnerModule> => {\n if (sonner) return Promise.resolve(sonner)\n if (sonnerImport) return sonnerImport\n\n sonnerImport = import(\"sonner\").then((mod) => {\n sonner = mod\n flushQueue()\n return mod\n })\n\n return sonnerImport\n}\n\nconst enqueue = (fn: (mod: SonnerModule) => void): void => {\n if (sonner && (toasterMounted || typeof document === \"undefined\")) {\n fn(sonner)\n return\n }\n\n queued.push(fn)\n}\n\nconst isPageLoaded = (): boolean => {\n if (typeof document === \"undefined\") return false\n return document.readyState === \"complete\"\n}\n\nconst startToaster = (): void => {\n if (toasterPreloadStarted) return\n toasterPreloadStarted = true\n requestToasterMount()\n void loadSonner()\n}\n\nconst ensureReady = (): void => {\n if (typeof document === \"undefined\") startToaster()\n}\n\nconst toastFn = ((message: Parameters<SonnerToast>[0], data?: Parameters<SonnerToast>[1]) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast(message as any, nextData)\n })\n return id as any\n}) as SonnerToast\n\nconst toastSuccess: SonnerToast[\"success\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.success(message as any, nextData)\n })\n return id as any\n}\n\nconst toastInfo: SonnerToast[\"info\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.info(message as any, nextData)\n })\n return id as any\n}\n\nconst toastWarning: SonnerToast[\"warning\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.warning(message as any, nextData)\n })\n return id as any\n}\n\nconst toastError: SonnerToast[\"error\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.error(message as any, nextData)\n })\n return id as any\n}\n\nconst toastMessage: SonnerToast[\"message\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.message(message as any, nextData)\n })\n return id as any\n}\n\nconst toastLoading: SonnerToast[\"loading\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.loading(message as any, nextData)\n })\n return id as any\n}\n\nconst toastCustom: SonnerToast[\"custom\"] = (jsx, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.custom(jsx as any, nextData)\n })\n return id as any\n}\n\nconst toastPromise: SonnerToast[\"promise\"] = (promise, data) => {\n ensureReady()\n if (!data) return undefined as any\n\n const startedPromise = promise instanceof Function ? promise() : promise\n const unwrap = () => Promise.resolve(startedPromise)\n\n if ((data as any).loading === undefined) {\n enqueue((m) => {\n m.toast.promise(startedPromise as any, data as any)\n })\n return { unwrap } as any\n }\n\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = { ...(data as any), id }\n\n enqueue((m) => {\n m.toast.promise(startedPromise as any, nextData)\n })\n\n return Object.assign(id as any, { unwrap }) as any\n}\n\nconst toastDismiss: SonnerToast[\"dismiss\"] = (id?: ToastId) => {\n ensureReady()\n enqueue((m) => {\n m.toast.dismiss(id as any)\n })\n return id as any\n}\n\nconst toastGetHistory: SonnerToast[\"getHistory\"] = () =>\n sonner ? (sonner.toast as any).getHistory() : []\n\nconst toastGetToasts: SonnerToast[\"getToasts\"] = () =>\n sonner ? (sonner.toast as any).getToasts() : []\n\nexport const toast = Object.assign(toastFn, {\n success: toastSuccess,\n info: toastInfo,\n warning: toastWarning,\n error: toastError,\n message: toastMessage,\n loading: toastLoading,\n custom: toastCustom,\n promise: toastPromise,\n dismiss: toastDismiss,\n getHistory: toastGetHistory,\n getToasts: toastGetToasts,\n}) as SonnerToast\n\nconst LazySonnerToaster = lazy(async () => {\n const mod = await import(\"sonner\")\n return { default: mod.Toaster }\n})\n\nconst MountedLazyToaster = (props: any) => {\n useEffect(() => {\n setToasterMounted(true)\n return () => setToasterMounted(false)\n }, [])\n\n return <LazySonnerToaster {...props} />\n}\n\nconst ActiveToaster = () => {\n const isMobile = useMediaQuery(\"(max-width: 767px)\")\n const isCoarsePointer = useMediaQuery(\"(hover: none) and (pointer: coarse)\")\n\n const position = isMobile ? \"top-center\" : undefined\n\n useEffect(() => {\n const handler = (event: Event) => {\n const target = event.target\n if (!(target instanceof Element)) return\n if (!target.closest(\"[data-sonner-toaster]\")) return\n event.preventDefault()\n }\n\n document.addEventListener(\"dismissableLayer.pointerDownOutside\", handler, true)\n document.addEventListener(\"dismissableLayer.focusOutside\", handler, true)\n\n return () => {\n document.removeEventListener(\"dismissableLayer.pointerDownOutside\", handler, true)\n document.removeEventListener(\"dismissableLayer.focusOutside\", handler, true)\n }\n }, [])\n\n return (\n <Suspense fallback={null}>\n <MountedLazyToaster\n closeButton={!isCoarsePointer}\n theme=\"dark\"\n position={position}\n swipeDirections={isCoarsePointer ? undefined : []}\n style={{\n pointerEvents: \"auto\",\n [\"--toast-close-button-start\" as any]: \"unset\",\n [\"--toast-close-button-end\" as any]: \"0\",\n [\"--toast-close-button-transform\" as any]: \"translate(35%, -35%)\",\n }}\n toastOptions={{\n style: {\n pointerEvents: \"auto\",\n userSelect: \"text\",\n },\n }}\n />\n </Suspense>\n )\n}\n\nexport const Toaster = () => {\n useEffect(() => {\n if (typeof window === \"undefined\") return\n\n const startDeferred = () => {\n if (typeof window.requestIdleCallback === \"function\") {\n window.requestIdleCallback(() => startToaster(), { timeout: 2000 })\n return\n }\n\n window.setTimeout(() => startToaster(), 150)\n }\n\n if (isPageLoaded()) {\n startDeferred()\n return\n }\n\n window.addEventListener(\"load\", startDeferred, { once: true })\n\n return () => {\n window.removeEventListener(\"load\", startDeferred)\n }\n }, [])\n\n const requested = useSyncExternalStore(\n subscribeToasterRequested,\n getToasterRequested,\n getToasterRequested,\n )\n\n if (!requested) return null\n\n return <ActiveToaster />\n}\n","import env from \"@rpcbase/env\"\nimport type { Application } from \"express\"\nimport type { Ctx } from \"@rpcbase/api\"\n\n\ntype ServerArgs = {\n app: Application;\n};\n\ntype InitOptions = {\n baseURL?: string;\n};\n\ntype PayloadNotCtx = Record<string, unknown> & {\n [P in keyof Ctx]?: never;\n};\n\ntype ApiClientMethod = <TResponse = Record<string, unknown>>(\n path: string,\n payload: PayloadNotCtx,\n ctx?: Ctx,\n) => Promise<TResponse>;\n\nexport type HttpMethod = \"get\" | \"put\" | \"post\" | \"delete\";\ntype MethodRecord<T> = Record<HttpMethod, T>;\n\nexport type ApiClient = MethodRecord<ApiClientMethod>;\n\nlet apiClient: ApiClient\n\nexport const initApiClient = async (args?: ServerArgs | InitOptions) => {\n if (env.SSR) {\n if (!args) {\n throw new Error(\"Server args must be provided in SSR mode\")\n }\n\n const { getServerApiClient } = await import(\"./getServerApiClient\")\n\n apiClient = await getServerApiClient((args as ServerArgs).app)\n } else {\n // Force the browser build of axios so Vite doesn't try to bundle the\n // Node http adapter (which drags in `follow-redirects` and core modules).\n const axios = (await import(\"axios/dist/browser/axios.cjs\")).default\n\n const axiosClient = axios.create({\n baseURL: args && \"baseURL\" in args ? args?.baseURL ?? \"/\" : \"/\",\n withCredentials: true,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n\n const createMethod = (method: HttpMethod): ApiClientMethod => {\n return async <TResponse = Record<string, unknown>>(\n path: string,\n payload: PayloadNotCtx,\n _ctx?: Ctx,\n ): Promise<TResponse> => {\n const config = {\n method,\n url: path,\n ...(method === \"get\" ? { params: payload } : { data: payload }),\n headers: {\n // ...(typeof ctxOrPath !== 'string' && {\n // // 'X-Custom-Header': ctxOrPath.someHeaderValue,\n // // ...ctxOrPath.additionalHeaders,\n // }),\n },\n }\n\n try {\n const response = await axiosClient(config)\n return response.data\n } catch (error) {\n console.log(\"AXIOS API ERROR\", error)\n throw error\n }\n }\n }\n\n apiClient = {\n get: createMethod(\"get\"),\n put: createMethod(\"put\"),\n post: createMethod(\"post\"),\n delete: createMethod(\"delete\"),\n }\n }\n}\n\nexport { apiClient }\n","import env from \"@rpcbase/env\"\n\n\nconst CLEANUP_WAIT_DELAY = 1000\n\n// Function to clean UTM params while preserving others\nexport const cleanupURL = () => {\n if (env.SSR) {\n return\n }\n\n const runCleanup = () => {\n // Add a small delay before running cleanupURL\n setTimeout(() => {\n const url = new URL(window.location.href)\n const params = new URLSearchParams(url.search)\n\n // Get all current query parameter keys\n const paramKeys = Array.from(params.keys())\n\n // Remove any parameter starting with 'utm_'\n paramKeys.forEach((key) => {\n if (key.startsWith(\"utm_\")) {\n params.delete(key)\n }\n })\n\n // Build the new URL: keep pathname and append remaining query params (if any)\n const cleanUrl =\n url.pathname +\n (params.toString() ? \"?\" + params.toString() : \"\") +\n url.hash\n\n // Update the browser URL without reloading\n window.history.replaceState({}, document.title, cleanUrl)\n }, CLEANUP_WAIT_DELAY)\n }\n\n // If DOM is already loaded, schedule the cleanup\n if (\n document.readyState === \"complete\" ||\n document.readyState === \"interactive\"\n ) {\n runCleanup()\n } else {\n // Otherwise wait for the DOM content to be loaded\n document.addEventListener(\"DOMContentLoaded\", runCleanup, { once: true })\n }\n}\n","import { getNavigationGuards, type DataRouter, type NavigationGuard } from \"@rpcbase/router\"\n\n\nconst DEFAULT_PRIORITY = 0\n\nconst canBlockNavigation = (\n guard: NavigationGuard,\n {\n isPathnameChange,\n isSearchChange,\n }: {\n isPathnameChange: boolean\n isSearchChange: boolean\n },\n): boolean => {\n if (!guard.enabled) return false\n if (isPathnameChange) return true\n if (isSearchChange && guard.blockOnSearch) return true\n return false\n}\n\nconst pickNavigationGuard = (\n args: Parameters<NavigationGuard[\"shouldBlockNavigation\"]>[0],\n): NavigationGuard | null => {\n const isPathnameChange =\n args.currentLocation.pathname !== args.nextLocation.pathname\n const isSearchChange = args.currentLocation.search !== args.nextLocation.search\n\n if (!isPathnameChange && !isSearchChange) {\n return null\n }\n\n const eligibleGuards = getNavigationGuards()\n .filter((guard) => canBlockNavigation(guard, { isPathnameChange, isSearchChange }))\n .filter((guard) => guard.shouldBlockNavigation(args))\n\n if (eligibleGuards.length === 0) {\n return null\n }\n\n return eligibleGuards.reduce<NavigationGuard>((best, guard) => {\n const bestPriority = best.priority ?? DEFAULT_PRIORITY\n const guardPriority = guard.priority ?? DEFAULT_PRIORITY\n return guardPriority > bestPriority ? guard : best\n }, eligibleGuards[0]!)\n}\n\nconst getLocationDedupKey = (location: { key?: string; pathname: string; search: string }): string =>\n location.key ?? `${location.pathname}${location.search}`\n\nconst hasUnloadBlockers = (): boolean =>\n getNavigationGuards().some((guard) => guard.enabled && guard.shouldBlockUnload)\n\ntype NavigationGuardWindowState = {\n suppressBeforeUnloadFromKey: string | null\n nativePromptActive: boolean\n}\n\nconst getWindowState = (): NavigationGuardWindowState | null => {\n if (typeof window === \"undefined\") return null\n\n const key = \"__rpcbaseNavigationGuardWindowState\"\n const globalAny = window as any\n\n if (globalAny[key]) {\n const existing = globalAny[key] as any\n if (typeof existing.suppressBeforeUnloadFromKey === \"undefined\") {\n existing.suppressBeforeUnloadFromKey = null\n }\n return existing as NavigationGuardWindowState\n }\n\n const created: NavigationGuardWindowState = {\n suppressBeforeUnloadFromKey: null,\n nativePromptActive: false,\n }\n globalAny[key] = created\n return created\n}\n\nconst getGlobalGuardWeakSet = (): WeakSet<object> => {\n const key = \"__rpcbaseNavigationGuardInstalledRouters\"\n const globalAny = globalThis as any\n const existing = globalAny[key]\n if (existing && existing instanceof WeakSet) {\n return existing\n }\n const created = new WeakSet<object>()\n globalAny[key] = created\n return created\n}\n\nexport const installGlobalNavigationGuard = (router: DataRouter): void => {\n const installedRouters = getGlobalGuardWeakSet()\n if (installedRouters.has(router as unknown as object)) {\n return\n }\n installedRouters.add(router as unknown as object)\n\n const blockerKey = \"rpcbase:navigation-guards\"\n const windowState = getWindowState()\n\n let lastArgs: Parameters<NavigationGuard[\"shouldBlockNavigation\"]>[0] | null = null\n let lastPromptedLocationKey: string | null = null\n\n router.getBlocker(blockerKey, (args) => {\n lastArgs = args\n if (windowState?.nativePromptActive && args.historyAction !== \"POP\") {\n windowState.nativePromptActive = false\n }\n return pickNavigationGuard(args) !== null\n })\n\n router.subscribe((state) => {\n if (windowState?.suppressBeforeUnloadFromKey && (state as any)?.location) {\n const currentKey = getLocationDedupKey((state as any).location)\n if (currentKey !== windowState.suppressBeforeUnloadFromKey) {\n windowState.suppressBeforeUnloadFromKey = null\n }\n }\n\n const blocker = state.blockers.get(blockerKey)\n\n if (!blocker || blocker.state !== \"blocked\") {\n lastPromptedLocationKey = null\n return\n }\n\n const blockedLocation = blocker.location\n const dedupKey = getLocationDedupKey(blockedLocation)\n if (lastPromptedLocationKey === dedupKey) {\n return\n }\n\n lastPromptedLocationKey = dedupKey\n\n if (windowState?.nativePromptActive && lastArgs?.historyAction === \"POP\") {\n windowState.nativePromptActive = false\n blocker.reset()\n return\n }\n\n const args = lastArgs\n if (!args) {\n blocker.proceed()\n return\n }\n\n const guard = pickNavigationGuard(args)\n if (!guard) {\n blocker.proceed()\n return\n }\n\n const ok = window.confirm(guard.message)\n if (ok) {\n if (windowState) {\n windowState.suppressBeforeUnloadFromKey = getLocationDedupKey(args.currentLocation)\n }\n blocker.proceed()\n } else {\n blocker.reset()\n }\n })\n\n if (typeof window !== \"undefined\") {\n const key = \"__rpcbaseBeforeUnloadNavigationGuardInstalled\"\n const globalAny = window as any\n\n if (!globalAny[key]) {\n globalAny[key] = true\n\n window.addEventListener(\"beforeunload\", (event: BeforeUnloadEvent) => {\n const state = getWindowState()\n if (state && state.suppressBeforeUnloadFromKey) {\n state.suppressBeforeUnloadFromKey = null\n return\n }\n\n if (!hasUnloadBlockers()) {\n return\n }\n\n if (state) {\n state.nativePromptActive = true\n }\n\n event.preventDefault()\n event.returnValue = \"\"\n })\n }\n }\n}\n","export const SSR_ERROR_STATE_GLOBAL_KEY = \"__RPCBASE_SSR_ERROR__\"\n\nexport type SsrErrorStatePayload = {\n statusCode?: number\n title?: string\n message?: string\n details?: string\n}\n\nconst ESCAPED_LT = /</g\nconst ESCAPED_U2028 = /\\u2028/g\nconst ESCAPED_U2029 = /\\u2029/g\n\nexport const serializeSsrErrorState = (state: SsrErrorStatePayload): string =>\n JSON.stringify(state)\n .replace(ESCAPED_LT, \"\\\\u003c\")\n .replace(ESCAPED_U2028, \"\\\\u2028\")\n .replace(ESCAPED_U2029, \"\\\\u2029\")\n\nexport const peekClientSsrErrorState = (): SsrErrorStatePayload | null => {\n if (typeof window === \"undefined\") {\n return null\n }\n const globalScope = window as typeof window & Record<string, unknown>\n const state = globalScope[SSR_ERROR_STATE_GLOBAL_KEY] as SsrErrorStatePayload | undefined\n if (state && typeof state === \"object\") {\n return state\n }\n return null\n}\n\nexport const consumeClientSsrErrorState = (): SsrErrorStatePayload | null => {\n const state = peekClientSsrErrorState()\n if (!state) {\n return null\n }\n if (typeof window !== \"undefined\") {\n delete (window as typeof window & Record<string, unknown>)[SSR_ERROR_STATE_GLOBAL_KEY]\n }\n return state\n}\n","import { ReactNode } from \"react\"\n\nimport { SsrErrorStatePayload } from \"../ssrErrorState\"\n\n\ntype RenderErrorExtra = (state: SsrErrorStatePayload) => ReactNode\n\ntype SsrErrorFallbackProps = {\n state: SsrErrorStatePayload\n renderErrorExtra?: RenderErrorExtra\n}\n\nconst DEFAULT_TITLE = \"Something went wrong\"\nconst DEFAULT_MESSAGE = \"We couldn't render this page. Please try again in a few seconds.\"\n\nexport const SsrErrorFallback = ({ state, renderErrorExtra }: SsrErrorFallbackProps) => {\n const {\n statusCode = 500,\n title = DEFAULT_TITLE,\n message = DEFAULT_MESSAGE,\n details,\n } = state\n\n const extra = renderErrorExtra?.(state)\n\n return (\n <div className=\"bg-white min-h-screen\">\n <main className=\"mx-auto flex min-h-screen max-w-2xl flex-col items-center justify-center px-6 py-12 text-center sm:py-24\">\n <p className=\"text-base font-semibold text-rose-600\">{statusCode}</p>\n <h1 className=\"mt-4 text-pretty text-4xl font-semibold tracking-tight text-gray-900 sm:text-5xl\">\n {title}\n </h1>\n <p className=\"mt-6 text-lg text-gray-600 sm:text-xl/relaxed\">{message}</p>\n\n {details ? (\n <div className=\"mt-10 w-full rounded-2xl bg-gray-900/95 p-5 text-left shadow-2xl\">\n <p className=\"text-sm font-semibold uppercase tracking-wide text-gray-400\">Debug details</p>\n <pre className=\"mt-3 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-gray-100\">\n {details}\n </pre>\n </div>\n ) : null}\n\n {extra ? (\n <div className=\"mt-10 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center\">\n {extra}\n </div>\n ) : null}\n </main>\n </div>\n )\n}\n","import env from \"@rpcbase/env\"\nimport { ReactNode, StrictMode, useEffect, useState } from \"react\"\nimport {createBrowserRouter, createRoutesFromElements, RouterProvider} from \"@rpcbase/router\"\nimport { hydrateRoot } from \"react-dom/client\"\n\nimport { initApiClient } from \"./apiClient\"\nimport {cleanupURL} from \"./cleanupURL\"\nimport { reportClientException } from \"./errorReporting\"\nimport { installGlobalNavigationGuard } from \"./navigationGuard/installGlobalNavigationGuard\"\nimport {\n consumeClientSsrErrorState,\n peekClientSsrErrorState,\n SsrErrorStatePayload,\n} from \"./ssrErrorState\"\nimport { SsrErrorFallback } from \"./components/SsrErrorFallback\"\nimport { Toaster } from \"./toast\"\n\n\nconst isProduction = env.MODE === \"production\"\n\nconst LOADER_TIMEOUT_MS = 8000\n\ntype ReactErrorInfo = { componentStack?: string }\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst showErrorOverlay = (err: { title: string, message: string, reason: string, plugin: string }) => {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\")\n // don't open outside vite environment\n if (!ErrorOverlay) {return}\n console.log(err)\n const overlay = new ErrorOverlay(err)\n document.body.appendChild(overlay)\n}\n\n\nconst handleServerErrors = () => {\n if ((window as any).__staticRouterHydrationData?.errors) {\n\n const {errors} = (window as any).__staticRouterHydrationData\n\n Object.values(errors).forEach((error: any) => {\n showErrorOverlay({\n plugin: \"ssr-router\",\n ...error.reason\n })\n })\n }\n}\n\nconst wrapLoaderWithTimeout = <T extends (...args: any[]) => any>(loader: T, routeId?: string) =>\n async (...args: Parameters<T>): Promise<Awaited<ReturnType<T>>> =>\n new Promise<Awaited<ReturnType<T>>>((resolve, reject) => {\n const timer = setTimeout(() => {\n console.error(\"[rpcbase timeout][client loader]\", {routeId, ms: LOADER_TIMEOUT_MS, url: window.location.href})\n reject(new Response(\"Loader timeout\", {status: 504}))\n }, LOADER_TIMEOUT_MS)\n\n Promise.resolve(loader(...args))\n .then((val) => {\n clearTimeout(timer)\n resolve(val as Awaited<ReturnType<T>>)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n\nconst applyLoaderTimeouts = (routes: any[]): void => {\n routes.forEach((route) => {\n if (route.loader) {\n route.loader = wrapLoaderWithTimeout(route.loader, route.id)\n }\n\n if (route.lazy) {\n const origLazy = route.lazy\n route.lazy = async (...lazyArgs: any[]) => {\n const mod = await origLazy(...lazyArgs)\n if (mod?.loader) {\n const origLoader = mod.loader\n mod.loader = (...loaderArgs: any[]) =>\n wrapLoaderWithTimeout(origLoader as any, route.id)(...loaderArgs)\n }\n return mod\n }\n }\n\n if (route.children) {\n applyLoaderTimeouts(route.children)\n }\n })\n}\n\ntype InitWithRoutesOptions = {\n devThrowsOnHydrationErrors?: boolean\n renderErrorExtra?: (state: SsrErrorStatePayload) => ReactNode\n}\n\ntype RoutesElement = Parameters<typeof createRoutesFromElements>[0]\n\nconst getRootElement = () => {\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error(\"Root element #root not found\")\n }\n return el\n}\n\nconst hydrateSsrFallbackIfPresent = (\n rootElement: HTMLElement,\n renderErrorExtra?: (state: SsrErrorStatePayload) => ReactNode,\n): boolean => {\n const ssrErrorState = peekClientSsrErrorState()\n if (!ssrErrorState) {\n return false\n }\n\n consumeClientSsrErrorState()\n\n hydrateRoot(\n rootElement,\n <StrictMode>\n <SsrErrorFallback state={ssrErrorState} renderErrorExtra={renderErrorExtra} />\n </StrictMode>,\n )\n return true\n}\n\nconst ClientOnly = ({ children }: { children: ReactNode }) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n if (!mounted) return null\n\n return <>{children}</>\n}\n\nexport const initWithRoutes = async (\n routesElement: RoutesElement,\n opts?: InitWithRoutesOptions\n) => {\n\n const rootElement = getRootElement()\n\n if (hydrateSsrFallbackIfPresent(rootElement, opts?.renderErrorExtra)) {\n return\n }\n\n await initApiClient()\n\n cleanupURL()\n\n handleServerErrors()\n\n\n const routes = createRoutesFromElements(routesElement)\n applyLoaderTimeouts(routes)\n const router = createBrowserRouter(routes, {})\n installGlobalNavigationGuard(router)\n\n const toError = (error: unknown): Error =>\n error instanceof Error ? error : new Error(String(error))\n\n const mentionsHydration = (value: unknown, depth = 0): boolean => {\n if (depth > 5) {\n return false\n }\n if (typeof value === \"string\") {\n return value.toLowerCase().includes(\"hydrat\")\n }\n if (value instanceof Error) {\n const digest = (value as { digest?: unknown }).digest\n const cause = (value as { cause?: unknown }).cause\n return (\n mentionsHydration(value.message, depth + 1) ||\n mentionsHydration(digest, depth + 1) ||\n mentionsHydration(cause, depth + 1)\n )\n }\n return false\n }\n\n const reactErrorHandler =\n (reactContext: \"uncaught\" | \"caught\" | \"recoverable\") =>\n (error: unknown, errorInfo?: ReactErrorInfo) => {\n const err = toError(error)\n reportClientException(err, {\n reactContext,\n componentStack: errorInfo?.componentStack,\n })\n if (reactContext === \"uncaught\") {\n console.warn(\"Uncaught error\", err, errorInfo?.componentStack)\n }\n }\n\n const hydrationOptions: Parameters<typeof hydrateRoot>[2] | undefined = isProduction ? {\n onUncaughtError: reactErrorHandler(\"uncaught\"),\n onCaughtError: reactErrorHandler(\"caught\"),\n onRecoverableError: reactErrorHandler(\"recoverable\")\n } : (opts?.devThrowsOnHydrationErrors ? {\n onRecoverableError(error, errorInfo) {\n const err = toError(error)\n if (mentionsHydration(err) || mentionsHydration(errorInfo?.componentStack)) {\n throw err\n }\n // For non-hydration recoverable errors in dev, keep a visible signal.\n console.error(err, errorInfo?.componentStack)\n }\n } : undefined)\n\n\n hydrateRoot(\n rootElement,\n <StrictMode>\n <>\n <RouterProvider router={router} />\n <ClientOnly>\n <Toaster />\n </ClientOnly>\n </>\n </StrictMode>,\n hydrationOptions\n )\n}\n\n// initialize react grab in dev\nif (!isProduction && !env.SSR) {\n import(\"react-grab/core\").then(({ init }) => {\n // eslint-disable-next-line\n const api = init({\n // theme: { hue: 350 }\n })\n })\n}\n","/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n","/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = basePropertyOf;\n","var basePropertyOf = require('./_basePropertyOf');\n\n/** Used to map Latin Unicode letters to basic Latin letters. */\nvar deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n};\n\n/**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\nvar deburrLetter = basePropertyOf(deburredLetters);\n\nmodule.exports = deburrLetter;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var deburrLetter = require('./_deburrLetter'),\n toString = require('./toString');\n\n/** Used to match Latin Unicode letters (excluding mathematical operators). */\nvar reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n/** Used to compose unicode character classes. */\nvar rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;\n\n/** Used to compose unicode capture groups. */\nvar rsCombo = '[' + rsComboRange + ']';\n\n/**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\nvar reComboMark = RegExp(rsCombo, 'g');\n\n/**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\nfunction deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n}\n\nmodule.exports = deburr;\n","/** Used to match words composed of alphanumeric characters. */\nvar reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n/**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction asciiWords(string) {\n return string.match(reAsciiWord) || [];\n}\n\nmodule.exports = asciiWords;\n","/** Used to detect strings that need a more robust regexp to match words. */\nvar reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n/**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\nfunction hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n}\n\nmodule.exports = hasUnicodeWord;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\",\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;\n\n/** Used to match complex or compound words. */\nvar reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n].join('|'), 'g');\n\n/**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n}\n\nmodule.exports = unicodeWords;\n","var asciiWords = require('./_asciiWords'),\n hasUnicodeWord = require('./_hasUnicodeWord'),\n toString = require('./toString'),\n unicodeWords = require('./_unicodeWords');\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n}\n\nmodule.exports = words;\n","var arrayReduce = require('./_arrayReduce'),\n deburr = require('./deburr'),\n words = require('./words');\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\";\n\n/** Used to match apostrophes. */\nvar reApos = RegExp(rsApos, 'g');\n\n/**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\nfunction createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n}\n\nmodule.exports = createCompounder;\n","var createCompounder = require('./_createCompounder');\n\n/**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\nvar snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n});\n\nmodule.exports = snakeCase;\n","import env from \"@rpcbase/env\"\nimport _snakeCase from \"lodash/snakeCase\"\n\n\nexport const getFeatureFlag = async (\n flag: string,\n): Promise<boolean | string | undefined> => {\n const envKey = `RB_PUBLIC_FLAG_${_snakeCase(flag).toUpperCase()}`\n\n if (env.SSR) {\n if (process.env[envKey] !== undefined) {\n return process.env[envKey]\n }\n\n const startTime = performance.now()\n // Use a runtime dynamic import so bundlers building for the browser don't\n // try to include the Node-only `posthog-node` package (it pulls in `fs`,\n // `path`, etc. and breaks client builds).\n const { PostHog } = await (Function(\"return import('posthog-node')\")() as Promise<typeof import(\"posthog-node\")>)\n const client = new PostHog(\n process.env.RB_PUBLIC_POSTHOG_KEY!,\n { host: \"https://eu.i.posthog.com\" },\n )\n\n const distinctId = \"server\"\n console.log(\"TODO: NYI server side feature flags client distinctId\")\n const value = await client.getFeatureFlag(flag, distinctId)\n const endTime = performance.now()\n console.log(`SSR: Feature flag \"${flag}\" loaded in ${(endTime - startTime).toFixed(2)}ms`)\n\n return value\n } else {\n if (import.meta.env[envKey] !== undefined) {\n return import.meta.env[envKey]\n }\n\n const startTime = performance.now()\n const { posthog } = await import(\"posthog-js\")\n\n let hasLoadedFeatureFlags = false\n const TIMEOUT_MS = 8000\n\n function waitForFeatureFlags(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (hasLoadedFeatureFlags) {\n resolve()\n } else {\n const timeout = setTimeout(() => {\n // Bubble up a clear failure instead of hanging indefinitely.\n reject(new Error(`PostHog feature flags did not load within ${TIMEOUT_MS}ms`))\n }, TIMEOUT_MS)\n\n posthog.onFeatureFlags(() => {\n hasLoadedFeatureFlags = true\n clearTimeout(timeout)\n resolve()\n })\n }\n })\n }\n\n await waitForFeatureFlags()\n const endTime = performance.now()\n\n console.log(`Client: Feature flag \"${flag}\" loaded in ${(endTime - startTime).toFixed(2)}ms`)\n\n return posthog.getFeatureFlag(flag)\n }\n}\n","import { useCallback, useEffect, useRef } from \"react\"\nimport { useLocation } from \"@rpcbase/router\"\n\n\nfunction throttle(callback: (...args: any[]) => void, limit: number) {\n let wait = false\n return (...args: any[]) => {\n if (!wait) {\n callback(...args)\n wait = true\n setTimeout(() => {\n wait = false\n }, limit)\n }\n }\n}\n\nexport function useApplyScroll() {\n const location = useLocation()\n const previousPathRef = useRef(location.pathname)\n const isScrollingProgrammatically = useRef(false)\n const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const lastAppliedHashRef = useRef(\"\")\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n lastAppliedHashRef.current = window.location.hash || \"\"\n }\n }, [])\n\n useEffect(() => {\n lastAppliedHashRef.current = location.hash || \"\"\n }, [location.hash])\n\n const replaceHashSilently = useCallback((hash: string) => {\n if (typeof window === \"undefined\") {\n return\n }\n if (lastAppliedHashRef.current === hash) {\n return\n }\n const base = `${window.location.pathname}${window.location.search}`\n window.history.replaceState(window.history.state, \"\", `${base}${hash}`)\n lastAppliedHashRef.current = hash\n }, [])\n\n const markProgrammaticScroll = useCallback(() => {\n isScrollingProgrammatically.current = true\n if (scrollTimeoutRef.current) {\n clearTimeout(scrollTimeoutRef.current)\n }\n scrollTimeoutRef.current = setTimeout(() => {\n isScrollingProgrammatically.current = false\n }, 1000)\n }, [])\n\n useEffect(() => {\n const pathChanged = previousPathRef.current !== location.pathname\n\n if (pathChanged) {\n previousPathRef.current = location.pathname\n\n if (!location.hash) {\n window.scrollTo({ top: 0, left: 0, behavior: \"auto\" })\n return\n }\n\n setTimeout(() => {\n const id = location.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }, 100)\n\n return\n }\n\n if (!location.hash) {\n return\n }\n\n const id = location.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }, [location.hash, location.pathname, markProgrammaticScroll])\n\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const handleScroll = throttle(() => {\n if (isScrollingProgrammatically.current) {\n return\n }\n\n const sections = Array.from(document.querySelectorAll<HTMLElement>(\"section[id]\"))\n\n if (sections.length === 0) {\n replaceHashSilently(\"\")\n return\n }\n\n const scrollPosition = window.scrollY\n const viewportHeight = window.innerHeight\n const checkPoint = scrollPosition + viewportHeight / 3\n\n let activeSectionId: string | null = null\n for (const section of sections) {\n if (\n section.offsetTop <= checkPoint &&\n section.offsetTop + section.offsetHeight > checkPoint\n ) {\n activeSectionId = section.id\n break\n }\n }\n\n const newHash = activeSectionId ? `#${activeSectionId}` : \"\"\n replaceHashSilently(newHash)\n }, 150)\n\n document.addEventListener(\"scroll\", handleScroll)\n return () => {\n document.removeEventListener(\"scroll\", handleScroll)\n if (scrollTimeoutRef.current) {\n clearTimeout(scrollTimeoutRef.current)\n scrollTimeoutRef.current = null\n }\n }\n }, [replaceHashSilently])\n\n useEffect(() => {\n const handleClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement | null\n const link = target?.closest(\"a\")\n const currentHash =\n typeof window !== \"undefined\"\n ? window.location.hash\n : location.hash || \"\"\n\n if (\n !link ||\n !link.hash ||\n link.pathname !== location.pathname ||\n link.hash !== currentHash\n ) {\n return\n }\n\n const id = link.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n event.preventDefault()\n event.stopPropagation()\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }\n\n document.addEventListener(\"click\", handleClick, true)\n return () => document.removeEventListener(\"click\", handleClick, true)\n }, [location.hash, location.pathname, markProgrammaticScroll])\n}\n","import { ReactNode } from \"react\"\n\nimport { useApplyScroll } from \"../utils/useApplyScroll\"\n\n\ntype RootProviderProps = {\n children: ReactNode\n}\n\nexport const RootProvider = ({children}: RootProviderProps) => {\n useApplyScroll()\n\n return <>{children}</>\n}\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","const { getOwnPropertyNames, getOwnPropertySymbols } = Object;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { hasOwnProperty } = Object.prototype;\n/**\n * Combine two comparators into a single comparators.\n */\nfunction combineComparators(comparatorA, comparatorB) {\n return function isEqual(a, b, state) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nfunction createIsCircular(areItemsEqual) {\n return function isCircular(a, b, state) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n const { cache } = state;\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n cache.set(a, b);\n cache.set(b, a);\n const result = areItemsEqual(a, b, state);\n cache.delete(a);\n cache.delete(b);\n return result;\n };\n}\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nfunction getStrictProperties(object) {\n return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));\n}\n/**\n * Whether the object contains the property passed as an own property.\n */\nconst hasOwn = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nObject.hasOwn || ((object, property) => hasOwnProperty.call(object, property));\n\nconst PREACT_VNODE = '__v';\nconst PREACT_OWNER = '__o';\nconst REACT_OWNER = '_owner';\nconst { getOwnPropertyDescriptor, keys } = Object;\n/**\n * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.\n *\n * @note\n * When available in the environment, this is just a re-export of the global\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.\n */\nconst sameValueEqual = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nObject.is\n || function sameValueEqual(a, b) {\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n };\n/**\n * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevaluezero) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`), both are `NaN`, or both\n * are either positive or negative zero.\n */\nfunction sameValueZeroEqual(a, b) {\n return a === b || (a !== a && b !== b);\n}\n/**\n * Whether the values passed are equal based on a\n * [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`).\n *\n * @note\n * This is mainly available as a convenience function, such as being a default when a function to determine equality between\n * two objects is used.\n */\nfunction strictEqual(a, b) {\n return a === b;\n}\n/**\n * Whether the array buffers are equal in value.\n */\nfunction areArrayBuffersEqual(a, b) {\n return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));\n}\n/**\n * Whether the arrays are equal in value.\n */\nfunction areArraysEqual(a, b, state) {\n let index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the dataviews are equal in value.\n */\nfunction areDataViewsEqual(a, b) {\n return (a.byteLength === b.byteLength\n && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)));\n}\n/**\n * Whether the dates passed are equal in value.\n */\nfunction areDatesEqual(a, b) {\n return sameValueEqual(a.getTime(), b.getTime());\n}\n/**\n * Whether the errors passed are equal in value.\n */\nfunction areErrorsEqual(a, b) {\n return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;\n}\n/**\n * Whether the `Map`s are equal in value.\n */\nfunction areMapsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.entries();\n let aResult;\n let bResult;\n let index = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.entries();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (matchedIndices[matchIndex]) {\n matchIndex++;\n continue;\n }\n const aEntry = aResult.value;\n const bEntry = bResult.value;\n if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)\n && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n index++;\n }\n return true;\n}\n/**\n * Whether the objects are equal in value.\n */\nfunction areObjectsEqual(a, b, state) {\n const properties = keys(a);\n let index = properties.length;\n if (keys(b).length !== index) {\n return false;\n }\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isPropertyEqual(a, b, state, properties[index])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nfunction areObjectsEqualStrict(a, b, state) {\n const properties = getStrictProperties(a);\n let index = properties.length;\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n let property;\n let descriptorA;\n let descriptorB;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (!isPropertyEqual(a, b, state, property)) {\n return false;\n }\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n if ((descriptorA || descriptorB)\n && (!descriptorA\n || !descriptorB\n || descriptorA.configurable !== descriptorB.configurable\n || descriptorA.enumerable !== descriptorB.enumerable\n || descriptorA.writable !== descriptorB.writable)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nfunction arePrimitiveWrappersEqual(a, b) {\n return sameValueEqual(a.valueOf(), b.valueOf());\n}\n/**\n * Whether the regexps passed are equal in value.\n */\nfunction areRegExpsEqual(a, b) {\n return a.source === b.source && a.flags === b.flags;\n}\n/**\n * Whether the `Set`s are equal in value.\n */\nfunction areSetsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.values();\n let aResult;\n let bResult;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.values();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (!matchedIndices[matchIndex]\n && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the TypedArray instances are equal in value.\n */\nfunction areTypedArraysEqual(a, b) {\n let index = a.byteLength;\n if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {\n return false;\n }\n while (index-- > 0) {\n if (a[index] !== b[index]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the URL instances are equal in value.\n */\nfunction areUrlsEqual(a, b) {\n return (a.hostname === b.hostname\n && a.pathname === b.pathname\n && a.protocol === b.protocol\n && a.port === b.port\n && a.hash === b.hash\n && a.username === b.username\n && a.password === b.password);\n}\nfunction isPropertyEqual(a, b, state, property) {\n if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)\n && (a.$$typeof || b.$$typeof)) {\n return true;\n }\n return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toString = Object.prototype.toString;\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nfunction createEqualityComparator(config) {\n const supportedComparatorMap = createSupportedComparatorMap(config);\n const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, } = config;\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a, b, state) {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n // If either of the items are nullish and fail the strictly equal check\n // above, then they must be unequal.\n if (a == null || b == null) {\n return false;\n }\n const type = typeof a;\n if (type !== typeof b) {\n return false;\n }\n if (type !== 'object') {\n if (type === 'number' || type === 'bigint') {\n return areNumbersEqual(a, b, state);\n }\n if (type === 'function') {\n return areFunctionsEqual(a, b, state);\n }\n // If a primitive value that is not strictly equal, it must be unequal.\n return false;\n }\n const constructor = a.constructor;\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n // Constructors should match, otherwise there is potential for false positives\n // between class and subclass or custom object and POJO.\n if (constructor !== b.constructor) {\n return false;\n }\n // Try to fast-path equality checks for other complex object types in the\n // same realm to avoid capturing the string tag. Strict equality is used\n // instead of `instanceof` because it is more performant for the common\n // use-case. If someone is creating a subclass from a native class, it will be\n // handled with the string tag comparison.\n if (constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n if (constructor === Array) {\n return areArraysEqual(a, b, state);\n }\n if (constructor === Date) {\n return areDatesEqual(a, b, state);\n }\n if (constructor === RegExp) {\n return areRegExpsEqual(a, b, state);\n }\n if (constructor === Map) {\n return areMapsEqual(a, b, state);\n }\n if (constructor === Set) {\n return areSetsEqual(a, b, state);\n }\n if (constructor === Promise) {\n // Avoid tag checks for promise values, since we know if they are not referentially equal\n // then they are not equal.\n return false;\n }\n // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n // the string tag or doing an `instanceof` in edge cases.\n if (Array.isArray(a)) {\n return areArraysEqual(a, b, state);\n }\n // Since this is a custom object, capture the string tag to determining its type.\n // This is reasonably performant in modern environments like v8 and SpiderMonkey.\n const tag = toString.call(a);\n const supportedComparator = supportedComparatorMap[tag];\n if (supportedComparator) {\n return supportedComparator(a, b, state);\n }\n const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);\n if (unsupportedCustomComparator) {\n return unsupportedCustomComparator(a, b, state);\n }\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n/**\n * Create the configuration object used for building comparators.\n */\nfunction createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {\n let config = {\n areArrayBuffersEqual,\n areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,\n areDataViewsEqual,\n areDatesEqual: areDatesEqual,\n areErrorsEqual: areErrorsEqual,\n areFunctionsEqual: strictEqual,\n areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,\n areNumbersEqual: sameValueEqual,\n areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,\n areRegExpsEqual: areRegExpsEqual,\n areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,\n areTypedArraysEqual: strict\n ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)\n : areTypedArraysEqual,\n areUrlsEqual: areUrlsEqual,\n getUnsupportedCustomComparator: undefined,\n };\n if (createCustomConfig) {\n config = Object.assign({}, config, createCustomConfig(config));\n }\n if (circular) {\n const areArraysEqual = createIsCircular(config.areArraysEqual);\n const areMapsEqual = createIsCircular(config.areMapsEqual);\n const areObjectsEqual = createIsCircular(config.areObjectsEqual);\n const areSetsEqual = createIsCircular(config.areSetsEqual);\n config = Object.assign({}, config, {\n areArraysEqual,\n areMapsEqual,\n areObjectsEqual,\n areSetsEqual,\n });\n }\n return config;\n}\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nfunction createInternalEqualityComparator(compare) {\n return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {\n return compare(a, b, state);\n };\n}\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nfunction createIsEqual({ circular, comparator, createState, equals, strict }) {\n if (createState) {\n return function isEqual(a, b) {\n const { cache = circular ? new WeakMap() : undefined, meta } = createState();\n return comparator(a, b, {\n cache,\n equals,\n meta,\n strict,\n });\n };\n }\n if (circular) {\n return function isEqual(a, b) {\n return comparator(a, b, {\n cache: new WeakMap(),\n equals,\n meta: undefined,\n strict,\n });\n };\n }\n const state = {\n cache: undefined,\n equals,\n meta: undefined,\n strict,\n };\n return function isEqual(a, b) {\n return comparator(a, b, state);\n };\n}\n/**\n * Create a map of `toString()` values to their respective handlers for `tag`-based lookups.\n */\nfunction createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, }) {\n return {\n '[object Arguments]': areObjectsEqual,\n '[object Array]': areArraysEqual,\n '[object ArrayBuffer]': areArrayBuffersEqual,\n '[object AsyncGeneratorFunction]': areFunctionsEqual,\n '[object BigInt]': areNumbersEqual,\n '[object BigInt64Array]': areTypedArraysEqual,\n '[object BigUint64Array]': areTypedArraysEqual,\n '[object Boolean]': arePrimitiveWrappersEqual,\n '[object DataView]': areDataViewsEqual,\n '[object Date]': areDatesEqual,\n // If an error tag, it should be tested explicitly. Like RegExp, the properties are not\n // enumerable, and therefore will give false positives if tested like a standard object.\n '[object Error]': areErrorsEqual,\n '[object Float16Array]': areTypedArraysEqual,\n '[object Float32Array]': areTypedArraysEqual,\n '[object Float64Array]': areTypedArraysEqual,\n '[object Function]': areFunctionsEqual,\n '[object GeneratorFunction]': areFunctionsEqual,\n '[object Int8Array]': areTypedArraysEqual,\n '[object Int16Array]': areTypedArraysEqual,\n '[object Int32Array]': areTypedArraysEqual,\n '[object Map]': areMapsEqual,\n '[object Number]': arePrimitiveWrappersEqual,\n '[object Object]': (a, b, state) => \n // The exception for value comparison is custom `Promise`-like class instances. These should\n // be treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state),\n // For RegExp, the properties are not enumerable, and therefore will give false positives if\n // tested like a standard object.\n '[object RegExp]': areRegExpsEqual,\n '[object Set]': areSetsEqual,\n '[object String]': arePrimitiveWrappersEqual,\n '[object URL]': areUrlsEqual,\n '[object Uint8Array]': areTypedArraysEqual,\n '[object Uint8ClampedArray]': areTypedArraysEqual,\n '[object Uint16Array]': areTypedArraysEqual,\n '[object Uint32Array]': areTypedArraysEqual,\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nconst deepEqual = createCustomEqual();\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nconst strictDeepEqual = createCustomEqual({ strict: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nconst circularDeepEqual = createCustomEqual({ circular: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nconst shallowEqual = createCustomEqual({\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nconst strictShallowEqual = createCustomEqual({\n strict: true,\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nconst circularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueEqual,\n strict: true,\n});\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nfunction createCustomEqual(options = {}) {\n const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;\n const config = createEqualityComparatorConfig(options);\n const comparator = createEqualityComparator(config);\n const equals = createCustomInternalComparator\n ? createCustomInternalComparator(comparator)\n : createInternalEqualityComparator(comparator);\n return createIsEqual({ circular, comparator, createState, equals, strict });\n}\n\nexport { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictEqual, strictShallowEqual };\n","import {useState, useEffect, useCallback, useLayoutEffect, useRef} from \"react\"\nimport _throttle from \"lodash/throttle\"\nimport { deepEqual } from \"fast-equals\"\n\n\ntype Rect = {x: number, y: number, width: number, height: number, top: number, left: number, bottom: number, right: number}\n\nconst defaultRect: Rect = {x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0}\n\nconst useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect\n\nconst useLocalMeasure = () => {\n const [node, setNode] = useState<HTMLElement | null>(null)\n const ref = useCallback((el: HTMLElement | null) => setNode(el), [])\n const [rect, setRect] = useState<Rect>(defaultRect)\n\n useIsomorphicLayoutEffect(() => {\n if (typeof window === \"undefined\" || typeof ResizeObserver === \"undefined\") return\n if (!node) return\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry?.contentRect) return\n const { x, y, width, height, top, left, bottom, right } = entry.contentRect as DOMRectReadOnly\n setRect({ x, y, width, height, top, left, bottom, right })\n })\n\n observer.observe(node)\n return () => observer.disconnect()\n }, [node])\n\n return [ref, rect] as const\n}\n\nconst DEFAULT_THROTTLE_TIME = 16\n\nexport const useThrottledMeasure = (throttleDuration = DEFAULT_THROTTLE_TIME) => {\n const hasInitialMeasure = useRef(false)\n\n const [ref, measuredRect] = useLocalMeasure()\n const [rect, setRect] = useState(() => defaultRect)\n\n const throttledSetRect = useCallback(\n _throttle(\n (newRect) => {\n setRect((current) => {\n return deepEqual(current, newRect) ? current : newRect\n })\n },\n throttleDuration,\n {leading: true, trailing: true},\n ),\n [throttleDuration],\n )\n\n useEffect(() => {\n if (measuredRect.width > 0 && !hasInitialMeasure.current) {\n hasInitialMeasure.current = true\n setRect((current) => {\n return deepEqual(current, measuredRect) ? current : measuredRect\n })\n return\n }\n\n throttledSetRect(measuredRect)\n\n return () => {\n throttledSetRect.cancel()\n }\n }, [measuredRect, throttledSetRect])\n\n return [ref, rect]\n}\n","import env from \"@rpcbase/env\"\nimport { ReactNode } from \"react\"\nimport { isRouteErrorResponse, useRouteError } from \"@rpcbase/router\"\n\nimport { SsrErrorFallback } from \"./SsrErrorFallback\"\nimport { SsrErrorStatePayload } from \"../ssrErrorState\"\n\n\ntype RenderErrorExtra = (state: SsrErrorStatePayload) => ReactNode\n\ntype RouteErrorBoundaryProps = {\n renderErrorExtra?: RenderErrorExtra\n}\n\nconst defaultState: Required<Pick<SsrErrorStatePayload, \"statusCode\" | \"title\" | \"message\">> = {\n statusCode: 500,\n title: \"Something went wrong\",\n message: \"We couldn't render this route. Please try again shortly.\",\n}\n\nconst toSsrErrorState = (error: unknown): SsrErrorStatePayload => {\n if (isRouteErrorResponse(error)) {\n const data = error.data as { message?: string } | string | undefined\n const message = typeof data === \"string\" ? data : data?.message || defaultState.message\n\n let details: string | undefined\n if (env.DEV && data && typeof data !== \"string\") {\n try {\n details = JSON.stringify(data, null, 2)\n } catch {\n details = undefined\n }\n }\n\n return {\n statusCode: error.status ?? defaultState.statusCode,\n title: error.statusText || defaultState.title,\n message,\n details,\n }\n }\n\n if (error instanceof Error) {\n return {\n statusCode: defaultState.statusCode,\n title: defaultState.title,\n message: error.message || defaultState.message,\n details: import.meta.env.DEV ? error.stack ?? error.message : undefined,\n }\n }\n\n if (typeof error === \"string\") {\n return {\n statusCode: defaultState.statusCode,\n title: defaultState.title,\n message: error,\n }\n }\n\n return defaultState\n}\n\nexport const RouteErrorBoundary = ({ renderErrorExtra }: RouteErrorBoundaryProps) => {\n const routeError = useRouteError()\n const state = toSsrErrorState(routeError)\n\n return (\n <SsrErrorFallback\n state={state}\n renderErrorExtra={renderErrorExtra}\n />\n )\n}\n","import { apiClient } from \"./apiClient\"\n\n\nexport type NotificationItem = {\n id: string\n topic?: string\n title: string\n body?: string\n url?: string\n createdAt: string\n seenAt?: string\n readAt?: string\n archivedAt?: string\n metadata?: Record<string, unknown>\n}\n\nexport type NotificationDigestFrequency = \"off\" | \"daily\" | \"weekly\"\n\nexport type NotificationTopicPreference = {\n topic: string\n inApp: boolean\n emailDigest: boolean\n push: boolean\n}\n\nexport type NotificationSettings = {\n digestFrequency: NotificationDigestFrequency\n topicPreferences: NotificationTopicPreference[]\n lastDigestSentAt?: string\n}\n\nexport type ListNotificationsInput = {\n includeArchived?: boolean\n unreadOnly?: boolean\n limit?: number\n markSeen?: boolean\n}\n\nexport type ListNotificationsResponse = {\n ok: boolean\n error?: string\n notifications?: NotificationItem[]\n unreadCount?: number\n unseenCount?: number\n}\n\nexport const listNotifications = async (input: ListNotificationsInput = {}) => {\n const result = await apiClient.post<ListNotificationsResponse>(\"/api/rb/notifications\", input)\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to load notifications\")\n }\n return {\n notifications: Array.isArray(result.notifications) ? result.notifications : [],\n unreadCount: Number.isFinite(result.unreadCount) ? Math.max(0, Math.floor(result.unreadCount ?? 0)) : 0,\n unseenCount: Number.isFinite(result.unseenCount) ? Math.max(0, Math.floor(result.unseenCount ?? 0)) : 0,\n }\n}\n\nexport const markNotificationRead = async (notificationId: string) => {\n const id = notificationId.trim()\n if (!id) throw new Error(\"notificationId is required\")\n\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\n `/api/rb/notifications/${encodeURIComponent(id)}/read`,\n {},\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to mark notification read\")\n }\n}\n\nexport const archiveNotification = async (notificationId: string) => {\n const id = notificationId.trim()\n if (!id) throw new Error(\"notificationId is required\")\n\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\n `/api/rb/notifications/${encodeURIComponent(id)}/archive`,\n {},\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to archive notification\")\n }\n}\n\nexport const markAllNotificationsRead = async () => {\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\"/api/rb/notifications/mark-all-read\", {})\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to mark all notifications read\")\n }\n}\n\ntype SettingsResponse = {\n ok?: boolean\n error?: string\n settings?: NotificationSettings\n}\n\nexport const getNotificationSettings = async (): Promise<NotificationSettings> => {\n const result = await apiClient.get<SettingsResponse>(\"/api/rb/notifications/settings\", {})\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to load notification settings\")\n }\n\n return result.settings ?? { digestFrequency: \"weekly\", topicPreferences: [] }\n}\n\nexport const updateNotificationSettings = async (\n partial: Partial<Pick<NotificationSettings, \"digestFrequency\" | \"topicPreferences\">>,\n): Promise<NotificationSettings> => {\n const result = await apiClient.put<SettingsResponse>(\"/api/rb/notifications/settings\", partial)\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to update notification settings\")\n }\n return result.settings ?? { digestFrequency: \"weekly\", topicPreferences: [] }\n}\n\nexport const runNotificationDigest = async ({ force = false }: { force?: boolean } = {}) => {\n const result = await apiClient.post<{ ok?: boolean; error?: string; sent?: boolean; skippedReason?: string }>(\n \"/api/rb/notifications/digest/run\",\n { force },\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to run digest\")\n }\n return { sent: result.sent === true, skippedReason: result.skippedReason }\n}\n","import { createContext, useContext, useEffect, useMemo, useRef, type ReactNode } from \"react\"\n\nimport { toast } from \"./toast\"\nimport { useQuery } from \"./rts\"\nimport type { NotificationItem } from \"./notifications\"\n\n\ntype SettingsDoc = {\n _id: string\n userId: string\n topicPreferences?: Array<{\n topic?: string\n inApp?: boolean\n }>\n}\n\ntype NotificationDoc = {\n _id: string\n userId?: string\n topic?: string\n title?: string\n body?: string\n url?: string\n createdAt?: string | Date\n seenAt?: string | Date\n readAt?: string | Date\n archivedAt?: string | Date\n metadata?: Record<string, unknown>\n}\n\nexport type NotificationsRealtimeState = {\n notifications: NotificationItem[]\n unreadCount: number\n unseenCount: number\n loading: boolean\n error: unknown\n}\n\nexport const NotificationsRealtimeContext = createContext<NotificationsRealtimeState | null>(null)\n\nconst toIso = (value: unknown): string | undefined => {\n if (value instanceof Date) return value.toISOString()\n if (typeof value === \"string\") return value\n return undefined\n}\n\nconst toNotificationItem = (doc: NotificationDoc): NotificationItem | null => {\n const id = typeof doc._id === \"string\" ? doc._id : String(doc._id ?? \"\")\n if (!id) return null\n\n return {\n id,\n topic: typeof doc.topic === \"string\" ? doc.topic : undefined,\n title: typeof doc.title === \"string\" ? doc.title : \"\",\n body: typeof doc.body === \"string\" ? doc.body : undefined,\n url: typeof doc.url === \"string\" ? doc.url : undefined,\n createdAt: toIso(doc.createdAt) ?? new Date().toISOString(),\n seenAt: toIso(doc.seenAt),\n readAt: toIso(doc.readAt),\n archivedAt: toIso(doc.archivedAt),\n metadata: typeof doc.metadata === \"object\" && doc.metadata !== null ? doc.metadata : undefined,\n }\n}\n\nconst buildDisabledTopics = (settings: SettingsDoc | null): string[] => {\n const raw = settings?.topicPreferences\n if (!Array.isArray(raw) || raw.length === 0) return []\n\n return raw\n .map((pref) => {\n if (!pref || typeof pref !== \"object\") return null\n const topic = typeof pref.topic === \"string\" ? pref.topic.trim() : \"\"\n if (!topic) return null\n return pref.inApp === false ? topic : null\n })\n .filter((topic): topic is string => Boolean(topic))\n}\n\nexport function NotificationsRealtimeProvider({\n userId,\n limit = 200,\n toastOnNew = true,\n children,\n}: {\n userId?: string\n limit?: number\n toastOnNew?: boolean\n children: ReactNode\n}) {\n const trimmedUserId = typeof userId === \"string\" ? userId.trim() : \"\"\n const canUseRts = Boolean(trimmedUserId)\n\n const settingsQuery = useQuery<SettingsDoc>(\n \"RBNotificationSettings\",\n useMemo(() => (canUseRts ? { userId: trimmedUserId } : {}), [canUseRts, trimmedUserId]),\n useMemo(() => ({ key: \"rb.notifications.settings\", limit: 1, enabled: canUseRts }), [canUseRts]),\n )\n\n const settings = (settingsQuery.data?.[0] ?? null) as SettingsDoc | null\n const disabledTopics = useMemo(() => buildDisabledTopics(settings), [settings])\n\n const query = useMemo(() => {\n if (!canUseRts) return {}\n const base: Record<string, unknown> = {\n userId: trimmedUserId,\n archivedAt: { $exists: false },\n }\n if (disabledTopics.length > 0) {\n base.topic = { $nin: disabledTopics }\n }\n return base\n }, [canUseRts, disabledTopics, trimmedUserId])\n\n const notificationsQuery = useQuery<NotificationDoc>(\n \"RBNotification\",\n query,\n useMemo(() => ({\n key: \"rb.notifications\",\n sort: { createdAt: -1 },\n limit,\n enabled: canUseRts,\n }), [canUseRts, limit]),\n )\n\n const notifications = useMemo(() => {\n const raw = notificationsQuery.data\n if (!Array.isArray(raw)) return []\n return raw\n .map((doc) => toNotificationItem(doc))\n .filter((n): n is NotificationItem => Boolean(n))\n }, [notificationsQuery.data])\n\n const unreadCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.readAt ? 0 : 1), 0), [notifications])\n const unseenCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.seenAt ? 0 : 1), 0), [notifications])\n\n const lastToastIds = useRef<Set<string>>(new Set())\n const hasSeededToastIds = useRef(false)\n const toastStartMs = useRef<number>(Date.now())\n\n useEffect(() => {\n hasSeededToastIds.current = false\n lastToastIds.current = new Set()\n toastStartMs.current = Date.now()\n }, [trimmedUserId])\n\n useEffect(() => {\n if (!toastOnNew) return\n if (!canUseRts) return\n if (notificationsQuery.loading) return\n\n if (!hasSeededToastIds.current) {\n hasSeededToastIds.current = true\n lastToastIds.current = new Set(notifications.map((n) => n.id))\n return\n }\n\n const nextNew = notifications.filter((n) => !lastToastIds.current.has(n.id))\n if (!nextNew.length) return\n\n for (const n of nextNew) {\n lastToastIds.current.add(n.id)\n }\n\n const isTabActive = typeof document !== \"undefined\" && document.visibilityState === \"visible\"\n if (!isTabActive) return\n\n const eligible = nextNew.filter((n) => {\n const createdAtMs = Date.parse(n.createdAt)\n if (!Number.isFinite(createdAtMs)) return true\n return createdAtMs >= toastStartMs.current\n })\n if (!eligible.length) return\n\n if (eligible.length > 3) {\n toast(`${eligible.length} new notifications`, { description: \"Open the notifications drawer to view them.\" })\n return\n }\n\n for (const n of eligible) {\n toast(n.title || \"New notification\", { description: n.body })\n }\n }, [canUseRts, notifications, notificationsQuery.loading, toastOnNew])\n\n const value = useMemo<NotificationsRealtimeState>(() => ({\n notifications,\n unreadCount,\n unseenCount,\n loading: notificationsQuery.loading,\n error: notificationsQuery.error,\n }), [notifications, notificationsQuery.error, notificationsQuery.loading, unreadCount, unseenCount])\n\n return (\n <NotificationsRealtimeContext.Provider value={canUseRts ? value : null}>\n {children}\n </NotificationsRealtimeContext.Provider>\n )\n}\n\nexport const useNotificationsRealtime = (): NotificationsRealtimeState | null => {\n return useContext(NotificationsRealtimeContext)\n}\n"],"names":["jsx","require$$0","global","hasOwnProperty","require$$1","require$$2","require$$3","toString","id","element","throttle","sameValueEqual","areArraysEqual","areDatesEqual","areMapsEqual","areObjectsEqual","areRegExpsEqual","areSetsEqual","areArrayBuffersEqual","areDataViewsEqual","areErrorsEqual","arePrimitiveWrappersEqual","areTypedArraysEqual","areUrlsEqual"],"mappings":";;;;;;;;AAGA,MAAM,mBAAmB,MAAM;AAAC;AAEzB,MAAM,gBAAgB,CAAC,UAA2B;AACvD,QAAM,WAAW,OAAO,WAAW;AAEnC,QAAM,YAAY,CAAC,aAAyB;AAC1C,QAAI,SAAU,QAAO;AAErB,UAAM,MAAM,OAAO,WAAW,KAAK;AAGnC,QAAI,IAAI,kBAAkB;AACxB,UAAI,iBAAiB,UAAU,QAAQ;AACvC,aAAO,MAAM,IAAI,oBAAoB,UAAU,QAAQ;AAAA,IACzD;AAGA,QAAI,YAAY,QAAQ;AACxB,WAAO,MAAM,IAAI,eAAe,QAAQ;AAAA,EAC1C;AAEA,QAAM,cAAc,MAAM;AACxB,QAAI,SAAU,QAAO;AACrB,WAAO,OAAO,WAAW,KAAK,EAAE;AAAA,EAClC;AAEA,SAAO,qBAAqB,WAAW,aAAa,MAAM,KAAK;AACjE;ACrBA,IAAI,SAA8B;AAClC,IAAI,eAA6C;AACjD,MAAM,SAA2C,CAAA;AAEjD,IAAI,mBAAmB;AACvB,MAAM,uCAAuB,IAAA;AAC7B,IAAI,iBAAiB;AACrB,IAAI,wBAAwB;AAE5B,IAAI,YAAY;AAChB,MAAM,gBAAgB,MAAc,YA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BAAoB;AACpF,QAAI,CAAC,YAAa;AAElB,UAAM,WAAW,QAAQ,OAAO,CAAC,MAAM;AACrC,YAAM,cAAc,KAAK,MAAM,EAAE,SAAS;AAC1C,UAAI,CAAC,OAAO,SAAS,WAAW,EAAG,QAAO;AAC1C,aAAO,eAAe,aAAa;AAAA,IACrC,CAAC;AACD,QAAI,CAAC,SAAS,OAAQ;AAEtB,QAAI,SAAS,SAAS,GAAG;AACvB,YAAM,GAAG,SAAS,MAAM,sBAAsB,EAAE,aAAa,+CAA+C;AAC5G;AAAA,IACF;AAEA,eAAW,KAAK,UAAU;AACxB,YAAM,EAAE,SAAS,oBAAoB,EAAE,aAAa,EAAE,MAAM;AAAA,IAC9D;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,mBAAmB,SAAS,UAAU,CAAC;AAErE,QAAM,QAAQ,QAAoC,OAAO;AAAA,IACvD;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,mBAAmB;AAAA,IAC5B,OAAO,mBAAmB;AAAA,EAAA,IACxB,CAAC,eAAe,mBAAmB,OAAO,mBAAmB,SAAS,aAAa,WAAW,CAAC;AAEnG,SACE,oBAAC,6BAA6B,UAA7B,EAAsC,OAAO,YAAY,QAAQ,MAC/D,UACH;AAEJ;AAEO,MAAM,2BAA2B,MAAyC;AAC/E,SAAO,WAAW,4BAA4B;AAChD;","x_google_ignoreList":[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40]}
1
+ {"version":3,"file":"index.js","sources":["../src/hooks/useMediaQuery.ts","../src/toast.tsx","../src/apiClient/index.ts","../src/cleanupURL.ts","../src/navigationGuard/installGlobalNavigationGuard.ts","../src/ssrErrorState.ts","../src/components/SsrErrorFallback.tsx","../src/initWithRoutes.tsx","../../../node_modules/lodash/_arrayReduce.js","../../../node_modules/lodash/_basePropertyOf.js","../../../node_modules/lodash/_deburrLetter.js","../../../node_modules/lodash/_freeGlobal.js","../../../node_modules/lodash/_root.js","../../../node_modules/lodash/_Symbol.js","../../../node_modules/lodash/_arrayMap.js","../../../node_modules/lodash/isArray.js","../../../node_modules/lodash/_getRawTag.js","../../../node_modules/lodash/_objectToString.js","../../../node_modules/lodash/_baseGetTag.js","../../../node_modules/lodash/isObjectLike.js","../../../node_modules/lodash/isSymbol.js","../../../node_modules/lodash/_baseToString.js","../../../node_modules/lodash/toString.js","../../../node_modules/lodash/deburr.js","../../../node_modules/lodash/_asciiWords.js","../../../node_modules/lodash/_hasUnicodeWord.js","../../../node_modules/lodash/_unicodeWords.js","../../../node_modules/lodash/words.js","../../../node_modules/lodash/_createCompounder.js","../../../node_modules/lodash/snakeCase.js","../src/getFeatureFlag.ts","../src/utils/useApplyScroll.ts","../src/RootProvider/index.tsx","../../../node_modules/lodash/isObject.js","../../../node_modules/lodash/now.js","../../../node_modules/lodash/_trimmedEndIndex.js","../../../node_modules/lodash/_baseTrim.js","../../../node_modules/lodash/toNumber.js","../../../node_modules/lodash/debounce.js","../../../node_modules/lodash/throttle.js","../../../node_modules/fast-equals/dist/es/index.mjs","../src/hooks/useThrottledMeasure.ts","../src/components/RouteErrorBoundary.tsx","../src/notifications.ts","../src/notificationsRealtime.tsx"],"sourcesContent":["import { useSyncExternalStore } from \"react\"\n\n\nconst emptyUnsubscribe = () => {}\n\nexport const useMediaQuery = (query: string): boolean => {\n const isServer = typeof window === \"undefined\"\n\n const subscribe = (callback: () => void) => {\n if (isServer) return emptyUnsubscribe\n\n const mql = window.matchMedia(query)\n\n // Modern browsers\n if (mql.addEventListener) {\n mql.addEventListener(\"change\", callback)\n return () => mql.removeEventListener(\"change\", callback)\n }\n\n // Legacy fallback\n mql.addListener(callback)\n return () => mql.removeListener(callback)\n }\n\n const getSnapshot = () => {\n if (isServer) return false\n return window.matchMedia(query).matches\n }\n\n return useSyncExternalStore(subscribe, getSnapshot, () => false)\n}\n","import { lazy, Suspense, useEffect, useSyncExternalStore } from \"react\"\n\nimport { useMediaQuery } from \"./hooks/useMediaQuery\"\n\n\ntype SonnerModule = typeof import(\"sonner\")\ntype SonnerToast = typeof import(\"sonner\").toast\ntype ToastId = string | number\n\nlet sonner: SonnerModule | null = null\nlet sonnerImport: Promise<SonnerModule> | null = null\nconst queued: Array<(m: SonnerModule) => void> = []\n\nlet toasterRequested = false\nconst toasterListeners = new Set<() => void>()\nlet toasterMounted = false\nlet toasterPreloadStarted = false\n\nlet idCounter = 0\nconst createToastId = (): string => `rb-toast-${++idCounter}`\n\nconst resolveId = (id: unknown): ToastId | undefined => {\n if (typeof id === \"number\") return id\n if (typeof id === \"string\" && id.length > 0) return id\n return undefined\n}\n\nconst requestToasterMount = (): void => {\n if (toasterRequested) return\n toasterRequested = true\n for (const listener of toasterListeners) {\n listener()\n }\n}\n\nconst subscribeToasterRequested = (listener: () => void): (() => void) => {\n toasterListeners.add(listener)\n return () => {\n toasterListeners.delete(listener)\n }\n}\n\nconst getToasterRequested = (): boolean => toasterRequested\n\nconst flushQueue = (): void => {\n if (!sonner) return\n if (typeof document !== \"undefined\" && !toasterMounted) return\n while (queued.length) {\n const fn = queued.shift()\n if (fn) fn(sonner)\n }\n}\n\nconst setToasterMounted = (mounted: boolean): void => {\n toasterMounted = mounted\n if (mounted) flushQueue()\n}\n\nconst loadSonner = (): Promise<SonnerModule> => {\n if (sonner) return Promise.resolve(sonner)\n if (sonnerImport) return sonnerImport\n\n sonnerImport = import(\"sonner\").then((mod) => {\n sonner = mod\n flushQueue()\n return mod\n })\n\n return sonnerImport\n}\n\nconst enqueue = (fn: (mod: SonnerModule) => void): void => {\n if (sonner && (toasterMounted || typeof document === \"undefined\")) {\n fn(sonner)\n return\n }\n\n queued.push(fn)\n}\n\nconst isPageLoaded = (): boolean => {\n if (typeof document === \"undefined\") return false\n return document.readyState === \"complete\"\n}\n\nconst startToaster = (): void => {\n if (toasterPreloadStarted) return\n toasterPreloadStarted = true\n requestToasterMount()\n void loadSonner()\n}\n\nconst ensureReady = (): void => {\n if (typeof document === \"undefined\") startToaster()\n}\n\nconst toastFn = ((message: Parameters<SonnerToast>[0], data?: Parameters<SonnerToast>[1]) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast(message as any, nextData)\n })\n return id as any\n}) as SonnerToast\n\nconst toastSuccess: SonnerToast[\"success\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.success(message as any, nextData)\n })\n return id as any\n}\n\nconst toastInfo: SonnerToast[\"info\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.info(message as any, nextData)\n })\n return id as any\n}\n\nconst toastWarning: SonnerToast[\"warning\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.warning(message as any, nextData)\n })\n return id as any\n}\n\nconst toastError: SonnerToast[\"error\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.error(message as any, nextData)\n })\n return id as any\n}\n\nconst toastMessage: SonnerToast[\"message\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.message(message as any, nextData)\n })\n return id as any\n}\n\nconst toastLoading: SonnerToast[\"loading\"] = (message, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.loading(message as any, nextData)\n })\n return id as any\n}\n\nconst toastCustom: SonnerToast[\"custom\"] = (jsx, data) => {\n ensureReady()\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = data ? { ...(data as any), id } : ({ id } as any)\n enqueue((m) => {\n m.toast.custom(jsx as any, nextData)\n })\n return id as any\n}\n\nconst toastPromise: SonnerToast[\"promise\"] = (promise, data) => {\n ensureReady()\n if (!data) return undefined as any\n\n const startedPromise = promise instanceof Function ? promise() : promise\n const unwrap = () => Promise.resolve(startedPromise)\n\n if ((data as any).loading === undefined) {\n enqueue((m) => {\n m.toast.promise(startedPromise as any, data as any)\n })\n return { unwrap } as any\n }\n\n const id = resolveId((data as any)?.id) ?? createToastId()\n const nextData = { ...(data as any), id }\n\n enqueue((m) => {\n m.toast.promise(startedPromise as any, nextData)\n })\n\n return Object.assign(id as any, { unwrap }) as any\n}\n\nconst toastDismiss: SonnerToast[\"dismiss\"] = (id?: ToastId) => {\n ensureReady()\n enqueue((m) => {\n m.toast.dismiss(id as any)\n })\n return id as any\n}\n\nconst toastGetHistory: SonnerToast[\"getHistory\"] = () =>\n sonner ? (sonner.toast as any).getHistory() : []\n\nconst toastGetToasts: SonnerToast[\"getToasts\"] = () =>\n sonner ? (sonner.toast as any).getToasts() : []\n\nexport const toast = Object.assign(toastFn, {\n success: toastSuccess,\n info: toastInfo,\n warning: toastWarning,\n error: toastError,\n message: toastMessage,\n loading: toastLoading,\n custom: toastCustom,\n promise: toastPromise,\n dismiss: toastDismiss,\n getHistory: toastGetHistory,\n getToasts: toastGetToasts,\n}) as SonnerToast\n\nconst LazySonnerToaster = lazy(async () => {\n const mod = await import(\"sonner\")\n return { default: mod.Toaster }\n})\n\nconst MountedLazyToaster = (props: any) => {\n useEffect(() => {\n setToasterMounted(true)\n return () => setToasterMounted(false)\n }, [])\n\n return <LazySonnerToaster {...props} />\n}\n\nconst ActiveToaster = () => {\n const isMobile = useMediaQuery(\"(max-width: 767px)\")\n const isCoarsePointer = useMediaQuery(\"(hover: none) and (pointer: coarse)\")\n\n const position = isMobile ? \"top-center\" : undefined\n\n useEffect(() => {\n const handler = (event: Event) => {\n const target = event.target\n if (!(target instanceof Element)) return\n if (!target.closest(\"[data-sonner-toaster]\")) return\n event.preventDefault()\n }\n\n document.addEventListener(\"dismissableLayer.pointerDownOutside\", handler, true)\n document.addEventListener(\"dismissableLayer.focusOutside\", handler, true)\n\n return () => {\n document.removeEventListener(\"dismissableLayer.pointerDownOutside\", handler, true)\n document.removeEventListener(\"dismissableLayer.focusOutside\", handler, true)\n }\n }, [])\n\n return (\n <Suspense fallback={null}>\n <MountedLazyToaster\n closeButton={!isCoarsePointer}\n theme=\"dark\"\n position={position}\n swipeDirections={isCoarsePointer ? undefined : []}\n style={{\n pointerEvents: \"auto\",\n [\"--toast-close-button-start\" as any]: \"unset\",\n [\"--toast-close-button-end\" as any]: \"0\",\n [\"--toast-close-button-transform\" as any]: \"translate(35%, -35%)\",\n }}\n toastOptions={{\n style: {\n pointerEvents: \"auto\",\n userSelect: \"text\",\n },\n }}\n />\n </Suspense>\n )\n}\n\nexport const Toaster = () => {\n useEffect(() => {\n if (typeof window === \"undefined\") return\n\n const startDeferred = () => {\n if (typeof window.requestIdleCallback === \"function\") {\n window.requestIdleCallback(() => startToaster(), { timeout: 2000 })\n return\n }\n\n window.setTimeout(() => startToaster(), 150)\n }\n\n if (isPageLoaded()) {\n startDeferred()\n return\n }\n\n window.addEventListener(\"load\", startDeferred, { once: true })\n\n return () => {\n window.removeEventListener(\"load\", startDeferred)\n }\n }, [])\n\n const requested = useSyncExternalStore(\n subscribeToasterRequested,\n getToasterRequested,\n getToasterRequested,\n )\n\n if (!requested) return null\n\n return <ActiveToaster />\n}\n","import env from \"@rpcbase/env\"\nimport type { Application } from \"express\"\nimport type { Ctx } from \"@rpcbase/api\"\n\n\ntype ServerArgs = {\n app: Application;\n};\n\ntype InitOptions = {\n baseURL?: string;\n};\n\ntype PayloadNotCtx = Record<string, unknown> & {\n [P in keyof Ctx]?: never;\n};\n\ntype ApiClientMethod = <TResponse = Record<string, unknown>>(\n path: string,\n payload: PayloadNotCtx,\n ctx?: Ctx,\n) => Promise<TResponse>;\n\nexport type HttpMethod = \"get\" | \"put\" | \"post\" | \"delete\";\ntype MethodRecord<T> = Record<HttpMethod, T>;\n\nexport type ApiClient = MethodRecord<ApiClientMethod>;\n\nlet apiClient: ApiClient\n\nexport const initApiClient = async (args?: ServerArgs | InitOptions) => {\n if (env.SSR) {\n if (!args) {\n throw new Error(\"Server args must be provided in SSR mode\")\n }\n\n const { getServerApiClient } = await import(\"./getServerApiClient\")\n\n apiClient = await getServerApiClient((args as ServerArgs).app)\n } else {\n // Force the browser build of axios so Vite doesn't try to bundle the\n // Node http adapter (which drags in `follow-redirects` and core modules).\n const axios = (await import(\"axios/dist/browser/axios.cjs\")).default\n\n const axiosClient = axios.create({\n baseURL: args && \"baseURL\" in args ? args?.baseURL ?? \"/\" : \"/\",\n withCredentials: true,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n\n const createMethod = (method: HttpMethod): ApiClientMethod => {\n return async <TResponse = Record<string, unknown>>(\n path: string,\n payload: PayloadNotCtx,\n _ctx?: Ctx,\n ): Promise<TResponse> => {\n const config = {\n method,\n url: path,\n ...(method === \"get\" ? { params: payload } : { data: payload }),\n headers: {\n // ...(typeof ctxOrPath !== 'string' && {\n // // 'X-Custom-Header': ctxOrPath.someHeaderValue,\n // // ...ctxOrPath.additionalHeaders,\n // }),\n },\n }\n\n try {\n const response = await axiosClient(config)\n return response.data\n } catch (error) {\n console.log(\"AXIOS API ERROR\", error)\n throw error\n }\n }\n }\n\n apiClient = {\n get: createMethod(\"get\"),\n put: createMethod(\"put\"),\n post: createMethod(\"post\"),\n delete: createMethod(\"delete\"),\n }\n }\n}\n\nexport { apiClient }\n","import env from \"@rpcbase/env\"\n\n\nconst CLEANUP_WAIT_DELAY = 1000\n\n// Function to clean UTM params while preserving others\nexport const cleanupURL = () => {\n if (env.SSR) {\n return\n }\n\n const runCleanup = () => {\n // Add a small delay before running cleanupURL\n setTimeout(() => {\n const url = new URL(window.location.href)\n const params = new URLSearchParams(url.search)\n\n // Get all current query parameter keys\n const paramKeys = Array.from(params.keys())\n\n // Remove any parameter starting with 'utm_'\n paramKeys.forEach((key) => {\n if (key.startsWith(\"utm_\")) {\n params.delete(key)\n }\n })\n\n // Build the new URL: keep pathname and append remaining query params (if any)\n const cleanUrl =\n url.pathname +\n (params.toString() ? \"?\" + params.toString() : \"\") +\n url.hash\n\n // Update the browser URL without reloading\n window.history.replaceState({}, document.title, cleanUrl)\n }, CLEANUP_WAIT_DELAY)\n }\n\n // If DOM is already loaded, schedule the cleanup\n if (\n document.readyState === \"complete\" ||\n document.readyState === \"interactive\"\n ) {\n runCleanup()\n } else {\n // Otherwise wait for the DOM content to be loaded\n document.addEventListener(\"DOMContentLoaded\", runCleanup, { once: true })\n }\n}\n","import { getNavigationGuards, type DataRouter, type NavigationGuard } from \"@rpcbase/router\"\n\n\nconst DEFAULT_PRIORITY = 0\n\nconst canBlockNavigation = (\n guard: NavigationGuard,\n {\n isPathnameChange,\n isSearchChange,\n }: {\n isPathnameChange: boolean\n isSearchChange: boolean\n },\n): boolean => {\n if (!guard.enabled) return false\n if (isPathnameChange) return true\n if (isSearchChange && guard.blockOnSearch) return true\n return false\n}\n\nconst pickNavigationGuard = (\n args: Parameters<NavigationGuard[\"shouldBlockNavigation\"]>[0],\n): NavigationGuard | null => {\n const isPathnameChange =\n args.currentLocation.pathname !== args.nextLocation.pathname\n const isSearchChange = args.currentLocation.search !== args.nextLocation.search\n\n if (!isPathnameChange && !isSearchChange) {\n return null\n }\n\n const eligibleGuards = getNavigationGuards()\n .filter((guard) => canBlockNavigation(guard, { isPathnameChange, isSearchChange }))\n .filter((guard) => guard.shouldBlockNavigation(args))\n\n if (eligibleGuards.length === 0) {\n return null\n }\n\n return eligibleGuards.reduce<NavigationGuard>((best, guard) => {\n const bestPriority = best.priority ?? DEFAULT_PRIORITY\n const guardPriority = guard.priority ?? DEFAULT_PRIORITY\n return guardPriority > bestPriority ? guard : best\n }, eligibleGuards[0]!)\n}\n\nconst getLocationDedupKey = (location: { key?: string; pathname: string; search: string }): string =>\n location.key ?? `${location.pathname}${location.search}`\n\nconst hasUnloadBlockers = (): boolean =>\n getNavigationGuards().some((guard) => guard.enabled && guard.shouldBlockUnload)\n\ntype NavigationGuardWindowState = {\n suppressBeforeUnloadFromKey: string | null\n nativePromptActive: boolean\n}\n\nconst getWindowState = (): NavigationGuardWindowState | null => {\n if (typeof window === \"undefined\") return null\n\n const key = \"__rpcbaseNavigationGuardWindowState\"\n const globalAny = window as any\n\n if (globalAny[key]) {\n const existing = globalAny[key] as any\n if (typeof existing.suppressBeforeUnloadFromKey === \"undefined\") {\n existing.suppressBeforeUnloadFromKey = null\n }\n return existing as NavigationGuardWindowState\n }\n\n const created: NavigationGuardWindowState = {\n suppressBeforeUnloadFromKey: null,\n nativePromptActive: false,\n }\n globalAny[key] = created\n return created\n}\n\nconst getGlobalGuardWeakSet = (): WeakSet<object> => {\n const key = \"__rpcbaseNavigationGuardInstalledRouters\"\n const globalAny = globalThis as any\n const existing = globalAny[key]\n if (existing && existing instanceof WeakSet) {\n return existing\n }\n const created = new WeakSet<object>()\n globalAny[key] = created\n return created\n}\n\nexport const installGlobalNavigationGuard = (router: DataRouter): void => {\n const installedRouters = getGlobalGuardWeakSet()\n if (installedRouters.has(router as unknown as object)) {\n return\n }\n installedRouters.add(router as unknown as object)\n\n const blockerKey = \"rpcbase:navigation-guards\"\n const windowState = getWindowState()\n\n let lastArgs: Parameters<NavigationGuard[\"shouldBlockNavigation\"]>[0] | null = null\n let lastPromptedLocationKey: string | null = null\n\n router.getBlocker(blockerKey, (args) => {\n lastArgs = args\n if (windowState?.nativePromptActive && args.historyAction !== \"POP\") {\n windowState.nativePromptActive = false\n }\n return pickNavigationGuard(args) !== null\n })\n\n router.subscribe((state) => {\n if (windowState?.suppressBeforeUnloadFromKey && (state as any)?.location) {\n const currentKey = getLocationDedupKey((state as any).location)\n if (currentKey !== windowState.suppressBeforeUnloadFromKey) {\n windowState.suppressBeforeUnloadFromKey = null\n }\n }\n\n const blocker = state.blockers.get(blockerKey)\n\n if (!blocker || blocker.state !== \"blocked\") {\n lastPromptedLocationKey = null\n return\n }\n\n const blockedLocation = blocker.location\n const dedupKey = getLocationDedupKey(blockedLocation)\n if (lastPromptedLocationKey === dedupKey) {\n return\n }\n\n lastPromptedLocationKey = dedupKey\n\n if (windowState?.nativePromptActive && lastArgs?.historyAction === \"POP\") {\n windowState.nativePromptActive = false\n blocker.reset()\n return\n }\n\n const args = lastArgs\n if (!args) {\n blocker.proceed()\n return\n }\n\n const guard = pickNavigationGuard(args)\n if (!guard) {\n blocker.proceed()\n return\n }\n\n const ok = window.confirm(guard.message)\n if (ok) {\n if (windowState) {\n windowState.suppressBeforeUnloadFromKey = getLocationDedupKey(args.currentLocation)\n }\n blocker.proceed()\n } else {\n blocker.reset()\n }\n })\n\n if (typeof window !== \"undefined\") {\n const key = \"__rpcbaseBeforeUnloadNavigationGuardInstalled\"\n const globalAny = window as any\n\n if (!globalAny[key]) {\n globalAny[key] = true\n\n window.addEventListener(\"beforeunload\", (event: BeforeUnloadEvent) => {\n const state = getWindowState()\n if (state && state.suppressBeforeUnloadFromKey) {\n state.suppressBeforeUnloadFromKey = null\n return\n }\n\n if (!hasUnloadBlockers()) {\n return\n }\n\n if (state) {\n state.nativePromptActive = true\n }\n\n event.preventDefault()\n event.returnValue = \"\"\n })\n }\n }\n}\n","export const SSR_ERROR_STATE_GLOBAL_KEY = \"__RPCBASE_SSR_ERROR__\"\n\nexport type SsrErrorStatePayload = {\n statusCode?: number\n title?: string\n message?: string\n details?: string\n}\n\nconst ESCAPED_LT = /</g\nconst ESCAPED_U2028 = /\\u2028/g\nconst ESCAPED_U2029 = /\\u2029/g\n\nexport const serializeSsrErrorState = (state: SsrErrorStatePayload): string =>\n JSON.stringify(state)\n .replace(ESCAPED_LT, \"\\\\u003c\")\n .replace(ESCAPED_U2028, \"\\\\u2028\")\n .replace(ESCAPED_U2029, \"\\\\u2029\")\n\nexport const peekClientSsrErrorState = (): SsrErrorStatePayload | null => {\n if (typeof window === \"undefined\") {\n return null\n }\n const globalScope = window as typeof window & Record<string, unknown>\n const state = globalScope[SSR_ERROR_STATE_GLOBAL_KEY] as SsrErrorStatePayload | undefined\n if (state && typeof state === \"object\") {\n return state\n }\n return null\n}\n\nexport const consumeClientSsrErrorState = (): SsrErrorStatePayload | null => {\n const state = peekClientSsrErrorState()\n if (!state) {\n return null\n }\n if (typeof window !== \"undefined\") {\n delete (window as typeof window & Record<string, unknown>)[SSR_ERROR_STATE_GLOBAL_KEY]\n }\n return state\n}\n","import { ReactNode } from \"react\"\n\nimport { SsrErrorStatePayload } from \"../ssrErrorState\"\n\n\ntype RenderErrorExtra = (state: SsrErrorStatePayload) => ReactNode\n\ntype SsrErrorFallbackProps = {\n state: SsrErrorStatePayload\n renderErrorExtra?: RenderErrorExtra\n}\n\nconst DEFAULT_TITLE = \"Something went wrong\"\nconst DEFAULT_MESSAGE = \"We couldn't render this page. Please try again in a few seconds.\"\n\nexport const SsrErrorFallback = ({ state, renderErrorExtra }: SsrErrorFallbackProps) => {\n const {\n statusCode = 500,\n title = DEFAULT_TITLE,\n message = DEFAULT_MESSAGE,\n details,\n } = state\n\n const extra = renderErrorExtra?.(state)\n\n return (\n <div className=\"bg-white min-h-screen\">\n <main className=\"mx-auto flex min-h-screen max-w-2xl flex-col items-center justify-center px-6 py-12 text-center sm:py-24\">\n <p className=\"text-base font-semibold text-rose-600\">{statusCode}</p>\n <h1 className=\"mt-4 text-pretty text-4xl font-semibold tracking-tight text-gray-900 sm:text-5xl\">\n {title}\n </h1>\n <p className=\"mt-6 text-lg text-gray-600 sm:text-xl/relaxed\">{message}</p>\n\n {details ? (\n <div className=\"mt-10 w-full rounded-2xl bg-gray-900/95 p-5 text-left shadow-2xl\">\n <p className=\"text-sm font-semibold uppercase tracking-wide text-gray-400\">Debug details</p>\n <pre className=\"mt-3 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-gray-100\">\n {details}\n </pre>\n </div>\n ) : null}\n\n {extra ? (\n <div className=\"mt-10 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center\">\n {extra}\n </div>\n ) : null}\n </main>\n </div>\n )\n}\n","import env from \"@rpcbase/env\"\nimport { ReactNode, StrictMode, useEffect, useState } from \"react\"\nimport {createBrowserRouter, createRoutesFromElements, RouterProvider} from \"@rpcbase/router\"\nimport { hydrateRoot } from \"react-dom/client\"\n\nimport { initApiClient } from \"./apiClient\"\nimport {cleanupURL} from \"./cleanupURL\"\nimport { reportClientException } from \"./errorReporting\"\nimport { installGlobalNavigationGuard } from \"./navigationGuard/installGlobalNavigationGuard\"\nimport {\n consumeClientSsrErrorState,\n peekClientSsrErrorState,\n SsrErrorStatePayload,\n} from \"./ssrErrorState\"\nimport { SsrErrorFallback } from \"./components/SsrErrorFallback\"\nimport { Toaster } from \"./toast\"\n\n\nconst isProduction = env.MODE === \"production\"\n\nconst LOADER_TIMEOUT_MS = 8000\n\ntype ReactErrorInfo = { componentStack?: string }\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst showErrorOverlay = (err: { title: string, message: string, reason: string, plugin: string }) => {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\")\n // don't open outside vite environment\n if (!ErrorOverlay) {return}\n console.log(err)\n const overlay = new ErrorOverlay(err)\n document.body.appendChild(overlay)\n}\n\n\nconst handleServerErrors = () => {\n if ((window as any).__staticRouterHydrationData?.errors) {\n\n const {errors} = (window as any).__staticRouterHydrationData\n\n Object.values(errors).forEach((error: any) => {\n showErrorOverlay({\n plugin: \"ssr-router\",\n ...error.reason\n })\n })\n }\n}\n\nconst wrapLoaderWithTimeout = <T extends (...args: any[]) => any>(loader: T, routeId?: string) =>\n async (...args: Parameters<T>): Promise<Awaited<ReturnType<T>>> =>\n new Promise<Awaited<ReturnType<T>>>((resolve, reject) => {\n const timer = setTimeout(() => {\n console.error(\"[rpcbase timeout][client loader]\", {routeId, ms: LOADER_TIMEOUT_MS, url: window.location.href})\n reject(new Response(\"Loader timeout\", {status: 504}))\n }, LOADER_TIMEOUT_MS)\n\n Promise.resolve(loader(...args))\n .then((val) => {\n clearTimeout(timer)\n resolve(val as Awaited<ReturnType<T>>)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n\nconst applyLoaderTimeouts = (routes: any[]): void => {\n routes.forEach((route) => {\n if (route.loader) {\n route.loader = wrapLoaderWithTimeout(route.loader, route.id)\n }\n\n if (route.lazy) {\n const origLazy = route.lazy\n route.lazy = async (...lazyArgs: any[]) => {\n const mod = await origLazy(...lazyArgs)\n if (mod?.loader) {\n const origLoader = mod.loader\n mod.loader = (...loaderArgs: any[]) =>\n wrapLoaderWithTimeout(origLoader as any, route.id)(...loaderArgs)\n }\n return mod\n }\n }\n\n if (route.children) {\n applyLoaderTimeouts(route.children)\n }\n })\n}\n\ntype InitWithRoutesOptions = {\n devThrowsOnHydrationErrors?: boolean\n renderErrorExtra?: (state: SsrErrorStatePayload) => ReactNode\n}\n\ntype RoutesElement = Parameters<typeof createRoutesFromElements>[0]\n\nconst getRootElement = () => {\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error(\"Root element #root not found\")\n }\n return el\n}\n\nconst hydrateSsrFallbackIfPresent = (\n rootElement: HTMLElement,\n renderErrorExtra?: (state: SsrErrorStatePayload) => ReactNode,\n): boolean => {\n const ssrErrorState = peekClientSsrErrorState()\n if (!ssrErrorState) {\n return false\n }\n\n consumeClientSsrErrorState()\n\n hydrateRoot(\n rootElement,\n <StrictMode>\n <SsrErrorFallback state={ssrErrorState} renderErrorExtra={renderErrorExtra} />\n </StrictMode>,\n )\n return true\n}\n\nconst ClientOnly = ({ children }: { children: ReactNode }) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n if (!mounted) return null\n\n return <>{children}</>\n}\n\nexport const initWithRoutes = async (\n routesElement: RoutesElement,\n opts?: InitWithRoutesOptions\n) => {\n\n const rootElement = getRootElement()\n\n if (hydrateSsrFallbackIfPresent(rootElement, opts?.renderErrorExtra)) {\n return\n }\n\n await initApiClient()\n\n cleanupURL()\n\n handleServerErrors()\n\n\n const routes = createRoutesFromElements(routesElement)\n applyLoaderTimeouts(routes)\n const router = createBrowserRouter(routes, {})\n installGlobalNavigationGuard(router)\n\n const toError = (error: unknown): Error =>\n error instanceof Error ? error : new Error(String(error))\n\n const mentionsHydration = (value: unknown, depth = 0): boolean => {\n if (depth > 5) {\n return false\n }\n if (typeof value === \"string\") {\n return value.toLowerCase().includes(\"hydrat\")\n }\n if (value instanceof Error) {\n const digest = (value as { digest?: unknown }).digest\n const cause = (value as { cause?: unknown }).cause\n return (\n mentionsHydration(value.message, depth + 1) ||\n mentionsHydration(digest, depth + 1) ||\n mentionsHydration(cause, depth + 1)\n )\n }\n return false\n }\n\n const reactErrorHandler =\n (reactContext: \"uncaught\" | \"caught\" | \"recoverable\") =>\n (error: unknown, errorInfo?: ReactErrorInfo) => {\n const err = toError(error)\n reportClientException(err, {\n reactContext,\n componentStack: errorInfo?.componentStack,\n })\n if (reactContext === \"uncaught\") {\n console.warn(\"Uncaught error\", err, errorInfo?.componentStack)\n }\n }\n\n const hydrationOptions: Parameters<typeof hydrateRoot>[2] | undefined = isProduction ? {\n onUncaughtError: reactErrorHandler(\"uncaught\"),\n onCaughtError: reactErrorHandler(\"caught\"),\n onRecoverableError: reactErrorHandler(\"recoverable\")\n } : (opts?.devThrowsOnHydrationErrors ? {\n onRecoverableError(error, errorInfo) {\n const err = toError(error)\n if (mentionsHydration(err) || mentionsHydration(errorInfo?.componentStack)) {\n throw err\n }\n // For non-hydration recoverable errors in dev, keep a visible signal.\n console.error(err, errorInfo?.componentStack)\n }\n } : undefined)\n\n\n hydrateRoot(\n rootElement,\n <StrictMode>\n <>\n <RouterProvider router={router} />\n <ClientOnly>\n <Toaster />\n </ClientOnly>\n </>\n </StrictMode>,\n hydrationOptions\n )\n}\n\n// initialize react grab in dev\nif (!isProduction && !env.SSR) {\n import(\"react-grab/core\").then(({ init }) => {\n // eslint-disable-next-line\n const api = init({\n // theme: { hue: 350 }\n })\n })\n}\n","/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n","/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = basePropertyOf;\n","var basePropertyOf = require('./_basePropertyOf');\n\n/** Used to map Latin Unicode letters to basic Latin letters. */\nvar deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n};\n\n/**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\nvar deburrLetter = basePropertyOf(deburredLetters);\n\nmodule.exports = deburrLetter;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var deburrLetter = require('./_deburrLetter'),\n toString = require('./toString');\n\n/** Used to match Latin Unicode letters (excluding mathematical operators). */\nvar reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n/** Used to compose unicode character classes. */\nvar rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;\n\n/** Used to compose unicode capture groups. */\nvar rsCombo = '[' + rsComboRange + ']';\n\n/**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\nvar reComboMark = RegExp(rsCombo, 'g');\n\n/**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\nfunction deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n}\n\nmodule.exports = deburr;\n","/** Used to match words composed of alphanumeric characters. */\nvar reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n/**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction asciiWords(string) {\n return string.match(reAsciiWord) || [];\n}\n\nmodule.exports = asciiWords;\n","/** Used to detect strings that need a more robust regexp to match words. */\nvar reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n/**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\nfunction hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n}\n\nmodule.exports = hasUnicodeWord;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\",\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;\n\n/** Used to match complex or compound words. */\nvar reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n].join('|'), 'g');\n\n/**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n}\n\nmodule.exports = unicodeWords;\n","var asciiWords = require('./_asciiWords'),\n hasUnicodeWord = require('./_hasUnicodeWord'),\n toString = require('./toString'),\n unicodeWords = require('./_unicodeWords');\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n}\n\nmodule.exports = words;\n","var arrayReduce = require('./_arrayReduce'),\n deburr = require('./deburr'),\n words = require('./words');\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\";\n\n/** Used to match apostrophes. */\nvar reApos = RegExp(rsApos, 'g');\n\n/**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\nfunction createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n}\n\nmodule.exports = createCompounder;\n","var createCompounder = require('./_createCompounder');\n\n/**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\nvar snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n});\n\nmodule.exports = snakeCase;\n","import env from \"@rpcbase/env\"\nimport _snakeCase from \"lodash/snakeCase\"\n\n\nexport const getFeatureFlag = async (\n flag: string,\n): Promise<boolean | string | undefined> => {\n const envKey = `RB_PUBLIC_FLAG_${_snakeCase(flag).toUpperCase()}`\n\n if (env.SSR) {\n if (process.env[envKey] !== undefined) {\n return process.env[envKey]\n }\n\n const startTime = performance.now()\n // Use a runtime dynamic import so bundlers building for the browser don't\n // try to include the Node-only `posthog-node` package (it pulls in `fs`,\n // `path`, etc. and breaks client builds).\n const { PostHog } = await (Function(\"return import('posthog-node')\")() as Promise<typeof import(\"posthog-node\")>)\n const client = new PostHog(\n process.env.RB_PUBLIC_POSTHOG_KEY!,\n { host: \"https://eu.i.posthog.com\" },\n )\n\n const distinctId = \"server\"\n console.log(\"TODO: NYI server side feature flags client distinctId\")\n const value = await client.getFeatureFlag(flag, distinctId)\n const endTime = performance.now()\n console.log(`SSR: Feature flag \"${flag}\" loaded in ${(endTime - startTime).toFixed(2)}ms`)\n\n return value\n } else {\n if (import.meta.env[envKey] !== undefined) {\n return import.meta.env[envKey]\n }\n\n const startTime = performance.now()\n const { posthog } = await import(\"posthog-js\")\n\n let hasLoadedFeatureFlags = false\n const TIMEOUT_MS = 8000\n\n function waitForFeatureFlags(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (hasLoadedFeatureFlags) {\n resolve()\n } else {\n const timeout = setTimeout(() => {\n // Bubble up a clear failure instead of hanging indefinitely.\n reject(new Error(`PostHog feature flags did not load within ${TIMEOUT_MS}ms`))\n }, TIMEOUT_MS)\n\n posthog.onFeatureFlags(() => {\n hasLoadedFeatureFlags = true\n clearTimeout(timeout)\n resolve()\n })\n }\n })\n }\n\n await waitForFeatureFlags()\n const endTime = performance.now()\n\n console.log(`Client: Feature flag \"${flag}\" loaded in ${(endTime - startTime).toFixed(2)}ms`)\n\n return posthog.getFeatureFlag(flag)\n }\n}\n","import { useCallback, useEffect, useRef } from \"react\"\nimport { useLocation } from \"@rpcbase/router\"\n\n\nfunction throttle(callback: (...args: any[]) => void, limit: number) {\n let wait = false\n return (...args: any[]) => {\n if (!wait) {\n callback(...args)\n wait = true\n setTimeout(() => {\n wait = false\n }, limit)\n }\n }\n}\n\nexport function useApplyScroll() {\n const location = useLocation()\n const previousPathRef = useRef(location.pathname)\n const isScrollingProgrammatically = useRef(false)\n const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const lastAppliedHashRef = useRef(\"\")\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n lastAppliedHashRef.current = window.location.hash || \"\"\n }\n }, [])\n\n useEffect(() => {\n lastAppliedHashRef.current = location.hash || \"\"\n }, [location.hash])\n\n const replaceHashSilently = useCallback((hash: string) => {\n if (typeof window === \"undefined\") {\n return\n }\n if (lastAppliedHashRef.current === hash) {\n return\n }\n const base = `${window.location.pathname}${window.location.search}`\n window.history.replaceState(window.history.state, \"\", `${base}${hash}`)\n lastAppliedHashRef.current = hash\n }, [])\n\n const markProgrammaticScroll = useCallback(() => {\n isScrollingProgrammatically.current = true\n if (scrollTimeoutRef.current) {\n clearTimeout(scrollTimeoutRef.current)\n }\n scrollTimeoutRef.current = setTimeout(() => {\n isScrollingProgrammatically.current = false\n }, 1000)\n }, [])\n\n useEffect(() => {\n const pathChanged = previousPathRef.current !== location.pathname\n\n if (pathChanged) {\n previousPathRef.current = location.pathname\n\n if (!location.hash) {\n window.scrollTo({ top: 0, left: 0, behavior: \"auto\" })\n return\n }\n\n setTimeout(() => {\n const id = location.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }, 100)\n\n return\n }\n\n if (!location.hash) {\n return\n }\n\n const id = location.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }, [location.hash, location.pathname, markProgrammaticScroll])\n\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const handleScroll = throttle(() => {\n if (isScrollingProgrammatically.current) {\n return\n }\n\n const sections = Array.from(document.querySelectorAll<HTMLElement>(\"section[id]\"))\n\n if (sections.length === 0) {\n replaceHashSilently(\"\")\n return\n }\n\n const scrollPosition = window.scrollY\n const viewportHeight = window.innerHeight\n const checkPoint = scrollPosition + viewportHeight / 3\n\n let activeSectionId: string | null = null\n for (const section of sections) {\n if (\n section.offsetTop <= checkPoint &&\n section.offsetTop + section.offsetHeight > checkPoint\n ) {\n activeSectionId = section.id\n break\n }\n }\n\n const newHash = activeSectionId ? `#${activeSectionId}` : \"\"\n replaceHashSilently(newHash)\n }, 150)\n\n document.addEventListener(\"scroll\", handleScroll)\n return () => {\n document.removeEventListener(\"scroll\", handleScroll)\n if (scrollTimeoutRef.current) {\n clearTimeout(scrollTimeoutRef.current)\n scrollTimeoutRef.current = null\n }\n }\n }, [replaceHashSilently])\n\n useEffect(() => {\n const handleClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement | null\n const link = target?.closest(\"a\")\n const currentHash =\n typeof window !== \"undefined\"\n ? window.location.hash\n : location.hash || \"\"\n\n if (\n !link ||\n !link.hash ||\n link.pathname !== location.pathname ||\n link.hash !== currentHash\n ) {\n return\n }\n\n const id = link.hash.substring(1)\n const element = document.getElementById(id)\n if (element) {\n event.preventDefault()\n event.stopPropagation()\n markProgrammaticScroll()\n element.scrollIntoView({ behavior: \"smooth\" })\n }\n }\n\n document.addEventListener(\"click\", handleClick, true)\n return () => document.removeEventListener(\"click\", handleClick, true)\n }, [location.hash, location.pathname, markProgrammaticScroll])\n}\n","import { ReactNode } from \"react\"\n\nimport { useApplyScroll } from \"../utils/useApplyScroll\"\n\n\ntype RootProviderProps = {\n children: ReactNode\n}\n\nexport const RootProvider = ({children}: RootProviderProps) => {\n useApplyScroll()\n\n return <>{children}</>\n}\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","const { getOwnPropertyNames, getOwnPropertySymbols } = Object;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { hasOwnProperty } = Object.prototype;\n/**\n * Combine two comparators into a single comparators.\n */\nfunction combineComparators(comparatorA, comparatorB) {\n return function isEqual(a, b, state) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nfunction createIsCircular(areItemsEqual) {\n return function isCircular(a, b, state) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n const { cache } = state;\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n cache.set(a, b);\n cache.set(b, a);\n const result = areItemsEqual(a, b, state);\n cache.delete(a);\n cache.delete(b);\n return result;\n };\n}\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nfunction getStrictProperties(object) {\n return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));\n}\n/**\n * Whether the object contains the property passed as an own property.\n */\nconst hasOwn = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nObject.hasOwn || ((object, property) => hasOwnProperty.call(object, property));\n\nconst PREACT_VNODE = '__v';\nconst PREACT_OWNER = '__o';\nconst REACT_OWNER = '_owner';\nconst { getOwnPropertyDescriptor, keys } = Object;\n/**\n * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.\n *\n * @note\n * When available in the environment, this is just a re-export of the global\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.\n */\nconst sameValueEqual = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nObject.is\n || function sameValueEqual(a, b) {\n return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;\n };\n/**\n * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevaluezero) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`), both are `NaN`, or both\n * are either positive or negative zero.\n */\nfunction sameValueZeroEqual(a, b) {\n return a === b || (a !== a && b !== b);\n}\n/**\n * Whether the values passed are equal based on a\n * [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.\n * Simplified, this maps to if the two values are referentially equal to one another (`a === b`).\n *\n * @note\n * This is mainly available as a convenience function, such as being a default when a function to determine equality between\n * two objects is used.\n */\nfunction strictEqual(a, b) {\n return a === b;\n}\n/**\n * Whether the array buffers are equal in value.\n */\nfunction areArrayBuffersEqual(a, b) {\n return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));\n}\n/**\n * Whether the arrays are equal in value.\n */\nfunction areArraysEqual(a, b, state) {\n let index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the dataviews are equal in value.\n */\nfunction areDataViewsEqual(a, b) {\n return (a.byteLength === b.byteLength\n && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)));\n}\n/**\n * Whether the dates passed are equal in value.\n */\nfunction areDatesEqual(a, b) {\n return sameValueEqual(a.getTime(), b.getTime());\n}\n/**\n * Whether the errors passed are equal in value.\n */\nfunction areErrorsEqual(a, b) {\n return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;\n}\n/**\n * Whether the `Map`s are equal in value.\n */\nfunction areMapsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.entries();\n let aResult;\n let bResult;\n let index = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.entries();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (matchedIndices[matchIndex]) {\n matchIndex++;\n continue;\n }\n const aEntry = aResult.value;\n const bEntry = bResult.value;\n if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)\n && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n index++;\n }\n return true;\n}\n/**\n * Whether the objects are equal in value.\n */\nfunction areObjectsEqual(a, b, state) {\n const properties = keys(a);\n let index = properties.length;\n if (keys(b).length !== index) {\n return false;\n }\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n if (!isPropertyEqual(a, b, state, properties[index])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nfunction areObjectsEqualStrict(a, b, state) {\n const properties = getStrictProperties(a);\n let index = properties.length;\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n let property;\n let descriptorA;\n let descriptorB;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (!isPropertyEqual(a, b, state, property)) {\n return false;\n }\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n if ((descriptorA || descriptorB)\n && (!descriptorA\n || !descriptorB\n || descriptorA.configurable !== descriptorB.configurable\n || descriptorA.enumerable !== descriptorB.enumerable\n || descriptorA.writable !== descriptorB.writable)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nfunction arePrimitiveWrappersEqual(a, b) {\n return sameValueEqual(a.valueOf(), b.valueOf());\n}\n/**\n * Whether the regexps passed are equal in value.\n */\nfunction areRegExpsEqual(a, b) {\n return a.source === b.source && a.flags === b.flags;\n}\n/**\n * Whether the `Set`s are equal in value.\n */\nfunction areSetsEqual(a, b, state) {\n const size = a.size;\n if (size !== b.size) {\n return false;\n }\n if (!size) {\n return true;\n }\n const matchedIndices = new Array(size);\n const aIterable = a.values();\n let aResult;\n let bResult;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n const bIterable = b.values();\n let hasMatch = false;\n let matchIndex = 0;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (!matchedIndices[matchIndex]\n && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {\n hasMatch = matchedIndices[matchIndex] = true;\n break;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the TypedArray instances are equal in value.\n */\nfunction areTypedArraysEqual(a, b) {\n let index = a.byteLength;\n if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {\n return false;\n }\n while (index-- > 0) {\n if (a[index] !== b[index]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the URL instances are equal in value.\n */\nfunction areUrlsEqual(a, b) {\n return (a.hostname === b.hostname\n && a.pathname === b.pathname\n && a.protocol === b.protocol\n && a.port === b.port\n && a.hash === b.hash\n && a.username === b.username\n && a.password === b.password);\n}\nfunction isPropertyEqual(a, b, state, property) {\n if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)\n && (a.$$typeof || b.$$typeof)) {\n return true;\n }\n return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toString = Object.prototype.toString;\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nfunction createEqualityComparator(config) {\n const supportedComparatorMap = createSupportedComparatorMap(config);\n const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, } = config;\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a, b, state) {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n // If either of the items are nullish and fail the strictly equal check\n // above, then they must be unequal.\n if (a == null || b == null) {\n return false;\n }\n const type = typeof a;\n if (type !== typeof b) {\n return false;\n }\n if (type !== 'object') {\n if (type === 'number' || type === 'bigint') {\n return areNumbersEqual(a, b, state);\n }\n if (type === 'function') {\n return areFunctionsEqual(a, b, state);\n }\n // If a primitive value that is not strictly equal, it must be unequal.\n return false;\n }\n const constructor = a.constructor;\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n // Constructors should match, otherwise there is potential for false positives\n // between class and subclass or custom object and POJO.\n if (constructor !== b.constructor) {\n return false;\n }\n // Try to fast-path equality checks for other complex object types in the\n // same realm to avoid capturing the string tag. Strict equality is used\n // instead of `instanceof` because it is more performant for the common\n // use-case. If someone is creating a subclass from a native class, it will be\n // handled with the string tag comparison.\n if (constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n if (constructor === Array) {\n return areArraysEqual(a, b, state);\n }\n if (constructor === Date) {\n return areDatesEqual(a, b, state);\n }\n if (constructor === RegExp) {\n return areRegExpsEqual(a, b, state);\n }\n if (constructor === Map) {\n return areMapsEqual(a, b, state);\n }\n if (constructor === Set) {\n return areSetsEqual(a, b, state);\n }\n if (constructor === Promise) {\n // Avoid tag checks for promise values, since we know if they are not referentially equal\n // then they are not equal.\n return false;\n }\n // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n // the string tag or doing an `instanceof` in edge cases.\n if (Array.isArray(a)) {\n return areArraysEqual(a, b, state);\n }\n // Since this is a custom object, capture the string tag to determining its type.\n // This is reasonably performant in modern environments like v8 and SpiderMonkey.\n const tag = toString.call(a);\n const supportedComparator = supportedComparatorMap[tag];\n if (supportedComparator) {\n return supportedComparator(a, b, state);\n }\n const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);\n if (unsupportedCustomComparator) {\n return unsupportedCustomComparator(a, b, state);\n }\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n/**\n * Create the configuration object used for building comparators.\n */\nfunction createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {\n let config = {\n areArrayBuffersEqual,\n areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,\n areDataViewsEqual,\n areDatesEqual: areDatesEqual,\n areErrorsEqual: areErrorsEqual,\n areFunctionsEqual: strictEqual,\n areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,\n areNumbersEqual: sameValueEqual,\n areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,\n areRegExpsEqual: areRegExpsEqual,\n areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,\n areTypedArraysEqual: strict\n ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)\n : areTypedArraysEqual,\n areUrlsEqual: areUrlsEqual,\n getUnsupportedCustomComparator: undefined,\n };\n if (createCustomConfig) {\n config = Object.assign({}, config, createCustomConfig(config));\n }\n if (circular) {\n const areArraysEqual = createIsCircular(config.areArraysEqual);\n const areMapsEqual = createIsCircular(config.areMapsEqual);\n const areObjectsEqual = createIsCircular(config.areObjectsEqual);\n const areSetsEqual = createIsCircular(config.areSetsEqual);\n config = Object.assign({}, config, {\n areArraysEqual,\n areMapsEqual,\n areObjectsEqual,\n areSetsEqual,\n });\n }\n return config;\n}\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nfunction createInternalEqualityComparator(compare) {\n return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {\n return compare(a, b, state);\n };\n}\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nfunction createIsEqual({ circular, comparator, createState, equals, strict }) {\n if (createState) {\n return function isEqual(a, b) {\n const { cache = circular ? new WeakMap() : undefined, meta } = createState();\n return comparator(a, b, {\n cache,\n equals,\n meta,\n strict,\n });\n };\n }\n if (circular) {\n return function isEqual(a, b) {\n return comparator(a, b, {\n cache: new WeakMap(),\n equals,\n meta: undefined,\n strict,\n });\n };\n }\n const state = {\n cache: undefined,\n equals,\n meta: undefined,\n strict,\n };\n return function isEqual(a, b) {\n return comparator(a, b, state);\n };\n}\n/**\n * Create a map of `toString()` values to their respective handlers for `tag`-based lookups.\n */\nfunction createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, }) {\n return {\n '[object Arguments]': areObjectsEqual,\n '[object Array]': areArraysEqual,\n '[object ArrayBuffer]': areArrayBuffersEqual,\n '[object AsyncGeneratorFunction]': areFunctionsEqual,\n '[object BigInt]': areNumbersEqual,\n '[object BigInt64Array]': areTypedArraysEqual,\n '[object BigUint64Array]': areTypedArraysEqual,\n '[object Boolean]': arePrimitiveWrappersEqual,\n '[object DataView]': areDataViewsEqual,\n '[object Date]': areDatesEqual,\n // If an error tag, it should be tested explicitly. Like RegExp, the properties are not\n // enumerable, and therefore will give false positives if tested like a standard object.\n '[object Error]': areErrorsEqual,\n '[object Float16Array]': areTypedArraysEqual,\n '[object Float32Array]': areTypedArraysEqual,\n '[object Float64Array]': areTypedArraysEqual,\n '[object Function]': areFunctionsEqual,\n '[object GeneratorFunction]': areFunctionsEqual,\n '[object Int8Array]': areTypedArraysEqual,\n '[object Int16Array]': areTypedArraysEqual,\n '[object Int32Array]': areTypedArraysEqual,\n '[object Map]': areMapsEqual,\n '[object Number]': arePrimitiveWrappersEqual,\n '[object Object]': (a, b, state) => \n // The exception for value comparison is custom `Promise`-like class instances. These should\n // be treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state),\n // For RegExp, the properties are not enumerable, and therefore will give false positives if\n // tested like a standard object.\n '[object RegExp]': areRegExpsEqual,\n '[object Set]': areSetsEqual,\n '[object String]': arePrimitiveWrappersEqual,\n '[object URL]': areUrlsEqual,\n '[object Uint8Array]': areTypedArraysEqual,\n '[object Uint8ClampedArray]': areTypedArraysEqual,\n '[object Uint16Array]': areTypedArraysEqual,\n '[object Uint32Array]': areTypedArraysEqual,\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nconst deepEqual = createCustomEqual();\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nconst strictDeepEqual = createCustomEqual({ strict: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nconst circularDeepEqual = createCustomEqual({ circular: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nconst shallowEqual = createCustomEqual({\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nconst strictShallowEqual = createCustomEqual({\n strict: true,\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nconst circularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueEqual,\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nconst strictCircularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: () => sameValueEqual,\n strict: true,\n});\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nfunction createCustomEqual(options = {}) {\n const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;\n const config = createEqualityComparatorConfig(options);\n const comparator = createEqualityComparator(config);\n const equals = createCustomInternalComparator\n ? createCustomInternalComparator(comparator)\n : createInternalEqualityComparator(comparator);\n return createIsEqual({ circular, comparator, createState, equals, strict });\n}\n\nexport { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictEqual, strictShallowEqual };\n","import {useState, useEffect, useCallback, useLayoutEffect, useRef, useMemo} from \"react\"\nimport _throttle from \"lodash/throttle\"\nimport { deepEqual } from \"fast-equals\"\n\n\ntype Rect = {x: number, y: number, width: number, height: number, top: number, left: number, bottom: number, right: number}\n\nconst defaultRect: Rect = {x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0}\n\nconst useLocalMeasure = () => {\n const [node, setNode] = useState<HTMLElement | null>(null)\n const ref = useCallback((el: HTMLElement | null) => setNode(el), [])\n const [rect, setRect] = useState<Rect>(defaultRect)\n\n // React Compiler rejects hook aliasing (useIsomorphicLayoutEffect pattern), so we call\n // useLayoutEffect directly and guard browser-only APIs inside the effect.\n useLayoutEffect(() => {\n if (typeof window === \"undefined\" || typeof ResizeObserver === \"undefined\") return\n if (!node) return\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry?.contentRect) return\n const { x, y, width, height, top, left, bottom, right } = entry.contentRect as DOMRectReadOnly\n setRect({ x, y, width, height, top, left, bottom, right })\n })\n\n observer.observe(node)\n return () => observer.disconnect()\n }, [node])\n\n return [ref, rect] as const\n}\n\nconst DEFAULT_THROTTLE_TIME = 16\n\nexport const useThrottledMeasure = (throttleDuration = DEFAULT_THROTTLE_TIME) => {\n const hasInitialMeasure = useRef(false)\n\n const [ref, measuredRect] = useLocalMeasure()\n const [rect, setRect] = useState(() => defaultRect)\n\n const throttledSetRect = useMemo(\n () =>\n _throttle(\n (newRect: Rect) => {\n setRect((current) => {\n return deepEqual(current, newRect) ? current : newRect\n })\n },\n throttleDuration,\n {leading: true, trailing: true},\n ),\n [throttleDuration],\n )\n\n useEffect(() => {\n if (measuredRect.width > 0 && !hasInitialMeasure.current) {\n hasInitialMeasure.current = true\n setRect((current) => {\n return deepEqual(current, measuredRect) ? current : measuredRect\n })\n return\n }\n\n throttledSetRect(measuredRect)\n\n return () => {\n throttledSetRect.cancel()\n }\n }, [measuredRect, throttledSetRect])\n\n return [ref, rect]\n}\n","import env from \"@rpcbase/env\"\nimport { ReactNode } from \"react\"\nimport { isRouteErrorResponse, useRouteError } from \"@rpcbase/router\"\n\nimport { SsrErrorFallback } from \"./SsrErrorFallback\"\nimport { SsrErrorStatePayload } from \"../ssrErrorState\"\n\n\ntype RenderErrorExtra = (state: SsrErrorStatePayload) => ReactNode\n\ntype RouteErrorBoundaryProps = {\n renderErrorExtra?: RenderErrorExtra\n}\n\nconst defaultState: Required<Pick<SsrErrorStatePayload, \"statusCode\" | \"title\" | \"message\">> = {\n statusCode: 500,\n title: \"Something went wrong\",\n message: \"We couldn't render this route. Please try again shortly.\",\n}\n\nconst toSsrErrorState = (error: unknown): SsrErrorStatePayload => {\n if (isRouteErrorResponse(error)) {\n const data = error.data as { message?: string } | string | undefined\n const message = typeof data === \"string\" ? data : data?.message || defaultState.message\n\n let details: string | undefined\n if (env.DEV && data && typeof data !== \"string\") {\n try {\n details = JSON.stringify(data, null, 2)\n } catch {\n details = undefined\n }\n }\n\n return {\n statusCode: error.status ?? defaultState.statusCode,\n title: error.statusText || defaultState.title,\n message,\n details,\n }\n }\n\n if (error instanceof Error) {\n return {\n statusCode: defaultState.statusCode,\n title: defaultState.title,\n message: error.message || defaultState.message,\n details: import.meta.env.DEV ? error.stack ?? error.message : undefined,\n }\n }\n\n if (typeof error === \"string\") {\n return {\n statusCode: defaultState.statusCode,\n title: defaultState.title,\n message: error,\n }\n }\n\n return defaultState\n}\n\nexport const RouteErrorBoundary = ({ renderErrorExtra }: RouteErrorBoundaryProps) => {\n const routeError = useRouteError()\n const state = toSsrErrorState(routeError)\n\n return (\n <SsrErrorFallback\n state={state}\n renderErrorExtra={renderErrorExtra}\n />\n )\n}\n","import { apiClient } from \"./apiClient\"\n\n\nexport type NotificationItem = {\n id: string\n topic?: string\n title: string\n body?: string\n url?: string\n createdAt: string\n seenAt?: string\n readAt?: string\n archivedAt?: string\n metadata?: Record<string, unknown>\n}\n\nexport type NotificationDigestFrequency = \"off\" | \"daily\" | \"weekly\"\n\nexport type NotificationTopicPreference = {\n topic: string\n inApp: boolean\n emailDigest: boolean\n push: boolean\n}\n\nexport type NotificationSettings = {\n digestFrequency: NotificationDigestFrequency\n topicPreferences: NotificationTopicPreference[]\n lastDigestSentAt?: string\n}\n\nexport type ListNotificationsInput = {\n includeArchived?: boolean\n unreadOnly?: boolean\n limit?: number\n markSeen?: boolean\n}\n\nexport type ListNotificationsResponse = {\n ok: boolean\n error?: string\n notifications?: NotificationItem[]\n unreadCount?: number\n unseenCount?: number\n}\n\nexport const listNotifications = async (input: ListNotificationsInput = {}) => {\n const result = await apiClient.post<ListNotificationsResponse>(\"/api/rb/notifications\", input)\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to load notifications\")\n }\n return {\n notifications: Array.isArray(result.notifications) ? result.notifications : [],\n unreadCount: Number.isFinite(result.unreadCount) ? Math.max(0, Math.floor(result.unreadCount ?? 0)) : 0,\n unseenCount: Number.isFinite(result.unseenCount) ? Math.max(0, Math.floor(result.unseenCount ?? 0)) : 0,\n }\n}\n\nexport const markNotificationRead = async (notificationId: string) => {\n const id = notificationId.trim()\n if (!id) throw new Error(\"notificationId is required\")\n\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\n `/api/rb/notifications/${encodeURIComponent(id)}/read`,\n {},\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to mark notification read\")\n }\n}\n\nexport const archiveNotification = async (notificationId: string) => {\n const id = notificationId.trim()\n if (!id) throw new Error(\"notificationId is required\")\n\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\n `/api/rb/notifications/${encodeURIComponent(id)}/archive`,\n {},\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to archive notification\")\n }\n}\n\nexport const markAllNotificationsRead = async () => {\n const result = await apiClient.post<{ ok?: boolean; error?: string }>(\"/api/rb/notifications/mark-all-read\", {})\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to mark all notifications read\")\n }\n}\n\ntype SettingsResponse = {\n ok?: boolean\n error?: string\n settings?: NotificationSettings\n}\n\nexport const getNotificationSettings = async (): Promise<NotificationSettings> => {\n const result = await apiClient.get<SettingsResponse>(\"/api/rb/notifications/settings\", {})\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to load notification settings\")\n }\n\n return result.settings ?? { digestFrequency: \"weekly\", topicPreferences: [] }\n}\n\nexport const updateNotificationSettings = async (\n partial: Partial<Pick<NotificationSettings, \"digestFrequency\" | \"topicPreferences\">>,\n): Promise<NotificationSettings> => {\n const result = await apiClient.put<SettingsResponse>(\"/api/rb/notifications/settings\", partial)\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to update notification settings\")\n }\n return result.settings ?? { digestFrequency: \"weekly\", topicPreferences: [] }\n}\n\nexport const runNotificationDigest = async ({ force = false }: { force?: boolean } = {}) => {\n const result = await apiClient.post<{ ok?: boolean; error?: string; sent?: boolean; skippedReason?: string }>(\n \"/api/rb/notifications/digest/run\",\n { force },\n )\n if (!result?.ok) {\n throw new Error(result?.error || \"Failed to run digest\")\n }\n return { sent: result.sent === true, skippedReason: result.skippedReason }\n}\n","import { createContext, useContext, useEffect, useMemo, useRef, type ReactNode } from \"react\"\n\nimport { toast } from \"./toast\"\nimport { useQuery } from \"./rts\"\nimport type { NotificationItem } from \"./notifications\"\n\n\ntype SettingsDoc = {\n _id: string\n userId: string\n topicPreferences?: Array<{\n topic?: string\n inApp?: boolean\n }>\n}\n\ntype NotificationDoc = {\n _id: string\n userId?: string\n topic?: string\n title?: string\n body?: string\n url?: string\n createdAt?: string | Date\n seenAt?: string | Date\n readAt?: string | Date\n archivedAt?: string | Date\n metadata?: Record<string, unknown>\n}\n\nexport type NotificationsRealtimeState = {\n notifications: NotificationItem[]\n unreadCount: number\n unseenCount: number\n loading: boolean\n error: unknown\n}\n\nexport const NotificationsRealtimeContext = createContext<NotificationsRealtimeState | null>(null)\n\nconst toIso = (value: unknown): string | undefined => {\n if (value instanceof Date) return value.toISOString()\n if (typeof value === \"string\") return value\n return undefined\n}\n\nconst toNotificationItem = (doc: NotificationDoc): NotificationItem | null => {\n const id = typeof doc._id === \"string\" ? doc._id : String(doc._id ?? \"\")\n if (!id) return null\n\n return {\n id,\n topic: typeof doc.topic === \"string\" ? doc.topic : undefined,\n title: typeof doc.title === \"string\" ? doc.title : \"\",\n body: typeof doc.body === \"string\" ? doc.body : undefined,\n url: typeof doc.url === \"string\" ? doc.url : undefined,\n createdAt: toIso(doc.createdAt) ?? new Date().toISOString(),\n seenAt: toIso(doc.seenAt),\n readAt: toIso(doc.readAt),\n archivedAt: toIso(doc.archivedAt),\n metadata: typeof doc.metadata === \"object\" && doc.metadata !== null ? doc.metadata : undefined,\n }\n}\n\nconst buildDisabledTopics = (settings: SettingsDoc | null): string[] => {\n const raw = settings?.topicPreferences\n if (!Array.isArray(raw) || raw.length === 0) return []\n\n return raw\n .map((pref) => {\n if (!pref || typeof pref !== \"object\") return null\n const topic = typeof pref.topic === \"string\" ? pref.topic.trim() : \"\"\n if (!topic) return null\n return pref.inApp === false ? topic : null\n })\n .filter((topic): topic is string => Boolean(topic))\n}\n\nexport function NotificationsRealtimeProvider({\n userId,\n limit = 200,\n toastOnNew = true,\n children,\n}: {\n userId?: string\n limit?: number\n toastOnNew?: boolean\n children: ReactNode\n}) {\n const trimmedUserId = typeof userId === \"string\" ? userId.trim() : \"\"\n const canUseRts = Boolean(trimmedUserId)\n\n const settingsQuery = useQuery<SettingsDoc>(\n \"RBNotificationSettings\",\n useMemo(() => (canUseRts ? { userId: trimmedUserId } : {}), [canUseRts, trimmedUserId]),\n useMemo(() => ({ key: \"rb.notifications.settings\", limit: 1, enabled: canUseRts }), [canUseRts]),\n )\n\n const settings = (settingsQuery.data?.[0] ?? null) as SettingsDoc | null\n const disabledTopics = useMemo(() => buildDisabledTopics(settings), [settings])\n\n const query = useMemo(() => {\n if (!canUseRts) return {}\n const base: Record<string, unknown> = {\n userId: trimmedUserId,\n archivedAt: { $exists: false },\n }\n if (disabledTopics.length > 0) {\n base.topic = { $nin: disabledTopics }\n }\n return base\n }, [canUseRts, disabledTopics, trimmedUserId])\n\n const notificationsQuery = useQuery<NotificationDoc>(\n \"RBNotification\",\n query,\n useMemo(() => ({\n key: \"rb.notifications\",\n sort: { createdAt: -1 },\n limit,\n enabled: canUseRts,\n }), [canUseRts, limit]),\n )\n\n const notifications = useMemo(() => {\n const raw = notificationsQuery.data\n if (!Array.isArray(raw)) return []\n return raw\n .map((doc) => toNotificationItem(doc))\n .filter((n): n is NotificationItem => Boolean(n))\n }, [notificationsQuery.data])\n\n const unreadCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.readAt ? 0 : 1), 0), [notifications])\n const unseenCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.seenAt ? 0 : 1), 0), [notifications])\n\n const lastToastIds = useRef<Set<string>>(new Set())\n const hasSeededToastIds = useRef(false)\n const toastStartMs = useRef<number>(Date.now())\n\n useEffect(() => {\n hasSeededToastIds.current = false\n lastToastIds.current = new Set()\n toastStartMs.current = Date.now()\n }, [trimmedUserId])\n\n useEffect(() => {\n if (!toastOnNew) return\n if (!canUseRts) return\n if (notificationsQuery.loading) return\n\n if (!hasSeededToastIds.current) {\n hasSeededToastIds.current = true\n lastToastIds.current = new Set(notifications.map((n) => n.id))\n return\n }\n\n const nextNew = notifications.filter((n) => !lastToastIds.current.has(n.id))\n if (!nextNew.length) return\n\n for (const n of nextNew) {\n lastToastIds.current.add(n.id)\n }\n\n const isTabActive = typeof document !== \"undefined\" && document.visibilityState === \"visible\"\n if (!isTabActive) return\n\n const eligible = nextNew.filter((n) => {\n const createdAtMs = Date.parse(n.createdAt)\n if (!Number.isFinite(createdAtMs)) return true\n return createdAtMs >= toastStartMs.current\n })\n if (!eligible.length) return\n\n if (eligible.length > 3) {\n toast(`${eligible.length} new notifications`, { description: \"Open the notifications drawer to view them.\" })\n return\n }\n\n for (const n of eligible) {\n toast(n.title || \"New notification\", { description: n.body })\n }\n }, [canUseRts, notifications, notificationsQuery.loading, toastOnNew])\n\n const value = useMemo<NotificationsRealtimeState>(() => ({\n notifications,\n unreadCount,\n unseenCount,\n loading: notificationsQuery.loading,\n error: notificationsQuery.error,\n }), [notifications, notificationsQuery.error, notificationsQuery.loading, unreadCount, unseenCount])\n\n return (\n <NotificationsRealtimeContext.Provider value={canUseRts ? value : null}>\n {children}\n </NotificationsRealtimeContext.Provider>\n )\n}\n\nexport const useNotificationsRealtime = (): NotificationsRealtimeState | null => {\n return useContext(NotificationsRealtimeContext)\n}\n"],"names":["jsx","require$$0","global","hasOwnProperty","require$$1","require$$2","require$$3","toString","id","element","throttle","sameValueEqual","areArraysEqual","areDatesEqual","areMapsEqual","areObjectsEqual","areRegExpsEqual","areSetsEqual","areArrayBuffersEqual","areDataViewsEqual","areErrorsEqual","arePrimitiveWrappersEqual","areTypedArraysEqual","areUrlsEqual"],"mappings":";;;;;;;;AAGA,MAAM,mBAAmB,MAAM;AAAC;AAEzB,MAAM,gBAAgB,CAAC,UAA2B;AACvD,QAAM,WAAW,OAAO,WAAW;AAEnC,QAAM,YAAY,CAAC,aAAyB;AAC1C,QAAI,SAAU,QAAO;AAErB,UAAM,MAAM,OAAO,WAAW,KAAK;AAGnC,QAAI,IAAI,kBAAkB;AACxB,UAAI,iBAAiB,UAAU,QAAQ;AACvC,aAAO,MAAM,IAAI,oBAAoB,UAAU,QAAQ;AAAA,IACzD;AAGA,Q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8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,33,34,35,36,37,38,39,40]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.372.0",
3
+ "version": "0.374.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1 +0,0 @@
1
- {"version":3,"file":"getServerApiClient-4RhtHILD.js","sources":["../src/apiClient/getServerApiClient.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Application, IRouter, Request, Response } from \"express\"\n\n// import { Ctx } from \"@rpcbase/api\"\ntype Ctx = any\n\n\nexport const getServerApiClient = async(app: Application) => {\n const callRoute = async <TResponse = Record<string, unknown>>(\n app: Application,\n method: string,\n matchPath: string,\n requestUrl: string,\n req: Partial<Request>,\n res: Partial<Response>\n ): Promise<TResponse> => {\n return new Promise((resolve, reject) => {\n let isEnded = false\n\n const mockReq = {\n ...req,\n method: method.toUpperCase(),\n url: requestUrl\n } as Request\n\n const mockRes = {\n ...res,\n json: (data: any) => {\n if (!isEnded) {\n isEnded = true\n resolve(data)\n }\n },\n status: (statusCode: number) => {\n console.log(\"Status:\", statusCode, mockReq.method, mockReq.url)\n return mockRes\n },\n } as Response\n\n const routerStack: any[] = (app.router as unknown as IRouter).stack\n\n const firstApiMiddlewareIndex = routerStack.findIndex((layer) => layer.name === \"__FIRST_API_MIDDLEWARE__\")\n if (!(firstApiMiddlewareIndex > -1)) {\n throw new Error(\"middleware: __FIRST_API_MIDDLEWARE__ was not found in stack\")\n }\n\n const apiStack = routerStack.slice(firstApiMiddlewareIndex + 1)\n\n const processLayer = async (index: number) => {\n if (index >= apiStack.length || isEnded) return\n\n const layer = apiStack[index]\n\n const isNonMatchingLayer = !layer.match(matchPath)\n if (isNonMatchingLayer) {\n // console.log(\"not machthing route:\", matchPath, \"to layer:\", index, layer.name, layer, \"reason: \", {isNonMatchingLayer})\n await processLayer(index + 1)\n return\n }\n\n const runHandler = async(handler: any) => new Promise<void>((resolveMiddleware, rejectMiddleware) => {\n handler(mockReq, mockRes, (err?: any) => {\n if (err) {\n console.error(\"Middleware error:\", err)\n if (!isEnded) {\n isEnded = true\n rejectMiddleware(err)\n }\n return\n }\n resolveMiddleware()\n })\n })\n\n if (layer.route) {\n if (!layer.route.methods[method.toLowerCase()]) {\n // console.log(\"not machthing route:\", matchPath, \"to route layer:\", index, layer.name, layer, \"reason: method not matching\")\n await processLayer(index + 1)\n return\n }\n\n if (layer.route.stack.length !== 1) {\n throw new Error(`expected only one handler per route for route: ${layer.route.path}`)\n }\n\n await runHandler(layer.route.stack[0].handle)\n\n } else {\n await runHandler(layer.handle)\n }\n\n if (!isEnded) {\n await processLayer(index + 1)\n }\n }\n\n // AWAIT ??\n processLayer(0)\n\n // Set a timeout to prevent hanging\n setTimeout(() => {\n if (!isEnded) {\n reject(\"Route handler timed out\")\n }\n }, 30000)\n })\n }\n\n const mergeQueryValues = (target: Record<string, string | string[]>, key: string, value: string) => {\n const existing = target[key]\n if (Array.isArray(existing)) {\n existing.push(value)\n return\n }\n\n if (typeof existing === \"string\") {\n target[key] = [existing, value]\n return\n }\n\n target[key] = value\n }\n\n const toQueryValue = (value: unknown): string | null => {\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") return Number.isFinite(value) ? String(value) : null\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\"\n if (typeof value === \"bigint\") return String(value)\n if (value instanceof Date) return value.toISOString()\n return null\n }\n\n const buildQuery = (path: string, payload: Record<string, unknown>) => {\n const url = new URL(path, \"http://localhost\")\n\n const query: Record<string, string | string[]> = {}\n for (const [key, value] of url.searchParams) {\n mergeQueryValues(query, key, value)\n }\n\n for (const [key, rawValue] of Object.entries(payload)) {\n if (!key) continue\n\n if (Array.isArray(rawValue)) {\n for (const item of rawValue) {\n const converted = toQueryValue(item)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n continue\n }\n\n const converted = toQueryValue(rawValue)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n\n const searchParams = new URLSearchParams()\n for (const [key, rawValue] of Object.entries(query)) {\n if (Array.isArray(rawValue)) {\n for (const value of rawValue) {\n searchParams.append(key, value)\n }\n continue\n }\n\n searchParams.append(key, rawValue)\n }\n\n const matchPath = url.pathname\n const requestUrl = `${matchPath}${searchParams.toString() ? `?${searchParams.toString()}` : \"\"}`\n\n return { matchPath, requestUrl, query }\n }\n\n const createMethod = (method: string) => {\n return async <TResponse = Record<string, unknown>>(\n path: string,\n payload: Record<string, unknown>,\n ctx?: Ctx,\n ): Promise<TResponse> => {\n if (!ctx) {\n throw new Error(\"Context must be provided in SSR mode\")\n }\n\n const normalizedMethod = method.toLowerCase()\n\n if (normalizedMethod === \"get\") {\n const { matchPath, requestUrl, query } = buildQuery(path, payload)\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: {}, query }, ctx.res)\n }\n\n const { matchPath, requestUrl, query } = buildQuery(path, {})\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: payload, query }, ctx.res)\n }\n }\n\n const apiClient = {\n get: createMethod(\"get\"),\n post: createMethod(\"post\"),\n put: createMethod(\"put\"),\n delete: createMethod(\"delete\")\n }\n\n return apiClient\n}\n\nexport default getServerApiClient\n"],"names":["app","converted","matchPath","requestUrl","query"],"mappings":"AAOO,MAAM,qBAAqB,OAAM,QAAqB;AAC3D,QAAM,YAAY,OAChBA,MACA,QACA,WACA,YACA,KACA,QACuB;AACvB,WAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAI,UAAU;AAEd,YAAM,UAAU;AAAA,QACd,GAAG;AAAA,QACH,QAAQ,OAAO,YAAA;AAAA,QACf,KAAK;AAAA,MAAA;AAGP,YAAM,UAAU;AAAA,QACd,GAAG;AAAA,QACH,MAAM,CAAC,SAAc;AACnB,cAAI,CAAC,SAAS;AACZ,sBAAU;AACV,oBAAQ,IAAI;AAAA,UACd;AAAA,QACF;AAA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