diff --git a/.gitignore b/.gitignore index 96370a4674..15980d87e5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .dev/dependencies .dev/coverage .dev/artifacts +.dev/db-studio */.dev/artifacts */.dev/coverage */.dev/dependencies diff --git a/packages/cli/build.gradle.kts b/packages/cli/build.gradle.kts index 443e33bb4d..ec19e5b1cc 100644 --- a/packages/cli/build.gradle.kts +++ b/packages/cli/build.gradle.kts @@ -2407,7 +2407,7 @@ tasks { val allSamples = layout.projectDirectory.dir("src/projects") .asFile .listFiles() - .filter { it.isDirectory() } + .filter { it.isDirectory() && it.name != "db-studio" } .map { it.toPath() to it.name } val builtSamples = layout.buildDirectory.dir("packed-samples") @@ -2429,10 +2429,29 @@ tasks { dependsOn(allSamplePackTasks) } + val prepareDbStudioResources by registering(Copy::class) { + group = "build" + description = "Prepare Database Studio resources for embedding in CLI" + + // Copy API files + from(layout.projectDirectory.dir("src/db-studio/api")) { + into("api") + exclude("config.ts") // Generated at runtime with injected config + } + + // Copy built UI (dist/ folder only, not source or node_modules) + from(layout.projectDirectory.dir("src/db-studio/ui/dist")) { + into("ui") + } + + into(layout.buildDirectory.dir("resources/main/META-INF/elide/db-studio")) + } + processResources { dependsOn( ":packages:graalvm:buildRustNativesForHostDebug", prepKotlinResources, + prepareDbStudioResources, packSamples, allSamplePackTasks, ) diff --git a/packages/cli/src/db-studio/api/.dev/dependencies/npm/package-lock.kdl b/packages/cli/src/db-studio/api/.dev/dependencies/npm/package-lock.kdl new file mode 120000 index 0000000000..a9e4ceefd3 --- /dev/null +++ b/packages/cli/src/db-studio/api/.dev/dependencies/npm/package-lock.kdl @@ -0,0 +1 @@ +/Users/francis/code/millpointlabs/elide/elide/packages/cli/src/db-studio/api/package-lock.kdl \ No newline at end of file diff --git a/packages/cli/src/db-studio/api/.dev/dependencies/npm/package.json b/packages/cli/src/db-studio/api/.dev/dependencies/npm/package.json new file mode 100644 index 0000000000..6c3badee97 --- /dev/null +++ b/packages/cli/src/db-studio/api/.dev/dependencies/npm/package.json @@ -0,0 +1,13 @@ +{ + "name": "db-studio-api", + "version": "1.0.0", + "description": "Database Studio API Server", + "main": "index.ts", + "scripts": {}, + "dependencies": { + "zod": "4" + }, + "devDependencies": { + "@elide-dev/types": "1.0.0-beta10" + } +} \ No newline at end of file diff --git a/packages/cli/src/db-studio/api/.dev/elide.lock.bin b/packages/cli/src/db-studio/api/.dev/elide.lock.bin new file mode 100644 index 0000000000..182f6907dc Binary files /dev/null and b/packages/cli/src/db-studio/api/.dev/elide.lock.bin differ diff --git a/packages/cli/src/db-studio/api/config.ts b/packages/cli/src/db-studio/api/config.ts new file mode 100644 index 0000000000..9203008216 --- /dev/null +++ b/packages/cli/src/db-studio/api/config.ts @@ -0,0 +1,22 @@ +import type { DiscoveredDatabase } from "./database.ts"; + +/** + * Database Studio Configuration + * + * This is a sample configuration file. In production, this would be + * generated by DbStudioCommand.kt based on discovered databases. + */ + +const config = { + port: 4984, + databases: [ + { + path: "./sample.db", + name: "sample.db", + size: 0, + lastModified: Date.now(), + } + ] as DiscoveredDatabase[], +}; + +export default config; diff --git a/packages/cli/src/db-studio/api/database.ts b/packages/cli/src/db-studio/api/database.ts new file mode 100644 index 0000000000..32cbff3926 --- /dev/null +++ b/packages/cli/src/db-studio/api/database.ts @@ -0,0 +1,176 @@ +/** + * Database API Layer + * + * Provides abstraction over database operations for the DB Studio. + * This layer isolates all database-specific logic, making it easy to: + * - Swap SQLite for other databases (PostgreSQL, MySQL, etc.) + * - Add caching, connection pooling, or other optimizations + * - Centralize error handling and validation + * + * NOTE: This module does NOT import "elide:sqlite" directly because Elide's + * module loader can only handle that special protocol in the entry point file. + * The Database class must be passed from index.ts. + */ + +import type { Database, Statement } from "elide:sqlite"; + +/** + * Log SQL queries to console + */ +function logQuery(sql: string, params?: unknown[]): void { + const timestamp = new Date().toISOString(); + const paramsStr = params && params.length > 0 ? ` [${params.join(", ")}]` : ""; + console.log(`[${timestamp}] SQL: ${sql}${paramsStr}`); +} + +export interface DiscoveredDatabase { + path: string; + name: string; + size: number; + lastModified: number; +} + +export interface TableInfo { + name: string; + rowCount: number; +} + +export type TableData = { + name: string; + columns: string[]; + rows: unknown[][]; + totalRows: number; +}; + +export interface DatabaseInfo { + path: string; + name: string; + size: number; + lastModified: number; + tableCount: number; +} + +interface TableNameRow { + name: string; +} + +interface CountRow { + count: number; +} + +/** + * Get list of tables in a database + */ +export function getTables(db: Database): TableInfo[] { + const sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"; + logQuery(sql); + const query: Statement = db.query(sql); + const results = query.all(); + + return results.map(({ name }) => { + const tableName = name; + const countSql = `SELECT COUNT(*) as count FROM ${tableName}`; + logQuery(countSql); + const countQuery: Statement = db.query(countSql); + const countResult = countQuery.get(); + + return { + name: tableName, + rowCount: countResult?.count ?? 0, + }; + }); +} + + +interface ColumnNameRow { + name: string; +} + +/** + * Get table data with schema and rows + */ +export function getTableData(db: Database, tableName: string, limit: number = 100, offset: number = 0): TableData { + + // Get schema (column names) + const schemaSql = `SELECT name FROM pragma_table_info('${tableName}') ORDER BY cid`; + logQuery(schemaSql); + const schemaQuery: Statement = db.prepare(schemaSql); + const schemaResults = schemaQuery.all(); + const columns = schemaResults.map((col) => col.name); + + // Get data rows (unknown type since we don't know the schema) + const dataSql = `SELECT * FROM ${tableName} LIMIT ${limit} OFFSET ${offset}`; + logQuery(dataSql); + const dataQuery = db.query(dataSql); + const rows = dataQuery.all(); + + // Get total row count + const countSql = `SELECT COUNT(*) as count FROM ${tableName}`; + logQuery(countSql); + const countQuery: Statement = db.query(countSql); + const countResult = countQuery.get(); + const totalRows = countResult?.count ?? 0; + + return { + name: tableName, + columns, + rows: rows.map((row: unknown) => columns.map(col => (row as Record)[col])), + totalRows, + }; +} + +/** + * Get database metadata + */ +export function getDatabaseInfo(db: Database, dbPath: string): DatabaseInfo { + const sql = "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table'"; + logQuery(sql); + const tablesQuery: Statement = db.query(sql); + const tablesResult = tablesQuery.get(); + + // Extract name from path + const pathParts = dbPath.split('/'); + const name = pathParts[pathParts.length - 1]; + + return { + path: dbPath, + name, + size: 0, // Will be populated by calling code if available + lastModified: 0, // Will be populated by calling code if available + tableCount: tablesResult?.count ?? 0, + }; +} + +/** + * Execute a raw SQL query (for future query editor feature) + */ +export function executeQuery(db: Database, sql: string, limit: number = 100): { columns: string[], rows: unknown[][] } { + logQuery(sql); + const query = db.query(sql); + const results = query.all(); + + if (results.length === 0) { + return { columns: [], rows: [] }; + } + + const firstRow = results[0] as Record; + const columns = Object.keys(firstRow); + const rows = results.map((row: unknown) => columns.map(col => (row as Record)[col])); + + return { columns, rows }; +} + +/** + * Validate that a database path is accessible + */ +export function validateDatabase(db: Database): boolean { + try { + // Try a simple query to verify the database is valid + const sql = "SELECT 1"; + const query = db.query(sql); + query.get(); + return true; + } catch (err) { + return false; + } +} diff --git a/packages/cli/src/db-studio/api/elide.pkl b/packages/cli/src/db-studio/api/elide.pkl new file mode 100644 index 0000000000..fd21b1621b --- /dev/null +++ b/packages/cli/src/db-studio/api/elide.pkl @@ -0,0 +1,22 @@ +amends "elide:project.pkl" +import "elide:JavaScript.pkl" as js + +name = "db-studio-api" +version = "1.0.0" +description = "Database Studio API Server" + +entrypoint { + "index.ts" +} + +dependencies { + npm { + packages { + "zod@4" + } + + devPackages { + "@elide-dev/types@1.0.0-beta10" + } + } +} \ No newline at end of file diff --git a/packages/cli/src/db-studio/api/http/middleware.ts b/packages/cli/src/db-studio/api/http/middleware.ts new file mode 100644 index 0000000000..8750e69872 --- /dev/null +++ b/packages/cli/src/db-studio/api/http/middleware.ts @@ -0,0 +1,18 @@ +import type { ApiResponse, RouteContext, RouteHandler, DatabaseHandler } from "./types.ts"; +import { validateDatabaseIndex } from "../utils/validation.ts"; + +/** + * Middleware that validates database index and provides database instance to handler + */ +export function withDatabase(handler: DatabaseHandler): RouteHandler { + return async (params: Record, context: RouteContext, body: string): Promise => { + const result = validateDatabaseIndex(params.dbIndex, context.databases); + if ("error" in result) return result.error; + + const { database } = result; + const db = new context.Database(database.path); + + return handler(params, { ...context, database, db }, body); + }; +} + diff --git a/packages/cli/src/db-studio/api/http/responses.ts b/packages/cli/src/db-studio/api/http/responses.ts new file mode 100644 index 0000000000..b26be8d837 --- /dev/null +++ b/packages/cli/src/db-studio/api/http/responses.ts @@ -0,0 +1,39 @@ +import type { ApiResponse } from "./types.ts"; + +const SUCCESS_STATUS = 200; +const ERROR_STATUS = 500; +const NOT_FOUND_STATUS = 404; + +/** + * Create a JSON response + */ +export function jsonResponse(data: unknown, status: number = SUCCESS_STATUS): ApiResponse { + console.log("returning json response", data); + return { + status, + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }; +} + +/** + * Create an error response + */ +export function errorResponse(message: string, status: number = ERROR_STATUS): ApiResponse { + return jsonResponse({ error: message }, status); +} + +/** + * Handle database operation errors + */ +export function handleDatabaseError(err: unknown, operation: string): ApiResponse { + const errorMessage = err instanceof Error ? err.message : "Unknown error"; + return errorResponse(`Failed to ${operation}: ${errorMessage}`, ERROR_STATUS); +} + +/** + * Creates a 404 Not Found response + */ +export function notFoundResponse(): ApiResponse { + return jsonResponse({ error: "Not Found" }, NOT_FOUND_STATUS); +} diff --git a/packages/cli/src/db-studio/api/http/router.ts b/packages/cli/src/db-studio/api/http/router.ts new file mode 100644 index 0000000000..9dbc1c94c9 --- /dev/null +++ b/packages/cli/src/db-studio/api/http/router.ts @@ -0,0 +1,97 @@ +/** + * Represents a captured route parameter + */ +type RouteParameter = { + name: string; + value: string; +}; + +/** + * Result of matching a single path segment + */ +type SegmentMatchResult = + | { matched: true; parameter: RouteParameter | null } + | { matched: false }; + +/** + * Splits a URL path into segments, filtering out empty strings + */ +function splitPathIntoSegments(path: string): string[] { + return path.split("/").filter(segment => segment.length > 0); +} + +/** + * Checks if a pattern segment is a parameter (starts with ':') + */ +function isParameterSegment(segment: string): boolean { + return segment.startsWith(":"); +} + +/** + * Extracts the parameter name from a pattern segment (removes the ':' prefix) + */ +function extractParameterName(segment: string): string { + return segment.slice(1); +} + +/** + * Matches a single pattern segment against a path segment + * Returns match result indicating success and any captured parameter + */ +function matchPathSegment( + patternSegment: string, + pathSegment: string +): SegmentMatchResult { + if (isParameterSegment(patternSegment)) { + return { + matched: true, + parameter: { + name: extractParameterName(patternSegment), + value: pathSegment + } + }; + } + + // Literal segment - must match exactly + if (patternSegment === pathSegment) { + return { matched: true, parameter: null }; + } + + return { matched: false }; +} + +/** + * Matches a route pattern against a path and extracts parameters + * + * Pattern segments starting with ':' are treated as parameters. + * + * @example + * matchRoute("/api/:dbIndex/query", "/api/0/query") + * // Returns: { dbIndex: "0" } + */ +export function matchRoute(pattern: string, path: string): Record | null { + const patternSegments = splitPathIntoSegments(pattern); + const pathSegments = splitPathIntoSegments(path); + + // Paths must have the same number of segments to match + if (patternSegments.length !== pathSegments.length) { + return null; + } + + const params: Record = {}; + + for (let i = 0; i < patternSegments.length; i++) { + const result = matchPathSegment(patternSegments[i], pathSegments[i]); + + if (!result.matched) { + return null; + } + + if (result.parameter) { + params[result.parameter.name] = result.parameter.value; + } + } + + return params; +} + diff --git a/packages/cli/src/db-studio/api/http/server.ts b/packages/cli/src/db-studio/api/http/server.ts new file mode 100644 index 0000000000..a623b3b3b3 --- /dev/null +++ b/packages/cli/src/db-studio/api/http/server.ts @@ -0,0 +1,58 @@ +import type { DiscoveredDatabase } from "../database.ts"; +import type { ApiResponse, RouteContext, DatabaseConstructor } from "./types.ts"; +import { matchRoute } from "./router.ts"; +import { routes } from "../routes/index.ts"; +import { errorResponse, notFoundResponse } from "./responses.ts"; + +/** + * Extracts the path from a URL, removing query strings + */ +function parseUrlPath(url: string): string { + return url.split('?')[0]; +} + +/** + * Attempts to find and execute a matching route handler + */ +async function executeMatchingRoute( + path: string, + method: string, + body: string, + context: RouteContext +): Promise { + for (const route of routes) { + if (route.method !== method) continue; + + const params = matchRoute(route.pattern, path); + if (params) { + return await route.handler(params, context, body); + } + } + + return null; +} + +/** + * Main API request handler - routes requests to appropriate handlers + */ +export async function handleApiRequest( + url: string, + method: string, + body: string, + databases: DiscoveredDatabase[], + Database: DatabaseConstructor +): Promise { + try { + const path = parseUrlPath(url); + const context: RouteContext = { databases, Database }; + + const response = await executeMatchingRoute(path, method, body, context); + return response ?? notFoundResponse(); + + } catch (err) { + const errorMessage = err instanceof Error ? err.message : "Unknown error"; + console.error("Error handling request:", err); + return errorResponse(errorMessage); + } +} + diff --git a/packages/cli/src/db-studio/api/http/types.ts b/packages/cli/src/db-studio/api/http/types.ts new file mode 100644 index 0000000000..64669e243f --- /dev/null +++ b/packages/cli/src/db-studio/api/http/types.ts @@ -0,0 +1,61 @@ +import type { DiscoveredDatabase } from "../database.ts"; +import type { Database } from "elide:sqlite"; + +/** + * Database constructor type + */ +export type DatabaseConstructor = typeof Database; + +/** + * API response structure + */ +export type ApiResponse = { + status: number; + headers: Record; + body: string; +}; + +/** + * Context passed to all route handlers + */ +export type RouteContext = { + databases: DiscoveredDatabase[]; + Database: DatabaseConstructor; +}; + +/** + * Route handler function signature + */ +export type RouteHandler = ( + params: Record, + context: RouteContext, + body: string +) => Promise; + +/** + * Route definition + */ +export type Route = { + method: string; + pattern: string; + handler: RouteHandler; +}; + +/** + * Extended context for database-specific handlers + */ +export type DatabaseHandlerContext = { + database: DiscoveredDatabase; + db: Database; + databases: DiscoveredDatabase[]; +}; + +/** + * Database-specific handler function signature + */ +export type DatabaseHandler = ( + params: Record, + context: DatabaseHandlerContext, + body: string +) => Promise; + diff --git a/packages/cli/src/db-studio/api/index.ts b/packages/cli/src/db-studio/api/index.ts new file mode 100644 index 0000000000..3293b62453 --- /dev/null +++ b/packages/cli/src/db-studio/api/index.ts @@ -0,0 +1,69 @@ +import { createServer, IncomingMessage, ServerResponse } from "http"; +import { Database } from "elide:sqlite"; +import { handleApiRequest } from "./http/server.ts"; +import { errorResponse } from "./http/responses.ts"; +import type { ApiResponse } from "./http/types.ts"; +import config from "./config.ts"; + +/** + * Database Studio - Entry Point + * + * Bootstraps the HTTP server for the Database Studio API. + */ + +export { Database }; + +const { port, databases } = config; + +/** + * Parses the request body from an incoming HTTP request + */ +function parseRequestBody(req: IncomingMessage): Promise { + return new Promise((resolve, reject) => { + let body = ''; + + req.on('data', (chunk) => { + body += chunk.toString('utf8'); + }); + + req.on('end', () => resolve(body)); + req.on('error', (err) => reject(err)); + }); +} + +/** + * Writes an ApiResponse to the HTTP ServerResponse + */ +function writeResponse(res: ServerResponse, response: ApiResponse): void { + res.writeHead(response.status, { + ...response.headers, + 'Content-Length': Buffer.byteLength(response.body, 'utf8') + }); + res.end(response.body); +} + +/** + * Main request handler - processes incoming HTTP requests + */ +async function handleRequest(req: IncomingMessage, res: ServerResponse): Promise { + try { + const body = await parseRequestBody(req); + const url = req.url || '/'; + const method = req.method || 'GET'; + + const response = await handleApiRequest(url, method, body, databases, Database); + writeResponse(res, response); + } catch (err) { + console.error("Error handling request:", err); + const response = errorResponse('Internal server error', 500); + writeResponse(res, response); + } +} + +// Create and configure HTTP server +const server = createServer(handleRequest); + +// Start listening on configured port +server.listen(port, () => { + console.log(`Database Studio API started on http://localhost:${port} 🚀`); +}); \ No newline at end of file diff --git a/packages/cli/src/db-studio/api/package-lock.kdl b/packages/cli/src/db-studio/api/package-lock.kdl new file mode 100644 index 0000000000..83c8462fcf --- /dev/null +++ b/packages/cli/src/db-studio/api/package-lock.kdl @@ -0,0 +1,35 @@ +lockfile-version 1 +root{ +dependencies{ +zod ">=4.0.0 <5.0.0-0" + } +dev-dependencies{ +"@elide-dev/types" "1.0.0-beta10" + } +} +pkg "@elide-dev/types"{ +version "1.0.0-beta10" +resolved "https://registry.npmjs.org/@elide-dev/types/-/types-1.0.0-beta10.tgz" +integrity "sha512-VAaiwprV0ekDHn0cXxn/GnvNohm2gLk0SOqymMCyWK6Tk0Q9rf0O4PCR4NGOFZf51zfghB1Pd204w72lhQbPhg==" +dependencies{ +"@types/node" ">=0.0.0" + } +} +pkg "@types/node"{ +version "24.10.1" +resolved "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz" +integrity "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==" +dependencies{ +undici-types ">=7.16.0 <7.17.0-0" + } +} +pkg undici-types{ +version "7.16.0" +resolved "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz" +integrity "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==" +} +pkg zod{ +version "4.1.12" +resolved "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz" +integrity "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==" +} diff --git a/packages/cli/src/db-studio/api/routes/databases.ts b/packages/cli/src/db-studio/api/routes/databases.ts new file mode 100644 index 0000000000..7a9f89c4d3 --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/databases.ts @@ -0,0 +1,28 @@ +import type { RouteContext, ApiResponse } from "../http/types.ts"; +import { jsonResponse } from "../http/responses.ts"; +import { withDatabase } from "../http/middleware.ts"; +import { getDatabaseInfo } from "../database.ts"; + +/** + * List all databases + */ +export async function listDatabases(_params: Record, context: RouteContext, _body: string): Promise { + return jsonResponse({ databases: context.databases }); +} + +/** + * Get database info + */ +export const getDatabaseInfoRoute = withDatabase(async (_params, context, _body) => { + const info = getDatabaseInfo(context.db, context.database.path); + + const fullInfo = { + ...info, + size: context.database.size, + lastModified: context.database.lastModified, + tableCount: info.tableCount, + }; + + return jsonResponse(fullInfo); +}); + diff --git a/packages/cli/src/db-studio/api/routes/health.ts b/packages/cli/src/db-studio/api/routes/health.ts new file mode 100644 index 0000000000..e8167ec09a --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/health.ts @@ -0,0 +1,10 @@ +import type { ApiResponse } from "../http/types.ts"; +import { jsonResponse } from "../http/responses.ts"; + +/** + * Health check endpoint + */ +export async function healthCheck(): Promise { + return jsonResponse({ status: "ok" }); +} + diff --git a/packages/cli/src/db-studio/api/routes/index.ts b/packages/cli/src/db-studio/api/routes/index.ts new file mode 100644 index 0000000000..bbda7ea24b --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/index.ts @@ -0,0 +1,38 @@ +import type { Route } from "../http/types.ts"; +import { healthCheck } from "./health.ts"; +import { listDatabases, getDatabaseInfoRoute } from "./databases.ts"; +import { getTablesRoute, getTableDataRoute, createTableRoute, dropTableRoute } from "./tables.ts"; +import { insertRowsRoute, updateRowsRoute, deleteRowsRoute } from "./rows.ts"; +import { executeQueryRoute } from "./query.ts"; + +/** + * Route Registry + * + * All application routes are defined here, mapping HTTP methods and URL patterns + * to their corresponding handler functions. + */ +export const routes: Route[] = [ + // Health check + { method: "GET", pattern: "/health", handler: healthCheck }, + + // Database operations + { method: "GET", pattern: "/api/databases", handler: listDatabases }, + { method: "GET", pattern: "/api/databases/:dbIndex", handler: getDatabaseInfoRoute }, + + // Table operations - read + { method: "GET", pattern: "/api/databases/:dbIndex/tables", handler: getTablesRoute }, + { method: "GET", pattern: "/api/databases/:dbIndex/tables/:tableName", handler: getTableDataRoute }, + + // Table operations - write + { method: "POST", pattern: "/api/databases/:dbIndex/tables", handler: createTableRoute }, + { method: "DELETE", pattern: "/api/databases/:dbIndex/tables/:tableName", handler: dropTableRoute }, + + // Row operations + { method: "POST", pattern: "/api/databases/:dbIndex/tables/:tableName/rows", handler: insertRowsRoute }, + { method: "PATCH", pattern: "/api/databases/:dbIndex/tables/:tableName/rows", handler: updateRowsRoute }, + { method: "DELETE", pattern: "/api/databases/:dbIndex/tables/:tableName/rows", handler: deleteRowsRoute }, + + // Raw SQL query endpoint + { method: "POST", pattern: "/api/databases/:dbIndex/query", handler: executeQueryRoute }, +]; + diff --git a/packages/cli/src/db-studio/api/routes/query.ts b/packages/cli/src/db-studio/api/routes/query.ts new file mode 100644 index 0000000000..150d7e1540 --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/query.ts @@ -0,0 +1,40 @@ +import { jsonResponse, handleDatabaseError, errorResponse } from "../http/responses.ts"; +import { withDatabase } from "../http/middleware.ts"; +import { parseRequestBody } from "../utils/request.ts"; + +/** + * Execute a raw SQL query + */ +export const executeQueryRoute = withDatabase(async (_params, context, body) => { + const data = parseRequestBody(body); + const sql = data.sql as string | undefined; + const queryParams = data.params as unknown[] | undefined; + + if (!sql) { + return errorResponse("Request body must contain 'sql' string", 400); + } + + try { + const stmt = context.db.prepare(sql); + const params = queryParams || []; + + if (sql.trim().toLowerCase().startsWith("select")) { + const rows = stmt.all(...(params as any)); + return jsonResponse({ + success: true, + rows, + rowCount: Array.isArray(rows) ? rows.length : 0, + }); + } else { + const info = stmt.run(...(params as any)); + return jsonResponse({ + success: true, + rowsAffected: info.changes, + lastInsertRowid: info.lastInsertRowid, + }); + } + } catch (err) { + return handleDatabaseError(err, "execute query"); + } +}); + diff --git a/packages/cli/src/db-studio/api/routes/rows.ts b/packages/cli/src/db-studio/api/routes/rows.ts new file mode 100644 index 0000000000..0738d9fa77 --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/rows.ts @@ -0,0 +1,92 @@ +import type { ApiResponse } from "../http/types.ts"; +import { jsonResponse, handleDatabaseError, errorResponse } from "../http/responses.ts"; +import { withDatabase } from "../http/middleware.ts"; +import { requireTableName } from "../utils/validation.ts"; +import { parseRequestBody, buildWhereClause } from "../utils/request.ts"; + +/** + * Insert rows into a table + */ +export const insertRowsRoute = withDatabase(async (params, context, body) => { + const tableNameError = requireTableName(params); + if (tableNameError) return tableNameError; + + const data = parseRequestBody(body); + const values = data.values as Record | undefined; + + if (!values || typeof values !== "object") { + return errorResponse("Request body must contain 'values' object", 400); + } + + const columns = Object.keys(values); + const placeholders = columns.map(() => "?").join(", "); + const sql = `INSERT INTO ${params.tableName} (${columns.join(", ")}) VALUES (${placeholders})`; + + try { + const stmt = context.db.prepare(sql); + stmt.run(...(Object.values(values) as any)); + return jsonResponse({ success: true, message: "Row inserted successfully" }); + } catch (err) { + return handleDatabaseError(err, "insert row"); + } +}); + +/** + * Update rows in a table + */ +export const updateRowsRoute = withDatabase(async (params, context, body) => { + const tableNameError = requireTableName(params); + if (tableNameError) return tableNameError; + + const data = parseRequestBody(body); + const values = data.values as Record | undefined; + const where = data.where as Record | undefined; + + if (!values || typeof values !== "object") { + return errorResponse("Request body must contain 'values' object", 400); + } + + if (!where || typeof where !== "object" || Object.keys(where).length === 0) { + return errorResponse("Request body must contain 'where' object with at least one condition", 400); + } + + const setColumns = Object.keys(values).map(key => `${key} = ?`).join(", "); + const { clause: whereClause, values: whereValues } = buildWhereClause(where); + const sql = `UPDATE ${params.tableName} SET ${setColumns} ${whereClause}`; + + try { + const stmt = context.db.prepare(sql); + const allValues = [...Object.values(values), ...whereValues]; + const info = stmt.run(...(allValues as any)); + return jsonResponse({ success: true, rowsAffected: info.changes, message: "Rows updated successfully" }); + } catch (err) { + return handleDatabaseError(err, "update rows"); + } +}); + +/** + * Delete rows from a table + */ +export const deleteRowsRoute = withDatabase(async (params, context, body) => { + const tableNameError = requireTableName(params); + if (tableNameError) return tableNameError; + + const data = parseRequestBody(body); + const where = data.where as Record | undefined; + + if (!where || typeof where !== "object" || Object.keys(where).length === 0) { + return errorResponse("Request body must contain 'where' object with at least one condition (safety check)", 400); + } + + const { clause: whereClause, values: whereValues } = buildWhereClause(where); + const sql = `DELETE FROM ${params.tableName} ${whereClause}`; + + try { + const stmt = context.db.prepare(sql); + const info = stmt.run(...(whereValues as any)); + return jsonResponse({ success: true, rowsAffected: info.changes, message: "Rows deleted successfully" }); + } catch (err) { + return handleDatabaseError(err, "delete rows"); + } +}); + diff --git a/packages/cli/src/db-studio/api/routes/tables.ts b/packages/cli/src/db-studio/api/routes/tables.ts new file mode 100644 index 0000000000..b93432d54a --- /dev/null +++ b/packages/cli/src/db-studio/api/routes/tables.ts @@ -0,0 +1,81 @@ +import { jsonResponse, handleDatabaseError, errorResponse } from "../http/responses.ts"; +import { withDatabase } from "../http/middleware.ts"; +import { requireTableName } from "../utils/validation.ts"; +import { parseRequestBody } from "../utils/request.ts"; +import { getTables, getTableData } from "../database.ts"; + +/** + * Get list of tables in a database + */ +export const getTablesRoute = withDatabase(async (_params, context, _body) => { + const tables = getTables(context.db); + return jsonResponse({ tables }); +}); + +/** + * Get table data + */ +export const getTableDataRoute = withDatabase(async (params, context, _body) => { + const tableNameError = requireTableName(params); + if (tableNameError) return tableNameError; + + const tableData = getTableData(context.db, params.tableName); + console.log(tableData); + return jsonResponse(tableData); +}); + +/** + * Create a new table + */ +export const createTableRoute = withDatabase(async (_params, context, body) => { + const data = parseRequestBody(body); + const tableName = data.name as string | undefined; + const schema = data.schema as Array<{ name: string; type: string; constraints?: string }> | undefined; + + if (!tableName) { + return errorResponse("Request body must contain 'name' for the table", 400); + } + + if (!schema || !Array.isArray(schema) || schema.length === 0) { + return errorResponse("Request body must contain 'schema' array with at least one column", 400); + } + + const columns = schema.map(col => { + const constraints = col.constraints ? ` ${col.constraints}` : ""; + return `${col.name} ${col.type}${constraints}`; + }).join(", "); + + const sql = `CREATE TABLE ${tableName} (${columns})`; + + try { + context.db.exec(sql); + return jsonResponse({ success: true, message: `Table '${tableName}' created successfully` }); + } catch (err) { + return handleDatabaseError(err, "create table"); + } +}); + +/** + * Drop a table + */ +export const dropTableRoute = withDatabase(async (params, context, body) => { + const tableNameError = requireTableName(params); + if (tableNameError) return tableNameError; + + const data = parseRequestBody(body); + const confirm = data.confirm as boolean | undefined; + + if (!confirm) { + return errorResponse("Must set 'confirm: true' in request body to drop table (safety check)", 400); + } + + const sql = `DROP TABLE ${params.tableName}`; + + try { + context.db.exec(sql); + return jsonResponse({ success: true, message: `Table '${params.tableName}' dropped successfully` }); + } catch (err) { + return handleDatabaseError(err, "drop table"); + } +}); + diff --git a/packages/cli/src/db-studio/api/test.ts b/packages/cli/src/db-studio/api/test.ts new file mode 100644 index 0000000000..fa7e402128 --- /dev/null +++ b/packages/cli/src/db-studio/api/test.ts @@ -0,0 +1,14 @@ +import {z} from "zod"; + +const schema = z.object({ + name: z.string(), + age: z.number(), +}); + +const data = { + name: "John", + age: 30, +}; + +const result = schema.parse(data); +console.log(result); \ No newline at end of file diff --git a/packages/cli/src/db-studio/api/tsconfig.json b/packages/cli/src/db-studio/api/tsconfig.json new file mode 100644 index 0000000000..979acea239 --- /dev/null +++ b/packages/cli/src/db-studio/api/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "lib": ["ES2022"], + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "skipLibCheck": true, + + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + + "types": ["@elide-dev/types"] + }, + "include": ["**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/packages/cli/src/db-studio/api/utils/request.ts b/packages/cli/src/db-studio/api/utils/request.ts new file mode 100644 index 0000000000..9dd1287df5 --- /dev/null +++ b/packages/cli/src/db-studio/api/utils/request.ts @@ -0,0 +1,32 @@ +/** + * Parse request body as JSON + */ +export function parseRequestBody(body: string): Record { + if (!body || body.trim() === "") { + return {}; + } + try { + return JSON.parse(body); + } catch { + return {}; + } +} + +/** + * Build SQL WHERE clause from object + */ +export function buildWhereClause(where: Record): { clause: string; values: unknown[] } { + const conditions: string[] = []; + const values: unknown[] = []; + + for (const [key, value] of Object.entries(where)) { + conditions.push(`${key} = ?`); + values.push(value); + } + + return { + clause: conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "", + values, + }; +} + diff --git a/packages/cli/src/db-studio/api/utils/validation.ts b/packages/cli/src/db-studio/api/utils/validation.ts new file mode 100644 index 0000000000..05879ce83b --- /dev/null +++ b/packages/cli/src/db-studio/api/utils/validation.ts @@ -0,0 +1,47 @@ +import type { ApiResponse } from "../http/types.ts"; +import type { DiscoveredDatabase } from "../database.ts"; +import { errorResponse } from "../http/responses.ts"; + +/** + * Validate database index parameter + */ +export function validateDatabaseIndex( + dbIndexStr: string, + databases: DiscoveredDatabase[] +): { database: DiscoveredDatabase } | { error: ApiResponse } { + const dbIndex = parseInt(dbIndexStr, 10); + + if (isNaN(dbIndex)) { + return { error: errorResponse("Invalid database index", 400) }; + } + + if (dbIndex < 0 || dbIndex >= databases.length) { + return { error: errorResponse(`Database not found at index ${dbIndex}`, 404) }; + } + + return { database: databases[dbIndex] }; +} + +/** + * Require table name parameter + */ +export function requireTableName(params: Record): ApiResponse | null { + const tableName = params.tableName; + if (!tableName) { + return errorResponse("Table name is required", 400); + } + return null; +} + +/** + * Check if a SQL query is potentially destructive + */ +export function isDestructiveQuery(sql: string): boolean { + const normalized = sql.trim().toLowerCase(); + return ( + normalized.startsWith("drop") || + normalized.startsWith("truncate") || + (normalized.startsWith("delete") && !normalized.includes("where")) + ); +} + diff --git a/packages/cli/src/db-studio/db/chinook.sqlite b/packages/cli/src/db-studio/db/chinook.sqlite new file mode 100644 index 0000000000..b559c7394a Binary files /dev/null and b/packages/cli/src/db-studio/db/chinook.sqlite differ diff --git a/packages/cli/src/db-studio/db/northwind.db b/packages/cli/src/db-studio/db/northwind.db new file mode 100644 index 0000000000..da01968c34 Binary files /dev/null and b/packages/cli/src/db-studio/db/northwind.db differ diff --git a/packages/cli/src/db-studio/db/test.db b/packages/cli/src/db-studio/db/test.db new file mode 100644 index 0000000000..98ce59ff4a Binary files /dev/null and b/packages/cli/src/db-studio/db/test.db differ diff --git a/packages/cli/src/db-studio/run-db-studio.sh b/packages/cli/src/db-studio/run-db-studio.sh new file mode 100755 index 0000000000..b4c63a87c1 --- /dev/null +++ b/packages/cli/src/db-studio/run-db-studio.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Database Studio Runner +# Generates and runs the Database Studio with API and UI servers + +set -e + +# Colors for output +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Build command arguments +if [ -z "$1" ]; then + echo -e "${YELLOW}No database specified - will discover databases in current directory${NC}" + ARGS="db studio" +else + DB_PATH="$1" + echo -e "${BLUE}Using database: $DB_PATH${NC}" + ARGS="db studio $DB_PATH" +fi + +echo -e "${BLUE}Generating Database Studio files...${NC}" +./gradlew :packages:cli:run --args="$ARGS" -q + +echo "" +echo -e "${GREEN}Database Studio files generated!${NC}" +echo "" +echo -e "${YELLOW}Starting servers...${NC}" +echo "" + +# Trap to kill all background processes on exit +trap 'kill $(jobs -p) 2>/dev/null' EXIT + +# Function to wait for server to be ready +wait_for_server() { + local port=$1 + local name=$2 + local max_wait=60 + local waited=0 + + while ! nc -z localhost $port 2>/dev/null; do + if [ $waited -ge $max_wait ]; then + echo -e "${YELLOW}Warning: $name didn't start within ${max_wait}s${NC}" + return 1 + fi + sleep 1 + waited=$((waited + 1)) + done + echo -e "${GREEN}✓ $name is ready${NC}" +} + +# Get absolute paths +PROJECT_ROOT="$(pwd)" +API_DIR="$PROJECT_ROOT/.dev/db-studio/api" +UI_DIR="$PROJECT_ROOT/.dev/db-studio/ui" + +# Start API server in background (imperative Node.js HTTP server) +echo -e "${BLUE}[API Server]${NC} Starting on port 4984..." +./gradlew :packages:cli:run --args="run $API_DIR/index.ts" -q 2>&1 | sed 's/^/[API] /' & +API_PID=$! + +# Wait for API server to be ready +wait_for_server 4984 "API Server" + +# Start UI server in background +echo -e "${BLUE}[UI Server]${NC} Starting on port 8080..." +./gradlew :packages:cli:run --args="serve .dev/db-studio/ui" -q 2>&1 | sed 's/^/[UI] /' & +UI_PID=$! + +# Wait for UI server to be ready +wait_for_server 8080 "UI Server" + +echo "" +echo -e "${GREEN}✓ Database Studio is running!${NC}" +echo "" +echo " UI: http://localhost:8080" +echo " API: http://localhost:4984" +echo "" +echo "Press Ctrl+C to stop all servers" +echo "" + +# Wait for any background job to finish +wait diff --git a/packages/cli/src/db-studio/ui/README.md b/packages/cli/src/db-studio/ui/README.md new file mode 100644 index 0000000000..4dcad1f915 --- /dev/null +++ b/packages/cli/src/db-studio/ui/README.md @@ -0,0 +1,73 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## React Compiler + +The React Compiler is currently not compatible with SWC. See [this issue](https://github.com/vitejs/vite-plugin-react/issues/428) for tracking the progress. + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: + +```js +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + // Other configs... + + // Remove tseslint.configs.recommended and replace with this + tseslint.configs.recommendedTypeChecked, + // Alternatively, use this for stricter rules + tseslint.configs.strictTypeChecked, + // Optionally, add this for stylistic rules + tseslint.configs.stylisticTypeChecked, + + // Other configs... + ], + languageOptions: { + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + // other options... + }, + }, +]) +``` + +You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: + +```js +// eslint.config.js +import reactX from 'eslint-plugin-react-x' +import reactDom from 'eslint-plugin-react-dom' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + // Other configs... + // Enable lint rules for React + reactX.configs['recommended-typescript'], + // Enable lint rules for React DOM + reactDom.configs.recommended, + ], + languageOptions: { + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + // other options... + }, + }, +]) +``` diff --git a/packages/cli/src/db-studio/ui/components.json b/packages/cli/src/db-studio/ui/components.json new file mode 100644 index 0000000000..9b4169b45d --- /dev/null +++ b/packages/cli/src/db-studio/ui/components.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/index.css", + "baseColor": "zinc", + "cssVariables": true, + "prefix": "" + }, + "iconLibrary": "lucide", + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "registries": {} +} diff --git a/packages/cli/src/db-studio/ui/dist/assets/index-BnzMNST7.js b/packages/cli/src/db-studio/ui/dist/assets/index-BnzMNST7.js new file mode 100644 index 0000000000..941de6db00 --- /dev/null +++ b/packages/cli/src/db-studio/ui/dist/assets/index-BnzMNST7.js @@ -0,0 +1,106 @@ +(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))s(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&s(h)}).observe(document,{childList:!0,subtree:!0});function o(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(f){if(f.ep)return;f.ep=!0;const d=o(f);fetch(f.href,d)}})();var Ws={exports:{}},Ki={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Om;function Ng(){if(Om)return Ki;Om=1;var l=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(s,f,d){var h=null;if(d!==void 0&&(h=""+d),f.key!==void 0&&(h=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:l,type:s,key:h,ref:f!==void 0?f:null,props:d}}return Ki.Fragment=r,Ki.jsx=o,Ki.jsxs=o,Ki}var Dm;function Ug(){return Dm||(Dm=1,Ws.exports=Ng()),Ws.exports}var $=Ug(),Ps={exports:{}},Ee={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var _m;function jg(){if(_m)return Ee;_m=1;var l=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),M=Symbol.iterator;function N(x){return x===null||typeof x!="object"?null:(x=M&&x[M]||x["@@iterator"],typeof x=="function"?x:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Q=Object.assign,V={};function X(x,L,Z){this.props=x,this.context=L,this.refs=V,this.updater=Z||B}X.prototype.isReactComponent={},X.prototype.setState=function(x,L){if(typeof x!="object"&&typeof x!="function"&&x!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,x,L,"setState")},X.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function W(){}W.prototype=X.prototype;function ee(x,L,Z){this.props=x,this.context=L,this.refs=V,this.updater=Z||B}var ve=ee.prototype=new W;ve.constructor=ee,Q(ve,X.prototype),ve.isPureReactComponent=!0;var le=Array.isArray;function D(){}var F={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function se(x,L,Z){var P=Z.ref;return{$$typeof:l,type:x,key:L,ref:P!==void 0?P:null,props:Z}}function Re(x,L){return se(x.type,L,x.props)}function He(x){return typeof x=="object"&&x!==null&&x.$$typeof===l}function $e(x){var L={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(Z){return L[Z]})}var Ne=/\/+/g;function Ae(x,L){return typeof x=="object"&&x!==null&&x.key!=null?$e(""+x.key):L.toString(36)}function Qe(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(D,D):(x.status="pending",x.then(function(L){x.status==="pending"&&(x.status="fulfilled",x.value=L)},function(L){x.status==="pending"&&(x.status="rejected",x.reason=L)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function C(x,L,Z,P,ye){var be=typeof x;(be==="undefined"||be==="boolean")&&(x=null);var pe=!1;if(x===null)pe=!0;else switch(be){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(x.$$typeof){case l:case r:pe=!0;break;case g:return pe=x._init,C(pe(x._payload),L,Z,P,ye)}}if(pe)return ye=ye(x),pe=P===""?"."+Ae(x,0):P,le(ye)?(Z="",pe!=null&&(Z=pe.replace(Ne,"$&/")+"/"),C(ye,L,Z,"",function(We){return We})):ye!=null&&(He(ye)&&(ye=Re(ye,Z+(ye.key==null||x&&x.key===ye.key?"":(""+ye.key).replace(Ne,"$&/")+"/")+pe)),L.push(ye)),1;pe=0;var st=P===""?".":P+":";if(le(x))for(var Ze=0;Ze>>1,Se=C[xe];if(0>>1;xef(Z,G))Pf(ye,Z)?(C[xe]=ye,C[P]=G,xe=P):(C[xe]=Z,C[L]=G,xe=L);else if(Pf(ye,G))C[xe]=ye,C[P]=G,xe=P;else break e}}return k}function f(C,k){var G=C.sortIndex-k.sortIndex;return G!==0?G:C.id-k.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;l.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var y=[],m=[],g=1,E=null,M=3,N=!1,B=!1,Q=!1,V=!1,X=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,ee=typeof setImmediate<"u"?setImmediate:null;function ve(C){for(var k=o(m);k!==null;){if(k.callback===null)s(m);else if(k.startTime<=C)s(m),k.sortIndex=k.expirationTime,r(y,k);else break;k=o(m)}}function le(C){if(Q=!1,ve(C),!B)if(o(y)!==null)B=!0,D||(D=!0,$e());else{var k=o(m);k!==null&&Qe(le,k.startTime-C)}}var D=!1,F=-1,K=5,se=-1;function Re(){return V?!0:!(l.unstable_now()-seC&&Re());){var xe=E.callback;if(typeof xe=="function"){E.callback=null,M=E.priorityLevel;var Se=xe(E.expirationTime<=C);if(C=l.unstable_now(),typeof Se=="function"){E.callback=Se,ve(C),k=!0;break t}E===o(y)&&s(y),ve(C)}else s(y);E=o(y)}if(E!==null)k=!0;else{var x=o(m);x!==null&&Qe(le,x.startTime-C),k=!1}}break e}finally{E=null,M=G,N=!1}k=void 0}}finally{k?$e():D=!1}}}var $e;if(typeof ee=="function")$e=function(){ee(He)};else if(typeof MessageChannel<"u"){var Ne=new MessageChannel,Ae=Ne.port2;Ne.port1.onmessage=He,$e=function(){Ae.postMessage(null)}}else $e=function(){X(He,0)};function Qe(C,k){F=X(function(){C(l.unstable_now())},k)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(C){C.callback=null},l.unstable_forceFrameRate=function(C){0>C||125xe?(C.sortIndex=G,r(m,C),o(y)===null&&C===o(m)&&(Q?(W(F),F=-1):Q=!0,Qe(le,G-xe))):(C.sortIndex=Se,r(y,C),B||N||(B=!0,D||(D=!0,$e()))),C},l.unstable_shouldYield=Re,l.unstable_wrapCallback=function(C){var k=M;return function(){var G=M;M=k;try{return C.apply(this,arguments)}finally{M=G}}}})(tc)),tc}var jm;function Hg(){return jm||(jm=1,ec.exports=Lg()),ec.exports}var ac={exports:{}},At={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Lm;function Bg(){if(Lm)return At;Lm=1;var l=Mc();function r(y){var m="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(r){console.error(r)}}return l(),ac.exports=Bg(),ac.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bm;function qg(){if(Bm)return ki;Bm=1;var l=Hg(),r=Mc(),o=My();function s(e){var t="https://react.dev/errors/"+e;if(1Se||(e.current=xe[Se],xe[Se]=null,Se--)}function Z(e,t){Se++,xe[Se]=e.current,e.current=t}var P=x(null),ye=x(null),be=x(null),pe=x(null);function st(e,t){switch(Z(be,t),Z(ye,e),Z(P,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ih(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ih(t),e=em(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(P),Z(P,e)}function Ze(){L(P),L(ye),L(be)}function We(e){e.memoizedState!==null&&Z(pe,e);var t=P.current,a=em(t,e.type);t!==a&&(Z(ye,e),Z(P,a))}function Ot(e){ye.current===e&&(L(P),L(ye)),pe.current===e&&(L(pe),Gi._currentValue=G)}var ma,sr;function Dt(e){if(ma===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ma=t&&t[1]||"",sr=-1)":-1i||b[n]!==O[i]){var H=` +`+b[n].replace(" at new "," at ");return e.displayName&&H.includes("")&&(H=H.replace("",e.displayName)),H}while(1<=n&&0<=i);break}}}finally{Pn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Dt(a):""}function cr(e,t){switch(e.tag){case 26:case 27:case 5:return Dt(e.type);case 16:return Dt("Lazy");case 13:return e.child!==t&&t!==null?Dt("Suspense Fallback"):Dt("Suspense");case 19:return Dt("SuspenseList");case 0:case 15:return In(e.type,!1);case 11:return In(e.type.render,!1);case 1:return In(e.type,!0);case 31:return Dt("Activity");default:return""}}function fr(e){try{var t="",a=null;do t+=cr(e,a),a=e,e=e.return;while(e);return t}catch(n){return` +Error generating stack: `+n.message+` +`+n.stack}}var ei=Object.prototype.hasOwnProperty,ti=l.unstable_scheduleCallback,ai=l.unstable_cancelCallback,Na=l.unstable_shouldYield,jl=l.unstable_requestPaint,zt=l.unstable_now,li=l.unstable_getCurrentPriorityLevel,Wt=l.unstable_ImmediatePriority,Pt=l.unstable_UserBlockingPriority,Ll=l.unstable_NormalPriority,Yu=l.unstable_LowPriority,sn=l.unstable_IdlePriority,Gu=l.log,ya=l.unstable_setDisableYieldValue,ll=null,wt=null;function va(e){if(typeof Gu=="function"&&ya(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(ll,e)}catch{}}var _t=Math.clz32?Math.clz32:hr,dr=Math.log,cn=Math.LN2;function hr(e){return e>>>=0,e===0?32:31-(dr(e)/cn|0)|0}var nl=256,fn=262144,Hl=4194304;function Ua(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Bl(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var i=0,u=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var v=n&134217727;return v!==0?(n=v&~u,n!==0?i=Ua(n):(c&=v,c!==0?i=Ua(c):a||(a=v&~e,a!==0&&(i=Ua(a))))):(v=n&~u,v!==0?i=Ua(v):c!==0?i=Ua(c):a||(a=n&~e,a!==0&&(i=Ua(a)))),i===0?0:t!==0&&t!==i&&(t&u)===0&&(u=i&-i,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:i}function Ta(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dn(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mr(){var e=Hl;return Hl<<=1,(Hl&62914560)===0&&(Hl=4194304),e}function ni(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function S(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,a,n,i,u){var c=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,b=e.expirationTimes,O=e.hiddenUpdates;for(a=c&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var wv=/[\n"\\]/g;function aa(e){return e.replace(wv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xu(e,t,a,n,i,u,c,v){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ta(t)):e.value!==""+ta(t)&&(e.value=""+ta(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?Zu(e,c,ta(t)):a!=null?Zu(e,c,ta(a)):n!=null&&e.removeAttribute("value"),i==null&&u!=null&&(e.defaultChecked=!!u),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+ta(v):e.removeAttribute("name")}function Kc(e,t,a,n,i,u,c,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Vu(e);return}a=a!=null?""+ta(a):"",t=t!=null?""+ta(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}n=n??i,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=v?e.checked:!!n,e.defaultChecked=!!n,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),Vu(e)}function Zu(e,t,a){t==="number"&&yr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function hn(e,t,a,n){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$u=!1;if(Ba)try{var ri={};Object.defineProperty(ri,"passive",{get:function(){$u=!0}}),window.addEventListener("test",ri,ri),window.removeEventListener("test",ri,ri)}catch{$u=!1}var il=null,Wu=null,pr=null;function Ic(){if(pr)return pr;var e,t=Wu,a=t.length,n,i="value"in il?il.value:il.textContent,u=i.length;for(e=0;e=si),rf=" ",uf=!1;function of(e,t){switch(e){case"keyup":return tp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pn=!1;function lp(e,t){switch(e){case"compositionend":return sf(t);case"keypress":return t.which!==32?null:(uf=!0,rf);case"textInput":return e=t.data,e===rf&&uf?null:e;default:return null}}function np(e,t){if(pn)return e==="compositionend"||!ao&&of(e,t)?(e=Ic(),pr=Wu=il=null,pn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=pf(a)}}function bf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=yr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=yr(e.document)}return t}function io(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var dp=Ba&&"documentMode"in document&&11>=document.documentMode,gn=null,ro=null,hi=null,uo=!1;function Ef(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;uo||gn==null||gn!==yr(n)||(n=gn,"selectionStart"in n&&io(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),hi&&di(hi,n)||(hi=n,n=cu(ro,"onSelect"),0>=c,i-=c,wa=1<<32-_t(t)+i|a<Me?(je=oe,oe=null):je=oe.sibling;var qe=_(R,oe,A[Me],q);if(qe===null){oe===null&&(oe=je);break}e&&oe&&qe.alternate===null&&t(R,oe),T=u(qe,T,Me),Be===null?me=qe:Be.sibling=qe,Be=qe,oe=je}if(Me===A.length)return a(R,oe),Le&&Qa(R,Me),me;if(oe===null){for(;MeMe?(je=oe,oe=null):je=oe.sibling;var wl=_(R,oe,qe.value,q);if(wl===null){oe===null&&(oe=je);break}e&&oe&&wl.alternate===null&&t(R,oe),T=u(wl,T,Me),Be===null?me=wl:Be.sibling=wl,Be=wl,oe=je}if(qe.done)return a(R,oe),Le&&Qa(R,Me),me;if(oe===null){for(;!qe.done;Me++,qe=A.next())qe=Y(R,qe.value,q),qe!==null&&(T=u(qe,T,Me),Be===null?me=qe:Be.sibling=qe,Be=qe);return Le&&Qa(R,Me),me}for(oe=n(oe);!qe.done;Me++,qe=A.next())qe=j(oe,R,Me,qe.value,q),qe!==null&&(e&&qe.alternate!==null&&oe.delete(qe.key===null?Me:qe.key),T=u(qe,T,Me),Be===null?me=qe:Be.sibling=qe,Be=qe);return e&&oe.forEach(function(_g){return t(R,_g)}),Le&&Qa(R,Me),me}function Fe(R,T,A,q){if(typeof A=="object"&&A!==null&&A.type===Q&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case N:e:{for(var me=A.key;T!==null;){if(T.key===me){if(me=A.type,me===Q){if(T.tag===7){a(R,T.sibling),q=i(T,A.props.children),q.return=R,R=q;break e}}else if(T.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===K&&$l(me)===T.type){a(R,T.sibling),q=i(T,A.props),bi(q,A),q.return=R,R=q;break e}a(R,T);break}else t(R,T);T=T.sibling}A.type===Q?(q=Zl(A.props.children,R.mode,q,A.key),q.return=R,R=q):(q=wr(A.type,A.key,A.props,null,R.mode,q),bi(q,A),q.return=R,R=q)}return c(R);case B:e:{for(me=A.key;T!==null;){if(T.key===me)if(T.tag===4&&T.stateNode.containerInfo===A.containerInfo&&T.stateNode.implementation===A.implementation){a(R,T.sibling),q=i(T,A.children||[]),q.return=R,R=q;break e}else{a(R,T);break}else t(R,T);T=T.sibling}q=yo(A,R.mode,q),q.return=R,R=q}return c(R);case K:return A=$l(A),Fe(R,T,A,q)}if(Qe(A))return ne(R,T,A,q);if($e(A)){if(me=$e(A),typeof me!="function")throw Error(s(150));return A=me.call(A),ge(R,T,A,q)}if(typeof A.then=="function")return Fe(R,T,Ur(A),q);if(A.$$typeof===ee)return Fe(R,T,Or(R,A),q);jr(R,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,T!==null&&T.tag===6?(a(R,T.sibling),q=i(T,A),q.return=R,R=q):(a(R,T),q=mo(A,R.mode,q),q.return=R,R=q),c(R)):a(R,T)}return function(R,T,A,q){try{gi=0;var me=Fe(R,T,A,q);return An=null,me}catch(oe){if(oe===Cn||oe===_r)throw oe;var Be=Xt(29,oe,null,R.mode);return Be.lanes=q,Be.return=R,Be}finally{}}}var Pl=Xf(!0),Zf=Xf(!1),cl=!1;function wo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dl(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ge&2)!==0){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,t=zr(e),Cf(e,null,a),t}return Mr(e,n,t,a),zr(e)}function Si(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,J(e,a)}}function Ao(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var i=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var c={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?i=u=c:u=u.next=c,a=a.next}while(a!==null);u===null?i=u=t:u=u.next=t}else i=u=t;a={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:u,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Oo=!1;function Ei(){if(Oo){var e=wn;if(e!==null)throw e}}function xi(e,t,a,n){Oo=!1;var i=e.updateQueue;cl=!1;var u=i.firstBaseUpdate,c=i.lastBaseUpdate,v=i.shared.pending;if(v!==null){i.shared.pending=null;var b=v,O=b.next;b.next=null,c===null?u=O:c.next=O,c=b;var H=e.alternate;H!==null&&(H=H.updateQueue,v=H.lastBaseUpdate,v!==c&&(v===null?H.firstBaseUpdate=O:v.next=O,H.lastBaseUpdate=b))}if(u!==null){var Y=i.baseState;c=0,H=O=b=null,v=u;do{var _=v.lane&-536870913,j=_!==v.lane;if(j?(Ue&_)===_:(n&_)===_){_!==0&&_===zn&&(Oo=!0),H!==null&&(H=H.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ne=e,ge=v;_=t;var Fe=a;switch(ge.tag){case 1:if(ne=ge.payload,typeof ne=="function"){Y=ne.call(Fe,Y,_);break e}Y=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=ge.payload,_=typeof ne=="function"?ne.call(Fe,Y,_):ne,_==null)break e;Y=E({},Y,_);break e;case 2:cl=!0}}_=v.callback,_!==null&&(e.flags|=64,j&&(e.flags|=8192),j=i.callbacks,j===null?i.callbacks=[_]:j.push(_))}else j={lane:_,tag:v.tag,payload:v.payload,callback:v.callback,next:null},H===null?(O=H=j,b=Y):H=H.next=j,c|=_;if(v=v.next,v===null){if(v=i.shared.pending,v===null)break;j=v,v=j.next,j.next=null,i.lastBaseUpdate=j,i.shared.pending=null}}while(!0);H===null&&(b=Y),i.baseState=b,i.firstBaseUpdate=O,i.lastBaseUpdate=H,u===null&&(i.shared.lanes=0),pl|=c,e.lanes=c,e.memoizedState=Y}}function Kf(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function kf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;eu?u:8;var c=C.T,v={};C.T=v,Fo(e,!1,t,a);try{var b=i(),O=C.S;if(O!==null&&O(v,b),b!==null&&typeof b=="object"&&typeof b.then=="function"){var H=Ep(b,n);Mi(e,t,H,Ft(e))}else Mi(e,t,n,Ft(e))}catch(Y){Mi(e,t,{then:function(){},status:"rejected",reason:Y},Ft())}finally{k.p=u,c!==null&&v.types!==null&&(c.types=v.types),C.T=c}}function wp(){}function ko(e,t,a,n){if(e.tag!==5)throw Error(s(476));var i=Md(e).queue;Rd(e,i,t,G,a===null?wp:function(){return zd(e),a(n)})}function Md(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:G},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zd(e){var t=Md(e);t.next===null&&(t=e.alternate.memoizedState),Mi(e,t.next.queue,{},Ft())}function Jo(){return xt(Gi)}function wd(){return ot().memoizedState}function Cd(){return ot().memoizedState}function Cp(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ft();e=fl(a);var n=dl(t,e,a);n!==null&&(Qt(n,t,a),Si(n,t,a)),t={cache:To()},e.payload=t;return}t=t.return}}function Ap(e,t,a){var n=Ft();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zr(e)?Od(t,a):(a=fo(e,t,a,n),a!==null&&(Qt(a,e,n),Dd(a,t,n)))}function Ad(e,t,a){var n=Ft();Mi(e,t,a,n)}function Mi(e,t,a,n){var i={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zr(e))Od(t,i);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var c=t.lastRenderedState,v=u(c,a);if(i.hasEagerState=!0,i.eagerState=v,Vt(v,c))return Mr(e,t,i,0),Pe===null&&Rr(),!1}catch{}finally{}if(a=fo(e,t,i,n),a!==null)return Qt(a,e,n),Dd(a,t,n),!0}return!1}function Fo(e,t,a,n){if(n={lane:2,revertLane:ws(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Zr(e)){if(t)throw Error(s(479))}else t=fo(e,a,n,2),t!==null&&Qt(t,e,2)}function Zr(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Od(e,t){Dn=Br=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Dd(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,J(e,a)}}var zi={readContext:xt,use:Yr,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useLayoutEffect:nt,useInsertionEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useSyncExternalStore:nt,useId:nt,useHostTransitionStatus:nt,useFormState:nt,useActionState:nt,useOptimistic:nt,useMemoCache:nt,useCacheRefresh:nt};zi.useEffectEvent=nt;var _d={readContext:xt,use:Yr,useCallback:function(e,t){return Ut().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:yd,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Vr(4194308,4,bd.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Vr(4194308,4,e,t)},useInsertionEffect:function(e,t){Vr(4,2,e,t)},useMemo:function(e,t){var a=Ut();t=t===void 0?null:t;var n=e();if(Il){va(!0);try{e()}finally{va(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=Ut();if(a!==void 0){var i=a(t);if(Il){va(!0);try{a(t)}finally{va(!1)}}}else i=t;return n.memoizedState=n.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},n.queue=e,e=e.dispatch=Ap.bind(null,Te,e),[n.memoizedState,e]},useRef:function(e){var t=Ut();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,a=Ad.bind(null,Te,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Zo,useDeferredValue:function(e,t){var a=Ut();return Ko(a,e,t)},useTransition:function(){var e=Go(!1);return e=Rd.bind(null,Te,e.queue,!0,!1),Ut().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Te,i=Ut();if(Le){if(a===void 0)throw Error(s(407));a=a()}else{if(a=t(),Pe===null)throw Error(s(349));(Ue&127)!==0||If(n,t,a)}i.memoizedState=a;var u={value:a,getSnapshot:t};return i.queue=u,yd(td.bind(null,n,u,e),[e]),n.flags|=2048,Nn(9,{destroy:void 0},ed.bind(null,n,u,a,t),null),a},useId:function(){var e=Ut(),t=Pe.identifierPrefix;if(Le){var a=Ca,n=wa;a=(n&~(1<<32-_t(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=qr++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof n.is=="string"?c.createElement("select",{is:n.is}):c.createElement("select"),n.multiple?u.multiple=!0:n.size&&(u.size=n.size);break;default:u=typeof n.is=="string"?c.createElement(i,{is:n.is}):c.createElement(i)}}u[te]=t,u[ae]=n;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=u;e:switch(Rt(u,i,n),i){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Ka(t)}}return tt(t),ss(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Ka(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(s(166));if(e=be.current,Rn(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,i=Et,i!==null)switch(i.tag){case 27:case 5:n=i.memoizedProps}e[te]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Wh(e.nodeValue,a)),e||ol(t,!0)}else e=fu(e).createTextNode(n),e[te]=t,t.stateNode=e}return tt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Rn(t),a!==null){if(e===null){if(!n)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[te]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tt(t),e=!1}else a=bo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Kt(t),t):(Kt(t),null);if((t.flags&128)!==0)throw Error(s(558))}return tt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Rn(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));i[te]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tt(t),i=!1}else i=bo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Kt(t),t):(Kt(t),null)}return Kt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,i=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(i=n.alternate.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==i&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),$r(t,t.updateQueue),tt(t),null);case 4:return Ze(),e===null&&Ds(t.stateNode.containerInfo),tt(t),null;case 10:return Ga(t.type),tt(t),null;case 19:if(L(ut),n=t.memoizedState,n===null)return tt(t),null;if(i=(t.flags&128)!==0,u=n.rendering,u===null)if(i)Ci(n,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Hr(e),u!==null){for(t.flags|=128,Ci(n,!1),e=u.updateQueue,t.updateQueue=e,$r(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Af(a,e),a=a.sibling;return Z(ut,ut.current&1|2),Le&&Qa(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&zt()>tu&&(t.flags|=128,i=!0,Ci(n,!1),t.lanes=4194304)}else{if(!i)if(e=Hr(u),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,$r(t,e),Ci(n,!0),n.tail===null&&n.tailMode==="hidden"&&!u.alternate&&!Le)return tt(t),null}else 2*zt()-n.renderingStartTime>tu&&a!==536870912&&(t.flags|=128,i=!0,Ci(n,!1),t.lanes=4194304);n.isBackwards?(u.sibling=t.child,t.child=u):(e=n.last,e!==null?e.sibling=u:t.child=u,n.last=u)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=zt(),e.sibling=null,a=ut.current,Z(ut,i?a&1|2:a&1),Le&&Qa(t,n.treeForkCount),e):(tt(t),null);case 22:case 23:return Kt(t),_o(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),a=t.updateQueue,a!==null&&$r(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&L(Fl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ga(ft),tt(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Up(e,t){switch(po(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ga(ft),Ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ot(t),null;case 31:if(t.memoizedState!==null){if(Kt(t),t.alternate===null)throw Error(s(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(ut),null;case 4:return Ze(),null;case 10:return Ga(t.type),null;case 22:case 23:return Kt(t),_o(),e!==null&&L(Fl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ga(ft),null;case 25:return null;default:return null}}function ah(e,t){switch(po(t),t.tag){case 3:Ga(ft),Ze();break;case 26:case 27:case 5:Ot(t);break;case 4:Ze();break;case 31:t.memoizedState!==null&&Kt(t);break;case 13:Kt(t);break;case 19:L(ut);break;case 10:Ga(t.type);break;case 22:case 23:Kt(t),_o(),e!==null&&L(Fl);break;case 24:Ga(ft)}}function Ai(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var i=n.next;a=i;do{if((a.tag&e)===e){n=void 0;var u=a.create,c=a.inst;n=u(),c.destroy=n}a=a.next}while(a!==i)}}catch(v){Xe(t,t.return,v)}}function yl(e,t,a){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){var c=n.inst,v=c.destroy;if(v!==void 0){c.destroy=void 0,i=t;var b=a,O=v;try{O()}catch(H){Xe(i,b,H)}}}n=n.next}while(n!==u)}}catch(H){Xe(t,t.return,H)}}function lh(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{kf(t,a)}catch(n){Xe(e,e.return,n)}}}function nh(e,t,a){a.props=en(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Xe(e,t,n)}}function Oi(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(i){Xe(e,t,i)}}function Aa(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(i){Xe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Xe(e,t,i)}else a.current=null}function ih(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(i){Xe(e,e.return,i)}}function cs(e,t,a){try{var n=e.stateNode;ag(n,e.type,a,t),n[ae]=t}catch(i){Xe(e,e.return,i)}}function rh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xl(e.type)||e.tag===4}function fs(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&xl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ds(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ha));else if(n!==4&&(n===27&&xl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ds(e,t,a),e=e.sibling;e!==null;)ds(e,t,a),e=e.sibling}function Wr(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&xl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Wr(e,t,a),e=e.sibling;e!==null;)Wr(e,t,a),e=e.sibling}function uh(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rt(t,n,a),t[te]=e,t[ae]=a}catch(u){Xe(e,e.return,u)}}var ka=!1,mt=!1,hs=!1,oh=typeof WeakSet=="function"?WeakSet:Set,bt=null;function jp(e,t){if(e=e.containerInfo,Us=gu,e=Sf(e),io(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var i=n.anchorOffset,u=n.focusNode;n=n.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var c=0,v=-1,b=-1,O=0,H=0,Y=e,_=null;t:for(;;){for(var j;Y!==a||i!==0&&Y.nodeType!==3||(v=c+i),Y!==u||n!==0&&Y.nodeType!==3||(b=c+n),Y.nodeType===3&&(c+=Y.nodeValue.length),(j=Y.firstChild)!==null;)_=Y,Y=j;for(;;){if(Y===e)break t;if(_===a&&++O===i&&(v=c),_===u&&++H===n&&(b=c),(j=Y.nextSibling)!==null)break;Y=_,_=Y.parentNode}Y=j}a=v===-1||b===-1?null:{start:v,end:b}}else a=null}a=a||{start:0,end:0}}else a=null;for(js={focusedElem:e,selectionRange:a},gu=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),Rt(u,n,a),u[te]=e,at(u),n=u;break e;case"link":var c=mm("link","href",i).get(n+(a.href||""));if(c){for(var v=0;vFe&&(c=Fe,Fe=ge,ge=c);var R=gf(v,ge),T=gf(v,Fe);if(R&&T&&(j.rangeCount!==1||j.anchorNode!==R.node||j.anchorOffset!==R.offset||j.focusNode!==T.node||j.focusOffset!==T.offset)){var A=Y.createRange();A.setStart(R.node,R.offset),j.removeAllRanges(),ge>Fe?(j.addRange(A),j.extend(T.node,T.offset)):(A.setEnd(T.node,T.offset),j.addRange(A))}}}}for(Y=[],j=v;j=j.parentNode;)j.nodeType===1&&Y.push({element:j,left:j.scrollLeft,top:j.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;va?32:a,C.T=null,a=Ss,Ss=null;var u=bl,c=Pa;if(vt=0,Bn=bl=null,Pa=0,(Ge&6)!==0)throw Error(s(331));var v=Ge;if(Ge|=4,bh(u.current),vh(u,u.current,c,a),Ge=v,Li(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(ll,u)}catch{}return!0}finally{k.p=i,C.T=n,Hh(e,t)}}function qh(e,t,a){t=na(a,t),t=Io(e.stateNode,t,2),e=dl(e,t,2),e!==null&&(S(e,2),Oa(e))}function Xe(e,t,a){if(e.tag===3)qh(e,e,a);else for(;t!==null;){if(t.tag===3){qh(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(gl===null||!gl.has(n))){e=na(a,e),a=Qd(2),n=dl(t,a,2),n!==null&&(Yd(a,n,t,e),S(n,2),Oa(n));break}}t=t.return}}function Rs(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new Bp;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(a)||(vs=!0,i.add(a),e=Vp.bind(null,e,t,a),t.then(e,e))}function Vp(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Pe===e&&(Ue&a)===a&&(it===4||it===3&&(Ue&62914560)===Ue&&300>zt()-eu?(Ge&2)===0&&qn(e,0):ps|=a,Hn===Ue&&(Hn=0)),Oa(e)}function Qh(e,t){t===0&&(t=mr()),e=Xl(e,t),e!==null&&(S(e,t),Oa(e))}function Xp(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Qh(e,a)}function Zp(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(s(314))}n!==null&&n.delete(t),Qh(e,a)}function Kp(e,t){return ti(e,t)}var uu=null,Yn=null,Ms=!1,ou=!1,zs=!1,El=0;function Oa(e){e!==Yn&&e.next===null&&(Yn===null?uu=Yn=e:Yn=Yn.next=e),ou=!0,Ms||(Ms=!0,Jp())}function Li(e,t){if(!zs&&ou){zs=!0;do for(var a=!1,n=uu;n!==null;){if(e!==0){var i=n.pendingLanes;if(i===0)var u=0;else{var c=n.suspendedLanes,v=n.pingedLanes;u=(1<<31-_t(42|e)+1)-1,u&=i&~(c&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,Xh(n,u))}else u=Ue,u=Bl(n,n===Pe?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(u&3)===0||Ta(n,u)||(a=!0,Xh(n,u));n=n.next}while(a);zs=!1}}function kp(){Yh()}function Yh(){ou=Ms=!1;var e=0;El!==0&&ng()&&(e=El);for(var t=zt(),a=null,n=uu;n!==null;){var i=n.next,u=Gh(n,t);u===0?(n.next=null,a===null?uu=i:a.next=i,i===null&&(Yn=a)):(a=n,(e!==0||(u&3)!==0)&&(ou=!0)),n=i}vt!==0&&vt!==5||Li(e),El!==0&&(El=0)}function Gh(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,u=e.pendingLanes&-62914561;0v)break;var H=b.transferSize,Y=b.initiatorType;H&&Ph(Y)&&(b=b.responseEnd,c+=H*(b"u"?null:document;function cm(e,t,a){var n=Gn;if(n&&typeof t=="string"&&t){var i=aa(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),sm.has(i)||(sm.add(i),e={rel:e,crossOrigin:a,href:t},n.querySelector(i)===null&&(t=n.createElement("link"),Rt(t,"link",e),at(t),n.head.appendChild(t)))}}function hg(e){Ia.D(e),cm("dns-prefetch",e,null)}function mg(e,t){Ia.C(e,t),cm("preconnect",e,t)}function yg(e,t,a){Ia.L(e,t,a);var n=Gn;if(n&&e&&t){var i='link[rel="preload"][as="'+aa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+aa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+aa(a.imageSizes)+'"]')):i+='[href="'+aa(e)+'"]';var u=i;switch(t){case"style":u=Vn(e);break;case"script":u=Xn(e)}ca.has(u)||(e=E({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ca.set(u,e),n.querySelector(i)!==null||t==="style"&&n.querySelector(Qi(u))||t==="script"&&n.querySelector(Yi(u))||(t=n.createElement("link"),Rt(t,"link",e),at(t),n.head.appendChild(t)))}}function vg(e,t){Ia.m(e,t);var a=Gn;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+aa(n)+'"][href="'+aa(e)+'"]',u=i;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Xn(e)}if(!ca.has(u)&&(e=E({rel:"modulepreload",href:e},t),ca.set(u,e),a.querySelector(i)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yi(u)))return}n=a.createElement("link"),Rt(n,"link",e),at(n),a.head.appendChild(n)}}}function pg(e,t,a){Ia.S(e,t,a);var n=Gn;if(n&&e){var i=Ra(n).hoistableStyles,u=Vn(e);t=t||"default";var c=i.get(u);if(!c){var v={loading:0,preload:null};if(c=n.querySelector(Qi(u)))v.loading=5;else{e=E({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ca.get(u))&&Gs(e,a);var b=c=n.createElement("link");at(b),Rt(b,"link",e),b._p=new Promise(function(O,H){b.onload=O,b.onerror=H}),b.addEventListener("load",function(){v.loading|=1}),b.addEventListener("error",function(){v.loading|=2}),v.loading|=4,hu(c,t,n)}c={type:"stylesheet",instance:c,count:1,state:v},i.set(u,c)}}}function gg(e,t){Ia.X(e,t);var a=Gn;if(a&&e){var n=Ra(a).hoistableScripts,i=Xn(e),u=n.get(i);u||(u=a.querySelector(Yi(i)),u||(e=E({src:e,async:!0},t),(t=ca.get(i))&&Vs(e,t),u=a.createElement("script"),at(u),Rt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(i,u))}}function bg(e,t){Ia.M(e,t);var a=Gn;if(a&&e){var n=Ra(a).hoistableScripts,i=Xn(e),u=n.get(i);u||(u=a.querySelector(Yi(i)),u||(e=E({src:e,async:!0,type:"module"},t),(t=ca.get(i))&&Vs(e,t),u=a.createElement("script"),at(u),Rt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(i,u))}}function fm(e,t,a,n){var i=(i=be.current)?du(i):null;if(!i)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Vn(a.href),a=Ra(i).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Vn(a.href);var u=Ra(i).hoistableStyles,c=u.get(e);if(c||(i=i.ownerDocument||i,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,c),(u=i.querySelector(Qi(e)))&&!u._p&&(c.instance=u,c.state.loading=5),ca.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ca.set(e,a),u||Sg(i,e,a,c.state))),t&&n===null)throw Error(s(528,""));return c}if(t&&n!==null)throw Error(s(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Xn(a),a=Ra(i).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Vn(e){return'href="'+aa(e)+'"'}function Qi(e){return'link[rel="stylesheet"]['+e+"]"}function dm(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function Sg(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Rt(t,"link",a),at(t),e.head.appendChild(t))}function Xn(e){return'[src="'+aa(e)+'"]'}function Yi(e){return"script[async]"+e}function hm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+aa(a.href)+'"]');if(n)return t.instance=n,at(n),n;var i=E({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),at(n),Rt(n,"style",i),hu(n,a.precedence,e),t.instance=n;case"stylesheet":i=Vn(a.href);var u=e.querySelector(Qi(i));if(u)return t.state.loading|=4,t.instance=u,at(u),u;n=dm(a),(i=ca.get(i))&&Gs(n,i),u=(e.ownerDocument||e).createElement("link"),at(u);var c=u;return c._p=new Promise(function(v,b){c.onload=v,c.onerror=b}),Rt(u,"link",n),t.state.loading|=4,hu(u,a.precedence,e),t.instance=u;case"script":return u=Xn(a.src),(i=e.querySelector(Yi(u)))?(t.instance=i,at(i),i):(n=a,(i=ca.get(u))&&(n=E({},a),Vs(n,i)),e=e.ownerDocument||e,i=e.createElement("script"),at(i),Rt(i,"link",n),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,hu(n,a.precedence,e));return t.instance}function hu(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=n.length?n[n.length-1]:null,u=i,c=0;c title"):null)}function Eg(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function vm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function xg(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=Vn(n.href),u=t.querySelector(Qi(i));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=yu.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,at(u);return}u=t.ownerDocument||t,n=dm(n),(i=ca.get(i))&&Gs(n,i),u=u.createElement("link"),at(u);var c=u;c._p=new Promise(function(v,b){c.onload=v,c.onerror=b}),Rt(u,"link",n),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=yu.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Xs=0;function Tg(e,t){return e.stylesheets&&e.count===0&&pu(e,e.stylesheets),0Xs?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(i)}}:null}function yu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vu=null;function pu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vu=new Map,t.forEach(Rg,e),vu=null,yu.call(e))}function Rg(e,t){if(!(t.state.loading&4)){var a=vu.get(e);if(a)var n=a.get(null);else{a=new Map,vu.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(r){console.error(r)}}return l(),Is.exports=qg(),Is.exports}var Yg=Qg(),nr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(l){return this.listeners.add(l),this.onSubscribe(),()=>{this.listeners.delete(l),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gg={setTimeout:(l,r)=>setTimeout(l,r),clearTimeout:l=>clearTimeout(l),setInterval:(l,r)=>setInterval(l,r),clearInterval:l=>clearInterval(l)},Vg=class{#e=Gg;#t=!1;setTimeoutProvider(l){this.#e=l}setTimeout(l,r){return this.#e.setTimeout(l,r)}clearTimeout(l){this.#e.clearTimeout(l)}setInterval(l,r){return this.#e.setInterval(l,r)}clearInterval(l){this.#e.clearInterval(l)}},nn=new Vg;function Xg(l){setTimeout(l,0)}var un=typeof window>"u"||"Deno"in globalThis;function Yt(){}function Zg(l,r){return typeof l=="function"?l(r):l}function cc(l){return typeof l=="number"&&l>=0&&l!==1/0}function zy(l,r){return Math.max(l+(r||0)-Date.now(),0)}function Dl(l,r){return typeof l=="function"?l(r):l}function da(l,r){return typeof l=="function"?l(r):l}function Qm(l,r){const{type:o="all",exact:s,fetchStatus:f,predicate:d,queryKey:h,stale:p}=l;if(h){if(s){if(r.queryHash!==zc(h,r.options))return!1}else if(!er(r.queryKey,h))return!1}if(o!=="all"){const y=r.isActive();if(o==="active"&&!y||o==="inactive"&&y)return!1}return!(typeof p=="boolean"&&r.isStale()!==p||f&&f!==r.state.fetchStatus||d&&!d(r))}function Ym(l,r){const{exact:o,status:s,predicate:f,mutationKey:d}=l;if(d){if(!r.options.mutationKey)return!1;if(o){if(Ii(r.options.mutationKey)!==Ii(d))return!1}else if(!er(r.options.mutationKey,d))return!1}return!(s&&r.state.status!==s||f&&!f(r))}function zc(l,r){return(r?.queryKeyHashFn||Ii)(l)}function Ii(l){return JSON.stringify(l,(r,o)=>dc(o)?Object.keys(o).sort().reduce((s,f)=>(s[f]=o[f],s),{}):o)}function er(l,r){return l===r?!0:typeof l!=typeof r?!1:l&&r&&typeof l=="object"&&typeof r=="object"?Object.keys(r).every(o=>er(l[o],r[o])):!1}var Kg=Object.prototype.hasOwnProperty;function wy(l,r){if(l===r)return l;const o=Gm(l)&&Gm(r);if(!o&&!(dc(l)&&dc(r)))return r;const f=(o?l:Object.keys(l)).length,d=o?r:Object.keys(r),h=d.length,p=o?new Array(h):{};let y=0;for(let m=0;m{nn.setTimeout(r,l)})}function hc(l,r,o){return typeof o.structuralSharing=="function"?o.structuralSharing(l,r):o.structuralSharing!==!1?wy(l,r):r}function Jg(l,r,o=0){const s=[...l,r];return o&&s.length>o?s.slice(1):s}function Fg(l,r,o=0){const s=[r,...l];return o&&s.length>o?s.slice(0,-1):s}var wc=Symbol();function Cy(l,r){return!l.queryFn&&r?.initialPromise?()=>r.initialPromise:!l.queryFn||l.queryFn===wc?()=>Promise.reject(new Error(`Missing queryFn: '${l.queryHash}'`)):l.queryFn}function $g(l,r){return typeof l=="function"?l(...r):!!l}var Wg=class extends nr{#e;#t;#a;constructor(){super(),this.#a=l=>{if(!un&&window.addEventListener){const r=()=>l();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#a)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(l){this.#a=l,this.#t?.(),this.#t=l(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(l){this.#e!==l&&(this.#e=l,this.onFocus())}onFocus(){const l=this.isFocused();this.listeners.forEach(r=>{r(l)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Cc=new Wg;function mc(){let l,r;const o=new Promise((f,d)=>{l=f,r=d});o.status="pending",o.catch(()=>{});function s(f){Object.assign(o,f),delete o.resolve,delete o.reject}return o.resolve=f=>{s({status:"fulfilled",value:f}),l(f)},o.reject=f=>{s({status:"rejected",reason:f}),r(f)},o}var Pg=Xg;function Ig(){let l=[],r=0,o=p=>{p()},s=p=>{p()},f=Pg;const d=p=>{r?l.push(p):f(()=>{o(p)})},h=()=>{const p=l;l=[],p.length&&f(()=>{s(()=>{p.forEach(y=>{o(y)})})})};return{batch:p=>{let y;r++;try{y=p()}finally{r--,r||h()}return y},batchCalls:p=>(...y)=>{d(()=>{p(...y)})},schedule:d,setNotifyFunction:p=>{o=p},setBatchNotifyFunction:p=>{s=p},setScheduler:p=>{f=p}}}var Mt=Ig(),e0=class extends nr{#e=!0;#t;#a;constructor(){super(),this.#a=l=>{if(!un&&window.addEventListener){const r=()=>l(!0),o=()=>l(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}}}}onSubscribe(){this.#t||this.setEventListener(this.#a)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(l){this.#a=l,this.#t?.(),this.#t=l(this.setOnline.bind(this))}setOnline(l){this.#e!==l&&(this.#e=l,this.listeners.forEach(o=>{o(l)}))}isOnline(){return this.#e}},ju=new e0;function t0(l){return Math.min(1e3*2**l,3e4)}function Ay(l){return(l??"online")==="online"?ju.isOnline():!0}var yc=class extends Error{constructor(l){super("CancelledError"),this.revert=l?.revert,this.silent=l?.silent}};function Oy(l){let r=!1,o=0,s;const f=mc(),d=()=>f.status!=="pending",h=Q=>{if(!d()){const V=new yc(Q);M(V),l.onCancel?.(V)}},p=()=>{r=!0},y=()=>{r=!1},m=()=>Cc.isFocused()&&(l.networkMode==="always"||ju.isOnline())&&l.canRun(),g=()=>Ay(l.networkMode)&&l.canRun(),E=Q=>{d()||(s?.(),f.resolve(Q))},M=Q=>{d()||(s?.(),f.reject(Q))},N=()=>new Promise(Q=>{s=V=>{(d()||m())&&Q(V)},l.onPause?.()}).then(()=>{s=void 0,d()||l.onContinue?.()}),B=()=>{if(d())return;let Q;const V=o===0?l.initialPromise:void 0;try{Q=V??l.fn()}catch(X){Q=Promise.reject(X)}Promise.resolve(Q).then(E).catch(X=>{if(d())return;const W=l.retry??(un?0:3),ee=l.retryDelay??t0,ve=typeof ee=="function"?ee(o,X):ee,le=W===!0||typeof W=="number"&&om()?void 0:N()).then(()=>{r?M(X):B()})})};return{promise:f,status:()=>f.status,cancel:h,continue:()=>(s?.(),f),cancelRetry:p,continueRetry:y,canStart:g,start:()=>(g()?B():N().then(B),f)}}var Dy=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cc(this.gcTime)&&(this.#e=nn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(l){this.gcTime=Math.max(this.gcTime||0,l??(un?1/0:300*1e3))}clearGcTimeout(){this.#e&&(nn.clearTimeout(this.#e),this.#e=void 0)}},a0=class extends Dy{#e;#t;#a;#n;#l;#u;#r;constructor(l){super(),this.#r=!1,this.#u=l.defaultOptions,this.setOptions(l.options),this.observers=[],this.#n=l.client,this.#a=this.#n.getQueryCache(),this.queryKey=l.queryKey,this.queryHash=l.queryHash,this.#e=Xm(this.options),this.state=l.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(l){if(this.options={...this.#u,...l},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Xm(this.options);r.data!==void 0&&(this.setData(r.data,{updatedAt:r.dataUpdatedAt,manual:!0}),this.#e=r)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(l,r){const o=hc(this.state.data,l,this.options);return this.#i({data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(l,r){this.#i({type:"setState",state:l,setStateOptions:r})}cancel(l){const r=this.#l?.promise;return this.#l?.cancel(l),r?r.then(Yt).catch(Yt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(l=>da(l.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(l=>Dl(l.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(l=>l.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(l=0){return this.state.data===void 0?!0:l==="static"?!1:this.state.isInvalidated?!0:!zy(this.state.dataUpdatedAt,l)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(l){this.observers.includes(l)||(this.observers.push(l),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:l}))}removeObserver(l){this.observers.includes(l)&&(this.observers=this.observers.filter(r=>r!==l),this.observers.length||(this.#l&&(this.#r?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:l}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(l,r){if(this.state.fetchStatus!=="idle"&&this.#l?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(l&&this.setOptions(l),!this.options.queryFn){const p=this.observers.find(y=>y.options.queryFn);p&&this.setOptions(p.options)}const o=new AbortController,s=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(this.#r=!0,o.signal)})},f=()=>{const p=Cy(this.options,r),m=(()=>{const g={client:this.#n,queryKey:this.queryKey,meta:this.meta};return s(g),g})();return this.#r=!1,this.options.persister?this.options.persister(p,m,this):p(m)},h=(()=>{const p={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:f};return s(p),p})();this.options.behavior?.onFetch(h,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==h.fetchOptions?.meta)&&this.#i({type:"fetch",meta:h.fetchOptions?.meta}),this.#l=Oy({initialPromise:r?.initialPromise,fn:h.fetchFn,onCancel:p=>{p instanceof yc&&p.revert&&this.setState({...this.#t,fetchStatus:"idle"}),o.abort()},onFail:(p,y)=>{this.#i({type:"failed",failureCount:p,error:y})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0});try{const p=await this.#l.start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),this.#a.config.onSuccess?.(p,this),this.#a.config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof yc){if(p.silent)return this.#l.promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw this.#i({type:"error",error:p}),this.#a.config.onError?.(p,this),this.#a.config.onSettled?.(this.state.data,p,this),p}finally{this.scheduleGc()}}#i(l){const r=o=>{switch(l.type){case"failed":return{...o,fetchFailureCount:l.failureCount,fetchFailureReason:l.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,..._y(o.data,this.options),fetchMeta:l.meta??null};case"success":const s={...o,data:l.data,dataUpdateCount:o.dataUpdateCount+1,dataUpdatedAt:l.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!l.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=l.manual?s:void 0,s;case"error":const f=l.error;return{...o,error:f,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error"};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...l.state}}};this.state=r(this.state),Mt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:l})})}};function _y(l,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ay(r.networkMode)?"fetching":"paused",...l===void 0&&{error:null,status:"pending"}}}function Xm(l){const r=typeof l.initialData=="function"?l.initialData():l.initialData,o=r!==void 0,s=o?typeof l.initialDataUpdatedAt=="function"?l.initialDataUpdatedAt():l.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var l0=class extends nr{constructor(l,r){super(),this.options=r,this.#e=l,this.#i=null,this.#r=mc(),this.bindMethods(),this.setOptions(r)}#e;#t=void 0;#a=void 0;#n=void 0;#l;#u;#r;#i;#y;#d;#h;#s;#c;#o;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Zm(this.#t,this.options)?this.#f():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vc(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vc(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#E(),this.#t.removeObserver(this)}setOptions(l){const r=this.options,o=this.#t;if(this.options=this.#e.defaultQueryOptions(l),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof da(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),r._defaulted&&!fc(this.options,r)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const s=this.hasListeners();s&&Km(this.#t,o,this.options,r)&&this.#f(),this.updateResult(),s&&(this.#t!==o||da(this.options.enabled,this.#t)!==da(r.enabled,this.#t)||Dl(this.options.staleTime,this.#t)!==Dl(r.staleTime,this.#t))&&this.#v();const f=this.#p();s&&(this.#t!==o||da(this.options.enabled,this.#t)!==da(r.enabled,this.#t)||f!==this.#o)&&this.#g(f)}getOptimisticResult(l){const r=this.#e.getQueryCache().build(this.#e,l),o=this.createResult(r,l);return i0(this,o)&&(this.#n=o,this.#u=this.options,this.#l=this.#t.state),o}getCurrentResult(){return this.#n}trackResult(l,r){return new Proxy(l,{get:(o,s)=>(this.trackProp(s),r?.(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,s))})}trackProp(l){this.#m.add(l)}getCurrentQuery(){return this.#t}refetch({...l}={}){return this.fetch({...l})}fetchOptimistic(l){const r=this.#e.defaultQueryOptions(l),o=this.#e.getQueryCache().build(this.#e,r);return o.fetch().then(()=>this.createResult(o,r))}fetch(l){return this.#f({...l,cancelRefetch:l.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(l){this.#x();let r=this.#t.fetch(this.options,l);return l?.throwOnError||(r=r.catch(Yt)),r}#v(){this.#S();const l=Dl(this.options.staleTime,this.#t);if(un||this.#n.isStale||!cc(l))return;const o=zy(this.#n.dataUpdatedAt,l)+1;this.#s=nn.setTimeout(()=>{this.#n.isStale||this.updateResult()},o)}#p(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(l){this.#E(),this.#o=l,!(un||da(this.options.enabled,this.#t)===!1||!cc(this.#o)||this.#o===0)&&(this.#c=nn.setInterval(()=>{(this.options.refetchIntervalInBackground||Cc.isFocused())&&this.#f()},this.#o))}#b(){this.#v(),this.#g(this.#p())}#S(){this.#s&&(nn.clearTimeout(this.#s),this.#s=void 0)}#E(){this.#c&&(nn.clearInterval(this.#c),this.#c=void 0)}createResult(l,r){const o=this.#t,s=this.options,f=this.#n,d=this.#l,h=this.#u,y=l!==o?l.state:this.#a,{state:m}=l;let g={...m},E=!1,M;if(r._optimisticResults){const K=this.hasListeners(),se=!K&&Zm(l,r),Re=K&&Km(l,o,r,s);(se||Re)&&(g={...g,..._y(m.data,l.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:N,errorUpdatedAt:B,status:Q}=g;M=g.data;let V=!1;if(r.placeholderData!==void 0&&M===void 0&&Q==="pending"){let K;f?.isPlaceholderData&&r.placeholderData===h?.placeholderData?(K=f.data,V=!0):K=typeof r.placeholderData=="function"?r.placeholderData(this.#h?.state.data,this.#h):r.placeholderData,K!==void 0&&(Q="success",M=hc(f?.data,K,r),E=!0)}if(r.select&&M!==void 0&&!V)if(f&&M===d?.data&&r.select===this.#y)M=this.#d;else try{this.#y=r.select,M=r.select(M),M=hc(f?.data,M,r),this.#d=M,this.#i=null}catch(K){this.#i=K}this.#i&&(N=this.#i,M=this.#d,B=Date.now(),Q="error");const X=g.fetchStatus==="fetching",W=Q==="pending",ee=Q==="error",ve=W&&X,le=M!==void 0,F={status:Q,fetchStatus:g.fetchStatus,isPending:W,isSuccess:Q==="success",isError:ee,isInitialLoading:ve,isLoading:ve,data:M,dataUpdatedAt:g.dataUpdatedAt,error:N,errorUpdatedAt:B,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>y.dataUpdateCount||g.errorUpdateCount>y.errorUpdateCount,isFetching:X,isRefetching:X&&!W,isLoadingError:ee&&!le,isPaused:g.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:ee&&le,isStale:Ac(l,r),refetch:this.refetch,promise:this.#r,isEnabled:da(r.enabled,l)!==!1};if(this.options.experimental_prefetchInRender){const K=He=>{F.status==="error"?He.reject(F.error):F.data!==void 0&&He.resolve(F.data)},se=()=>{const He=this.#r=F.promise=mc();K(He)},Re=this.#r;switch(Re.status){case"pending":l.queryHash===o.queryHash&&K(Re);break;case"fulfilled":(F.status==="error"||F.data!==Re.value)&&se();break;case"rejected":(F.status!=="error"||F.error!==Re.reason)&&se();break}}return F}updateResult(){const l=this.#n,r=this.createResult(this.#t,this.options);if(this.#l=this.#t.state,this.#u=this.options,this.#l.data!==void 0&&(this.#h=this.#t),fc(r,l))return;this.#n=r;const o=()=>{if(!l)return!0;const{notifyOnChangeProps:s}=this.options,f=typeof s=="function"?s():s;if(f==="all"||!f&&!this.#m.size)return!0;const d=new Set(f??this.#m);return this.options.throwOnError&&d.add("error"),Object.keys(this.#n).some(h=>{const p=h;return this.#n[p]!==l[p]&&d.has(p)})};this.#T({listeners:o()})}#x(){const l=this.#e.getQueryCache().build(this.#e,this.options);if(l===this.#t)return;const r=this.#t;this.#t=l,this.#a=l.state,this.hasListeners()&&(r?.removeObserver(this),l.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#T(l){Mt.batch(()=>{l.listeners&&this.listeners.forEach(r=>{r(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function n0(l,r){return da(r.enabled,l)!==!1&&l.state.data===void 0&&!(l.state.status==="error"&&r.retryOnMount===!1)}function Zm(l,r){return n0(l,r)||l.state.data!==void 0&&vc(l,r,r.refetchOnMount)}function vc(l,r,o){if(da(r.enabled,l)!==!1&&Dl(r.staleTime,l)!=="static"){const s=typeof o=="function"?o(l):o;return s==="always"||s!==!1&&Ac(l,r)}return!1}function Km(l,r,o,s){return(l!==r||da(s.enabled,l)===!1)&&(!o.suspense||l.state.status!=="error")&&Ac(l,o)}function Ac(l,r){return da(r.enabled,l)!==!1&&l.isStaleByTime(Dl(r.staleTime,l))}function i0(l,r){return!fc(l.getCurrentResult(),r)}function km(l){return{onFetch:(r,o)=>{const s=r.options,f=r.fetchOptions?.meta?.fetchMore?.direction,d=r.state.data?.pages||[],h=r.state.data?.pageParams||[];let p={pages:[],pageParams:[]},y=0;const m=async()=>{let g=!1;const E=B=>{Object.defineProperty(B,"signal",{enumerable:!0,get:()=>(r.signal.aborted?g=!0:r.signal.addEventListener("abort",()=>{g=!0}),r.signal)})},M=Cy(r.options,r.fetchOptions),N=async(B,Q,V)=>{if(g)return Promise.reject();if(Q==null&&B.pages.length)return Promise.resolve(B);const W=(()=>{const D={client:r.client,queryKey:r.queryKey,pageParam:Q,direction:V?"backward":"forward",meta:r.options.meta};return E(D),D})(),ee=await M(W),{maxPages:ve}=r.options,le=V?Fg:Jg;return{pages:le(B.pages,ee,ve),pageParams:le(B.pageParams,Q,ve)}};if(f&&d.length){const B=f==="backward",Q=B?r0:Jm,V={pages:d,pageParams:h},X=Q(s,V);p=await N(V,X,B)}else{const B=l??d.length;do{const Q=y===0?h[0]??s.initialPageParam:Jm(s,p);if(y>0&&Q==null)break;p=await N(p,Q),y++}while(yr.options.persister?.(m,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},o):r.fetchFn=m}}}function Jm(l,{pages:r,pageParams:o}){const s=r.length-1;return r.length>0?l.getNextPageParam(r[s],r,o[s],o):void 0}function r0(l,{pages:r,pageParams:o}){return r.length>0?l.getPreviousPageParam?.(r[0],r,o[0],o):void 0}var u0=class extends Dy{#e;#t;#a;#n;constructor(l){super(),this.#e=l.client,this.mutationId=l.mutationId,this.#a=l.mutationCache,this.#t=[],this.state=l.state||o0(),this.setOptions(l.options),this.scheduleGc()}setOptions(l){this.options=l,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(l){this.#t.includes(l)||(this.#t.push(l),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",mutation:this,observer:l}))}removeObserver(l){this.#t=this.#t.filter(r=>r!==l),this.scheduleGc(),this.#a.notify({type:"observerRemoved",mutation:this,observer:l})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#a.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(l){const r=()=>{this.#l({type:"continue"})},o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=Oy({fn:()=>this.options.mutationFn?this.options.mutationFn(l,o):Promise.reject(new Error("No mutationFn found")),onFail:(d,h)=>{this.#l({type:"failed",failureCount:d,error:h})},onPause:()=>{this.#l({type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#a.canRun(this)});const s=this.state.status==="pending",f=!this.#n.canStart();try{if(s)r();else{this.#l({type:"pending",variables:l,isPaused:f}),await this.#a.config.onMutate?.(l,this,o);const h=await this.options.onMutate?.(l,o);h!==this.state.context&&this.#l({type:"pending",context:h,variables:l,isPaused:f})}const d=await this.#n.start();return await this.#a.config.onSuccess?.(d,l,this.state.context,this,o),await this.options.onSuccess?.(d,l,this.state.context,o),await this.#a.config.onSettled?.(d,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(d,null,l,this.state.context,o),this.#l({type:"success",data:d}),d}catch(d){try{throw await this.#a.config.onError?.(d,l,this.state.context,this,o),await this.options.onError?.(d,l,this.state.context,o),await this.#a.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(void 0,d,l,this.state.context,o),d}finally{this.#l({type:"error",error:d})}}finally{this.#a.runNext(this)}}#l(l){const r=o=>{switch(l.type){case"failed":return{...o,failureCount:l.failureCount,failureReason:l.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:l.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:l.isPaused,status:"pending",variables:l.variables,submittedAt:Date.now()};case"success":return{...o,data:l.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:l.error,failureCount:o.failureCount+1,failureReason:l.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Mt.batch(()=>{this.#t.forEach(o=>{o.onMutationUpdate(l)}),this.#a.notify({mutation:this,type:"updated",action:l})})}};function o0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var s0=class extends nr{constructor(l={}){super(),this.config=l,this.#e=new Set,this.#t=new Map,this.#a=0}#e;#t;#a;build(l,r,o){const s=new u0({client:l,mutationCache:this,mutationId:++this.#a,options:l.defaultMutationOptions(r),state:o});return this.add(s),s}add(l){this.#e.add(l);const r=Mu(l);if(typeof r=="string"){const o=this.#t.get(r);o?o.push(l):this.#t.set(r,[l])}this.notify({type:"added",mutation:l})}remove(l){if(this.#e.delete(l)){const r=Mu(l);if(typeof r=="string"){const o=this.#t.get(r);if(o)if(o.length>1){const s=o.indexOf(l);s!==-1&&o.splice(s,1)}else o[0]===l&&this.#t.delete(r)}}this.notify({type:"removed",mutation:l})}canRun(l){const r=Mu(l);if(typeof r=="string"){const s=this.#t.get(r)?.find(f=>f.state.status==="pending");return!s||s===l}else return!0}runNext(l){const r=Mu(l);return typeof r=="string"?this.#t.get(r)?.find(s=>s!==l&&s.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Mt.batch(()=>{this.#e.forEach(l=>{this.notify({type:"removed",mutation:l})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(l){const r={exact:!0,...l};return this.getAll().find(o=>Ym(r,o))}findAll(l={}){return this.getAll().filter(r=>Ym(l,r))}notify(l){Mt.batch(()=>{this.listeners.forEach(r=>{r(l)})})}resumePausedMutations(){const l=this.getAll().filter(r=>r.state.isPaused);return Mt.batch(()=>Promise.all(l.map(r=>r.continue().catch(Yt))))}};function Mu(l){return l.options.scope?.id}var c0=class extends nr{constructor(l={}){super(),this.config=l,this.#e=new Map}#e;build(l,r,o){const s=r.queryKey,f=r.queryHash??zc(s,r);let d=this.get(f);return d||(d=new a0({client:l,queryKey:s,queryHash:f,options:l.defaultQueryOptions(r),state:o,defaultOptions:l.getQueryDefaults(s)}),this.add(d)),d}add(l){this.#e.has(l.queryHash)||(this.#e.set(l.queryHash,l),this.notify({type:"added",query:l}))}remove(l){const r=this.#e.get(l.queryHash);r&&(l.destroy(),r===l&&this.#e.delete(l.queryHash),this.notify({type:"removed",query:l}))}clear(){Mt.batch(()=>{this.getAll().forEach(l=>{this.remove(l)})})}get(l){return this.#e.get(l)}getAll(){return[...this.#e.values()]}find(l){const r={exact:!0,...l};return this.getAll().find(o=>Qm(r,o))}findAll(l={}){const r=this.getAll();return Object.keys(l).length>0?r.filter(o=>Qm(l,o)):r}notify(l){Mt.batch(()=>{this.listeners.forEach(r=>{r(l)})})}onFocus(){Mt.batch(()=>{this.getAll().forEach(l=>{l.onFocus()})})}onOnline(){Mt.batch(()=>{this.getAll().forEach(l=>{l.onOnline()})})}},f0=class{#e;#t;#a;#n;#l;#u;#r;#i;constructor(l={}){this.#e=l.queryCache||new c0,this.#t=l.mutationCache||new s0,this.#a=l.defaultOptions||{},this.#n=new Map,this.#l=new Map,this.#u=0}mount(){this.#u++,this.#u===1&&(this.#r=Cc.subscribe(async l=>{l&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=ju.subscribe(async l=>{l&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#u--,this.#u===0&&(this.#r?.(),this.#r=void 0,this.#i?.(),this.#i=void 0)}isFetching(l){return this.#e.findAll({...l,fetchStatus:"fetching"}).length}isMutating(l){return this.#t.findAll({...l,status:"pending"}).length}getQueryData(l){const r=this.defaultQueryOptions({queryKey:l});return this.#e.get(r.queryHash)?.state.data}ensureQueryData(l){const r=this.defaultQueryOptions(l),o=this.#e.build(this,r),s=o.state.data;return s===void 0?this.fetchQuery(l):(l.revalidateIfStale&&o.isStaleByTime(Dl(r.staleTime,o))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(l){return this.#e.findAll(l).map(({queryKey:r,state:o})=>{const s=o.data;return[r,s]})}setQueryData(l,r,o){const s=this.defaultQueryOptions({queryKey:l}),d=this.#e.get(s.queryHash)?.state.data,h=Zg(r,d);if(h!==void 0)return this.#e.build(this,s).setData(h,{...o,manual:!0})}setQueriesData(l,r,o){return Mt.batch(()=>this.#e.findAll(l).map(({queryKey:s})=>[s,this.setQueryData(s,r,o)]))}getQueryState(l){const r=this.defaultQueryOptions({queryKey:l});return this.#e.get(r.queryHash)?.state}removeQueries(l){const r=this.#e;Mt.batch(()=>{r.findAll(l).forEach(o=>{r.remove(o)})})}resetQueries(l,r){const o=this.#e;return Mt.batch(()=>(o.findAll(l).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...l},r)))}cancelQueries(l,r={}){const o={revert:!0,...r},s=Mt.batch(()=>this.#e.findAll(l).map(f=>f.cancel(o)));return Promise.all(s).then(Yt).catch(Yt)}invalidateQueries(l,r={}){return Mt.batch(()=>(this.#e.findAll(l).forEach(o=>{o.invalidate()}),l?.refetchType==="none"?Promise.resolve():this.refetchQueries({...l,type:l?.refetchType??l?.type??"active"},r)))}refetchQueries(l,r={}){const o={...r,cancelRefetch:r.cancelRefetch??!0},s=Mt.batch(()=>this.#e.findAll(l).filter(f=>!f.isDisabled()&&!f.isStatic()).map(f=>{let d=f.fetch(void 0,o);return o.throwOnError||(d=d.catch(Yt)),f.state.fetchStatus==="paused"?Promise.resolve():d}));return Promise.all(s).then(Yt)}fetchQuery(l){const r=this.defaultQueryOptions(l);r.retry===void 0&&(r.retry=!1);const o=this.#e.build(this,r);return o.isStaleByTime(Dl(r.staleTime,o))?o.fetch(r):Promise.resolve(o.state.data)}prefetchQuery(l){return this.fetchQuery(l).then(Yt).catch(Yt)}fetchInfiniteQuery(l){return l.behavior=km(l.pages),this.fetchQuery(l)}prefetchInfiniteQuery(l){return this.fetchInfiniteQuery(l).then(Yt).catch(Yt)}ensureInfiniteQueryData(l){return l.behavior=km(l.pages),this.ensureQueryData(l)}resumePausedMutations(){return ju.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#a}setDefaultOptions(l){this.#a=l}setQueryDefaults(l,r){this.#n.set(Ii(l),{queryKey:l,defaultOptions:r})}getQueryDefaults(l){const r=[...this.#n.values()],o={};return r.forEach(s=>{er(l,s.queryKey)&&Object.assign(o,s.defaultOptions)}),o}setMutationDefaults(l,r){this.#l.set(Ii(l),{mutationKey:l,defaultOptions:r})}getMutationDefaults(l){const r=[...this.#l.values()],o={};return r.forEach(s=>{er(l,s.mutationKey)&&Object.assign(o,s.defaultOptions)}),o}defaultQueryOptions(l){if(l._defaulted)return l;const r={...this.#a.queries,...this.getQueryDefaults(l.queryKey),...l,_defaulted:!0};return r.queryHash||(r.queryHash=zc(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===wc&&(r.enabled=!1),r}defaultMutationOptions(l){return l?._defaulted?l:{...this.#a.mutations,...l?.mutationKey&&this.getMutationDefaults(l.mutationKey),...l,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ny=z.createContext(void 0),d0=l=>{const r=z.useContext(Ny);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},h0=({client:l,children:r})=>(z.useEffect(()=>(l.mount(),()=>{l.unmount()}),[l]),$.jsx(Ny.Provider,{value:l,children:r})),Uy=z.createContext(!1),m0=()=>z.useContext(Uy);Uy.Provider;function y0(){let l=!1;return{clearReset:()=>{l=!1},reset:()=>{l=!0},isReset:()=>l}}var v0=z.createContext(y0()),p0=()=>z.useContext(v0),g0=(l,r)=>{(l.suspense||l.throwOnError||l.experimental_prefetchInRender)&&(r.isReset()||(l.retryOnMount=!1))},b0=l=>{z.useEffect(()=>{l.clearReset()},[l])},S0=({result:l,errorResetBoundary:r,throwOnError:o,query:s,suspense:f})=>l.isError&&!r.isReset()&&!l.isFetching&&s&&(f&&l.data===void 0||$g(o,[l.error,s])),E0=l=>{if(l.suspense){const o=f=>f==="static"?f:Math.max(f??1e3,1e3),s=l.staleTime;l.staleTime=typeof s=="function"?(...f)=>o(s(...f)):o(s),typeof l.gcTime=="number"&&(l.gcTime=Math.max(l.gcTime,1e3))}},x0=(l,r)=>l.isLoading&&l.isFetching&&!r,T0=(l,r)=>l?.suspense&&r.isPending,Fm=(l,r,o)=>r.fetchOptimistic(l).catch(()=>{o.clearReset()});function R0(l,r,o){const s=m0(),f=p0(),d=d0(),h=d.defaultQueryOptions(l);d.getDefaultOptions().queries?._experimental_beforeQuery?.(h),h._optimisticResults=s?"isRestoring":"optimistic",E0(h),g0(h,f),b0(f);const p=!d.getQueryCache().get(h.queryHash),[y]=z.useState(()=>new r(d,h)),m=y.getOptimisticResult(h),g=!s&&l.subscribed!==!1;if(z.useSyncExternalStore(z.useCallback(E=>{const M=g?y.subscribe(Mt.batchCalls(E)):Yt;return y.updateResult(),M},[y,g]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),z.useEffect(()=>{y.setOptions(h)},[h,y]),T0(h,m))throw Fm(h,y,f);if(S0({result:m,errorResetBoundary:f,throwOnError:h.throwOnError,query:d.getQueryCache().get(h.queryHash),suspense:h.suspense}))throw m.error;return d.getDefaultOptions().queries?._experimental_afterQuery?.(h,m),h.experimental_prefetchInRender&&!un&&x0(m,s)&&(p?Fm(h,y,f):d.getQueryCache().get(h.queryHash)?.promise)?.catch(Yt).finally(()=>{y.updateResult()}),h.notifyOnChangeProps?m:y.trackResult(m)}function Oc(l,r){return R0(l,l0)}/** + * react-router v7.9.4 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var jy=l=>{throw TypeError(l)},M0=(l,r,o)=>r.has(l)||jy("Cannot "+o),lc=(l,r,o)=>(M0(l,r,"read from private field"),o?o.call(l):r.get(l)),z0=(l,r,o)=>r.has(l)?jy("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(l):r.set(l,o),$m="popstate";function w0(l={}){function r(s,f){let{pathname:d,search:h,hash:p}=s.location;return tr("",{pathname:d,search:h,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function o(s,f){return typeof f=="string"?f:_l(f)}return A0(r,o,null,l)}function _e(l,r){if(l===!1||l===null||typeof l>"u")throw new Error(r)}function yt(l,r){if(!l){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function C0(){return Math.random().toString(36).substring(2,10)}function Wm(l,r){return{usr:l.state,key:l.key,idx:r}}function tr(l,r,o=null,s){return{pathname:typeof l=="string"?l:l.pathname,search:"",hash:"",...typeof r=="string"?Nl(r):r,state:o,key:r&&r.key||s||C0()}}function _l({pathname:l="/",search:r="",hash:o=""}){return r&&r!=="?"&&(l+=r.charAt(0)==="?"?r:"?"+r),o&&o!=="#"&&(l+=o.charAt(0)==="#"?o:"#"+o),l}function Nl(l){let r={};if(l){let o=l.indexOf("#");o>=0&&(r.hash=l.substring(o),l=l.substring(0,o));let s=l.indexOf("?");s>=0&&(r.search=l.substring(s),l=l.substring(0,s)),l&&(r.pathname=l)}return r}function A0(l,r,o,s={}){let{window:f=document.defaultView,v5Compat:d=!1}=s,h=f.history,p="POP",y=null,m=g();m==null&&(m=0,h.replaceState({...h.state,idx:m},""));function g(){return(h.state||{idx:null}).idx}function E(){p="POP";let V=g(),X=V==null?null:V-m;m=V,y&&y({action:p,location:Q.location,delta:X})}function M(V,X){p="PUSH";let W=tr(Q.location,V,X);m=g()+1;let ee=Wm(W,m),ve=Q.createHref(W);try{h.pushState(ee,"",ve)}catch(le){if(le instanceof DOMException&&le.name==="DataCloneError")throw le;f.location.assign(ve)}d&&y&&y({action:p,location:Q.location,delta:1})}function N(V,X){p="REPLACE";let W=tr(Q.location,V,X);m=g();let ee=Wm(W,m),ve=Q.createHref(W);h.replaceState(ee,"",ve),d&&y&&y({action:p,location:Q.location,delta:0})}function B(V){return Ly(V)}let Q={get action(){return p},get location(){return l(f,h)},listen(V){if(y)throw new Error("A history only accepts one active listener");return f.addEventListener($m,E),y=V,()=>{f.removeEventListener($m,E),y=null}},createHref(V){return r(f,V)},createURL:B,encodeLocation(V){let X=B(V);return{pathname:X.pathname,search:X.search,hash:X.hash}},push:M,replace:N,go(V){return h.go(V)}};return Q}function Ly(l,r=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),_e(o,"No window.location.(origin|href) available to create URL");let s=typeof l=="string"?l:_l(l);return s=s.replace(/ $/,"%20"),!r&&s.startsWith("//")&&(s=o+s),new URL(s,o)}var Pi,Pm=class{constructor(l){if(z0(this,Pi,new Map),l)for(let[r,o]of l)this.set(r,o)}get(l){if(lc(this,Pi).has(l))return lc(this,Pi).get(l);if(l.defaultValue!==void 0)return l.defaultValue;throw new Error("No value found for context")}set(l,r){lc(this,Pi).set(l,r)}};Pi=new WeakMap;var O0=new Set(["lazy","caseSensitive","path","id","index","children"]);function D0(l){return O0.has(l)}var _0=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function N0(l){return _0.has(l)}function U0(l){return l.index===!0}function ar(l,r,o=[],s={},f=!1){return l.map((d,h)=>{let p=[...o,String(h)],y=typeof d.id=="string"?d.id:p.join("-");if(_e(d.index!==!0||!d.children,"Cannot specify children on an index route"),_e(f||!s[y],`Found a route id collision on id "${y}". Route id's must be globally unique within Data Router usages`),U0(d)){let m={...d,...r(d),id:y};return s[y]=m,m}else{let m={...d,...r(d),id:y,children:void 0};return s[y]=m,d.children&&(m.children=ar(d.children,r,p,s,f)),m}})}function Al(l,r,o="/"){return Du(l,r,o,!1)}function Du(l,r,o,s){let f=typeof r=="string"?Nl(r):r,d=ha(f.pathname||"/",o);if(d==null)return null;let h=Hy(l);L0(h);let p=null;for(let y=0;p==null&&y{let g={relativePath:m===void 0?h.path||"":m,caseSensitive:h.caseSensitive===!0,childrenIndex:p,route:h};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(s)&&y)return;_e(g.relativePath.startsWith(s),`Absolute route path "${g.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(s.length)}let E=Da([s,g.relativePath]),M=o.concat(g);h.children&&h.children.length>0&&(_e(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${E}".`),Hy(h.children,r,M,E,y)),!(h.path==null&&!h.index)&&r.push({path:E,score:V0(E,h.index),routesMeta:M})};return l.forEach((h,p)=>{if(h.path===""||!h.path?.includes("?"))d(h,p);else for(let y of By(h.path))d(h,p,!0,y)}),r}function By(l){let r=l.split("/");if(r.length===0)return[];let[o,...s]=r,f=o.endsWith("?"),d=o.replace(/\?$/,"");if(s.length===0)return f?[d,""]:[d];let h=By(s.join("/")),p=[];return p.push(...h.map(y=>y===""?d:[d,y].join("/"))),f&&p.push(...h),p.map(y=>l.startsWith("/")&&y===""?"/":y)}function L0(l){l.sort((r,o)=>r.score!==o.score?o.score-r.score:X0(r.routesMeta.map(s=>s.childrenIndex),o.routesMeta.map(s=>s.childrenIndex)))}var H0=/^:[\w-]+$/,B0=3,q0=2,Q0=1,Y0=10,G0=-2,Im=l=>l==="*";function V0(l,r){let o=l.split("/"),s=o.length;return o.some(Im)&&(s+=G0),r&&(s+=q0),o.filter(f=>!Im(f)).reduce((f,d)=>f+(H0.test(d)?B0:d===""?Q0:Y0),s)}function X0(l,r){return l.length===r.length&&l.slice(0,-1).every((s,f)=>s===r[f])?l[l.length-1]-r[r.length-1]:0}function Z0(l,r,o=!1){let{routesMeta:s}=l,f={},d="/",h=[];for(let p=0;p{if(g==="*"){let B=p[M]||"";h=d.slice(0,d.length-B.length).replace(/(.)\/+$/,"$1")}const N=p[M];return E&&!N?m[g]=void 0:m[g]=(N||"").replace(/%2F/g,"/"),m},{}),pathname:d,pathnameBase:h,pattern:l}}function K0(l,r=!1,o=!0){yt(l==="*"||!l.endsWith("*")||l.endsWith("/*"),`Route path "${l}" will be treated as if it were "${l.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${l.replace(/\*$/,"/*")}".`);let s=[],f="^"+l.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,p,y)=>(s.push({paramName:p,isOptional:y!=null}),y?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return l.endsWith("*")?(s.push({paramName:"*"}),f+=l==="*"||l==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?f+="\\/*$":l!==""&&l!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,r?void 0:"i"),s]}function k0(l){try{return l.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return yt(!1,`The URL path "${l}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),l}}function ha(l,r){if(r==="/")return l;if(!l.toLowerCase().startsWith(r.toLowerCase()))return null;let o=r.endsWith("/")?r.length-1:r.length,s=l.charAt(o);return s&&s!=="/"?null:l.slice(o)||"/"}function J0({basename:l,pathname:r}){return r==="/"?l:Da([l,r])}function F0(l,r="/"){let{pathname:o,search:s="",hash:f=""}=typeof l=="string"?Nl(l):l;return{pathname:o?o.startsWith("/")?o:$0(o,r):r,search:P0(s),hash:I0(f)}}function $0(l,r){let o=r.replace(/\/+$/,"").split("/");return l.split("/").forEach(f=>{f===".."?o.length>1&&o.pop():f!=="."&&o.push(f)}),o.length>1?o.join("/"):"/"}function nc(l,r,o,s){return`Cannot include a '${l}' character in a manually specified \`to.${r}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function qy(l){return l.filter((r,o)=>o===0||r.route.path&&r.route.path.length>0)}function Dc(l){let r=qy(l);return r.map((o,s)=>s===r.length-1?o.pathname:o.pathnameBase)}function _c(l,r,o,s=!1){let f;typeof l=="string"?f=Nl(l):(f={...l},_e(!f.pathname||!f.pathname.includes("?"),nc("?","pathname","search",f)),_e(!f.pathname||!f.pathname.includes("#"),nc("#","pathname","hash",f)),_e(!f.search||!f.search.includes("#"),nc("#","search","hash",f)));let d=l===""||f.pathname==="",h=d?"/":f.pathname,p;if(h==null)p=o;else{let E=r.length-1;if(!s&&h.startsWith("..")){let M=h.split("/");for(;M[0]==="..";)M.shift(),E-=1;f.pathname=M.join("/")}p=E>=0?r[E]:"/"}let y=F0(f,p),m=h&&h!=="/"&&h.endsWith("/"),g=(d||h===".")&&o.endsWith("/");return!y.pathname.endsWith("/")&&(m||g)&&(y.pathname+="/"),y}var Da=l=>l.join("/").replace(/\/\/+/g,"/"),W0=l=>l.replace(/\/+$/,"").replace(/^\/*/,"/"),P0=l=>!l||l==="?"?"":l.startsWith("?")?l:"?"+l,I0=l=>!l||l==="#"?"":l.startsWith("#")?l:"#"+l,Hu=class{constructor(l,r,o,s=!1){this.status=l,this.statusText=r||"",this.internal=s,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function lr(l){return l!=null&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.internal=="boolean"&&"data"in l}var Qy=["POST","PUT","PATCH","DELETE"],eb=new Set(Qy),tb=["GET",...Qy],ab=new Set(tb),lb=new Set([301,302,303,307,308]),nb=new Set([307,308]),ic={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ib={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ji={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},rb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Nc=l=>rb.test(l),ub=l=>({hasErrorBoundary:!!l.hasErrorBoundary}),Yy="remix-router-transitions",Gy=Symbol("ResetLoaderData");function ob(l){const r=l.window?l.window:typeof window<"u"?window:void 0,o=typeof r<"u"&&typeof r.document<"u"&&typeof r.document.createElement<"u";_e(l.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=l.hydrationRouteProperties||[],f=l.mapRouteProperties||ub,d={},h=ar(l.routes,f,void 0,d),p,y=l.basename||"/";y.startsWith("/")||(y=`/${y}`);let m=l.dataStrategy||hb,g={...l.future},E=null,M=new Set,N=null,B=null,Q=null,V=l.hydrationData!=null,X=Al(h,l.history.location,y),W=!1,ee=null,ve;if(X==null&&!l.patchRoutesOnNavigation){let S=fa(404,{pathname:l.history.location.pathname}),{matches:w,route:U}=zu(h);ve=!0,X=w,ee={[U.id]:S}}else if(X&&!l.hydrationData&&Ta(X,h,l.history.location.pathname).active&&(X=null),X)if(X.some(S=>S.route.lazy))ve=!1;else if(!X.some(S=>Uc(S.route)))ve=!0;else{let S=l.hydrationData?l.hydrationData.loaderData:null,w=l.hydrationData?l.hydrationData.errors:null;if(w){let U=X.findIndex(J=>w[J.route.id]!==void 0);ve=X.slice(0,U+1).every(J=>!gc(J.route,S,w))}else ve=X.every(U=>!gc(U.route,S,w))}else{ve=!1,X=[];let S=Ta(null,h,l.history.location.pathname);S.active&&S.matches&&(W=!0,X=S.matches)}let le,D={historyAction:l.history.action,location:l.history.location,matches:X,initialized:ve,navigation:ic,restoreScrollPosition:l.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:l.hydrationData&&l.hydrationData.loaderData||{},actionData:l.hydrationData&&l.hydrationData.actionData||null,errors:l.hydrationData&&l.hydrationData.errors||ee,fetchers:new Map,blockers:new Map},F="POP",K=!1,se,Re=!1,He=new Map,$e=null,Ne=!1,Ae=!1,Qe=new Set,C=new Map,k=0,G=-1,xe=new Map,Se=new Set,x=new Map,L=new Map,Z=new Set,P=new Map,ye,be=null;function pe(){if(E=l.history.listen(({action:S,location:w,delta:U})=>{if(ye){ye(),ye=void 0;return}yt(P.size===0||U!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let J=hr({currentLocation:D.location,nextLocation:w,historyAction:S});if(J&&U!=null){let I=new Promise(ce=>{ye=ce});l.history.go(U*-1),cn(J,{state:"blocked",location:w,proceed(){cn(J,{state:"proceeding",proceed:void 0,reset:void 0,location:w}),I.then(()=>l.history.go(U))},reset(){let ce=new Map(D.blockers);ce.set(J,Ji),We({blockers:ce})}});return}return Dt(S,w)}),o){Cb(r,He);let S=()=>Ab(r,He);r.addEventListener("pagehide",S),$e=()=>r.removeEventListener("pagehide",S)}return D.initialized||Dt("POP",D.location,{initialHydration:!0}),le}function st(){E&&E(),$e&&$e(),M.clear(),se&&se.abort(),D.fetchers.forEach((S,w)=>sn(w)),D.blockers.forEach((S,w)=>dr(w))}function Ze(S){return M.add(S),()=>M.delete(S)}function We(S,w={}){S.matches&&(S.matches=S.matches.map(I=>{let ce=d[I.route.id],fe=I.route;return fe.element!==ce.element||fe.errorElement!==ce.errorElement||fe.hydrateFallbackElement!==ce.hydrateFallbackElement?{...I,route:ce}:I})),D={...D,...S};let U=[],J=[];D.fetchers.forEach((I,ce)=>{I.state==="idle"&&(Z.has(ce)?U.push(ce):J.push(ce))}),Z.forEach(I=>{!D.fetchers.has(I)&&!C.has(I)&&U.push(I)}),[...M].forEach(I=>I(D,{deletedFetchers:U,viewTransitionOpts:w.viewTransitionOpts,flushSync:w.flushSync===!0})),U.forEach(I=>sn(I)),J.forEach(I=>D.fetchers.delete(I))}function Ot(S,w,{flushSync:U}={}){let J=D.actionData!=null&&D.navigation.formMethod!=null&&Gt(D.navigation.formMethod)&&D.navigation.state==="loading"&&S.state?._isRedirect!==!0,I;w.actionData?Object.keys(w.actionData).length>0?I=w.actionData:I=null:J?I=D.actionData:I=null;let ce=w.loaderData?sy(D.loaderData,w.loaderData,w.matches||[],w.errors):D.loaderData,fe=D.blockers;fe.size>0&&(fe=new Map(fe),fe.forEach((te,ae)=>fe.set(ae,Ji)));let ue=Ne?!1:Bl(S,w.matches||D.matches),de=K===!0||D.navigation.formMethod!=null&&Gt(D.navigation.formMethod)&&S.state?._isRedirect!==!0;p&&(h=p,p=void 0),Ne||F==="POP"||(F==="PUSH"?l.history.push(S,S.state):F==="REPLACE"&&l.history.replace(S,S.state));let he;if(F==="POP"){let te=He.get(D.location.pathname);te&&te.has(S.pathname)?he={currentLocation:D.location,nextLocation:S}:He.has(S.pathname)&&(he={currentLocation:S,nextLocation:D.location})}else if(Re){let te=He.get(D.location.pathname);te?te.add(S.pathname):(te=new Set([S.pathname]),He.set(D.location.pathname,te)),he={currentLocation:D.location,nextLocation:S}}We({...w,actionData:I,loaderData:ce,historyAction:F,location:S,initialized:!0,navigation:ic,revalidation:"idle",restoreScrollPosition:ue,preventScrollReset:de,blockers:fe},{viewTransitionOpts:he,flushSync:U===!0}),F="POP",K=!1,Re=!1,Ne=!1,Ae=!1,be?.resolve(),be=null}async function ma(S,w){if(typeof S=="number"){l.history.go(S);return}let U=pc(D.location,D.matches,y,S,w?.fromRouteId,w?.relative),{path:J,submission:I,error:ce}=ey(!1,U,w),fe=D.location,ue=tr(D.location,J,w&&w.state);ue={...ue,...l.history.encodeLocation(ue)};let de=w&&w.replace!=null?w.replace:void 0,he="PUSH";de===!0?he="REPLACE":de===!1||I!=null&&Gt(I.formMethod)&&I.formAction===D.location.pathname+D.location.search&&(he="REPLACE");let te=w&&"preventScrollReset"in w?w.preventScrollReset===!0:void 0,ae=(w&&w.flushSync)===!0,ze=hr({currentLocation:fe,nextLocation:ue,historyAction:he});if(ze){cn(ze,{state:"blocked",location:ue,proceed(){cn(ze,{state:"proceeding",proceed:void 0,reset:void 0,location:ue}),ma(S,w)},reset(){let Ke=new Map(D.blockers);Ke.set(ze,Ji),We({blockers:Ke})}});return}await Dt(he,ue,{submission:I,pendingError:ce,preventScrollReset:te,replace:w&&w.replace,enableViewTransition:w&&w.viewTransition,flushSync:ae})}function sr(){be||(be=Ob()),li(),We({revalidation:"loading"});let S=be.promise;return D.navigation.state==="submitting"?S:D.navigation.state==="idle"?(Dt(D.historyAction,D.location,{startUninterruptedRevalidation:!0}),S):(Dt(F||D.historyAction,D.navigation.location,{overrideNavigation:D.navigation,enableViewTransition:Re===!0}),S)}async function Dt(S,w,U){se&&se.abort(),se=null,F=S,Ne=(U&&U.startUninterruptedRevalidation)===!0,Ua(D.location,D.matches),K=(U&&U.preventScrollReset)===!0,Re=(U&&U.enableViewTransition)===!0;let J=p||h,I=U&&U.overrideNavigation,ce=U?.initialHydration&&D.matches&&D.matches.length>0&&!W?D.matches:Al(J,w,y),fe=(U&&U.flushSync)===!0;if(ce&&D.initialized&&!Ae&&Eb(D.location,w)&&!(U&&U.submission&&Gt(U.submission.formMethod))){Ot(w,{matches:ce},{flushSync:fe});return}let ue=Ta(ce,J,w.pathname);if(ue.active&&ue.matches&&(ce=ue.matches),!ce){let{error:St,notFoundMatches:Ie,route:Ye}=nl(w.pathname);Ot(w,{matches:Ie,loaderData:{},errors:{[Ye.id]:St}},{flushSync:fe});return}se=new AbortController;let de=kn(l.history,w,se.signal,U&&U.submission),he=l.getContext?await l.getContext():new Pm,te;if(U&&U.pendingError)te=[Ol(ce).route.id,{type:"error",error:U.pendingError}];else if(U&&U.submission&&Gt(U.submission.formMethod)){let St=await Pn(de,w,U.submission,ce,he,ue.active,U&&U.initialHydration===!0,{replace:U.replace,flushSync:fe});if(St.shortCircuited)return;if(St.pendingActionResult){let[Ie,Ye]=St.pendingActionResult;if($t(Ye)&&lr(Ye.error)&&Ye.error.status===404){se=null,Ot(w,{matches:St.matches,loaderData:{},errors:{[Ie]:Ye.error}});return}}ce=St.matches||ce,te=St.pendingActionResult,I=rc(w,U.submission),fe=!1,ue.active=!1,de=kn(l.history,de.url,de.signal)}let{shortCircuited:ae,matches:ze,loaderData:Ke,errors:ct}=await In(de,w,ce,he,ue.active,I,U&&U.submission,U&&U.fetcherSubmission,U&&U.replace,U&&U.initialHydration===!0,fe,te);ae||(se=null,Ot(w,{matches:ze||ce,...cy(te),loaderData:Ke,errors:ct}))}async function Pn(S,w,U,J,I,ce,fe,ue={}){li();let de=zb(w,U);if(We({navigation:de},{flushSync:ue.flushSync===!0}),ce){let ae=await dn(J,w.pathname,S.signal);if(ae.type==="aborted")return{shortCircuited:!0};if(ae.type==="error"){if(ae.partialMatches.length===0){let{matches:Ke,route:ct}=zu(h);return{matches:Ke,pendingActionResult:[ct.id,{type:"error",error:ae.error}]}}let ze=Ol(ae.partialMatches).route.id;return{matches:ae.partialMatches,pendingActionResult:[ze,{type:"error",error:ae.error}]}}else if(ae.matches)J=ae.matches;else{let{notFoundMatches:ze,error:Ke,route:ct}=nl(w.pathname);return{matches:ze,pendingActionResult:[ct.id,{type:"error",error:Ke}]}}}let he,te=_u(J,w);if(!te.route.action&&!te.route.lazy)he={type:"error",error:fa(405,{method:S.method,pathname:w.pathname,routeId:te.route.id})};else{let ae=Jn(f,d,S,J,te,fe?[]:s,I),ze=await jl(S,ae,I,null);if(he=ze[te.route.id],!he){for(let Ke of J)if(ze[Ke.route.id]){he=ze[Ke.route.id];break}}if(S.signal.aborted)return{shortCircuited:!0}}if(rn(he)){let ae;return ue&&ue.replace!=null?ae=ue.replace:ae=ry(he.response.headers.get("Location"),new URL(S.url),y)===D.location.pathname+D.location.search,await Na(S,he,!0,{submission:U,replace:ae}),{shortCircuited:!0}}if($t(he)){let ae=Ol(J,te.route.id);return(ue&&ue.replace)!==!0&&(F="PUSH"),{matches:J,pendingActionResult:[ae.route.id,he,te.route.id]}}return{matches:J,pendingActionResult:[te.route.id,he]}}async function In(S,w,U,J,I,ce,fe,ue,de,he,te,ae){let ze=ce||rc(w,fe),Ke=fe||ue||dy(ze),ct=!Ne&&!he;if(I){if(ct){let gt=cr(ae);We({navigation:ze,...gt!==void 0?{actionData:gt}:{}},{flushSync:te})}let we=await dn(U,w.pathname,S.signal);if(we.type==="aborted")return{shortCircuited:!0};if(we.type==="error"){if(we.partialMatches.length===0){let{matches:ja,route:za}=zu(h);return{matches:ja,loaderData:{},errors:{[za.id]:we.error}}}let gt=Ol(we.partialMatches).route.id;return{matches:we.partialMatches,loaderData:{},errors:{[gt]:we.error}}}else if(we.matches)U=we.matches;else{let{error:gt,notFoundMatches:ja,route:za}=nl(w.pathname);return{matches:ja,loaderData:{},errors:{[za.id]:gt}}}}let St=p||h,{dsMatches:Ie,revalidatingFetchers:Ye}=ty(S,J,f,d,l.history,D,U,Ke,w,he?[]:s,he===!0,Ae,Qe,Z,x,Se,St,y,l.patchRoutesOnNavigation!=null,ae);if(G=++k,!l.dataStrategy&&!Ie.some(we=>we.shouldLoad)&&!Ie.some(we=>we.route.middleware&&we.route.middleware.length>0)&&Ye.length===0){let we=wt();return Ot(w,{matches:U,loaderData:{},errors:ae&&$t(ae[1])?{[ae[0]]:ae[1].error}:null,...cy(ae),...we?{fetchers:new Map(D.fetchers)}:{}},{flushSync:te}),{shortCircuited:!0}}if(ct){let we={};if(!I){we.navigation=ze;let gt=cr(ae);gt!==void 0&&(we.actionData=gt)}Ye.length>0&&(we.fetchers=fr(Ye)),We(we,{flushSync:te})}Ye.forEach(we=>{ya(we.key),we.controller&&C.set(we.key,we.controller)});let pa=()=>Ye.forEach(we=>ya(we.key));se&&se.signal.addEventListener("abort",pa);let{loaderResults:It,fetcherResults:Nt}=await zt(Ie,Ye,S,J);if(S.signal.aborted)return{shortCircuited:!0};se&&se.signal.removeEventListener("abort",pa),Ye.forEach(we=>C.delete(we.key));let Ct=wu(It);if(Ct)return await Na(S,Ct.result,!0,{replace:de}),{shortCircuited:!0};if(Ct=wu(Nt),Ct)return Se.add(Ct.key),await Na(S,Ct.result,!0,{replace:de}),{shortCircuited:!0};let{loaderData:Ra,errors:at}=oy(D,U,It,ae,Ye,Nt);he&&D.errors&&(at={...D.errors,...at});let Ma=wt(),ql=va(G),ea=Ma||ql||Ye.length>0;return{matches:U,loaderData:Ra,errors:at,...ea?{fetchers:new Map(D.fetchers)}:{}}}function cr(S){if(S&&!$t(S[1]))return{[S[0]]:S[1].data};if(D.actionData)return Object.keys(D.actionData).length===0?null:D.actionData}function fr(S){return S.forEach(w=>{let U=D.fetchers.get(w.key),J=Fi(void 0,U?U.data:void 0);D.fetchers.set(w.key,J)}),new Map(D.fetchers)}async function ei(S,w,U,J){ya(S);let I=(J&&J.flushSync)===!0,ce=p||h,fe=pc(D.location,D.matches,y,U,w,J?.relative),ue=Al(ce,fe,y),de=Ta(ue,ce,fe);if(de.active&&de.matches&&(ue=de.matches),!ue){Pt(S,w,fa(404,{pathname:fe}),{flushSync:I});return}let{path:he,submission:te,error:ae}=ey(!0,fe,J);if(ae){Pt(S,w,ae,{flushSync:I});return}let ze=l.getContext?await l.getContext():new Pm,Ke=(J&&J.preventScrollReset)===!0;if(te&&Gt(te.formMethod)){await ti(S,w,he,ue,ze,de.active,I,Ke,te);return}x.set(S,{routeId:w,path:he}),await ai(S,w,he,ue,ze,de.active,I,Ke,te)}async function ti(S,w,U,J,I,ce,fe,ue,de){li(),x.delete(S);let he=D.fetchers.get(S);Wt(S,wb(de,he),{flushSync:fe});let te=new AbortController,ae=kn(l.history,U,te.signal,de);if(ce){let rt=await dn(J,new URL(ae.url).pathname,ae.signal,S);if(rt.type==="aborted")return;if(rt.type==="error"){Pt(S,w,rt.error,{flushSync:fe});return}else if(rt.matches)J=rt.matches;else{Pt(S,w,fa(404,{pathname:U}),{flushSync:fe});return}}let ze=_u(J,U);if(!ze.route.action&&!ze.route.lazy){let rt=fa(405,{method:de.formMethod,pathname:U,routeId:w});Pt(S,w,rt,{flushSync:fe});return}C.set(S,te);let Ke=k,ct=Jn(f,d,ae,J,ze,s,I),Ie=(await jl(ae,ct,I,S))[ze.route.id];if(ae.signal.aborted){C.get(S)===te&&C.delete(S);return}if(Z.has(S)){if(rn(Ie)||$t(Ie)){Wt(S,tl(void 0));return}}else{if(rn(Ie))if(C.delete(S),G>Ke){Wt(S,tl(void 0));return}else return Se.add(S),Wt(S,Fi(de)),Na(ae,Ie,!1,{fetcherSubmission:de,preventScrollReset:ue});if($t(Ie)){Pt(S,w,Ie.error);return}}let Ye=D.navigation.location||D.location,pa=kn(l.history,Ye,te.signal),It=p||h,Nt=D.navigation.state!=="idle"?Al(It,D.navigation.location,y):D.matches;_e(Nt,"Didn't find any matches after fetcher action");let Ct=++k;xe.set(S,Ct);let Ra=Fi(de,Ie.data);D.fetchers.set(S,Ra);let{dsMatches:at,revalidatingFetchers:Ma}=ty(pa,I,f,d,l.history,D,Nt,de,Ye,s,!1,Ae,Qe,Z,x,Se,It,y,l.patchRoutesOnNavigation!=null,[ze.route.id,Ie]);Ma.filter(rt=>rt.key!==S).forEach(rt=>{let La=rt.key,Ql=D.fetchers.get(La),ga=Fi(void 0,Ql?Ql.data:void 0);D.fetchers.set(La,ga),ya(La),rt.controller&&C.set(La,rt.controller)}),We({fetchers:new Map(D.fetchers)});let ql=()=>Ma.forEach(rt=>ya(rt.key));te.signal.addEventListener("abort",ql);let{loaderResults:ea,fetcherResults:we}=await zt(at,Ma,pa,I);if(te.signal.aborted)return;if(te.signal.removeEventListener("abort",ql),xe.delete(S),C.delete(S),Ma.forEach(rt=>C.delete(rt.key)),D.fetchers.has(S)){let rt=tl(Ie.data);D.fetchers.set(S,rt)}let gt=wu(ea);if(gt)return Na(pa,gt.result,!1,{preventScrollReset:ue});if(gt=wu(we),gt)return Se.add(gt.key),Na(pa,gt.result,!1,{preventScrollReset:ue});let{loaderData:ja,errors:za}=oy(D,Nt,ea,void 0,Ma,we);va(Ct),D.navigation.state==="loading"&&Ct>G?(_e(F,"Expected pending action"),se&&se.abort(),Ot(D.navigation.location,{matches:Nt,loaderData:ja,errors:za,fetchers:new Map(D.fetchers)})):(We({errors:za,loaderData:sy(D.loaderData,ja,Nt,za),fetchers:new Map(D.fetchers)}),Ae=!1)}async function ai(S,w,U,J,I,ce,fe,ue,de){let he=D.fetchers.get(S);Wt(S,Fi(de,he?he.data:void 0),{flushSync:fe});let te=new AbortController,ae=kn(l.history,U,te.signal);if(ce){let Ye=await dn(J,new URL(ae.url).pathname,ae.signal,S);if(Ye.type==="aborted")return;if(Ye.type==="error"){Pt(S,w,Ye.error,{flushSync:fe});return}else if(Ye.matches)J=Ye.matches;else{Pt(S,w,fa(404,{pathname:U}),{flushSync:fe});return}}let ze=_u(J,U);C.set(S,te);let Ke=k,ct=Jn(f,d,ae,J,ze,s,I),Ie=(await jl(ae,ct,I,S))[ze.route.id];if(C.get(S)===te&&C.delete(S),!ae.signal.aborted){if(Z.has(S)){Wt(S,tl(void 0));return}if(rn(Ie))if(G>Ke){Wt(S,tl(void 0));return}else{Se.add(S),await Na(ae,Ie,!1,{preventScrollReset:ue});return}if($t(Ie)){Pt(S,w,Ie.error);return}Wt(S,tl(Ie.data))}}async function Na(S,w,U,{submission:J,fetcherSubmission:I,preventScrollReset:ce,replace:fe}={}){w.response.headers.has("X-Remix-Revalidate")&&(Ae=!0);let ue=w.response.headers.get("Location");_e(ue,"Expected a Location header on the redirect Response"),ue=ry(ue,new URL(S.url),y);let de=tr(D.location,ue,{_isRedirect:!0});if(o){let ct=!1;if(w.response.headers.has("X-Remix-Reload-Document"))ct=!0;else if(Nc(ue)){const St=Ly(ue,!0);ct=St.origin!==r.location.origin||ha(St.pathname,y)==null}if(ct){fe?r.location.replace(ue):r.location.assign(ue);return}}se=null;let he=fe===!0||w.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:te,formAction:ae,formEncType:ze}=D.navigation;!J&&!I&&te&&ae&&ze&&(J=dy(D.navigation));let Ke=J||I;if(nb.has(w.response.status)&&Ke&&Gt(Ke.formMethod))await Dt(he,de,{submission:{...Ke,formAction:ue},preventScrollReset:ce||K,enableViewTransition:U?Re:void 0});else{let ct=rc(de,J);await Dt(he,de,{overrideNavigation:ct,fetcherSubmission:I,preventScrollReset:ce||K,enableViewTransition:U?Re:void 0})}}async function jl(S,w,U,J){let I,ce={};try{I=await yb(m,S,w,J,U,!1)}catch(fe){return w.filter(ue=>ue.shouldLoad).forEach(ue=>{ce[ue.route.id]={type:"error",error:fe}}),ce}if(S.signal.aborted)return ce;for(let[fe,ue]of Object.entries(I))if(Rb(ue)){let de=ue.result;ce[fe]={type:"redirect",response:bb(de,S,fe,w,y)}}else ce[fe]=await gb(ue);return ce}async function zt(S,w,U,J){let I=jl(U,S,J,null),ce=Promise.all(w.map(async de=>{if(de.matches&&de.match&&de.request&&de.controller){let te=(await jl(de.request,de.matches,J,de.key))[de.match.route.id];return{[de.key]:te}}else return Promise.resolve({[de.key]:{type:"error",error:fa(404,{pathname:de.path})}})})),fe=await I,ue=(await ce).reduce((de,he)=>Object.assign(de,he),{});return{loaderResults:fe,fetcherResults:ue}}function li(){Ae=!0,x.forEach((S,w)=>{C.has(w)&&Qe.add(w),ya(w)})}function Wt(S,w,U={}){D.fetchers.set(S,w),We({fetchers:new Map(D.fetchers)},{flushSync:(U&&U.flushSync)===!0})}function Pt(S,w,U,J={}){let I=Ol(D.matches,w);sn(S),We({errors:{[I.route.id]:U},fetchers:new Map(D.fetchers)},{flushSync:(J&&J.flushSync)===!0})}function Ll(S){return L.set(S,(L.get(S)||0)+1),Z.has(S)&&Z.delete(S),D.fetchers.get(S)||ib}function Yu(S,w){ya(S,w?.reason),Wt(S,tl(null))}function sn(S){let w=D.fetchers.get(S);C.has(S)&&!(w&&w.state==="loading"&&xe.has(S))&&ya(S),x.delete(S),xe.delete(S),Se.delete(S),Z.delete(S),Qe.delete(S),D.fetchers.delete(S)}function Gu(S){let w=(L.get(S)||0)-1;w<=0?(L.delete(S),Z.add(S)):L.set(S,w),We({fetchers:new Map(D.fetchers)})}function ya(S,w){let U=C.get(S);U&&(U.abort(w),C.delete(S))}function ll(S){for(let w of S){let U=Ll(w),J=tl(U.data);D.fetchers.set(w,J)}}function wt(){let S=[],w=!1;for(let U of Se){let J=D.fetchers.get(U);_e(J,`Expected fetcher: ${U}`),J.state==="loading"&&(Se.delete(U),S.push(U),w=!0)}return ll(S),w}function va(S){let w=[];for(let[U,J]of xe)if(J0}function _t(S,w){let U=D.blockers.get(S)||Ji;return P.get(S)!==w&&P.set(S,w),U}function dr(S){D.blockers.delete(S),P.delete(S)}function cn(S,w){let U=D.blockers.get(S)||Ji;_e(U.state==="unblocked"&&w.state==="blocked"||U.state==="blocked"&&w.state==="blocked"||U.state==="blocked"&&w.state==="proceeding"||U.state==="blocked"&&w.state==="unblocked"||U.state==="proceeding"&&w.state==="unblocked",`Invalid blocker state transition: ${U.state} -> ${w.state}`);let J=new Map(D.blockers);J.set(S,w),We({blockers:J})}function hr({currentLocation:S,nextLocation:w,historyAction:U}){if(P.size===0)return;P.size>1&&yt(!1,"A router only supports one blocker at a time");let J=Array.from(P.entries()),[I,ce]=J[J.length-1],fe=D.blockers.get(I);if(!(fe&&fe.state==="proceeding")&&ce({currentLocation:S,nextLocation:w,historyAction:U}))return I}function nl(S){let w=fa(404,{pathname:S}),U=p||h,{matches:J,route:I}=zu(U);return{notFoundMatches:J,route:I,error:w}}function fn(S,w,U){if(N=S,Q=w,B=U||null,!V&&D.navigation===ic){V=!0;let J=Bl(D.location,D.matches);J!=null&&We({restoreScrollPosition:J})}return()=>{N=null,Q=null,B=null}}function Hl(S,w){return B&&B(S,w.map(J=>j0(J,D.loaderData)))||S.key}function Ua(S,w){if(N&&Q){let U=Hl(S,w);N[U]=Q()}}function Bl(S,w){if(N){let U=Hl(S,w),J=N[U];if(typeof J=="number")return J}return null}function Ta(S,w,U){if(l.patchRoutesOnNavigation)if(S){if(Object.keys(S[0].params).length>0)return{active:!0,matches:Du(w,U,y,!0)}}else return{active:!0,matches:Du(w,U,y,!0)||[]};return{active:!1,matches:null}}async function dn(S,w,U,J){if(!l.patchRoutesOnNavigation)return{type:"success",matches:S};let I=S;for(;;){let ce=p==null,fe=p||h,ue=d;try{await l.patchRoutesOnNavigation({signal:U,path:w,matches:I,fetcherKey:J,patch:(te,ae)=>{U.aborted||ay(te,ae,fe,ue,f,!1)}})}catch(te){return{type:"error",error:te,partialMatches:I}}finally{ce&&!U.aborted&&(h=[...h])}if(U.aborted)return{type:"aborted"};let de=Al(fe,w,y);if(de)return{type:"success",matches:de};let he=Du(fe,w,y,!0);if(!he||I.length===he.length&&I.every((te,ae)=>te.route.id===he[ae].route.id))return{type:"success",matches:null};I=he}}function mr(S){d={},p=ar(S,f,void 0,d)}function ni(S,w,U=!1){let J=p==null;ay(S,w,p||h,d,f,U),J&&(h=[...h],We({}))}return le={get basename(){return y},get future(){return g},get state(){return D},get routes(){return h},get window(){return r},initialize:pe,subscribe:Ze,enableScrollRestoration:fn,navigate:ma,fetch:ei,revalidate:sr,createHref:S=>l.history.createHref(S),encodeLocation:S=>l.history.encodeLocation(S),getFetcher:Ll,resetFetcher:Yu,deleteFetcher:Gu,dispose:st,getBlocker:_t,deleteBlocker:dr,patchRoutes:ni,_internalFetchControllers:C,_internalSetRoutes:mr,_internalSetStateDoNotUseOrYouWillBreakYourApp(S){We(S)}},le}function sb(l){return l!=null&&("formData"in l&&l.formData!=null||"body"in l&&l.body!==void 0)}function pc(l,r,o,s,f,d){let h,p;if(f){h=[];for(let m of r)if(h.push(m),m.route.id===f){p=m;break}}else h=r,p=r[r.length-1];let y=_c(s||".",Dc(h),ha(l.pathname,o)||l.pathname,d==="path");if(s==null&&(y.search=l.search,y.hash=l.hash),(s==null||s===""||s===".")&&p){let m=jc(y.search);if(p.route.index&&!m)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!p.route.index&&m){let g=new URLSearchParams(y.search),E=g.getAll("index");g.delete("index"),E.filter(N=>N).forEach(N=>g.append("index",N));let M=g.toString();y.search=M?`?${M}`:""}}return o!=="/"&&(y.pathname=J0({basename:o,pathname:y.pathname})),_l(y)}function ey(l,r,o){if(!o||!sb(o))return{path:r};if(o.formMethod&&!Mb(o.formMethod))return{path:r,error:fa(405,{method:o.formMethod})};let s=()=>({path:r,error:fa(400,{type:"invalid-body"})}),d=(o.formMethod||"get").toUpperCase(),h=Jy(r);if(o.body!==void 0){if(o.formEncType==="text/plain"){if(!Gt(d))return s();let E=typeof o.body=="string"?o.body:o.body instanceof FormData||o.body instanceof URLSearchParams?Array.from(o.body.entries()).reduce((M,[N,B])=>`${M}${N}=${B} +`,""):String(o.body);return{path:r,submission:{formMethod:d,formAction:h,formEncType:o.formEncType,formData:void 0,json:void 0,text:E}}}else if(o.formEncType==="application/json"){if(!Gt(d))return s();try{let E=typeof o.body=="string"?JSON.parse(o.body):o.body;return{path:r,submission:{formMethod:d,formAction:h,formEncType:o.formEncType,formData:void 0,json:E,text:void 0}}}catch{return s()}}}_e(typeof FormData=="function","FormData is not available in this environment");let p,y;if(o.formData)p=Sc(o.formData),y=o.formData;else if(o.body instanceof FormData)p=Sc(o.body),y=o.body;else if(o.body instanceof URLSearchParams)p=o.body,y=uy(p);else if(o.body==null)p=new URLSearchParams,y=new FormData;else try{p=new URLSearchParams(o.body),y=uy(p)}catch{return s()}let m={formMethod:d,formAction:h,formEncType:o&&o.formEncType||"application/x-www-form-urlencoded",formData:y,json:void 0,text:void 0};if(Gt(m.formMethod))return{path:r,submission:m};let g=Nl(r);return l&&g.search&&jc(g.search)&&p.append("index",""),g.search=`?${p}`,{path:_l(g),submission:m}}function ty(l,r,o,s,f,d,h,p,y,m,g,E,M,N,B,Q,V,X,W,ee){let ve=ee?$t(ee[1])?ee[1].error:ee[1].data:void 0,le=f.createURL(d.location),D=f.createURL(y),F;if(g&&d.errors){let Ne=Object.keys(d.errors)[0];F=h.findIndex(Ae=>Ae.route.id===Ne)}else if(ee&&$t(ee[1])){let Ne=ee[0];F=h.findIndex(Ae=>Ae.route.id===Ne)-1}let K=ee?ee[1].statusCode:void 0,se=K&&K>=400,Re={currentUrl:le,currentParams:d.matches[0]?.params||{},nextUrl:D,nextParams:h[0].params,...p,actionResult:ve,actionStatus:K},He=h.map((Ne,Ae)=>{let{route:Qe}=Ne,C=null;if(F!=null&&Ae>F?C=!1:Qe.lazy?C=!0:Uc(Qe)?g?C=gc(Qe,d.loaderData,d.errors):cb(d.loaderData,d.matches[Ae],Ne)&&(C=!0):C=!1,C!==null)return bc(o,s,l,Ne,m,r,C);let k=se?!1:E||le.pathname+le.search===D.pathname+D.search||le.search!==D.search||fb(d.matches[Ae],Ne),G={...Re,defaultShouldRevalidate:k},xe=Bu(Ne,G);return bc(o,s,l,Ne,m,r,xe,G)}),$e=[];return B.forEach((Ne,Ae)=>{if(g||!h.some(L=>L.route.id===Ne.routeId)||N.has(Ae))return;let Qe=d.fetchers.get(Ae),C=Qe&&Qe.state!=="idle"&&Qe.data===void 0,k=Al(V,Ne.path,X);if(!k){if(W&&C)return;$e.push({key:Ae,routeId:Ne.routeId,path:Ne.path,matches:null,match:null,request:null,controller:null});return}if(Q.has(Ae))return;let G=_u(k,Ne.path),xe=new AbortController,Se=kn(f,Ne.path,xe.signal),x=null;if(M.has(Ae))M.delete(Ae),x=Jn(o,s,Se,k,G,m,r);else if(C)E&&(x=Jn(o,s,Se,k,G,m,r));else{let L={...Re,defaultShouldRevalidate:se?!1:E};Bu(G,L)&&(x=Jn(o,s,Se,k,G,m,r,L))}x&&$e.push({key:Ae,routeId:Ne.routeId,path:Ne.path,matches:x,match:G,request:Se,controller:xe})}),{dsMatches:He,revalidatingFetchers:$e}}function Uc(l){return l.loader!=null||l.middleware!=null&&l.middleware.length>0}function gc(l,r,o){if(l.lazy)return!0;if(!Uc(l))return!1;let s=r!=null&&l.id in r,f=o!=null&&o[l.id]!==void 0;return!s&&f?!1:typeof l.loader=="function"&&l.loader.hydrate===!0?!0:!s&&!f}function cb(l,r,o){let s=!r||o.route.id!==r.route.id,f=!l.hasOwnProperty(o.route.id);return s||f}function fb(l,r){let o=l.route.path;return l.pathname!==r.pathname||o!=null&&o.endsWith("*")&&l.params["*"]!==r.params["*"]}function Bu(l,r){if(l.route.shouldRevalidate){let o=l.route.shouldRevalidate(r);if(typeof o=="boolean")return o}return r.defaultShouldRevalidate}function ay(l,r,o,s,f,d){let h;if(l){let m=s[l];_e(m,`No route found to patch children into: routeId = ${l}`),m.children||(m.children=[]),h=m.children}else h=o;let p=[],y=[];if(r.forEach(m=>{let g=h.find(E=>Vy(m,E));g?y.push({existingRoute:g,newRoute:m}):p.push(m)}),p.length>0){let m=ar(p,f,[l||"_","patch",String(h?.length||"0")],s);h.push(...m)}if(d&&y.length>0)for(let m=0;mr.children?.some(f=>Vy(o,f))):!1}var ly=new WeakMap,Xy=({key:l,route:r,manifest:o,mapRouteProperties:s})=>{let f=o[r.id];if(_e(f,"No route found in manifest"),!f.lazy||typeof f.lazy!="object")return;let d=f.lazy[l];if(!d)return;let h=ly.get(f);h||(h={},ly.set(f,h));let p=h[l];if(p)return p;let y=(async()=>{let m=D0(l),E=f[l]!==void 0&&l!=="hasErrorBoundary";if(m)yt(!m,"Route property "+l+" is not a supported lazy route property. This property will be ignored."),h[l]=Promise.resolve();else if(E)yt(!1,`Route "${f.id}" has a static property "${l}" defined. The lazy property will be ignored.`);else{let M=await d();M!=null&&(Object.assign(f,{[l]:M}),Object.assign(f,s(f)))}typeof f.lazy=="object"&&(f.lazy[l]=void 0,Object.values(f.lazy).every(M=>M===void 0)&&(f.lazy=void 0))})();return h[l]=y,y},ny=new WeakMap;function db(l,r,o,s,f){let d=o[l.id];if(_e(d,"No route found in manifest"),!l.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof l.lazy=="function"){let g=ny.get(d);if(g)return{lazyRoutePromise:g,lazyHandlerPromise:g};let E=(async()=>{_e(typeof l.lazy=="function","No lazy route function found");let M=await l.lazy(),N={};for(let B in M){let Q=M[B];if(Q===void 0)continue;let V=N0(B),W=d[B]!==void 0&&B!=="hasErrorBoundary";V?yt(!V,"Route property "+B+" is not a supported property to be returned from a lazy route function. This property will be ignored."):W?yt(!W,`Route "${d.id}" has a static property "${B}" defined but its lazy function is also returning a value for this property. The lazy route property "${B}" will be ignored.`):N[B]=Q}Object.assign(d,N),Object.assign(d,{...s(d),lazy:void 0})})();return ny.set(d,E),E.catch(()=>{}),{lazyRoutePromise:E,lazyHandlerPromise:E}}let h=Object.keys(l.lazy),p=[],y;for(let g of h){if(f&&f.includes(g))continue;let E=Xy({key:g,route:l,manifest:o,mapRouteProperties:s});E&&(p.push(E),g===r&&(y=E))}let m=p.length>0?Promise.all(p).then(()=>{}):void 0;return m?.catch(()=>{}),y?.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:y}}async function iy(l){let r=l.matches.filter(f=>f.shouldLoad),o={};return(await Promise.all(r.map(f=>f.resolve()))).forEach((f,d)=>{o[r[d].route.id]=f}),o}async function hb(l){return l.matches.some(r=>r.route.middleware)?Zy(l,()=>iy(l)):iy(l)}function Zy(l,r){return mb(l,r,s=>s,xb,o);function o(s,f,d){if(d)return Promise.resolve(Object.assign(d.value,{[f]:{type:"error",result:s}}));{let{matches:h}=l,p=Math.min(Math.max(h.findIndex(m=>m.route.id===f),0),Math.max(h.findIndex(m=>m.unstable_shouldCallHandler()),0)),y=Ol(h,h[p].route.id).route.id;return Promise.resolve({[y]:{type:"error",result:s}})}}}async function mb(l,r,o,s,f){let{matches:d,request:h,params:p,context:y}=l,m=d.flatMap(E=>E.route.middleware?E.route.middleware.map(M=>[E.route.id,M]):[]);return await Ky({request:h,params:p,context:y},m,r,o,s,f)}async function Ky(l,r,o,s,f,d,h=0){let{request:p}=l;if(p.signal.aborted)throw p.signal.reason??new Error(`Request aborted: ${p.method} ${p.url}`);let y=r[h];if(!y)return await o();let[m,g]=y,E,M=async()=>{if(E)throw new Error("You may only call `next()` once per middleware");try{return E={value:await Ky(l,r,o,s,f,d,h+1)},E.value}catch(N){return E={value:await d(N,m,E)},E.value}};try{let N=await g(l,M),B=N!=null?s(N):void 0;return f(B)?B:E?B??E.value:(E={value:await M()},E.value)}catch(N){return await d(N,m,E)}}function ky(l,r,o,s,f){let d=Xy({key:"middleware",route:s.route,manifest:r,mapRouteProperties:l}),h=db(s.route,Gt(o.method)?"action":"loader",r,l,f);return{middleware:d,route:h.lazyRoutePromise,handler:h.lazyHandlerPromise}}function bc(l,r,o,s,f,d,h,p=null){let y=!1,m=ky(l,r,o,s,f);return{...s,_lazyPromises:m,shouldLoad:h,unstable_shouldRevalidateArgs:p,unstable_shouldCallHandler(g){return y=!0,p?typeof g=="boolean"?Bu(s,{...p,defaultShouldRevalidate:g}):Bu(s,p):h},resolve(g){let{lazy:E,loader:M,middleware:N}=s.route,B=y||h||g&&!Gt(o.method)&&(E||M),Q=N&&N.length>0&&!M&&!E;return B&&!Q?vb({request:o,match:s,lazyHandlerPromise:m?.handler,lazyRoutePromise:m?.route,handlerOverride:g,scopedContext:d}):Promise.resolve({type:"data",result:void 0})}}}function Jn(l,r,o,s,f,d,h,p=null){return s.map(y=>y.route.id!==f.route.id?{...y,shouldLoad:!1,unstable_shouldRevalidateArgs:p,unstable_shouldCallHandler:()=>!1,_lazyPromises:ky(l,r,o,y,d),resolve:()=>Promise.resolve({type:"data",result:void 0})}:bc(l,r,o,y,d,h,!0,p))}async function yb(l,r,o,s,f,d){o.some(m=>m._lazyPromises?.middleware)&&await Promise.all(o.map(m=>m._lazyPromises?.middleware));let h={request:r,params:o[0].params,context:f,matches:o},y=await l({...h,fetcherKey:s,runClientMiddleware:m=>{let g=h;return Zy(g,()=>m({...g,fetcherKey:s,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(o.flatMap(m=>[m._lazyPromises?.handler,m._lazyPromises?.route]))}catch{}return y}async function vb({request:l,match:r,lazyHandlerPromise:o,lazyRoutePromise:s,handlerOverride:f,scopedContext:d}){let h,p,y=Gt(l.method),m=y?"action":"loader",g=E=>{let M,N=new Promise((V,X)=>M=X);p=()=>M(),l.signal.addEventListener("abort",p);let B=V=>typeof E!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${r.route.id}]`)):E({request:l,params:r.params,context:d},...V!==void 0?[V]:[]),Q=(async()=>{try{return{type:"data",result:await(f?f(X=>B(X)):B())}}catch(V){return{type:"error",result:V}}})();return Promise.race([Q,N])};try{let E=y?r.route.action:r.route.loader;if(o||s)if(E){let M,[N]=await Promise.all([g(E).catch(B=>{M=B}),o,s]);if(M!==void 0)throw M;h=N}else{await o;let M=y?r.route.action:r.route.loader;if(M)[h]=await Promise.all([g(M),s]);else if(m==="action"){let N=new URL(l.url),B=N.pathname+N.search;throw fa(405,{method:l.method,pathname:B,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(E)h=await g(E);else{let M=new URL(l.url),N=M.pathname+M.search;throw fa(404,{pathname:N})}}catch(E){return{type:"error",result:E}}finally{p&&l.signal.removeEventListener("abort",p)}return h}async function pb(l){let r=l.headers.get("Content-Type");return r&&/\bapplication\/json\b/.test(r)?l.body==null?null:l.json():l.text()}async function gb(l){let{result:r,type:o}=l;if(Fy(r)){let s;try{s=await pb(r)}catch(f){return{type:"error",error:f}}return o==="error"?{type:"error",error:new Hu(r.status,r.statusText,s),statusCode:r.status,headers:r.headers}:{type:"data",data:s,statusCode:r.status,headers:r.headers}}return o==="error"?fy(r)?r.data instanceof Error?{type:"error",error:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:new Hu(r.init?.status||500,void 0,r.data),statusCode:lr(r)?r.status:void 0,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:r,statusCode:lr(r)?r.status:void 0}:fy(r)?{type:"data",data:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"data",data:r}}function bb(l,r,o,s,f){let d=l.headers.get("Location");if(_e(d,"Redirects returned/thrown from loaders/actions must have a Location header"),!Nc(d)){let h=s.slice(0,s.findIndex(p=>p.route.id===o)+1);d=pc(new URL(r.url),h,f,d),l.headers.set("Location",d)}return l}function ry(l,r,o){if(Nc(l)){let s=l,f=s.startsWith("//")?new URL(r.protocol+s):new URL(s),d=ha(f.pathname,o)!=null;if(f.origin===r.origin&&d)return f.pathname+f.search+f.hash}return l}function kn(l,r,o,s){let f=l.createURL(Jy(r)).toString(),d={signal:o};if(s&&Gt(s.formMethod)){let{formMethod:h,formEncType:p}=s;d.method=h.toUpperCase(),p==="application/json"?(d.headers=new Headers({"Content-Type":p}),d.body=JSON.stringify(s.json)):p==="text/plain"?d.body=s.text:p==="application/x-www-form-urlencoded"&&s.formData?d.body=Sc(s.formData):d.body=s.formData}return new Request(f,d)}function Sc(l){let r=new URLSearchParams;for(let[o,s]of l.entries())r.append(o,typeof s=="string"?s:s.name);return r}function uy(l){let r=new FormData;for(let[o,s]of l.entries())r.append(o,s);return r}function Sb(l,r,o,s=!1,f=!1){let d={},h=null,p,y=!1,m={},g=o&&$t(o[1])?o[1].error:void 0;return l.forEach(E=>{if(!(E.route.id in r))return;let M=E.route.id,N=r[M];if(_e(!rn(N),"Cannot handle redirect results in processLoaderData"),$t(N)){let B=N.error;if(g!==void 0&&(B=g,g=void 0),h=h||{},f)h[M]=B;else{let Q=Ol(l,M);h[Q.route.id]==null&&(h[Q.route.id]=B)}s||(d[M]=Gy),y||(y=!0,p=lr(N.error)?N.error.status:500),N.headers&&(m[M]=N.headers)}else d[M]=N.data,N.statusCode&&N.statusCode!==200&&!y&&(p=N.statusCode),N.headers&&(m[M]=N.headers)}),g!==void 0&&o&&(h={[o[0]]:g},o[2]&&(d[o[2]]=void 0)),{loaderData:d,errors:h,statusCode:p||200,loaderHeaders:m}}function oy(l,r,o,s,f,d){let{loaderData:h,errors:p}=Sb(r,o,s);return f.filter(y=>!y.matches||y.matches.some(m=>m.shouldLoad)).forEach(y=>{let{key:m,match:g,controller:E}=y;if(E&&E.signal.aborted)return;let M=d[m];if(_e(M,"Did not find corresponding fetcher result"),$t(M)){let N=Ol(l.matches,g?.route.id);p&&p[N.route.id]||(p={...p,[N.route.id]:M.error}),l.fetchers.delete(m)}else if(rn(M))_e(!1,"Unhandled fetcher revalidation redirect");else{let N=tl(M.data);l.fetchers.set(m,N)}}),{loaderData:h,errors:p}}function sy(l,r,o,s){let f=Object.entries(r).filter(([,d])=>d!==Gy).reduce((d,[h,p])=>(d[h]=p,d),{});for(let d of o){let h=d.route.id;if(!r.hasOwnProperty(h)&&l.hasOwnProperty(h)&&d.route.loader&&(f[h]=l[h]),s&&s.hasOwnProperty(h))break}return f}function cy(l){return l?$t(l[1])?{actionData:{}}:{actionData:{[l[0]]:l[1].data}}:{}}function Ol(l,r){return(r?l.slice(0,l.findIndex(s=>s.route.id===r)+1):[...l]).reverse().find(s=>s.route.hasErrorBoundary===!0)||l[0]}function zu(l){let r=l.length===1?l[0]:l.find(o=>o.index||!o.path||o.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:r}],route:r}}function fa(l,{pathname:r,routeId:o,method:s,type:f,message:d}={}){let h="Unknown Server Error",p="Unknown @remix-run/router error";return l===400?(h="Bad Request",s&&r&&o?p=`You made a ${s} request to "${r}" but did not provide a \`loader\` for route "${o}", so there is no way to handle the request.`:f==="invalid-body"&&(p="Unable to encode submission body")):l===403?(h="Forbidden",p=`Route "${o}" does not match URL "${r}"`):l===404?(h="Not Found",p=`No route matches URL "${r}"`):l===405&&(h="Method Not Allowed",s&&r&&o?p=`You made a ${s.toUpperCase()} request to "${r}" but did not provide an \`action\` for route "${o}", so there is no way to handle the request.`:s&&(p=`Invalid request method "${s.toUpperCase()}"`)),new Hu(l||500,h,new Error(p),!0)}function wu(l){let r=Object.entries(l);for(let o=r.length-1;o>=0;o--){let[s,f]=r[o];if(rn(f))return{key:s,result:f}}}function Jy(l){let r=typeof l=="string"?Nl(l):l;return _l({...r,hash:""})}function Eb(l,r){return l.pathname!==r.pathname||l.search!==r.search?!1:l.hash===""?r.hash!=="":l.hash===r.hash?!0:r.hash!==""}function xb(l){return l!=null&&typeof l=="object"&&Object.entries(l).every(([r,o])=>typeof r=="string"&&Tb(o))}function Tb(l){return l!=null&&typeof l=="object"&&"type"in l&&"result"in l&&(l.type==="data"||l.type==="error")}function Rb(l){return Fy(l.result)&&lb.has(l.result.status)}function $t(l){return l.type==="error"}function rn(l){return(l&&l.type)==="redirect"}function fy(l){return typeof l=="object"&&l!=null&&"type"in l&&"data"in l&&"init"in l&&l.type==="DataWithResponseInit"}function Fy(l){return l!=null&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.headers=="object"&&typeof l.body<"u"}function Mb(l){return ab.has(l.toUpperCase())}function Gt(l){return eb.has(l.toUpperCase())}function jc(l){return new URLSearchParams(l).getAll("index").some(r=>r==="")}function _u(l,r){let o=typeof r=="string"?Nl(r).search:r.search;if(l[l.length-1].route.index&&jc(o||""))return l[l.length-1];let s=qy(l);return s[s.length-1]}function dy(l){let{formMethod:r,formAction:o,formEncType:s,text:f,formData:d,json:h}=l;if(!(!r||!o||!s)){if(f!=null)return{formMethod:r,formAction:o,formEncType:s,formData:void 0,json:void 0,text:f};if(d!=null)return{formMethod:r,formAction:o,formEncType:s,formData:d,json:void 0,text:void 0};if(h!==void 0)return{formMethod:r,formAction:o,formEncType:s,formData:void 0,json:h,text:void 0}}}function rc(l,r){return r?{state:"loading",location:l,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:l,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function zb(l,r){return{state:"submitting",location:l,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Fi(l,r){return l?{state:"loading",formMethod:l.formMethod,formAction:l.formAction,formEncType:l.formEncType,formData:l.formData,json:l.json,text:l.text,data:r}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:r}}function wb(l,r){return{state:"submitting",formMethod:l.formMethod,formAction:l.formAction,formEncType:l.formEncType,formData:l.formData,json:l.json,text:l.text,data:r?r.data:void 0}}function tl(l){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:l}}function Cb(l,r){try{let o=l.sessionStorage.getItem(Yy);if(o){let s=JSON.parse(o);for(let[f,d]of Object.entries(s||{}))d&&Array.isArray(d)&&r.set(f,new Set(d||[]))}}catch{}}function Ab(l,r){if(r.size>0){let o={};for(let[s,f]of r)o[s]=[...f];try{l.sessionStorage.setItem(Yy,JSON.stringify(o))}catch(s){yt(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function Ob(){let l,r,o=new Promise((s,f)=>{l=async d=>{s(d);try{await o}catch{}},r=async d=>{f(d);try{await o}catch{}}});return{promise:o,resolve:l,reject:r}}var on=z.createContext(null);on.displayName="DataRouter";var ir=z.createContext(null);ir.displayName="DataRouterState";z.createContext(!1);var Lc=z.createContext({isTransitioning:!1});Lc.displayName="ViewTransition";var $y=z.createContext(new Map);$y.displayName="Fetchers";var Db=z.createContext(null);Db.displayName="Await";var _a=z.createContext(null);_a.displayName="Navigation";var qu=z.createContext(null);qu.displayName="Location";var xa=z.createContext({outlet:null,matches:[],isDataRoute:!1});xa.displayName="Route";var Hc=z.createContext(null);Hc.displayName="RouteError";function _b(l,{relative:r}={}){_e(rr(),"useHref() may be used only in the context of a component.");let{basename:o,navigator:s}=z.useContext(_a),{hash:f,pathname:d,search:h}=ur(l,{relative:r}),p=d;return o!=="/"&&(p=d==="/"?o:Da([o,d])),s.createHref({pathname:p,search:h,hash:f})}function rr(){return z.useContext(qu)!=null}function Ul(){return _e(rr(),"useLocation() may be used only in the context of a component."),z.useContext(qu).location}var Wy="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Py(l){z.useContext(_a).static||z.useLayoutEffect(l)}function Nb(){let{isDataRoute:l}=z.useContext(xa);return l?Jb():Ub()}function Ub(){_e(rr(),"useNavigate() may be used only in the context of a component.");let l=z.useContext(on),{basename:r,navigator:o}=z.useContext(_a),{matches:s}=z.useContext(xa),{pathname:f}=Ul(),d=JSON.stringify(Dc(s)),h=z.useRef(!1);return Py(()=>{h.current=!0}),z.useCallback((y,m={})=>{if(yt(h.current,Wy),!h.current)return;if(typeof y=="number"){o.go(y);return}let g=_c(y,JSON.parse(d),f,m.relative==="path");l==null&&r!=="/"&&(g.pathname=g.pathname==="/"?r:Da([r,g.pathname])),(m.replace?o.replace:o.push)(g,m.state,m)},[r,o,d,f,l])}var jb=z.createContext(null);function Lb(l){let r=z.useContext(xa).outlet;return z.useMemo(()=>r&&z.createElement(jb.Provider,{value:l},r),[r,l])}function Iy(){let{matches:l}=z.useContext(xa),r=l[l.length-1];return r?r.params:{}}function ur(l,{relative:r}={}){let{matches:o}=z.useContext(xa),{pathname:s}=Ul(),f=JSON.stringify(Dc(o));return z.useMemo(()=>_c(l,JSON.parse(f),s,r==="path"),[l,f,s,r])}function Hb(l,r,o,s,f){_e(rr(),"useRoutes() may be used only in the context of a component.");let{navigator:d}=z.useContext(_a),{matches:h}=z.useContext(xa),p=h[h.length-1],y=p?p.params:{},m=p?p.pathname:"/",g=p?p.pathnameBase:"/",E=p&&p.route;{let W=E&&E.path||"";ev(m,!E||W.endsWith("*")||W.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${m}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let M=Ul(),N;N=M;let B=N.pathname||"/",Q=B;if(g!=="/"){let W=g.replace(/^\//,"").split("/");Q="/"+B.replace(/^\//,"").split("/").slice(W.length).join("/")}let V=Al(l,{pathname:Q});return yt(E||V!=null,`No routes matched location "${N.pathname}${N.search}${N.hash}" `),yt(V==null||V[V.length-1].route.element!==void 0||V[V.length-1].route.Component!==void 0||V[V.length-1].route.lazy!==void 0,`Matched leaf route at location "${N.pathname}${N.search}${N.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),Gb(V&&V.map(W=>Object.assign({},W,{params:Object.assign({},y,W.params),pathname:Da([g,d.encodeLocation?d.encodeLocation(W.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:W.pathname]),pathnameBase:W.pathnameBase==="/"?g:Da([g,d.encodeLocation?d.encodeLocation(W.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:W.pathnameBase])})),h,o,s,f)}function Bb(){let l=kb(),r=lr(l)?`${l.status} ${l.statusText}`:l instanceof Error?l.message:JSON.stringify(l),o=l instanceof Error?l.stack:null,s="rgba(200,200,200, 0.5)",f={padding:"0.5rem",backgroundColor:s},d={padding:"2px 4px",backgroundColor:s},h=null;return console.error("Error handled by React Router default ErrorBoundary:",l),h=z.createElement(z.Fragment,null,z.createElement("p",null,"💿 Hey developer 👋"),z.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",z.createElement("code",{style:d},"ErrorBoundary")," or"," ",z.createElement("code",{style:d},"errorElement")," prop on your route.")),z.createElement(z.Fragment,null,z.createElement("h2",null,"Unexpected Application Error!"),z.createElement("h3",{style:{fontStyle:"italic"}},r),o?z.createElement("pre",{style:f},o):null,h)}var qb=z.createElement(Bb,null),Qb=class extends z.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,r){return r.location!==l.location||r.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:r.error,location:r.location,revalidation:l.revalidation||r.revalidation}}componentDidCatch(l,r){this.props.unstable_onError?this.props.unstable_onError(l,r):console.error("React Router caught the following error during render",l)}render(){return this.state.error!==void 0?z.createElement(xa.Provider,{value:this.props.routeContext},z.createElement(Hc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Yb({routeContext:l,match:r,children:o}){let s=z.useContext(on);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),z.createElement(xa.Provider,{value:l},o)}function Gb(l,r=[],o=null,s=null,f=null){if(l==null){if(!o)return null;if(o.errors)l=o.matches;else if(r.length===0&&!o.initialized&&o.matches.length>0)l=o.matches;else return null}let d=l,h=o?.errors;if(h!=null){let m=d.findIndex(g=>g.route.id&&h?.[g.route.id]!==void 0);_e(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,m+1))}let p=!1,y=-1;if(o)for(let m=0;m=0?d=d.slice(0,y+1):d=[d[0]];break}}}return d.reduceRight((m,g,E)=>{let M,N=!1,B=null,Q=null;o&&(M=h&&g.route.id?h[g.route.id]:void 0,B=g.route.errorElement||qb,p&&(y<0&&E===0?(ev("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,Q=null):y===E&&(N=!0,Q=g.route.hydrateFallbackElement||null)));let V=r.concat(d.slice(0,E+1)),X=()=>{let W;return M?W=B:N?W=Q:g.route.Component?W=z.createElement(g.route.Component,null):g.route.element?W=g.route.element:W=m,z.createElement(Yb,{match:g,routeContext:{outlet:m,matches:V,isDataRoute:o!=null},children:W})};return o&&(g.route.ErrorBoundary||g.route.errorElement||E===0)?z.createElement(Qb,{location:o.location,revalidation:o.revalidation,component:B,error:M,children:X(),routeContext:{outlet:null,matches:V,isDataRoute:!0},unstable_onError:s}):X()},null)}function Bc(l){return`${l} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vb(l){let r=z.useContext(on);return _e(r,Bc(l)),r}function Xb(l){let r=z.useContext(ir);return _e(r,Bc(l)),r}function Zb(l){let r=z.useContext(xa);return _e(r,Bc(l)),r}function qc(l){let r=Zb(l),o=r.matches[r.matches.length-1];return _e(o.route.id,`${l} can only be used on routes that contain a unique "id"`),o.route.id}function Kb(){return qc("useRouteId")}function kb(){let l=z.useContext(Hc),r=Xb("useRouteError"),o=qc("useRouteError");return l!==void 0?l:r.errors?.[o]}function Jb(){let{router:l}=Vb("useNavigate"),r=qc("useNavigate"),o=z.useRef(!1);return Py(()=>{o.current=!0}),z.useCallback(async(f,d={})=>{yt(o.current,Wy),o.current&&(typeof f=="number"?l.navigate(f):await l.navigate(f,{fromRouteId:r,...d}))},[l,r])}var hy={};function ev(l,r,o){!r&&!hy[l]&&(hy[l]=!0,yt(!1,o))}var my={};function yy(l,r){!l&&!my[r]&&(my[r]=!0,console.warn(r))}function Fb(l){let r={hasErrorBoundary:l.hasErrorBoundary||l.ErrorBoundary!=null||l.errorElement!=null};return l.Component&&(l.element&&yt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(r,{element:z.createElement(l.Component),Component:void 0})),l.HydrateFallback&&(l.hydrateFallbackElement&&yt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(r,{hydrateFallbackElement:z.createElement(l.HydrateFallback),HydrateFallback:void 0})),l.ErrorBoundary&&(l.errorElement&&yt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(r,{errorElement:z.createElement(l.ErrorBoundary),ErrorBoundary:void 0})),r}var $b=["HydrateFallback","hydrateFallbackElement"],Wb=class{constructor(){this.status="pending",this.promise=new Promise((l,r)=>{this.resolve=o=>{this.status==="pending"&&(this.status="resolved",l(o))},this.reject=o=>{this.status==="pending"&&(this.status="rejected",r(o))}})}};function Pb({router:l,flushSync:r,unstable_onError:o}){let[s,f]=z.useState(l.state),[d,h]=z.useState(),[p,y]=z.useState({isTransitioning:!1}),[m,g]=z.useState(),[E,M]=z.useState(),[N,B]=z.useState(),Q=z.useRef(new Map),V=z.useCallback(le=>{f(D=>(le.errors&&o&&Object.entries(le.errors).forEach(([F,K])=>{D.errors?.[F]!==K&&o(K)}),le))},[o]),X=z.useCallback((le,{deletedFetchers:D,flushSync:F,viewTransitionOpts:K})=>{le.fetchers.forEach((Re,He)=>{Re.data!==void 0&&Q.current.set(He,Re.data)}),D.forEach(Re=>Q.current.delete(Re)),yy(F===!1||r!=null,'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let se=l.window!=null&&l.window.document!=null&&typeof l.window.document.startViewTransition=="function";if(yy(K==null||se,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!K||!se){r&&F?r(()=>V(le)):z.startTransition(()=>V(le));return}if(r&&F){r(()=>{E&&(m&&m.resolve(),E.skipTransition()),y({isTransitioning:!0,flushSync:!0,currentLocation:K.currentLocation,nextLocation:K.nextLocation})});let Re=l.window.document.startViewTransition(()=>{r(()=>V(le))});Re.finished.finally(()=>{r(()=>{g(void 0),M(void 0),h(void 0),y({isTransitioning:!1})})}),r(()=>M(Re));return}E?(m&&m.resolve(),E.skipTransition(),B({state:le,currentLocation:K.currentLocation,nextLocation:K.nextLocation})):(h(le),y({isTransitioning:!0,flushSync:!1,currentLocation:K.currentLocation,nextLocation:K.nextLocation}))},[l.window,r,E,m,V]);z.useLayoutEffect(()=>l.subscribe(X),[l,X]),z.useEffect(()=>{p.isTransitioning&&!p.flushSync&&g(new Wb)},[p]),z.useEffect(()=>{if(m&&d&&l.window){let le=d,D=m.promise,F=l.window.document.startViewTransition(async()=>{z.startTransition(()=>V(le)),await D});F.finished.finally(()=>{g(void 0),M(void 0),h(void 0),y({isTransitioning:!1})}),M(F)}},[d,m,l.window,V]),z.useEffect(()=>{m&&d&&s.location.key===d.location.key&&m.resolve()},[m,E,s.location,d]),z.useEffect(()=>{!p.isTransitioning&&N&&(h(N.state),y({isTransitioning:!0,flushSync:!1,currentLocation:N.currentLocation,nextLocation:N.nextLocation}),B(void 0))},[p.isTransitioning,N]);let W=z.useMemo(()=>({createHref:l.createHref,encodeLocation:l.encodeLocation,go:le=>l.navigate(le),push:(le,D,F)=>l.navigate(le,{state:D,preventScrollReset:F?.preventScrollReset}),replace:(le,D,F)=>l.navigate(le,{replace:!0,state:D,preventScrollReset:F?.preventScrollReset})}),[l]),ee=l.basename||"/",ve=z.useMemo(()=>({router:l,navigator:W,static:!1,basename:ee,unstable_onError:o}),[l,W,ee,o]);return z.createElement(z.Fragment,null,z.createElement(on.Provider,{value:ve},z.createElement(ir.Provider,{value:s},z.createElement($y.Provider,{value:Q.current},z.createElement(Lc.Provider,{value:p},z.createElement(t1,{basename:ee,location:s.location,navigationType:s.historyAction,navigator:W},z.createElement(Ib,{routes:l.routes,future:l.future,state:s,unstable_onError:o})))))),null)}var Ib=z.memo(e1);function e1({routes:l,future:r,state:o,unstable_onError:s}){return Hb(l,void 0,o,s,r)}function tv(l){return Lb(l.context)}function t1({basename:l="/",children:r=null,location:o,navigationType:s="POP",navigator:f,static:d=!1}){_e(!rr(),"You cannot render a inside another . You should never have more than one in your app.");let h=l.replace(/^\/*/,"/"),p=z.useMemo(()=>({basename:h,navigator:f,static:d,future:{}}),[h,f,d]);typeof o=="string"&&(o=Nl(o));let{pathname:y="/",search:m="",hash:g="",state:E=null,key:M="default"}=o,N=z.useMemo(()=>{let B=ha(y,h);return B==null?null:{location:{pathname:B,search:m,hash:g,state:E,key:M},navigationType:s}},[h,y,m,g,E,M,s]);return yt(N!=null,` is not able to match the URL "${y}${m}${g}" because it does not start with the basename, so the won't render anything.`),N==null?null:z.createElement(_a.Provider,{value:p},z.createElement(qu.Provider,{children:r,value:N}))}var Nu="get",Uu="application/x-www-form-urlencoded";function Qu(l){return l!=null&&typeof l.tagName=="string"}function a1(l){return Qu(l)&&l.tagName.toLowerCase()==="button"}function l1(l){return Qu(l)&&l.tagName.toLowerCase()==="form"}function n1(l){return Qu(l)&&l.tagName.toLowerCase()==="input"}function i1(l){return!!(l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)}function r1(l,r){return l.button===0&&(!r||r==="_self")&&!i1(l)}var Cu=null;function u1(){if(Cu===null)try{new FormData(document.createElement("form"),0),Cu=!1}catch{Cu=!0}return Cu}var o1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function uc(l){return l!=null&&!o1.has(l)?(yt(!1,`"${l}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Uu}"`),null):l}function s1(l,r){let o,s,f,d,h;if(l1(l)){let p=l.getAttribute("action");s=p?ha(p,r):null,o=l.getAttribute("method")||Nu,f=uc(l.getAttribute("enctype"))||Uu,d=new FormData(l)}else if(a1(l)||n1(l)&&(l.type==="submit"||l.type==="image")){let p=l.form;if(p==null)throw new Error('Cannot submit a + + )} + + + + ) +} + +export default App diff --git a/packages/cli/src/db-studio/ui/src/assets/react.svg b/packages/cli/src/db-studio/ui/src/assets/react.svg new file mode 100644 index 0000000000..6c87de9bb3 --- /dev/null +++ b/packages/cli/src/db-studio/ui/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/cli/src/db-studio/ui/src/components/ui/button.tsx b/packages/cli/src/db-studio/ui/src/components/ui/button.tsx new file mode 100644 index 0000000000..65d4fcd9ca --- /dev/null +++ b/packages/cli/src/db-studio/ui/src/components/ui/button.tsx @@ -0,0 +1,57 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const buttonVariants = cva( + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + { + variants: { + variant: { + default: + "bg-primary text-primary-foreground shadow hover:bg-primary/90", + destructive: + "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", + outline: + "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground", + secondary: + "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-9 px-4 py-2", + sm: "h-8 rounded-md px-3 text-xs", + lg: "h-10 rounded-md px-8", + icon: "h-9 w-9", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button" + return ( + + ) + } +) +Button.displayName = "Button" + +export { Button, buttonVariants } diff --git a/packages/cli/src/db-studio/ui/src/components/ui/card.tsx b/packages/cli/src/db-studio/ui/src/components/ui/card.tsx new file mode 100644 index 0000000000..5f0647f8e8 --- /dev/null +++ b/packages/cli/src/db-studio/ui/src/components/ui/card.tsx @@ -0,0 +1,78 @@ +import * as React from "react" +import { cn } from "@/lib/utils" + +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +Card.displayName = "Card" + +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardHeader.displayName = "CardHeader" + +const CardTitle = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardTitle.displayName = "CardTitle" + +const CardDescription = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardDescription.displayName = "CardDescription" + +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardContent.displayName = "CardContent" + +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardFooter.displayName = "CardFooter" + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/packages/cli/src/db-studio/ui/src/components/ui/table.tsx b/packages/cli/src/db-studio/ui/src/components/ui/table.tsx new file mode 100644 index 0000000000..e20632ca38 --- /dev/null +++ b/packages/cli/src/db-studio/ui/src/components/ui/table.tsx @@ -0,0 +1,120 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +const Table = React.forwardRef< + HTMLTableElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+ + +)) +Table.displayName = "Table" + +const TableHeader = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableHeader.displayName = "TableHeader" + +const TableBody = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableBody.displayName = "TableBody" + +const TableFooter = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + tr]:last:border-b-0", + className + )} + {...props} + /> +)) +TableFooter.displayName = "TableFooter" + +const TableRow = React.forwardRef< + HTMLTableRowElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableRow.displayName = "TableRow" + +const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes +>(({ className, ...props }, ref) => ( +
[role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> +)) +TableHead.displayName = "TableHead" + +const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes +>(({ className, ...props }, ref) => ( + [role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> +)) +TableCell.displayName = "TableCell" + +const TableCaption = React.forwardRef< + HTMLTableCaptionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +TableCaption.displayName = "TableCaption" + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +} diff --git a/packages/cli/src/db-studio/ui/src/components/ui/textarea.tsx b/packages/cli/src/db-studio/ui/src/components/ui/textarea.tsx new file mode 100644 index 0000000000..e56b0affd7 --- /dev/null +++ b/packages/cli/src/db-studio/ui/src/components/ui/textarea.tsx @@ -0,0 +1,22 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +const Textarea = React.forwardRef< + HTMLTextAreaElement, + React.ComponentProps<"textarea"> +>(({ className, ...props }, ref) => { + return ( +