From fc69dfd063b3f75072d653ee6e50d5c571ce95fb Mon Sep 17 00:00:00 2001 From: "LASTA_DEV01\\lasta" Date: Wed, 20 May 2026 13:21:08 +0900 Subject: [PATCH] =?UTF-8?q?[crawler=5Fplatform=20=EC=82=AD=EC=A0=9C]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + crawler_platform/app/web-legacy/static/app.js | 812 ------------------ .../app/web-legacy/static/index.html | 281 ------ .../app/web-legacy/static/styles.css | 480 ----------- crawler_platform/app/web/__init__.py | 2 - .../app/web/static/assets/index-B9qLr-xp.js | 12 - .../web/static/assets/index-B9qLr-xp.js.map | 1 - .../app/web/static/assets/index-CAk04EKS.css | 1 - crawler_platform/app/web/static/index.html | 14 - .../app/web/static/locales/en/common.json | 172 ---- .../app/web/static/locales/ko/common.json | 172 ---- ontology_platform/.gitignore | 5 + .../configs/perfume_subscription.yaml | 113 +++ .../crawler_platform}/__init__.py | 0 .../crawler_platform}/app/__init__.py | 0 .../app/adapters/__init__.py | 0 .../crawler_platform}/app/adapters/base.py | 0 .../app/adapters/ecommerce/__init__.py | 0 .../app/adapters/ecommerce/perfume.py | 0 .../app/adapters/registry.py | 0 .../crawler_platform}/app/api/__init__.py | 0 .../crawler_platform}/app/api/routes.py | 0 .../crawler_platform}/app/cli/__init__.py | 0 .../crawler_platform}/app/cli/main.py | 0 .../crawler_platform}/app/config/__init__.py | 0 .../crawler_platform}/app/config/loader.py | 0 .../crawler_platform}/app/core/__init__.py | 0 .../app/core/crawler/__init__.py | 0 .../app/core/crawler/content_zone.py | 0 .../app/core/crawler/discovery.py | 0 .../app/core/crawler/fetchers.py | 0 .../app/core/crawler/html_cleaner.py | 0 .../app/core/crawler/page_classifier.py | 0 .../app/core/crawler/page_cleaner.py | 0 .../app/core/crawler/pipeline.py | 0 .../app/core/crawler/plugins.py | 0 .../app/core/crawler/site_crawler.py | 0 .../app/core/database/__init__.py | 0 .../app/core/database/models.py | 0 .../app/core/database/repository.py | 0 .../app/core/database/session.py | 0 .../app/core/extractor/__init__.py | 0 .../app/core/extractor/ai_provider.py | 0 .../app/core/extractor/base.py | 0 .../app/core/extractor/factory.py | 0 .../app/core/extractor/rule_based.py | 0 .../app/core/extractor/validation.py | 0 .../app/core/ontology/__init__.py | 0 .../app/core/ontology/definitions.py | 0 .../app/core/ontology/entity_normalizer.py | 0 .../app/core/ontology/gap_detector.py | 0 .../app/core/ontology/graph_merge.py | 0 .../app/core/ontology/mapper.py | 0 .../app/core/ontology/registry.py | 0 .../app/core/ontology/relation_schema.py | 0 .../app/core/ontology/structured_output.py | 0 .../app/core/ontology/triple_store.py | 0 .../app/core/recommendation/__init__.py | 0 .../app/core/recommendation/scorer.py | 0 .../app/core/research/__init__.py | 0 .../app/core/research/entity_expansion.py | 0 .../app/core/research/exploration_queue.py | 0 .../app/core/research/gap_task_planner.py | 0 .../app/core/research/graph_query.py | 0 .../app/core/research/graph_research_loop.py | 0 .../app/core/research/memory_store.py | 0 .../app/core/research/relevance_engine.py | 0 .../app/core/scheduler/__init__.py | 0 .../app/core/scheduler/update_policy.py | 0 .../crawler_platform}/app/domains/__init__.py | 0 .../app/domains/candle/__init__.py | 0 .../app/domains/coffee/__init__.py | 0 .../app/domains/gift/__init__.py | 0 .../app/domains/perfume/__init__.py | 0 .../app/domains/perfume/extractor.py | 0 .../app/domains/supplement/__init__.py | 0 .../app/domains/tea/__init__.py | 0 .../crawler_platform}/app/main.py | 8 +- ontology_platform/ont_platform/api/main.py | 4 +- .../ont_platform/api/product_backend.py | 87 ++ ontology_platform/pyproject.toml | 4 +- .../web/frontend/.gitignore | 0 .../web/frontend/index.html | 0 .../web/frontend/package-lock.json | 4 +- .../web/frontend/package.json | 2 +- .../web/frontend/postcss.config.js | 0 .../frontend/public/locales/en/common.json | 0 .../frontend/public/locales/ko/common.json | 0 .../web/frontend/src/App.tsx | 0 .../src/components/layout/AppShell.tsx | 0 .../web/frontend/src/components/ui/badge.tsx | 0 .../web/frontend/src/components/ui/button.tsx | 0 .../web/frontend/src/components/ui/card.tsx | 0 .../web/frontend/src/components/ui/input.tsx | 0 .../web/frontend/src/components/ui/label.tsx | 0 .../frontend/src/components/ui/progress.tsx | 0 .../web/frontend/src/components/ui/select.tsx | 0 .../frontend/src/components/ui/skeleton.tsx | 0 .../web/frontend/src/components/ui/tabs.tsx | 0 .../frontend/src/components/ui/textarea.tsx | 0 .../web/frontend/src/hooks/queryKeys.ts | 0 .../web/frontend/src/hooks/useClaims.ts | 0 .../web/frontend/src/hooks/useCrawl.ts | 0 .../web/frontend/src/hooks/useDomains.ts | 0 .../web/frontend/src/hooks/useEntities.ts | 0 .../web/frontend/src/hooks/usePlatform.ts | 0 .../web/frontend/src/hooks/useProjects.ts | 0 .../web/frontend/src/hooks/useResearch.ts | 0 .../web/frontend/src/hooks/useSources.ts | 0 .../web/frontend/src/i18n.ts | 0 .../web/frontend/src/legacy/api.js | 0 .../web/frontend/src/legacy/graph.js | 0 .../web/frontend/src/legacy/i18n.js | 0 .../web/frontend/src/legacy/inspector.js | 0 .../web/frontend/src/legacy/main.js | 0 .../web/frontend/src/legacy/pipeline.js | 0 .../web/frontend/src/legacy/search.js | 0 .../web/frontend/src/legacy/shell.js | 0 .../web/frontend/src/legacy/sidebar.js | 0 .../web/frontend/src/legacy/state.js | 0 .../frontend/src/legacy/styles/components.css | 0 .../web/frontend/src/legacy/styles/graph.css | 0 .../web/frontend/src/legacy/styles/index.css | 0 .../frontend/src/legacy/styles/inspector.css | 0 .../frontend/src/legacy/styles/pipeline.css | 0 .../web/frontend/src/legacy/styles/search.css | 0 .../web/frontend/src/legacy/styles/shell.css | 0 .../frontend/src/legacy/styles/sidebar.css | 0 .../web/frontend/src/legacy/styles/tokens.css | 0 .../frontend/src/legacy/styles/workbench.css | 0 .../frontend/src/legacy/styles/workspace.css | 0 .../web/frontend/src/legacy/utils.js | 0 .../web/frontend/src/legacy/workbench.js | 0 .../web/frontend/src/legacy/workspace.js | 0 .../web/frontend/src/lib/api/claims.ts | 0 .../web/frontend/src/lib/api/client.ts | 0 .../web/frontend/src/lib/api/crawl.ts | 0 .../web/frontend/src/lib/api/domains.ts | 0 .../web/frontend/src/lib/api/entities.ts | 0 .../web/frontend/src/lib/api/index.ts | 0 .../web/frontend/src/lib/api/ontology.ts | 0 .../web/frontend/src/lib/api/platform.ts | 0 .../web/frontend/src/lib/api/projects.ts | 0 .../web/frontend/src/lib/api/research.ts | 0 .../web/frontend/src/lib/api/sources.ts | 0 .../web/frontend/src/lib/display.ts | 0 .../web/frontend/src/lib/queryClient.ts | 0 .../web/frontend/src/lib/utils.ts | 0 .../web/frontend/src/main.tsx | 0 .../frontend/src/pages/BuildPipelinePage.tsx | 0 .../src/pages/ConfigureSourcesPage.tsx | 0 .../web/frontend/src/pages/CrawlPage.tsx | 0 .../web/frontend/src/pages/DashboardPage.tsx | 0 .../web/frontend/src/pages/ExportApiPage.tsx | 0 .../web/frontend/src/pages/GraphViewPage.tsx | 0 .../web/frontend/src/pages/OnboardingPage.tsx | 0 .../frontend/src/pages/OntologyEditorPage.tsx | 0 .../frontend/src/pages/PageAnalysisPage.tsx | 0 .../src/pages/QualityInspectorPage.tsx | 0 .../web/frontend/src/pages/ResearchPage.tsx | 0 .../web/frontend/src/pages/ReviewPage.tsx | 0 .../frontend/src/pages/SchemaDesignerPage.tsx | 0 .../web/frontend/src/stores/index.ts | 0 .../frontend/src/stores/slices/crawlSlice.ts | 0 .../src/stores/slices/ontologySlice.ts | 0 .../web/frontend/src/stores/slices/uiSlice.ts | 0 .../web/frontend/src/styles/globals.css | 0 .../web/frontend/tailwind.config.js | 0 .../web/frontend/tsconfig.json | 0 .../web/frontend/tsconfig.node.json | 0 .../web/frontend/vite.config.js | 7 +- restart_all_servers.bat | 40 +- shutdown_all_servers.bat | 67 ++ 173 files changed, 307 insertions(+), 1982 deletions(-) delete mode 100644 crawler_platform/app/web-legacy/static/app.js delete mode 100644 crawler_platform/app/web-legacy/static/index.html delete mode 100644 crawler_platform/app/web-legacy/static/styles.css delete mode 100644 crawler_platform/app/web/__init__.py delete mode 100644 crawler_platform/app/web/static/assets/index-B9qLr-xp.js delete mode 100644 crawler_platform/app/web/static/assets/index-B9qLr-xp.js.map delete mode 100644 crawler_platform/app/web/static/assets/index-CAk04EKS.css delete mode 100644 crawler_platform/app/web/static/index.html delete mode 100644 crawler_platform/app/web/static/locales/en/common.json delete mode 100644 crawler_platform/app/web/static/locales/ko/common.json create mode 100644 ontology_platform/configs/perfume_subscription.yaml rename {crawler_platform => ontology_platform/crawler_platform}/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/adapters/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/adapters/base.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/adapters/ecommerce/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/adapters/ecommerce/perfume.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/adapters/registry.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/api/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/api/routes.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/cli/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/cli/main.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/config/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/config/loader.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/content_zone.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/discovery.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/fetchers.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/html_cleaner.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/page_classifier.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/page_cleaner.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/pipeline.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/plugins.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/crawler/site_crawler.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/database/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/database/models.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/database/repository.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/database/session.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/ai_provider.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/base.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/factory.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/rule_based.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/extractor/validation.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/definitions.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/entity_normalizer.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/gap_detector.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/graph_merge.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/mapper.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/registry.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/relation_schema.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/structured_output.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/ontology/triple_store.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/recommendation/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/recommendation/scorer.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/entity_expansion.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/exploration_queue.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/gap_task_planner.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/graph_query.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/graph_research_loop.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/memory_store.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/research/relevance_engine.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/scheduler/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/core/scheduler/update_policy.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/candle/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/coffee/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/gift/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/perfume/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/perfume/extractor.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/supplement/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/domains/tea/__init__.py (100%) rename {crawler_platform => ontology_platform/crawler_platform}/app/main.py (80%) create mode 100644 ontology_platform/ont_platform/api/product_backend.py rename {crawler_platform/app => ontology_platform}/web/frontend/.gitignore (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/index.html (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/package-lock.json (99%) rename {crawler_platform/app => ontology_platform}/web/frontend/package.json (97%) rename {crawler_platform/app => ontology_platform}/web/frontend/postcss.config.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/public/locales/en/common.json (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/public/locales/ko/common.json (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/App.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/layout/AppShell.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/badge.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/button.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/card.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/input.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/label.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/progress.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/select.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/skeleton.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/tabs.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/components/ui/textarea.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/queryKeys.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useClaims.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useCrawl.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useDomains.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useEntities.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/usePlatform.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useProjects.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useResearch.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/hooks/useSources.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/i18n.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/api.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/graph.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/i18n.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/inspector.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/main.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/pipeline.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/search.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/shell.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/sidebar.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/state.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/components.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/graph.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/index.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/inspector.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/pipeline.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/search.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/shell.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/sidebar.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/tokens.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/workbench.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/styles/workspace.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/utils.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/workbench.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/legacy/workspace.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/claims.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/client.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/crawl.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/domains.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/entities.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/index.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/ontology.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/platform.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/projects.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/research.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/api/sources.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/display.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/queryClient.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/lib/utils.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/main.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/BuildPipelinePage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/ConfigureSourcesPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/CrawlPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/DashboardPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/ExportApiPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/GraphViewPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/OnboardingPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/OntologyEditorPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/PageAnalysisPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/QualityInspectorPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/ResearchPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/ReviewPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/pages/SchemaDesignerPage.tsx (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/stores/index.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/stores/slices/crawlSlice.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/stores/slices/ontologySlice.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/stores/slices/uiSlice.ts (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/src/styles/globals.css (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/tailwind.config.js (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/tsconfig.json (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/tsconfig.node.json (100%) rename {crawler_platform/app => ontology_platform}/web/frontend/vite.config.js (89%) create mode 100644 shutdown_all_servers.bat diff --git a/.gitignore b/.gitignore index cd9d6b2..e539894 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ crawler_platform.db-* *.sqlite-* *.sqlite3-* uvicorn.*.log +.server-logs/ diff --git a/crawler_platform/app/web-legacy/static/app.js b/crawler_platform/app/web-legacy/static/app.js deleted file mode 100644 index 741c840..0000000 --- a/crawler_platform/app/web-legacy/static/app.js +++ /dev/null @@ -1,812 +0,0 @@ -const state = { - projects: [], - selectedProject: null, - projectDetail: null, - ontology: null, - siteCrawlPoll: null, - siteCrawlPageCount: 0, - activeSiteCrawlJobId: null, -}; - -const $ = (id) => document.getElementById(id); - -function csv(value) { - return value.split(",").map((item) => item.trim()).filter(Boolean); -} - -async function api(path, options = {}) { - const response = await fetch(path, { - headers: { "Content-Type": "application/json" }, - ...options, - }); - if (!response.ok) { - let detail = `${response.status} ${response.statusText}`; - try { - const body = await response.json(); - detail = body.detail || body.error || detail; - } catch { - // Keep status text. - } - throw new Error(detail); - } - return response.json(); -} - -function toast(message) { - const node = $("toast"); - node.textContent = message; - node.classList.add("show"); - window.setTimeout(() => node.classList.remove("show"), 2400); -} - -function requestBase() { - return { - config_path: $("configPath").value.trim(), - source_name: $("sourceSelect").value, - url: $("crawlUrl").value.trim(), - extractor_provider: $("extractorProvider").value, - extractor_model: $("extractorModel").value.trim() || null, - extractor_base_url: $("extractorBaseUrl").value.trim() || null, - }; -} - -async function loadProjects() { - state.projects = await api("/projects"); - if (!state.selectedProject && state.projects.length) { - state.selectedProject = state.projects[0].name; - } - renderProjects(); - if (state.selectedProject) { - await selectProject(state.selectedProject); - } -} - -function renderProjects() { - const list = $("projectList"); - list.innerHTML = ""; - state.projects.forEach((project) => { - const button = document.createElement("button"); - button.className = `project-item ${state.selectedProject === project.name ? "active" : ""}`; - button.innerHTML = `${escapeHtml(project.name)}${escapeHtml(project.domain)}`; - button.addEventListener("click", () => selectProject(project.name)); - list.appendChild(button); - }); -} - -async function selectProject(projectName) { - state.selectedProject = projectName; - state.projectDetail = await api(`/projects/${encodeURIComponent(projectName)}`); - state.ontology = await api(`/ontology/${encodeURIComponent(state.projectDetail.domain)}`); - renderProjects(); - renderOverview(); - renderOntology(); - await Promise.all([ - loadOntologyRegistry(), - loadEntities(), - loadClaims(), - loadExtractionLogs(), - loadResearchSessions(), - loadGraphQuery(), - loadTags(), - ]); -} - -function renderOverview() { - const detail = state.projectDetail; - $("metricProject").textContent = detail?.name ?? "-"; - $("metricDomain").textContent = detail?.domain ?? "-"; - $("metricSources").textContent = detail?.sources?.length ?? 0; - - const sourceSelect = $("sourceSelect"); - sourceSelect.innerHTML = ""; - (detail?.sources ?? []).forEach((source) => { - const option = document.createElement("option"); - option.value = source.name; - option.textContent = `${source.name} (${source.type})`; - sourceSelect.appendChild(option); - }); - $("sourceTable").innerHTML = table( - ["Name", "Type", "Trust", "Robots", "Rate"], - (detail?.sources ?? []).map((source) => [ - source.name, - source.type, - source.trust_level, - source.respect_robots_txt ? "on" : "off", - `${source.rate_limit_per_minute}/min`, - ]) - ); -} - -function renderOntology() { - const entityTypes = state.ontology?.entity_types ?? []; - const predicates = state.ontology?.predicates ?? []; - $("ontologyEntities").innerHTML = entityTypes.map(chip).join(""); - $("ontologyPredicates").innerHTML = predicates.map(chip).join(""); - $("entityTypeFilter").innerHTML = `${entityTypes - .map((type) => ``) - .join("")}`; -} - -async function loadOntologyRegistry() { - if (!state.selectedProject) return; - const [registry, proposals, gaps, triples] = await Promise.all([ - api(`/projects/${encodeURIComponent(state.selectedProject)}/ontology/registry`), - api(`/projects/${encodeURIComponent(state.selectedProject)}/ontology/proposals?limit=50`), - api(`/projects/${encodeURIComponent(state.selectedProject)}/knowledge-gaps?limit=50`), - api(`/projects/${encodeURIComponent(state.selectedProject)}/ontology/triples?limit=50`), - ]); - $("ontologyRegistryEntityTable").innerHTML = table( - ["Type", "Domain", "Status", "Confidence"], - (registry.entity_types ?? []).map((row) => [ - row.name, - row.domain, - row.status, - Math.round((row.confidence ?? 0) * 100) + "%", - ]) - ); - $("ontologyRegistryRelationTable").innerHTML = table( - ["Relation", "Domain", "Subject", "Object", "Status"], - (registry.relation_types ?? []).map((row) => [ - row.name, - row.domain, - (row.allowed_subject_types ?? []).join(", "), - (row.allowed_object_types ?? []).join(", ") || (row.semantic_constraints?.literal_value ? "literal" : ""), - row.status, - ]) - ); - $("ontologyProposalTable").innerHTML = table( - ["Type", "Name", "Status", "Reason"], - (proposals ?? []).map((row) => [row.proposal_type, row.name, row.status, escapeHtml(row.reason ?? "")]) - ); - $("knowledgeGapTable").innerHTML = table( - ["Gap", "Target", "Priority", "Description"], - (gaps ?? []).map((row) => [ - row.gap_type, - `${row.target_type ?? ""}: ${row.target_name ?? ""}`, - Math.round((row.priority ?? 0) * 100) + "%", - escapeHtml(row.description ?? ""), - ]) - ); - $("ontologyTripleTable").innerHTML = table( - ["Subject", "Relation", "Object", "Status", "Support"], - (triples ?? []).map((row) => [ - row.subject ?? "", - row.predicate, - row.object ?? JSON.stringify(row.object_value ?? ""), - row.status, - row.support_count, - ]) - ); -} - -async function createProject() { - const configPath = $("configPath").value.trim(); - if (!configPath) return; - const result = await api("/projects", { - method: "POST", - body: JSON.stringify({ config_path: configPath }), - }); - toast(`Project created: ${result.name}`); - state.selectedProject = result.name; - await loadProjects(); -} - -async function initializeCurrentProject() { - const configPath = $("configPath").value.trim(); - if (!configPath) { - toast("Config path is required"); - return; - } - if (!window.confirm("Reset current project crawl data (pages/entities/claims)?")) return; - const result = await api("/projects/reset", { - method: "POST", - body: JSON.stringify({ - config_path: configPath, - project_name: state.selectedProject, - }), - }); - state.selectedProject = result.name; - await loadProjects(); - if (result.reset) { - const removedClaims = result.deleted?.claims ?? 0; - const removedEntities = result.deleted?.entities ?? 0; - const removedPages = result.deleted?.pages ?? 0; - $("crawlResult").textContent = `Reset done: pages ${removedPages}, entities ${removedEntities}, claims ${removedClaims}`; - toast(`Reset completed: ${result.name}`); - return; - } - $("crawlResult").textContent = `Project created: ${result.name}`; - toast(`Project created: ${result.name}`); -} -async function crawl() { - if (!state.selectedProject) return; - $("crawlResult").textContent = "Crawling one URL..."; - try { - const result = await api("/crawl", { - method: "POST", - body: JSON.stringify(requestBase()), - }); - $("crawlResult").textContent = - `URL done: page ${result.page_id}, ${result.crawl_status}/${result.extraction_status}, ${result.page_type}, raw ${result.raw_text_length}, clean ${result.clean_text_length}, claims ${result.claim_count}, entities ${result.entity_count}`; - toast("URL crawl completed"); - await Promise.all([ - loadOntologyRegistry(), - loadEntities(), - loadClaims(), - loadExtractionLogs(), - loadResearchSessions(), - loadGraphQuery(), - loadTags(), - ]); - } catch (error) { - $("crawlResult").textContent = `Crawl failed: ${error.message}`; - toast("Crawl failed"); - } -} - -async function crawlSite() { - if (!state.selectedProject) return; - stopSiteCrawlPolling(); - state.siteCrawlPageCount = 0; - state.siteCrawlPollErrorCount = 0; - $("crawlResult").textContent = "Starting site crawl from seed..."; - $("discoveredLinks").innerHTML = ""; - try { - const job = await api("/crawl-site", { - method: "POST", - body: JSON.stringify({ - ...requestBase(), - max_depth: Number($("siteMaxDepth").value || 0), - max_pages: Number($("siteMaxPages").value || 1), - same_domain_only: $("sameDomainOnly").checked, - analyze_page_types: ["ProductPage", "BrandStoryPage", "ReviewPage"], - }), - }); - $("crawlResult").textContent = `Site crawl queued: job ${job.job_id}`; - state.activeSiteCrawlJobId = job.job_id; - $("stopSiteCrawlBtn").disabled = false; - renderSiteCrawlProgress(job); - pollSiteCrawl(job.job_id); - toast("Site crawl started"); - } catch (error) { - $("crawlResult").textContent = `Site crawl failed: ${error.message}`; - toast("Site crawl failed"); - } -} - -async function stopSiteCrawl() { - const jobId = state.activeSiteCrawlJobId; - if (!jobId) return; - $("stopSiteCrawlBtn").disabled = true; - $("crawlResult").textContent = `Stopping site crawl: job ${jobId}`; - try { - const job = await api(`/crawl-site/jobs/${jobId}/cancel`, { method: "POST" }); - renderSiteCrawlProgress(job); - toast("Stop requested"); - } catch (error) { - $("stopSiteCrawlBtn").disabled = false; - $("crawlResult").textContent = `Stop failed: ${error.message}`; - toast("Stop failed"); - } -} - -function stopSiteCrawlPolling() { - if (state.siteCrawlPoll) { - window.clearTimeout(state.siteCrawlPoll); - state.siteCrawlPoll = null; - } -} - -async function pollSiteCrawl(jobId) { - let job; - try { - job = await api(`/crawl-site/jobs/${jobId}`); - } catch (error) { - const transient = state.siteCrawlPollErrorCount = (state.siteCrawlPollErrorCount ?? 0) + 1; - $("crawlResult").textContent = `Site crawl status check failed (retry ${transient}): ${error.message}`; - if (transient >= 5) { - stopSiteCrawlPolling(); - toast("Site crawl status failed"); - return; - } - state.siteCrawlPoll = window.setTimeout(() => pollSiteCrawl(jobId), 3000); - return; - } - state.siteCrawlPollErrorCount = 0; - - const progress = job.progress ?? {}; - const pageCount = progress.pages?.length ?? 0; - renderSiteCrawlProgress(job); - if (pageCount !== state.siteCrawlPageCount) { - state.siteCrawlPageCount = pageCount; - const loaders = [ - ["ontology registry", loadOntologyRegistry], - ["entities", loadEntities], - ["claims", loadClaims], - ["extraction logs", loadExtractionLogs], - ["research sessions", loadResearchSessions], - ["graph query", loadGraphQuery], - ["tags", loadTags], - ]; - await Promise.all(loaders.map(async ([label, fn]) => { - try { - await fn(); - } catch (error) { - console.warn(`poll: ${label} reload failed`, error); - } - })); - } - if (["completed", "failed", "canceled"].includes(job.status)) { - stopSiteCrawlPolling(); - state.activeSiteCrawlJobId = null; - $("stopSiteCrawlBtn").disabled = true; - toast(job.status === "completed" ? "Site crawl completed" : `Site crawl ${job.status}`); - return; - } - state.siteCrawlPoll = window.setTimeout(() => pollSiteCrawl(jobId), 1500); -} - -function renderSiteCrawlProgress(job) { - const progress = job.progress ?? {}; - const pages = progress.pages ?? []; - $("crawlResult").textContent = - `Site ${job.status}: visited ${progress.visited_count ?? 0}, analyzed ${progress.analyzed_count ?? 0}, skipped ${progress.skipped_count ?? 0}, queued ${progress.queued_count ?? 0}`; - $("discoveredLinks").innerHTML = pages.map(renderSitePage).join(""); - document.querySelectorAll("[data-discovered-url]").forEach((button) => { - button.addEventListener("click", () => { - $("crawlUrl").value = button.dataset.discoveredUrl; - toast("URL copied to input"); - }); - }); -} - -function renderSitePage(page) { - const diagnostics = `raw ${page.raw_text_length ?? 0}, clean ${page.clean_text_length ?? 0}, removed ${page.removed_noise_zones_count ?? 0}`; - const warnings = (page.warnings ?? []).length ? `, warnings: ${(page.warnings ?? []).join("; ")}` : ""; - return ` - - `; -} - -async function discover() { - $("crawlResult").textContent = "Discovering links..."; - $("discoveredLinks").innerHTML = ""; - try { - const result = await api("/discover", { - method: "POST", - body: JSON.stringify({ - config_path: $("configPath").value.trim(), - source_name: $("sourceSelect").value, - url: $("crawlUrl").value.trim(), - limit: 30, - }), - }); - if (!result.ok) { - $("crawlResult").textContent = result.error ?? "Discovery failed"; - return; - } - $("crawlResult").textContent = `Discovered ${result.links.length} links`; - $("discoveredLinks").innerHTML = result.links.map(renderDiscoveredLink).join(""); - document.querySelectorAll("[data-discovered-url]").forEach((button) => { - button.addEventListener("click", () => { - $("crawlUrl").value = button.dataset.discoveredUrl; - toast("URL copied to input"); - }); - }); - } catch (error) { - $("crawlResult").textContent = `Discovery failed: ${error.message}`; - toast("Discovery failed"); - } -} - -function renderDiscoveredLink(link) { - return ` - - `; -} - -function updateExtractorOptions() { - const provider = $("extractorProvider").value; - $("extractorOptions").classList.toggle("active", provider !== "rule_based"); - if (provider === "ollama" && !$("extractorBaseUrl").value.trim()) { - $("extractorBaseUrl").placeholder = "http://localhost:11434/api/chat"; - } else if (provider === "lm_studio" && !$("extractorBaseUrl").value.trim()) { - $("extractorBaseUrl").value = "http://localhost:1234/v1"; - $("extractorBaseUrl").placeholder = "http://localhost:1234/v1"; - } else { - $("extractorBaseUrl").placeholder = "optional provider endpoint"; - } -} - -async function testExtractor(options = {}) { - const announce = options.announce ?? true; - const provider = $("extractorProvider").value; - const baseUrl = $("extractorBaseUrl").value.trim(); - if (announce) { - $("crawlResult").textContent = "Testing analyzer..."; - } - const result = await api("/extractors/models", { - method: "POST", - body: JSON.stringify({ provider, base_url: baseUrl || null }), - }); - if (!result.ok) { - if (announce) { - $("crawlResult").textContent = `Analyzer failed: ${result.error}`; - toast("Analyzer failed"); - } - return; - } - const models = result.models ?? []; - if (models.length && !$("extractorModel").value.trim()) { - $("extractorModel").value = models[0].id; - } - if (announce) { - $("crawlResult").textContent = models.length - ? `Analyzer connected. Models: ${models.map((model) => model.id).join(", ")}` - : "Analyzer connected. No models returned."; - toast("Analyzer connected"); - } -} - -async function connectDefaultAnalyzer() { - if ($("extractorProvider").value !== "lm_studio") return; - try { - await testExtractor({ announce: false }); - } catch { - // LM Studio may not be running yet; keep the default fields ready. - } -} - -async function loadEntities() { - if (!state.selectedProject) return; - const type = $("entityTypeFilter").value; - const query = type ? `?entity_type=${encodeURIComponent(type)}&limit=100` : "?limit=100"; - const entities = await api(`/projects/${encodeURIComponent(state.selectedProject)}/entities${query}`); - $("metricEntities").textContent = entities.length; - $("entityTable").innerHTML = table( - ["ID", "Type", "Name", "Metadata"], - entities.map((entity) => [ - entity.id, - entity.type, - entity.name, - `${escapeHtml(JSON.stringify(entity.metadata ?? {}))}`, - ]) - ); -} - -async function mergeEntities() { - if (!state.selectedProject) return; - const sourceId = Number($("mergeSourceId").value); - const targetId = Number($("mergeTargetId").value); - if (!sourceId || !targetId || sourceId === targetId) { - toast("Check entity IDs"); - return; - } - const result = await api("/entities/merge", { - method: "POST", - body: JSON.stringify({ - project_name: state.selectedProject, - source_entity_id: sourceId, - target_entity_id: targetId, - }), - }); - if (!result.ok) { - toast(result.error ?? "Merge failed"); - return; - } - toast("Entity merged"); - $("mergeSourceId").value = ""; - $("mergeTargetId").value = ""; - await Promise.all([ - loadOntologyRegistry(), - loadEntities(), - loadClaims(), - loadExtractionLogs(), - loadResearchSessions(), - loadGraphQuery(), - loadTags(), - ]); -} - -async function loadClaims() { - if (!state.selectedProject) return; - const includeCandidates = $("showCandidateClaims")?.checked ? "&include_candidates=true" : ""; - const claims = await api(`/projects/${encodeURIComponent(state.selectedProject)}/claims?limit=100${includeCandidates}`); - $("claimTable").innerHTML = claims.map(renderClaim).join(""); - document.querySelectorAll("[data-save-claim]").forEach((button) => { - button.addEventListener("click", () => updateClaimConfidence(button.dataset.saveClaim)); - }); -} - -function renderClaim(claim) { - const object = claim.object ?? JSON.stringify(claim.object_value ?? ""); - const breakdown = claim.confidence_breakdown - ? `LLM ${Math.round((claim.confidence_breakdown.llm_confidence ?? 0) * 100)}%, evidence ${Math.round((claim.confidence_breakdown.evidence_confidence ?? 0) * 100)}%, ontology ${Math.round((claim.confidence_breakdown.ontology_confidence ?? 0) * 100)}%, stored ${Math.round((claim.confidence_breakdown.stored_confidence ?? claim.confidence) * 100)}%` - : ""; - return ` -
-
- ${escapeHtml(claim.subject)} - ${escapeHtml(claim.predicate)} - ${escapeHtml(object)} - ${escapeHtml(claim.status ?? "active")} - ${Math.round(claim.confidence * 100)}% -
-
${escapeHtml(claim.evidence_text ?? "")}
-
${escapeHtml(claim.page_type ?? "")} / ${escapeHtml(claim.source_zone ?? "")} / ${escapeHtml(claim.source_selector ?? "")}
-
${escapeHtml(claim.validation_status ?? "")} / graph ${escapeHtml(claim.graph_merge_status ?? "")}${claim.graph_merge_reason ? `: ${escapeHtml(claim.graph_merge_reason)}` : ""}
-
${claim.review_required ? `review: ${escapeHtml(claim.review_reason ?? "required")}` : ""}
-
${escapeHtml(breakdown)}
-
${escapeHtml(claim.source)} · ${escapeHtml(claim.page_url ?? "")}
-
- - - -
-
- `; -} - -async function updateClaimConfidence(claimId) { - const confidence = Number($(`confidence-${claimId}`).value); - const reason = $(`reason-${claimId}`).value.trim(); - await api(`/claims/${claimId}/confidence`, { - method: "PATCH", - body: JSON.stringify({ confidence, reason }), - }); - toast("Claim updated"); - await loadClaims(); -} - -async function loadExtractionLogs() { - if (!state.selectedProject) return; - const logs = await api(`/projects/${encodeURIComponent(state.selectedProject)}/extraction-logs?limit=50`); - $("extractionLogTable").innerHTML = logs.map(renderExtractionLog).join(""); -} - -function renderExtractionLog(log) { - const validation = log.validation ?? {}; - const context = log.page_context ?? {}; - const rejected = validation.rejected_claims ?? []; - const rejectedPreview = rejected - .slice(0, 3) - .map((item) => `${item.predicate ?? ""}: ${item.reason ?? ""}`) - .join(" | "); - return ` -
-
- ${escapeHtml(log.extractor_name)} - ${escapeHtml(log.provider)} - ${escapeHtml(validation.claim_status ?? "")} - accepted ${validation.accepted_claim_count ?? 0} - rejected ${validation.rejected_claim_count ?? 0} -
-
${escapeHtml(context.page_type ?? "")} / ${escapeHtml(context.crawl_status ?? "")} / ${escapeHtml(context.extraction_status ?? "")}
-
${escapeHtml(log.page_url ?? "")}
-
${escapeHtml(rejectedPreview)}
-
- `; -} - -async function runResearch() { - if (!state.selectedProject) return; - $("researchResult").textContent = "Running graph research..."; - const seedEntityRaw = $("researchSeedEntityId").value.trim(); - try { - const result = await api("/research/run", { - method: "POST", - body: JSON.stringify({ - ...requestBase(), - project_name: state.selectedProject, - seed_entity_id: seedEntityRaw ? Number(seedEntityRaw) : null, - goal: $("researchGoal").value.trim() || "Semantic ontology exploration", - max_depth: Number($("siteMaxDepth").value || 2), - max_steps: Number($("researchMaxSteps").value || 8), - max_branch: 8, - min_relevance: Number($("researchMinRelevance").value || 0.35), - same_domain_only: $("sameDomainOnly").checked, - analyze_page_types: ["ProductPage", "BrandStoryPage", "ReviewPage"], - }), - }); - $("researchResult").textContent = - `Research ${result.status}: explored ${result.explored_count}, analyzed ${result.analyzed_count}, queued ${result.queued_count}, skipped ${result.skipped_count}`; - toast("Research completed"); - await Promise.all([ - loadOntologyRegistry(), - loadEntities(), - loadClaims(), - loadExtractionLogs(), - loadResearchSessions(), - loadGraphQuery(), - loadTags(), - ]); - } catch (error) { - $("researchResult").textContent = `Research failed: ${error.message}`; - toast("Research failed"); - } -} - -async function loadResearchSessions() { - if (!state.selectedProject) return; - const sessions = await api(`/projects/${encodeURIComponent(state.selectedProject)}/research/sessions?limit=20`); - $("researchSessions").innerHTML = sessions.map(renderResearchSession).join(""); -} - -function renderResearchSession(session) { - const history = session.history ?? []; - const latest = history.length ? history[history.length - 1] : null; - const memory = session.memory ?? {}; - const conflicts = memory.conflicts ?? []; - return ` -
-
- ${escapeHtml(session.name ?? "Research session")} - ${escapeHtml(session.status ?? "")} - history ${history.length} - queue ${(session.queue ?? []).length} - conflicts ${conflicts.length} -
-
${escapeHtml(session.goal ?? "")}
-
seed ${escapeHtml(session.seed ?? "")}
-
${escapeHtml(latest?.outcome?.reason ?? latest?.outcome?.status ?? "")}
-
- `; -} - -async function loadGraphQuery() { - if (!state.selectedProject) return; - const kind = $("graphQueryKind")?.value ?? "trend_summary"; - const text = $("graphQueryText")?.value.trim() ?? ""; - let query = `kind=${encodeURIComponent(kind)}`; - if (kind === "brand_products" && text) query += `&brand=${encodeURIComponent(text)}`; - if (kind === "products_by_tag" && text) query += `&tag=${encodeURIComponent(text)}`; - const rows = await api(`/projects/${encodeURIComponent(state.selectedProject)}/graph/query?${query}`); - $("graphQueryTable").innerHTML = renderGraphRows(kind, rows); -} - -function renderGraphRows(kind, rows) { - if (kind === "brand_products") { - return table( - ["Product", "Type", "Brand", "Confidence"], - rows.map((row) => [row.product, row.product_type, row.brand ?? "", Math.round(row.confidence * 100) + "%"]) - ); - } - if (kind === "products_by_tag") { - return table( - ["Product", "Predicate", "Tag", "Confidence"], - rows.map((row) => [row.product, row.predicate, row.tag, Math.round(row.confidence * 100) + "%"]) - ); - } - if (kind === "relation_summary") { - return table( - ["Predicate", "Status", "Support", "Confidence"], - rows.map((row) => [ - row.predicate, - row.status, - row.support_count, - Math.round((row.max_confidence ?? 0) * 100) + "%", - ]) - ); - } - if (kind === "entity_type_summary") { - return table( - ["Entity Type", "Count"], - rows.map((row) => [row.entity_type, row.count]) - ); - } - return table( - ["Predicate", "Name", "Type", "Support", "Confidence"], - rows.map((row) => [ - row.predicate, - row.name, - row.entity_type, - row.support_count, - Math.round(row.max_confidence * 100) + "%", - ]) - ); -} - -async function loadTags() { - if (!state.selectedProject) return; - const tags = await api(`/projects/${encodeURIComponent(state.selectedProject)}/recommendation-tags`); - $("tagTable").innerHTML = table( - ["Predicate", "Type", "Name", "Support", "Confidence"], - tags.map((tag) => [ - tag.predicate, - tag.type, - tag.name, - tag.support_count, - Math.round(tag.max_confidence * 100) + "%", - ]) - ); -} - -async function recommend() { - if (!state.selectedProject) return; - const result = await api("/recommend", { - method: "POST", - body: JSON.stringify({ - project_name: state.selectedProject, - target_entity_type: state.projectDetail?.config?.recommendation?.target_entity_type ?? "Perfume", - preferences: { - preferred_notes: csv($("preferredNotes").value), - avoided_notes: csv($("avoidedNotes").value), - preferred_moods: csv($("preferredMoods").value), - season_context: $("seasonContext").value.trim() || null, - occasion_context: $("occasionContext").value.trim() || null, - }, - limit: 10, - }), - }); - $("recommendTable").innerHTML = table( - ["Name", "Type", "Score", "Reasons"], - result.map((item) => [item.name, item.entity_type, item.score, item.reasons.join(", ")]) - ); -} - -function chip(value) { - return `${escapeHtml(value)}`; -} - -function table(headers, rows) { - if (!rows.length) { - return `
No data.
`; - } - return ` - - ${headers.map((header) => ``).join("")} - ${rows.map((row) => `${row.map((cell) => ``).join("")}`).join("")} -
${escapeHtml(header)}
${String(cell)}
- `; -} - -function escapeHtml(value) { - return String(value) - .replaceAll("&", "&") - .replaceAll("<", "<") - .replaceAll(">", ">") - .replaceAll('"', """) - .replaceAll("'", "'"); -} - -document.querySelectorAll(".tab").forEach((tab) => { - tab.addEventListener("click", () => { - document.querySelectorAll(".tab").forEach((node) => node.classList.remove("active")); - document.querySelectorAll(".tab-panel").forEach((node) => node.classList.remove("active")); - tab.classList.add("active"); - $(tab.dataset.tab).classList.add("active"); - }); -}); - -$("refreshBtn").addEventListener("click", loadProjects); -$("createProjectBtn").addEventListener("click", createProject); -$("initProjectBtn").addEventListener("click", initializeCurrentProject); -$("discoverBtn").addEventListener("click", discover); -$("crawlBtn").addEventListener("click", crawl); -$("siteCrawlBtn").addEventListener("click", crawlSite); -$("stopSiteCrawlBtn").addEventListener("click", stopSiteCrawl); -$("extractorProvider").addEventListener("change", updateExtractorOptions); -$("testExtractorBtn").addEventListener("click", testExtractor); -$("loadEntitiesBtn").addEventListener("click", loadEntities); -$("mergeEntitiesBtn").addEventListener("click", mergeEntities); -$("loadClaimsBtn").addEventListener("click", loadClaims); -$("showCandidateClaims").addEventListener("change", loadClaims); -$("loadExtractionLogsBtn").addEventListener("click", loadExtractionLogs); -$("runResearchBtn").addEventListener("click", runResearch); -$("loadResearchBtn").addEventListener("click", loadResearchSessions); -$("loadGraphQueryBtn").addEventListener("click", loadGraphQuery); -$("loadTagsBtn").addEventListener("click", loadTags); -$("loadOntologyRegistryBtn").addEventListener("click", loadOntologyRegistry); -$("recommendBtn").addEventListener("click", recommend); - -updateExtractorOptions(); -connectDefaultAnalyzer(); -loadProjects().catch((error) => toast(error.message)); diff --git a/crawler_platform/app/web-legacy/static/index.html b/crawler_platform/app/web-legacy/static/index.html deleted file mode 100644 index 883df4f..0000000 --- a/crawler_platform/app/web-legacy/static/index.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - Ontology Crawler Platform - - - -
-
-

Ontology Crawler

-

Project crawler, ontology mapping, claim review, and recommendation tags

-
- -
- -
- - -
- - -
-
-
- Project - - -
-
- Domain - - -
-
- Sources - 0 -
-
- Entities - 0 -
-
-
-

Sources

-
-
-
- -
-
- -
-
-
-

Configured Entity Types

-
-
-
-

Configured Predicates

-
-
-
-
-
-

Registry Entity Types

-
-
-
-

Registry Relation Types

-
-
-
-
-

Ontology Triples

-
-
-
-
-

Schema Proposals

-
-
-
-

Knowledge Gaps

-
-
-
-
- -
-
- - -
-
- - - -
-
-
- -
-
- - -
-
-
- -
-
- -
-
-
- -
-
-

Semantic Exploration

-
- - - - -
-
- - -
-
-
-
-
-

Graph Query

-
- - - -
-
-
-
- -
-
- -
-
-
- -
-
- - - - - -
- -
-
-
-
- -
- - - diff --git a/crawler_platform/app/web-legacy/static/styles.css b/crawler_platform/app/web-legacy/static/styles.css deleted file mode 100644 index ff2bb36..0000000 --- a/crawler_platform/app/web-legacy/static/styles.css +++ /dev/null @@ -1,480 +0,0 @@ -:root { - color-scheme: light; - --bg: #f6f7f4; - --surface: #ffffff; - --surface-2: #eef3ee; - --text: #202420; - --muted: #667063; - --line: #d8ded6; - --accent: #236b5b; - --accent-2: #9c4f30; - --danger: #a33434; - --shadow: 0 16px 40px rgba(24, 35, 28, 0.08); -} - -* { - box-sizing: border-box; -} - -body { - margin: 0; - min-width: 320px; - background: var(--bg); - color: var(--text); - font-family: Inter, "Segoe UI", Arial, sans-serif; - letter-spacing: 0; -} - -button, -input, -select { - font: inherit; -} - -button { - border: 1px solid var(--line); - background: var(--surface); - color: var(--text); - border-radius: 6px; - min-height: 36px; - padding: 0 12px; - cursor: pointer; -} - -button:hover { - border-color: var(--accent); -} - -button.primary { - background: var(--accent); - color: white; - border-color: var(--accent); -} - -input, -select { - width: 100%; - min-height: 36px; - border: 1px solid var(--line); - border-radius: 6px; - background: white; - padding: 0 10px; - color: var(--text); -} - -label { - display: grid; - gap: 6px; - color: var(--muted); - font-size: 12px; - font-weight: 700; -} - -.topbar { - display: flex; - align-items: center; - justify-content: space-between; - gap: 16px; - padding: 18px 24px; - border-bottom: 1px solid var(--line); - background: rgba(255, 255, 255, 0.86); - position: sticky; - top: 0; - z-index: 5; - backdrop-filter: blur(12px); -} - -.topbar h1 { - margin: 0; - font-size: 22px; -} - -.topbar p { - margin: 4px 0 0; - color: var(--muted); - font-size: 13px; -} - -.icon-button { - width: 40px; - padding: 0; - font-size: 20px; -} - -.layout { - display: grid; - grid-template-columns: 320px minmax(0, 1fr); - gap: 18px; - padding: 18px; -} - -.sidebar, -.workspace { - min-width: 0; -} - -.sidebar { - display: grid; - align-content: start; - gap: 14px; -} - -.panel, -.wide-panel, -.metric { - background: var(--surface); - border: 1px solid var(--line); - border-radius: 8px; - box-shadow: var(--shadow); -} - -.panel, -.wide-panel { - padding: 14px; -} - -.panel-head { - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: 10px; -} - -h2 { - margin: 0; - font-size: 15px; -} - -.field-row { - display: grid; - grid-template-columns: minmax(0, 1fr) 42px; - gap: 8px; -} - -#initProjectBtn { - margin-top: 8px; -} - -.list { - display: grid; - gap: 8px; - margin-top: 12px; -} - -.project-item { - display: grid; - gap: 2px; - text-align: left; - height: auto; - min-height: 52px; - padding: 8px 10px; -} - -.project-item.active { - border-color: var(--accent); - background: var(--surface-2); -} - -.project-item strong { - font-size: 14px; -} - -.project-item span { - color: var(--muted); - font-size: 12px; -} - -.mini-log { - min-height: 38px; - margin-top: 10px; - color: var(--muted); - font-size: 12px; - line-height: 1.45; -} - -.button-grid { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 8px; -} - -button.full { - width: 100%; -} - -.site-controls { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 8px; - align-items: end; -} - -.check-row { - display: flex; - align-items: center; - gap: 8px; - min-height: 36px; -} - -.check-row input { - width: 16px; - min-height: 16px; -} - -.extractor-options { - display: none; - gap: 8px; -} - -.extractor-options.active { - display: grid; -} - -.extractor-options button { - width: 100%; -} - -.discovered-links { - display: grid; - gap: 6px; - margin-top: 10px; - max-height: 280px; - overflow: auto; -} - -.discovered-link { - display: grid; - gap: 2px; - min-height: 44px; - padding: 7px 8px; - text-align: left; - overflow-wrap: anywhere; -} - -.discovered-link span { - color: var(--muted); - font-size: 11px; -} - -.tabs { - display: flex; - gap: 6px; - overflow-x: auto; - padding-bottom: 10px; -} - -.tab { - white-space: nowrap; -} - -.tab.active { - background: var(--text); - color: white; - border-color: var(--text); -} - -.tab-panel { - display: none; -} - -.tab-panel.active { - display: grid; - gap: 14px; -} - -.summary-grid { - display: grid; - grid-template-columns: repeat(4, minmax(120px, 1fr)); - gap: 12px; -} - -.metric { - padding: 14px; -} - -.metric span { - display: block; - color: var(--muted); - font-size: 12px; - font-weight: 700; -} - -.metric strong { - display: block; - margin-top: 8px; - font-size: 20px; - overflow-wrap: anywhere; -} - -.split { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 14px; -} - -.chips { - display: flex; - flex-wrap: wrap; - gap: 8px; - margin-top: 12px; -} - -.chip { - display: inline-flex; - align-items: center; - min-height: 28px; - padding: 0 10px; - border: 1px solid var(--line); - border-radius: 999px; - background: var(--surface-2); - font-size: 12px; -} - -.toolbar { - display: flex; - gap: 8px; - align-items: center; -} - -.toolbar.wrap { - flex-wrap: wrap; -} - -.toolbar select { - max-width: 240px; -} - -.merge-bar { - display: grid; - grid-template-columns: minmax(120px, 180px) minmax(120px, 180px) 80px; - gap: 8px; -} - -.table { - overflow-x: auto; - background: var(--surface); - border: 1px solid var(--line); - border-radius: 8px; -} - -table { - width: 100%; - border-collapse: collapse; - font-size: 13px; -} - -th, -td { - padding: 10px; - border-bottom: 1px solid var(--line); - text-align: left; - vertical-align: top; -} - -th { - color: var(--muted); - background: #fafbf8; - font-size: 12px; -} - -.claim-list { - display: grid; - gap: 10px; -} - -.claim-card { - display: grid; - gap: 8px; - padding: 12px; - background: var(--surface); - border: 1px solid var(--line); - border-radius: 8px; -} - -.claim-main { - display: flex; - flex-wrap: wrap; - gap: 8px; - align-items: center; -} - -.predicate { - color: var(--accent); - font-weight: 800; -} - -.confidence { - margin-left: auto; - color: var(--accent-2); - font-weight: 800; -} - -.evidence { - color: var(--muted); - font-size: 12px; - line-height: 1.45; -} - -.claim-actions { - display: grid; - grid-template-columns: 120px minmax(0, 1fr) 90px; - gap: 8px; -} - -.recommend-grid { - display: grid; - grid-template-columns: repeat(5, minmax(120px, 1fr)); - gap: 10px; -} - -#toast { - position: fixed; - right: 18px; - bottom: 18px; - max-width: min(420px, calc(100vw - 36px)); - padding: 12px 14px; - border-radius: 8px; - background: var(--text); - color: white; - opacity: 0; - transform: translateY(10px); - transition: 180ms ease; - pointer-events: none; - font-size: 13px; -} - -#toast.show { - opacity: 1; - transform: translateY(0); -} - -@media (max-width: 920px) { - .layout { - grid-template-columns: 1fr; - } - - .summary-grid, - .split, - .recommend-grid { - grid-template-columns: 1fr 1fr; - } -} - -@media (max-width: 560px) { - .topbar { - padding: 14px; - } - - .layout { - padding: 12px; - } - - .summary-grid, - .split, - .recommend-grid, - .claim-actions, - .merge-bar, - .site-controls { - grid-template-columns: 1fr; - } -} diff --git a/crawler_platform/app/web/__init__.py b/crawler_platform/app/web/__init__.py deleted file mode 100644 index 9be5afc..0000000 --- a/crawler_platform/app/web/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -"""Admin web UI.""" - diff --git a/crawler_platform/app/web/static/assets/index-B9qLr-xp.js b/crawler_platform/app/web/static/assets/index-B9qLr-xp.js deleted file mode 100644 index ff14819..0000000 --- a/crawler_platform/app/web/static/assets/index-B9qLr-xp.js +++ /dev/null @@ -1,12 +0,0 @@ -function Vy(t,e){for(var r=0;ri[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();var Za=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function iu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zc={exports:{}},Fa={},Gc={exports:{}},Ze={};var km;function F1(){if(km)return Ze;km=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),w=Symbol.iterator;function y(T){return T===null||typeof T!="object"?null:(T=w&&T[w]||T["@@iterator"],typeof T=="function"?T:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,_={};function b(T,Q,ue){this.props=T,this.context=Q,this.refs=_,this.updater=ue||x}b.prototype.isReactComponent={},b.prototype.setState=function(T,Q){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,Q,"setState")},b.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function P(){}P.prototype=b.prototype;function N(T,Q,ue){this.props=T,this.context=Q,this.refs=_,this.updater=ue||x}var F=N.prototype=new P;F.constructor=N,S(F,b.prototype),F.isPureReactComponent=!0;var L=Array.isArray,k=Object.prototype.hasOwnProperty,I={current:null},X={key:!0,ref:!0,__self:!0,__source:!0};function re(T,Q,ue){var pe,Le={},qe=null,Ce=null;if(Q!=null)for(pe in Q.ref!==void 0&&(Ce=Q.ref),Q.key!==void 0&&(qe=""+Q.key),Q)k.call(Q,pe)&&!X.hasOwnProperty(pe)&&(Le[pe]=Q[pe]);var Ge=arguments.length-2;if(Ge===1)Le.children=ue;else if(1>>1,Q=H[T];if(0>>1;Ta(Le,K))qea(Ce,Le)?(H[T]=Ce,H[qe]=K,T=qe):(H[T]=Le,H[pe]=K,T=pe);else if(qea(Ce,K))H[T]=Ce,H[qe]=K,T=qe;else break e}}return W}function a(H,W){var K=H.sortIndex-W.sortIndex;return K!==0?K:H.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var d=Date,f=d.now();t.unstable_now=function(){return d.now()-f}}var m=[],p=[],v=1,w=null,y=3,x=!1,S=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(H){for(var W=r(p);W!==null;){if(W.callback===null)i(p);else if(W.startTime<=H)i(p),W.sortIndex=W.expirationTime,e(m,W);else break;W=r(p)}}function L(H){if(_=!1,F(H),!S)if(r(m)!==null)S=!0,R(k);else{var W=r(p);W!==null&&G(L,W.startTime-H)}}function k(H,W){S=!1,_&&(_=!1,P(re),re=-1),x=!0;var K=y;try{for(F(W),w=r(m);w!==null&&(!(w.expirationTime>W)||H&&!Oe());){var T=w.callback;if(typeof T=="function"){w.callback=null,y=w.priorityLevel;var Q=T(w.expirationTime<=W);W=t.unstable_now(),typeof Q=="function"?w.callback=Q:w===r(m)&&i(m),F(W)}else i(m);w=r(m)}if(w!==null)var ue=!0;else{var pe=r(p);pe!==null&&G(L,pe.startTime-W),ue=!1}return ue}finally{w=null,y=K,x=!1}}var I=!1,X=null,re=-1,de=5,Z=-1;function Oe(){return!(t.unstable_now()-ZH||125T?(H.sortIndex=K,e(p,H),r(m)===null&&H===r(p)&&(_?(P(re),re=-1):_=!0,G(L,K-T))):(H.sortIndex=Q,e(m,H),S||x||(S=!0,R(k))),H},t.unstable_shouldYield=Oe,t.unstable_wrapCallback=function(H){var W=y;return function(){var K=y;y=W;try{return H.apply(this,arguments)}finally{y=K}}}})(Xc)),Xc}var Om;function V1(){return Om||(Om=1,Yc.exports=U1()),Yc.exports}var Rm;function B1(){if(Rm)return Nn;Rm=1;var t=po(),e=V1();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},w={};function y(n){return m.call(w,n)?!0:m.call(v,n)?!1:p.test(n)?w[n]=!0:(v[n]=!0,!1)}function x(n,s,o,c){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function S(n,s,o,c){if(s===null||typeof s>"u"||x(n,s,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(n,s,o,c,h,g,j){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=h,this.mustUseProperty=o,this.propertyName=n,this.type=s,this.sanitizeURL=g,this.removeEmptyString=j}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){b[n]=new _(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];b[s]=new _(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){b[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){b[n]=new _(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){b[n]=new _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){b[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){b[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){b[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){b[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var P=/[\-:]([a-z])/g;function N(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var s=n.replace(P,N);b[s]=new _(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(P,N);b[s]=new _(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(P,N);b[s]=new _(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function F(n,s,o,c){var h=b.hasOwnProperty(s)?b[s]:null;(h!==null?h.type!==0:c||!(2C||h[j]!==g[C]){var O=` -`+h[j].replace(" at new "," at ");return n.displayName&&O.includes("")&&(O=O.replace("",n.displayName)),O}while(1<=j&&0<=C);break}}}finally{ue=!1,Error.prepareStackTrace=o}return(n=n?n.displayName||n.name:"")?Q(n):""}function Le(n){switch(n.tag){case 5:return Q(n.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return n=pe(n.type,!1),n;case 11:return n=pe(n.type.render,!1),n;case 1:return n=pe(n.type,!0),n;default:return""}}function qe(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case X:return"Fragment";case I:return"Portal";case de:return"Profiler";case re:return"StrictMode";case ve:return"Suspense";case me:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case Oe:return(n.displayName||"Context")+".Consumer";case Z:return(n._context.displayName||"Context")+".Provider";case J:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case M:return s=n.displayName||null,s!==null?s:qe(n.type)||"Memo";case R:s=n._payload,n=n._init;try{return qe(n(s))}catch{}}return null}function Ce(n){var s=n.type;switch(n.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qe(s);case 8:return s===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function Ge(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function et(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Rt(n){var s=et(n)?"checked":"value",o=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),c=""+n[s];if(!n.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,g=o.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return h.call(this)},set:function(j){c=""+j,g.call(this,j)}}),Object.defineProperty(n,s,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function yn(n){n._valueTracker||(n._valueTracker=Rt(n))}function Tr(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return n&&(c=et(n)?n.checked?"true":"false":n.value),n=c,n!==o?(s.setValue(n),!0):!1}function Jn(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Lr(n,s){var o=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??n._wrapperState.initialChecked})}function ui(n,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=Ge(s.value!=null?s.value:o),n._wrapperState={initialChecked:c,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Yr(n,s){s=s.checked,s!=null&&F(n,"checked",s,!1)}function Ms(n,s){Yr(n,s);var o=Ge(s.value),c=s.type;if(o!=null)c==="number"?(o===0&&n.value===""||n.value!=o)&&(n.value=""+o):n.value!==""+o&&(n.value=""+o);else if(c==="submit"||c==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?Xr(n,s.type,o):s.hasOwnProperty("defaultValue")&&Xr(n,s.type,Ge(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function Ar(n,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,o||s===n.value||(n.value=s),n.defaultValue=s}o=n.name,o!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,o!==""&&(n.name=o)}function Xr(n,s,o){(s!=="number"||Jn(n.ownerDocument)!==n)&&(o==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+o&&(n.defaultValue=""+o))}var pr=Array.isArray;function vn(n,s,o,c){if(n=n.options,s){s={};for(var h=0;h"+s.valueOf().toString()+"",s=le.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function ce(n,s){if(s){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=s;return}}n.textContent=s}var Ae={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},We=["Webkit","ms","Moz","O"];Object.keys(Ae).forEach(function(n){We.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),Ae[s]=Ae[n]})});function St(n,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||Ae.hasOwnProperty(n)&&Ae[n]?(""+s).trim():s+"px"}function Tt(n,s){n=n.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,h=St(o,s[o],c);o==="float"&&(o="cssFloat"),c?n.setProperty(o,h):n[o]=h}}var Ft=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $n(n,s){if(s){if(Ft[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Ir(n,s){if(n.indexOf("-")===-1)return typeof s.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Mr=null;function es(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Fr=null,mr=null,Tn=null;function Yn(n){if(n=ja(n)){if(typeof Fr!="function")throw Error(r(280));var s=n.stateNode;s&&(s=zo(s),Fr(n.stateNode,n.type,s))}}function yo(n){mr?Tn?Tn.push(n):Tn=[n]:mr=n}function Fe(){if(mr){var n=mr,s=Tn;if(Tn=mr=null,Yn(n),s)for(n=0;n>>=0,n===0?32:31-(Xx(n)/e0|0)|0}var jo=64,_o=4194304;function sa(n){switch(n&-n){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: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function So(n,s){var o=n.pendingLanes;if(o===0)return 0;var c=0,h=n.suspendedLanes,g=n.pingedLanes,j=o&268435455;if(j!==0){var C=j&~h;C!==0?c=sa(C):(g&=j,g!==0&&(c=sa(g)))}else j=o&~h,j!==0?c=sa(j):g!==0&&(c=sa(g));if(c===0)return 0;if(s!==0&&s!==c&&(s&h)===0&&(h=c&-c,g=s&-s,h>=g||h===16&&(g&4194240)!==0))return s;if((c&4)!==0&&(c|=o&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=c;0o;o++)s.push(n);return s}function ia(n,s,o){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-er(s),n[s]=o}function s0(n,s){var o=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var c=n.eventTimes;for(n=n.expirationTimes;0=ha),vh=" ",xh=!1;function wh(n,s){switch(n){case"keyup":return T0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bh(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var fi=!1;function A0(n,s){switch(n){case"compositionend":return bh(s);case"keypress":return s.which!==32?null:(xh=!0,vh);case"textInput":return n=s.data,n===vh&&xh?null:n;default:return null}}function I0(n,s){if(fi)return n==="compositionend"||!Pu&&wh(n,s)?(n=fh(),Po=_u=is=null,fi=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:o,offset:s-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Eh(o)}}function Oh(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Oh(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Rh(){for(var n=window,s=Jn();s instanceof n.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)n=s.contentWindow;else break;s=Jn(n.document)}return s}function Tu(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function q0(n){var s=Rh(),o=n.focusedElem,c=n.selectionRange;if(s!==o&&o&&o.ownerDocument&&Oh(o.ownerDocument.documentElement,o)){if(c!==null&&Tu(o)){if(s=c.start,n=c.end,n===void 0&&(n=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(n,o.value.length);else if(n=(s=o.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var h=o.textContent.length,g=Math.min(c.start,h);c=c.end===void 0?g:Math.min(c.end,h),!n.extend&&g>c&&(h=c,c=g,g=h),h=Ph(o,g);var j=Ph(o,c);h&&j&&(n.rangeCount!==1||n.anchorNode!==h.node||n.anchorOffset!==h.offset||n.focusNode!==j.node||n.focusOffset!==j.offset)&&(s=s.createRange(),s.setStart(h.node,h.offset),n.removeAllRanges(),g>c?(n.addRange(s),n.extend(j.node,j.offset)):(s.setEnd(j.node,j.offset),n.addRange(s)))}}for(s=[],n=o;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,hi=null,Lu=null,ya=null,Au=!1;function Th(n,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Au||hi==null||hi!==Jn(c)||(c=hi,"selectionStart"in c&&Tu(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ya&&ga(ya,c)||(ya=c,c=Fo(Lu,"onSelect"),0vi||(n.current=Wu[vi],Wu[vi]=null,vi--)}function ft(n,s){vi++,Wu[vi]=n.current,n.current=s}var us={},Qt=ls(us),bn=ls(!1),zs=us;function xi(n,s){var o=n.type.contextTypes;if(!o)return us;var c=n.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var h={},g;for(g in o)h[g]=s[g];return c&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=h),h}function jn(n){return n=n.childContextTypes,n!=null}function Uo(){pt(bn),pt(Qt)}function Kh(n,s,o){if(Qt.current!==us)throw Error(r(168));ft(Qt,s),ft(bn,o)}function Qh(n,s,o){var c=n.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var h in c)if(!(h in s))throw Error(r(108,Ce(n)||"Unknown",h));return K({},o,c)}function Vo(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||us,zs=Qt.current,ft(Qt,n),ft(bn,bn.current),!0}function Zh(n,s,o){var c=n.stateNode;if(!c)throw Error(r(169));o?(n=Qh(n,s,zs),c.__reactInternalMemoizedMergedChildContext=n,pt(bn),pt(Qt),ft(Qt,n)):pt(bn),ft(bn,o)}var $r=null,Bo=!1,Ku=!1;function Gh(n){$r===null?$r=[n]:$r.push(n)}function n1(n){Bo=!0,Gh(n)}function cs(){if(!Ku&&$r!==null){Ku=!0;var n=0,s=ut;try{var o=$r;for(ut=1;n>=j,h-=j,zr=1<<32-er(s)+h|o<Me?(Bt=Te,Te=null):Bt=Te.sibling;var nt=Y(U,Te,B[Me],se);if(nt===null){Te===null&&(Te=Bt);break}n&&Te&&nt.alternate===null&&s(U,Te),A=g(nt,A,Me),Re===null?Se=nt:Re.sibling=nt,Re=nt,Te=Bt}if(Me===B.length)return o(U,Te),gt&&Vs(U,Me),Se;if(Te===null){for(;MeMe?(Bt=Te,Te=null):Bt=Te.sibling;var xs=Y(U,Te,nt.value,se);if(xs===null){Te===null&&(Te=Bt);break}n&&Te&&xs.alternate===null&&s(U,Te),A=g(xs,A,Me),Re===null?Se=xs:Re.sibling=xs,Re=xs,Te=Bt}if(nt.done)return o(U,Te),gt&&Vs(U,Me),Se;if(Te===null){for(;!nt.done;Me++,nt=B.next())nt=te(U,nt.value,se),nt!==null&&(A=g(nt,A,Me),Re===null?Se=nt:Re.sibling=nt,Re=nt);return gt&&Vs(U,Me),Se}for(Te=c(U,Te);!nt.done;Me++,nt=B.next())nt=he(Te,U,Me,nt.value,se),nt!==null&&(n&&nt.alternate!==null&&Te.delete(nt.key===null?Me:nt.key),A=g(nt,A,Me),Re===null?Se=nt:Re.sibling=nt,Re=nt);return n&&Te.forEach(function(M1){return s(U,M1)}),gt&&Vs(U,Me),Se}function Ot(U,A,B,se){if(typeof B=="object"&&B!==null&&B.type===X&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case k:e:{for(var Se=B.key,Re=A;Re!==null;){if(Re.key===Se){if(Se=B.type,Se===X){if(Re.tag===7){o(U,Re.sibling),A=h(Re,B.props.children),A.return=U,U=A;break e}}else if(Re.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===R&&np(Se)===Re.type){o(U,Re.sibling),A=h(Re,B.props),A.ref=_a(U,Re,B),A.return=U,U=A;break e}o(U,Re);break}else s(U,Re);Re=Re.sibling}B.type===X?(A=Gs(B.props.children,U.mode,se,B.key),A.return=U,U=A):(se=yl(B.type,B.key,B.props,null,U.mode,se),se.ref=_a(U,A,B),se.return=U,U=se)}return j(U);case I:e:{for(Re=B.key;A!==null;){if(A.key===Re)if(A.tag===4&&A.stateNode.containerInfo===B.containerInfo&&A.stateNode.implementation===B.implementation){o(U,A.sibling),A=h(A,B.children||[]),A.return=U,U=A;break e}else{o(U,A);break}else s(U,A);A=A.sibling}A=qc(B,U.mode,se),A.return=U,U=A}return j(U);case R:return Re=B._init,Ot(U,A,Re(B._payload),se)}if(pr(B))return be(U,A,B,se);if(W(B))return _e(U,A,B,se);Ko(U,B)}return typeof B=="string"&&B!==""||typeof B=="number"?(B=""+B,A!==null&&A.tag===6?(o(U,A.sibling),A=h(A,B),A.return=U,U=A):(o(U,A),A=Bc(B,U.mode,se),A.return=U,U=A),j(U)):o(U,A)}return Ot}var _i=rp(!0),sp=rp(!1),Qo=ls(null),Zo=null,Si=null,Xu=null;function ec(){Xu=Si=Zo=null}function tc(n){var s=Qo.current;pt(Qo),n._currentValue=s}function nc(n,s,o){for(;n!==null;){var c=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),n===o)break;n=n.return}}function ki(n,s){Zo=n,Xu=Si=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(_n=!0),n.firstContext=null)}function Vn(n){var s=n._currentValue;if(Xu!==n)if(n={context:n,memoizedValue:s,next:null},Si===null){if(Zo===null)throw Error(r(308));Si=n,Zo.dependencies={lanes:0,firstContext:n}}else Si=Si.next=n;return s}var Bs=null;function rc(n){Bs===null?Bs=[n]:Bs.push(n)}function ip(n,s,o,c){var h=s.interleaved;return h===null?(o.next=o,rc(s)):(o.next=h.next,h.next=o),s.interleaved=o,Vr(n,c)}function Vr(n,s){n.lanes|=s;var o=n.alternate;for(o!==null&&(o.lanes|=s),o=n,n=n.return;n!==null;)n.childLanes|=s,o=n.alternate,o!==null&&(o.childLanes|=s),o=n,n=n.return;return o.tag===3?o.stateNode:null}var ds=!1;function sc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ap(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Br(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function fs(n,s,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(tt&2)!==0){var h=c.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),c.pending=s,Vr(n,o)}return h=c.interleaved,h===null?(s.next=s,rc(c)):(s.next=h.next,h.next=s),c.interleaved=s,Vr(n,o)}function Go(n,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var c=s.lanes;c&=n.pendingLanes,o|=c,s.lanes=o,vu(n,o)}}function op(n,s){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var h=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var j={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};g===null?h=g=j:g=g.next=j,o=o.next}while(o!==null);g===null?h=g=s:g=g.next=s}else h=g=s;o={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,effects:c.effects},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=s:n.next=s,o.lastBaseUpdate=s}function Jo(n,s,o,c){var h=n.updateQueue;ds=!1;var g=h.firstBaseUpdate,j=h.lastBaseUpdate,C=h.shared.pending;if(C!==null){h.shared.pending=null;var O=C,q=O.next;O.next=null,j===null?g=q:j.next=q,j=O;var ee=n.alternate;ee!==null&&(ee=ee.updateQueue,C=ee.lastBaseUpdate,C!==j&&(C===null?ee.firstBaseUpdate=q:C.next=q,ee.lastBaseUpdate=O))}if(g!==null){var te=h.baseState;j=0,ee=q=O=null,C=g;do{var Y=C.lane,he=C.eventTime;if((c&Y)===Y){ee!==null&&(ee=ee.next={eventTime:he,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var be=n,_e=C;switch(Y=s,he=o,_e.tag){case 1:if(be=_e.payload,typeof be=="function"){te=be.call(he,te,Y);break e}te=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=_e.payload,Y=typeof be=="function"?be.call(he,te,Y):be,Y==null)break e;te=K({},te,Y);break e;case 2:ds=!0}}C.callback!==null&&C.lane!==0&&(n.flags|=64,Y=h.effects,Y===null?h.effects=[C]:Y.push(C))}else he={eventTime:he,lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ee===null?(q=ee=he,O=te):ee=ee.next=he,j|=Y;if(C=C.next,C===null){if(C=h.shared.pending,C===null)break;Y=C,C=Y.next,Y.next=null,h.lastBaseUpdate=Y,h.shared.pending=null}}while(!0);if(ee===null&&(O=te),h.baseState=O,h.firstBaseUpdate=q,h.lastBaseUpdate=ee,s=h.shared.interleaved,s!==null){h=s;do j|=h.lane,h=h.next;while(h!==s)}else g===null&&(h.shared.lanes=0);Ws|=j,n.lanes=j,n.memoizedState=te}}function lp(n,s,o){if(n=s.effects,s.effects=null,n!==null)for(s=0;so?o:4,n(!0);var c=uc.transition;uc.transition={};try{n(!1),s()}finally{ut=o,uc.transition=c}}function Cp(){return Bn().memoizedState}function a1(n,s,o){var c=gs(n);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},Ep(n))Pp(s,o);else if(o=ip(n,s,o,c),o!==null){var h=on();ar(o,n,c,h),Op(o,s,c)}}function o1(n,s,o){var c=gs(n),h={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(Ep(n))Pp(s,h);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var j=s.lastRenderedState,C=g(j,o);if(h.hasEagerState=!0,h.eagerState=C,tr(C,j)){var O=s.interleaved;O===null?(h.next=h,rc(s)):(h.next=O.next,O.next=h),s.interleaved=h;return}}catch{}o=ip(n,s,h,c),o!==null&&(h=on(),ar(o,n,c,h),Op(o,s,c))}}function Ep(n){var s=n.alternate;return n===bt||s!==null&&s===bt}function Pp(n,s){Ca=el=!0;var o=n.pending;o===null?s.next=s:(s.next=o.next,o.next=s),n.pending=s}function Op(n,s,o){if((o&4194240)!==0){var c=s.lanes;c&=n.pendingLanes,o|=c,s.lanes=o,vu(n,o)}}var rl={readContext:Vn,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useInsertionEffect:Zt,useLayoutEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useMutableSource:Zt,useSyncExternalStore:Zt,useId:Zt,unstable_isNewReconciler:!1},l1={readContext:Vn,useCallback:function(n,s){return wr().memoizedState=[n,s===void 0?null:s],n},useContext:Vn,useEffect:xp,useImperativeHandle:function(n,s,o){return o=o!=null?o.concat([n]):null,tl(4194308,4,jp.bind(null,s,n),o)},useLayoutEffect:function(n,s){return tl(4194308,4,n,s)},useInsertionEffect:function(n,s){return tl(4,2,n,s)},useMemo:function(n,s){var o=wr();return s=s===void 0?null:s,n=n(),o.memoizedState=[n,s],n},useReducer:function(n,s,o){var c=wr();return s=o!==void 0?o(s):s,c.memoizedState=c.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},c.queue=n,n=n.dispatch=a1.bind(null,bt,n),[c.memoizedState,n]},useRef:function(n){var s=wr();return n={current:n},s.memoizedState=n},useState:yp,useDebugValue:gc,useDeferredValue:function(n){return wr().memoizedState=n},useTransition:function(){var n=yp(!1),s=n[0];return n=i1.bind(null,n[1]),wr().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,o){var c=bt,h=wr();if(gt){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),Vt===null)throw Error(r(349));(Hs&30)!==0||fp(c,s,o)}h.memoizedState=o;var g={value:o,getSnapshot:s};return h.queue=g,xp(pp.bind(null,c,g,n),[n]),c.flags|=2048,Oa(9,hp.bind(null,c,g,o,s),void 0,null),o},useId:function(){var n=wr(),s=Vt.identifierPrefix;if(gt){var o=Ur,c=zr;o=(c&~(1<<32-er(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=Ea++,0<\/script>",n=n.removeChild(n.firstChild)):typeof c.is=="string"?n=j.createElement(o,{is:c.is}):(n=j.createElement(o),o==="select"&&(j=n,c.multiple?j.multiple=!0:c.size&&(j.size=c.size))):n=j.createElementNS(n,o),n[vr]=s,n[ba]=c,Gp(n,s,!1,!1),s.stateNode=n;e:{switch(j=Ir(o,c),o){case"dialog":ht("cancel",n),ht("close",n),h=c;break;case"iframe":case"object":case"embed":ht("load",n),h=c;break;case"video":case"audio":for(h=0;hOi&&(s.flags|=128,c=!0,Ra(g,!1),s.lanes=4194304)}else{if(!c)if(n=Yo(j),n!==null){if(s.flags|=128,c=!0,o=n.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),Ra(g,!0),g.tail===null&&g.tailMode==="hidden"&&!j.alternate&&!gt)return Gt(s),null}else 2*Pt()-g.renderingStartTime>Oi&&o!==1073741824&&(s.flags|=128,c=!0,Ra(g,!1),s.lanes=4194304);g.isBackwards?(j.sibling=s.child,s.child=j):(o=g.last,o!==null?o.sibling=j:s.child=j,g.last=j)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=Pt(),s.sibling=null,o=wt.current,ft(wt,c?o&1|2:o&1),s):(Gt(s),null);case 22:case 23:return zc(),c=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Mn&1073741824)!==0&&(Gt(s),s.subtreeFlags&6&&(s.flags|=8192)):Gt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function g1(n,s){switch(Zu(s),s.tag){case 1:return jn(s.type)&&Uo(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Ni(),pt(bn),pt(Qt),lc(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return ac(s),null;case 13:if(pt(wt),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ji()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return pt(wt),null;case 4:return Ni(),null;case 10:return tc(s.type._context),null;case 22:case 23:return zc(),null;case 24:return null;default:return null}}var ol=!1,Jt=!1,y1=typeof WeakSet=="function"?WeakSet:Set,xe=null;function Ei(n,s){var o=n.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){kt(n,s,c)}else o.current=null}function Ec(n,s,o){try{o()}catch(c){kt(n,s,c)}}var Xp=!1;function v1(n,s){if(zu=Co,n=Rh(),Tu(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var j=0,C=-1,O=-1,q=0,ee=0,te=n,Y=null;t:for(;;){for(var he;te!==o||h!==0&&te.nodeType!==3||(C=j+h),te!==g||c!==0&&te.nodeType!==3||(O=j+c),te.nodeType===3&&(j+=te.nodeValue.length),(he=te.firstChild)!==null;)Y=te,te=he;for(;;){if(te===n)break t;if(Y===o&&++q===h&&(C=j),Y===g&&++ee===c&&(O=j),(he=te.nextSibling)!==null)break;te=Y,Y=te.parentNode}te=he}o=C===-1||O===-1?null:{start:C,end:O}}else o=null}o=o||{start:0,end:0}}else o=null;for(Uu={focusedElem:n,selectionRange:o},Co=!1,xe=s;xe!==null;)if(s=xe,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,xe=n;else for(;xe!==null;){s=xe;try{var be=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var _e=be.memoizedProps,Ot=be.memoizedState,U=s.stateNode,A=U.getSnapshotBeforeUpdate(s.elementType===s.type?_e:rr(s.type,_e),Ot);U.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var B=s.stateNode.containerInfo;B.nodeType===1?B.textContent="":B.nodeType===9&&B.documentElement&&B.removeChild(B.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){kt(s,s.return,se)}if(n=s.sibling,n!==null){n.return=s.return,xe=n;break}xe=s.return}return be=Xp,Xp=!1,be}function Ta(n,s,o){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&n)===n){var g=h.destroy;h.destroy=void 0,g!==void 0&&Ec(s,o,g)}h=h.next}while(h!==c)}}function ll(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&n)===n){var c=o.create;o.destroy=c()}o=o.next}while(o!==s)}}function Pc(n){var s=n.ref;if(s!==null){var o=n.stateNode;n.tag,n=o,typeof s=="function"?s(n):s.current=n}}function em(n){var s=n.alternate;s!==null&&(n.alternate=null,em(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[vr],delete s[ba],delete s[Hu],delete s[e1],delete s[t1])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function tm(n){return n.tag===5||n.tag===3||n.tag===4}function nm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||tm(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Oc(n,s,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(n,s):o.insertBefore(n,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(n,o)):(s=o,s.appendChild(n)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=$o));else if(c!==4&&(n=n.child,n!==null))for(Oc(n,s,o),n=n.sibling;n!==null;)Oc(n,s,o),n=n.sibling}function Rc(n,s,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,s?o.insertBefore(n,s):o.appendChild(n);else if(c!==4&&(n=n.child,n!==null))for(Rc(n,s,o),n=n.sibling;n!==null;)Rc(n,s,o),n=n.sibling}var Ht=null,sr=!1;function hs(n,s,o){for(o=o.child;o!==null;)rm(n,s,o),o=o.sibling}function rm(n,s,o){if(yr&&typeof yr.onCommitFiberUnmount=="function")try{yr.onCommitFiberUnmount(bo,o)}catch{}switch(o.tag){case 5:Jt||Ei(o,s);case 6:var c=Ht,h=sr;Ht=null,hs(n,s,o),Ht=c,sr=h,Ht!==null&&(sr?(n=Ht,o=o.stateNode,n.nodeType===8?n.parentNode.removeChild(o):n.removeChild(o)):Ht.removeChild(o.stateNode));break;case 18:Ht!==null&&(sr?(n=Ht,o=o.stateNode,n.nodeType===8?qu(n.parentNode,o):n.nodeType===1&&qu(n,o),ca(n)):qu(Ht,o.stateNode));break;case 4:c=Ht,h=sr,Ht=o.stateNode.containerInfo,sr=!0,hs(n,s,o),Ht=c,sr=h;break;case 0:case 11:case 14:case 15:if(!Jt&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){h=c=c.next;do{var g=h,j=g.destroy;g=g.tag,j!==void 0&&((g&2)!==0||(g&4)!==0)&&Ec(o,s,j),h=h.next}while(h!==c)}hs(n,s,o);break;case 1:if(!Jt&&(Ei(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(C){kt(o,s,C)}hs(n,s,o);break;case 21:hs(n,s,o);break;case 22:o.mode&1?(Jt=(c=Jt)||o.memoizedState!==null,hs(n,s,o),Jt=c):hs(n,s,o);break;default:hs(n,s,o)}}function sm(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var o=n.stateNode;o===null&&(o=n.stateNode=new y1),s.forEach(function(c){var h=C1.bind(null,n,c);o.has(c)||(o.add(c),c.then(h,h))})}}function ir(n,s){var o=s.deletions;if(o!==null)for(var c=0;ch&&(h=j),c&=~g}if(c=h,c=Pt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*w1(c/1960))-c,10n?16:n,ms===null)var c=!1;else{if(n=ms,ms=null,hl=0,(tt&6)!==0)throw Error(r(331));var h=tt;for(tt|=4,xe=n.current;xe!==null;){var g=xe,j=g.child;if((xe.flags&16)!==0){var C=g.deletions;if(C!==null){for(var O=0;OPt()-Ac?Qs(n,0):Lc|=o),kn(n,s)}function ym(n,s){s===0&&((n.mode&1)===0?s=1:(s=_o,_o<<=1,(_o&130023424)===0&&(_o=4194304)));var o=on();n=Vr(n,s),n!==null&&(ia(n,s,o),kn(n,o))}function N1(n){var s=n.memoizedState,o=0;s!==null&&(o=s.retryLane),ym(n,o)}function C1(n,s){var o=0;switch(n.tag){case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(o=h.retryLane);break;case 19:c=n.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(s),ym(n,o)}var vm;vm=function(n,s,o){if(n!==null)if(n.memoizedProps!==s.pendingProps||bn.current)_n=!0;else{if((n.lanes&o)===0&&(s.flags&128)===0)return _n=!1,p1(n,s,o);_n=(n.flags&131072)!==0}else _n=!1,gt&&(s.flags&1048576)!==0&&Jh(s,Ho,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;al(n,s),n=s.pendingProps;var h=xi(s,Qt.current);ki(s,o),h=dc(null,s,c,n,h,o);var g=fc();return s.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,jn(c)?(g=!0,Vo(s)):g=!1,s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,sc(s),h.updater=sl,s.stateNode=h,h._reactInternals=s,vc(s,c,n,o),s=jc(null,s,c,!0,g,o)):(s.tag=0,gt&&g&&Qu(s),an(null,s,h,o),s=s.child),s;case 16:c=s.elementType;e:{switch(al(n,s),n=s.pendingProps,h=c._init,c=h(c._payload),s.type=c,h=s.tag=P1(c),n=rr(c,n),h){case 0:s=bc(null,s,c,n,o);break e;case 1:s=qp(null,s,c,n,o);break e;case 11:s=$p(null,s,c,n,o);break e;case 14:s=zp(null,s,c,rr(c.type,n),o);break e}throw Error(r(306,c,""))}return s;case 0:return c=s.type,h=s.pendingProps,h=s.elementType===c?h:rr(c,h),bc(n,s,c,h,o);case 1:return c=s.type,h=s.pendingProps,h=s.elementType===c?h:rr(c,h),qp(n,s,c,h,o);case 3:e:{if(Hp(s),n===null)throw Error(r(387));c=s.pendingProps,g=s.memoizedState,h=g.element,ap(n,s),Jo(s,c,null,o);var j=s.memoizedState;if(c=j.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){h=Ci(Error(r(423)),s),s=Wp(n,s,c,o,h);break e}else if(c!==h){h=Ci(Error(r(424)),s),s=Wp(n,s,c,o,h);break e}else for(In=os(s.stateNode.containerInfo.firstChild),An=s,gt=!0,nr=null,o=sp(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ji(),c===h){s=qr(n,s,o);break e}an(n,s,c,o)}s=s.child}return s;case 5:return up(s),n===null&&Ju(s),c=s.type,h=s.pendingProps,g=n!==null?n.memoizedProps:null,j=h.children,Vu(c,h)?j=null:g!==null&&Vu(c,g)&&(s.flags|=32),Bp(n,s),an(n,s,j,o),s.child;case 6:return n===null&&Ju(s),null;case 13:return Kp(n,s,o);case 4:return ic(s,s.stateNode.containerInfo),c=s.pendingProps,n===null?s.child=_i(s,null,c,o):an(n,s,c,o),s.child;case 11:return c=s.type,h=s.pendingProps,h=s.elementType===c?h:rr(c,h),$p(n,s,c,h,o);case 7:return an(n,s,s.pendingProps,o),s.child;case 8:return an(n,s,s.pendingProps.children,o),s.child;case 12:return an(n,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,h=s.pendingProps,g=s.memoizedProps,j=h.value,ft(Qo,c._currentValue),c._currentValue=j,g!==null)if(tr(g.value,j)){if(g.children===h.children&&!bn.current){s=qr(n,s,o);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var C=g.dependencies;if(C!==null){j=g.child;for(var O=C.firstContext;O!==null;){if(O.context===c){if(g.tag===1){O=Br(-1,o&-o),O.tag=2;var q=g.updateQueue;if(q!==null){q=q.shared;var ee=q.pending;ee===null?O.next=O:(O.next=ee.next,ee.next=O),q.pending=O}}g.lanes|=o,O=g.alternate,O!==null&&(O.lanes|=o),nc(g.return,o,s),C.lanes|=o;break}O=O.next}}else if(g.tag===10)j=g.type===s.type?null:g.child;else if(g.tag===18){if(j=g.return,j===null)throw Error(r(341));j.lanes|=o,C=j.alternate,C!==null&&(C.lanes|=o),nc(j,o,s),j=g.sibling}else j=g.child;if(j!==null)j.return=g;else for(j=g;j!==null;){if(j===s){j=null;break}if(g=j.sibling,g!==null){g.return=j.return,j=g;break}j=j.return}g=j}an(n,s,h.children,o),s=s.child}return s;case 9:return h=s.type,c=s.pendingProps.children,ki(s,o),h=Vn(h),c=c(h),s.flags|=1,an(n,s,c,o),s.child;case 14:return c=s.type,h=rr(c,s.pendingProps),h=rr(c.type,h),zp(n,s,c,h,o);case 15:return Up(n,s,s.type,s.pendingProps,o);case 17:return c=s.type,h=s.pendingProps,h=s.elementType===c?h:rr(c,h),al(n,s),s.tag=1,jn(c)?(n=!0,Vo(s)):n=!1,ki(s,o),Tp(s,c,h),vc(s,c,h,o),jc(null,s,c,!0,n,o);case 19:return Zp(n,s,o);case 22:return Vp(n,s,o)}throw Error(r(156,s.tag))};function xm(n,s){return Yf(n,s)}function E1(n,s,o,c){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hn(n,s,o,c){return new E1(n,s,o,c)}function Vc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function P1(n){if(typeof n=="function")return Vc(n)?1:0;if(n!=null){if(n=n.$$typeof,n===J)return 11;if(n===M)return 14}return 2}function vs(n,s){var o=n.alternate;return o===null?(o=Hn(n.tag,s,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=s,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&14680064,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,s=n.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o}function yl(n,s,o,c,h,g){var j=2;if(c=n,typeof n=="function")Vc(n)&&(j=1);else if(typeof n=="string")j=5;else e:switch(n){case X:return Gs(o.children,h,g,s);case re:j=8,h|=8;break;case de:return n=Hn(12,o,s,h|2),n.elementType=de,n.lanes=g,n;case ve:return n=Hn(13,o,s,h),n.elementType=ve,n.lanes=g,n;case me:return n=Hn(19,o,s,h),n.elementType=me,n.lanes=g,n;case G:return vl(o,h,g,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Z:j=10;break e;case Oe:j=9;break e;case J:j=11;break e;case M:j=14;break e;case R:j=16,c=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=Hn(j,o,s,h),s.elementType=n,s.type=c,s.lanes=g,s}function Gs(n,s,o,c){return n=Hn(7,n,c,s),n.lanes=o,n}function vl(n,s,o,c){return n=Hn(22,n,c,s),n.elementType=G,n.lanes=o,n.stateNode={isHidden:!1},n}function Bc(n,s,o){return n=Hn(6,n,null,s),n.lanes=o,n}function qc(n,s,o){return s=Hn(4,n.children!==null?n.children:[],n.key,s),s.lanes=o,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function O1(n,s,o,c,h){this.tag=s,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yu(0),this.expirationTimes=yu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yu(0),this.identifierPrefix=c,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function Hc(n,s,o,c,h,g,j,C,O){return n=new O1(n,s,o,C,O),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Hn(3,null,null,s),n.current=g,g.stateNode=n,g.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},sc(g),n}function R1(n,s,o){var c=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jc.exports=B1(),Jc.exports}var Lm;function q1(){if(Lm)return kl;Lm=1;var t=By();return kl.createRoot=t.createRoot,kl.hydrateRoot=t.hydrateRoot,kl}var H1=q1();const W1=iu(H1);var ed={exports:{}},td={};var Am;function K1(){if(Am)return td;Am=1;var t=po();function e(w,y){return w===y&&(w!==0||1/w===1/y)||w!==w&&y!==y}var r=typeof Object.is=="function"?Object.is:e,i=t.useState,a=t.useEffect,l=t.useLayoutEffect,d=t.useDebugValue;function f(w,y){var x=y(),S=i({inst:{value:x,getSnapshot:y}}),_=S[0].inst,b=S[1];return l(function(){_.value=x,_.getSnapshot=y,m(_)&&b({inst:_})},[w,x,y]),a(function(){return m(_)&&b({inst:_}),w(function(){m(_)&&b({inst:_})})},[w]),d(x),x}function m(w){var y=w.getSnapshot;w=w.value;try{var x=y();return!r(w,x)}catch{return!0}}function p(w,y){return y()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return td.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:v,td}var Im;function qy(){return Im||(Im=1,ed.exports=K1()),ed.exports}qy();var nd={exports:{}},rd={};var Mm;function Q1(){if(Mm)return rd;Mm=1;var t=po(),e=qy();function r(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var i=typeof Object.is=="function"?Object.is:r,a=e.useSyncExternalStore,l=t.useRef,d=t.useEffect,f=t.useMemo,m=t.useDebugValue;return rd.useSyncExternalStoreWithSelector=function(p,v,w,y,x){var S=l(null);if(S.current===null){var _={hasValue:!1,value:null};S.current=_}else _=S.current;S=f(function(){function P(I){if(!N){if(N=!0,F=I,I=y(I),x!==void 0&&_.hasValue){var X=_.value;if(x(X,I))return L=X}return L=I}if(X=L,i(F,I))return X;var re=y(I);return x!==void 0&&x(X,re)?(F=I,X):(F=I,L=re)}var N=!1,F,L,k=w===void 0?null:w;return[function(){return P(v())},k===null?void 0:function(){return P(k())}]},[v,w,y,x]);var b=a(p,S[0],S[1]);return d(function(){_.hasValue=!0,_.value=b},[b]),m(b),b},rd}var Fm;function Z1(){return Fm||(Fm=1,nd.exports=Q1()),nd.exports}var G1=Z1(),Hy=By();const J1=iu(Hy);function Y1(t){t()}let Wy=Y1;const X1=t=>Wy=t,ew=()=>Wy,Dm=Symbol.for("react-redux-context"),$m=typeof globalThis<"u"?globalThis:{};function tw(){var t;if(!$.createContext)return{};const e=(t=$m[Dm])!=null?t:$m[Dm]=new Map;let r=e.get($.createContext);return r||(r=$.createContext(null),e.set($.createContext,r)),r}const Rs=tw();function gf(t=Rs){return function(){return $.useContext(t)}}const Ky=gf(),nw=()=>{throw new Error("uSES not initialized!")};let Qy=nw;const rw=t=>{Qy=t},sw=(t,e)=>t===e;function iw(t=Rs){const e=t===Rs?Ky:gf(t);return function(i,a={}){const{equalityFn:l=sw,stabilityCheck:d=void 0,noopCheck:f=void 0}=typeof a=="function"?{equalityFn:a}:a,{store:m,subscription:p,getServerState:v,stabilityCheck:w,noopCheck:y}=e();$.useRef(!0);const x=$.useCallback({[i.name](_){return i(_)}}[i.name],[i,w,d]),S=Qy(p.addNestedSub,m.getState,v||m.getState,x,l);return $.useDebugValue(S),S}}const aw=iw();var sd={exports:{}},ot={};var zm;function ow(){if(zm)return ot;zm=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,r=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,a=t?Symbol.for("react.strict_mode"):60108,l=t?Symbol.for("react.profiler"):60114,d=t?Symbol.for("react.provider"):60109,f=t?Symbol.for("react.context"):60110,m=t?Symbol.for("react.async_mode"):60111,p=t?Symbol.for("react.concurrent_mode"):60111,v=t?Symbol.for("react.forward_ref"):60112,w=t?Symbol.for("react.suspense"):60113,y=t?Symbol.for("react.suspense_list"):60120,x=t?Symbol.for("react.memo"):60115,S=t?Symbol.for("react.lazy"):60116,_=t?Symbol.for("react.block"):60121,b=t?Symbol.for("react.fundamental"):60117,P=t?Symbol.for("react.responder"):60118,N=t?Symbol.for("react.scope"):60119;function F(k){if(typeof k=="object"&&k!==null){var I=k.$$typeof;switch(I){case e:switch(k=k.type,k){case m:case p:case i:case l:case a:case w:return k;default:switch(k=k&&k.$$typeof,k){case f:case v:case S:case x:case d:return k;default:return I}}case r:return I}}}function L(k){return F(k)===p}return ot.AsyncMode=m,ot.ConcurrentMode=p,ot.ContextConsumer=f,ot.ContextProvider=d,ot.Element=e,ot.ForwardRef=v,ot.Fragment=i,ot.Lazy=S,ot.Memo=x,ot.Portal=r,ot.Profiler=l,ot.StrictMode=a,ot.Suspense=w,ot.isAsyncMode=function(k){return L(k)||F(k)===m},ot.isConcurrentMode=L,ot.isContextConsumer=function(k){return F(k)===f},ot.isContextProvider=function(k){return F(k)===d},ot.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===e},ot.isForwardRef=function(k){return F(k)===v},ot.isFragment=function(k){return F(k)===i},ot.isLazy=function(k){return F(k)===S},ot.isMemo=function(k){return F(k)===x},ot.isPortal=function(k){return F(k)===r},ot.isProfiler=function(k){return F(k)===l},ot.isStrictMode=function(k){return F(k)===a},ot.isSuspense=function(k){return F(k)===w},ot.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===i||k===p||k===l||k===a||k===w||k===y||typeof k=="object"&&k!==null&&(k.$$typeof===S||k.$$typeof===x||k.$$typeof===d||k.$$typeof===f||k.$$typeof===v||k.$$typeof===b||k.$$typeof===P||k.$$typeof===N||k.$$typeof===_)},ot.typeOf=F,ot}var Um;function lw(){return Um||(Um=1,sd.exports=ow()),sd.exports}var id,Vm;function uw(){if(Vm)return id;Vm=1;var t=lw(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};l[t.ForwardRef]=i,l[t.Memo]=a;function d(S){return t.isMemo(S)?a:l[S.$$typeof]||e}var f=Object.defineProperty,m=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,v=Object.getOwnPropertyDescriptor,w=Object.getPrototypeOf,y=Object.prototype;function x(S,_,b){if(typeof _!="string"){if(y){var P=w(_);P&&P!==y&&x(S,P,b)}var N=m(_);p&&(N=N.concat(p(_)));for(var F=d(S),L=d(_),k=0;k{let i=e;for(;i;)i.callback(),i=i.next})},get(){let i=[],a=e;for(;a;)i.push(a),a=a.next;return i},subscribe(i){let a=!0,l=r={callback:i,next:null,prev:r};return l.prev?l.prev.next=l:e=l,function(){!a||e===null||(a=!1,l.next?l.next.prev=l.prev:r=l.prev,l.prev?l.prev.next=l.next:e=l.next)}}}}const Hm={notify(){},get:()=>[]};function hw(t,e){let r,i=Hm,a=0,l=!1;function d(_){v();const b=i.subscribe(_);let P=!1;return()=>{P||(P=!0,b(),w())}}function f(){i.notify()}function m(){S.onStateChange&&S.onStateChange()}function p(){return l}function v(){a++,r||(r=t.subscribe(m),i=fw())}function w(){a--,r&&a===0&&(r(),r=void 0,i.clear(),i=Hm)}function y(){l||(l=!0,v())}function x(){l&&(l=!1,w())}const S={addNestedSub:d,notifyNestedSubs:f,handleChangeWrapper:m,isSubscribed:p,trySubscribe:y,tryUnsubscribe:x,getListeners:()=>i};return S}const pw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mw=pw?$.useLayoutEffect:$.useEffect;function gw({store:t,context:e,children:r,serverState:i,stabilityCheck:a="once",noopCheck:l="once"}){const d=$.useMemo(()=>{const p=hw(t);return{store:t,subscription:p,getServerState:i?()=>i:void 0,stabilityCheck:a,noopCheck:l}},[t,i,a,l]),f=$.useMemo(()=>t.getState(),[t]);mw(()=>{const{subscription:p}=d;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),f!==t.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[d,f]);const m=e||Rs;return $.createElement(m.Provider,{value:d},r)}function Zy(t=Rs){const e=t===Rs?Ky:gf(t);return function(){const{store:i}=e();return i}}const yw=Zy();function vw(t=Rs){const e=t===Rs?yw:Zy(t);return function(){return e().dispatch}}const xw=vw();rw(G1.useSyncExternalStoreWithSelector);X1(Hy.unstable_batchedUpdates);function eo(){return eo=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function yf(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function bw(){return Math.random().toString(36).substr(2,8)}function Km(t,e){return{usr:t.state,key:t.key,idx:e}}function Od(t,e,r,i){return r===void 0&&(r=null),eo({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Yi(e):e,{state:r,key:e&&e.key||i||bw()})}function Fl(t){let{pathname:e="/",search:r="",hash:i=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function Yi(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let i=t.indexOf("?");i>=0&&(e.search=t.substr(i),t=t.substr(0,i)),t&&(e.pathname=t)}return e}function jw(t,e,r,i){i===void 0&&(i={});let{window:a=document.defaultView,v5Compat:l=!1}=i,d=a.history,f=ks.Pop,m=null,p=v();p==null&&(p=0,d.replaceState(eo({},d.state,{idx:p}),""));function v(){return(d.state||{idx:null}).idx}function w(){f=ks.Pop;let b=v(),P=b==null?null:b-p;p=b,m&&m({action:f,location:_.location,delta:P})}function y(b,P){f=ks.Push;let N=Od(_.location,b,P);p=v()+1;let F=Km(N,p),L=_.createHref(N);try{d.pushState(F,"",L)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;a.location.assign(L)}l&&m&&m({action:f,location:_.location,delta:1})}function x(b,P){f=ks.Replace;let N=Od(_.location,b,P);p=v();let F=Km(N,p),L=_.createHref(N);d.replaceState(F,"",L),l&&m&&m({action:f,location:_.location,delta:0})}function S(b){let P=a.location.origin!=="null"?a.location.origin:a.location.href,N=typeof b=="string"?b:Fl(b);return N=N.replace(/ $/,"%20"),Et(P,"No window.location.(origin|href) available to create URL for href: "+N),new URL(N,P)}let _={get action(){return f},get location(){return t(a,d)},listen(b){if(m)throw new Error("A history only accepts one active listener");return a.addEventListener(Wm,w),m=b,()=>{a.removeEventListener(Wm,w),m=null}},createHref(b){return e(a,b)},createURL:S,encodeLocation(b){let P=S(b);return{pathname:P.pathname,search:P.search,hash:P.hash}},push:y,replace:x,go(b){return d.go(b)}};return _}var Qm;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Qm||(Qm={}));function _w(t,e,r){return r===void 0&&(r="/"),Sw(t,e,r)}function Sw(t,e,r,i){let a=typeof e=="string"?Yi(e):e,l=Ui(a.pathname||"/",r);if(l==null)return null;let d=Gy(t);kw(d);let f=null;for(let m=0;f==null&&m{let m={relativePath:f===void 0?l.path||"":f,caseSensitive:l.caseSensitive===!0,childrenIndex:d,route:l};m.relativePath.startsWith("/")&&(Et(m.relativePath.startsWith(i),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(i.length));let p=Ns([i,m.relativePath]),v=r.concat(m);l.children&&l.children.length>0&&(Et(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),Gy(l.children,e,v,p)),!(l.path==null&&!l.index)&&e.push({path:p,score:Tw(p,l.index),routesMeta:v})};return t.forEach((l,d)=>{var f;if(l.path===""||!((f=l.path)!=null&&f.includes("?")))a(l,d);else for(let m of Jy(l.path))a(l,d,m)}),e}function Jy(t){let e=t.split("/");if(e.length===0)return[];let[r,...i]=e,a=r.endsWith("?"),l=r.replace(/\?$/,"");if(i.length===0)return a?[l,""]:[l];let d=Jy(i.join("/")),f=[];return f.push(...d.map(m=>m===""?l:[l,m].join("/"))),a&&f.push(...d),f.map(m=>t.startsWith("/")&&m===""?"/":m)}function kw(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Lw(e.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const Nw=/^:[\w-]+$/,Cw=3,Ew=2,Pw=1,Ow=10,Rw=-2,Zm=t=>t==="*";function Tw(t,e){let r=t.split("/"),i=r.length;return r.some(Zm)&&(i+=Rw),e&&(i+=Ew),r.filter(a=>!Zm(a)).reduce((a,l)=>a+(Nw.test(l)?Cw:l===""?Pw:Ow),i)}function Lw(t,e){return t.length===e.length&&t.slice(0,-1).every((i,a)=>i===e[a])?t[t.length-1]-e[e.length-1]:0}function Aw(t,e,r){let{routesMeta:i}=t,a={},l="/",d=[];for(let f=0;f{let{paramName:y,isOptional:x}=v;if(y==="*"){let _=f[w]||"";d=l.slice(0,l.length-_.length).replace(/(.)\/+$/,"$1")}const S=f[w];return x&&!S?p[y]=void 0:p[y]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:d,pattern:t}}function Iw(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),yf(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let i=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m)=>(i.push({paramName:f,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(i.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),i]}function Mw(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return yf(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Ui(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,i=t.charAt(r);return i&&i!=="/"?null:t.slice(r)||"/"}const Fw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dw=t=>Fw.test(t);function $w(t,e){e===void 0&&(e="/");let{pathname:r,search:i="",hash:a=""}=typeof t=="string"?Yi(t):t,l;if(r)if(Dw(r))l=r;else{if(r.includes("//")){let d=r;r=r.replace(/\/\/+/g,"/"),yf(!1,"Pathnames cannot have embedded double slashes - normalizing "+(d+" -> "+r))}r.startsWith("/")?l=Gm(r.substring(1),"/"):l=Gm(r,e)}else l=e;return{pathname:l,search:Vw(i),hash:Bw(a)}}function Gm(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function od(t,e,r,i){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function zw(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Yy(t,e){let r=zw(t);return e?r.map((i,a)=>a===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Xy(t,e,r,i){i===void 0&&(i=!1);let a;typeof t=="string"?a=Yi(t):(a=eo({},t),Et(!a.pathname||!a.pathname.includes("?"),od("?","pathname","search",a)),Et(!a.pathname||!a.pathname.includes("#"),od("#","pathname","hash",a)),Et(!a.search||!a.search.includes("#"),od("#","search","hash",a)));let l=t===""||a.pathname==="",d=l?"/":a.pathname,f;if(d==null)f=r;else{let w=e.length-1;if(!i&&d.startsWith("..")){let y=d.split("/");for(;y[0]==="..";)y.shift(),w-=1;a.pathname=y.join("/")}f=w>=0?e[w]:"/"}let m=$w(a,f),p=d&&d!=="/"&&d.endsWith("/"),v=(l||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(p||v)&&(m.pathname+="/"),m}const Ns=t=>t.join("/").replace(/\/\/+/g,"/"),Uw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Vw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Bw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function qw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ev=["post","put","patch","delete"];new Set(ev);const Hw=["get",...ev];new Set(Hw);function no(){return no=Object.assign?Object.assign.bind():function(t){for(var e=1;e{f.current=!0}),$.useCallback(function(p,v){if(v===void 0&&(v={}),!f.current)return;if(typeof p=="number"){i.go(p);return}let w=Xy(p,JSON.parse(d),l,v.relative==="path");t==null&&e!=="/"&&(w.pathname=w.pathname==="/"?e:Ns([e,w.pathname])),(v.replace?i.replace:i.push)(w,v.state,v)},[e,i,d,l,t])}const Qw=$.createContext(null);function Zw(t){let e=$.useContext(Jr).outlet;return e&&$.createElement(Qw.Provider,{value:t},e)}function fr(){let{matches:t}=$.useContext(Jr),e=t[t.length-1];return e?e.params:{}}function lu(t,e){let{relative:r}=e===void 0?{}:e,{future:i}=$.useContext(Is),{matches:a}=$.useContext(Jr),{pathname:l}=Xi(),d=JSON.stringify(Yy(a,i.v7_relativeSplatPath));return $.useMemo(()=>Xy(t,JSON.parse(d),l,r==="path"),[t,d,l,r])}function Gw(t,e){return Jw(t,e)}function Jw(t,e,r,i){mo()||Et(!1);let{navigator:a}=$.useContext(Is),{matches:l}=$.useContext(Jr),d=l[l.length-1],f=d?d.params:{};d&&d.pathname;let m=d?d.pathnameBase:"/";d&&d.route;let p=Xi(),v;if(e){var w;let b=typeof e=="string"?Yi(e):e;m==="/"||(w=b.pathname)!=null&&w.startsWith(m)||Et(!1),v=b}else v=p;let y=v.pathname||"/",x=y;if(m!=="/"){let b=m.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(b.length).join("/")}let S=_w(t,{pathname:x}),_=nb(S&&S.map(b=>Object.assign({},b,{params:Object.assign({},f,b.params),pathname:Ns([m,a.encodeLocation?a.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?m:Ns([m,a.encodeLocation?a.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),l,r,i);return e&&_?$.createElement(ou.Provider,{value:{location:no({pathname:"/",search:"",hash:"",state:null,key:"default"},v),navigationType:ks.Pop}},_):_}function Yw(){let t=ab(),e=qw(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return $.createElement($.Fragment,null,$.createElement("h2",null,"Unexpected Application Error!"),$.createElement("h3",{style:{fontStyle:"italic"}},e),r?$.createElement("pre",{style:a},r):null,null)}const Xw=$.createElement(Yw,null);class eb extends $.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?$.createElement(Jr.Provider,{value:this.props.routeContext},$.createElement(nv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tb(t){let{routeContext:e,match:r,children:i}=t,a=$.useContext(au);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),$.createElement(Jr.Provider,{value:e},i)}function nb(t,e,r,i){var a;if(e===void 0&&(e=[]),r===void 0&&(r=null),i===void 0&&(i=null),t==null){var l;if(!r)return null;if(r.errors)t=r.matches;else if((l=i)!=null&&l.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let d=t,f=(a=r)==null?void 0:a.errors;if(f!=null){let v=d.findIndex(w=>w.route.id&&f?.[w.route.id]!==void 0);v>=0||Et(!1),d=d.slice(0,Math.min(d.length,v+1))}let m=!1,p=-1;if(r&&i&&i.v7_partialHydration)for(let v=0;v=0?d=d.slice(0,p+1):d=[d[0]];break}}}return d.reduceRight((v,w,y)=>{let x,S=!1,_=null,b=null;r&&(x=f&&w.route.id?f[w.route.id]:void 0,_=w.route.errorElement||Xw,m&&(p<0&&y===0?(lb("route-fallback"),S=!0,b=null):p===y&&(S=!0,b=w.route.hydrateFallbackElement||null)));let P=e.concat(d.slice(0,y+1)),N=()=>{let F;return x?F=_:S?F=b:w.route.Component?F=$.createElement(w.route.Component,null):w.route.element?F=w.route.element:F=v,$.createElement(tb,{match:w,routeContext:{outlet:v,matches:P,isDataRoute:r!=null},children:F})};return r&&(w.route.ErrorBoundary||w.route.errorElement||y===0)?$.createElement(eb,{location:r.location,revalidation:r.revalidation,component:_,error:x,children:N(),routeContext:{outlet:null,matches:P,isDataRoute:!0}}):N()},null)}var sv=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(sv||{}),iv=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(iv||{});function rb(t){let e=$.useContext(au);return e||Et(!1),e}function sb(t){let e=$.useContext(tv);return e||Et(!1),e}function ib(t){let e=$.useContext(Jr);return e||Et(!1),e}function av(t){let e=ib(),r=e.matches[e.matches.length-1];return r.route.id||Et(!1),r.route.id}function ab(){var t;let e=$.useContext(nv),r=sb(),i=av();return e!==void 0?e:(t=r.errors)==null?void 0:t[i]}function ob(){let{router:t}=rb(sv.UseNavigateStable),e=av(iv.UseNavigateStable),r=$.useRef(!1);return rv(()=>{r.current=!0}),$.useCallback(function(a,l){l===void 0&&(l={}),r.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,no({fromRouteId:e},l)))},[t,e])}const Jm={};function lb(t,e,r){Jm[t]||(Jm[t]=!0)}function ub(t,e){t?.v7_startTransition,t?.v7_relativeSplatPath}function cb(t){return Zw(t.context)}function ln(t){Et(!1)}function db(t){let{basename:e="/",children:r=null,location:i,navigationType:a=ks.Pop,navigator:l,static:d=!1,future:f}=t;mo()&&Et(!1);let m=e.replace(/^\/*/,"/"),p=$.useMemo(()=>({basename:m,navigator:l,static:d,future:no({v7_relativeSplatPath:!1},f)}),[m,f,l,d]);typeof i=="string"&&(i=Yi(i));let{pathname:v="/",search:w="",hash:y="",state:x=null,key:S="default"}=i,_=$.useMemo(()=>{let b=Ui(v,m);return b==null?null:{location:{pathname:b,search:w,hash:y,state:x,key:S},navigationType:a}},[m,v,w,y,x,S,a]);return _==null?null:$.createElement(Is.Provider,{value:p},$.createElement(ou.Provider,{children:r,value:_}))}function fb(t){let{children:e,location:r}=t;return Gw(Rd(e),r)}new Promise(()=>{});function Rd(t,e){e===void 0&&(e=[]);let r=[];return $.Children.forEach(t,(i,a)=>{if(!$.isValidElement(i))return;let l=[...e,a];if(i.type===$.Fragment){r.push.apply(r,Rd(i.props.children,l));return}i.type!==ln&&Et(!1),!i.props.index||!i.props.children||Et(!1);let d={id:i.props.id||l.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Rd(i.props.children,l)),r.push(d)}),r}function Dl(){return Dl=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[a]=t[a]);return r}function hb(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function pb(t,e){return t.button===0&&(!e||e==="_self")&&!hb(t)}const mb=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gb=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],yb="6";try{window.__reactRouterVersion=yb}catch{}const vb=$.createContext({isTransitioning:!1}),xb="startTransition",Ym=z1[xb];function wb(t){let{basename:e,children:r,future:i,window:a}=t,l=$.useRef();l.current==null&&(l.current=ww({window:a,v5Compat:!0}));let d=l.current,[f,m]=$.useState({action:d.action,location:d.location}),{v7_startTransition:p}=i||{},v=$.useCallback(w=>{p&&Ym?Ym(()=>m(w)):m(w)},[m,p]);return $.useLayoutEffect(()=>d.listen(v),[d,v]),$.useEffect(()=>ub(i),[i]),$.createElement(db,{basename:e,children:r,location:f.location,navigationType:f.action,navigator:d,future:i})}const bb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_b=$.forwardRef(function(e,r){let{onClick:i,relative:a,reloadDocument:l,replace:d,state:f,target:m,to:p,preventScrollReset:v,viewTransition:w}=e,y=ov(e,mb),{basename:x}=$.useContext(Is),S,_=!1;if(typeof p=="string"&&jb.test(p)&&(S=p,bb))try{let F=new URL(window.location.href),L=p.startsWith("//")?new URL(F.protocol+p):new URL(p),k=Ui(L.pathname,x);L.origin===F.origin&&k!=null?p=k+L.search+L.hash:_=!0}catch{}let b=Ww(p,{relative:a}),P=Nb(p,{replace:d,state:f,target:m,preventScrollReset:v,relative:a,viewTransition:w});function N(F){i&&i(F),F.defaultPrevented||P(F)}return $.createElement("a",Dl({},y,{href:S||b,onClick:_||l?i:N,ref:r,target:m}))}),Sb=$.forwardRef(function(e,r){let{"aria-current":i="page",caseSensitive:a=!1,className:l="",end:d=!1,style:f,to:m,viewTransition:p,children:v}=e,w=ov(e,gb),y=lu(m,{relative:w.relative}),x=Xi(),S=$.useContext(tv),{navigator:_,basename:b}=$.useContext(Is),P=S!=null&&Cb(y)&&p===!0,N=_.encodeLocation?_.encodeLocation(y).pathname:y.pathname,F=x.pathname,L=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;a||(F=F.toLowerCase(),L=L?L.toLowerCase():null,N=N.toLowerCase()),L&&b&&(L=Ui(L,b)||L);const k=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let I=F===N||!d&&F.startsWith(N)&&F.charAt(k)==="/",X=L!=null&&(L===N||!d&&L.startsWith(N)&&L.charAt(N.length)==="/"),re={isActive:I,isPending:X,isTransitioning:P},de=I?i:void 0,Z;typeof l=="function"?Z=l(re):Z=[l,I?"active":null,X?"pending":null,P?"transitioning":null].filter(Boolean).join(" ");let Oe=typeof f=="function"?f(re):f;return $.createElement(_b,Dl({},w,{"aria-current":de,className:Z,ref:r,style:Oe,to:m,viewTransition:p}),typeof v=="function"?v(re):v)});var Td;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Td||(Td={}));var Xm;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Xm||(Xm={}));function kb(t){let e=$.useContext(au);return e||Et(!1),e}function Nb(t,e){let{target:r,replace:i,state:a,preventScrollReset:l,relative:d,viewTransition:f}=e===void 0?{}:e,m=mn(),p=Xi(),v=lu(t,{relative:d});return $.useCallback(w=>{if(pb(w,r)){w.preventDefault();let y=i!==void 0?i:Fl(p)===Fl(v);m(t,{replace:y,state:a,preventScrollReset:l,relative:d,viewTransition:f})}},[p,m,v,i,a,r,t,l,d,f])}function Cb(t,e){e===void 0&&(e={});let r=$.useContext(vb);r==null&&Et(!1);let{basename:i}=kb(Td.useViewTransitionState),a=lu(t,{relative:e.relative});if(!r.isTransitioning)return!1;let l=Ui(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=Ui(r.nextLocation.pathname,i)||r.nextLocation.pathname;return to(a.pathname,d)!=null||to(a.pathname,l)!=null}var ea=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Eb=class extends ea{#e;#t;#n;constructor(){super(),this.#n=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},vf=new Eb,Pb={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Ob=class{#e=Pb;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},Xs=new Ob;function Rb(t){setTimeout(t,0)}var Tb=typeof window>"u"||"Deno"in globalThis;function un(){}function Lb(t,e){return typeof t=="function"?t(e):t}function Ld(t){return typeof t=="number"&&t>=0&&t!==1/0}function lv(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Cs(t,e){return typeof t=="function"?t(e):t}function Fn(t,e){return typeof t=="function"?t(e):t}function eg(t,e){const{type:r="all",exact:i,fetchStatus:a,predicate:l,queryKey:d,stale:f}=t;if(d){if(i){if(e.queryHash!==xf(d,e.options))return!1}else if(!ro(e.queryKey,d))return!1}if(r!=="all"){const m=e.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof f=="boolean"&&e.isStale()!==f||a&&a!==e.state.fetchStatus||l&&!l(e))}function tg(t,e){const{exact:r,status:i,predicate:a,mutationKey:l}=t;if(l){if(!e.options.mutationKey)return!1;if(r){if(ti(e.options.mutationKey)!==ti(l))return!1}else if(!ro(e.options.mutationKey,l))return!1}return!(i&&e.state.status!==i||a&&!a(e))}function xf(t,e){return(e?.queryKeyHashFn||ti)(t)}function ti(t){return JSON.stringify(t,(e,r)=>Ad(r)?Object.keys(r).sort().reduce((i,a)=>(i[a]=r[a],i),{}):r)}function ro(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>ro(t[r],e[r])):!1}var Ab=Object.prototype.hasOwnProperty;function uv(t,e,r=0){if(t===e)return t;if(r>500)return e;const i=ng(t)&&ng(e);if(!i&&!(Ad(t)&&Ad(e)))return e;const l=(i?t:Object.keys(t)).length,d=i?e:Object.keys(e),f=d.length,m=i?new Array(f):{};let p=0;for(let v=0;v{Xs.setTimeout(e,t)})}function Id(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?uv(t,e):e}function Mb(t,e,r=0){const i=[...t,e];return r&&i.length>r?i.slice(1):i}function Fb(t,e,r=0){const i=[e,...t];return r&&i.length>r?i.slice(0,-1):i}var wf=Symbol();function cv(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===wf?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function bf(t,e){return typeof t=="function"?t(...e):!!t}function Db(t,e,r){let i=!1,a;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(a??=e(),i||(i=!0,a.aborted?r():a.addEventListener("abort",r,{once:!0})),a)}),t}var so=(()=>{let t=()=>Tb;return{isServer(){return t()},setIsServer(e){t=e}}})();function Md(){let t,e;const r=new Promise((a,l)=>{t=a,e=l});r.status="pending",r.catch(()=>{});function i(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{i({status:"fulfilled",value:a}),t(a)},r.reject=a=>{i({status:"rejected",reason:a}),e(a)},r}var $b=Rb;function zb(){let t=[],e=0,r=f=>{f()},i=f=>{f()},a=$b;const l=f=>{e?t.push(f):a(()=>{r(f)})},d=()=>{const f=t;t=[],f.length&&a(()=>{i(()=>{f.forEach(m=>{r(m)})})})};return{batch:f=>{let m;e++;try{m=f()}finally{e--,e||d()}return m},batchCalls:f=>(...m)=>{l(()=>{f(...m)})},schedule:l,setNotifyFunction:f=>{r=f},setBatchNotifyFunction:f=>{i=f},setScheduler:f=>{a=f}}}var zt=zb(),Ub=class extends ea{#e=!0;#t;#n;constructor(){super(),this.#n=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(r=>{r(t)}))}isOnline(){return this.#e}},zl=new Ub;function Vb(t){return Math.min(1e3*2**t,3e4)}function dv(t){return(t??"online")==="online"?zl.isOnline():!0}var Fd=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function fv(t){let e=!1,r=0,i;const a=Md(),l=()=>a.status!=="pending",d=_=>{if(!l()){const b=new Fd(_);y(b),t.onCancel?.(b)}},f=()=>{e=!0},m=()=>{e=!1},p=()=>vf.isFocused()&&(t.networkMode==="always"||zl.isOnline())&&t.canRun(),v=()=>dv(t.networkMode)&&t.canRun(),w=_=>{l()||(i?.(),a.resolve(_))},y=_=>{l()||(i?.(),a.reject(_))},x=()=>new Promise(_=>{i=b=>{(l()||p())&&_(b)},t.onPause?.()}).then(()=>{i=void 0,l()||t.onContinue?.()}),S=()=>{if(l())return;let _;const b=r===0?t.initialPromise:void 0;try{_=b??t.fn()}catch(P){_=Promise.reject(P)}Promise.resolve(_).then(w).catch(P=>{if(l())return;const N=t.retry??(so.isServer()?0:3),F=t.retryDelay??Vb,L=typeof F=="function"?F(r,P):F,k=N===!0||typeof N=="number"&&rp()?void 0:x()).then(()=>{e?y(P):S()})})};return{promise:a,status:()=>a.status,cancel:d,continue:()=>(i?.(),a),cancelRetry:f,continueRetry:m,canStart:v,start:()=>(v()?S():x().then(S),a)}}var hv=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ld(this.gcTime)&&(this.#e=Xs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(so.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Xs.clearTimeout(this.#e),this.#e=void 0)}};function Bb(t){return{onFetch:(e,r)=>{const i=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,l=e.state.data?.pages||[],d=e.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const p=async()=>{let v=!1;const w=S=>{Db(S,()=>e.signal,()=>v=!0)},y=cv(e.options,e.fetchOptions),x=async(S,_,b)=>{if(v)return Promise.reject(e.signal.reason);if(_==null&&S.pages.length)return Promise.resolve(S);const N=(()=>{const I={client:e.client,queryKey:e.queryKey,pageParam:_,direction:b?"backward":"forward",meta:e.options.meta};return w(I),I})(),F=await y(N),{maxPages:L}=e.options,k=b?Fb:Mb;return{pages:k(S.pages,F,L),pageParams:k(S.pageParams,_,L)}};if(a&&l.length){const S=a==="backward",_=S?qb:sg,b={pages:l,pageParams:d},P=_(i,b);f=await x(b,P,S)}else{const S=t??l.length;do{const _=m===0?d[0]??i.initialPageParam:sg(i,f);if(m>0&&_==null)break;f=await x(f,_),m++}while(me.options.persister?.(p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=p}}}function sg(t,{pages:e,pageParams:r}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,r[i],r):void 0}function qb(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var Hb=class extends hv{#e;#t;#n;#r;#i;#s;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#r=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ag(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=ag(this.options);e.data!==void 0&&(this.setState(ig(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){const r=Id(this.state.data,t,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t){this.#l({type:"setState",state:t})}cancel(t){const e=this.#s?.promise;return this.#s?.cancel(t),e?e.then(un).catch(un):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Fn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Cs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!lv(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#s&&(this.#a||this.#c()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},a=()=>{const m=cv(this.options,e),v=(()=>{const w={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(w),w})();return this.#a=!1,this.options.persister?this.options.persister(m,v,this):m(v)},d=(()=>{const m={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return i(m),m})();(this.#e==="infinite"?Bb(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#l({type:"fetch",meta:d.fetchOptions?.meta}),this.#s=fv({initialPromise:e?.initialPromise,fn:d.fetchFn,onCancel:m=>{m instanceof Fd&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(m,p)=>{this.#l({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0});try{const m=await this.#s.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#r.config.onSuccess?.(m,this),this.#r.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof Fd){if(m.silent)return this.#s.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#l({type:"error",error:m}),this.#r.config.onError?.(m,this),this.#r.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#l(t){const e=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...pv(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...ig(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=t.manual?i:void 0,i;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=e(this.state),zt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function pv(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dv(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function ig(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ag(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,i=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Wb=class extends ea{constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=Md(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#o;#a;#c;#l;#p;#d;#f;#u;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),og(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dd(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dd(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#b(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#t.setOptions(this.options),e._defaulted&&!$l(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&lg(this.#t,r,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==r||Fn(this.options.enabled,this.#t)!==Fn(e.enabled,this.#t)||Cs(this.options.staleTime,this.#t)!==Cs(e.staleTime,this.#t))&&this.#g();const a=this.#y();i&&(this.#t!==r||Fn(this.options.enabled,this.#t)!==Fn(e.enabled,this.#t)||a!==this.#u)&&this.#v(a)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),r=this.createResult(e,t);return Qb(this,r)&&(this.#r=r,this.#s=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),e?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),r=this.#e.getQueryCache().build(this.#e,e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#j();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(un)),e}#g(){this.#w();const t=Cs(this.options.staleTime,this.#t);if(so.isServer()||this.#r.isStale||!Ld(t))return;const r=lv(this.#r.dataUpdatedAt,t)+1;this.#d=Xs.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(t){this.#b(),this.#u=t,!(so.isServer()||Fn(this.options.enabled,this.#t)===!1||!Ld(this.#u)||this.#u===0)&&(this.#f=Xs.setInterval(()=>{(this.options.refetchIntervalInBackground||vf.isFocused())&&this.#h()},this.#u))}#x(){this.#g(),this.#v(this.#y())}#w(){this.#d!==void 0&&(Xs.clearTimeout(this.#d),this.#d=void 0)}#b(){this.#f!==void 0&&(Xs.clearInterval(this.#f),this.#f=void 0)}createResult(t,e){const r=this.#t,i=this.options,a=this.#r,l=this.#i,d=this.#s,m=t!==r?t.state:this.#n,{state:p}=t;let v={...p},w=!1,y;if(e._optimisticResults){const re=this.hasListeners(),de=!re&&og(t,e),Z=re&&lg(t,r,e,i);(de||Z)&&(v={...v,...pv(p.data,t.options)}),e._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:_}=v;y=v.data;let b=!1;if(e.placeholderData!==void 0&&y===void 0&&_==="pending"){let re;a?.isPlaceholderData&&e.placeholderData===d?.placeholderData?(re=a.data,b=!0):re=typeof e.placeholderData=="function"?e.placeholderData(this.#p?.state.data,this.#p):e.placeholderData,re!==void 0&&(_="success",y=Id(a?.data,re,e),w=!0)}if(e.select&&y!==void 0&&!b)if(a&&y===l?.data&&e.select===this.#c)y=this.#l;else try{this.#c=e.select,y=e.select(y),y=Id(a?.data,y,e),this.#l=y,this.#a=null}catch(re){this.#a=re}this.#a&&(x=this.#a,y=this.#l,S=Date.now(),_="error");const P=v.fetchStatus==="fetching",N=_==="pending",F=_==="error",L=N&&P,k=y!==void 0,X={status:_,fetchStatus:v.fetchStatus,isPending:N,isSuccess:_==="success",isError:F,isInitialLoading:L,isLoading:L,data:y,dataUpdatedAt:v.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:P,isRefetching:P&&!N,isLoadingError:F&&!k,isPaused:v.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:F&&k,isStale:jf(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Fn(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const re=X.data!==void 0,de=X.status==="error"&&!re,Z=ve=>{de?ve.reject(X.error):re&&ve.resolve(X.data)},Oe=()=>{const ve=this.#o=X.promise=Md();Z(ve)},J=this.#o;switch(J.status){case"pending":t.queryHash===r.queryHash&&Z(J);break;case"fulfilled":(de||X.data!==J.value)&&Oe();break;case"rejected":(!de||X.error!==J.reason)&&Oe();break}}return X}updateResult(){const t=this.#r,e=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#p=this.#t),$l(e,t))return;this.#r=e;const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!this.#m.size)return!0;const l=new Set(a??this.#m);return this.options.throwOnError&&l.add("error"),Object.keys(this.#r).some(d=>{const f=d;return this.#r[f]!==t[f]&&l.has(f)})};this.#_({listeners:r()})}#j(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#n=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#_(t){zt.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Kb(t,e){return Fn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Fn(e.retryOnMount,t)===!1)}function og(t,e){return Kb(t,e)||t.state.data!==void 0&&Dd(t,e,e.refetchOnMount)}function Dd(t,e,r){if(Fn(e.enabled,t)!==!1&&Cs(e.staleTime,t)!=="static"){const i=typeof r=="function"?r(t):r;return i==="always"||i!==!1&&jf(t,e)}return!1}function lg(t,e,r,i){return(t!==e||Fn(i.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&jf(t,r)}function jf(t,e){return Fn(e.enabled,t)!==!1&&t.isStaleByTime(Cs(e.staleTime,t))}function Qb(t,e){return!$l(t.getCurrentResult(),e)}var Zb=class extends hv{#e;#t;#n;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#t=[],this.state=t.state||mv(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=fv({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(l,d)=>{this.#i({type:"failed",failureCount:l,error:d})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",a=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(t,this,r);const d=await this.options.onMutate?.(t,r);d!==this.state.context&&this.#i({type:"pending",context:d,variables:t,isPaused:a})}const l=await this.#r.start();return await this.#n.config.onSuccess?.(l,t,this.state.context,this,r),await this.options.onSuccess?.(l,t,this.state.context,r),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(l,null,t,this.state.context,r),this.#i({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,t,this.state.context,this,r)}catch(d){Promise.reject(d)}try{await this.options.onError?.(l,t,this.state.context,r)}catch(d){Promise.reject(d)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,r)}catch(d){Promise.reject(d)}try{await this.options.onSettled?.(void 0,l,t,this.state.context,r)}catch(d){Promise.reject(d)}throw this.#i({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#i(t){const e=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),zt.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function mv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gb=class extends ea{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(t,e,r){const i=new Zb({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:r});return this.add(i),i}add(t){this.#e.add(t);const e=Nl(t);if(typeof e=="string"){const r=this.#t.get(e);r?r.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=Nl(t);if(typeof e=="string"){const r=this.#t.get(e);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=Nl(t);if(typeof e=="string"){const i=this.#t.get(e)?.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=Nl(t);return typeof e=="string"?this.#t.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){zt.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(r=>tg(e,r))}findAll(t={}){return this.getAll().filter(e=>tg(t,e))}notify(t){zt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return zt.batch(()=>Promise.all(t.map(e=>e.continue().catch(un))))}};function Nl(t){return t.options.scope?.id}var Jb=class extends ea{#e;#t=void 0;#n;#r;constructor(e,r){super(),this.#e=e,this.setOptions(r),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const r=this.options;this.options=this.#e.defaultMutationOptions(e),$l(this.options,r)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),r?.mutationKey&&this.options.mutationKey&&ti(r.mutationKey)!==ti(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#s()}mutate(e,r){return this.#r=r,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){const e=this.#n?.state??mv();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#s(e){zt.batch(()=>{if(this.#r&&this.hasListeners()){const r=this.#t.variables,i=this.#t.context,a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,r,i,a)}catch(l){Promise.reject(l)}try{this.#r.onSettled?.(e.data,null,r,i,a)}catch(l){Promise.reject(l)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,r,i,a)}catch(l){Promise.reject(l)}try{this.#r.onSettled?.(void 0,e.error,r,i,a)}catch(l){Promise.reject(l)}}}this.listeners.forEach(r=>{r(this.#t)})})}},Yb=class extends ea{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,r){const i=e.queryKey,a=e.queryHash??xf(i,e);let l=this.get(a);return l||(l=new Hb({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){zt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(r=>eg(e,r))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(r=>eg(t,r)):e}notify(t){zt.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){zt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){zt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Xb=class{#e;#t;#n;#r;#i;#s;#o;#a;constructor(t={}){this.#e=t.queryCache||new Yb,this.#t=t.mutationCache||new Gb,this.#n=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=vf.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=zl.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=this.#e.build(this,e),i=r.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Cs(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:r})=>{const i=r.data;return[e,i]})}setQueryData(t,e,r){const i=this.defaultQueryOptions({queryKey:t}),l=this.#e.get(i.queryHash)?.state.data,d=Lb(e,l);if(d!==void 0)return this.#e.build(this,i).setData(d,{...r,manual:!0})}setQueriesData(t,e,r){return zt.batch(()=>this.#e.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,r)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;zt.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=this.#e;return zt.batch(()=>(r.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},i=zt.batch(()=>this.#e.findAll(t).map(a=>a.cancel(r)));return Promise.all(i).then(un).catch(un)}invalidateQueries(t,e={}){return zt.batch(()=>(this.#e.findAll(t).forEach(r=>{r.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},i=zt.batch(()=>this.#e.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let l=a.fetch(void 0,r);return r.throwOnError||(l=l.catch(un)),a.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(un)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=this.#e.build(this,e);return r.isStaleByTime(Cs(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(un).catch(un)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(un).catch(un)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return zl.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#r.set(ti(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],r={};return e.forEach(i=>{ro(t,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(t,e){this.#i.set(ti(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],r={};return e.forEach(i=>{ro(t,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=xf(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===wf&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},gv=$.createContext(void 0),Kt=t=>{const e=$.useContext(gv);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},ej=({client:t,children:e})=>($.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),u.jsx(gv.Provider,{value:t,children:e})),yv=$.createContext(!1),tj=()=>$.useContext(yv);yv.Provider;function nj(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rj=$.createContext(nj()),sj=()=>$.useContext(rj),ij=(t,e,r)=>{const i=r?.state.error&&typeof t.throwOnError=="function"?bf(t.throwOnError,[r.state.error,r]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||i)&&(e.isReset()||(t.retryOnMount=!1))},aj=t=>{$.useEffect(()=>{t.clearReset()},[t])},oj=({result:t,errorResetBoundary:e,throwOnError:r,query:i,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(a&&t.data===void 0||bf(r,[t.error,i])),lj=t=>{if(t.suspense){const r=a=>a==="static"?a:Math.max(a??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...a)=>r(i(...a)):r(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},uj=(t,e)=>t.isLoading&&t.isFetching&&!e,cj=(t,e)=>t?.suspense&&e.isPending,ug=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function dj(t,e,r){const i=tj(),a=sj(),l=Kt(),d=l.defaultQueryOptions(t);l.getDefaultOptions().queries?._experimental_beforeQuery?.(d);const f=l.getQueryCache().get(d.queryHash);d._optimisticResults=i?"isRestoring":"optimistic",lj(d),ij(d,a,f),aj(a);const m=!l.getQueryCache().get(d.queryHash),[p]=$.useState(()=>new e(l,d)),v=p.getOptimisticResult(d),w=!i&&t.subscribed!==!1;if($.useSyncExternalStore($.useCallback(y=>{const x=w?p.subscribe(zt.batchCalls(y)):un;return p.updateResult(),x},[p,w]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),$.useEffect(()=>{p.setOptions(d)},[d,p]),cj(d,v))throw ug(d,p,a);if(oj({result:v,errorResetBoundary:a,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(d,v),d.experimental_prefetchInRender&&!so.isServer()&&uj(v,i)&&(m?ug(d,p,a):f?.promise)?.catch(un).finally(()=>{p.updateResult()}),d.notifyOnChangeProps?v:p.trackResult(v)}function On(t,e){return dj(t,Wb)}function gn(t,e){const r=Kt(),[i]=$.useState(()=>new Jb(r,t));$.useEffect(()=>{i.setOptions(t)},[i,t]);const a=$.useSyncExternalStore($.useCallback(d=>i.subscribe(zt.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),l=$.useCallback((d,f)=>{i.mutate(d,f).catch(un)},[i]);if(a.error&&bf(i.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:l,mutateAsync:a.mutate}}var fj=t=>{switch(t){case"success":return mj;case"info":return yj;case"warning":return gj;case"error":return vj;default:return null}},hj=Array(12).fill(0),pj=({visible:t,className:e})=>ne.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ne.createElement("div",{className:"sonner-spinner"},hj.map((r,i)=>ne.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),mj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),yj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),vj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),xj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ne.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ne.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),wj=()=>{let[t,e]=ne.useState(document.hidden);return ne.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},$d=1,bj=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...i}=t,a=typeof t?.id=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:$d++,l=this.toasts.find(f=>f.id===a),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(f=>f.id===a?(this.publish({...f,...t,id:a,title:r}),{...f,...t,id:a,dismissible:d,title:r}):f):this.addToast({title:r,...i,dismissible:d,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let i=t instanceof Promise?t:t(),a=r!==void 0,l,d=i.then(async m=>{if(l=["resolve",m],ne.isValidElement(m))a=!1,this.create({id:r,type:"default",message:m});else if(_j(m)&&!m.ok){a=!1;let p=typeof e.error=="function"?await e.error(`HTTP error! status: ${m.status}`):e.error,v=typeof e.description=="function"?await e.description(`HTTP error! status: ${m.status}`):e.description;this.create({id:r,type:"error",message:p,description:v})}else if(e.success!==void 0){a=!1;let p=typeof e.success=="function"?await e.success(m):e.success,v=typeof e.description=="function"?await e.description(m):e.description;this.create({id:r,type:"success",message:p,description:v})}}).catch(async m=>{if(l=["reject",m],e.error!==void 0){a=!1;let p=typeof e.error=="function"?await e.error(m):e.error,v=typeof e.description=="function"?await e.description(m):e.description;this.create({id:r,type:"error",message:p,description:v})}}).finally(()=>{var m;a&&(this.dismiss(r),r=void 0),(m=e.finally)==null||m.call(e)}),f=()=>new Promise((m,p)=>d.then(()=>l[0]==="reject"?p(l[1]):m(l[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:f}:Object.assign(r,{unwrap:f})},this.custom=(t,e)=>{let r=e?.id||$d++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Cn=new bj,jj=(t,e)=>{let r=e?.id||$d++;return Cn.addToast({title:t,...e,id:r}),r},_j=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Sj=jj,kj=()=>Cn.toasts,Nj=()=>Cn.getActiveToasts(),jt=Object.assign(Sj,{success:Cn.success,info:Cn.info,warning:Cn.warning,error:Cn.error,custom:Cn.custom,message:Cn.message,promise:Cn.promise,dismiss:Cn.dismiss,loading:Cn.loading},{getHistory:kj,getToasts:Nj});function Cj(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}Cj(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Cl(t){return t.label!==void 0}var Ej=3,Pj="32px",Oj="16px",cg=4e3,Rj=356,Tj=14,Lj=20,Aj=200;function or(...t){return t.filter(Boolean).join(" ")}function Ij(t){let[e,r]=t.split("-"),i=[];return e&&i.push(e),r&&i.push(r),i}var Mj=t=>{var e,r,i,a,l,d,f,m,p,v,w;let{invert:y,toast:x,unstyled:S,interacting:_,setHeights:b,visibleToasts:P,heights:N,index:F,toasts:L,expanded:k,removeToast:I,defaultRichColors:X,closeButton:re,style:de,cancelButtonStyle:Z,actionButtonStyle:Oe,className:J="",descriptionClassName:ve="",duration:me,position:M,gap:R,loadingIcon:G,expandByDefault:H,classNames:W,icons:K,closeButtonAriaLabel:T="Close toast",pauseWhenPageIsHidden:Q}=t,[ue,pe]=ne.useState(null),[Le,qe]=ne.useState(null),[Ce,Ge]=ne.useState(!1),[et,Rt]=ne.useState(!1),[yn,Tr]=ne.useState(!1),[Jn,Lr]=ne.useState(!1),[ui,Yr]=ne.useState(!1),[Ms,Ar]=ne.useState(0),[Xr,pr]=ne.useState(0),vn=ne.useRef(x.duration||me||cg),Fs=ne.useRef(null),Rn=ne.useRef(null),E=F===0,z=F+1<=P,V=x.type,oe=x.dismissible!==!1,le=x.className||"",ae=x.descriptionClassName||"",ce=ne.useMemo(()=>N.findIndex(Fe=>Fe.toastId===x.id)||0,[N,x.id]),Ae=ne.useMemo(()=>{var Fe;return(Fe=x.closeButton)!=null?Fe:re},[x.closeButton,re]),We=ne.useMemo(()=>x.duration||me||cg,[x.duration,me]),St=ne.useRef(0),Tt=ne.useRef(0),Ft=ne.useRef(0),$n=ne.useRef(null),[Ir,Mr]=M.split("-"),es=ne.useMemo(()=>N.reduce((Fe,at,ct)=>ct>=ce?Fe:Fe+at.height,0),[N,ce]),Fr=wj(),mr=x.invert||y,Tn=V==="loading";Tt.current=ne.useMemo(()=>ce*R+es,[ce,es]),ne.useEffect(()=>{vn.current=We},[We]),ne.useEffect(()=>{Ge(!0)},[]),ne.useEffect(()=>{let Fe=Rn.current;if(Fe){let at=Fe.getBoundingClientRect().height;return pr(at),b(ct=>[{toastId:x.id,height:at,position:x.position},...ct]),()=>b(ct=>ct.filter(sn=>sn.toastId!==x.id))}},[b,x.id]),ne.useLayoutEffect(()=>{if(!Ce)return;let Fe=Rn.current,at=Fe.style.height;Fe.style.height="auto";let ct=Fe.getBoundingClientRect().height;Fe.style.height=at,pr(ct),b(sn=>sn.find(xn=>xn.toastId===x.id)?sn.map(xn=>xn.toastId===x.id?{...xn,height:ct}:xn):[{toastId:x.id,height:ct,position:x.position},...sn])},[Ce,x.title,x.description,b,x.id]);let Yn=ne.useCallback(()=>{Rt(!0),Ar(Tt.current),b(Fe=>Fe.filter(at=>at.toastId!==x.id)),setTimeout(()=>{I(x)},Aj)},[x,I,b,Tt]);ne.useEffect(()=>{if(x.promise&&V==="loading"||x.duration===1/0||x.type==="loading")return;let Fe;return k||_||Q&&Fr?(()=>{if(Ft.current{var at;(at=x.onAutoClose)==null||at.call(x,x),Yn()},vn.current)),()=>clearTimeout(Fe)},[k,_,x,V,Q,Fr,Yn]),ne.useEffect(()=>{x.delete&&Yn()},[Yn,x.delete]);function yo(){var Fe,at,ct;return K!=null&&K.loading?ne.createElement("div",{className:or(W?.loader,(Fe=x?.classNames)==null?void 0:Fe.loader,"sonner-loader"),"data-visible":V==="loading"},K.loading):G?ne.createElement("div",{className:or(W?.loader,(at=x?.classNames)==null?void 0:at.loader,"sonner-loader"),"data-visible":V==="loading"},G):ne.createElement(pj,{className:or(W?.loader,(ct=x?.classNames)==null?void 0:ct.loader),visible:V==="loading"})}return ne.createElement("li",{tabIndex:0,ref:Rn,className:or(J,le,W?.toast,(e=x?.classNames)==null?void 0:e.toast,W?.default,W?.[V],(r=x?.classNames)==null?void 0:r[V]),"data-sonner-toast":"","data-rich-colors":(i=x.richColors)!=null?i:X,"data-styled":!(x.jsx||x.unstyled||S),"data-mounted":Ce,"data-promise":!!x.promise,"data-swiped":ui,"data-removed":et,"data-visible":z,"data-y-position":Ir,"data-x-position":Mr,"data-index":F,"data-front":E,"data-swiping":yn,"data-dismissible":oe,"data-type":V,"data-invert":mr,"data-swipe-out":Jn,"data-swipe-direction":Le,"data-expanded":!!(k||H&&Ce),style:{"--index":F,"--toasts-before":F,"--z-index":L.length-F,"--offset":`${et?Ms:Tt.current}px`,"--initial-height":H?"auto":`${Xr}px`,...de,...x.style},onDragEnd:()=>{Tr(!1),pe(null),$n.current=null},onPointerDown:Fe=>{Tn||!oe||(Fs.current=new Date,Ar(Tt.current),Fe.target.setPointerCapture(Fe.pointerId),Fe.target.tagName!=="BUTTON"&&(Tr(!0),$n.current={x:Fe.clientX,y:Fe.clientY}))},onPointerUp:()=>{var Fe,at,ct,sn;if(Jn||!oe)return;$n.current=null;let xn=Number(((Fe=Rn.current)==null?void 0:Fe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),wn=Number(((at=Rn.current)==null?void 0:at.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xn=new Date().getTime()-((ct=Fs.current)==null?void 0:ct.getTime()),qt=ue==="x"?xn:wn,gr=Math.abs(qt)/Xn;if(Math.abs(qt)>=Lj||gr>.11){Ar(Tt.current),(sn=x.onDismiss)==null||sn.call(x,x),qe(ue==="x"?xn>0?"right":"left":wn>0?"down":"up"),Yn(),Lr(!0),Yr(!1);return}Tr(!1),pe(null)},onPointerMove:Fe=>{var at,ct,sn,xn;if(!$n.current||!oe||((at=window.getSelection())==null?void 0:at.toString().length)>0)return;let wn=Fe.clientY-$n.current.y,Xn=Fe.clientX-$n.current.x,qt=(ct=t.swipeDirections)!=null?ct:Ij(M);!ue&&(Math.abs(Xn)>1||Math.abs(wn)>1)&&pe(Math.abs(Xn)>Math.abs(wn)?"x":"y");let gr={x:0,y:0};ue==="y"?(qt.includes("top")||qt.includes("bottom"))&&(qt.includes("top")&&wn<0||qt.includes("bottom")&&wn>0)&&(gr.y=wn):ue==="x"&&(qt.includes("left")||qt.includes("right"))&&(qt.includes("left")&&Xn<0||qt.includes("right")&&Xn>0)&&(gr.x=Xn),(Math.abs(gr.x)>0||Math.abs(gr.y)>0)&&Yr(!0),(sn=Rn.current)==null||sn.style.setProperty("--swipe-amount-x",`${gr.x}px`),(xn=Rn.current)==null||xn.style.setProperty("--swipe-amount-y",`${gr.y}px`)}},Ae&&!x.jsx?ne.createElement("button",{"aria-label":T,"data-disabled":Tn,"data-close-button":!0,onClick:Tn||!oe?()=>{}:()=>{var Fe;Yn(),(Fe=x.onDismiss)==null||Fe.call(x,x)},className:or(W?.closeButton,(a=x?.classNames)==null?void 0:a.closeButton)},(l=K?.close)!=null?l:xj):null,x.jsx||$.isValidElement(x.title)?x.jsx?x.jsx:typeof x.title=="function"?x.title():x.title:ne.createElement(ne.Fragment,null,V||x.icon||x.promise?ne.createElement("div",{"data-icon":"",className:or(W?.icon,(d=x?.classNames)==null?void 0:d.icon)},x.promise||x.type==="loading"&&!x.icon?x.icon||yo():null,x.type!=="loading"?x.icon||K?.[V]||fj(V):null):null,ne.createElement("div",{"data-content":"",className:or(W?.content,(f=x?.classNames)==null?void 0:f.content)},ne.createElement("div",{"data-title":"",className:or(W?.title,(m=x?.classNames)==null?void 0:m.title)},typeof x.title=="function"?x.title():x.title),x.description?ne.createElement("div",{"data-description":"",className:or(ve,ae,W?.description,(p=x?.classNames)==null?void 0:p.description)},typeof x.description=="function"?x.description():x.description):null),$.isValidElement(x.cancel)?x.cancel:x.cancel&&Cl(x.cancel)?ne.createElement("button",{"data-button":!0,"data-cancel":!0,style:x.cancelButtonStyle||Z,onClick:Fe=>{var at,ct;Cl(x.cancel)&&oe&&((ct=(at=x.cancel).onClick)==null||ct.call(at,Fe),Yn())},className:or(W?.cancelButton,(v=x?.classNames)==null?void 0:v.cancelButton)},x.cancel.label):null,$.isValidElement(x.action)?x.action:x.action&&Cl(x.action)?ne.createElement("button",{"data-button":!0,"data-action":!0,style:x.actionButtonStyle||Oe,onClick:Fe=>{var at,ct;Cl(x.action)&&((ct=(at=x.action).onClick)==null||ct.call(at,Fe),!Fe.defaultPrevented&&Yn())},className:or(W?.actionButton,(w=x?.classNames)==null?void 0:w.actionButton)},x.action.label):null))};function dg(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Fj(t,e){let r={};return[t,e].forEach((i,a)=>{let l=a===1,d=l?"--mobile-offset":"--offset",f=l?Oj:Pj;function m(p){["top","right","bottom","left"].forEach(v=>{r[`${d}-${v}`]=typeof p=="number"?`${p}px`:p})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(p=>{i[p]===void 0?r[`${d}-${p}`]=f:r[`${d}-${p}`]=typeof i[p]=="number"?`${i[p]}px`:i[p]}):m(f)}),r}var Dj=$.forwardRef(function(t,e){let{invert:r,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:l,closeButton:d,className:f,offset:m,mobileOffset:p,theme:v="light",richColors:w,duration:y,style:x,visibleToasts:S=Ej,toastOptions:_,dir:b=dg(),gap:P=Tj,loadingIcon:N,icons:F,containerAriaLabel:L="Notifications",pauseWhenPageIsHidden:k}=t,[I,X]=ne.useState([]),re=ne.useMemo(()=>Array.from(new Set([i].concat(I.filter(Q=>Q.position).map(Q=>Q.position)))),[I,i]),[de,Z]=ne.useState([]),[Oe,J]=ne.useState(!1),[ve,me]=ne.useState(!1),[M,R]=ne.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ne.useRef(null),H=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=ne.useRef(null),K=ne.useRef(!1),T=ne.useCallback(Q=>{X(ue=>{var pe;return(pe=ue.find(Le=>Le.id===Q.id))!=null&&pe.delete||Cn.dismiss(Q.id),ue.filter(({id:Le})=>Le!==Q.id)})},[]);return ne.useEffect(()=>Cn.subscribe(Q=>{if(Q.dismiss){X(ue=>ue.map(pe=>pe.id===Q.id?{...pe,delete:!0}:pe));return}setTimeout(()=>{J1.flushSync(()=>{X(ue=>{let pe=ue.findIndex(Le=>Le.id===Q.id);return pe!==-1?[...ue.slice(0,pe),{...ue[pe],...Q},...ue.slice(pe+1)]:[Q,...ue]})})})}),[]),ne.useEffect(()=>{if(v!=="system"){R(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?R("dark"):R("light")),typeof window>"u")return;let Q=window.matchMedia("(prefers-color-scheme: dark)");try{Q.addEventListener("change",({matches:ue})=>{R(ue?"dark":"light")})}catch{Q.addListener(({matches:pe})=>{try{R(pe?"dark":"light")}catch(Le){console.error(Le)}})}},[v]),ne.useEffect(()=>{I.length<=1&&J(!1)},[I]),ne.useEffect(()=>{let Q=ue=>{var pe,Le;a.every(qe=>ue[qe]||ue.code===qe)&&(J(!0),(pe=G.current)==null||pe.focus()),ue.code==="Escape"&&(document.activeElement===G.current||(Le=G.current)!=null&&Le.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[a]),ne.useEffect(()=>{if(G.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,K.current=!1)}},[G.current]),ne.createElement("section",{ref:e,"aria-label":`${L} ${H}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},re.map((Q,ue)=>{var pe;let[Le,qe]=Q.split("-");return I.length?ne.createElement("ol",{key:Q,dir:b==="auto"?dg():b,tabIndex:-1,ref:G,className:f,"data-sonner-toaster":!0,"data-theme":M,"data-y-position":Le,"data-lifted":Oe&&I.length>1&&!l,"data-x-position":qe,style:{"--front-toast-height":`${((pe=de[0])==null?void 0:pe.height)||0}px`,"--width":`${Rj}px`,"--gap":`${P}px`,...x,...Fj(m,p)},onBlur:Ce=>{K.current&&!Ce.currentTarget.contains(Ce.relatedTarget)&&(K.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||K.current||(K.current=!0,W.current=Ce.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{ve||J(!1)},onDragEnd:()=>J(!1),onPointerDown:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||me(!0)},onPointerUp:()=>me(!1)},I.filter(Ce=>!Ce.position&&ue===0||Ce.position===Q).map((Ce,Ge)=>{var et,Rt;return ne.createElement(Mj,{key:Ce.id,icons:F,index:Ge,toast:Ce,defaultRichColors:w,duration:(et=_?.duration)!=null?et:y,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:r,visibleToasts:S,closeButton:(Rt=_?.closeButton)!=null?Rt:d,interacting:ve,position:Q,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,removeToast:T,toasts:I.filter(yn=>yn.position==Ce.position),heights:de.filter(yn=>yn.position==Ce.position),setHeights:Z,expandByDefault:l,gap:P,loadingIcon:N,expanded:Oe,pauseWhenPageIsHidden:k,swipeDirections:t.swipeDirections})})):null}))});const $e=t=>typeof t=="string",Da=()=>{let t,e;const r=new Promise((i,a)=>{t=i,e=a});return r.resolve=t,r.reject=e,r},fg=t=>t==null?"":""+t,$j=(t,e,r)=>{t.forEach(i=>{e[i]&&(r[i]=e[i])})},zj=/###/g,hg=t=>t&&t.indexOf("###")>-1?t.replace(zj,"."):t,pg=t=>!t||$e(t),Ga=(t,e,r)=>{const i=$e(e)?e.split("."):e;let a=0;for(;a{const{obj:i,k:a}=Ga(t,e,Object);if(i!==void 0||e.length===1){i[a]=r;return}let l=e[e.length-1],d=e.slice(0,e.length-1),f=Ga(t,d,Object);for(;f.obj===void 0&&d.length;)l=`${d[d.length-1]}.${l}`,d=d.slice(0,d.length-1),f=Ga(t,d,Object),f&&f.obj&&typeof f.obj[`${f.k}.${l}`]<"u"&&(f.obj=void 0);f.obj[`${f.k}.${l}`]=r},Uj=(t,e,r,i)=>{const{obj:a,k:l}=Ga(t,e,Object);a[l]=a[l]||[],a[l].push(r)},Ul=(t,e)=>{const{obj:r,k:i}=Ga(t,e);if(r)return r[i]},Vj=(t,e,r)=>{const i=Ul(t,r);return i!==void 0?i:Ul(e,r)},vv=(t,e,r)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in t?$e(t[i])||t[i]instanceof String||$e(e[i])||e[i]instanceof String?r&&(t[i]=e[i]):vv(t[i],e[i],r):t[i]=e[i]);return t},Ti=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Bj={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const qj=t=>$e(t)?t.replace(/[&<>"'\/]/g,e=>Bj[e]):t;class Hj{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const Wj=[" ",",","?","!",";"],Kj=new Hj(20),Qj=(t,e,r)=>{e=e||"",r=r||"";const i=Wj.filter(d=>e.indexOf(d)<0&&r.indexOf(d)<0);if(i.length===0)return!0;const a=Kj.getRegExp(`(${i.map(d=>d==="?"?"\\?":d).join("|")})`);let l=!a.test(t);if(!l){const d=t.indexOf(r);d>0&&!a.test(t.substring(0,d))&&(l=!0)}return l},zd=function(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const i=e.split(r);let a=t;for(let l=0;l-1&&mt&&t.replace("_","-"),Zj={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console&&console[t]&&console[t].apply(console,e)}};class Bl{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,r)}init(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=e||Zj,this.options=r,this.debug=r.debug}log(){for(var e=arguments.length,r=new Array(e),i=0;i{this.observers[i]||(this.observers[i]=new Map);const a=this.observers[i].get(r)||0;this.observers[i].set(r,a+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a{let[f,m]=d;for(let p=0;p{let[f,m]=d;for(let p=0;p1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,d=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;e.indexOf(".")>-1?f=e.split("."):(f=[e,r],i&&(Array.isArray(i)?f.push(...i):$e(i)&&l?f.push(...i.split(l)):f.push(i)));const m=Ul(this.data,f);return!m&&!r&&!i&&e.indexOf(".")>-1&&(e=f[0],r=f[1],i=f.slice(2).join(".")),m||!d||!$e(i)?m:zd(this.data&&this.data[e]&&this.data[e][r],i,l)}addResource(e,r,i,a){let l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const d=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator;let f=[e,r];i&&(f=f.concat(d?i.split(d):i)),e.indexOf(".")>-1&&(f=e.split("."),a=r,r=f[1]),this.addNamespaces(r),mg(this.data,f,a),l.silent||this.emit("added",e,r,i,a)}addResources(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const l in i)($e(i[l])||Array.isArray(i[l]))&&this.addResource(e,r,l,i[l],{silent:!0});a.silent||this.emit("added",e,r,i)}addResourceBundle(e,r,i,a,l){let d=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},f=[e,r];e.indexOf(".")>-1&&(f=e.split("."),a=i,i=r,r=f[1]),this.addNamespaces(r);let m=Ul(this.data,f)||{};d.skipCopy||(i=JSON.parse(JSON.stringify(i))),a?vv(m,i,l):m={...m,...i},mg(this.data,f,m),d.silent||this.emit("added",e,r,i)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,r)}:this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(a=>r[a]&&Object.keys(r[a]).length>0)}toJSON(){return this.data}}var xv={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,i,a){return t.forEach(l=>{this.processors[l]&&(e=this.processors[l].process(e,r,i,a))}),e}};const yg={};class ql extends uu{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),$j(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Cr.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const i=this.resolve(e,r);return i&&i.res!==void 0}extractFromKey(e,r){let i=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let l=r.ns||this.options.defaultNS||[];const d=i&&e.indexOf(i)>-1,f=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Qj(e,i,a);if(d&&!f){const m=e.match(this.interpolator.nestingRegexp);if(m&&m.length>0)return{key:e,namespaces:$e(l)?[l]:l};const p=e.split(i);(i!==a||i===a&&this.options.ns.indexOf(p[0])>-1)&&(l=p.shift()),e=p.join(a)}return{key:e,namespaces:$e(l)?[l]:l}}translate(e,r,i){if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const a=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,l=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:d,namespaces:f}=this.extractFromKey(e[e.length-1],r),m=f[f.length-1],p=r.lng||this.language,v=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(v){const L=r.nsSeparator||this.options.nsSeparator;return a?{res:`${m}${L}${d}`,usedKey:d,exactUsedKey:d,usedLng:p,usedNS:m,usedParams:this.getUsedParamsDetails(r)}:`${m}${L}${d}`}return a?{res:d,usedKey:d,exactUsedKey:d,usedLng:p,usedNS:m,usedParams:this.getUsedParamsDetails(r)}:d}const w=this.resolve(e,r);let y=w&&w.res;const x=w&&w.usedKey||d,S=w&&w.exactUsedKey||d,_=Object.prototype.toString.apply(y),b=["[object Number]","[object Function]","[object RegExp]"],P=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,N=!this.i18nFormat||this.i18nFormat.handleAsObject,F=!$e(y)&&typeof y!="boolean"&&typeof y!="number";if(N&&y&&F&&b.indexOf(_)<0&&!($e(P)&&Array.isArray(y))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,y,{...r,ns:f}):`key '${d} (${this.language})' returned an object instead of string.`;return a?(w.res=L,w.usedParams=this.getUsedParamsDetails(r),w):L}if(l){const L=Array.isArray(y),k=L?[]:{},I=L?S:x;for(const X in y)if(Object.prototype.hasOwnProperty.call(y,X)){const re=`${I}${l}${X}`;k[X]=this.translate(re,{...r,joinArrays:!1,ns:f}),k[X]===re&&(k[X]=y[X])}y=k}}else if(N&&$e(P)&&Array.isArray(y))y=y.join(P),y&&(y=this.extendTranslation(y,e,r,i));else{let L=!1,k=!1;const I=r.count!==void 0&&!$e(r.count),X=ql.hasDefaultValue(r),re=I?this.pluralResolver.getSuffix(p,r.count,r):"",de=r.ordinal&&I?this.pluralResolver.getSuffix(p,r.count,{ordinal:!1}):"",Z=I&&!r.ordinal&&r.count===0&&this.pluralResolver.shouldUseIntlApi(),Oe=Z&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${re}`]||r[`defaultValue${de}`]||r.defaultValue;!this.isValidLookup(y)&&X&&(L=!0,y=Oe),this.isValidLookup(y)||(k=!0,y=d);const ve=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&k?void 0:y,me=X&&Oe!==y&&this.options.updateMissing;if(k||L||me){if(this.logger.log(me?"updateKey":"missingKey",p,m,d,me?Oe:y),l){const H=this.resolve(d,{...r,keySeparator:!1});H&&H.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let M=[];const R=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&R&&R[0])for(let H=0;H{const T=X&&K!==y?K:ve;this.options.missingKeyHandler?this.options.missingKeyHandler(H,m,W,T,me,r):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(H,m,W,T,me,r),this.emit("missingKey",H,m,W,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&I?M.forEach(H=>{const W=this.pluralResolver.getSuffixes(H,r);Z&&r[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(K=>{G([H],d+K,r[`defaultValue${K}`]||Oe)})}):G(M,d,Oe))}y=this.extendTranslation(y,e,r,w,i),k&&y===d&&this.options.appendNamespaceToMissingKey&&(y=`${m}:${d}`),(k||L)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}:${d}`:d,L?y:void 0):y=this.options.parseMissingKeyHandler(y))}return a?(w.res=y,w.usedParams=this.getUsedParamsDetails(r),w):y}extendTranslation(e,r,i,a,l){var d=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const p=$e(e)&&(i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(p){const y=e.match(this.interpolator.nestingRegexp);v=y&&y.length}let w=i.replace&&!$e(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(w={...this.options.interpolation.defaultVariables,...w}),e=this.interpolator.interpolate(e,w,i.lng||this.language||a.usedLng,i),p){const y=e.match(this.interpolator.nestingRegexp),x=y&&y.length;v1&&arguments[1]!==void 0?arguments[1]:{},i,a,l,d,f;return $e(e)&&(e=[e]),e.forEach(m=>{if(this.isValidLookup(i))return;const p=this.extractFromKey(m,r),v=p.key;a=v;let w=p.namespaces;this.options.fallbackNS&&(w=w.concat(this.options.fallbackNS));const y=r.count!==void 0&&!$e(r.count),x=y&&!r.ordinal&&r.count===0&&this.pluralResolver.shouldUseIntlApi(),S=r.context!==void 0&&($e(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);w.forEach(b=>{this.isValidLookup(i)||(f=b,!yg[`${_[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(f)&&(yg[`${_[0]}-${b}`]=!0,this.logger.warn(`key "${a}" for languages "${_.join(", ")}" won't get resolved as namespace "${f}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(P=>{if(this.isValidLookup(i))return;d=P;const N=[v];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(N,v,P,b,r);else{let L;y&&(L=this.pluralResolver.getSuffix(P,r.count,r));const k=`${this.options.pluralSeparator}zero`,I=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(N.push(v+L),r.ordinal&&L.indexOf(I)===0&&N.push(v+L.replace(I,this.options.pluralSeparator)),x&&N.push(v+k)),S){const X=`${v}${this.options.contextSeparator}${r.context}`;N.push(X),y&&(N.push(X+L),r.ordinal&&L.indexOf(I)===0&&N.push(X+L.replace(I,this.options.pluralSeparator)),x&&N.push(X+k))}}let F;for(;F=N.pop();)this.isValidLookup(i)||(l=F,i=this.getResource(P,b,F,r))}))})}),{res:i,usedKey:a,exactUsedKey:l,usedLng:d,usedNS:f}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,r,i,a):this.resourceStore.getResource(e,r,i,a)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!$e(e.replace);let a=i?e.replace:e;if(i&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!i){a={...a};for(const l of r)delete a[l]}return a}static hasDefaultValue(e){const r="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&r===i.substring(0,r.length)&&e[i]!==void 0)return!0;return!1}}const ld=t=>t.charAt(0).toUpperCase()+t.slice(1);class vg{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Cr.create("languageUtils")}getScriptPartFromCode(e){if(e=Vl(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=Vl(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if($e(e)&&e.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let a=Intl.getCanonicalLocales(e)[0];if(a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a)return a}catch{}const r=["hans","hant","latn","cyrl","cans","mong","arab"];let i=e.split("-");return this.options.lowerCaseLng?i=i.map(a=>a.toLowerCase()):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=ld(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=ld(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=ld(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(i=>{if(r)return;const a=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(a))&&(r=a)}),!r&&this.options.supportedLngs&&e.forEach(i=>{if(r)return;const a=this.getLanguagePartFromCode(i);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(l=>{if(l===a)return l;if(!(l.indexOf("-")<0&&a.indexOf("-")<0)&&(l.indexOf("-")>0&&a.indexOf("-")<0&&l.substring(0,l.indexOf("-"))===a||l.indexOf(a)===0&&a.length>1))return l})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),$e(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let i=e[r];return i||(i=e[this.getScriptPartFromCode(r)]),i||(i=e[this.formatLanguageCode(r)]),i||(i=e[this.getLanguagePartFromCode(r)]),i||(i=e.default),i||[]}toResolveHierarchy(e,r){const i=this.getFallbackCodes(r||this.options.fallbackLng||[],e),a=[],l=d=>{d&&(this.isSupportedCode(d)?a.push(d):this.logger.warn(`rejecting language code not found in supportedLngs: ${d}`))};return $e(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&l(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&l(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&l(this.getLanguagePartFromCode(e))):$e(e)&&l(this.formatLanguageCode(e)),i.forEach(d=>{a.indexOf(d)<0&&l(this.formatLanguageCode(d))}),a}}let Gj=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Jj={1:t=>+(t>1),2:t=>+(t!=1),3:t=>0,4:t=>t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2,5:t=>t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5,6:t=>t==1?0:t>=2&&t<=4?1:2,7:t=>t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2,8:t=>t==1?0:t==2?1:t!=8&&t!=11?2:3,9:t=>+(t>=2),10:t=>t==1?0:t==2?1:t<7?2:t<11?3:4,11:t=>t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3,12:t=>+(t%10!=1||t%100==11),13:t=>+(t!==0),14:t=>t==1?0:t==2?1:t==3?2:3,15:t=>t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2,16:t=>t%10==1&&t%100!=11?0:t!==0?1:2,17:t=>t==1||t%10==1&&t%100!=11?0:1,18:t=>t==0?0:t==1?1:2,19:t=>t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3,20:t=>t==1?0:t==0||t%100>0&&t%100<20?1:2,21:t=>t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0,22:t=>t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3};const Yj=["v1","v2","v3"],Xj=["v4"],xg={zero:0,one:1,two:2,few:3,many:4,other:5},e_=()=>{const t={};return Gj.forEach(e=>{e.lngs.forEach(r=>{t[r]={numbers:e.nr,plurals:Jj[e.fc]}})}),t};class t_{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=r,this.logger=Cr.create("pluralResolver"),(!this.options.compatibilityJSON||Xj.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=e_(),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const i=Vl(e==="dev"?"en":e),a=r.ordinal?"ordinal":"cardinal",l=JSON.stringify({cleanedCode:i,type:a});if(l in this.pluralRulesCache)return this.pluralRulesCache[l];let d;try{d=new Intl.PluralRules(i,{type:a})}catch{if(!e.match(/-|_/))return;const m=this.languageUtils.getLanguagePartFromCode(e);d=this.getRule(m,r)}return this.pluralRulesCache[l]=d,d}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=this.getRule(e,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}getPluralFormsOfKey(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(a=>`${r}${a}`)}getSuffixes(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort((a,l)=>xg[a]-xg[l]).map(a=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a}`):i.numbers.map(a=>this.getSuffix(e,a,r)):[]}getSuffix(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const a=this.getRule(e,i);return a?this.shouldUseIntlApi()?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${a.select(r)}`:this.getSuffixRetroCompatible(a,r):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,r){const i=e.noAbs?e.plurals(r):e.plurals(Math.abs(r));let a=e.numbers[i];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(a===2?a="plural":a===1&&(a=""));const l=()=>this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString();return this.options.compatibilityJSON==="v1"?a===1?"":typeof a=="number"?`_plural_${a.toString()}`:l():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?l():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}shouldUseIntlApi(){return!Yj.includes(this.options.compatibilityJSON)}}const wg=function(t,e,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=Vj(t,e,r);return!l&&a&&$e(r)&&(l=zd(t,r,i),l===void 0&&(l=zd(e,r,i))),l},ud=t=>t.replace(/\$/g,"$$$$");class n_{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Cr.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(r=>r),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:i,useRawValueToEscape:a,prefix:l,prefixEscaped:d,suffix:f,suffixEscaped:m,formatSeparator:p,unescapeSuffix:v,unescapePrefix:w,nestingPrefix:y,nestingPrefixEscaped:x,nestingSuffix:S,nestingSuffixEscaped:_,nestingOptionsSeparator:b,maxReplaces:P,alwaysFormat:N}=e.interpolation;this.escape=r!==void 0?r:qj,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=l?Ti(l):d||"{{",this.suffix=f?Ti(f):m||"}}",this.formatSeparator=p||",",this.unescapePrefix=v?"":w||"-",this.unescapeSuffix=this.unescapePrefix?"":v||"",this.nestingPrefix=y?Ti(y):x||Ti("$t("),this.nestingSuffix=S?Ti(S):_||Ti(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=P||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,i)=>r&&r.source===i?(r.lastIndex=0,r):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,r,i,a){let l,d,f;const m=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=x=>{if(x.indexOf(this.formatSeparator)<0){const P=wg(r,m,x,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(P,void 0,i,{...a,...r,interpolationkey:x}):P}const S=x.split(this.formatSeparator),_=S.shift().trim(),b=S.join(this.formatSeparator).trim();return this.format(wg(r,m,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,i,{...a,...r,interpolationkey:_})};this.resetRegExp();const v=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,w=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:x=>ud(x)},{regex:this.regexp,safeValue:x=>this.escapeValue?ud(this.escape(x)):ud(x)}].forEach(x=>{for(f=0;l=x.regex.exec(e);){const S=l[1].trim();if(d=p(S),d===void 0)if(typeof v=="function"){const b=v(e,l,a);d=$e(b)?b:""}else if(a&&Object.prototype.hasOwnProperty.call(a,S))d="";else if(w){d=l[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),d="";else!$e(d)&&!this.useRawValueToEscape&&(d=fg(d));const _=x.safeValue(d);if(e=e.replace(l[0],_),w?(x.regex.lastIndex+=d.length,x.regex.lastIndex-=l[0].length):x.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),e}nest(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,l,d;const f=(m,p)=>{const v=this.nestingOptionsSeparator;if(m.indexOf(v)<0)return m;const w=m.split(new RegExp(`${v}[ ]*{`));let y=`{${w[1]}`;m=w[0],y=this.interpolate(y,d);const x=y.match(/'/g),S=y.match(/"/g);(x&&x.length%2===0&&!S||S.length%2!==0)&&(y=y.replace(/'/g,'"'));try{d=JSON.parse(y),p&&(d={...p,...d})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${m}`,_),`${m}${v}${y}`}return d.defaultValue&&d.defaultValue.indexOf(this.prefix)>-1&&delete d.defaultValue,m};for(;a=this.nestingRegexp.exec(e);){let m=[];d={...i},d=d.replace&&!$e(d.replace)?d.replace:d,d.applyPostProcessor=!1,delete d.defaultValue;let p=!1;if(a[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(a[1])){const v=a[1].split(this.formatSeparator).map(w=>w.trim());a[1]=v.shift(),m=v,p=!0}if(l=r(f.call(this,a[1].trim(),d),d),l&&a[0]===e&&!$e(l))return l;$e(l)||(l=fg(l)),l||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),l=""),p&&(l=m.reduce((v,w)=>this.format(v,w,i.lng,{...i,interpolationkey:a[1].trim()}),l.trim())),e=e.replace(a[0],l),this.regexp.lastIndex=0}return e}}const r_=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const i=t.split("(");e=i[0].toLowerCase().trim();const a=i[1].substring(0,i[1].length-1);e==="currency"&&a.indexOf(":")<0?r.currency||(r.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?r.range||(r.range=a.trim()):a.split(";").forEach(d=>{if(d){const[f,...m]=d.split(":"),p=m.join(":").trim().replace(/^'+|'+$/g,""),v=f.trim();r[v]||(r[v]=p),p==="false"&&(r[v]=!1),p==="true"&&(r[v]=!0),isNaN(p)||(r[v]=parseInt(p,10))}})}return{formatName:e,formatOptions:r}},Li=t=>{const e={};return(r,i,a)=>{let l=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(l={...l,[a.interpolationkey]:void 0});const d=i+JSON.stringify(l);let f=e[d];return f||(f=t(Vl(i),a),e[d]=f),f(r)}};class s_{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Cr.create("formatter"),this.options=e,this.formats={number:Li((r,i)=>{const a=new Intl.NumberFormat(r,{...i});return l=>a.format(l)}),currency:Li((r,i)=>{const a=new Intl.NumberFormat(r,{...i,style:"currency"});return l=>a.format(l)}),datetime:Li((r,i)=>{const a=new Intl.DateTimeFormat(r,{...i});return l=>a.format(l)}),relativetime:Li((r,i)=>{const a=new Intl.RelativeTimeFormat(r,{...i});return l=>a.format(l,i.range||"day")}),list:Li((r,i)=>{const a=new Intl.ListFormat(r,{...i});return l=>a.format(l)})},this.init(e)}init(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=r.interpolation.formatSeparator||","}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=Li(r)}format(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const l=r.split(this.formatSeparator);if(l.length>1&&l[0].indexOf("(")>1&&l[0].indexOf(")")<0&&l.find(f=>f.indexOf(")")>-1)){const f=l.findIndex(m=>m.indexOf(")")>-1);l[0]=[l[0],...l.splice(1,f)].join(this.formatSeparator)}return l.reduce((f,m)=>{const{formatName:p,formatOptions:v}=r_(m);if(this.formats[p]){let w=f;try{const y=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},x=y.locale||y.lng||a.locale||a.lng||i;w=this.formats[p](f,x,{...v,...a,...y})}catch(y){this.logger.warn(y)}return w}else this.logger.warn(`there was no format function for ${p}`);return f},e)}}const i_=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class a_ extends uu{constructor(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=r,this.services=i,this.languageUtils=i.languageUtils,this.options=a,this.logger=Cr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(i,a.backend,a)}queueLoad(e,r,i,a){const l={},d={},f={},m={};return e.forEach(p=>{let v=!0;r.forEach(w=>{const y=`${p}|${w}`;!i.reload&&this.store.hasResourceBundle(p,w)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?d[y]===void 0&&(d[y]=!0):(this.state[y]=1,v=!1,d[y]===void 0&&(d[y]=!0),l[y]===void 0&&(l[y]=!0),m[w]===void 0&&(m[w]=!0)))}),v||(f[p]=!0)}),(Object.keys(l).length||Object.keys(d).length)&&this.queue.push({pending:d,pendingCount:Object.keys(d).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(l),pending:Object.keys(d),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(m)}}loaded(e,r,i){const a=e.split("|"),l=a[0],d=a[1];r&&this.emit("failedLoading",l,d,r),!r&&i&&this.store.addResourceBundle(l,d,i,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&i&&(this.state[e]=0);const f={};this.queue.forEach(m=>{Uj(m.loaded,[l],d),i_(m,e),r&&m.errors.push(r),m.pendingCount===0&&!m.done&&(Object.keys(m.loaded).forEach(p=>{f[p]||(f[p]={});const v=m.loaded[p];v.length&&v.forEach(w=>{f[p][w]===void 0&&(f[p][w]=!0)})}),m.done=!0,m.errors.length?m.callback(m.errors):m.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(m=>!m.done)}read(e,r,i){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,d=arguments.length>5?arguments[5]:void 0;if(!e.length)return d(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:i,tried:a,wait:l,callback:d});return}this.readingCalls++;const f=(p,v)=>{if(this.readingCalls--,this.waitingReads.length>0){const w=this.waitingReads.shift();this.read(w.lng,w.ns,w.fcName,w.tried,w.wait,w.callback)}if(p&&v&&a{this.read.call(this,e,r,i,a+1,l*2,d)},l);return}d(p,v)},m=this.backend[i].bind(this.backend);if(m.length===2){try{const p=m(e,r);p&&typeof p.then=="function"?p.then(v=>f(null,v)).catch(f):f(null,p)}catch(p){f(p)}return}return m(e,r,f)}prepareLoading(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();$e(e)&&(e=this.languageUtils.toResolveHierarchy(e)),$e(r)&&(r=[r]);const l=this.queueLoad(e,r,i,a);if(!l.toLoad.length)return l.pending.length||a(),null;l.toLoad.forEach(d=>{this.loadOne(d)})}load(e,r,i){this.prepareLoading(e,r,{},i)}reload(e,r,i){this.prepareLoading(e,r,{reload:!0},i)}loadOne(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),a=i[0],l=i[1];this.read(a,l,"read",void 0,void 0,(d,f)=>{d&&this.logger.warn(`${r}loading namespace ${l} for language ${a} failed`,d),!d&&f&&this.logger.log(`${r}loaded namespace ${l} for language ${a}`,f),this.loaded(e,d,f)})}saveMissing(e,r,i,a,l){let d=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},f=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${i}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if(this.backend&&this.backend.create){const m={...d,isUpdate:l},p=this.backend.create.bind(this.backend);if(p.length<6)try{let v;p.length===5?v=p(e,r,i,a,m):v=p(e,r,i,a),v&&typeof v.then=="function"?v.then(w=>f(null,w)).catch(f):f(null,v)}catch(v){f(v)}else p(e,r,i,a,f,m)}!e||!e[0]||this.store.addResource(e[0],r,i,a)}}}const bg=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),$e(t[1])&&(e.defaultValue=t[1]),$e(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{e[i]=r[i]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),jg=t=>($e(t.ns)&&(t.ns=[t.ns]),$e(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),$e(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),El=()=>{},o_=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class io extends uu{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(super(),this.options=jg(e),this.services={},this.logger=Cr,this.modules={external:[]},o_(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof r=="function"&&(i=r,r={}),!r.defaultNS&&r.defaultNS!==!1&&r.ns&&($e(r.ns)?r.defaultNS=r.ns:r.ns.indexOf("translation")<0&&(r.defaultNS=r.ns[0]));const a=bg();this.options={...a,...this.options,...jg(r)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...a.interpolation,...this.options.interpolation}),r.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=r.keySeparator),r.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=r.nsSeparator);const l=v=>v?typeof v=="function"?new v:v:null;if(!this.options.isClone){this.modules.logger?Cr.init(l(this.modules.logger),this.options):Cr.init(null,this.options);let v;this.modules.formatter?v=this.modules.formatter:typeof Intl<"u"&&(v=s_);const w=new vg(this.options);this.store=new gg(this.options.resources,this.options);const y=this.services;y.logger=Cr,y.resourceStore=this.store,y.languageUtils=w,y.pluralResolver=new t_(w,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),v&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(y.formatter=l(v),y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new n_(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new a_(l(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",function(x){for(var S=arguments.length,_=new Array(S>1?S-1:0),b=1;b1?S-1:0),b=1;b{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,i||(i=El),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const v=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);v.length>0&&v[0]!=="dev"&&(this.options.lng=v[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(v=>{this[v]=function(){return e.store[v](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(v=>{this[v]=function(){return e.store[v](...arguments),e}});const m=Da(),p=()=>{const v=(w,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),m.resolve(y),i(w,y)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return v(null,this.t.bind(this));this.changeLanguage(this.options.lng,v)};return this.options.resources||!this.options.initImmediate?p():setTimeout(p,0),m}loadResources(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:El;const a=$e(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(a&&a.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const l=[],d=f=>{if(!f||f==="cimode")return;this.services.languageUtils.toResolveHierarchy(f).forEach(p=>{p!=="cimode"&&l.indexOf(p)<0&&l.push(p)})};a?d(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(m=>d(m)),this.options.preload&&this.options.preload.forEach(f=>d(f)),this.services.backendConnector.load(l,this.options.ns,f=>{!f&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(f)})}else i(null)}reloadResources(e,r,i){const a=Da();return typeof e=="function"&&(i=e,e=void 0),typeof r=="function"&&(i=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),i||(i=El),this.services.backendConnector.reload(e,r,l=>{a.resolve(),i(l)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&xv.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let r=0;r-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}}changeLanguage(e,r){var i=this;this.isLanguageChangingTo=e;const a=Da();this.emit("languageChanging",e);const l=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},d=(m,p)=>{p?(l(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,a.resolve(function(){return i.t(...arguments)}),r&&r(m,function(){return i.t(...arguments)})},f=m=>{!e&&!m&&this.services.languageDetector&&(m=[]);const p=$e(m)?m:this.services.languageUtils.getBestMatchFromCodes(m);p&&(this.language||l(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(p)),this.loadResources(p,v=>{d(v,p)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(e),a}getFixedT(e,r,i){var a=this;const l=function(d,f){let m;if(typeof f!="object"){for(var p=arguments.length,v=new Array(p>2?p-2:0),w=2;w`${m.keyPrefix}${y}${S}`):x=m.keyPrefix?`${m.keyPrefix}${y}${d}`:d,a.t(x,m)};return $e(e)?l.lng=e:l.lngs=e,l.ns=r,l.keyPrefix=i,l}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=r.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,l=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const d=(f,m)=>{const p=this.services.backendConnector.state[`${f}|${m}`];return p===-1||p===0||p===2};if(r.precheck){const f=r.precheck(this,d);if(f!==void 0)return f}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||d(i,e)&&(!a||d(l,e)))}loadNamespaces(e,r){const i=Da();return this.options.ns?($e(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{i.resolve(),r&&r(a)}),i):(r&&r(),Promise.resolve())}loadLanguages(e,r){const i=Da();$e(e)&&(e=[e]);const a=this.options.preload||[],l=e.filter(d=>a.indexOf(d)<0&&this.services.languageUtils.isSupportedCode(d));return l.length?(this.options.preload=a.concat(l),this.loadResources(d=>{i.resolve(),r&&r(d)}),i):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=this.services&&this.services.languageUtils||new vg(bg());return r.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new io(e,r)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:El;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},l=new io(a);return(e.debug!==void 0||e.prefix!==void 0)&&(l.logger=l.logger.clone(e)),["store","services","language"].forEach(f=>{l[f]=this[f]}),l.services={...this.services},l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},i&&(l.store=new gg(this.store.data,a),l.services.resourceStore=l.store),l.translator=new ql(l.services,a),l.translator.on("*",function(f){for(var m=arguments.length,p=new Array(m>1?m-1:0),v=1;v()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function Sg(t,e,r){t.loadNamespaces(e,wv(t,r))}function kg(t,e,r,i){typeof r=="string"&&(r=[r]),r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,wv(t,i))}function u_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=e.languages[0],a=e.options?e.options.fallbackLng:!1,l=e.languages[e.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const d=(f,m)=>{const p=e.services.backendConnector.state[`${f}|${m}`];return p===-1||p===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!d(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(i,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||d(i,t)&&(!a||d(l,t)))}function c_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Ud("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(a,l)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!l(a.isLanguageChangingTo,t))return!1}}):u_(t,e,r)}const d_=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,f_={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},h_=t=>f_[t],p_=t=>t.replace(d_,h_);let Vd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:p_};function m_(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vd={...Vd,...t}}function g_(){return Vd}let bv;function y_(t){bv=t}function v_(){return bv}const x_={type:"3rdParty",init(t){m_(t.options.react),y_(t)}},w_=$.createContext();class b_{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const j_=(t,e)=>{const r=$.useRef();return $.useEffect(()=>{r.current=t},[t,e]),r.current};function oi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:i,defaultNS:a}=$.useContext(w_)||{},l=r||i||v_();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new b_),!l){Ud("You will need to pass in an i18next instance by using initReactI18next");const F=(k,I)=>typeof I=="string"?I:I&&typeof I=="object"&&typeof I.defaultValue=="string"?I.defaultValue:Array.isArray(k)?k[k.length-1]:k,L=[F,{},!1];return L.t=F,L.i18n={},L.ready=!1,L}l.options.react&&l.options.react.wait!==void 0&&Ud("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...g_(),...l.options.react,...e},{useSuspense:f,keyPrefix:m}=d;let p=a||l.options&&l.options.defaultNS;p=typeof p=="string"?[p]:p||["translation"],l.reportNamespaces.addUsedNamespaces&&l.reportNamespaces.addUsedNamespaces(p);const v=(l.isInitialized||l.initializedStoreOnce)&&p.every(F=>c_(F,l,d));function w(){return l.getFixedT(e.lng||null,d.nsMode==="fallback"?p:p[0],m)}const[y,x]=$.useState(w);let S=p.join();e.lng&&(S=`${e.lng}${S}`);const _=j_(S),b=$.useRef(!0);$.useEffect(()=>{const{bindI18n:F,bindI18nStore:L}=d;b.current=!0,!v&&!f&&(e.lng?kg(l,e.lng,p,()=>{b.current&&x(w)}):Sg(l,p,()=>{b.current&&x(w)})),v&&_&&_!==S&&b.current&&x(w);function k(){b.current&&x(w)}return F&&l&&l.on(F,k),L&&l&&l.store.on(L,k),()=>{b.current=!1,F&&l&&F.split(" ").forEach(I=>l.off(I,k)),L&&l&&L.split(" ").forEach(I=>l.store.off(I,k))}},[l,S]);const P=$.useRef(!0);$.useEffect(()=>{b.current&&!P.current&&x(w),P.current=!1},[l,m]);const N=[y,l,v];if(N.t=y,N.i18n=l,N.ready=v,v||!v&&!f)return N;throw new Promise(F=>{e.lng?kg(l,e.lng,p,()=>F()):Sg(l,p,()=>F())})}function __(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ao(t){"@babel/helpers - typeof";return ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ao(t)}function S_(t,e){if(ao(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e);if(ao(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function jv(t){var e=S_(t,"string");return ao(e)=="symbol"?e:e+""}function k_(t,e){for(var r=0;r0){var f=a.maxAge-0;if(Number.isNaN(f))throw new Error("maxAge should be a Number");d+="; Max-Age=".concat(Math.floor(f))}if(a.domain){if(!Ng.test(a.domain))throw new TypeError("option domain is invalid");d+="; Domain=".concat(a.domain)}if(a.path){if(!Ng.test(a.path))throw new TypeError("option path is invalid");d+="; Path=".concat(a.path)}if(a.expires){if(typeof a.expires.toUTCString!="function")throw new TypeError("option expires is invalid");d+="; Expires=".concat(a.expires.toUTCString())}if(a.httpOnly&&(d+="; HttpOnly"),a.secure&&(d+="; Secure"),a.sameSite){var m=typeof a.sameSite=="string"?a.sameSite.toLowerCase():a.sameSite;switch(m){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return d},Cg={create:function(e,r,i,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};i&&(l.expires=new Date,l.expires.setTime(l.expires.getTime()+i*60*1e3)),a&&(l.domain=a),document.cookie=O_(e,encodeURIComponent(r),l)},read:function(e){for(var r="".concat(e,"="),i=document.cookie.split(";"),a=0;a-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));for(var a=i.substring(1),l=a.split("&"),d=0;d0){var m=l[d].substring(0,f);m===e.lookupQuerystring&&(r=l[d].substring(f+1))}}}return r}},$a=null,Eg=function(){if($a!==null)return $a;try{$a=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{$a=!1}return $a},L_={name:"localStorage",lookup:function(e){var r;if(e.lookupLocalStorage&&Eg()){var i=window.localStorage.getItem(e.lookupLocalStorage);i&&(r=i)}return r},cacheUserLanguage:function(e,r){r.lookupLocalStorage&&Eg()&&window.localStorage.setItem(r.lookupLocalStorage,e)}},za=null,Pg=function(){if(za!==null)return za;try{za=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{za=!1}return za},A_={name:"sessionStorage",lookup:function(e){var r;if(e.lookupSessionStorage&&Pg()){var i=window.sessionStorage.getItem(e.lookupSessionStorage);i&&(r=i)}return r},cacheUserLanguage:function(e,r){r.lookupSessionStorage&&Pg()&&window.sessionStorage.setItem(r.lookupSessionStorage,e)}},I_={name:"navigator",lookup:function(e){var r=[];if(typeof navigator<"u"){if(navigator.languages)for(var i=0;i0?r:void 0}},M_={name:"htmlTag",lookup:function(e){var r,i=e.htmlTag||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(r=i.getAttribute("lang")),r}},F_={name:"path",lookup:function(e){var r;if(typeof window<"u"){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof i[e.lookupFromPathIndex]!="string")return;r=i[e.lookupFromPathIndex].replace("/","")}else r=i[0].replace("/","")}return r}},D_={name:"subdomain",lookup:function(e){var r=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,i=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(i)return i[r]}},Sv=!1;try{document.cookie,Sv=!0}catch{}var kv=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Sv||kv.splice(1,1);function $_(){return{order:kv,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var Nv=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};__(this,t),this.type="languageDetector",this.detectors={},this.init(e,r)}return N_(t,[{key:"init",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=r||{languageUtils:{}},this.options=P_(i,this.options||{},$_()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(l){return l.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=a,this.addDetector(R_),this.addDetector(T_),this.addDetector(L_),this.addDetector(A_),this.addDetector(I_),this.addDetector(M_),this.addDetector(F_),this.addDetector(D_)}},{key:"addDetector",value:function(r){return this.detectors[r.name]=r,this}},{key:"detect",value:function(r){var i=this;r||(r=this.options.order);var a=[];return r.forEach(function(l){if(i.detectors[l]){var d=i.detectors[l].lookup(i.options);d&&typeof d=="string"&&(d=[d]),d&&(a=a.concat(d))}}),a=a.map(function(l){return i.options.convertDetectedLanguage(l)}),this.services.languageUtils.getBestMatchFromCodes?a:a.length>0?a[0]:null}},{key:"cacheUserLanguage",value:function(r,i){var a=this;i||(i=this.options.caches),i&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(r)>-1||i.forEach(function(l){a.detectors[l]&&a.detectors[l].cacheUserLanguage(r,a.options)}))}}])})();Nv.type="languageDetector";function Bd(t){"@babel/helpers - typeof";return Bd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bd(t)}function Cv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Bd(XMLHttpRequest))==="object"}function z_(t){return!!t&&typeof t.then=="function"}function U_(t){return z_(t)?t:Promise.resolve(t)}function V_(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pl={exports:{}},Ol={exports:{}},Og;function B_(){return Og||(Og=1,(function(t,e){var r=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Za<"u"&&Za,i=(function(){function l(){this.fetch=!1,this.DOMException=r.DOMException}return l.prototype=r,new l})();(function(l){(function(d){var f=typeof l<"u"&&l||typeof self<"u"&&self||typeof f<"u"&&f,m={searchParams:"URLSearchParams"in f,iterable:"Symbol"in f&&"iterator"in Symbol,blob:"FileReader"in f&&"Blob"in f&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in f,arrayBuffer:"ArrayBuffer"in f};function p(M){return M&&DataView.prototype.isPrototypeOf(M)}if(m.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(M){return M&&v.indexOf(Object.prototype.toString.call(M))>-1};function y(M){if(typeof M!="string"&&(M=String(M)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(M)||M==="")throw new TypeError('Invalid character in header field name: "'+M+'"');return M.toLowerCase()}function x(M){return typeof M!="string"&&(M=String(M)),M}function S(M){var R={next:function(){var G=M.shift();return{done:G===void 0,value:G}}};return m.iterable&&(R[Symbol.iterator]=function(){return R}),R}function _(M){this.map={},M instanceof _?M.forEach(function(R,G){this.append(G,R)},this):Array.isArray(M)?M.forEach(function(R){this.append(R[0],R[1])},this):M&&Object.getOwnPropertyNames(M).forEach(function(R){this.append(R,M[R])},this)}_.prototype.append=function(M,R){M=y(M),R=x(R);var G=this.map[M];this.map[M]=G?G+", "+R:R},_.prototype.delete=function(M){delete this.map[y(M)]},_.prototype.get=function(M){return M=y(M),this.has(M)?this.map[M]:null},_.prototype.has=function(M){return this.map.hasOwnProperty(y(M))},_.prototype.set=function(M,R){this.map[y(M)]=x(R)},_.prototype.forEach=function(M,R){for(var G in this.map)this.map.hasOwnProperty(G)&&M.call(R,this.map[G],G,this)},_.prototype.keys=function(){var M=[];return this.forEach(function(R,G){M.push(G)}),S(M)},_.prototype.values=function(){var M=[];return this.forEach(function(R){M.push(R)}),S(M)},_.prototype.entries=function(){var M=[];return this.forEach(function(R,G){M.push([G,R])}),S(M)},m.iterable&&(_.prototype[Symbol.iterator]=_.prototype.entries);function b(M){if(M.bodyUsed)return Promise.reject(new TypeError("Already read"));M.bodyUsed=!0}function P(M){return new Promise(function(R,G){M.onload=function(){R(M.result)},M.onerror=function(){G(M.error)}})}function N(M){var R=new FileReader,G=P(R);return R.readAsArrayBuffer(M),G}function F(M){var R=new FileReader,G=P(R);return R.readAsText(M),G}function L(M){for(var R=new Uint8Array(M),G=new Array(R.length),H=0;H-1?R:M}function de(M,R){if(!(this instanceof de))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var G=R.body;if(M instanceof de){if(M.bodyUsed)throw new TypeError("Already read");this.url=M.url,this.credentials=M.credentials,R.headers||(this.headers=new _(M.headers)),this.method=M.method,this.mode=M.mode,this.signal=M.signal,!G&&M._bodyInit!=null&&(G=M._bodyInit,M.bodyUsed=!0)}else this.url=String(M);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new _(R.headers)),this.method=re(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&G)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(G),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var H=/([?&])_=[^&]*/;if(H.test(this.url))this.url=this.url.replace(H,"$1_="+new Date().getTime());else{var W=/\?/;this.url+=(W.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}de.prototype.clone=function(){return new de(this,{body:this._bodyInit})};function Z(M){var R=new FormData;return M.trim().split("&").forEach(function(G){if(G){var H=G.split("="),W=H.shift().replace(/\+/g," "),K=H.join("=").replace(/\+/g," ");R.append(decodeURIComponent(W),decodeURIComponent(K))}}),R}function Oe(M){var R=new _,G=M.replace(/\r?\n[\t ]+/g," ");return G.split("\r").map(function(H){return H.indexOf(` -`)===0?H.substr(1,H.length):H}).forEach(function(H){var W=H.split(":"),K=W.shift().trim();if(K){var T=W.join(":").trim();R.append(K,T)}}),R}I.call(de.prototype);function J(M,R){if(!(this instanceof J))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new _(R.headers),this.url=R.url||"",this._initBody(M)}I.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _(this.headers),url:this.url})},J.error=function(){var M=new J(null,{status:0,statusText:""});return M.type="error",M};var ve=[301,302,303,307,308];J.redirect=function(M,R){if(ve.indexOf(R)===-1)throw new RangeError("Invalid status code");return new J(null,{status:R,headers:{location:M}})},d.DOMException=f.DOMException;try{new d.DOMException}catch{d.DOMException=function(R,G){this.message=R,this.name=G;var H=Error(R);this.stack=H.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function me(M,R){return new Promise(function(G,H){var W=new de(M,R);if(W.signal&&W.signal.aborted)return H(new d.DOMException("Aborted","AbortError"));var K=new XMLHttpRequest;function T(){K.abort()}K.onload=function(){var ue={status:K.status,statusText:K.statusText,headers:Oe(K.getAllResponseHeaders()||"")};ue.url="responseURL"in K?K.responseURL:ue.headers.get("X-Request-URL");var pe="response"in K?K.response:K.responseText;setTimeout(function(){G(new J(pe,ue))},0)},K.onerror=function(){setTimeout(function(){H(new TypeError("Network request failed"))},0)},K.ontimeout=function(){setTimeout(function(){H(new TypeError("Network request failed"))},0)},K.onabort=function(){setTimeout(function(){H(new d.DOMException("Aborted","AbortError"))},0)};function Q(ue){try{return ue===""&&f.location.href?f.location.href:ue}catch{return ue}}K.open(W.method,Q(W.url),!0),W.credentials==="include"?K.withCredentials=!0:W.credentials==="omit"&&(K.withCredentials=!1),"responseType"in K&&(m.blob?K.responseType="blob":m.arrayBuffer&&W.headers.get("Content-Type")&&W.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(K.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof _)?Object.getOwnPropertyNames(R.headers).forEach(function(ue){K.setRequestHeader(ue,x(R.headers[ue]))}):W.headers.forEach(function(ue,pe){K.setRequestHeader(pe,ue)}),W.signal&&(W.signal.addEventListener("abort",T),K.onreadystatechange=function(){K.readyState===4&&W.signal.removeEventListener("abort",T)}),K.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return me.polyfill=!0,f.fetch||(f.fetch=me,f.Headers=_,f.Request=de,f.Response=J),d.Headers=_,d.Request=de,d.Response=J,d.fetch=me,d})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var a=r.fetch?r:i;e=a.fetch,e.default=a.fetch,e.fetch=a.fetch,e.Headers=a.Headers,e.Request=a.Request,e.Response=a.Response,t.exports=e})(Ol,Ol.exports)),Ol.exports}var Rg;function q_(){return Rg||(Rg=1,(function(t,e){var r=typeof fetch=="function"?fetch:void 0;if(typeof Za<"u"&&Za.fetch?r=Za.fetch:typeof window<"u"&&window.fetch&&(r=window.fetch),typeof V_<"u"&&typeof window>"u"){var i=r||B_();i.default&&(i=i.default),e.default=i,t.exports=e.default}})(Pl,Pl.exports)),Pl.exports}var Ev=q_();const Pv=iu(Ev),Tg=Vy({__proto__:null,default:Pv},[Ev]);function Lg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,i)}return r}function Ag(t){for(var e=1;e"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(l["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),i&&(l["Content-Type"]="application/json");var d=typeof e.requestOptions=="function"?e.requestOptions(i):e.requestOptions,f=Ag({method:i?"POST":"GET",body:i?e.stringify(i):void 0,headers:l},Mg?{}:d),m=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Ig(r,f,a,m)}catch(p){if(!d||Object.keys(d).length===0||!p.message||p.message.indexOf("not implemented")<0)return a(p);try{Object.keys(d).forEach(function(v){delete f[v]}),Ig(r,f,a,m),Mg=!0}catch(v){a(v)}}},Z_=function(e,r,i,a){i&&ni(i)==="object"&&(i=qd("",i).slice(1)),e.queryStringParams&&(r=qd(r,e.queryStringParams));try{var l;oo?l=new oo:l=new Hl("MSXML2.XMLHTTP.3.0"),l.open(i?"POST":"GET",r,1),e.crossDomain||l.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.withCredentials=!!e.withCredentials,i&&l.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l.overrideMimeType&&l.overrideMimeType("application/json");var d=e.customHeaders;if(d=typeof d=="function"?d():d,d)for(var f in d)l.setRequestHeader(f,d[f]);l.onreadystatechange=function(){l.readyState>3&&a(l.status>=400?l.statusText:null,{status:l.status,data:l.responseText})},l.send(i)}catch(m){console&&console.log(m)}},G_=function(e,r,i,a){if(typeof i=="function"&&(a=i,i=void 0),a=a||function(){},Ts&&r.indexOf("file:")!==0)return Q_(e,r,i,a);if(Cv()||typeof ActiveXObject=="function")return Z_(e,r,i,a);a(new Error("No fetch and no xhr implementation found!"))};function Vi(t){"@babel/helpers - typeof";return Vi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vi(t)}function Fg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,i)}return r}function cd(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};J_(this,t),this.services=e,this.options=r,this.allOptions=i,this.type="backend",this.init(e,r,i)}return X_(t,[{key:"init",value:function(r){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=r,this.options=cd(cd(cd({},tS()),this.options||{}),a),this.allOptions=l,this.services&&this.options.reloadInterval){var d=setInterval(function(){return i.reload()},this.options.reloadInterval);Vi(d)==="object"&&typeof d.unref=="function"&&d.unref()}}},{key:"readMulti",value:function(r,i,a){this._readAny(r,r,i,i,a)}},{key:"read",value:function(r,i,a){this._readAny([r],r,[i],i,a)}},{key:"_readAny",value:function(r,i,a,l,d){var f=this,m=this.options.loadPath;typeof this.options.loadPath=="function"&&(m=this.options.loadPath(r,a)),m=U_(m),m.then(function(p){if(!p)return d(null,{});var v=f.services.interpolator.interpolate(p,{lng:r.join("+"),ns:a.join("+")});f.loadUrl(v,d,i,l)})}},{key:"loadUrl",value:function(r,i,a,l){var d=this,f=typeof a=="string"?[a]:a,m=typeof l=="string"?[l]:l,p=this.options.parseLoadPayload(f,m);this.options.request(this.options,r,p,function(v,w){if(w&&(w.status>=500&&w.status<600||!w.status))return i("failed loading "+r+"; status code: "+w.status,!0);if(w&&w.status>=400&&w.status<500)return i("failed loading "+r+"; status code: "+w.status,!1);if(!w&&v&&v.message){var y=v.message.toLowerCase(),x=["failed","fetch","network","load"].find(function(b){return y.indexOf(b)>-1});if(x)return i("failed loading "+r+": "+v.message,!0)}if(v)return i(v,!1);var S,_;try{typeof w.data=="string"?S=d.options.parse(w.data,a,l):S=w.data}catch{_="failed parsing "+r+" to json"}if(_)return i(_,!1);i(null,S)})}},{key:"create",value:function(r,i,a,l,d){var f=this;if(this.options.addPath){typeof r=="string"&&(r=[r]);var m=this.options.parsePayload(i,a,l),p=0,v=[],w=[];r.forEach(function(y){var x=f.options.addPath;typeof f.options.addPath=="function"&&(x=f.options.addPath(y,i));var S=f.services.interpolator.interpolate(x,{lng:y,ns:i});f.options.request(f.options,S,m,function(_,b){p+=1,v.push(_),w.push(b),p===r.length&&typeof d=="function"&&d(v,w)})})}}},{key:"reload",value:function(){var r=this,i=this.services,a=i.backendConnector,l=i.languageUtils,d=i.logger,f=a.language;if(!(f&&f.toLowerCase()==="cimode")){var m=[],p=function(w){var y=l.toResolveHierarchy(w);y.forEach(function(x){m.indexOf(x)<0&&m.push(x)})};p(f),this.allOptions.preload&&this.allOptions.preload.forEach(function(v){return p(v)}),m.forEach(function(v){r.allOptions.ns.forEach(function(w){a.read(v,w,"read",null,null,function(y,x){y&&d.warn("loading namespace ".concat(w," for language ").concat(v," failed"),y),!y&&x&&d.log("loaded namespace ".concat(w," for language ").concat(v),x),a.loaded("".concat(v,"|").concat(w),y,x)})})})}}}])})();Tv.type="backend";rn.use(Tv).use(Nv).use(x_).init({fallbackLng:"en",ns:["common","pages"],defaultNS:"common",backend:{loadPath:"/static/locales/{{lng}}/{{ns}}.json"},interpolation:{escapeValue:!1},react:{useSuspense:!1}});var nS={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const rS=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pe=(t,e)=>{const r=$.forwardRef(({color:i="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:d,children:f,...m},p)=>$.createElement("svg",{ref:p,...nS,width:a,height:a,stroke:i,strokeWidth:d?Number(l)*24/Number(a):l,className:`lucide lucide-${rS(t)}`,...m},[...e.map(([v,w])=>$.createElement(v,w)),...(Array.isArray(f)?f:[f])||[]]));return r.displayName=`${t}`,r},sS=Pe("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),fn=Pe("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),iS=Pe("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Zn=Pe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Lv=Pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),aS=Pe("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]),oS=Pe("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]),lS=Pe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]),Av=Pe("Brain",[["path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z",key:"1mhkh5"}],["path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z",key:"1d6s00"}]]),_f=Pe("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Dg=Pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),uS=Pe("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),Hd=Pe("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]),Iv=Pe("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),cS=Pe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Sf=Pe("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),dS=Pe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),Mv=Pe("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),fS=Pe("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Wd=Pe("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),hS=Pe("FileSearch",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v3",key:"am10z3"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"ychnub"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}]]),pS=Pe("FileSpreadsheet",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M14 17h2",key:"10kma7"}]]),Fv=Pe("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]),mS=Pe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),gS=Pe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),kf=Pe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),yS=Pe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),vS=Pe("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]),xS=Pe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),Dv=Pe("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]),wS=Pe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),bS=Pe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jS=Pe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),Nf=Pe("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]),dr=Pe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),_S=Pe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Cf=Pe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),$v=Pe("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]),ri=Pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),zv=Pe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),$g=Pe("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),Uv=Pe("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),Vv=Pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),SS=Pe("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),kS=Pe("ShieldAlert",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),Bv=Pe("ShieldCheck",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),NS=Pe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),CS=Pe("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]),ES=Pe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Kd=Pe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),PS=Pe("UploadCloud",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]),OS=Pe("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),zg=Pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ur(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i3?e.i-4:e.i:Array.isArray(t)?1:Ef(t)?2:Pf(t)?3:0}function Di(t,e){return ta(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function RS(t,e){return ta(t)===2?t.get(e):t[e]}function qv(t,e,r){var i=ta(t);i===2?t.set(e,r):i===3?t.add(r):t[e]=r}function Hv(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function Ef(t){return FS&&t instanceof Map}function Pf(t){return DS&&t instanceof Set}function Js(t){return t.o||t.t}function Of(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Kv(t);delete e[yt];for(var r=$i(e),i=0;i1&&(t.set=t.add=t.clear=t.delete=TS),Object.freeze(t),e&&si(t,(function(r,i){return Rf(i,!0)}),!0)),t}function TS(){ur(2)}function Tf(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Er(t){var e=Jd[t];return e||ur(18,t),e}function LS(t,e){Jd[t]||(Jd[t]=e)}function Qd(){return lo}function dd(t,e){e&&(Er("Patches"),t.u=[],t.s=[],t.v=e)}function Wl(t){Zd(t),t.p.forEach(AS),t.p=null}function Zd(t){t===lo&&(lo=t.l)}function Ug(t){return lo={p:[],l:lo,h:t,m:!0,_:0}}function AS(t){var e=t[yt];e.i===0||e.i===1?e.j():e.g=!0}function fd(t,e){e._=e.p.length;var r=e.p[0],i=t!==void 0&&t!==r;return e.h.O||Er("ES5").S(e,t,i),i?(r[yt].P&&(Wl(e),ur(4)),Zr(t)&&(t=Kl(e,t),e.l||Ql(e,t)),e.u&&Er("Patches").M(r[yt].t,t,e.u,e.s)):t=Kl(e,r,[]),Wl(e),e.u&&e.v(e.u,e.s),t!==Wv?t:void 0}function Kl(t,e,r){if(Tf(e))return e;var i=e[yt];if(!i)return si(e,(function(f,m){return Vg(t,i,e,f,m,r)}),!0),e;if(i.A!==t)return e;if(!i.P)return Ql(t,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var a=i.i===4||i.i===5?i.o=Of(i.k):i.o,l=a,d=!1;i.i===3&&(l=new Set(a),a.clear(),d=!0),si(l,(function(f,m){return Vg(t,i,a,f,m,r,d)})),Ql(t,a,!1),r&&t.u&&Er("Patches").N(i,r,t.u,t.s)}return i.o}function Vg(t,e,r,i,a,l,d){if(Ls(a)){var f=Kl(t,a,l&&e&&e.i!==3&&!Di(e.R,i)?l.concat(i):void 0);if(qv(r,i,f),!Ls(f))return;t.m=!1}else d&&r.add(a);if(Zr(a)&&!Tf(a)){if(!t.h.D&&t._<1)return;Kl(t,a),e&&e.A.l||Ql(t,a)}}function Ql(t,e,r){r===void 0&&(r=!1),!t.l&&t.h.D&&t.m&&Rf(e,r)}function hd(t,e){var r=t[yt];return(r?Js(r):t)[e]}function Bg(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var i=Object.getOwnPropertyDescriptor(r,e);if(i)return i;r=Object.getPrototypeOf(r)}}function Ss(t){t.P||(t.P=!0,t.l&&Ss(t.l))}function pd(t){t.o||(t.o=Of(t.t))}function Gd(t,e,r){var i=Ef(e)?Er("MapSet").F(e,r):Pf(e)?Er("MapSet").T(e,r):t.O?(function(a,l){var d=Array.isArray(a),f={i:d?1:0,A:l?l.A:Qd(),P:!1,I:!1,R:{},l,t:a,k:null,o:null,j:null,C:!1},m=f,p=uo;d&&(m=[f],p=Wa);var v=Proxy.revocable(m,p),w=v.revoke,y=v.proxy;return f.k=y,f.j=w,y})(e,r):Er("ES5").J(e,r);return(r?r.A:Qd()).p.push(i),i}function IS(t){return Ls(t)||ur(22,t),(function e(r){if(!Zr(r))return r;var i,a=r[yt],l=ta(r);if(a){if(!a.P&&(a.i<4||!Er("ES5").K(a)))return a.t;a.I=!0,i=qg(r,l),a.I=!1}else i=qg(r,l);return si(i,(function(d,f){a&&RS(a.t,d)===f||qv(i,d,e(f))})),l===3?new Set(i):i})(t)}function qg(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Of(t)}function MS(){function t(l,d){var f=a[l];return f?f.enumerable=d:a[l]=f={configurable:!0,enumerable:d,get:function(){var m=this[yt];return uo.get(m,l)},set:function(m){var p=this[yt];uo.set(p,l,m)}},f}function e(l){for(var d=l.length-1;d>=0;d--){var f=l[d][yt];if(!f.P)switch(f.i){case 5:i(f)&&Ss(f);break;case 4:r(f)&&Ss(f)}}}function r(l){for(var d=l.t,f=l.k,m=$i(f),p=m.length-1;p>=0;p--){var v=m[p];if(v!==yt){var w=d[v];if(w===void 0&&!Di(d,v))return!0;var y=f[v],x=y&&y[yt];if(x?x.t!==w:!Hv(y,w))return!0}}var S=!!d[yt];return m.length!==$i(d).length+(S?0:1)}function i(l){var d=l.k;if(d.length!==l.t.length)return!0;var f=Object.getOwnPropertyDescriptor(d,d.length-1);if(f&&!f.get)return!0;for(var m=0;m1?P-1:0),F=1;F1?v-1:0),y=1;y=0;a--){var l=i[a];if(l.path.length===0&&l.op==="replace"){r=l.value;break}}a>-1&&(i=i.slice(a+1));var d=Er("Patches").$;return Ls(r)?d(r,i):this.produce(r,(function(f){return d(f,i)}))},t})(),Dn=new zS,Qv=Dn.produce;Dn.produceWithPatches.bind(Dn);Dn.setAutoFreeze.bind(Dn);Dn.setUseProxies.bind(Dn);Dn.applyPatches.bind(Dn);Dn.createDraft.bind(Dn);Dn.finishDraft.bind(Dn);function US(t,e,r){return(e=jv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,i)}return r}function Zg(t){for(var e=1;e"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Yt(1));return r(Zv)(t,e)}if(typeof t!="function")throw new Error(Yt(2));var a=t,l=e,d=[],f=d,m=!1;function p(){f===d&&(f=d.slice())}function v(){if(m)throw new Error(Yt(3));return l}function w(_){if(typeof _!="function")throw new Error(Yt(4));if(m)throw new Error(Yt(5));var b=!0;return p(),f.push(_),function(){if(b){if(m)throw new Error(Yt(6));b=!1,p();var N=f.indexOf(_);f.splice(N,1),d=null}}}function y(_){if(!VS(_))throw new Error(Yt(7));if(typeof _.type>"u")throw new Error(Yt(8));if(m)throw new Error(Yt(9));try{m=!0,l=a(l,_)}finally{m=!1}for(var b=d=f,P=0;P"u")throw new Error(Yt(12));if(typeof r(void 0,{type:Zl.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Yt(13))})}function qS(t){for(var e=Object.keys(t),r={},i=0;i"u")throw p&&p.type,new Error(Yt(14));w[x]=b,v=v||b!==_}return v=v||l.length!==Object.keys(m).length,v?w:m}}function Gl(){for(var t=arguments.length,e=new Array(t),r=0;r0&&l[l.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]{t.sidebarOpen=!t.sidebarOpen},setCurrentStep:(t,e)=>{t.currentStep=e.payload},setSelectedProject:(t,e)=>{t.selectedProjectId=e.payload},setLoading:(t,e)=>{t.isLoading=e.payload},showNotification:(t,e)=>{t.notification=e.payload},clearNotification:t=>{t.notification={type:null,message:""}}}}),{toggleSidebar:yk}=Xv.actions,vk=Xv.reducer;function ex(t){var e,r,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e{const e=bk(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:d=>{const f=d.split(Mf);return f[0]===""&&f.length!==1&&f.shift(),nx(f,e)||wk(d)},getConflictingClassGroupIds:(d,f)=>{const m=r[d]||[];return f&&i[d]?[...m,...i[d]]:m}}},nx=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],i=e.nextPart.get(r),a=i?nx(t.slice(1),i):void 0;if(a)return a;if(e.validators.length===0)return;const l=t.join(Mf);return e.validators.find(({validator:d})=>d(l))?.classGroupId},ty=/^\[(.+)\]$/,wk=t=>{if(ty.test(t)){const e=ty.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},bk=t=>{const{theme:e,prefix:r}=t,i={nextPart:new Map,validators:[]};return _k(Object.entries(t.classGroups),r).forEach(([l,d])=>{ef(d,i,l,e)}),i},ef=(t,e,r,i)=>{t.forEach(a=>{if(typeof a=="string"){const l=a===""?e:ny(e,a);l.classGroupId=r;return}if(typeof a=="function"){if(jk(a)){ef(a(i),e,r,i);return}e.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([l,d])=>{ef(d,ny(e,l),r,i)})})},ny=(t,e)=>{let r=t;return e.split(Mf).forEach(i=>{r.nextPart.has(i)||r.nextPart.set(i,{nextPart:new Map,validators:[]}),r=r.nextPart.get(i)}),r},jk=t=>t.isThemeGetter,_k=(t,e)=>e?t.map(([r,i])=>{const a=i.map(l=>typeof l=="string"?e+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([d,f])=>[e+d,f])):l);return[r,a]}):t,Sk=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,i=new Map;const a=(l,d)=>{r.set(l,d),e++,e>t&&(e=0,i=r,r=new Map)};return{get(l){let d=r.get(l);if(d!==void 0)return d;if((d=i.get(l))!==void 0)return a(l,d),d},set(l,d){r.has(l)?r.set(l,d):a(l,d)}}},rx="!",kk=t=>{const{separator:e,experimentalParseClassName:r}=t,i=e.length===1,a=e[0],l=e.length,d=f=>{const m=[];let p=0,v=0,w;for(let b=0;bv?w-v:void 0;return{modifiers:m,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:_}};return r?f=>r({className:f,parseClassName:d}):d},Nk=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(i=>{i[0]==="["?(e.push(...r.sort(),i),r=[]):r.push(i)}),e.push(...r.sort()),e},Ck=t=>({cache:Sk(t.cacheSize),parseClassName:kk(t),...xk(t)}),Ek=/\s+/,Pk=(t,e)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:a}=e,l=[],d=t.trim().split(Ek);let f="";for(let m=d.length-1;m>=0;m-=1){const p=d[m],{modifiers:v,hasImportantModifier:w,baseClassName:y,maybePostfixModifierPosition:x}=r(p);let S=!!x,_=i(S?y.substring(0,x):y);if(!_){if(!S){f=p+(f.length>0?" "+f:f);continue}if(_=i(y),!_){f=p+(f.length>0?" "+f:f);continue}S=!1}const b=Nk(v).join(":"),P=w?b+rx:b,N=P+_;if(l.includes(N))continue;l.push(N);const F=a(_,S);for(let L=0;L0?" "+f:f)}return f};function Ok(){let t=0,e,r,i="";for(;t{if(typeof t=="string")return t;let e,r="";for(let i=0;iw(v),t());return r=Ck(p),i=r.cache.get,a=r.cache.set,l=f,f(m)}function f(m){const p=i(m);if(p)return p;const v=Pk(m,r);return a(m,v),v}return function(){return l(Ok.apply(null,arguments))}}const mt=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},ix=/^\[(?:([a-z-]+):)?(.+)\]$/i,Tk=/^\d+\/\d+$/,Lk=new Set(["px","full","screen"]),Ak=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ik=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Dk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wr=t=>zi(t)||Lk.has(t)||Tk.test(t),ws=t=>na(t,"length",Wk),zi=t=>!!t&&!Number.isNaN(Number(t)),vd=t=>na(t,"number",zi),Ua=t=>!!t&&Number.isInteger(Number(t)),$k=t=>t.endsWith("%")&&zi(t.slice(0,-1)),He=t=>ix.test(t),bs=t=>Ak.test(t),zk=new Set(["length","size","percentage"]),Uk=t=>na(t,zk,ax),Vk=t=>na(t,"position",ax),Bk=new Set(["image","url"]),qk=t=>na(t,Bk,Qk),Hk=t=>na(t,"",Kk),Va=()=>!0,na=(t,e,r)=>{const i=ix.exec(t);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):r(i[2]):!1},Wk=t=>Ik.test(t)&&!Mk.test(t),ax=()=>!1,Kk=t=>Fk.test(t),Qk=t=>Dk.test(t),Zk=()=>{const t=mt("colors"),e=mt("spacing"),r=mt("blur"),i=mt("brightness"),a=mt("borderColor"),l=mt("borderRadius"),d=mt("borderSpacing"),f=mt("borderWidth"),m=mt("contrast"),p=mt("grayscale"),v=mt("hueRotate"),w=mt("invert"),y=mt("gap"),x=mt("gradientColorStops"),S=mt("gradientColorStopPositions"),_=mt("inset"),b=mt("margin"),P=mt("opacity"),N=mt("padding"),F=mt("saturate"),L=mt("scale"),k=mt("sepia"),I=mt("skew"),X=mt("space"),re=mt("translate"),de=()=>["auto","contain","none"],Z=()=>["auto","hidden","clip","visible","scroll"],Oe=()=>["auto",He,e],J=()=>[He,e],ve=()=>["",Wr,ws],me=()=>["auto",zi,He],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],R=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",He],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>[zi,He];return{cacheSize:500,separator:":",theme:{colors:[Va],spacing:[Wr,ws],blur:["none","",bs,He],brightness:T(),borderColor:[t],borderRadius:["none","","full",bs,He],borderSpacing:J(),borderWidth:ve(),contrast:T(),grayscale:W(),hueRotate:T(),invert:W(),gap:J(),gradientColorStops:[t],gradientColorStopPositions:[$k,ws],inset:Oe(),margin:Oe(),opacity:T(),padding:J(),saturate:T(),scale:T(),sepia:W(),skew:T(),space:J(),translate:J()},classGroups:{aspect:[{aspect:["auto","square","video",He]}],container:["container"],columns:[{columns:[bs]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),He]}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:de()}],"overscroll-x":[{"overscroll-x":de()}],"overscroll-y":[{"overscroll-y":de()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ua,He]}],basis:[{basis:Oe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",He]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Ua,He]}],"grid-cols":[{"grid-cols":[Va]}],"col-start-end":[{col:["auto",{span:["full",Ua,He]},He]}],"col-start":[{"col-start":me()}],"col-end":[{"col-end":me()}],"grid-rows":[{"grid-rows":[Va]}],"row-start-end":[{row:["auto",{span:[Ua,He]},He]}],"row-start":[{"row-start":me()}],"row-end":[{"row-end":me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",He]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",He]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[X]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[X]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",He,e]}],"min-w":[{"min-w":[He,e,"min","max","fit"]}],"max-w":[{"max-w":[He,e,"none","full","min","max","fit","prose",{screen:[bs]},bs]}],h:[{h:[He,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[He,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[He,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[He,e,"auto","min","max","fit"]}],"font-size":[{text:["base",bs,ws]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",vd]}],"font-family":[{font:[Va]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",He]}],"line-clamp":[{"line-clamp":["none",zi,vd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wr,He]}],"list-image":[{"list-image":["none",He]}],"list-style-type":[{list:["none","disc","decimal",He]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[P]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...R(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wr,ws]}],"underline-offset":[{"underline-offset":["auto",Wr,He]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:J()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[P]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),Vk]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Uk]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},qk]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[P]}],"border-style":[{border:[...R(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[P]}],"divide-style":[{divide:R()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...R()]}],"outline-offset":[{"outline-offset":[Wr,He]}],"outline-w":[{outline:[Wr,ws]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[P]}],"ring-offset-w":[{"ring-offset":[Wr,ws]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",bs,Hk]}],"shadow-color":[{shadow:[Va]}],opacity:[{opacity:[P]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[i]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",bs,He]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[v]}],invert:[{invert:[w]}],saturate:[{saturate:[F]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[P]}],"backdrop-saturate":[{"backdrop-saturate":[F]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",He]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",He]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",He]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[Ua,He]}],"translate-x":[{"translate-x":[re]}],"translate-y":[{"translate-y":[re]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",He]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",He]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",He]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Wr,ws,vd]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Gk=Rk(Zk);function _t(...t){return Gk(tx(t))}const ry=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,sy=tx,ox=(t,e)=>r=>{var i;if(e?.variants==null)return sy(t,r?.class,r?.className);const{variants:a,defaultVariants:l}=e,d=Object.keys(a).map(p=>{const v=r?.[p],w=l?.[p];if(v===null)return null;const y=ry(v)||ry(w);return a[p][y]}),f=r&&Object.entries(r).reduce((p,v)=>{let[w,y]=v;return y===void 0||(p[w]=y),p},{}),m=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((p,v)=>{let{class:w,className:y,...x}=v;return Object.entries(x).every(S=>{let[_,b]=S;return Array.isArray(b)?b.includes({...l,...f}[_]):{...l,...f}[_]===b})?[...p,w,y]:p},[]);return sy(t,d,m,r?.class,r?.className)},lx=ox("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ee=$.forwardRef(({className:t,variant:e,size:r,...i},a)=>u.jsx("button",{ref:a,className:_t(lx({variant:e,size:r}),t),...i}));Ee.displayName="Button";var st;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const l={};for(const d of a)l[d]=d;return l},t.getValidEnumValues=a=>{const l=t.objectKeys(a).filter(f=>typeof a[a[f]]!="number"),d={};for(const f of l)d[f]=a[f];return t.objectValues(d)},t.objectValues=a=>t.objectKeys(a).map(function(l){return a[l]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const l=[];for(const d in a)Object.prototype.hasOwnProperty.call(a,d)&&l.push(d);return l},t.find=(a,l)=>{for(const d of a)if(l(d))return d},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function i(a,l=" | "){return a.map(d=>typeof d=="string"?`'${d}'`:d).join(l)}t.joinValues=i,t.jsonStringifyReplacer=(a,l)=>typeof l=="bigint"?l.toString():l})(st||(st={}));var iy;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(iy||(iy={}));const je=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_s=t=>{switch(typeof t){case"undefined":return je.undefined;case"string":return je.string;case"number":return Number.isNaN(t)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(t)?je.array:t===null?je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?je.promise:typeof Map<"u"&&t instanceof Map?je.map:typeof Set<"u"&&t instanceof Set?je.set:typeof Date<"u"&&t instanceof Date?je.date:je.object;default:return je.unknown}},ie=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Gr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(l){return l.message},i={_errors:[]},a=l=>{for(const d of l.issues)if(d.code==="invalid_union")d.unionErrors.map(a);else if(d.code==="invalid_return_type")a(d.returnTypeError);else if(d.code==="invalid_arguments")a(d.argumentsError);else if(d.path.length===0)i._errors.push(r(d));else{let f=i,m=0;for(;mr.message){const r={},i=[];for(const a of this.issues)if(a.path.length>0){const l=a.path[0];r[l]=r[l]||[],r[l].push(e(a))}else i.push(e(a));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}Gr.create=t=>new Gr(t);const tf=(t,e)=>{let r;switch(t.code){case ie.invalid_type:t.received===je.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,st.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${st.joinValues(t.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${st.joinValues(t.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${st.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:st.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,st.assertNever(t)}return{message:r}};let Jk=tf;function Yk(){return Jk}const Xk=t=>{const{data:e,path:r,errorMaps:i,issueData:a}=t,l=[...r,...a.path||[]],d={...a,path:l};if(a.message!==void 0)return{...a,path:l,message:a.message};let f="";const m=i.filter(p=>!!p).slice().reverse();for(const p of m)f=p(d,{data:e,defaultError:f}).message;return{...a,path:l,message:f}};function fe(t,e){const r=Yk(),i=Xk({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===tf?void 0:tf].filter(a=>!!a)});t.common.issues.push(i)}class hn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const i=[];for(const a of r){if(a.status==="aborted")return ze;a.status==="dirty"&&e.dirty(),i.push(a.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){const i=[];for(const a of r){const l=await a.key,d=await a.value;i.push({key:l,value:d})}return hn.mergeObjectSync(e,i)}static mergeObjectSync(e,r){const i={};for(const a of r){const{key:l,value:d}=a;if(l.status==="aborted"||d.status==="aborted")return ze;l.status==="dirty"&&e.dirty(),d.status==="dirty"&&e.dirty(),l.value!=="__proto__"&&(typeof d.value<"u"||a.alwaysSet)&&(i[l.value]=d.value)}return{status:e.value,value:i}}}const ze=Object.freeze({status:"aborted"}),Ka=t=>({status:"dirty",value:t}),Gn=t=>({status:"valid",value:t}),ay=t=>t.status==="aborted",oy=t=>t.status==="dirty",qi=t=>t.status==="valid",Jl=t=>typeof Promise<"u"&&t instanceof Promise;var ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ke||(ke={}));class Or{constructor(e,r,i,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ly=(t,e)=>{if(qi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Gr(t.common.issues);return this._error=r,this._error}}};function Ke(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:i,description:a}=t;if(e&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(d,f)=>{const{message:m}=t;return d.code==="invalid_enum_value"?{message:m??f.defaultError}:typeof f.data>"u"?{message:m??i??f.defaultError}:d.code!=="invalid_type"?{message:f.defaultError}:{message:m??r??f.defaultError}},description:a}}class Je{get description(){return this._def.description}_getType(e){return _s(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:_s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new hn,ctx:{common:e.parent.common,data:e.data,parsedType:_s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Jl(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){const i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_s(e)},a=this._parseSync({data:e,path:i.path,parent:i});return ly(i,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_s(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return qi(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>qi(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){const i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){const i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_s(e)},a=this._parse({data:e,path:i.path,parent:i}),l=await(Jl(a)?a:Promise.resolve(a));return ly(i,l)}refine(e,r){const i=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,l)=>{const d=e(a),f=()=>l.addIssue({code:ie.custom,...i(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(m=>m?!0:(f(),!1)):d?!0:(f(),!1)})}refinement(e,r){return this._refinement((i,a)=>e(i)?!0:(a.addIssue(typeof r=="function"?r(i,a):r),!1))}_refinement(e){return new Ki({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Os.create(this,this._def)}nullable(){return Qi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return nu.create(this,this._def)}or(e){return Xl.create([this,e],this._def)}and(e){return eu.create(this,e,this._def)}transform(e){return new Ki({...Ke(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new lf({...Ke(this._def),innerType:this,defaultValue:r,typeName:De.ZodDefault})}brand(){return new jN({typeName:De.ZodBranded,type:this,...Ke(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new uf({...Ke(this._def),innerType:this,catchValue:r,typeName:De.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ff.create(this,e)}readonly(){return cf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const eN=/^c[^\s-]{8,}$/i,tN=/^[0-9a-z]+$/,nN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sN=/^[a-z0-9_-]{21}$/i,iN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,aN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xd;const uN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,fN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ux="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",mN=new RegExp(`^${ux}$`);function cx(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function gN(t){return new RegExp(`^${cx(t)}$`)}function yN(t){let e=`${ux}T${cx(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function vN(t,e){return!!((e==="v4"||!e)&&uN.test(t)||(e==="v6"||!e)&&dN.test(t))}function xN(t,e){if(!iN.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(i));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function wN(t,e){return!!((e==="v4"||!e)&&cN.test(t)||(e==="v6"||!e)&&fN.test(t))}class Kr extends Je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==je.string){const l=this._getOrReturnCtx(e);return fe(l,{code:ie.invalid_type,expected:je.string,received:l.parsedType}),ze}const i=new hn;let a;for(const l of this._def.checks)if(l.kind==="min")e.data.lengthl.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),i.dirty());else if(l.kind==="length"){const d=e.data.length>l.value,f=e.data.lengthe.test(a),{validation:r,code:ie.invalid_string,...ke.errToObj(i)})}_addCheck(e){return new Kr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ke.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ke.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ke.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ke.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ke.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ke.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ke.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ke.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ke.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ke.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ke.errToObj(r)})}nonempty(e){return this.min(1,ke.errToObj(e))}trim(){return new Kr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Kr({checks:[],typeName:De.ZodString,coerce:t?.coerce??!1,...Ke(t)});function bN(t,e){const r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,a=r>i?r:i,l=Number.parseInt(t.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return l%d/10**a}class Hi extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==je.number){const l=this._getOrReturnCtx(e);return fe(l,{code:ie.invalid_type,expected:je.number,received:l.parsedType}),ze}let i;const a=new hn;for(const l of this._def.checks)l.kind==="int"?st.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.invalid_type,expected:"integer",received:"float",message:l.message}),a.dirty()):l.kind==="min"?(l.inclusive?e.datal.value:e.data>=l.value)&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),a.dirty()):l.kind==="multipleOf"?bN(e.data,l.value)!==0&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.not_multiple_of,multipleOf:l.value,message:l.message}),a.dirty()):l.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.not_finite,message:l.message}),a.dirty()):st.assertNever(l);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,i,a){return new Hi({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ke.toString(a)}]})}_addCheck(e){return new Hi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&st.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.valuenew Hi({checks:[],typeName:De.ZodNumber,coerce:t?.coerce||!1,...Ke(t)});class co extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==je.bigint)return this._getInvalidInput(e);let i;const a=new hn;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?e.datal.value:e.data>=l.value)&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),a.dirty()):l.kind==="multipleOf"?e.data%l.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),fe(i,{code:ie.not_multiple_of,multipleOf:l.value,message:l.message}),a.dirty()):st.assertNever(l);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:je.bigint,received:r.parsedType}),ze}gte(e,r){return this.setLimit("min",e,!0,ke.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ke.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ke.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ke.toString(r))}setLimit(e,r,i,a){return new co({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ke.toString(a)}]})}_addCheck(e){return new co({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew co({checks:[],typeName:De.ZodBigInt,coerce:t?.coerce??!1,...Ke(t)});class nf extends Je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==je.boolean){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.boolean,received:i.parsedType}),ze}return Gn(e.data)}}nf.create=t=>new nf({typeName:De.ZodBoolean,coerce:t?.coerce||!1,...Ke(t)});class Yl extends Je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==je.date){const l=this._getOrReturnCtx(e);return fe(l,{code:ie.invalid_type,expected:je.date,received:l.parsedType}),ze}if(Number.isNaN(e.data.getTime())){const l=this._getOrReturnCtx(e);return fe(l,{code:ie.invalid_date}),ze}const i=new hn;let a;for(const l of this._def.checks)l.kind==="min"?e.data.getTime()l.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),i.dirty()):st.assertNever(l);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yl({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ke.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ke.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Yl({checks:[],coerce:t?.coerce||!1,typeName:De.ZodDate,...Ke(t)});class uy extends Je{_parse(e){if(this._getType(e)!==je.symbol){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.symbol,received:i.parsedType}),ze}return Gn(e.data)}}uy.create=t=>new uy({typeName:De.ZodSymbol,...Ke(t)});class cy extends Je{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.undefined,received:i.parsedType}),ze}return Gn(e.data)}}cy.create=t=>new cy({typeName:De.ZodUndefined,...Ke(t)});class rf extends Je{_parse(e){if(this._getType(e)!==je.null){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.null,received:i.parsedType}),ze}return Gn(e.data)}}rf.create=t=>new rf({typeName:De.ZodNull,...Ke(t)});class dy extends Je{constructor(){super(...arguments),this._any=!0}_parse(e){return Gn(e.data)}}dy.create=t=>new dy({typeName:De.ZodAny,...Ke(t)});class sf extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Gn(e.data)}}sf.create=t=>new sf({typeName:De.ZodUnknown,...Ke(t)});class As extends Je{_parse(e){const r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:je.never,received:r.parsedType}),ze}}As.create=t=>new As({typeName:De.ZodNever,...Ke(t)});class fy extends Je{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.void,received:i.parsedType}),ze}return Gn(e.data)}}fy.create=t=>new fy({typeName:De.ZodVoid,...Ke(t)});class Pr extends Je{_parse(e){const{ctx:r,status:i}=this._processInputParams(e),a=this._def;if(r.parsedType!==je.array)return fe(r,{code:ie.invalid_type,expected:je.array,received:r.parsedType}),ze;if(a.exactLength!==null){const d=r.data.length>a.exactLength.value,f=r.data.lengtha.maxLength.value&&(fe(r,{code:ie.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((d,f)=>a.type._parseAsync(new Or(r,d,r.path,f)))).then(d=>hn.mergeArray(i,d));const l=[...r.data].map((d,f)=>a.type._parseSync(new Or(r,d,r.path,f)));return hn.mergeArray(i,l)}get element(){return this._def.type}min(e,r){return new Pr({...this._def,minLength:{value:e,message:ke.toString(r)}})}max(e,r){return new Pr({...this._def,maxLength:{value:e,message:ke.toString(r)}})}length(e,r){return new Pr({...this._def,exactLength:{value:e,message:ke.toString(r)}})}nonempty(e){return this.min(1,e)}}Pr.create=(t,e)=>new Pr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...Ke(e)});function Fi(t){if(t instanceof Mt){const e={};for(const r in t.shape){const i=t.shape[r];e[r]=Os.create(Fi(i))}return new Mt({...t._def,shape:()=>e})}else return t instanceof Pr?new Pr({...t._def,type:Fi(t.element)}):t instanceof Os?Os.create(Fi(t.unwrap())):t instanceof Qi?Qi.create(Fi(t.unwrap())):t instanceof ii?ii.create(t.items.map(e=>Fi(e))):t}class Mt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=st.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==je.object){const p=this._getOrReturnCtx(e);return fe(p,{code:ie.invalid_type,expected:je.object,received:p.parsedType}),ze}const{status:i,ctx:a}=this._processInputParams(e),{shape:l,keys:d}=this._getCached(),f=[];if(!(this._def.catchall instanceof As&&this._def.unknownKeys==="strip"))for(const p in a.data)d.includes(p)||f.push(p);const m=[];for(const p of d){const v=l[p],w=a.data[p];m.push({key:{status:"valid",value:p},value:v._parse(new Or(a,w,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof As){const p=this._def.unknownKeys;if(p==="passthrough")for(const v of f)m.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(p==="strict")f.length>0&&(fe(a,{code:ie.unrecognized_keys,keys:f}),i.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const v of f){const w=a.data[v];m.push({key:{status:"valid",value:v},value:p._parse(new Or(a,w,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const v of m){const w=await v.key,y=await v.value;p.push({key:w,value:y,alwaysSet:v.alwaysSet})}return p}).then(p=>hn.mergeObjectSync(i,p)):hn.mergeObjectSync(i,m)}get shape(){return this._def.shape()}strict(e){return ke.errToObj,new Mt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{const a=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:ke.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:De.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Mt({...this._def,catchall:e})}pick(e){const r={};for(const i of st.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new Mt({...this._def,shape:()=>r})}omit(e){const r={};for(const i of st.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new Mt({...this._def,shape:()=>r})}deepPartial(){return Fi(this)}partial(e){const r={};for(const i of st.objectKeys(this.shape)){const a=this.shape[i];e&&!e[i]?r[i]=a:r[i]=a.optional()}return new Mt({...this._def,shape:()=>r})}required(e){const r={};for(const i of st.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let l=this.shape[i];for(;l instanceof Os;)l=l._def.innerType;r[i]=l}return new Mt({...this._def,shape:()=>r})}keyof(){return dx(st.objectKeys(this.shape))}}Mt.create=(t,e)=>new Mt({shape:()=>t,unknownKeys:"strip",catchall:As.create(),typeName:De.ZodObject,...Ke(e)});Mt.strictCreate=(t,e)=>new Mt({shape:()=>t,unknownKeys:"strict",catchall:As.create(),typeName:De.ZodObject,...Ke(e)});Mt.lazycreate=(t,e)=>new Mt({shape:t,unknownKeys:"strip",catchall:As.create(),typeName:De.ZodObject,...Ke(e)});class Xl extends Je{_parse(e){const{ctx:r}=this._processInputParams(e),i=this._def.options;function a(l){for(const f of l)if(f.result.status==="valid")return f.result;for(const f of l)if(f.result.status==="dirty")return r.common.issues.push(...f.ctx.common.issues),f.result;const d=l.map(f=>new Gr(f.ctx.common.issues));return fe(r,{code:ie.invalid_union,unionErrors:d}),ze}if(r.common.async)return Promise.all(i.map(async l=>{const d={...r,common:{...r.common,issues:[]},parent:null};return{result:await l._parseAsync({data:r.data,path:r.path,parent:d}),ctx:d}})).then(a);{let l;const d=[];for(const m of i){const p={...r,common:{...r.common,issues:[]},parent:null},v=m._parseSync({data:r.data,path:r.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!l&&(l={result:v,ctx:p}),p.common.issues.length&&d.push(p.common.issues)}if(l)return r.common.issues.push(...l.ctx.common.issues),l.result;const f=d.map(m=>new Gr(m));return fe(r,{code:ie.invalid_union,unionErrors:f}),ze}}get options(){return this._def.options}}Xl.create=(t,e)=>new Xl({options:t,typeName:De.ZodUnion,...Ke(e)});function af(t,e){const r=_s(t),i=_s(e);if(t===e)return{valid:!0,data:t};if(r===je.object&&i===je.object){const a=st.objectKeys(e),l=st.objectKeys(t).filter(f=>a.indexOf(f)!==-1),d={...t,...e};for(const f of l){const m=af(t[f],e[f]);if(!m.valid)return{valid:!1};d[f]=m.data}return{valid:!0,data:d}}else if(r===je.array&&i===je.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let l=0;l{if(ay(l)||ay(d))return ze;const f=af(l.value,d.value);return f.valid?((oy(l)||oy(d))&&r.dirty(),{status:r.value,value:f.data}):(fe(i,{code:ie.invalid_intersection_types}),ze)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([l,d])=>a(l,d)):a(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}eu.create=(t,e,r)=>new eu({left:t,right:e,typeName:De.ZodIntersection,...Ke(r)});class ii extends Je{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.array)return fe(i,{code:ie.invalid_type,expected:je.array,received:i.parsedType}),ze;if(i.data.lengththis._def.items.length&&(fe(i,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const l=[...i.data].map((d,f)=>{const m=this._def.items[f]||this._def.rest;return m?m._parse(new Or(i,d,i.path,f)):null}).filter(d=>!!d);return i.common.async?Promise.all(l).then(d=>hn.mergeArray(r,d)):hn.mergeArray(r,l)}get items(){return this._def.items}rest(e){return new ii({...this._def,rest:e})}}ii.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ii({items:t,typeName:De.ZodTuple,rest:null,...Ke(e)})};class tu extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.object)return fe(i,{code:ie.invalid_type,expected:je.object,received:i.parsedType}),ze;const a=[],l=this._def.keyType,d=this._def.valueType;for(const f in i.data)a.push({key:l._parse(new Or(i,f,i.path,f)),value:d._parse(new Or(i,i.data[f],i.path,f)),alwaysSet:f in i.data});return i.common.async?hn.mergeObjectAsync(r,a):hn.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Je?new tu({keyType:e,valueType:r,typeName:De.ZodRecord,...Ke(i)}):new tu({keyType:Kr.create(),valueType:e,typeName:De.ZodRecord,...Ke(r)})}}class hy extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.map)return fe(i,{code:ie.invalid_type,expected:je.map,received:i.parsedType}),ze;const a=this._def.keyType,l=this._def.valueType,d=[...i.data.entries()].map(([f,m],p)=>({key:a._parse(new Or(i,f,i.path,[p,"key"])),value:l._parse(new Or(i,m,i.path,[p,"value"]))}));if(i.common.async){const f=new Map;return Promise.resolve().then(async()=>{for(const m of d){const p=await m.key,v=await m.value;if(p.status==="aborted"||v.status==="aborted")return ze;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}})}else{const f=new Map;for(const m of d){const p=m.key,v=m.value;if(p.status==="aborted"||v.status==="aborted")return ze;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}}}}hy.create=(t,e,r)=>new hy({valueType:e,keyType:t,typeName:De.ZodMap,...Ke(r)});class fo extends Je{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.set)return fe(i,{code:ie.invalid_type,expected:je.set,received:i.parsedType}),ze;const a=this._def;a.minSize!==null&&i.data.sizea.maxSize.value&&(fe(i,{code:ie.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const l=this._def.valueType;function d(m){const p=new Set;for(const v of m){if(v.status==="aborted")return ze;v.status==="dirty"&&r.dirty(),p.add(v.value)}return{status:r.value,value:p}}const f=[...i.data.values()].map((m,p)=>l._parse(new Or(i,m,i.path,p)));return i.common.async?Promise.all(f).then(m=>d(m)):d(f)}min(e,r){return new fo({...this._def,minSize:{value:e,message:ke.toString(r)}})}max(e,r){return new fo({...this._def,maxSize:{value:e,message:ke.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}fo.create=(t,e)=>new fo({valueType:t,minSize:null,maxSize:null,typeName:De.ZodSet,...Ke(e)});class py extends Je{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}py.create=(t,e)=>new py({getter:t,typeName:De.ZodLazy,...Ke(e)});class of extends Je{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return fe(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),ze}return{status:"valid",value:e.data}}get value(){return this._def.value}}of.create=(t,e)=>new of({value:t,typeName:De.ZodLiteral,...Ke(e)});function dx(t,e){return new Wi({values:t,typeName:De.ZodEnum,...Ke(e)})}class Wi extends Je{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),i=this._def.values;return fe(r,{expected:st.joinValues(i),received:r.parsedType,code:ie.invalid_type}),ze}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),i=this._def.values;return fe(r,{received:r.data,code:ie.invalid_enum_value,options:i}),ze}return Gn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Wi.create(e,{...this._def,...r})}exclude(e,r=this._def){return Wi.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}}Wi.create=dx;class my extends Je{_parse(e){const r=st.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==je.string&&i.parsedType!==je.number){const a=st.objectValues(r);return fe(i,{expected:st.joinValues(a),received:i.parsedType,code:ie.invalid_type}),ze}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=st.objectValues(r);return fe(i,{received:i.data,code:ie.invalid_enum_value,options:a}),ze}return Gn(e.data)}get enum(){return this._def.values}}my.create=(t,e)=>new my({values:t,typeName:De.ZodNativeEnum,...Ke(e)});class nu extends Je{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==je.promise&&r.common.async===!1)return fe(r,{code:ie.invalid_type,expected:je.promise,received:r.parsedType}),ze;const i=r.parsedType===je.promise?r.data:Promise.resolve(r.data);return Gn(i.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}nu.create=(t,e)=>new nu({type:t,typeName:De.ZodPromise,...Ke(e)});class Ki extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:i}=this._processInputParams(e),a=this._def.effect||null,l={addIssue:d=>{fe(i,d),d.fatal?r.abort():r.dirty()},get path(){return i.path}};if(l.addIssue=l.addIssue.bind(l),a.type==="preprocess"){const d=a.transform(i.data,l);if(i.common.async)return Promise.resolve(d).then(async f=>{if(r.value==="aborted")return ze;const m=await this._def.schema._parseAsync({data:f,path:i.path,parent:i});return m.status==="aborted"?ze:m.status==="dirty"||r.value==="dirty"?Ka(m.value):m});{if(r.value==="aborted")return ze;const f=this._def.schema._parseSync({data:d,path:i.path,parent:i});return f.status==="aborted"?ze:f.status==="dirty"||r.value==="dirty"?Ka(f.value):f}}if(a.type==="refinement"){const d=f=>{const m=a.refinement(f,l);if(i.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f};if(i.common.async===!1){const f=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return f.status==="aborted"?ze:(f.status==="dirty"&&r.dirty(),d(f.value),{status:r.value,value:f.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(f=>f.status==="aborted"?ze:(f.status==="dirty"&&r.dirty(),d(f.value).then(()=>({status:r.value,value:f.value}))))}if(a.type==="transform")if(i.common.async===!1){const d=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!qi(d))return ze;const f=a.transform(d.value,l);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:f}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(d=>qi(d)?Promise.resolve(a.transform(d.value,l)).then(f=>({status:r.value,value:f})):ze);st.assertNever(a)}}Ki.create=(t,e,r)=>new Ki({schema:t,typeName:De.ZodEffects,effect:e,...Ke(r)});Ki.createWithPreprocess=(t,e,r)=>new Ki({schema:e,effect:{type:"preprocess",transform:t},typeName:De.ZodEffects,...Ke(r)});class Os extends Je{_parse(e){return this._getType(e)===je.undefined?Gn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Os.create=(t,e)=>new Os({innerType:t,typeName:De.ZodOptional,...Ke(e)});class Qi extends Je{_parse(e){return this._getType(e)===je.null?Gn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qi.create=(t,e)=>new Qi({innerType:t,typeName:De.ZodNullable,...Ke(e)});class lf extends Je{_parse(e){const{ctx:r}=this._processInputParams(e);let i=r.data;return r.parsedType===je.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}lf.create=(t,e)=>new lf({innerType:t,typeName:De.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ke(e)});class uf extends Je{_parse(e){const{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Jl(a)?a.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Gr(i.common.issues)},input:i.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Gr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}uf.create=(t,e)=>new uf({innerType:t,typeName:De.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ke(e)});class gy extends Je{_parse(e){if(this._getType(e)!==je.nan){const i=this._getOrReturnCtx(e);return fe(i,{code:ie.invalid_type,expected:je.nan,received:i.parsedType}),ze}return{status:"valid",value:e.data}}}gy.create=t=>new gy({typeName:De.ZodNaN,...Ke(t)});class jN extends Je{_parse(e){const{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ff extends Je{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return l.status==="aborted"?ze:l.status==="dirty"?(r.dirty(),Ka(l.value)):this._def.out._parseAsync({data:l.value,path:i.path,parent:i})})();{const a=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?ze:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:i.path,parent:i})}}static create(e,r){return new Ff({in:e,out:r,typeName:De.ZodPipeline})}}class cf extends Je{_parse(e){const r=this._def.innerType._parse(e),i=a=>(qi(a)&&(a.value=Object.freeze(a.value)),a);return Jl(r)?r.then(a=>i(a)):i(r)}unwrap(){return this._def.innerType}}cf.create=(t,e)=>new cf({innerType:t,typeName:De.ZodReadonly,...Ke(e)});var De;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(De||(De={}));const D=Kr.create,Ne=Hi.create,Rr=nf.create,Df=rf.create,dn=sf.create;As.create;const it=Pr.create,Be=Mt.create,nn=Xl.create;eu.create;ii.create;const li=tu.create,fx=of.create,hx=Wi.create;nu.create;Os.create;Qi.create;class yy extends Error{constructor(e,r,i,a){super(`${e} ${r} - ${a}`),this.status=e,this.statusText=r,this.body=i,this.url=a,this.name="ApiError"}status;statusText;body;url}function _N(t,e){if(!e)return t;const r=new URLSearchParams;for(const[a,l]of Object.entries(e))l!=null&&r.append(a,String(l));const i=r.toString();return i?`${t}?${i}`:t}async function Ba(t,e,r={}){const{body:i,query:a,headers:l,...d}=r,f=_N(t,a),m={...d,headers:{Accept:"application/json",...i!==void 0?{"Content-Type":"application/json"}:{},...l},body:i!==void 0?JSON.stringify(i):void 0},p=await fetch(f,m),w=(p.headers.get("content-type")??"").includes("application/json")&&p.status!==204?await p.json():await p.text();if(!p.ok)throw new yy(p.status,p.statusText,w,f);const y=e.safeParse(w);if(!y.success)throw new yy(p.status,"Response schema mismatch",{issues:y.error.issues,raw:w},f);return y.data}const rt={get:(t,e,r)=>Ba(t,e,{...r,method:"GET"}),post:(t,e,r,i)=>Ba(t,e,{...i,method:"POST",body:r}),put:(t,e,r,i)=>Ba(t,e,{...i,method:"PUT",body:r}),patch:(t,e,r,i)=>Ba(t,e,{...i,method:"PATCH",body:r}),delete:(t,e,r)=>Ba(t,e,{...r,method:"DELETE"})},SN=Be({id:nn([D(),Ne()]).transform(String),name:D(),domain:D(),created_at:D(),updated_at:D()}),kN=it(SN),NN=Be({id:nn([D(),Ne()]).transform(String),name:D(),type:D(),base_url:D().nullable().optional(),trust_level:nn([D(),Ne()]).nullable().optional(),respect_robots_txt:Rr().nullable().optional(),rate_limit_per_minute:Ne().nullable().optional()}),CN=Be({id:nn([D(),Ne()]).transform(String),name:D(),domain:D(),config:dn().optional(),sources:it(NN).default([])}),vy=Be({id:nn([D(),Ne()]).transform(String),name:D(),domain:D()}),$f={list:()=>rt.get("/projects",kN),detail:t=>rt.get(`/projects/${encodeURIComponent(t)}`,CN),create:t=>rt.post("/projects",vy,t),createInline:t=>rt.post("/projects/inline",vy,t)},Ie={projects:{all:["projects"],list:()=>[...Ie.projects.all,"list"],detail:t=>[...Ie.projects.all,"detail",t]},domains:{all:["domains"],list:()=>[...Ie.domains.all,"list"]},ontology:{all:["ontology"],byDomain:t=>[...Ie.ontology.all,"byDomain",t]},crawl:{all:["crawl"],job:t=>[...Ie.crawl.all,"job",t]},research:{all:["research"],sessions:t=>[...Ie.research.all,"sessions",t],session:t=>[...Ie.research.all,"session",t]},entities:{all:["entities"],list:(t,e)=>[...Ie.entities.all,"list",t,e??"*"]},claims:{all:["claims"],list:(t,e,r)=>[...Ie.claims.all,"list",t,e??"*",r??"*"]},platform:{all:["platform"],pipeline:t=>[...Ie.platform.all,"pipeline",t],extractionLogs:(t,e)=>[...Ie.platform.all,"extractionLogs",t,e],registry:t=>[...Ie.platform.all,"registry",t],proposals:(t,e)=>[...Ie.platform.all,"proposals",t,e],triples:(t,e,r)=>[...Ie.platform.all,"triples",t,e,r],graph:(t,e,r,i,a)=>[...Ie.platform.all,"graph",t,e,r,i,a],exportJson:(t,e,r,i)=>[...Ie.platform.all,"exportJson",t,e,r,i]}};function px(){return On({queryKey:Ie.projects.list(),queryFn:()=>$f.list()})}function hr(t){return On({queryKey:Ie.projects.detail(t??""),queryFn:()=>$f.detail(t),enabled:!!t})}function EN(){const t=Kt();return gn({mutationFn:e=>$f.createInline(e),onSuccess:()=>{t.invalidateQueries({queryKey:Ie.projects.all})}})}const PN=[{to:"/",labelKey:"nav.dashboard",label:"Dashboard",icon:wS},{to:"/onboard",labelKey:"nav.onboard",label:"New Project",icon:PS},{projectPath:"sources",labelKey:"nav.sources",label:"Source Explorer",icon:SS},{projectPath:"crawl",labelKey:"nav.crawl",label:"Seed Crawl",icon:sS},{projectPath:"pipeline",labelKey:"nav.pipeline",label:"Build Pipeline",icon:Dv},{projectPath:"analysis",labelKey:"nav.analysis",label:"Page Analysis",icon:Uv},{projectPath:"schema",labelKey:"nav.schema",label:"Schema Designer",icon:Bv},{projectPath:"editor",labelKey:"nav.editor",label:"Entity Manager",icon:Cf},{projectPath:"review",labelKey:"nav.review",label:"Claim Review",icon:Nf},{projectPath:"quality",labelKey:"nav.quality",label:"Quality Inspector",icon:Hd},{projectPath:"graph",labelKey:"nav.graph",label:"Graph View",icon:kf},{projectPath:"export",labelKey:"nav.export",label:"Export / API",icon:Sf},{projectPath:"research",labelKey:"nav.research",label:"Graph Research",icon:Av}],mx=["/sources/:projectId","/crawl/:projectId","/pipeline/:projectId","/analysis/:projectId","/schema/:projectId","/research/:projectId","/editor/:projectId","/review/:projectId","/quality/:projectId","/graph/:projectId","/export/:projectId"];function ON(t){for(const e of mx){const r=to({path:e,end:!1},t);if(r?.params.projectId)return r.params.projectId}}function RN(t){for(const e of mx)if(to({path:e,end:!1},t)?.params.projectId)return e.split("/")[1]}function TN(){const{t}=oi(),e=aw(w=>w.ui.sidebarOpen),r=xw(),i=Xi(),a=mn(),l=ON(i.pathname),d=RN(i.pathname),{data:f}=px(),m=f?.[0]?.name,p=!l||!f||f.some(w=>w.name===l),v=p?l??m:m;return $.useEffect(()=>{if(l&&f&&!p){const w=d&&m?`/${d}/${encodeURIComponent(m)}`:"/";a(w,{replace:!0})}},[m,a,f,p,l,d]),u.jsxs("div",{className:"flex min-h-screen bg-background text-foreground",children:[u.jsxs("aside",{className:_t("border-r bg-card transition-all duration-200 ease-out",e?"w-60":"w-16"),children:[u.jsxs("div",{className:"flex h-14 items-center justify-between px-4 border-b",children:[e&&u.jsx("span",{className:"text-sm font-semibold",children:t("app.title","Ontology Builder")}),u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>r(yk()),"aria-label":t("nav.toggleSidebar","Toggle sidebar"),children:u.jsx(_S,{className:"h-4 w-4"})})]}),e&&u.jsxs("div",{className:"border-b px-4 py-3",children:[u.jsx("p",{className:"text-xs text-muted-foreground",children:t("nav.currentProject","Current project")}),u.jsx("p",{className:"mt-1 truncate text-sm font-medium",children:v??t("nav.noProjectSelected","Select a project")})]}),u.jsx("nav",{className:"flex flex-col gap-1 p-2",children:PN.map(({to:w,projectPath:y,labelKey:x,label:S,icon:_})=>{const b=w??(v?`/${y}/${encodeURIComponent(v)}`:void 0);return b?u.jsxs(Sb,{to:b,end:b==="/",className:({isActive:P})=>_t("flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors",P?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[u.jsx(_,{className:"h-4 w-4 flex-shrink-0"}),e&&u.jsx("span",{children:t(x,S)})]},x):u.jsxs("div",{className:"flex cursor-not-allowed items-center gap-3 rounded-md px-3 py-2 text-sm text-muted-foreground/50",title:t("nav.selectProjectFirst","Select a project from the dashboard first"),children:[u.jsx(_,{className:"h-4 w-4 flex-shrink-0"}),e&&u.jsx("span",{children:t(x,S)})]},x)})})]}),u.jsxs("div",{className:"flex flex-1 flex-col",children:[u.jsx("header",{className:"flex h-14 items-center justify-between border-b bg-card px-6",children:u.jsx("h1",{className:"text-sm font-medium text-muted-foreground",children:t("app.subtitle","AI-powered ontology construction")})}),u.jsx("main",{className:"flex-1 overflow-auto",children:u.jsx(cb,{})})]})]})}var go=t=>t.type==="checkbox",ei=t=>t instanceof Date,cn=t=>t==null;const gx=t=>typeof t=="object";var Nt=t=>!cn(t)&&!Array.isArray(t)&&gx(t)&&!ei(t),LN=t=>Nt(t)&&t.target?go(t.target)?t.target.checked:t.target.value:t,AN=(t,e)=>e.split(".").some((r,i,a)=>!isNaN(Number(r))&&t.has(a.slice(0,i).join("."))),IN=t=>{const e=t.constructor&&t.constructor.prototype;return Nt(e)&&e.hasOwnProperty("isPrototypeOf")},zf=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function At(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(zf&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(Nt(t)&&IN(t)))return t;const i=r?[]:Object.create(Object.getPrototypeOf(t));for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=At(t[a]));return i}var cu=t=>/^\w*$/.test(t),vt=t=>t===void 0,Uf=t=>Array.isArray(t)?t.filter(Boolean):[],Vf=t=>Uf(t.replace(/["|']|\]/g,"").split(/\.|\[/)),we=(t,e,r)=>{if(!e||!Nt(t))return r;const a=(cu(e)?[e]:Vf(e)).reduce((l,d)=>cn(l)?void 0:l[d],t);return vt(a)||a===t?vt(t[e])?r:t[e]:a},kr=t=>typeof t=="boolean",Kn=t=>typeof t=="function",dt=(t,e,r)=>{let i=-1;const a=cu(e)?[e]:Vf(e),l=a.length,d=l-1;for(;++i{const a={};for(const l in t)Object.defineProperty(a,l,{get:()=>{const d=l;return e._proxyFormState[d]!==cr.all&&(e._proxyFormState[d]=!i||cr.all),t[d]}});return a};const DN=typeof window<"u"?ne.useLayoutEffect:ne.useEffect;var en=t=>typeof t=="string",$N=(t,e,r,i,a)=>en(t)?(i&&e.watch.add(t),we(r,t,a)):Array.isArray(t)?t.map(l=>(i&&e.watch.add(l),we(r,l))):(i&&(e.watchAll=!0),r),df=t=>cn(t)||!gx(t);function Nr(t,e,r=new WeakSet){if(t===e)return!0;if(df(t)||df(e))return Object.is(t,e);if(ei(t)&&ei(e))return Object.is(t.getTime(),e.getTime());const i=Object.keys(t),a=Object.keys(e);if(i.length!==a.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const l of i){const d=t[l];if(!(l in e))return!1;if(l!=="ref"){const f=e[l];if(ei(d)&&ei(f)||(Nt(d)||Array.isArray(d))&&(Nt(f)||Array.isArray(f))?!Nr(d,f,r):!Object.is(d,f))return!1}}return!0}const zN=ne.createContext(null);zN.displayName="HookFormContext";var vx=(t,e,r,i,a)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[i]:a||!0}}:{},Ja=t=>Array.isArray(t)?t:[t],xy=()=>{let t=[];return{get observers(){return t},next:a=>{for(const l of t)l.next&&l.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(l=>l!==a)}}),unsubscribe:()=>{t=[]}}};function xx(t,e){const r={};for(const i in t)if(t.hasOwnProperty(i)){const a=t[i],l=e[i];if(a&&Nt(a)&&l){const d=xx(a,l);Nt(d)&&(r[i]=d)}else t[i]&&(r[i]=l)}return r}var Xt=t=>Nt(t)&&!Object.keys(t).length,Bf=t=>t.type==="file",ru=t=>{if(!zf)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},wx=t=>t.type==="select-multiple",qf=t=>t.type==="radio",UN=t=>qf(t)||go(t),bd=t=>ru(t)&&t.isConnected;function VN(t,e){const r=e.slice(0,-1).length;let i=0;for(;i{for(const e in t)if(Kn(t[e]))return!0;return!1};function bx(t){return Array.isArray(t)||Nt(t)&&!qN(t)}function ff(t,e={}){for(const r in t){const i=t[r];bx(i)?(e[r]=Array.isArray(i)?[]:{},ff(i,e[r])):vt(i)||(e[r]=!0)}return e}function hf(t){if(t!==!1){if(t===!0)return!0;if(Array.isArray(t)){const e=t.map(r=>hf(r));return e.some(r=>r!==void 0)?e:void 0}if(Nt(t)){const e={};for(const r in t){const i=hf(t[r]);vt(i)||(e[r]=i)}return Object.keys(e).length?e:void 0}}}function Qa(t,e,r){r||(r=ff(e));for(const i in t){const a=t[i];if(bx(a))vt(e)||df(r[i])?r[i]=ff(a,Array.isArray(a)?[]:{}):Qa(a,cn(e)?{}:e[i],r[i]);else{const l=e[i];r[i]=!Nr(a,l)}}return hf(r)||{}}const wy={value:!1,isValid:!1},by={value:!0,isValid:!0};var jx=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!vt(t[0].attributes.value)?vt(t[0].value)||t[0].value===""?by:{value:t[0].value,isValid:!0}:by:wy}return wy},_x=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:i})=>vt(t)?t:e?t===""?NaN:t&&+t:r&&en(t)?new Date(t):i?i(t):t;const jy={isValid:!1,value:null};var Sx=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,jy):jy;function _y(t){const e=t.ref;return Bf(e)?e.files:qf(e)?Sx(t.refs).value:wx(e)?[...e.selectedOptions].map(({value:r})=>r):go(e)?jx(t.refs).value:_x(vt(e.value)?t.ref.value:e.value,t)}var HN=(t,e,r,i)=>{const a={};for(const l of t){const d=we(e,l);d&&dt(a,l,d._f)}return{criteriaMode:r,names:[...t],fields:a,shouldUseNativeValidation:i}},su=t=>t instanceof RegExp,qa=t=>vt(t)?t:su(t)?t.source:Nt(t)?su(t.value)?t.value.source:t.value:t,Sy=t=>({isOnSubmit:!t||t===cr.onSubmit,isOnBlur:t===cr.onBlur,isOnChange:t===cr.onChange,isOnAll:t===cr.all,isOnTouch:t===cr.onTouched});const ky="AsyncFunction";var WN=t=>!!t&&!!t.validate&&!!(Kn(t.validate)&&t.validate.constructor.name===ky||Nt(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ky)),KN=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Ny=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(i=>t.startsWith(i)&&/^\.\w+/.test(t.slice(i.length))));const Ya=(t,e,r,i)=>{for(const a of r||Object.keys(t)){const l=we(t,a);if(l){const{_f:d,...f}=l;if(d){if(d.refs&&d.refs[0]&&e(d.refs[0],a)&&!i)return!0;if(d.ref&&e(d.ref,d.name)&&!i)return!0;if(Ya(f,e))break}else if(Nt(f)&&Ya(f,e))break}}};function Cy(t,e,r){const i=we(t,r);if(i||cu(r))return{error:i,name:r};const a=r.split(".");for(;a.length;){const l=a.join("."),d=we(e,l),f=we(t,l);if(d&&!Array.isArray(d)&&r!==l)return{name:r};if(f&&f.type)return{name:l,error:f};if(f&&f.root&&f.root.type)return{name:`${l}.root`,error:f.root};a.pop()}return{name:r}}var QN=(t,e,r,i)=>{r(t);const{name:a,...l}=t;return Xt(l)||i&&Object.keys(l).length>=Object.keys(e).length||Object.keys(l).find(d=>e[d]===(!i||cr.all))},ZN=(t,e,r)=>!t||!e||t===e||Ja(t).some(i=>i&&(r?i===e:i.startsWith(e)||e.startsWith(i))),GN=(t,e,r,i,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(e||t):(r?i.isOnBlur:a.isOnBlur)?!t:(r?i.isOnChange:a.isOnChange)?t:!0,JN=(t,e)=>!Uf(we(t,e)).length&&It(t,e),YN=(t,e,r)=>{const i=Ja(we(t,r));return dt(i,yx,e[r]),dt(t,r,i),t};function Ey(t,e,r="validate"){if(en(t)||Array.isArray(t)&&t.every(en)||kr(t)&&!t)return{type:r,message:en(t)?t:"",ref:e}}var Ii=t=>Nt(t)&&!su(t)?t:{value:t,message:""},Py=async(t,e,r,i,a,l)=>{const{ref:d,refs:f,required:m,maxLength:p,minLength:v,min:w,max:y,pattern:x,validate:S,name:_,valueAsNumber:b,mount:P}=t._f,N=we(r,_);if(!P||e.has(_))return{};const F=f?f[0]:d,L=J=>{a&&F.reportValidity&&(F.setCustomValidity(kr(J)?"":J||""),F.reportValidity())},k={},I=qf(d),X=go(d),re=I||X,de=(b||Bf(d))&&vt(d.value)&&vt(N)||ru(d)&&d.value===""||N===""||Array.isArray(N)&&!N.length||b&&typeof N=="number"&&isNaN(N),Z=vx.bind(null,_,i,k),Oe=(J,ve,me,M=lr.maxLength,R=lr.minLength)=>{const G=J?ve:me;k[_]={type:J?M:R,message:G,ref:d,...Z(J?M:R,G)}};if(l?!Array.isArray(N)||!N.length:m&&(!re&&(de||cn(N))||kr(N)&&!N||X&&!jx(f).isValid||I&&!Sx(f).isValid)){const{value:J,message:ve}=en(m)?{value:!!m,message:m}:Ii(m);if(J&&(k[_]={type:lr.required,message:ve,ref:F,...Z(lr.required,ve)},!i))return L(ve),k}if(!de&&(!cn(w)||!cn(y))){let J,ve;const me=Ii(y),M=Ii(w);if(!cn(N)&&!isNaN(N)){const R=d.valueAsNumber||N&&+N;cn(me.value)||(J=R>me.value),cn(M.value)||(ve=Rnew Date(new Date().toDateString()+" "+K),H=d.type=="time",W=d.type=="week";en(me.value)&&N&&(J=H?G(N)>G(me.value):W?N>me.value:R>new Date(me.value)),en(M.value)&&N&&(ve=H?G(N)+J.value,M=!cn(ve.value)&&N.length<+ve.value;if((me||M)&&(Oe(me,J.message,ve.message),!i))return L(k[_].message),k}if(x&&!de&&en(N)){const{value:J,message:ve}=Ii(x);if(su(J)&&!N.match(J)&&(k[_]={type:lr.pattern,message:ve,ref:d,...Z(lr.pattern,ve)},!i))return L(ve),k}if(S){if(Kn(S)){const J=await S(N,r),ve=Ey(J,F);if(ve&&(k[_]={...ve,...Z(lr.validate,ve.message)},!i))return L(ve.message),k}else if(Nt(S)){let J={};for(const ve in S){if(!Xt(J)&&!i)break;const me=Ey(await S[ve](N,r),F,ve);me&&(J={...me,...Z(ve,me.message)},L(me.message),i&&(k[_]=J))}if(!Xt(J)&&(k[_]={ref:F,...J},!i))return k}}return L(!0),k};const XN={mode:cr.onSubmit,reValidateMode:cr.onChange,shouldFocusError:!0},kx={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function eC(t={}){let e={...XN,...t},r={...At(kx),isLoading:Kn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},i={},a=Nt(e.defaultValues)||Nt(e.values)?At(e.defaultValues||e.values)||{}:{},l=e.shouldUnregister?{}:At(a),d={action:!1,mount:!1,watch:!1,keepIsValid:!1},f={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},m,p=0;const v={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={...v};let y={...w};const x={array:xy(),state:xy()},S=e.criteriaMode===cr.all,_=E=>z=>{clearTimeout(p),p=setTimeout(E,z)},b=async E=>{if(!d.keepIsValid&&!e.disabled&&(w.isValid||y.isValid||E)){let z;e.resolver?(z=Xt((await de()).errors),P()):z=await J({fields:i,onlyCheckValid:!0,eventType:Ai.VALID}),z!==r.isValid&&x.state.next({isValid:z})}},P=(E,z)=>{!e.disabled&&(w.isValidating||w.validatingFields||y.isValidating||y.validatingFields)&&((E||Array.from(f.mount)).forEach(V=>{V&&(z?dt(r.validatingFields,V,z):It(r.validatingFields,V))}),x.state.next({validatingFields:r.validatingFields,isValidating:!Xt(r.validatingFields)}))},N=()=>{r.dirtyFields=Qa(a,l)},F=(E,z=[],V,oe,le=!0,ae=!0)=>{if(oe&&V&&!e.disabled){if(d.action=!0,ae&&Array.isArray(we(i,E))){const ce=V(we(i,E),oe.argA,oe.argB);le&&dt(i,E,ce)}if(ae&&Array.isArray(we(r.errors,E))){const ce=V(we(r.errors,E),oe.argA,oe.argB);le&&dt(r.errors,E,ce),JN(r.errors,E)}if((w.touchedFields||y.touchedFields)&&ae&&Array.isArray(we(r.touchedFields,E))){const ce=V(we(r.touchedFields,E),oe.argA,oe.argB);le&&dt(r.touchedFields,E,ce)}(w.dirtyFields||y.dirtyFields)&&N(),x.state.next({name:E,isDirty:me(E,z),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else dt(l,E,z)},L=(E,z)=>{dt(r.errors,E,z),x.state.next({errors:r.errors})},k=E=>{r.errors=E,x.state.next({errors:r.errors,isValid:!1})},I=(E,z,V,oe)=>{const le=we(i,E);if(le){const ae=vt(we(l,E)),ce=we(l,E,vt(V)?we(a,E):V);vt(ce)||oe&&oe.defaultChecked||z?dt(l,E,z?ce:_y(le._f)):G(E,ce),d.mount&&!d.action&&(b(),ae&&r.isDirty&&(w.isDirty||y.isDirty)&&(me()||(r.isDirty=!1,x.state.next({...r}))))}},X=(E,z,V,oe,le)=>{let ae=!1,ce=!1;const Ae={name:E};if(!e.disabled){if(!V||oe){(w.isDirty||y.isDirty)&&(ce=r.isDirty,r.isDirty=Ae.isDirty=me(),ae=ce!==Ae.isDirty);const We=Nr(we(a,E),z);ce=!!we(r.dirtyFields,E),We?It(r.dirtyFields,E):dt(r.dirtyFields,E,!0),Ae.dirtyFields=r.dirtyFields,ae=ae||(w.dirtyFields||y.dirtyFields)&&ce!==!We}if(V){const We=we(r.touchedFields,E);We||(dt(r.touchedFields,E,V),Ae.touchedFields=r.touchedFields,ae=ae||(w.touchedFields||y.touchedFields)&&We!==V)}ae&&le&&x.state.next(Ae)}return ae?Ae:{}},re=(E,z,V,oe)=>{const le=we(r.errors,E),ae=(w.isValid||y.isValid)&&kr(z)&&r.isValid!==z;if(e.delayError&&V?(m=_(()=>L(E,V)),m(e.delayError)):(clearTimeout(p),m=null,V?dt(r.errors,E,V):It(r.errors,E)),(V?!Nr(le,V):le)||!Xt(oe)||ae){const ce={...oe,...ae&&kr(z)?{isValid:z}:{},errors:r.errors,name:E};r={...r,...ce},x.state.next(ce)}},de=async E=>(P(E,!0),await e.resolver(l,e.context,HN(E||f.mount,i,e.criteriaMode,e.shouldUseNativeValidation))),Z=async E=>{const{errors:z}=await de(E);if(P(E),E)for(const V of E){const oe=we(z,V);oe?dt(r.errors,V,oe):It(r.errors,V)}else r.errors=z;return z},Oe=async({name:E,eventType:z})=>{if(t.validate){const V=await t.validate({formValues:l,formState:r,name:E,eventType:z});if(Nt(V))for(const oe in V)V[oe]&&Ce(`${wd}.${oe}`,{message:en(V.message)?V.message:"",type:lr.validate});else en(V)||!V?Ce(wd,{message:V||"",type:lr.validate}):qe(wd);return V}return!0},J=async({fields:E,onlyCheckValid:z,name:V,eventType:oe,context:le={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(le.runRootValidation=!0,!await Oe({name:V,eventType:oe})&&(le.valid=!1,z)))return le.valid;for(const ae in E){const ce=E[ae];if(ce){const{_f:Ae,...We}=ce;if(Ae){const St=f.array.has(Ae.name),Tt=ce._f&&WN(ce._f);Tt&&w.validatingFields&&P([Ae.name],!0);const Ft=await Py(ce,f.disabled,l,S,e.shouldUseNativeValidation&&!z,St);if(Tt&&w.validatingFields&&P([Ae.name]),Ft[Ae.name]&&(le.valid=!1,z)||(!z&&(we(Ft,Ae.name)?St?YN(r.errors,Ft,Ae.name):dt(r.errors,Ae.name,Ft[Ae.name]):It(r.errors,Ae.name)),t.shouldUseNativeValidation&&Ft[Ae.name]))break}!Xt(We)&&await J({context:le,onlyCheckValid:z,fields:We,name:ae,eventType:oe})}}return le.valid},ve=()=>{for(const E of f.unMount){const z=we(i,E);z&&(z._f.refs?z._f.refs.every(V=>!bd(V)):!bd(z._f.ref))&&yn(E)}f.unMount=new Set},me=(E,z)=>!e.disabled&&(E&&z&&dt(l,E,z),!Nr(pe(),a)),M=(E,z,V)=>$N(E,f,{...d.mount?l:vt(z)?a:en(E)?{[E]:z}:z},V,z),R=E=>Uf(we(d.mount?l:a,E,e.shouldUnregister?we(a,E,[]):[])),G=(E,z,V={})=>{const oe=we(i,E);let le=z;if(oe){const ae=oe._f;ae&&(!ae.disabled&&dt(l,E,_x(z,ae)),le=ru(ae.ref)&&cn(z)?"":z,wx(ae.ref)?[...ae.ref.options].forEach(ce=>ce.selected=le.includes(ce.value)):ae.refs?go(ae.ref)?ae.refs.forEach(ce=>{(!ce.defaultChecked||!ce.disabled)&&(Array.isArray(le)?ce.checked=!!le.find(Ae=>Ae===ce.value):ce.checked=le===ce.value||!!le)}):ae.refs.forEach(ce=>ce.checked=ce.value===le):Bf(ae.ref)?ae.ref.value="":(ae.ref.value=le,ae.ref.type||x.state.next({name:E,values:At(l)})))}(V.shouldDirty||V.shouldTouch)&&X(E,le,V.shouldTouch,V.shouldDirty,!0),V.shouldValidate&&ue(E)},H=(E,z,V)=>{for(const oe in z){if(!z.hasOwnProperty(oe))return;const le=z[oe],ae=E+"."+oe,ce=we(i,ae);(f.array.has(E)||Nt(le)||ce&&!ce._f)&&!ei(le)?H(ae,le,V):G(ae,le,V)}},W=(E,z,V={})=>{const oe=we(i,E),le=f.array.has(E),ae=At(z),ce=we(l,E),Ae=Nr(ce,ae);if(dt(l,E,ae),le)x.array.next({name:E,values:At(l)}),(w.isDirty||w.dirtyFields||y.isDirty||y.dirtyFields)&&V.shouldDirty&&(N(),x.state.next({name:E,dirtyFields:r.dirtyFields,isDirty:me(E,ae)}));else{const We=Array.isArray(ae)&&!ae.length||Xt(ae);!oe||oe._f||cn(ae)||We?G(E,ae,V):H(E,ae,V)}if(!Ae){const We=Ny(E,f);x.state.next({...We&&r,name:d.mount||We?E:void 0,values:At(l)})}},K=E=>{const z=Kn(E)?E(l):E;Nr(l,z)||(l={...l,...z},x.state.next({...r,values:l}))},T=async E=>{d.mount=!0;const z=E.target;let V=z.name,oe=!0;const le=we(i,V),ae=We=>{oe=Number.isNaN(We)||ei(We)&&isNaN(We.getTime())||Nr(We,we(l,V,We))},ce=Sy(e.mode),Ae=Sy(e.reValidateMode);if(le){let We,St;const Tt=z.type?_y(le._f):LN(E),Ft=E.type===Ai.BLUR||E.type===Ai.FOCUS_OUT,$n=!KN(le._f)&&!t.validate&&!e.resolver&&!we(r.errors,V)&&!le._f.deps||GN(Ft,we(r.touchedFields,V),r.isSubmitted,Ae,ce),Ir=Ny(V,f,Ft);dt(l,V,Tt),Ft?(!z||!z.readOnly)&&(le._f.onBlur&&le._f.onBlur(E),m&&m(0)):le._f.onChange&&le._f.onChange(E);const Mr=X(V,Tt,Ft),es=!Xt(Mr)||Ir;if(!Ft&&x.state.next({name:V,type:E.type,values:At(l)}),$n)return(w.isValid||y.isValid)&&(e.mode==="onBlur"?Ft&&b():Ft||b()),es&&x.state.next({name:V,...Ir?{}:Mr});if(!e.resolver&&t.validate&&await Oe({name:V,eventType:E.type}),!Ft&&Ir&&x.state.next({...r}),e.resolver){const{errors:Fr}=await de([V]);if(P([V]),ae(Tt),oe){const mr=Cy(r.errors,i,V),Tn=Cy(Fr,i,mr.name||V);We=Tn.error,V=Tn.name,St=Xt(Fr)}}else P([V],!0),We=(await Py(le,f.disabled,l,S,e.shouldUseNativeValidation))[V],P([V]),ae(Tt),oe&&(We?St=!1:(w.isValid||y.isValid)&&(St=await J({fields:i,onlyCheckValid:!0,name:V,eventType:E.type})));oe&&(le._f.deps&&(!Array.isArray(le._f.deps)||le._f.deps.length>0)&&ue(le._f.deps),re(V,St,We,Mr))}},Q=(E,z)=>{if(we(r.errors,z)&&E.focus)return E.focus(),1},ue=async(E,z={})=>{let V,oe;const le=Ja(E);if(e.resolver){const ae=await Z(vt(E)?E:le);V=Xt(ae),oe=E?!le.some(ce=>we(ae,ce)):V}else E?(oe=(await Promise.all(le.map(async ae=>{const ce=we(i,ae);return await J({fields:ce&&ce._f?{[ae]:ce}:ce,eventType:Ai.TRIGGER})}))).every(Boolean),!(!oe&&!r.isValid)&&b()):oe=V=await J({fields:i,name:E,eventType:Ai.TRIGGER});return x.state.next({...!en(E)||(w.isValid||y.isValid)&&V!==r.isValid?{}:{name:E},...e.resolver||!E?{isValid:V}:{},errors:r.errors}),z.shouldFocus&&!oe&&Ya(i,Q,E?le:f.mount),oe},pe=(E,z)=>{let V={...d.mount?l:a};return z&&(V=xx(z.dirtyFields?r.dirtyFields:r.touchedFields,V)),vt(E)?V:en(E)?we(V,E):E.map(oe=>we(V,oe))},Le=(E,z)=>({invalid:!!we((z||r).errors,E),isDirty:!!we((z||r).dirtyFields,E),error:we((z||r).errors,E),isValidating:!!we(r.validatingFields,E),isTouched:!!we((z||r).touchedFields,E)}),qe=E=>{const z=E?Ja(E):void 0;z?.forEach(V=>It(r.errors,V)),z?z.forEach(V=>{x.state.next({name:V,errors:r.errors})}):x.state.next({errors:{}})},Ce=(E,z,V)=>{const oe=(we(i,E,{_f:{}})._f||{}).ref,le=we(r.errors,E)||{},{ref:ae,message:ce,type:Ae,...We}=le;dt(r.errors,E,{...We,...z,ref:oe}),x.state.next({name:E,errors:r.errors,isValid:!1}),V&&V.shouldFocus&&oe&&oe.focus&&oe.focus()},Ge=(E,z)=>Kn(E)?x.state.subscribe({next:V=>"values"in V&&E(V.values||M(void 0,z),V)}):M(E,z,!0),et=E=>x.state.subscribe({next:z=>{if(ZN(E.name,z.name,E.exact)&&QN(z,E.formState||w,vn,E.reRenderRoot)){const V={...l};E.callback({values:V,...r,...z,defaultValues:a})}}}).unsubscribe,Rt=E=>(d.mount=!0,y={...y,...E.formState},et({...E,formState:{...v,...E.formState}})),yn=(E,z={})=>{for(const V of E?Ja(E):f.mount)f.mount.delete(V),f.array.delete(V),z.keepValue||(It(i,V),It(l,V)),!z.keepError&&It(r.errors,V),!z.keepDirty&&It(r.dirtyFields,V),!z.keepTouched&&It(r.touchedFields,V),!z.keepIsValidating&&It(r.validatingFields,V),!e.shouldUnregister&&!z.keepDefaultValue&&It(a,V);x.state.next({values:At(l)}),x.state.next({...r,...z.keepDirty?{isDirty:me()}:{}}),!z.keepIsValid&&b()},Tr=({disabled:E,name:z})=>{if(kr(E)&&d.mount||E||f.disabled.has(z)){const le=f.disabled.has(z)!==!!E;E?f.disabled.add(z):f.disabled.delete(z),le&&d.mount&&!d.action&&b()}},Jn=(E,z={})=>{let V=we(i,E);const oe=kr(z.disabled)||kr(e.disabled),le=!f.registerName.has(E)&&V&&V._f&&!V._f.mount;return dt(i,E,{...V||{},_f:{...V&&V._f?V._f:{ref:{name:E}},name:E,mount:!0,...z}}),f.mount.add(E),V&&!le?Tr({disabled:kr(z.disabled)?z.disabled:e.disabled,name:E}):I(E,!0,z.value),{...oe?{disabled:z.disabled||e.disabled}:{},...e.progressive?{required:!!z.required,min:qa(z.min),max:qa(z.max),minLength:qa(z.minLength),maxLength:qa(z.maxLength),pattern:qa(z.pattern)}:{},name:E,onChange:T,onBlur:T,ref:ae=>{if(ae){f.registerName.add(E),Jn(E,z),f.registerName.delete(E),V=we(i,E);const ce=vt(ae.value)&&ae.querySelectorAll&&ae.querySelectorAll("input,select,textarea")[0]||ae,Ae=UN(ce),We=V._f.refs||[];if(Ae?We.find(St=>St===ce):ce===V._f.ref)return;dt(i,E,{_f:{...V._f,...Ae?{refs:[...We.filter(bd),ce,...Array.isArray(we(a,E))?[{}]:[]],ref:{type:ce.type,name:E}}:{ref:ce}}}),I(E,!1,void 0,ce)}else V=we(i,E,{}),V._f&&(V._f.mount=!1),(e.shouldUnregister||z.shouldUnregister)&&!(AN(f.array,E)&&d.action)&&f.unMount.add(E)}}},Lr=()=>e.shouldFocusError&&Ya(i,Q,f.mount),ui=E=>{kr(E)&&(x.state.next({disabled:E}),Ya(i,(z,V)=>{const oe=we(i,V);oe&&(z.disabled=oe._f.disabled||E,Array.isArray(oe._f.refs)&&oe._f.refs.forEach(le=>{le.disabled=oe._f.disabled||E}))},0,!1))},Yr=(E,z)=>async V=>{let oe;V&&(V.preventDefault&&V.preventDefault(),V.persist&&V.persist());let le=At(l);if(x.state.next({isSubmitting:!0}),e.resolver){const{errors:ae,values:ce}=await de();P(),r.errors=ae,le=At(ce)}else await J({fields:i,eventType:Ai.SUBMIT});if(f.disabled.size)for(const ae of f.disabled)It(le,ae);if(It(r.errors,yx),Xt(r.errors)){x.state.next({errors:{}});try{await E(le,V)}catch(ae){oe=ae}}else z&&await z({...r.errors},V),Lr(),setTimeout(Lr);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xt(r.errors)&&!oe,submitCount:r.submitCount+1,errors:r.errors}),oe)throw oe},Ms=(E,z={})=>{we(i,E)&&(vt(z.defaultValue)?W(E,At(we(a,E))):(W(E,z.defaultValue),dt(a,E,At(z.defaultValue))),z.keepTouched||It(r.touchedFields,E),z.keepDirty||(It(r.dirtyFields,E),r.isDirty=z.defaultValue?me(E,At(we(a,E))):me()),z.keepError||(It(r.errors,E),w.isValid&&b()),x.state.next({...r}))},Ar=(E,z={})=>{const V=E?At(E):a,oe=At(V),le=Xt(E),ae=le?a:oe;if(z.keepDefaultValues||(a=V),!z.keepValues){if(z.keepDirtyValues){const ce=new Set([...f.mount,...Object.keys(Qa(a,l))]);for(const Ae of Array.from(ce)){const We=we(r.dirtyFields,Ae),St=we(l,Ae),Tt=we(ae,Ae);We&&!vt(St)?dt(ae,Ae,St):!We&&!vt(Tt)&&W(Ae,Tt)}}else{if(zf&&vt(E))for(const ce of f.mount){const Ae=we(i,ce);if(Ae&&Ae._f){const We=Array.isArray(Ae._f.refs)?Ae._f.refs[0]:Ae._f.ref;if(ru(We)){const St=We.closest("form");if(St){St.reset();break}}}}if(z.keepFieldsRef)for(const ce of f.mount)W(ce,we(ae,ce));else i={}}l=e.shouldUnregister?z.keepDefaultValues?At(a):{}:At(ae),x.array.next({values:{...ae}}),x.state.next({values:{...ae}})}f={mount:z.keepDirtyValues?f.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},d.mount=!w.isValid||!!z.keepIsValid||!!z.keepDirtyValues||!e.shouldUnregister&&!Xt(ae),d.watch=!!e.shouldUnregister,d.keepIsValid=!!z.keepIsValid,d.action=!1,z.keepErrors||(r.errors={}),x.state.next({submitCount:z.keepSubmitCount?r.submitCount:0,isDirty:le?!1:z.keepDirty?r.isDirty:!!(z.keepDefaultValues&&!Nr(E,a)),isSubmitted:z.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:le?{}:z.keepDirtyValues?z.keepDefaultValues&&l?Qa(a,l):r.dirtyFields:z.keepDefaultValues&&E?Qa(a,E):z.keepDirty?r.dirtyFields:{},touchedFields:z.keepTouched?r.touchedFields:{},errors:z.keepErrors?r.errors:{},isSubmitSuccessful:z.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Xr=(E,z)=>Ar(Kn(E)?E(l):E,{...e.resetOptions,...z}),pr=(E,z={})=>{const V=we(i,E),oe=V&&V._f;if(oe){const le=oe.refs?oe.refs[0]:oe.ref;le.focus&&setTimeout(()=>{le.focus(),z.shouldSelect&&Kn(le.select)&&le.select()})}},vn=E=>{r={...r,...E}},Rn={control:{register:Jn,unregister:yn,getFieldState:Le,handleSubmit:Yr,setError:Ce,_subscribe:et,_runSchema:de,_updateIsValidating:P,_focusError:Lr,_getWatch:M,_getDirty:me,_setValid:b,_setFieldArray:F,_setDisabledField:Tr,_setErrors:k,_getFieldArray:R,_reset:Ar,_resetDefaultValues:()=>Kn(e.defaultValues)&&e.defaultValues().then(E=>{Xr(E,e.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:ve,_disableForm:ui,_subjects:x,_proxyFormState:w,get _fields(){return i},get _formValues(){return l},get _state(){return d},set _state(E){d=E},get _defaultValues(){return a},get _names(){return f},set _names(E){f=E},get _formState(){return r},get _options(){return e},set _options(E){e={...e,...E}}},subscribe:Rt,trigger:ue,register:Jn,handleSubmit:Yr,watch:Ge,setValue:W,setValues:K,getValues:pe,reset:Xr,resetField:Ms,clearErrors:qe,unregister:yn,setError:Ce,setFocus:pr,getFieldState:Le};return{...Rn,formControl:Rn}}function Zi(t={}){const e=ne.useRef(void 0),r=ne.useRef(void 0),[i,a]=ne.useState(()=>({...At(kx),isLoading:Kn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Kn(t.defaultValues)?void 0:t.defaultValues}));if(!e.current)if(t.formControl)e.current={...t.formControl,formState:i},t.defaultValues&&!Kn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:d,...f}=eC(t);e.current={...f,formState:i}}const l=e.current.control;return l._options=t,DN(()=>{const d=l._subscribe({formState:l._proxyFormState,callback:()=>a({...l._formState}),reRenderRoot:!0});return a(f=>({...f,isReady:!0})),l._formState.isReady=!0,d},[l]),ne.useEffect(()=>l._disableForm(t.disabled),[l,t.disabled]),ne.useEffect(()=>{t.mode&&(l._options.mode=t.mode),t.reValidateMode&&(l._options.reValidateMode=t.reValidateMode)},[l,t.mode,t.reValidateMode]),ne.useEffect(()=>{t.errors&&(l._setErrors(t.errors),l._focusError())},[l,t.errors]),ne.useEffect(()=>{t.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,t.shouldUnregister]),ne.useEffect(()=>{if(l._proxyFormState.isDirty){const d=l._getDirty();d!==i.isDirty&&l._subjects.state.next({isDirty:d})}},[l,i.isDirty]),ne.useEffect(()=>{var d;t.values&&!Nr(t.values,r.current)?(l._reset(t.values,{keepFieldsRef:!0,...l._options.resetOptions}),!((d=l._options.resetOptions)===null||d===void 0)&&d.keepIsValid||l._setValid(),r.current=t.values,a(f=>({...f}))):l._resetDefaultValues()},[l,t.values]),ne.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),e.current.formState=ne.useMemo(()=>FN(i,l),[l,i]),e.current}const Oy=(t,e,r)=>{if(t&&"reportValidity"in t){const i=we(r,e);t.setCustomValidity(i&&i.message||""),t.reportValidity()}},Nx=(t,e)=>{for(const r in e.fields){const i=e.fields[r];i&&i.ref&&"reportValidity"in i.ref?Oy(i.ref,r,t):i.refs&&i.refs.forEach(a=>Oy(a,r,t))}},tC=(t,e)=>{e.shouldUseNativeValidation&&Nx(t,e);const r={};for(const i in t){const a=we(e.fields,i),l=Object.assign(t[i]||{},{ref:a&&a.ref});if(nC(e.names||Object.keys(t),i)){const d=Object.assign({},we(r,i));dt(d,"root",l),dt(r,i,d)}else dt(r,i,l)}return r},nC=(t,e)=>t.some(r=>r.startsWith(e+"."));var rC=function(t,e){for(var r={};t.length;){var i=t[0],a=i.code,l=i.message,d=i.path.join(".");if(!r[d])if("unionErrors"in i){var f=i.unionErrors[0].errors[0];r[d]={message:f.message,type:f.code}}else r[d]={message:l,type:a};if("unionErrors"in i&&i.unionErrors.forEach(function(v){return v.errors.forEach(function(w){return t.push(w)})}),e){var m=r[d].types,p=m&&m[i.code];r[d]=vx(d,e,r,a,p?[].concat(p,i.message):i.message)}t.shift()}return r},Gi=function(t,e,r){return r===void 0&&(r={}),function(i,a,l){try{return Promise.resolve((function(d,f){try{var m=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(p){return l.shouldUseNativeValidation&&Nx({},l),{errors:{},values:r.raw?i:p}})}catch(p){return f(p)}return m&&m.then?m.then(void 0,f):m})(0,function(d){if((function(f){return Array.isArray(f?.errors)})(d))return{values:{},errors:tC(rC(d.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw d}))}catch(d){return Promise.reject(d)}}};const ge=$.forwardRef(({className:t,...e},r)=>u.jsx("div",{ref:r,className:_t("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));ge.displayName="Card";const Ue=$.forwardRef(({className:t,...e},r)=>u.jsx("div",{ref:r,className:_t("flex flex-col space-y-1.5 p-6",t),...e}));Ue.displayName="CardHeader";const Ve=$.forwardRef(({className:t,...e},r)=>u.jsx("h3",{ref:r,className:_t("text-lg font-semibold leading-none tracking-tight",t),...e}));Ve.displayName="CardTitle";const Qe=$.forwardRef(({className:t,...e},r)=>u.jsx("p",{ref:r,className:_t("text-sm text-muted-foreground",t),...e}));Qe.displayName="CardDescription";const ye=$.forwardRef(({className:t,...e},r)=>u.jsx("div",{ref:r,className:_t("p-6 pt-0",t),...e}));ye.displayName="CardContent";const sC=$.forwardRef(({className:t,...e},r)=>u.jsx("div",{ref:r,className:_t("flex items-center p-6 pt-0",t),...e}));sC.displayName="CardFooter";const xt=$.forwardRef(({className:t,type:e="text",...r},i)=>u.jsx("input",{type:e,ref:i,className:_t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...r}));xt.displayName="Input";const Ye=$.forwardRef(({className:t,...e},r)=>u.jsx("label",{ref:r,className:_t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Ye.displayName="Label";function pn({className:t,...e}){return u.jsx("div",{className:_t("animate-pulse rounded-md bg-muted",t),...e})}const iC=Be({domain:D(),entity_types:it(D()),predicates:it(D()),attribute_count:Ne().int()}),aC=it(iC),oC={list:()=>rt.get("/domains",aC)},lC=Be({domain:D(),entity_types:it(D()),predicates:it(D()),attributes:it(D()),aliases:li(D(),D()).default({})}),uC={get:t=>rt.get(`/ontology/${encodeURIComponent(t)}`,lC)};function cC(){return On({queryKey:Ie.domains.list(),queryFn:()=>oC.list(),staleTime:1e3*60*30})}function Cx(t){return On({queryKey:Ie.ontology.byDomain(t??""),queryFn:()=>uC.get(t),enabled:!!t,staleTime:1e3*60*30})}const dC=/^[a-zA-Z0-9_-]+$/,fC=Be({project_name:D().min(2,"최소 2자 이상").max(64,"최대 64자").regex(dC,"영문/숫자/_/- 만 허용"),domain:D().min(1,"도메인을 선택하세요")});function hC(){const t=mn(),{t:e}=oi(),{data:r,isLoading:i,isError:a,error:l,refetch:d}=cC(),f=EN(),{register:m,handleSubmit:p,watch:v,setValue:w,formState:{errors:y,isSubmitting:x}}=Zi({resolver:Gi(fC),defaultValues:{project_name:"",domain:""}}),S=v("domain"),_=async b=>{const P=r?.find(N=>N.domain===b.domain);try{const N=await f.mutateAsync({project_name:b.project_name,domain:b.domain,target_entities:P?.entity_types??[]});jt.success(e("onboarding.created","프로젝트가 생성되었습니다: {{name}}",{name:N.name})),t(`/sources/${N.name}`)}catch(N){jt.error(e("onboarding.createFailed","생성 실패: {{msg}}",{msg:N.message}))}};return u.jsxs("div",{className:"mx-auto max-w-3xl px-6 py-10",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t("/"),"aria-label":e("common.back","이전"),children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("onboarding.title","새 프로젝트 만들기")})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:e("onboarding.formTitle","온톨로지 도메인 선택")}),u.jsx(Qe,{children:e("onboarding.formDesc","어떤 종류의 온톨로지를 구축할지 도메인을 선택하고 프로젝트 이름을 정해주세요.")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:p(_),className:"space-y-6",noValidate:!0,children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ye,{htmlFor:"project_name",children:e("onboarding.projectName","프로젝트 이름")}),u.jsx(xt,{id:"project_name",placeholder:"my_perfume_project","aria-invalid":!!y.project_name,...m("project_name")}),y.project_name&&u.jsx("p",{className:"text-sm text-destructive",children:y.project_name.message}),u.jsx("p",{className:"text-xs text-muted-foreground",children:e("onboarding.projectNameHint","영문, 숫자, _ , - 만 사용 (2~64자)")})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ye,{children:e("onboarding.domain","도메인")}),a&&u.jsx(ge,{className:"border-destructive",children:u.jsxs(ye,{className:"flex items-center justify-between gap-3 py-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),u.jsx("span",{children:l.message})]}),u.jsx(Ee,{variant:"outline",size:"sm",type:"button",onClick:()=>d(),children:e("common.retry","다시 시도")})]})}),i&&u.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:Array.from({length:4}).map((b,P)=>u.jsx(pn,{className:"h-24"},P))}),r&&u.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:r.map(b=>{const P=S===b.domain;return u.jsxs("button",{type:"button",onClick:()=>w("domain",b.domain,{shouldValidate:!0}),className:_t("rounded-lg border bg-card p-4 text-left transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",P&&"border-primary bg-accent/60"),children:[u.jsx("div",{className:"mb-1 font-semibold capitalize",children:b.domain}),u.jsx("div",{className:"text-xs text-muted-foreground",children:e("onboarding.domainSummary",{entities:b.entity_types.length,predicates:b.predicates.length,defaultValue:"엔티티 {{entities}}종 · 관계 {{predicates}}개"})}),u.jsxs("div",{className:"mt-2 line-clamp-2 text-xs text-muted-foreground/70",children:[b.entity_types.slice(0,5).join(", "),b.entity_types.length>5&&" …"]})]},b.domain)})}),y.domain&&u.jsx("p",{className:"text-sm text-destructive",children:y.domain.message})]}),u.jsxs("div",{className:"flex justify-end gap-3 border-t pt-4",children:[u.jsx(Ee,{type:"button",variant:"outline",onClick:()=>t("/"),disabled:x||f.isPending,children:e("common.cancel","취소")}),u.jsxs(Ee,{type:"submit",disabled:x||f.isPending,children:[f.isPending&&u.jsx(dr,{className:"h-4 w-4 animate-spin"}),e("onboarding.submit","프로젝트 만들기")]})]})]})})]})]})}const pC=Be({id:nn([D(),Ne()]).transform(String),name:D(),type:D(),base_url:D().nullable().optional(),trust_level:Ne().nullable().optional(),respect_robots_txt:Rr().nullable().optional(),rate_limit_per_minute:Ne().nullable().optional()}),mC=Be({ok:Rr(),deleted:D()}),Ex={create:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/sources`,pC,e),delete:(t,e)=>rt.delete(`/projects/${encodeURIComponent(t)}/sources/${encodeURIComponent(e)}`,mC)};function gC(t){const e=Kt();return gn({mutationFn:r=>Ex.create(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.projects.detail(t)})}})}function yC(t){const e=Kt();return gn({mutationFn:r=>Ex.delete(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.projects.detail(t)})}})}const Px=["official","review","blog","news","community","unknown"],vC=Be({name:D().min(2,"최소 2자 이상").max(64,"최대 64자").regex(/^[a-zA-Z0-9_-]+$/,"영문/숫자/_/-만 허용"),type:hx(Px),base_url:D().url("올바른 URL 형식이 아닙니다").or(fx("")).optional(),trust_level:Ne({invalid_type_error:"0~1 사이의 숫자"}).min(0).max(1),rate_limit_per_minute:Ne({invalid_type_error:"양의 정수"}).int().min(1).max(600),respect_robots_txt:Rr()});function xC(){const t=mn(),{projectId:e}=fr(),{t:r}=oi(),i=e??"",{data:a,isLoading:l,isError:d,error:f,refetch:m}=hr(i),p=gC(i),v=yC(i),{register:w,handleSubmit:y,reset:x,formState:{errors:S,isSubmitting:_}}=Zi({resolver:Gi(vC),defaultValues:{name:"",type:"official",base_url:"",trust_level:.7,rate_limit_per_minute:30,respect_robots_txt:!0}}),b=async N=>{try{await p.mutateAsync({...N,base_url:N.base_url||null}),jt.success(r("sources.added","소스가 추가되었습니다: {{name}}",{name:N.name})),x()}catch(F){jt.error(r("sources.addFailed","추가 실패: {{msg}}",{msg:F.message}))}},P=async N=>{if(confirm(r("sources.confirmDelete","정말 '{{name}}' 소스를 삭제하시겠습니까?",{name:N})))try{await v.mutateAsync(N),jt.success(r("sources.deleted","소스가 삭제되었습니다: {{name}}",{name:N}))}catch(F){jt.error(r("sources.deleteFailed","삭제 실패: {{msg}}",{msg:F.message}))}};return u.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-10",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t("/"),"aria-label":r("common.back","이전"),children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:r("sources.title","참고 소스 설정")}),a&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.name," ",u.jsxs("span",{className:"capitalize text-muted-foreground/70",children:["· ",a.domain]})]})]}),u.jsxs(Ee,{onClick:()=>t(`/crawl/${i}`),disabled:!a||(a.sources?.length??0)===0,children:[r("sources.next","크롤 진행"),u.jsx(Lv,{className:"h-4 w-4"})]})]}),d&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center justify-between gap-3 py-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),u.jsx("span",{children:f.message})]}),u.jsx(Ee,{variant:"outline",size:"sm",type:"button",onClick:()=>m(),children:r("common.retry","다시 시도")})]})}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_360px]",children:[u.jsx("section",{children:u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("sources.listTitle","등록된 소스")}),u.jsx(Qe,{children:r("sources.listDesc","프로젝트 온톨로지 구축에 사용할 참고 사이트 목록")})]}),u.jsxs(ye,{children:[l&&u.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((N,F)=>u.jsx(pn,{className:"h-16"},F))}),a&&a.sources.length===0&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:r("sources.empty","아직 등록된 소스가 없습니다. 오른쪽 폼에서 추가하세요.")}),a&&a.sources.length>0&&u.jsx("ul",{className:"divide-y",children:a.sources.map(N=>u.jsxs("li",{className:"flex items-center justify-between gap-4 py-3",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"font-medium",children:N.name}),u.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 text-xs text-secondary-foreground",children:N.type}),typeof N.trust_level=="number"&&u.jsxs("span",{className:"text-xs text-muted-foreground",children:[r("sources.trust","신뢰도")," ",N.trust_level.toFixed(2)]})]}),N.base_url&&u.jsxs("a",{href:N.base_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[u.jsx(Mv,{className:"h-3 w-3"}),N.base_url]})]}),u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>P(N.name),disabled:v.isPending,"aria-label":r("sources.delete","삭제"),children:u.jsx(Kd,{className:"h-4 w-4 text-destructive"})})]},N.id))})]})]})}),u.jsx("aside",{children:u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("sources.addTitle","소스 추가")}),u.jsx(Qe,{children:r("sources.addDesc","참고할 사이트 정보를 입력하세요")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:y(b),className:"space-y-4",noValidate:!0,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"src_name",children:r("sources.name","이름")}),u.jsx(xt,{id:"src_name",placeholder:"official_brand_site",...w("name")}),S.name&&u.jsx("p",{className:"text-xs text-destructive",children:S.name.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"src_type",children:r("sources.type","타입")}),u.jsx("select",{id:"src_type",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",...w("type"),children:Px.map(N=>u.jsx("option",{value:N,children:N},N))})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"src_url",children:r("sources.baseUrl","Base URL")}),u.jsx(xt,{id:"src_url",placeholder:"https://example.com",type:"url",...w("base_url")}),S.base_url&&u.jsx("p",{className:"text-xs text-destructive",children:S.base_url.message})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"src_trust",children:r("sources.trust","신뢰도")}),u.jsx(xt,{id:"src_trust",type:"number",step:"0.05",min:0,max:1,...w("trust_level",{valueAsNumber:!0})}),S.trust_level&&u.jsx("p",{className:"text-xs text-destructive",children:S.trust_level.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"src_rate",children:r("sources.rateLimit","rate/분")}),u.jsx(xt,{id:"src_rate",type:"number",min:1,max:600,...w("rate_limit_per_minute",{valueAsNumber:!0})}),S.rate_limit_per_minute&&u.jsx("p",{className:"text-xs text-destructive",children:S.rate_limit_per_minute.message})]})]}),u.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[u.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",...w("respect_robots_txt")}),u.jsx("span",{children:r("sources.respectRobots","robots.txt 준수")})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:_||p.isPending,children:[p.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(ri,{className:"h-4 w-4"}),r("sources.add","소스 추가")]})]})})]})})]})]})}const En=$.forwardRef(({className:t,children:e,...r},i)=>u.jsx("select",{ref:i,className:_t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e}));En.displayName="Select";const Ji=$.forwardRef(({className:t,value:e=0,max:r=100,indeterminate:i,...a},l)=>{const d=Math.min(100,Math.max(0,e/r*100));return u.jsx("div",{ref:l,role:"progressbar","aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":i?void 0:e,className:_t("relative h-2 w-full overflow-hidden rounded-full bg-secondary",t),...a,children:u.jsx("div",{className:_t("h-full bg-primary transition-all",i&&"w-1/3 animate-pulse"),style:i?void 0:{width:`${d}%`}})})});Ji.displayName="Progress";const wC=ox("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",success:"border-transparent bg-green-100 text-green-800",warning:"border-transparent bg-yellow-100 text-yellow-800"}},defaultVariants:{variant:"default"}});function Xe({className:t,variant:e,...r}){return u.jsx("span",{className:_t(wC({variant:e}),t),...r})}const bC=nn([D(),Ne()]).transform(String),Ry=Be({url:D().optional(),status:D().optional(),page_type:D().optional(),title:D().nullable().optional(),error:D().nullable().optional()}).passthrough(),jC=Be({seed_url:D().optional(),visited_count:Ne().optional(),analyzed_count:Ne().optional(),queued_count:Ne().optional(),skipped_count:Ne().optional(),errors:it(D()).optional(),pages:it(Ry).optional(),latest_page:Ry.optional()}).passthrough(),jd=Be({job_id:bC,status:D(),url:D().nullable().optional(),error:D().nullable().optional(),scheduled_at:D().nullable().optional(),started_at:D().nullable().optional(),finished_at:D().nullable().optional(),progress:jC.default({}),request:li(D(),dn()).default({})}),_C=new Set(["completed","failed","canceled"]);function Ox(t){return _C.has(t)}const Hf={startByProject:t=>rt.post("/crawl-site/by-project",jd,t),getJob:t=>rt.get(`/crawl-site/jobs/${encodeURIComponent(t)}`,jd),cancel:t=>rt.post(`/crawl-site/jobs/${encodeURIComponent(t)}/cancel`,jd)},Ty=2e3;function SC(){const t=Kt();return gn({mutationFn:e=>Hf.startByProject(e),onSuccess:e=>{t.setQueryData(Ie.crawl.job(e.job_id),e)}})}function kC(t){return On({queryKey:Ie.crawl.job(t??""),queryFn:()=>Hf.getJob(t),enabled:!!t,refetchInterval:e=>{const r=e.state.data;return r&&Ox(r.status)?!1:Ty},refetchIntervalInBackground:!1})}function NC(){const t=Kt();return gn({mutationFn:e=>Hf.cancel(e),onSuccess:e=>{t.setQueryData(Ie.crawl.job(e.job_id),e)}})}const CC=Be({source_name:D().min(1,"소스를 선택하세요"),url:D().url("올바른 URL 형식이 아닙니다"),max_depth:Ne().int().min(0).max(10),max_pages:Ne().int().min(1).max(500),same_domain_only:Rr()});function EC(t){switch(t){case"completed":return"success";case"failed":return"destructive";case"canceled":return"secondary";case"cancel_requested":return"warning";case"running":case"pending":return"default";default:return"outline"}}function PC({status:t}){return u.jsx(Xe,{variant:EC(t),children:t})}function OC(){const t=mn(),{projectId:e}=fr(),{t:r}=oi(),i=e??"",{data:a,isLoading:l,isError:d,error:f,refetch:m}=hr(i),[p,v]=$.useState(null),{data:w}=kC(p),y=SC(),x=NC(),{register:S,handleSubmit:_,setValue:b,watch:P,formState:{errors:N,isSubmitting:F}}=Zi({resolver:Gi(CC),defaultValues:{source_name:"",url:"",max_depth:2,max_pages:30,same_domain_only:!0}}),L=async H=>{try{const W=await y.mutateAsync({project_name:i,...H});v(W.job_id),jt.success(r("crawl.started","크롤이 시작되었습니다 (job #{{id}})",{id:W.job_id}))}catch(W){jt.error(r("crawl.startFailed","시작 실패: {{msg}}",{msg:W.message}))}},k=async()=>{if(p)try{await x.mutateAsync(p),jt.info(r("crawl.cancelRequested","취소 요청됨"))}catch(H){jt.error(r("crawl.cancelFailed","취소 실패: {{msg}}",{msg:H.message}))}},I=a?.sources??[],X=P("source_name"),re=I.find(H=>H.name===X),de=w?.progress,Z=de?.visited_count??0,Oe=de?.queued_count??0,J=de?.analyzed_count??0,ve=de?.errors??[],me=P("max_pages"),M=w&&me?Math.min(100,Z/me*100):0,R=w?Ox(w.status):!1,G=w&&!R;return u.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-10",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/sources/${i}`),"aria-label":r("common.back","이전"),children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:r("crawl.title","시드 크롤")}),a&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.name,u.jsxs("span",{className:"capitalize text-muted-foreground/70",children:[" ","· ",a.domain]})]})]}),R&&w?.status==="completed"&&u.jsxs(Ee,{onClick:()=>t(`/pipeline/${i}`),children:[r("crawl.review","파이프라인 확인"),u.jsx(Lv,{className:"h-4 w-4"})]})]}),d&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center justify-between gap-3 py-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),u.jsx("span",{children:f.message})]}),u.jsx(Ee,{variant:"outline",size:"sm",type:"button",onClick:()=>m(),children:r("common.retry","다시 시도")})]})}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[420px_1fr]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("crawl.formTitle","크롤 설정")}),u.jsx(Qe,{children:r("crawl.formDesc","시드 URL에서 시작해 링크를 따라가며 정보를 추출합니다")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:_(L),className:"space-y-4",noValidate:!0,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"source_name",children:r("crawl.source","참고 소스")}),l?u.jsx(pn,{className:"h-10"}):u.jsxs(En,{id:"source_name",...S("source_name"),onChange:H=>{const W=H.target.value,K=I.find(T=>T.name===W);b("source_name",W,{shouldValidate:!0,shouldDirty:!0}),b("url",K?.base_url??"",{shouldValidate:!!K?.base_url,shouldDirty:!0})},children:[u.jsx("option",{value:"",children:r("crawl.pickSource","소스를 선택하세요...")}),I.map(H=>u.jsxs("option",{value:H.name,children:[H.name," (",H.type,")"]},H.id))]}),I.length===0&&!l&&u.jsxs("p",{className:"text-xs text-muted-foreground",children:[r("crawl.noSources","등록된 소스가 없습니다. 먼저 참고 소스를 추가하세요.")," ",u.jsx("button",{type:"button",className:"text-primary underline",onClick:()=>t(`/sources/${i}`),children:r("crawl.addSource","소스 추가")})]}),N.source_name&&u.jsx("p",{className:"text-xs text-destructive",children:N.source_name.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"url",children:r("crawl.seedUrl","시드 URL")}),u.jsx(xt,{id:"url",placeholder:re?.base_url??"https://example.com/start",...S("url")}),N.url&&u.jsx("p",{className:"text-xs text-destructive",children:N.url.message})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"max_depth",children:r("crawl.maxDepth","최대 깊이")}),u.jsx(xt,{id:"max_depth",type:"number",min:0,max:10,...S("max_depth",{valueAsNumber:!0})}),N.max_depth&&u.jsx("p",{className:"text-xs text-destructive",children:N.max_depth.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"max_pages",children:r("crawl.maxPages","최대 페이지")}),u.jsx(xt,{id:"max_pages",type:"number",min:1,max:500,...S("max_pages",{valueAsNumber:!0})}),N.max_pages&&u.jsx("p",{className:"text-xs text-destructive",children:N.max_pages.message})]})]}),u.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[u.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",...S("same_domain_only")}),u.jsx("span",{children:r("crawl.sameDomainOnly","동일 도메인만 따라가기")})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:F||y.isPending||!!G,children:[y.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx($v,{className:"h-4 w-4"}),r("crawl.start","크롤 시작")]})]})})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:r("crawl.progressTitle","진행 상태")}),w&&u.jsxs(Qe,{className:"flex items-center gap-2",children:[u.jsxs("span",{children:["job #",w.job_id]}),u.jsx(PC,{status:w.status})]})]}),G&&u.jsxs(Ee,{variant:"outline",size:"sm",onClick:k,disabled:x.isPending,children:[u.jsx(aS,{className:"h-4 w-4"}),r("crawl.cancel","취소")]})]})}),u.jsxs(ye,{children:[!w&&u.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center text-muted-foreground",children:[u.jsx(yS,{className:"h-12 w-12 opacity-40"}),u.jsx("p",{children:r("crawl.idleHint","왼쪽에서 시드 URL을 입력하고 시작하세요")})]}),w&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"mb-1 flex items-center justify-between text-sm",children:[u.jsxs("span",{className:"text-muted-foreground",children:[r("crawl.visited","방문")," ",Z," / ",me]}),u.jsxs("span",{className:"text-muted-foreground",children:[r("crawl.queued","대기")," ",Oe," ·"," ",r("crawl.analyzed","분석")," ",J]})]}),u.jsx(Ji,{value:M,indeterminate:G&&Z===0})]}),w.url&&u.jsxs("div",{className:"rounded-md bg-secondary/30 px-3 py-2 text-xs",children:[u.jsx("div",{className:"text-muted-foreground",children:r("crawl.seedUrl","시드 URL")}),u.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"break-all text-foreground hover:underline",children:w.url})]}),de?.latest_page&&u.jsxs("div",{className:"rounded-md border bg-background px-3 py-2 text-xs",children:[u.jsx("div",{className:"mb-1 text-muted-foreground",children:r("crawl.latestPage","최근 페이지")}),u.jsx("div",{className:"truncate font-medium",children:de.latest_page.title||de.latest_page.url}),de.latest_page.page_type&&u.jsx(Xe,{variant:"outline",className:"mt-1",children:de.latest_page.page_type})]}),w.error&&u.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive bg-destructive/5 px-3 py-2 text-sm text-destructive",children:[u.jsx(OS,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),u.jsx("span",{children:w.error})]}),ve.length>0&&u.jsxs("details",{className:"rounded-md border bg-background",children:[u.jsx("summary",{className:"cursor-pointer px-3 py-2 text-sm font-medium",children:r("crawl.errorsCount","에러 {{count}}건",{count:ve.length})}),u.jsx("ul",{className:"max-h-40 overflow-y-auto px-4 py-2 text-xs text-muted-foreground",children:ve.map((H,W)=>u.jsx("li",{className:"border-b py-1 last:border-0",children:H},W))})]}),R&&w.status==="completed"&&u.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-700",children:[u.jsx(_f,{className:"h-4 w-4"}),r("crawl.doneHint","크롤 완료. 구축 파이프라인으로 이동하세요.")]})]})]})]})]})]})}const ho=$.forwardRef(({className:t,...e},r)=>u.jsx("textarea",{ref:r,className:_t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e}));ho.displayName="Textarea";const pf=nn([D(),Ne()]).transform(String),RC=Be({job_id:pf.optional(),project_id:pf.optional(),project_name:D().optional(),goal:D().optional(),status:D().optional(),started_at:D().nullable().optional(),finished_at:D().nullable().optional(),steps_taken:Ne().optional(),pages_visited:Ne().optional(),entities_found:Ne().optional(),claims_added:Ne().optional(),error:D().nullable().optional()}).passthrough(),Rx=Be({job_id:pf,status:D().optional(),goal:D().nullable().optional(),seed_url:D().nullable().optional(),started_at:D().nullable().optional(),finished_at:D().nullable().optional(),steps_taken:Ne().nullable().optional(),pages_visited:Ne().nullable().optional(),entities_found:Ne().nullable().optional()}).passthrough(),TC=it(Rx),LC=Rx.extend({trace:it(li(D(),dn())).optional()}),Tx={startByProject:t=>rt.post("/research/run/by-project",RC,t),listSessions:(t,e=25)=>rt.get(`/projects/${encodeURIComponent(t)}/research/sessions`,TC,{query:{limit:e}}),getSession:t=>rt.get(`/research/sessions/${encodeURIComponent(t)}`,LC)};function AC(t){const e=Kt();return gn({mutationFn:r=>Tx.startByProject(r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.research.sessions(t)})}})}function IC(t,e=25){return On({queryKey:Ie.research.sessions(t),queryFn:()=>Tx.listSessions(t,e),enabled:!!t})}const MC=Be({source_name:D().min(1,"소스를 선택하세요"),url:D().url("올바른 URL 형식이 아닙니다").or(fx("")).optional(),goal:D().min(3,"최소 3자").max(500,"최대 500자"),max_depth:Ne().int().min(0).max(10),max_steps:Ne().int().min(1).max(50),max_branch:Ne().int().min(1).max(30),min_relevance:Ne().min(0).max(1),same_domain_only:Rr()});function FC(t){switch(t){case"completed":return"success";case"failed":return"destructive";case"canceled":return"secondary";case"running":case"pending":return"default";default:return"outline"}}function DC(){const t=mn(),{projectId:e}=fr(),{t:r}=oi(),i=e??"",{data:a,isLoading:l,isError:d,error:f,refetch:m}=hr(i),p=IC(i),v=AC(i),[w,y]=$.useState(null),{register:x,handleSubmit:S,setValue:_,formState:{errors:b,isSubmitting:P}}=Zi({resolver:Gi(MC),defaultValues:{source_name:"",url:"",goal:"Semantic ontology exploration",max_depth:2,max_steps:12,max_branch:8,min_relevance:.35,same_domain_only:!0}}),N=async L=>{try{y(null);const k=await v.mutateAsync({project_name:i,source_name:L.source_name,url:L.url||void 0,goal:L.goal,max_depth:L.max_depth,max_steps:L.max_steps,max_branch:L.max_branch,min_relevance:L.min_relevance,same_domain_only:L.same_domain_only});y(k),jt.success(r("research.completed","자율 연구가 완료되었습니다"))}catch(k){jt.error(r("research.failed","실패: {{msg}}",{msg:k.message}))}},F=a?.sources??[];return u.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-10",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/sources/${i}`),"aria-label":r("common.back","이전"),children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Av,{className:"h-6 w-6 text-primary"}),r("research.title","자율 연구")]}),a&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.name,u.jsxs("span",{className:"capitalize text-muted-foreground/70",children:[" ","· ",a.domain]})]})]})]}),d&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center justify-between gap-3 py-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),u.jsx("span",{children:f.message})]}),u.jsx(Ee,{variant:"outline",size:"sm",type:"button",onClick:()=>m(),children:r("common.retry","다시 시도")})]})}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[460px_1fr]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(ES,{className:"h-5 w-5"}),r("research.formTitle","자율 연구 설정")]}),u.jsx(Qe,{children:r("research.formDesc","AI가 시드에서 시작해 스스로 링크를 따라가며 온톨로지를 확장합니다")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:S(N),className:"space-y-4",noValidate:!0,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"source_name",children:r("research.source","참고 소스")}),l?u.jsx(pn,{className:"h-10"}):u.jsxs(En,{id:"source_name",...x("source_name"),onChange:L=>_("source_name",L.target.value,{shouldValidate:!0}),children:[u.jsx("option",{value:"",children:r("research.pickSource","소스를 선택하세요...")}),F.map(L=>u.jsxs("option",{value:L.name,children:[L.name," (",L.type,")"]},L.id))]}),b.source_name&&u.jsx("p",{className:"text-xs text-destructive",children:b.source_name.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"goal",children:r("research.goal","목표")}),u.jsx(ho,{id:"goal",rows:2,placeholder:r("research.goalPlaceholder","예: 인기 브랜드 향수의 노트 구성과 시즌 추천 정보 수집"),...x("goal")}),b.goal&&u.jsx("p",{className:"text-xs text-destructive",children:b.goal.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs(Ye,{htmlFor:"url",children:[r("research.seedUrl","시드 URL")," ",u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r("research.optional","선택"),")"]})]}),u.jsx(xt,{id:"url",placeholder:"https://example.com/start",...x("url")}),b.url&&u.jsx("p",{className:"text-xs text-destructive",children:b.url.message})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"max_steps",children:r("research.maxSteps","최대 단계")}),u.jsx(xt,{id:"max_steps",type:"number",min:1,max:50,...x("max_steps",{valueAsNumber:!0})}),b.max_steps&&u.jsx("p",{className:"text-xs text-destructive",children:b.max_steps.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"max_branch",children:r("research.maxBranch","분기 폭")}),u.jsx(xt,{id:"max_branch",type:"number",min:1,max:30,...x("max_branch",{valueAsNumber:!0})}),b.max_branch&&u.jsx("p",{className:"text-xs text-destructive",children:b.max_branch.message})]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"max_depth",children:r("research.maxDepth","최대 깊이")}),u.jsx(xt,{id:"max_depth",type:"number",min:0,max:10,...x("max_depth",{valueAsNumber:!0})})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"min_relevance",children:r("research.minRelevance","최소 관련도")}),u.jsx(xt,{id:"min_relevance",type:"number",step:"0.05",min:0,max:1,...x("min_relevance",{valueAsNumber:!0})})]})]}),u.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[u.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",...x("same_domain_only")}),u.jsx("span",{children:r("research.sameDomainOnly","동일 도메인만 탐색")})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:P||v.isPending,children:[v.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(CS,{className:"h-4 w-4"}),r("research.start","자율 연구 시작")]}),v.isPending&&u.jsx("p",{className:"text-xs text-muted-foreground",children:r("research.runningHint","장시간 걸릴 수 있습니다. 완료될 때까지 페이지를 닫지 마세요.")})]})})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("research.resultTitle","최근 결과")}),u.jsx(Qe,{children:r("research.resultDesc","이번 세션에서 실행된 연구의 결과")})]}),u.jsxs(ye,{children:[!w&&!v.isPending&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:r("research.idleHint","왼쪽에서 자율 연구를 시작하면 결과가 여기에 표시됩니다")}),v.isPending&&u.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 text-center text-muted-foreground",children:[u.jsx(dr,{className:"h-8 w-8 animate-spin text-primary"}),u.jsx("p",{children:r("research.runningTitle","AI가 연구 중입니다...")})]}),w&&!v.isPending&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-700",children:[u.jsx(_f,{className:"h-4 w-4"}),r("research.doneHint","완료")]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm sm:grid-cols-4",children:[u.jsx(Rl,{label:r("research.stepsTaken","단계"),value:w.steps_taken}),u.jsx(Rl,{label:r("research.pagesVisited","페이지"),value:w.pages_visited}),u.jsx(Rl,{label:r("research.entitiesFound","엔티티"),value:w.entities_found}),u.jsx(Rl,{label:r("research.claimsAdded","클레임"),value:w.claims_added})]}),w.error&&u.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive bg-destructive/5 px-3 py-2 text-sm text-destructive",children:[u.jsx(fn,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),u.jsx("span",{children:w.error})]}),u.jsxs("details",{className:"rounded-md border bg-background",children:[u.jsx("summary",{className:"cursor-pointer px-3 py-2 text-sm font-medium",children:r("research.rawResult","원시 응답 JSON")}),u.jsx("pre",{className:"max-h-64 overflow-auto px-4 py-2 text-xs text-muted-foreground",children:JSON.stringify(w,null,2)})]})]})]})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(xS,{className:"h-5 w-5"}),r("research.historyTitle","세션 이력")]}),u.jsx(Qe,{children:r("research.historyDesc","이 프로젝트의 자율 연구 세션 기록")})]}),u.jsxs(ye,{children:[p.isLoading&&u.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((L,k)=>u.jsx(pn,{className:"h-12"},k))}),p.data&&p.data.length===0&&u.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:r("research.historyEmpty","아직 실행된 세션이 없습니다")}),p.data&&p.data.length>0&&u.jsx("ul",{className:"divide-y",children:p.data.map(L=>u.jsxs("li",{className:"flex items-center justify-between gap-3 py-3 text-sm",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("span",{className:"font-medium",children:["#",L.job_id]}),L.status&&u.jsx(Xe,{variant:FC(L.status),children:L.status})]}),L.goal&&u.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:L.goal})]}),u.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[typeof L.pages_visited=="number"&&u.jsxs("div",{children:[L.pages_visited," ",r("research.pages","페이지")]}),L.started_at&&u.jsx("div",{children:new Date(L.started_at).toLocaleString()})]})]},L.job_id))})]})]})]})]})]})}function Rl({label:t,value:e}){return u.jsxs("div",{className:"rounded-md border bg-background px-3 py-2",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 text-xl font-semibold",children:typeof e=="number"?e:"—"})]})}const Lx=$.createContext(null);function Ax(){const t=$.useContext(Lx);if(!t)throw new Error("Tabs primitives must be used within ");return t}function $C({value:t,onValueChange:e,className:r,children:i}){return u.jsx(Lx.Provider,{value:{value:t,onChange:e},children:u.jsx("div",{className:_t("flex flex-col gap-3",r),children:i})})}function zC({className:t,children:e}){return u.jsx("div",{role:"tablist",className:_t("inline-flex h-10 items-center justify-start gap-1 rounded-md bg-muted p-1 text-muted-foreground",t),children:e})}function _d({value:t,children:e,className:r}){const i=Ax(),a=i.value===t;return u.jsx("button",{role:"tab",type:"button","aria-selected":a,onClick:()=>i.onChange(t),className:_t("inline-flex items-center justify-center whitespace-nowrap rounded px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",a?"bg-background text-foreground shadow-sm":"hover:text-foreground",r),children:e})}function Sd({value:t,children:e,className:r}){return Ax().value!==t?null:u.jsx("div",{role:"tabpanel",className:_t("focus-visible:outline-none",r),children:e})}const Ix=nn([D(),Ne()]).transform(String),Mx=Be({id:Ix,type:D(),name:D(),metadata:li(D(),dn()).default({})}),UC=it(Mx),VC=Be({created:Ne(),entities:it(Be({id:Ix,type:D(),name:D()}))}),Fx=Be({ok:Rr(),deleted:nn([D(),Ne()])}),du={list:(t,e,r=200)=>rt.get(`/projects/${encodeURIComponent(t)}/entities`,UC,{query:{limit:r,...e?{entity_type:e}:{}}}),create:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/entities`,Mx,e),bulkCreate:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/entities/bulk`,VC,e),delete:(t,e)=>rt.delete(`/projects/${encodeURIComponent(t)}/entities/${e}`,Fx)};function Dx(t,e){return On({queryKey:Ie.entities.list(t,e),queryFn:()=>du.list(t,e),enabled:!!t})}function BC(t){const e=Kt();return gn({mutationFn:r=>du.create(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.entities.all})}})}function qC(t){const e=Kt();return gn({mutationFn:r=>du.bulkCreate(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.entities.all})}})}function HC(t){const e=Kt();return gn({mutationFn:r=>du.delete(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.entities.all}),e.invalidateQueries({queryKey:Ie.claims.all})}})}const Wf=nn([D(),Ne()]).transform(String),WC=Be({id:Wf,subject:D().optional(),subject_type:D().optional(),predicate:D(),object:D().nullable().optional(),object_type:D().nullable().optional(),object_value:dn().nullable().optional(),source:D().nullable().optional(),page_url:D().nullable().optional(),confidence:Ne().optional(),confidence_reason:D().nullable().optional(),status:D().optional(),evidence_text:D().nullable().optional(),evidence_summary:D().nullable().optional(),page_type:D().nullable().optional(),source_zone:D().nullable().optional(),source_selector:D().nullable().optional(),extraction_method:D().nullable().optional(),validation_status:D().nullable().optional(),graph_merge_status:D().nullable().optional(),graph_merge_reason:D().nullable().optional(),confidence_breakdown:li(D(),dn()).nullable().optional(),review_required:Rr().nullable().optional(),review_reason:D().nullable().optional(),conflict_status:D().nullable().optional(),source_history:it(dn()).optional(),last_seen_at:D().optional()}).passthrough(),KC=it(WC),QC=Be({id:Wf,subject_entity_id:nn([D(),Ne()]).transform(String),predicate:D(),object_entity_id:nn([D(),Ne(),Df()]).nullable().optional(),object_value:dn().nullable().optional(),confidence:Ne(),status:D()}),ZC=Be({ok:Rr(),claim_id:Wf,status:D()}),fu={list:(t,e={})=>rt.get(`/projects/${encodeURIComponent(t)}/claims`,KC,{query:{limit:e.limit??100,include_candidates:e.includeCandidates,status:e.status}}),create:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/claims`,QC,e),delete:(t,e)=>rt.delete(`/projects/${encodeURIComponent(t)}/claims/${e}`,Fx),updateStatus:(t,e)=>rt.patch(`/claims/${encodeURIComponent(String(t))}/status`,ZC,e)};function hu(t,e={}){return On({queryKey:Ie.claims.list(t,e.status,e.limit),queryFn:()=>fu.list(t,{status:e.status,includeCandidates:e.includeCandidates,limit:e.limit}),enabled:!!t})}function GC(t){const e=Kt();return gn({mutationFn:r=>fu.create(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.claims.all})}})}function JC(t){const e=Kt();return gn({mutationFn:r=>fu.delete(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.claims.all})}})}function YC(t){const e=Kt();return gn({mutationFn:({claimId:r,status:i,reason:a})=>fu.updateStatus(r,{status:i,reason:a}),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.claims.all}),e.invalidateQueries({queryKey:Ie.platform.all}),e.invalidateQueries({queryKey:Ie.platform.pipeline(t)})}})}const XC=Be({entity_type:D().min(1,"타입을 선택하세요"),name:D().min(1,"이름을 입력하세요").max(240)}),e2=Be({source_name:D().min(1,"소스를 선택하세요"),subject_entity_id:Ne().int().min(1,"주어 엔티티 선택"),predicate:D().min(1,"술어를 선택하세요"),object_kind:hx(["entity","value"]),object_entity_id:Ne().int().nullable().optional(),object_value:D().optional(),confidence:Ne().min(0).max(1)});function t2(){const t=mn(),{projectId:e}=fr(),{t:r}=oi(),i=e??"",[a,l]=$.useState("entities"),{data:d,isLoading:f,isError:m,error:p,refetch:v}=hr(i),{data:w}=Cx(d?.domain),y=Dx(i),x=hu(i,{includeCandidates:!0}),S=BC(i),_=qC(i),b=HC(i),P=GC(i),N=JC(i),F=d?.sources??[],L=$.useMemo(()=>w?.entity_types?.length?w.entity_types:["Entity","Concept","Attribute"],[w]),k=$.useMemo(()=>w?.predicates?.length?w.predicates:["hasAttribute","relatedTo","sameAs"],[w]),I=Zi({resolver:Gi(XC),defaultValues:{entity_type:"",name:""}}),X=async R=>{try{await S.mutateAsync({entity_type:R.entity_type,name:R.name}),jt.success(r("editor.entityAdded","엔티티가 추가되었습니다: {{name}}",{name:R.name})),I.reset({entity_type:R.entity_type,name:""})}catch(G){jt.error(r("editor.entityAddFailed","추가 실패: {{msg}}",{msg:G.message}))}},re=Zi({resolver:Gi(e2),defaultValues:{source_name:"",subject_entity_id:0,predicate:"",object_kind:"entity",object_entity_id:null,object_value:"",confidence:1}}),de=re.watch("object_kind"),Z=async R=>{try{await P.mutateAsync({source_name:R.source_name,subject_entity_id:R.subject_entity_id,predicate:R.predicate,object_entity_id:R.object_kind==="entity"?R.object_entity_id:null,object_value:R.object_kind==="value"?R.object_value:void 0,confidence:R.confidence}),jt.success(r("editor.claimAdded","클레임이 추가되었습니다")),re.reset({...re.getValues(),object_entity_id:null,object_value:""})}catch(G){jt.error(r("editor.claimAddFailed","추가 실패: {{msg}}",{msg:G.message}))}},[Oe,J]=$.useState(JSON.stringify({entities:[{entity_type:"Entity",name:"Example A"},{entity_type:"Entity",name:"Example B"}]},null,2)),[ve,me]=$.useState(null),M=async()=>{me(null);try{const R=JSON.parse(Oe),G=Array.isArray(R.entities)?R.entities:Array.isArray(R)?R:null;if(!G||G.length===0)throw new Error("최상위에 entities 배열이 있어야 합니다");const H=G.map((K,T)=>{if(typeof K!="object"||K===null||typeof K.entity_type!="string"||typeof K.name!="string")throw new Error(`항목 [${T}]에 entity_type/name 문자열이 필요합니다`);return{entity_type:K.entity_type,name:K.name,metadata:typeof K.metadata=="object"&&K.metadata!==null?K.metadata:{}}}),W=await _.mutateAsync({entities:H});jt.success(r("editor.bulkAdded","{{count}}개 엔티티가 추가되었습니다",{count:W.created}))}catch(R){me(R.message)}};return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-10",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/sources/${i}`),"aria-label":r("common.back","이전"),children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Cf,{className:"h-6 w-6 text-primary"}),r("editor.title","온톨로지 직접 편집")]}),d&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:[d.name,u.jsxs("span",{className:"capitalize text-muted-foreground/70",children:[" ","· ",d.domain]})]})]})]}),m&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center justify-between gap-3 py-4",children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),u.jsx("span",{children:p.message})]}),u.jsx(Ee,{variant:"outline",size:"sm",type:"button",onClick:()=>v(),children:r("common.retry","다시 시도")})]})}),u.jsxs($C,{value:a,onValueChange:R=>l(R),children:[u.jsxs(zC,{children:[u.jsxs(_d,{value:"entities",children:[r("editor.entitiesTab","엔티티")," (",y.data?.length??0,")"]}),u.jsxs(_d,{value:"claims",children:[u.jsx(bS,{className:"mr-1 h-4 w-4"}),r("editor.claimsTab","클레임")," (",x.data?.length??0,")"]}),u.jsxs(_d,{value:"bulk",children:[u.jsx(Wd,{className:"mr-1 h-4 w-4"}),r("editor.bulkTab","JSON 일괄 입력")]})]}),u.jsx(Sd,{value:"entities",children:u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[380px_1fr]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("editor.addEntity","엔티티 추가")}),u.jsx(Qe,{children:r("editor.addEntityDesc","온톨로지 도메인의 entity_types 중에서 선택")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:I.handleSubmit(X),className:"space-y-3",noValidate:!0,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.entityType","타입")}),u.jsxs(En,{...I.register("entity_type"),children:[u.jsx("option",{value:"",children:r("editor.pickType","타입 선택...")}),L.map(R=>u.jsx("option",{value:R,children:R},R))]}),I.formState.errors.entity_type&&u.jsx("p",{className:"text-xs text-destructive",children:I.formState.errors.entity_type.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.entityName","이름")}),u.jsx(xt,{placeholder:"Chanel No.5",...I.register("name")}),I.formState.errors.name&&u.jsx("p",{className:"text-xs text-destructive",children:I.formState.errors.name.message})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:S.isPending,children:[S.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(ri,{className:"h-4 w-4"}),r("editor.add","추가")]})]})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("editor.entitiesList","엔티티 목록")}),u.jsx(Qe,{children:y.data?r("editor.entityCount","{{count}}개",{count:y.data.length}):r("dashboard.loadFailed","")})]}),u.jsxs(ye,{children:[y.isLoading&&u.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((R,G)=>u.jsx(pn,{className:"h-10"},G))}),y.data&&y.data.length===0&&u.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:r("editor.entitiesEmpty","아직 등록된 엔티티가 없습니다")}),y.data&&y.data.length>0&&u.jsx("ul",{className:"max-h-[600px] divide-y overflow-y-auto",children:y.data.map(R=>u.jsxs("li",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[u.jsx("div",{className:"min-w-0 flex-1",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Xe,{variant:"outline",children:R.type}),u.jsx("span",{className:"truncate font-medium",children:R.name})]})}),u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>{confirm(r("editor.confirmDeleteEntity","엔티티 '{{name}}'을 삭제하시겠습니까?",{name:R.name}))&&b.mutate(R.id)},disabled:b.isPending,children:u.jsx(Kd,{className:"h-4 w-4 text-destructive"})})]},R.id))})]})]})]})}),u.jsx(Sd,{value:"claims",children:u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[420px_1fr]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("editor.addClaim","클레임 추가")}),u.jsx(Qe,{children:r("editor.addClaimDesc","주어-술어-목적어 형태로 직접 입력")})]}),u.jsx(ye,{children:u.jsxs("form",{onSubmit:re.handleSubmit(Z),className:"space-y-3",noValidate:!0,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.source","소스")}),u.jsxs(En,{...re.register("source_name"),children:[u.jsx("option",{value:"",children:r("editor.pickSource","소스 선택...")}),F.map(R=>u.jsx("option",{value:R.name,children:R.name},R.id))]}),re.formState.errors.source_name&&u.jsx("p",{className:"text-xs text-destructive",children:re.formState.errors.source_name.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.subject","주어 (Subject)")}),u.jsxs(En,{...re.register("subject_entity_id",{valueAsNumber:!0}),children:[u.jsx("option",{value:0,children:r("editor.pickSubject","엔티티 선택...")}),y.data?.map(R=>u.jsxs("option",{value:R.id,children:["[",R.type,"] ",R.name]},R.id))]}),re.formState.errors.subject_entity_id&&u.jsx("p",{className:"text-xs text-destructive",children:re.formState.errors.subject_entity_id.message})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.predicate","술어 (Predicate)")}),u.jsxs(En,{...re.register("predicate"),children:[u.jsx("option",{value:"",children:r("editor.pickPredicate","술어 선택...")}),k.map(R=>u.jsx("option",{value:R,children:R},R))]})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.objectKind","목적어 유형")}),u.jsxs(En,{...re.register("object_kind"),children:[u.jsx("option",{value:"entity",children:r("editor.objectEntity","다른 엔티티")}),u.jsx("option",{value:"value",children:r("editor.objectValue","리터럴 값")})]})]}),de==="entity"?u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.objectEntity","목적 엔티티")}),u.jsxs(En,{...re.register("object_entity_id",{valueAsNumber:!0,setValueAs:R=>R===""||R===null||R===void 0?null:Number(R)}),children:[u.jsx("option",{value:"",children:r("editor.pickObject","엔티티 선택...")}),y.data?.map(R=>u.jsxs("option",{value:R.id,children:["[",R.type,"] ",R.name]},R.id))]})]}):u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.objectValue","값")}),u.jsx(xt,{placeholder:"2024-01-15 또는 임의 문자열",...re.register("object_value")})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{children:r("editor.confidence","신뢰도")}),u.jsx(xt,{type:"number",step:"0.05",min:0,max:1,...re.register("confidence",{valueAsNumber:!0})})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:P.isPending,children:[P.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(ri,{className:"h-4 w-4"}),r("editor.add","추가")]})]})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("editor.claimsList","클레임 목록")}),u.jsx(Qe,{children:x.data&&r("editor.claimCount","{{count}}개",{count:x.data.length})})]}),u.jsxs(ye,{children:[x.isLoading&&u.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((R,G)=>u.jsx(pn,{className:"h-12"},G))}),x.data&&x.data.length===0&&u.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:r("editor.claimsEmpty","아직 등록된 클레임이 없습니다")}),x.data&&x.data.length>0&&u.jsx("ul",{className:"max-h-[600px] divide-y overflow-y-auto",children:x.data.map(R=>u.jsxs("li",{className:"flex items-start justify-between gap-3 py-3 text-sm",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[u.jsx("span",{className:"font-medium",children:R.subject??"?"}),u.jsx(Xe,{variant:"secondary",children:R.predicate}),u.jsx("span",{className:"font-medium",children:R.object??String(R.object_value??"—")})]}),u.jsxs("div",{className:"mt-1 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[u.jsxs("span",{children:[r("editor.source","소스"),": ",R.source??"—"]}),typeof R.confidence=="number"&&u.jsxs("span",{children:[r("editor.confidence","신뢰도"),":"," ",R.confidence.toFixed(2)]}),R.status&&u.jsx(Xe,{variant:"outline",children:R.status})]})]}),u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>{confirm(r("editor.confirmDeleteClaim","클레임을 삭제하시겠습니까?"))&&N.mutate(R.id)},children:u.jsx(Kd,{className:"h-4 w-4 text-destructive"})})]},R.id))})]})]})]})}),u.jsx(Sd,{value:"bulk",children:u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:r("editor.bulkTitle","JSON 일괄 입력")}),u.jsx(Qe,{children:r("editor.bulkDesc","{ entities: [{ entity_type, name, metadata? }] } 형태의 JSON")})]}),u.jsxs(ye,{className:"space-y-3",children:[u.jsx(ho,{value:Oe,onChange:R=>J(R.target.value),rows:12,className:"font-mono text-xs"}),ve&&u.jsx("p",{className:"text-sm text-destructive",children:ve}),u.jsxs(Ee,{onClick:M,disabled:_.isPending||f,children:[_.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(Wd,{className:"h-4 w-4"}),r("editor.bulkSubmit","일괄 추가")]})]})]})})]})]})}function Ct(t,e="-"){if(t==null||t==="")return e;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){const r=t.map(i=>Ct(i,"")).filter(Boolean);return r.length?r.join(", "):e}if(typeof t=="object"){const r=t;for(const a of["label","name","title","value","text","display","canonical_name"])if(r[a]!==void 0&&r[a]!==null)return Ct(r[a],e);const i=Object.entries(r).filter(([,a])=>a!=null&&a!=="").slice(0,4).map(([a,l])=>`${a}: ${Ct(l,"")}`).filter(a=>!a.endsWith(": "));return i.length?i.join(" · "):e}return String(t)}function tn(t,e="-"){return typeof t!="number"||Number.isNaN(t)?e:`${Math.round(t*100)}%`}function ai(t,e="-"){if(typeof t!="string"||!t)return e;const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString()}function Ys(t){switch((t??"").toLowerCase()){case"validated_claim":return"approved";case"rejected":return"rejected";case"active":case"candidate_claim":case"rule_candidate":return"candidate";default:return t||"candidate"}}function Ly(t){switch(Ys(t)){case"approved":return"success";case"rejected":return"destructive";case"candidate":return"warning";default:return"outline"}}function n2(t){return typeof t.confidence!="number"?"unknown":t.confidence>=.9?"auto-approve candidate":t.confidence>=.7?"normal review":"priority review"}function Ay(t){return Ct(t.object??t.object_value)}function r2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),a=hu(r,{includeCandidates:!0,limit:300}),l=YC(r),[d,f]=$.useState("all"),[m,p]=$.useState(""),[v,w]=$.useState(null),y=$.useMemo(()=>{const b=m.trim().toLowerCase();return(a.data??[]).filter(P=>d!=="all"&&Ys(P.status)!==d?!1:b?[P.subject,P.predicate,Ay(P),P.evidence_text,P.page_url,P.source].map(N=>Ct(N,"").toLowerCase()).some(N=>N.includes(b)):!0)},[a.data,m,d]),x=$.useMemo(()=>y.find(b=>b.id===v)??y[0],[y,v]),S=$.useMemo(()=>{const b=a.data??[];return{total:b.length,candidate:b.filter(P=>Ys(P.status)==="candidate").length,approved:b.filter(P=>Ys(P.status)==="approved").length,rejected:b.filter(P=>Ys(P.status)==="rejected").length}},[a.data]),_=async(b,P)=>{try{await l.mutateAsync({claimId:b.id,status:P,reason:P==="rejected"?"Rejected from Claim Review":"Updated from Claim Review"}),jt.success(`Claim ${P}`)}catch(N){jt.error(N.message)}};return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/schema/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Nf,{className:"h-6 w-6 text-primary"}),"Claim Review"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," · 후보, 승인, 반려 상태 분리 검토"]})]}),u.jsx(Ee,{onClick:()=>t(`/quality/${r}`),children:"Quality Inspector"})]}),a.isError&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),a.error.message]})}),u.jsxs("div",{className:"mb-6 grid gap-4 md:grid-cols-4",children:[u.jsx(Tl,{label:"Total",value:S.total}),u.jsx(Tl,{label:"Candidate",value:S.candidate}),u.jsx(Tl,{label:"Approved",value:S.approved}),u.jsx(Tl,{label:"Rejected",value:S.rejected})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_420px]",children:[u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:"Review Queue"}),u.jsx(Qe,{children:"신뢰도, 출처, 생성 방식, 검증 결과를 함께 확인합니다."})]}),u.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[u.jsxs("div",{className:"relative",children:[u.jsx(Vv,{className:"pointer-events-none absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),u.jsx(xt,{value:m,onChange:b=>p(b.target.value),className:"w-56 pl-9",placeholder:"Search claims"})]}),u.jsxs("div",{className:"relative",children:[u.jsx(mS,{className:"pointer-events-none absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),u.jsxs(En,{value:d,onChange:b=>f(b.target.value),className:"w-40 pl-9",children:[u.jsx("option",{value:"all",children:"All"}),u.jsx("option",{value:"candidate",children:"Candidate"}),u.jsx("option",{value:"approved",children:"Approved"}),u.jsx("option",{value:"rejected",children:"Rejected"})]})]})]})]})}),u.jsxs(ye,{children:[a.isLoading&&u.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((b,P)=>u.jsx(pn,{className:"h-24"},P))}),!a.isLoading&&y.length===0&&u.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"조건에 맞는 클레임이 없습니다."}),u.jsx("div",{className:"space-y-3",children:y.map(b=>u.jsx("article",{className:"rounded-md border bg-background p-4",children:u.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[u.jsxs("button",{type:"button",onClick:()=>w(b.id),className:"min-w-0 flex-1 text-left",children:[u.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[u.jsx(Xe,{variant:Ly(b.status),children:Ys(b.status)}),u.jsx(Xe,{variant:"secondary",children:b.predicate}),u.jsx("span",{className:"text-xs text-muted-foreground",children:n2(b)})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[u.jsx("span",{className:"font-medium",children:Ct(b.subject)}),u.jsx("span",{className:"text-muted-foreground",children:"->"}),u.jsx("span",{className:"font-medium",children:Ay(b)})]}),u.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[u.jsxs("span",{children:["Confidence ",tn(b.confidence)]}),u.jsxs("span",{children:["Source ",Ct(b.source)]}),u.jsxs("span",{children:["Evidence ",b.evidence_text?"yes":"missing"]}),u.jsxs("span",{children:["Method ",Ct(b.extraction_method)]})]})]}),u.jsxs("div",{className:"flex gap-1",children:[u.jsxs(Ee,{variant:"outline",size:"sm",onClick:()=>w(b.id),children:[u.jsx(fS,{className:"h-4 w-4"}),"Detail"]}),u.jsxs(Ee,{variant:"outline",size:"sm",onClick:()=>_(b,"validated_claim"),disabled:l.isPending,children:[u.jsx(Dg,{className:"h-4 w-4"}),"Approve"]}),u.jsxs(Ee,{variant:"outline",size:"sm",onClick:()=>_(b,"rejected"),disabled:l.isPending,children:[u.jsx(zg,{className:"h-4 w-4"}),"Reject"]})]})]})},b.id))})]})]}),u.jsx("aside",{className:"lg:sticky lg:top-4 lg:self-start",children:u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Claim Detail"}),u.jsx(Qe,{children:"근거, 출처, 검증 결과, 히스토리"})]}),u.jsxs(ye,{children:[!x&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"클레임을 선택하세요."}),x&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx(Xe,{variant:Ly(x.status),children:Ys(x.status)}),u.jsx(Xe,{variant:"outline",children:tn(x.confidence)}),x.review_required&&u.jsx(Xe,{variant:"warning",children:"review required"})]}),u.jsx(jr,{label:"Subject",value:x.subject}),u.jsx(jr,{label:"Subject Type",value:x.subject_type}),u.jsx(jr,{label:"Predicate",value:x.predicate}),u.jsx(jr,{label:"Object",value:x.object??x.object_value}),u.jsx(jr,{label:"Source",value:x.source}),u.jsx(jr,{label:"Source URL",value:x.page_url}),u.jsx(jr,{label:"Page Type",value:x.page_type}),u.jsx(jr,{label:"Created By",value:x.extraction_method}),u.jsx(jr,{label:"Validation",value:x.validation_status??x.graph_merge_status}),x.graph_merge_reason&&u.jsx(jr,{label:"Graph Reason",value:x.graph_merge_reason}),x.evidence_text&&u.jsxs("section",{children:[u.jsx("h3",{className:"mb-2 text-sm font-medium",children:"Evidence Text"}),u.jsx("div",{className:"rounded-md bg-yellow-50 px-3 py-2 text-sm leading-relaxed text-yellow-950",children:x.evidence_text})]}),x.confidence_breakdown&&u.jsxs("section",{children:[u.jsx("h3",{className:"mb-2 text-sm font-medium",children:"Confidence Breakdown"}),u.jsx("pre",{className:"max-h-44 overflow-auto rounded-md bg-secondary/30 p-3 text-xs",children:JSON.stringify(x.confidence_breakdown,null,2)})]}),x.source_history&&x.source_history.length>0&&u.jsxs("section",{children:[u.jsx("h3",{className:"mb-2 text-sm font-medium",children:"Source History"}),u.jsx("pre",{className:"max-h-44 overflow-auto rounded-md bg-secondary/30 p-3 text-xs",children:JSON.stringify(x.source_history,null,2)})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[u.jsxs(Ee,{onClick:()=>_(x,"validated_claim"),disabled:l.isPending,children:[u.jsx(Dg,{className:"h-4 w-4"}),"Approve"]}),u.jsxs(Ee,{variant:"outline",onClick:()=>_(x,"rejected"),disabled:l.isPending,children:[u.jsx(zg,{className:"h-4 w-4"}),"Reject"]})]}),u.jsxs("div",{className:"text-xs text-muted-foreground",children:["Last seen ",ai(x.last_seen_at)]})]})]})]})})]})]})}function Tl({label:t,value:e}){return u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 text-2xl font-semibold",children:e.toLocaleString()})]})})}function jr({label:t,value:e}){return u.jsxs("div",{className:"rounded-md border bg-background px-3 py-2 text-sm",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 break-words font-medium",children:Ct(e)})]})}const Pn=nn([D(),Ne()]).transform(String),Qr=li(D(),dn()),s2=Be({key:D(),count:Ne().default(0),extra:Qr.optional()}).passthrough(),i2=Be({stages:it(s2).default([]),entity_types:it(Be({type:D(),count:Ne()})).default([]),recent_pages:it(Be({id:Pn,url:D(),title:D().nullable().optional(),status_code:Ne().nullable().optional(),page_type:D().nullable().optional(),fetched_at:D().nullable().optional()}).passthrough()).default([]),recent_claims:it(Be({id:Pn,subject:D().nullable().optional(),predicate:D(),confidence:Ne().optional(),status:D().optional(),last_seen_at:D().nullable().optional()}).passthrough()).default([])}).passthrough(),a2=Be({id:Pn,page_url:D().nullable().optional(),extractor_name:D(),provider:D(),error:D().nullable().optional(),created_at:D(),validation:dn().optional(),page_context:dn().optional(),candidate_count:Ne().default(0),raw_output:dn().optional()}).passthrough(),o2=Be({entity_types:it(Be({id:Pn,name:D(),domain:D().optional(),description:D().nullable().optional(),status:D().optional(),version:D().optional(),confidence:Ne().optional(),metadata:Qr.optional()}).passthrough()).default([]),relation_types:it(Be({id:Pn,name:D(),domain:D().optional(),description:D().nullable().optional(),allowed_subject_types:it(D()).default([]),allowed_object_types:it(D()).default([]),allowed_page_types:it(D()).default([]),allowed_source_zones:it(D()).default([]),semantic_constraints:Qr.default({}),confidence_rules:Qr.default({}),status:D().optional(),version:D().optional(),confidence:Ne().optional(),metadata:Qr.optional()}).passthrough()).default([])}).passthrough(),l2=Be({id:Pn,proposal_type:D(),name:D(),reason:D().nullable().optional(),evidence:D().nullable().optional(),status:D(),confidence:Ne().optional(),metadata:Qr.optional(),updated_at:D().nullable().optional()}).passthrough(),u2=Be({id:Pn,claim_id:nn([D(),Ne(),Df()]).nullable().optional(),subject:D().nullable().optional(),subject_type:D().nullable().optional(),predicate:D(),object:D().nullable().optional(),object_type:D().nullable().optional(),object_value:dn().nullable().optional(),value_type:D().optional(),status:D().optional(),confidence:Ne().optional(),support_count:Ne().optional(),metadata:Qr.optional(),last_seen_at:D().nullable().optional()}).passthrough(),c2=Be({id:Pn,name:D(),type:D().optional(),canonical_name:D().nullable().optional(),metadata:Qr.optional()}).passthrough(),d2=Be({claim_id:Pn,source:Pn,target:nn([D(),Ne(),Df()]).nullable().optional(),target_value:dn().nullable().optional(),predicate:D(),status:D().optional(),confidence:Ne().optional(),last_seen_at:D().nullable().optional(),metadata:Qr.optional(),object:Be({id:Pn,name:D()}).nullable().optional()}).passthrough(),f2=Be({nodes:it(c2).default([]),edges:it(d2).default([])}).passthrough(),h2=Be({project:D(),status:D(),count:Ne(),claims:it(li(D(),dn())).default([])}).passthrough(),p2=Be({ok:Rr().optional(),stage:D(),action:D(),route:D().optional(),message:D().optional(),job_id:Pn.optional(),status:D().optional()}).passthrough(),m2=Be({id:Pn,name:D(),domain:D().optional(),status:D().optional()}).passthrough(),g2=Be({id:Pn,name:D(),domain:D().optional(),status:D().optional()}).passthrough(),Qn={pipeline:t=>rt.get(`/projects/${encodeURIComponent(t)}/pipeline`,i2),extractionLogs:(t,e=50)=>rt.get(`/projects/${encodeURIComponent(t)}/extraction-logs`,it(a2),{query:{limit:e}}),registry:t=>rt.get(`/projects/${encodeURIComponent(t)}/ontology/registry`,o2),proposals:(t,e=100)=>rt.get(`/projects/${encodeURIComponent(t)}/ontology/proposals`,it(l2),{query:{limit:e}}),triples:(t,e,r=200)=>rt.get(`/projects/${encodeURIComponent(t)}/ontology/triples`,it(u2),{query:{status:e,limit:r}}),graphNeighborhood:(t,e={})=>rt.get(`/projects/${encodeURIComponent(t)}/graph/neighborhood`,f2,{query:{entity_id:e.entityId,limit:e.limit??200,include_candidates:e.includeCandidates,status:e.status}}),exportJson:(t,e={})=>rt.get(`/projects/${encodeURIComponent(t)}/export`,h2,{query:{format:"json",status:e.status??"validated_claim",include_evidence:e.includeEvidence??!0,limit:e.limit??1e3}}),exportUrl:(t,e,r="validated_claim",i=!0,a=1e3)=>{const l=new URLSearchParams({format:e,status:r,include_evidence:String(i),limit:String(a)});return`/projects/${encodeURIComponent(t)}/export?${l.toString()}`},rerunStage:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/pipeline/rerun`,p2,{stage:e}),createSchemaEntityType:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/schema/entity-types`,m2,e),createSchemaRelationType:(t,e)=>rt.post(`/projects/${encodeURIComponent(t)}/schema/relation-types`,g2,e)};function Kf(t){return On({queryKey:Ie.platform.pipeline(t),queryFn:()=>Qn.pipeline(t),enabled:!!t})}function y2(t,e=50){return On({queryKey:Ie.platform.extractionLogs(t,e),queryFn:()=>Qn.extractionLogs(t,e),enabled:!!t})}function $x(t){return On({queryKey:Ie.platform.registry(t),queryFn:()=>Qn.registry(t),enabled:!!t})}function v2(t,e=100){return On({queryKey:Ie.platform.proposals(t,e),queryFn:()=>Qn.proposals(t,e),enabled:!!t})}function x2(t,e={}){const r=e.entityId==null?"*":String(e.entityId),i=e.status??"*",a=e.limit??200;return On({queryKey:Ie.platform.graph(t,r,!!e.includeCandidates,i,a),queryFn:()=>Qn.graphNeighborhood(t,e),enabled:!!t})}function w2(t,e={}){const r=e.status??"validated_claim",i=e.includeEvidence??!0,a=e.limit??1e3;return On({queryKey:Ie.platform.exportJson(t,r,i,a),queryFn:()=>Qn.exportJson(t,{status:r,includeEvidence:i,limit:a}),enabled:!!t})}function b2(t){const e=Kt();return gn({mutationFn:r=>Qn.rerunStage(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.platform.pipeline(t)})}})}function j2(t){const e=Kt();return gn({mutationFn:r=>Qn.createSchemaEntityType(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.platform.registry(t)})}})}function _2(t){const e=Kt();return gn({mutationFn:r=>Qn.createSchemaRelationType(t,r),onSuccess:()=>{e.invalidateQueries({queryKey:Ie.platform.registry(t)})}})}function S2(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString()}function k2(){const t=mn(),{t:e}=oi(),{data:r,isLoading:i,isError:a,error:l,refetch:d}=px();return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-10",children:[u.jsxs("div",{className:"mb-8 flex items-start justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:e("dashboard.title","Ontology Builder")}),u.jsx("p",{className:"mt-2 text-muted-foreground",children:e("dashboard.subtitle","Build and manage domain ontologies with AI-powered extraction")})]}),u.jsxs(Ee,{onClick:()=>t("/onboard"),children:[u.jsx(ri,{className:"h-4 w-4"}),e("dashboard.newProject","New Project")]})]}),u.jsxs("section",{children:[u.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[u.jsx("h2",{className:"text-lg font-semibold",children:e("dashboard.projects","Projects")}),r&&u.jsx("span",{className:"text-sm text-muted-foreground",children:e("dashboard.projectCount","{{count}} total",{count:r.length})})]}),i&&u.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:3}).map((f,m)=>u.jsx(pn,{className:"h-32"},m))}),a&&u.jsxs(ge,{className:"border-destructive",children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2 text-destructive",children:[u.jsx(fn,{className:"h-5 w-5"}),e("dashboard.loadFailed","Failed to load projects")]}),u.jsx(Qe,{children:l.message})]}),u.jsx(ye,{children:u.jsx(Ee,{variant:"outline",onClick:()=>d(),children:e("common.retry","Retry")})})]}),r&&r.length===0&&u.jsx(ge,{children:u.jsxs(ye,{className:"flex flex-col items-center gap-4 py-12 text-center",children:[u.jsx(gS,{className:"h-12 w-12 text-muted-foreground"}),u.jsxs("div",{children:[u.jsx("p",{className:"font-medium",children:e("dashboard.empty.title","No projects yet")}),u.jsx("p",{className:"text-sm text-muted-foreground",children:e("dashboard.empty.hint","Create your first project to start building an ontology")})]}),u.jsxs(Ee,{onClick:()=>t("/onboard"),children:[u.jsx(ri,{className:"h-4 w-4"}),e("dashboard.newProject","New Project")]})]})}),r&&r.length>0&&u.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:r.map(f=>u.jsx(N2,{project:f,onOpen:t},f.id))})]})]})}function N2({project:t,onOpen:e}){const r=Kf(t.name),i=r.data?.stages.find(p=>p.key==="claims"),a=r.data?.stages.find(p=>p.key==="validated"),l=r.data?.stages.find(p=>p.key==="crawled"),d=i?.count??0,f=a?.count??0,m=d>0?f/d:0;return u.jsxs(ge,{role:"button",tabIndex:0,onClick:()=>e(`/sources/${t.name}`),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&e(`/sources/${t.name}`)},className:"cursor-pointer transition-colors hover:bg-accent/40",children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:t.name}),u.jsx(Qe,{children:t.domain})]}),u.jsxs(ye,{children:[u.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[u.jsx(kd,{label:"Pages",value:l?.count??0}),u.jsx(kd,{label:"Claims",value:d}),u.jsx(kd,{label:"Approved",value:tn(m)})]}),u.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-muted-foreground",children:[u.jsx(cS,{className:"h-3 w-3"}),S2(t.updated_at)]})]})]})}function kd({label:t,value:e}){return u.jsxs("div",{className:"rounded-md border bg-background px-2 py-1",children:[u.jsx("div",{className:"text-muted-foreground",children:t}),u.jsx("div",{className:"font-semibold",children:typeof e=="number"?e.toLocaleString():e})]})}const C2=new Set(["human-review","ontology-commit","export"]);function Wn(t){return typeof t=="number"&&Number.isFinite(t)?t:0}function E2(t){switch(t){case"done":return"success";case"running":return"default";case"issue":return"warning";default:return"outline"}}function P2(t){return t.key==="human-review"?"Open review":t.key==="ontology-commit"?"Open graph":t.key==="export"?"Open export":"Rerun"}function O2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),a=Kf(r),l=b2(r),[d,f]=$.useState(null),m=$.useMemo(()=>{const y=a.data?.stages??[],x=new Map(y.map(Z=>[Z.key,Z])),S=Wn(x.get("crawled")?.count),_=Wn(x.get("extracted")?.count),b=Wn(x.get("extracted")?.extra?.events),P=Wn(x.get("extracted")?.extra?.errors),N=x.get("claims")?.extra??{},F=Wn(x.get("claims")?.count),L=Wn(x.get("validated")?.count),k=Wn(N.rejected),I=Wn(N.active)+Wn(N.rule_candidate)+Wn(N.candidate_claim),X=Wn(x.get("graph")?.count),re=Wn(x.get("graph")?.extra?.entities),de=a.data?.recent_pages.filter(Z=>Z.page_type).length??0;return[{key:"source-crawl",name:"Source Crawl",description:"Fetch source HTML, metadata, and in-domain links.",count:S,target:Math.max(S,1),status:S>0?"done":"waiting"},{key:"page-clean",name:"Page Clean",description:"Normalize page text and remove repeated UI noise.",count:S,target:Math.max(S,1),status:S>0?"done":"waiting"},{key:"page-classification",name:"Page Classification",description:"Classify product, brand, review, and supporting pages.",count:de,target:Math.max(S,1),status:de>0?"done":S>0?"running":"waiting"},{key:"entity-extraction",name:"Entity Extraction",description:"Extract candidate entities from typed pages.",count:re,target:Math.max(re,1),status:re>0?"done":_>0?"running":"waiting",extra:`${b} extraction events`},{key:"claim-generation",name:"Claim Generation",description:"Turn entities and page evidence into relation claims.",count:F,target:Math.max(F,1),status:F>0?"done":re>0?"running":"waiting"},{key:"deduplication",name:"Deduplication",description:"Collapse repeated entities and duplicate relation claims.",count:Math.max(F-I,0),target:Math.max(F,1),status:F>0?"done":"waiting"},{key:"validation",name:"Validation",description:"Check schema fit, evidence quality, and conflicts.",count:Math.max(F-I,0),target:Math.max(F,1),status:P>0?"issue":F>0?"done":"waiting",extra:P>0?`${P} errors`:void 0},{key:"human-review",name:"Human Review",description:"Approve, reject, or send uncertain claims back for cleanup.",count:L+k,target:Math.max(F,1),status:L+k>0?"done":F>0?"running":"waiting",extra:`${L} approved / ${k} rejected`},{key:"ontology-commit",name:"Ontology Commit",description:"Project accepted claims into the graph triple store.",count:X,target:Math.max(L,1),status:X>0?"done":L>0?"running":"waiting"},{key:"export",name:"Export",description:"Prepare JSON, CSV, Turtle, and API access for downstream use.",count:X,target:Math.max(X,1),status:X>0?"done":"waiting"}]},[a.data]),p=m.filter(y=>y.status==="done").length,v=m.length?p/m.length*100:0;async function w(y){f(null);try{const x=await l.mutateAsync(y.key);if(x.action==="navigate"&&x.route){t(x.route);return}f({tone:"success",text:x.job_id!=null?`Started job #${x.job_id} for ${y.name}.`:x.message??`${y.name} action completed.`}),a.refetch()}catch(x){f({tone:"error",text:x instanceof Error?x.message:"Stage action failed."})}}return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/crawl/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Dv,{className:"h-6 w-6 text-primary"}),"Build Pipeline"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," pipeline status and recovery actions"]})]}),u.jsxs(Ee,{variant:"outline",onClick:()=>a.refetch(),children:[u.jsx($g,{className:"h-4 w-4"}),"Refresh"]})]}),d&&u.jsx(ge,{className:d.tone==="error"?"mb-6 border-destructive":"mb-6 border-green-200",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm",children:[u.jsx(fn,{className:"h-4 w-4"}),d.text]})}),a.isError&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),a.error.message]})}),u.jsxs("div",{className:"mb-6 grid gap-4 md:grid-cols-4",children:[u.jsx(Ll,{icon:dS,label:"Collected pages",value:a.data?.stages.find(y=>y.key==="crawled")?.count}),u.jsx(Ll,{icon:hS,label:"Extraction pages",value:a.data?.stages.find(y=>y.key==="extracted")?.count}),u.jsx(Ll,{icon:Nf,label:"Claims",value:a.data?.stages.find(y=>y.key==="claims")?.count}),u.jsx(Ll,{icon:_f,label:"Overall",value:tn(v/100)})]}),u.jsxs(ge,{className:"mb-6",children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:"Ontology Build Flow"}),u.jsx(Qe,{children:"The ten major build stages, current counts, and recovery entry points."})]}),u.jsxs(Xe,{variant:"outline",children:[p,"/",m.length," complete"]})]})}),u.jsxs(ye,{children:[u.jsx(Ji,{value:v,className:"mb-5"}),a.isLoading?u.jsx("div",{className:"space-y-3",children:Array.from({length:6}).map((y,x)=>u.jsx(pn,{className:"h-20"},x))}):u.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:m.map((y,x)=>{const S=y.target>0?Math.min(100,y.count/y.target*100):0,_=C2.has(y.key);return u.jsxs("article",{className:"rounded-md border bg-background p-4",children:[u.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"text-xs text-muted-foreground",children:["Step ",x+1]}),u.jsx("h3",{className:"font-semibold",children:y.name}),u.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:y.description})]}),u.jsx(Xe,{variant:E2(y.status),children:y.status})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Ji,{value:S,className:"h-2"}),u.jsxs("span",{className:"w-16 text-right text-xs text-muted-foreground",children:[Math.round(S),"%"]})]}),u.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[u.jsxs("div",{children:[u.jsxs("span",{children:[y.count.toLocaleString()," items"]}),y.extra&&u.jsxs("span",{children:[" / ",y.extra]})]}),u.jsxs(Ee,{size:"sm",variant:_?"outline":"secondary",disabled:!r||l.isPending,onClick:()=>w(y),children:[_?u.jsx(Mv,{className:"h-3.5 w-3.5"}):u.jsx($g,{className:"h-3.5 w-3.5"}),l.isPending?"Working":P2(y)]})]})]},y.key)})})]})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Recent Pages"}),u.jsx(Qe,{children:"Most recently collected and typed pages."})]}),u.jsx(ye,{children:u.jsxs("ul",{className:"divide-y",children:[(a.data?.recent_pages??[]).map(y=>u.jsxs("li",{className:"py-3 text-sm",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Xe,{variant:"outline",children:y.page_type??"unknown"}),u.jsx("span",{className:"truncate font-medium",children:y.title||y.url})]}),u.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:y.url}),u.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:ai(y.fetched_at)})]},y.id)),a.data?.recent_pages.length===0&&u.jsx("li",{className:"py-6 text-center text-sm text-muted-foreground",children:"No collected pages yet."})]})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Recent Claims"}),u.jsx(Qe,{children:"Latest relation claims from the build flow."})]}),u.jsx(ye,{children:u.jsxs("ul",{className:"divide-y",children:[(a.data?.recent_claims??[]).map(y=>u.jsxs("li",{className:"py-3 text-sm",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx($v,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"truncate font-medium",children:y.subject||"-"}),u.jsx(Xe,{variant:"secondary",children:y.predicate})]}),u.jsxs("div",{className:"mt-1 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[u.jsx("span",{children:tn(y.confidence)}),u.jsx("span",{children:y.status}),u.jsx("span",{children:ai(y.last_seen_at)})]})]},y.id)),a.data?.recent_claims.length===0&&u.jsx("li",{className:"py-6 text-center text-sm text-muted-foreground",children:"No claims have been generated yet."})]})})]})]})]})}function Ll({icon:t,label:e,value:r}){return u.jsx(ge,{children:u.jsxs(ye,{className:"flex items-center justify-between gap-4 py-4",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:e}),u.jsx("div",{className:"mt-1 text-2xl font-semibold",children:typeof r=="number"?r.toLocaleString():r??"-"})]}),u.jsx(t,{className:"h-5 w-5 text-muted-foreground"})]})})}function Xa(t){return typeof t=="object"&&t!==null?t:{}}function Iy(...t){for(const e of t)if(typeof e=="string"&&e.trim())return e;return""}function R2(t){const e=Xa(t?.raw_output),r=e.candidate_claims;if(Array.isArray(r))return r;const a=Xa(e.validation).candidate_claims;return Array.isArray(a)?a:[]}function T2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),a=y2(r,100),l=hu(r,{includeCandidates:!0,limit:300}),[d,f]=$.useState(null),m=$.useMemo(()=>{const _=a.data??[];return _.find(b=>b.id===d)??_[0]},[a.data,d]),p=$.useMemo(()=>m?.page_url?(l.data??[]).filter(_=>_.page_url===m.page_url):[],[l.data,m?.page_url]),v=Xa(m?.page_context),w=Xa(m?.raw_output),y=Xa(w.page_context),x=Iy(v.clean_text,v.cleaned_text,v.text,y.clean_text,y.cleaned_text,y.text),S=Iy(v.html,v.raw_html,y.html,y.raw_html);return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/pipeline/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Uv,{className:"h-6 w-6 text-primary"}),"Page Analysis"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," · 추출 근거와 페이지 분석 로그"]})]}),u.jsx(Ee,{variant:"outline",onClick:()=>a.refetch(),children:"Refresh"})]}),(a.isError||l.isError)&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),a.error?.message??l.error?.message]})}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[360px_1fr]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Analysis Runs"}),u.jsx(Qe,{children:"페이지별 추출 실행 기록과 오류 상태"})]}),u.jsxs(ye,{children:[a.isLoading&&u.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((_,b)=>u.jsx(pn,{className:"h-16"},b))}),a.data?.length===0&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"아직 분석 로그가 없습니다. 먼저 크롤을 실행하세요."}),u.jsx("ul",{className:"max-h-[720px] divide-y overflow-y-auto",children:(a.data??[]).map(_=>u.jsx("li",{className:"py-2",children:u.jsxs("button",{type:"button",onClick:()=>f(_.id),className:"w-full rounded-md px-3 py-2 text-left transition-colors hover:bg-accent/10",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-sm font-medium",children:_.page_url??`run #${_.id}`}),u.jsx(Xe,{variant:_.error?"destructive":"success",children:_.error?"error":"ok"})]}),u.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:[u.jsx("span",{children:_.extractor_name}),u.jsx("span",{children:_.provider}),u.jsxs("span",{children:[_.candidate_count," candidates"]})]}),u.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:ai(_.created_at)})]})},_.id))})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:"Selected Page"}),u.jsx(Qe,{children:m?.page_url??"분석 로그를 선택하세요"})]}),m&&u.jsx(Xe,{variant:m.error?"destructive":"outline",children:m.provider})]})}),u.jsxs(ye,{children:[!m&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"표시할 페이지 분석 결과가 없습니다."}),m&&u.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[u.jsx(Nd,{label:"Extractor",value:m.extractor_name}),u.jsx(Nd,{label:"Candidates",value:String(m.candidate_count)}),u.jsx(Nd,{label:"Validation",value:Ct(m.validation)})]}),m?.error&&u.jsx("div",{className:"mt-4 rounded-md border border-destructive bg-destructive/5 px-3 py-2 text-sm text-destructive",children:m.error})]})]}),u.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(Fv,{className:"h-5 w-5"}),"Cleaned Text"]}),u.jsx(Qe,{children:"AI 분석에 투입된 정제 본문"})]}),u.jsx(ye,{children:u.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap rounded-md bg-secondary/30 p-3 text-xs leading-relaxed",children:x||"정제 본문이 저장되어 있지 않습니다."})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(Sf,{className:"h-5 w-5"}),"Raw Context"]}),u.jsx(Qe,{children:"원문 HTML 또는 분석 입력 컨텍스트"})]}),u.jsx(ye,{children:u.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap rounded-md bg-secondary/30 p-3 text-xs leading-relaxed",children:S||JSON.stringify(v||y,null,2)})})]})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Extracted Claims"}),u.jsx(Qe,{children:"같은 페이지에서 생성된 클레임과 근거 문장"})]}),u.jsxs(ye,{children:[l.isLoading&&u.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[u.jsx(dr,{className:"h-4 w-4 animate-spin"}),"클레임을 불러오는 중"]}),u.jsxs("div",{className:"space-y-3",children:[p.map(_=>u.jsxs("article",{className:"rounded-md border p-4",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[u.jsx("span",{className:"font-medium",children:Ct(_.subject)}),u.jsx(Xe,{variant:"secondary",children:_.predicate}),u.jsx("span",{className:"font-medium",children:Ct(_.object??_.object_value)}),u.jsx(Xe,{variant:"outline",children:tn(_.confidence)})]}),_.evidence_text&&u.jsxs("div",{className:"mt-3 rounded-md bg-yellow-50 px-3 py-2 text-sm text-yellow-950",children:[u.jsx(vS,{className:"mr-1 inline h-4 w-4"}),_.evidence_text]})]},_.id)),!l.isLoading&&p.length===0&&u.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"이 페이지 URL과 연결된 클레임이 없습니다."})]})]})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Candidate Payload"}),u.jsx(Qe,{children:"추출기가 반환한 후보 원본 일부"})]}),u.jsx(ye,{children:u.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-secondary/30 p-3 text-xs",children:JSON.stringify(R2(m),null,2)})})]})]})]})]})}function Nd({label:t,value:e}){return u.jsxs("div",{className:"rounded-md border bg-background px-3 py-2",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 truncate text-sm font-medium",children:e||"-"})]})}function My(t){return t.split(",").map(e=>e.trim()).filter(Boolean)}function L2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),a=Cx(i?.domain),l=$x(r),d=v2(r,100),f=j2(r),m=_2(r),[p,v]=$.useState(""),[w,y]=$.useState(""),[x,S]=$.useState(""),[_,b]=$.useState(""),[P,N]=$.useState(""),[F,L]=$.useState(""),k=$.useMemo(()=>new Set(a.data?.entity_types??[]),[a.data?.entity_types]),I=$.useMemo(()=>new Set((l.data?.entity_types??[]).map(Z=>Z.name.toLowerCase())),[l.data?.entity_types]),X=(a.data?.entity_types??[]).filter(Z=>!I.has(Z.toLowerCase())),re=async Z=>{if(Z.preventDefault(),!!p.trim())try{await f.mutateAsync({name:p.trim(),domain:i?.domain??"generic",description:w.trim()||null}),jt.success("Entity type saved"),v(""),y("")}catch(Oe){jt.error(Oe.message)}},de=async Z=>{if(Z.preventDefault(),!!x.trim())try{await m.mutateAsync({name:x.trim(),domain:i?.domain??"generic",description:F.trim()||null,allowed_subject_types:My(_),allowed_object_types:My(P),min_confidence:.8}),jt.success("Predicate rule saved"),S(""),b(""),N(""),L("")}catch(Oe){jt.error(Oe.message)}};return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/analysis/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Bv,{className:"h-6 w-6 text-primary"}),"Schema Designer"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," · 엔티티 타입과 Predicate 규칙 관리"]})]}),u.jsx(Ee,{variant:"outline",onClick:()=>l.refetch(),children:"Refresh"})]}),(l.isError||a.isError||d.isError)&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),l.error?.message??a.error?.message??d.error?.message]})}),u.jsxs("div",{className:"mb-6 grid gap-4 md:grid-cols-4",children:[u.jsx(Al,{label:"Entity types",value:l.data?.entity_types.length}),u.jsx(Al,{label:"Predicates",value:l.data?.relation_types.length}),u.jsx(Al,{label:"Schema proposals",value:d.data?.length}),u.jsx(Al,{label:"Domain coverage",value:a.data?.entity_types.length?tn(1-X.length/a.data.entity_types.length):"-"})]}),u.jsxs("div",{className:"grid gap-6 xl:grid-cols-[380px_1fr]",children:[u.jsxs("div",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(oS,{className:"h-5 w-5"}),"Entity Type"]}),u.jsx(Qe,{children:"AI가 생성할 수 있는 개체 종류를 명시합니다."})]}),u.jsx(ye,{children:u.jsxs("form",{className:"space-y-3",onSubmit:re,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"entityName",children:"Name"}),u.jsx(xt,{id:"entityName",value:p,onChange:Z=>v(Z.target.value),placeholder:"Product"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"entityDescription",children:"Description"}),u.jsx(ho,{id:"entityDescription",value:w,onChange:Z=>y(Z.target.value),rows:2,placeholder:"상품 또는 서비스 개체"})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:f.isPending,children:[f.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(ri,{className:"h-4 w-4"}),"Save entity type"]})]})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(kf,{className:"h-5 w-5"}),"Predicate Rule"]}),u.jsx(Qe,{children:"주어/목적어 타입과 최소 신뢰도 기준을 정의합니다."})]}),u.jsx(ye,{children:u.jsxs("form",{className:"space-y-3",onSubmit:de,children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"relationName",children:"Predicate"}),u.jsx(xt,{id:"relationName",value:x,onChange:Z=>S(Z.target.value),placeholder:"hasBrand"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"subjectTypes",children:"Subject types"}),u.jsx(xt,{id:"subjectTypes",value:_,onChange:Z=>b(Z.target.value),placeholder:"Product, Perfume"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"objectTypes",children:"Object types"}),u.jsx(xt,{id:"objectTypes",value:P,onChange:Z=>N(Z.target.value),placeholder:"Brand"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Ye,{htmlFor:"relationDescription",children:"Description"}),u.jsx(ho,{id:"relationDescription",value:F,onChange:Z=>L(Z.target.value),rows:2,placeholder:"상품이 특정 브랜드에 속함"})]}),u.jsxs(Ee,{type:"submit",className:"w-full",disabled:m.isPending,children:[m.isPending?u.jsx(dr,{className:"h-4 w-4 animate-spin"}):u.jsx(ri,{className:"h-4 w-4"}),"Save predicate rule"]})]})})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Registered Entity Types"}),u.jsx(Qe,{children:"프로젝트 스키마 레지스트리에 저장된 타입"})]}),u.jsx(ye,{children:l.isLoading?u.jsx(pn,{className:"h-32"}):u.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:(l.data?.entity_types??[]).map(Z=>u.jsxs("article",{className:"rounded-md border p-3",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("span",{className:"font-medium",children:Z.name}),u.jsx(Xe,{variant:k.has(Z.name)?"success":"outline",children:Z.domain??"generic"})]}),u.jsx("p",{className:"mt-2 line-clamp-2 text-sm text-muted-foreground",children:Z.description||Ct(Z.metadata)})]},Z.id))})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Predicate Rules"}),u.jsx(Qe,{children:"허용 관계와 타입 제약. 검증 단계에서 활용됩니다."})]}),u.jsx(ye,{children:u.jsxs("div",{className:"space-y-3",children:[(l.data?.relation_types??[]).map(Z=>u.jsxs("article",{className:"rounded-md border p-4",children:[u.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[u.jsx("span",{className:"font-medium",children:Z.name}),u.jsx(Xe,{variant:"outline",children:Z.status??"active"}),u.jsx("span",{className:"text-xs text-muted-foreground",children:tn(Z.confidence)})]}),u.jsxs("div",{className:"grid gap-3 text-sm md:grid-cols-2",children:[u.jsx(Fy,{label:"Subject",values:Z.allowed_subject_types}),u.jsx(Fy,{label:"Object",values:Z.allowed_object_types})]}),u.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:Z.description||Ct(Z.semantic_constraints)})]},Z.id)),l.data?.relation_types.length===0&&u.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"등록된 Predicate 규칙이 없습니다."})]})})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Schema Proposals"}),u.jsx(Qe,{children:"추출 중 발견된 스키마 보강 후보"})]}),u.jsx(ye,{children:u.jsxs("ul",{className:"divide-y",children:[(d.data??[]).map(Z=>u.jsxs("li",{className:"py-3 text-sm",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Xe,{variant:"secondary",children:Z.proposal_type}),u.jsx("span",{className:"font-medium",children:Z.name}),u.jsx(Xe,{variant:"outline",children:Z.status})]}),u.jsx("p",{className:"mt-1 text-muted-foreground",children:Z.reason||Z.evidence||"-"}),u.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:ai(Z.updated_at)})]},Z.id)),d.data?.length===0&&u.jsx("li",{className:"py-6 text-center text-sm text-muted-foreground",children:"현재 스키마 제안이 없습니다."})]})})]})]})]})]})}function Al({label:t,value:e}){return u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 text-2xl font-semibold",children:typeof e=="number"?e.toLocaleString():e??"-"})]})})}function Fy({label:t,values:e}){return u.jsxs("div",{children:[u.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"flex flex-wrap gap-1",children:e.length?e.map(r=>u.jsx(Xe,{variant:"outline",children:r},r)):u.jsx("span",{className:"text-xs text-muted-foreground",children:"Any"})})]})}const A2=new Set(["valid","ok","passed","clean"]),I2=new Set(["merged","active","synced","ok","ready"]),Dy=new Set(["value","keyword","name","item","product","brand","accord","note","unknown"]);function zx(t){switch(t){case"high":return"destructive";case"medium":return"warning";default:return"outline"}}function _r(t){return Ct(t).trim().toLowerCase().replace(/\s+/g," ")}function Ux(t){return Ct(t.object??t.object_value)}function M2(t){const e=t.value_type;return typeof e=="string"&&e.trim()?e.trim():void 0}function F2(t){return`${t.subject??""}|${t.predicate}|${Ux(t)}`.toLowerCase()}function Il(t,e){if(!e)return!1;const r=e.toLowerCase();return t.some(i=>i.toLowerCase()===r)}function js(t){return t.length?t.join(", "):"-"}function D2(t,e){if(t)for(const r of e){const i=t[r];if(typeof i=="number"&&Number.isFinite(i))return i}}function $2(t){return D2(t?.confidence_rules,["min_confidence","minimum_confidence","minConfidence"])??.7}function z2(t){if(!t)return;const e=new Date(t).getTime();if(Number.isFinite(e))return(Date.now()-e)/864e5}function U2(t,e,r){const i=[],a=new Map,l=new Map,d=new Set,f=new Map,m=new Map;r.forEach(p=>{m.set(p.name.toLowerCase(),p)});for(const p of e){const v=_r(p.name);if(!v)continue;const w=l.get(v)??[];w.push(p),l.set(v,w),f.set(v,p.type)}for(const p of t){const v=Ux(p),w=`${Ct(p.subject)} ${p.predicate} ${v}`,y=m.get(p.predicate.toLowerCase()),x=p.subject_type??f.get(_r(p.subject)),S=p.object_type??f.get(_r(v))??M2(p),_=p.evidence_text?.trim()??"",b=p.page_url?.trim()??"";if(y||i.push({id:`unknown-predicate-${p.id}`,type:"unknown_predicate",severity:"medium",title:"Predicate is not registered",detail:`${p.predicate} is missing from the ontology registry.`,target:w}),!b||!_?i.push({id:`source-${p.id}`,type:"missing_source",severity:"high",title:"Source or evidence is missing",detail:"Every claim should carry both page URL and evidence text.",target:w}):_.length<24&&i.push({id:`thin-evidence-${p.id}`,type:"thin_evidence",severity:"medium",title:"Evidence snippet is too thin",detail:"The supporting text is short enough to be ambiguous.",target:w}),_&&p.subject&&v){const X=_.toLowerCase(),re=_r(p.subject),de=_r(v),Z=re.length>2&&X.includes(re),Oe=de.length>2&&X.includes(de);!Z&&!Oe&&i.push({id:`evidence-alignment-${p.id}`,type:"weak_evidence_alignment",severity:"low",title:"Evidence does not mention the relation terms",detail:"The snippet may support the page generally, but not this exact relation.",target:w})}const P=$2(y);typeof p.confidence!="number"?i.push({id:`confidence-missing-${p.id}`,type:"missing_confidence",severity:"medium",title:"Confidence is missing",detail:"Claims need confidence for review prioritization.",target:w}):p.confidence180&&i.push({id:`stale-${p.id}`,type:"stale_claim",severity:"medium",title:"Claim is stale",detail:`Last observed ${Math.round(N)} days ago.`,target:w});const F=_r(p.subject),L=_r(v);(Dy.has(F)||F.length<=1)&&i.push({id:`generic-subject-${p.id}`,type:"generic_subject",severity:"medium",title:"Subject label is too generic",detail:"Generic entity labels should be normalized before graph commit.",target:w}),(Dy.has(L)||L.length<=1)&&i.push({id:`generic-object-${p.id}`,type:"generic_object",severity:"low",title:"Object label is too generic",detail:"The object value may need a more specific entity or literal label.",target:w});const k=F2(p),I=a.get(k);I?i.push({id:`duplicate-claim-${p.id}`,type:"duplicate_claim",severity:I.status!==p.status?"medium":"low",title:"Duplicate relation claim",detail:`Claim #${I.id} already has the same subject, predicate, and object.`,target:w}):a.set(k,p),p.subject&&d.add(_r(p.subject)),v&&d.add(_r(v))}for(const p of l.values())p.length>1&&i.push({id:`duplicate-entity-${p[0].id}`,type:"duplicate_entity",severity:"medium",title:"Duplicate entity candidate",detail:`${p.length} entities share the same normalized name.`,target:p[0].name});for(const p of e){const v=_r(p.name);d.has(v)||i.push({id:`isolated-${p.id}`,type:"isolated_entity",severity:"low",title:"Entity is isolated",detail:"No relation currently connects to this entity in the loaded claim set.",target:`[${p.type}] ${p.name}`}),["entity","unknown","unknown_entity"].includes(p.type.toLowerCase())&&i.push({id:`generic-entity-type-${p.id}`,type:"generic_entity_type",severity:"low",title:"Entity type is generic",detail:"The entity should be assigned to a domain-specific type.",target:`[${p.type}] ${p.name}`})}return i}function V2(t){const e=new Map;return t.forEach(r=>{e.set(r.type,(e.get(r.type)??0)+1)}),Array.from(e.entries()).map(([r,i])=>({type:r,count:i})).sort((r,i)=>i.count-r.count)}function B2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),a=hu(r,{includeCandidates:!0,limit:300}),l=Dx(r,void 0),d=$x(r),f=Kf(r),m=$.useMemo(()=>U2(a.data??[],l.data??[],d.data?.relation_types??[]),[a.data,l.data,d.data?.relation_types]),p=m.filter(k=>k.severity==="high").length,v=m.filter(k=>k.severity==="medium").length,w=m.filter(k=>k.severity==="low").length,y=Math.max(0,Math.round(100-p*10-v*5-w*1.5)),x=V2(m),S=new Set((d.data?.relation_types??[]).map(k=>k.name)),_=Array.from(new Set((a.data??[]).map(k=>k.predicate).filter(k=>!S.has(k)))),b=(a.data??[]).filter(k=>["validated_claim","rejected"].includes(k.status??"")).length,P=a.data?.length?b/a.data.length:0,N=m.filter(k=>["unknown_predicate","subject_type_mismatch","object_type_mismatch","page_type_mismatch","source_zone_mismatch","schema_violation"].includes(k.type)).length,F=m.filter(k=>["missing_source","thin_evidence","weak_evidence_alignment"].includes(k.type)).length,L=m.slice(0,250);return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/review/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Hd,{className:"h-6 w-6 text-primary"}),"Quality Inspector"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," schema, evidence, duplicate, and graph readiness checks."]})]}),u.jsx(Ee,{variant:"outline",onClick:()=>{a.refetch(),l.refetch(),d.refetch(),f.refetch()},children:"Refresh"})]}),(a.isError||l.isError||d.isError)&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),a.error?.message??l.error?.message??d.error?.message]})}),u.jsxs("div",{className:"mb-6 grid gap-4 md:grid-cols-5",children:[u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:"Quality score"}),u.jsx("div",{className:"mt-1 text-3xl font-semibold",children:y}),u.jsx(Ji,{value:y,className:"mt-3"})]})}),u.jsx(Ml,{label:"High",value:p,tone:"high"}),u.jsx(Ml,{label:"Medium",value:v,tone:"medium"}),u.jsx(Ml,{label:"Low",value:w,tone:"low"}),u.jsx(Ml,{label:"Review rate",value:tn(P)})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_360px]",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[u.jsx(Ve,{children:"Validation Issues"}),m.length>L.length&&u.jsxs(Xe,{variant:"outline",children:["Showing ",L.length," of ",m.length]})]}),u.jsx(Qe,{children:"Rule-based warnings generated from claim evidence and ontology registry constraints."})]}),u.jsxs(ye,{children:[(a.isLoading||l.isLoading||d.isLoading)&&u.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((k,I)=>u.jsx(pn,{className:"h-20"},I))}),!a.isLoading&&!l.isLoading&&!d.isLoading&&m.length===0&&u.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-center text-sm text-muted-foreground",children:[u.jsx(Hd,{className:"h-10 w-10 opacity-50"}),"No quality warnings were found in the loaded scope."]}),u.jsx("div",{className:"space-y-3",children:L.map(k=>u.jsxs("article",{className:"rounded-md border p-4",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Xe,{variant:zx(k.severity),children:k.severity}),u.jsx(Xe,{variant:"outline",children:k.type}),u.jsx("span",{className:"font-medium",children:k.title})]}),u.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:k.detail}),u.jsx("div",{className:"mt-2 rounded-md bg-secondary/30 px-3 py-2 text-sm",children:k.target})]},k.id))})]})]}),u.jsxs("div",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(kS,{className:"h-5 w-5"}),"Schema Coverage"]}),u.jsx(Qe,{children:"Predicate and type coverage against the ontology registry."})]}),u.jsxs(ye,{className:"space-y-3",children:[u.jsx(Mi,{label:"Relation rules",value:S.size}),u.jsx(Mi,{label:"Schema warnings",value:N}),u.jsx(Mi,{label:"Evidence warnings",value:F}),u.jsxs("div",{className:"flex items-center justify-between text-sm",children:[u.jsx("span",{children:"Unknown predicates"}),u.jsx(Xe,{variant:_.length?"warning":"success",children:_.length})]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.map(k=>u.jsx(Xe,{variant:"outline",children:k},k)),_.length===0&&u.jsx("span",{className:"text-sm text-muted-foreground",children:"All loaded predicates are registered."})]})]})]}),u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(jS,{className:"h-5 w-5"}),"Graph Readiness"]}),u.jsx(Qe,{children:"Build output ready for graph and exports."})]}),u.jsxs(ye,{className:"space-y-3",children:[u.jsx(Mi,{label:"Collected pages",value:f.data?.stages.find(k=>k.key==="crawled")?.count??0}),u.jsx(Mi,{label:"Approved claims",value:f.data?.stages.find(k=>k.key==="validated")?.count??0}),u.jsx(Mi,{label:"Graph triples",value:f.data?.stages.find(k=>k.key==="graph")?.count??0})]})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(iS,{className:"h-5 w-5"}),"Issue Mix"]})}),u.jsx(ye,{children:u.jsxs("ul",{className:"space-y-2 text-sm",children:[x.slice(0,8).map(k=>u.jsxs("li",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[u.jsx("span",{children:k.type}),u.jsx("span",{className:"font-medium",children:k.count})]},k.type)),x.length===0&&u.jsx("li",{className:"py-4 text-center text-muted-foreground",children:"No issues in the loaded scope."})]})})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsx(Ve,{children:"Recommended Actions"})}),u.jsx(ye,{children:u.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[p>0&&u.jsx("li",{children:"Resolve missing evidence, type violations, and conflicts before export."}),v>0&&u.jsx("li",{children:"Review stale claims, thin evidence, duplicate relations, and missing rule fields."}),_.length>0&&u.jsx("li",{children:"Add missing predicate rules in Schema Designer."}),y>=90&&u.jsx("li",{children:"The ontology is ready for graph inspection and Export/API handoff."})]})})]})]})]})]})}function Ml({label:t,value:e,tone:r}){return u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-2xl font-semibold",children:e}),r&&u.jsx(Xe,{variant:zx(r),children:r})]})]})})}function Mi({label:t,value:e}){return u.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:[u.jsx("span",{className:"text-muted-foreground",children:t}),u.jsx("span",{className:"font-medium",children:e.toLocaleString()})]})}const $y=["#2563eb","#059669","#d97706","#7c3aed","#db2777","#0891b2","#4b5563","#dc2626"];function mf(t,e){const r=Math.max(e.indexOf(t),0);return $y[r%$y.length]}function q2(t,e,r){const i=r.search.trim().toLowerCase(),a=Array.from(new Set(t.map(S=>S.type||"Entity").concat("Literal"))).sort(),l=new Map;t.forEach(S=>{const _=S.type||"Entity";l.set(String(S.id),{id:String(S.id),name:S.name,type:_,x:0,y:0,radius:18,color:mf(_,a),source:"entity",raw:S})});const d=[];e.forEach(S=>{const _=S.confidence??0;if(_r.entityType&&S.type!==r.entityType?!1:i?S.name.toLowerCase().includes(i)||S.type.toLowerCase().includes(i):!0);const m=new Set(f.map(S=>S.id)),p=d.filter(S=>m.has(S.source)&&m.has(S.target)),v=new Set;p.forEach(S=>{v.add(S.source),v.add(S.target)}),(r.predicate||r.minConfidence>0||i)&&(f=f.filter(S=>v.has(S.id)));const w=430,y=300,x=Math.max(160,Math.min(260,f.length*13));return f.forEach((S,_)=>{const b=Math.PI*2*_/Math.max(f.length,1);S.x=w+Math.cos(b)*x,S.y=y+Math.sin(b)*x}),{nodes:f,edges:p,types:a}}function H2(t,e){const r=e.find(a=>a.id===t.source),i=e.find(a=>a.id===t.target);return{source:r,target:i}}function W2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),[a,l]=$.useState("validated_claim"),[d,f]=$.useState(!0),[m,p]=$.useState(""),[v,w]=$.useState(""),[y,x]=$.useState(""),[S,_]=$.useState(0),[b,P]=$.useState(null),N=x2(r,{includeCandidates:d&&a==="validated_claim",limit:300,status:d&&a==="validated_claim"?void 0:a}),F=$.useMemo(()=>Array.from(new Set((N.data?.edges??[]).map(I=>I.predicate))).sort(),[N.data?.edges]),L=$.useMemo(()=>q2(N.data?.nodes??[],N.data?.edges??[],{search:m,predicate:v,entityType:y,minConfidence:S}),[y,N.data?.edges,N.data?.nodes,S,v,m]),k=L.edges.length?L.edges.reduce((I,X)=>I+X.confidence,0)/L.edges.length:0;return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/quality/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Cf,{className:"h-6 w-6 text-primary"}),"Graph View"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," relation graph, candidates, and edge evidence."]})]}),u.jsxs(Ee,{variant:"outline",onClick:()=>N.refetch(),children:[u.jsx(zv,{className:"h-4 w-4"}),"Refresh"]})]}),N.isError&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),N.error.message]})}),u.jsxs("div",{className:"mb-4 grid gap-3 xl:grid-cols-[1fr_180px_180px_180px_220px]",children:[u.jsxs("div",{className:"relative",children:[u.jsx(Vv,{className:"pointer-events-none absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),u.jsx(xt,{value:m,onChange:I=>p(I.target.value),className:"pl-9",placeholder:"Search node or type"})]}),u.jsxs(En,{value:y,onChange:I=>x(I.target.value),children:[u.jsx("option",{value:"",children:"All types"}),L.types.map(I=>u.jsx("option",{value:I,children:I},I))]}),u.jsxs(En,{value:v,onChange:I=>w(I.target.value),children:[u.jsx("option",{value:"",children:"All predicates"}),F.map(I=>u.jsx("option",{value:I,children:I},I))]}),u.jsxs(En,{value:a,onChange:I=>l(I.target.value),children:[u.jsx("option",{value:"validated_claim",children:"Validated"}),u.jsx("option",{value:"candidate_claim",children:"Candidate"}),u.jsx("option",{value:"rule_candidate",children:"Rule candidate"}),u.jsx("option",{value:"active",children:"Active"}),u.jsx("option",{value:"all",children:"All statuses"})]}),u.jsxs("label",{className:"flex items-center gap-2 rounded-md border px-3 text-sm",children:[u.jsx("input",{type:"checkbox",checked:d,disabled:a!=="validated_claim",onChange:I=>f(I.target.checked)}),"Blend candidates"]})]}),u.jsxs("div",{className:"mb-6 rounded-md border px-4 py-3",children:[u.jsxs("div",{className:"mb-2 flex items-center justify-between text-sm",children:[u.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[u.jsx(NS,{className:"h-4 w-4"}),"Minimum confidence"]}),u.jsx("span",{children:tn(S)})]}),u.jsx("input",{type:"range",min:0,max:1,step:.05,value:S,onChange:I=>_(Number(I.target.value)),className:"w-full"})]}),u.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_360px]",children:[u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:"Ontology Network"}),u.jsxs(Qe,{children:[L.nodes.length," nodes / ",L.edges.length," edges shown"]})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:L.types.slice(0,8).map(I=>u.jsxs("span",{className:"flex items-center gap-1 text-xs",children:[u.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:mf(I,L.types)}}),I]},I))})]})}),u.jsx(ye,{children:N.isLoading?u.jsx(pn,{className:"h-[640px]"}):L.nodes.length===0?u.jsxs("div",{className:"flex h-[500px] flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground",children:[u.jsx(kf,{className:"h-12 w-12 opacity-50"}),"No graph is available for the current filters."]}):u.jsxs("svg",{viewBox:"0 0 860 600",className:"h-[640px] w-full rounded-md border bg-secondary/20",role:"img","aria-label":"Ontology graph",children:[u.jsx("defs",{children:u.jsx("marker",{id:"arrow",markerWidth:"10",markerHeight:"10",refX:"10",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:u.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#64748b"})})}),L.edges.map(I=>{const{source:X,target:re}=H2(I,L.nodes);if(!X||!re)return null;const de=(X.x+re.x)/2,Z=(X.y+re.y)/2;return u.jsxs("g",{className:"cursor-pointer",onClick:()=>P(I),children:[u.jsx("line",{x1:X.x,y1:X.y,x2:re.x,y2:re.y,stroke:"#64748b",strokeWidth:1+I.confidence*3,strokeOpacity:"0.65",markerEnd:"url(#arrow)"}),u.jsx("text",{x:de,y:Z,textAnchor:"middle",className:"fill-slate-600 text-[10px]",children:I.predicate})]},I.id)}),L.nodes.map(I=>u.jsxs("g",{className:"cursor-pointer",onClick:()=>P(I),children:[u.jsx("circle",{cx:I.x,cy:I.y,r:I.radius,fill:I.color,stroke:b&&"id"in b&&b.id===I.id?"#111827":"#ffffff",strokeWidth:"2"}),u.jsx("text",{x:I.x,y:I.y+I.radius+14,textAnchor:"middle",className:"fill-slate-800 text-[11px] font-medium",children:I.name.length>24?`${I.name.slice(0,24)}...`:I.name})]},I.id))]})})]}),u.jsxs("aside",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsx(Ve,{children:"Selection"}),u.jsx(Qe,{children:"Click a node or edge to inspect it."})]}),u.jsxs(ye,{children:[!b&&u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Nothing selected."}),b&&"predicate"in b&&u.jsxs("div",{className:"space-y-3",children:[u.jsx(Xe,{variant:"secondary",children:b.predicate}),u.jsx(Sr,{label:"Claim",value:`#${b.id}`}),u.jsx(Sr,{label:"Status",value:b.raw.status}),u.jsx(Sr,{label:"Confidence",value:tn(b.confidence)}),u.jsx(Sr,{label:"Object",value:b.raw.object?.name??b.raw.target_value}),u.jsx(Sr,{label:"Last seen",value:ai(b.raw.last_seen_at)}),u.jsx(Sr,{label:"Metadata",value:Ct(b.raw.metadata)})]}),b&&!("predicate"in b)&&u.jsxs("div",{className:"space-y-3",children:[u.jsx(Xe,{variant:"outline",children:b.type}),u.jsx(Sr,{label:"Name",value:b.name}),u.jsx(Sr,{label:"Source",value:b.source}),u.jsx(Sr,{label:"Canonical",value:b.raw?.canonical_name}),u.jsx(Sr,{label:"Metadata",value:Ct(b.raw?.metadata)})]})]})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsx(Ve,{children:"Graph Health"})}),u.jsxs(ye,{className:"space-y-3",children:[u.jsx(Cd,{label:"Visible nodes",value:L.nodes.length}),u.jsx(Cd,{label:"Visible edges",value:L.edges.length}),u.jsx(Cd,{label:"Avg confidence",value:L.edges.length?tn(k):"-"}),u.jsx(Ji,{value:k*100})]})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(uS,{className:"h-5 w-5"}),"Predicate Counts"]})}),u.jsx(ye,{children:u.jsxs("ul",{className:"space-y-2 text-sm",children:[F.map(I=>{const X=(N.data?.edges??[]).filter(re=>re.predicate===I).length;return u.jsxs("li",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[u.jsx("span",{children:I}),u.jsx("span",{className:"font-medium",children:X})]},I)}),F.length===0&&u.jsx("li",{className:"py-4 text-center text-muted-foreground",children:"No predicates found."})]})})]})]})]})]})}function Sr({label:t,value:e}){return u.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:t}),u.jsx("div",{className:"mt-1 break-words font-medium",children:Ct(e)})]})}function Cd({label:t,value:e}){return u.jsxs("div",{className:"flex items-center justify-between text-sm",children:[u.jsx("span",{className:"text-muted-foreground",children:t}),u.jsx("span",{className:"font-medium",children:typeof e=="number"?e.toLocaleString():e})]})}const zy=[{value:"validated_claim",label:"Validated claims"},{value:"active",label:"Active claims"},{value:"candidate_claim",label:"Candidate claims"},{value:"rule_candidate",label:"Rule candidates"},{value:"rejected",label:"Rejected claims"},{value:"all",label:"All statuses"}];function Ha(t,e){return Ct(t[e])}function K2(){const t=mn(),{projectId:e}=fr(),r=e??"",{data:i}=hr(r),[a,l]=$.useState("validated_claim"),[d,f]=$.useState(!0),[m,p]=$.useState(1e3),[v,w]=$.useState(null),y=w2(r,{status:a,includeEvidence:d,limit:m}),x=$.useMemo(()=>({json:Qn.exportUrl(r,"json",a,d,m),csv:Qn.exportUrl(r,"csv",a,d,m),turtle:Qn.exportUrl(r,"turtle",a,d,m)}),[d,m,r,a]),_=`${typeof window<"u"&&window.location?.origin?window.location.origin:""}${x.json}`,b=`curl -L "${_}"`,P=`const response = await fetch("${x.json}"); -const ontology = await response.json();`,N=y.data?.claims.slice(0,8)??[],F=y.data?.claims.length?y.data.claims.reduce((k,I)=>{const X=I.confidence;return k+(typeof X=="number"?X:0)},0)/y.data.claims.length:0;async function L(k,I){try{await navigator.clipboard.writeText(k),w(I),window.setTimeout(()=>w(null),1600)}catch{w("failed")}}return u.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-8",children:[u.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[u.jsx(Ee,{variant:"ghost",size:"icon",onClick:()=>t(`/graph/${r}`),"aria-label":"Back",children:u.jsx(Zn,{className:"h-4 w-4"})}),u.jsxs("div",{className:"flex-1",children:[u.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold tracking-tight",children:[u.jsx(Sf,{className:"h-6 w-6 text-primary"}),"Export / API Center"]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:[i?.name??r," exports, endpoint settings, and integration snippets."]})]}),u.jsxs(Ee,{variant:"outline",onClick:()=>y.refetch(),children:[u.jsx(zv,{className:"h-4 w-4"}),"Refresh"]})]}),y.isError&&u.jsx(ge,{className:"mb-6 border-destructive",children:u.jsxs(ye,{className:"flex items-center gap-2 py-4 text-sm text-destructive",children:[u.jsx(fn,{className:"h-4 w-4"}),y.error.message]})}),u.jsxs("div",{className:"mb-6 grid gap-3 lg:grid-cols-[220px_180px_1fr_180px]",children:[u.jsx(En,{value:a,onChange:k=>l(k.target.value),children:zy.map(k=>u.jsx("option",{value:k.value,children:k.label},k.value))}),u.jsx(xt,{type:"number",min:1,max:5e3,value:m,onChange:k=>p(Math.max(1,Math.min(5e3,Number(k.target.value)||1))),"aria-label":"Export row limit"}),u.jsxs("label",{className:"flex items-center gap-2 rounded-md border px-3 text-sm",children:[u.jsx("input",{type:"checkbox",checked:d,onChange:k=>f(k.target.checked)}),"Include evidence text"]}),u.jsxs(Xe,{variant:"outline",className:"justify-center py-2",children:[y.data?.count??0," rows"]})]}),u.jsxs("div",{className:"mb-6 grid gap-4 md:grid-cols-3",children:[u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:"Export rows"}),u.jsx("div",{className:"mt-1 text-3xl font-semibold",children:(y.data?.count??0).toLocaleString()})]})}),u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:"Status scope"}),u.jsx("div",{className:"mt-1 text-lg font-semibold",children:zy.find(k=>k.value===a)?.label})]})}),u.jsx(ge,{children:u.jsxs(ye,{className:"py-4",children:[u.jsx("div",{className:"text-xs text-muted-foreground",children:"Avg confidence"}),u.jsx("div",{className:"mt-1 text-3xl font-semibold",children:tn(F)})]})})]}),u.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_380px]",children:[u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx(Ve,{children:"Export Preview"}),u.jsx(Qe,{children:"First rows from the JSON export endpoint."})]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx(Ed,{href:x.json,icon:Wd,label:"JSON"}),u.jsx(Ed,{href:x.csv,icon:pS,label:"CSV"}),u.jsx(Ed,{href:x.turtle,icon:Fv,label:"Turtle"})]})]})}),u.jsx(ye,{children:y.isLoading?u.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((k,I)=>u.jsx(pn,{className:"h-16"},I))}):N.length===0?u.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"No export rows match the current settings."}):u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-left text-sm",children:[u.jsx("thead",{className:"border-b text-xs text-muted-foreground",children:u.jsxs("tr",{children:[u.jsx("th",{className:"py-2 pr-3",children:"Claim"}),u.jsx("th",{className:"py-2 pr-3",children:"Subject"}),u.jsx("th",{className:"py-2 pr-3",children:"Predicate"}),u.jsx("th",{className:"py-2 pr-3",children:"Object"}),u.jsx("th",{className:"py-2 pr-3",children:"Confidence"}),u.jsx("th",{className:"py-2 pr-3",children:"Last seen"})]})}),u.jsx("tbody",{className:"divide-y",children:N.map((k,I)=>u.jsxs("tr",{children:[u.jsxs("td",{className:"py-3 pr-3 font-medium",children:["#",Ha(k,"claim_id")]}),u.jsx("td",{className:"max-w-[180px] truncate py-3 pr-3",children:Ha(k,"subject")}),u.jsx("td",{className:"py-3 pr-3",children:u.jsx(Xe,{variant:"secondary",children:Ha(k,"predicate")})}),u.jsx("td",{className:"max-w-[220px] truncate py-3 pr-3",children:Ha(k,"object")}),u.jsx("td",{className:"py-3 pr-3",children:typeof k.confidence=="number"?tn(k.confidence):"-"}),u.jsx("td",{className:"py-3 pr-3",children:ai(typeof k.last_seen_at=="string"?k.last_seen_at:void 0)})]},`${Ha(k,"claim_id")}-${I}`))})]})})})]}),u.jsxs("aside",{className:"space-y-6",children:[u.jsxs(ge,{children:[u.jsxs(Ue,{children:[u.jsxs(Ve,{className:"flex items-center gap-2",children:[u.jsx(lS,{className:"h-5 w-5"}),"API Endpoint"]}),u.jsx(Qe,{children:"Same settings as the preview."})]}),u.jsxs(ye,{className:"space-y-3",children:[u.jsx(Vx,{value:_}),u.jsxs(Ee,{variant:"outline",className:"w-full",onClick:()=>L(_,"endpoint"),children:[u.jsx(Iv,{className:"h-4 w-4"}),v==="endpoint"?"Copied":"Copy endpoint"]})]})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsx(Ve,{children:"Integration Snippets"})}),u.jsxs(ye,{className:"space-y-4",children:[u.jsx(Uy,{title:"cURL",value:b,copied:v==="curl",onCopy:()=>L(b,"curl")}),u.jsx(Uy,{title:"JavaScript",value:P,copied:v==="fetch",onCopy:()=>L(P,"fetch")})]})]}),u.jsxs(ge,{children:[u.jsx(Ue,{children:u.jsx(Ve,{children:"Formats"})}),u.jsxs(ye,{className:"space-y-2 text-sm",children:[u.jsx(Pd,{label:"JSON",detail:"API-first claim objects with evidence."}),u.jsx(Pd,{label:"CSV",detail:"Spreadsheet-friendly rows for review."}),u.jsx(Pd,{label:"Turtle",detail:"RDF triples for semantic graph tools."})]})]})]})]})]})}function Ed({href:t,icon:e,label:r}){return u.jsxs("a",{href:t,className:_t(lx({variant:"outline",size:"sm"})),children:[u.jsx(e,{className:"h-4 w-4"}),r]})}function Vx({value:t}){return u.jsx("pre",{className:"max-h-40 overflow-auto rounded-md bg-secondary/40 p-3 text-xs",children:u.jsx("code",{children:t})})}function Uy({title:t,value:e,copied:r,onCopy:i}){return u.jsxs("div",{className:"rounded-md border p-3",children:[u.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[u.jsx("span",{className:"text-sm font-medium",children:t}),u.jsxs(Ee,{variant:"ghost",size:"sm",onClick:i,children:[u.jsx(Iv,{className:"h-4 w-4"}),r?"Copied":"Copy"]})]}),u.jsx(Vx,{value:e})]})}function Pd({label:t,detail:e}){return u.jsxs("div",{className:"rounded-md border px-3 py-2",children:[u.jsx("div",{className:"font-medium",children:t}),u.jsx("div",{className:"text-xs text-muted-foreground",children:e})]})}function Q2(){return u.jsx(fb,{children:u.jsxs(ln,{element:u.jsx(TN,{}),children:[u.jsx(ln,{path:"/",element:u.jsx(k2,{})}),u.jsx(ln,{path:"/onboard",element:u.jsx(hC,{})}),u.jsx(ln,{path:"/sources/:projectId",element:u.jsx(xC,{})}),u.jsx(ln,{path:"/crawl/:projectId",element:u.jsx(OC,{})}),u.jsx(ln,{path:"/pipeline/:projectId",element:u.jsx(O2,{})}),u.jsx(ln,{path:"/analysis/:projectId",element:u.jsx(T2,{})}),u.jsx(ln,{path:"/schema/:projectId",element:u.jsx(L2,{})}),u.jsx(ln,{path:"/research/:projectId",element:u.jsx(DC,{})}),u.jsx(ln,{path:"/editor/:projectId",element:u.jsx(t2,{})}),u.jsx(ln,{path:"/review/:projectId",element:u.jsx(r2,{})}),u.jsx(ln,{path:"/quality/:projectId",element:u.jsx(B2,{})}),u.jsx(ln,{path:"/graph/:projectId",element:u.jsx(W2,{})}),u.jsx(ln,{path:"/export/:projectId",element:u.jsx(K2,{})})]})})}const Bx={name:"",domain:"",format:null,fileName:null,rawText:""},Z2={draft:Bx,isDirty:!1},G2=Af({name:"ontology",initialState:Z2,reducers:{updateDraft:(t,e)=>{t.draft={...t.draft,...e.payload},t.isDirty=!0},resetDraft:t=>{t.draft=Bx,t.isDirty=!1},markClean:t=>{t.isDirty=!1}}}),J2=G2.reducer,Y2={activeJobId:null,expandedStep:null,showLogs:!0,autoScrollLogs:!0},X2=Af({name:"crawl",initialState:Y2,reducers:{setActiveJob:(t,e)=>{t.activeJobId=e.payload},expandStep:(t,e)=>{t.expandedStep=e.payload},toggleLogs:t=>{t.showLogs=!t.showLogs},setAutoScroll:(t,e)=>{t.autoScrollLogs=e.payload}}}),eE=X2.reducer,tE=ak({reducer:{ontology:J2,crawl:eE,ui:vk}}),nE=new Xb({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1e3*60*10,retry:1},mutations:{retry:1}}});W1.createRoot(document.getElementById("root")).render(u.jsx(ne.StrictMode,{children:u.jsx(gw,{store:tE,children:u.jsx(ej,{client:nE,children:u.jsxs(wb,{basename:"/static/",children:[u.jsx(Q2,{}),u.jsx(Dj,{position:"top-right"})]})})})})); -//# sourceMappingURL=index-B9qLr-xp.js.map diff --git a/crawler_platform/app/web/static/assets/index-B9qLr-xp.js.map b/crawler_platform/app/web/static/assets/index-B9qLr-xp.js.map deleted file mode 100644 index 9dd7a6a..0000000 --- a/crawler_platform/app/web/static/assets/index-B9qLr-xp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index-B9qLr-xp.js","sources":["../../frontend/node_modules/react/cjs/react.production.min.js","../../frontend/node_modules/react/index.js","../../frontend/node_modules/react/cjs/react-jsx-runtime.production.min.js","../../frontend/node_modules/react/jsx-runtime.js","../../frontend/node_modules/scheduler/cjs/scheduler.production.min.js","../../frontend/node_modules/scheduler/index.js","../../frontend/node_modules/react-dom/cjs/react-dom.production.min.js","../../frontend/node_modules/react-dom/index.js","../../frontend/node_modules/react-dom/client.js","../../frontend/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../frontend/node_modules/use-sync-external-store/shim/index.js","../../frontend/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../../frontend/node_modules/use-sync-external-store/shim/with-selector.js","../../frontend/node_modules/react-redux/es/utils/batch.js","../../frontend/node_modules/react-redux/es/components/Context.js","../../frontend/node_modules/react-redux/es/hooks/useReduxContext.js","../../frontend/node_modules/react-redux/es/utils/useSyncExternalStore.js","../../frontend/node_modules/react-redux/es/hooks/useSelector.js","../../frontend/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js","../../frontend/node_modules/hoist-non-react-statics/node_modules/react-is/index.js","../../frontend/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../frontend/node_modules/react-is/cjs/react-is.production.min.js","../../frontend/node_modules/react-is/index.js","../../frontend/node_modules/react-redux/es/utils/Subscription.js","../../frontend/node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js","../../frontend/node_modules/react-redux/es/components/Provider.js","../../frontend/node_modules/react-redux/es/hooks/useStore.js","../../frontend/node_modules/react-redux/es/hooks/useDispatch.js","../../frontend/node_modules/react-redux/es/index.js","../../frontend/node_modules/@remix-run/router/dist/router.js","../../frontend/node_modules/react-router/dist/index.js","../../frontend/node_modules/react-router-dom/dist/index.js","../../frontend/node_modules/@tanstack/query-core/build/modern/subscribable.js","../../frontend/node_modules/@tanstack/query-core/build/modern/focusManager.js","../../frontend/node_modules/@tanstack/query-core/build/modern/timeoutManager.js","../../frontend/node_modules/@tanstack/query-core/build/modern/utils.js","../../frontend/node_modules/@tanstack/query-core/build/modern/environmentManager.js","../../frontend/node_modules/@tanstack/query-core/build/modern/thenable.js","../../frontend/node_modules/@tanstack/query-core/build/modern/notifyManager.js","../../frontend/node_modules/@tanstack/query-core/build/modern/onlineManager.js","../../frontend/node_modules/@tanstack/query-core/build/modern/retryer.js","../../frontend/node_modules/@tanstack/query-core/build/modern/removable.js","../../frontend/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js","../../frontend/node_modules/@tanstack/query-core/build/modern/query.js","../../frontend/node_modules/@tanstack/query-core/build/modern/queryObserver.js","../../frontend/node_modules/@tanstack/query-core/build/modern/mutation.js","../../frontend/node_modules/@tanstack/query-core/build/modern/mutationCache.js","../../frontend/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../frontend/node_modules/@tanstack/query-core/build/modern/queryCache.js","../../frontend/node_modules/@tanstack/query-core/build/modern/queryClient.js","../../frontend/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js","../../frontend/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js","../../frontend/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js","../../frontend/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js","../../frontend/node_modules/@tanstack/react-query/build/modern/suspense.js","../../frontend/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js","../../frontend/node_modules/@tanstack/react-query/build/modern/useQuery.js","../../frontend/node_modules/@tanstack/react-query/build/modern/useMutation.js","../../frontend/node_modules/sonner/dist/index.mjs","../../frontend/node_modules/i18next/dist/esm/i18next.js","../../frontend/node_modules/react-i18next/dist/es/utils.js","../../frontend/node_modules/react-i18next/dist/es/unescape.js","../../frontend/node_modules/react-i18next/dist/es/defaults.js","../../frontend/node_modules/react-i18next/dist/es/i18nInstance.js","../../frontend/node_modules/react-i18next/dist/es/initReactI18next.js","../../frontend/node_modules/react-i18next/dist/es/context.js","../../frontend/node_modules/react-i18next/dist/es/useTranslation.js","../../frontend/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../frontend/node_modules/@babel/runtime/helpers/esm/typeof.js","../../frontend/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../frontend/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../frontend/node_modules/@babel/runtime/helpers/esm/createClass.js","../../frontend/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js","../../frontend/node_modules/i18next-http-backend/esm/utils.js","../../frontend/node_modules/cross-fetch/dist/browser-ponyfill.js","../../frontend/node_modules/i18next-http-backend/esm/getFetch.cjs","../../frontend/node_modules/i18next-http-backend/esm/request.js","../../frontend/node_modules/i18next-http-backend/esm/index.js","../../frontend/src/i18n.ts","../../frontend/node_modules/lucide-react/dist/esm/defaultAttributes.js","../../frontend/node_modules/lucide-react/dist/esm/createLucideIcon.js","../../frontend/node_modules/lucide-react/dist/esm/icons/activity.js","../../frontend/node_modules/lucide-react/dist/esm/icons/alert-circle.js","../../frontend/node_modules/lucide-react/dist/esm/icons/alert-triangle.js","../../frontend/node_modules/lucide-react/dist/esm/icons/arrow-left.js","../../frontend/node_modules/lucide-react/dist/esm/icons/arrow-right.js","../../frontend/node_modules/lucide-react/dist/esm/icons/ban.js","../../frontend/node_modules/lucide-react/dist/esm/icons/book-open.js","../../frontend/node_modules/lucide-react/dist/esm/icons/braces.js","../../frontend/node_modules/lucide-react/dist/esm/icons/brain.js","../../frontend/node_modules/lucide-react/dist/esm/icons/check-circle-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/check.js","../../frontend/node_modules/lucide-react/dist/esm/icons/circle-dot.js","../../frontend/node_modules/lucide-react/dist/esm/icons/clipboard-check.js","../../frontend/node_modules/lucide-react/dist/esm/icons/clipboard.js","../../frontend/node_modules/lucide-react/dist/esm/icons/clock.js","../../frontend/node_modules/lucide-react/dist/esm/icons/code-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/database.js","../../frontend/node_modules/lucide-react/dist/esm/icons/external-link.js","../../frontend/node_modules/lucide-react/dist/esm/icons/eye.js","../../frontend/node_modules/lucide-react/dist/esm/icons/file-json.js","../../frontend/node_modules/lucide-react/dist/esm/icons/file-search.js","../../frontend/node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js","../../frontend/node_modules/lucide-react/dist/esm/icons/file-text.js","../../frontend/node_modules/lucide-react/dist/esm/icons/filter.js","../../frontend/node_modules/lucide-react/dist/esm/icons/folder-open.js","../../frontend/node_modules/lucide-react/dist/esm/icons/git-branch.js","../../frontend/node_modules/lucide-react/dist/esm/icons/globe.js","../../frontend/node_modules/lucide-react/dist/esm/icons/highlighter.js","../../frontend/node_modules/lucide-react/dist/esm/icons/history.js","../../frontend/node_modules/lucide-react/dist/esm/icons/layers-3.js","../../frontend/node_modules/lucide-react/dist/esm/icons/layout-dashboard.js","../../frontend/node_modules/lucide-react/dist/esm/icons/link-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/link.js","../../frontend/node_modules/lucide-react/dist/esm/icons/list-checks.js","../../frontend/node_modules/lucide-react/dist/esm/icons/loader-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/menu.js","../../frontend/node_modules/lucide-react/dist/esm/icons/network.js","../../frontend/node_modules/lucide-react/dist/esm/icons/play-circle.js","../../frontend/node_modules/lucide-react/dist/esm/icons/plus.js","../../frontend/node_modules/lucide-react/dist/esm/icons/refresh-cw.js","../../frontend/node_modules/lucide-react/dist/esm/icons/rotate-cw.js","../../frontend/node_modules/lucide-react/dist/esm/icons/search-check.js","../../frontend/node_modules/lucide-react/dist/esm/icons/search.js","../../frontend/node_modules/lucide-react/dist/esm/icons/settings-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/shield-alert.js","../../frontend/node_modules/lucide-react/dist/esm/icons/shield-check.js","../../frontend/node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js","../../frontend/node_modules/lucide-react/dist/esm/icons/sparkles.js","../../frontend/node_modules/lucide-react/dist/esm/icons/target.js","../../frontend/node_modules/lucide-react/dist/esm/icons/trash-2.js","../../frontend/node_modules/lucide-react/dist/esm/icons/upload-cloud.js","../../frontend/node_modules/lucide-react/dist/esm/icons/x-circle.js","../../frontend/node_modules/lucide-react/dist/esm/icons/x.js","../../frontend/node_modules/immer/dist/immer.esm.mjs","../../frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../frontend/node_modules/redux/es/redux.js","../../frontend/node_modules/redux-thunk/es/index.js","../../frontend/node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js","../../frontend/src/stores/slices/uiSlice.ts","../../frontend/node_modules/clsx/dist/clsx.mjs","../../frontend/node_modules/tailwind-merge/dist/bundle-mjs.mjs","../../frontend/src/lib/utils.ts","../../frontend/node_modules/class-variance-authority/dist/index.mjs","../../frontend/src/components/ui/button.tsx","../../frontend/node_modules/zod/v3/helpers/util.js","../../frontend/node_modules/zod/v3/ZodError.js","../../frontend/node_modules/zod/v3/locales/en.js","../../frontend/node_modules/zod/v3/errors.js","../../frontend/node_modules/zod/v3/helpers/parseUtil.js","../../frontend/node_modules/zod/v3/helpers/errorUtil.js","../../frontend/node_modules/zod/v3/types.js","../../frontend/src/lib/api/client.ts","../../frontend/src/lib/api/projects.ts","../../frontend/src/hooks/queryKeys.ts","../../frontend/src/hooks/useProjects.ts","../../frontend/src/components/layout/AppShell.tsx","../../frontend/node_modules/react-hook-form/dist/index.esm.mjs","../../frontend/node_modules/@hookform/resolvers/dist/resolvers.mjs","../../frontend/node_modules/@hookform/resolvers/zod/dist/zod.mjs","../../frontend/src/components/ui/card.tsx","../../frontend/src/components/ui/input.tsx","../../frontend/src/components/ui/label.tsx","../../frontend/src/components/ui/skeleton.tsx","../../frontend/src/lib/api/domains.ts","../../frontend/src/lib/api/ontology.ts","../../frontend/src/hooks/useDomains.ts","../../frontend/src/pages/OnboardingPage.tsx","../../frontend/src/lib/api/sources.ts","../../frontend/src/hooks/useSources.ts","../../frontend/src/pages/ConfigureSourcesPage.tsx","../../frontend/src/components/ui/select.tsx","../../frontend/src/components/ui/progress.tsx","../../frontend/src/components/ui/badge.tsx","../../frontend/src/lib/api/crawl.ts","../../frontend/src/hooks/useCrawl.ts","../../frontend/src/pages/CrawlPage.tsx","../../frontend/src/components/ui/textarea.tsx","../../frontend/src/lib/api/research.ts","../../frontend/src/hooks/useResearch.ts","../../frontend/src/pages/ResearchPage.tsx","../../frontend/src/components/ui/tabs.tsx","../../frontend/src/lib/api/entities.ts","../../frontend/src/hooks/useEntities.ts","../../frontend/src/lib/api/claims.ts","../../frontend/src/hooks/useClaims.ts","../../frontend/src/pages/OntologyEditorPage.tsx","../../frontend/src/lib/display.ts","../../frontend/src/pages/ReviewPage.tsx","../../frontend/src/lib/api/platform.ts","../../frontend/src/hooks/usePlatform.ts","../../frontend/src/pages/DashboardPage.tsx","../../frontend/src/pages/BuildPipelinePage.tsx","../../frontend/src/pages/PageAnalysisPage.tsx","../../frontend/src/pages/SchemaDesignerPage.tsx","../../frontend/src/pages/QualityInspectorPage.tsx","../../frontend/src/pages/GraphViewPage.tsx","../../frontend/src/pages/ExportApiPage.tsx","../../frontend/src/App.tsx","../../frontend/src/stores/slices/ontologySlice.ts","../../frontend/src/stores/slices/crawlSlice.ts","../../frontend/src/stores/index.ts","../../frontend/src/lib/queryClient.ts","../../frontend/src/main.tsx"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){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: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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Sg(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return}}\nfunction ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=!0),a.firstContext=null)}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a}}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a)}\nfunction hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}\nfunction lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mh(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}\nfunction nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nfunction ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=\nb;c.lastBaseUpdate=b}\nfunction qh(a,b,c,d){var e=a.updateQueue;jh=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k))}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback,\nnext:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if(\"function\"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r=\"function\"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A({},q,r);break a;case 2:jh=!0}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h))}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r;\nh=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q}}\nfunction sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=Gh.transition;Gh.transition={};try{a(!1),b()}finally{C=c,Gh.transition=d}}function wi(){return Uh().memoizedState}\nfunction xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d)}}\nfunction ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d))}}\nfunction zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308,\n4,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return[d.memoizedState,a]},useRef:function(a){var b=\nTh();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===Q)throw Error(p(349));0!==(Hh&30)||di(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d,\nf,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Kh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eGj&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304)}else{if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L.current,G(L,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(),\nnull;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Lj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Mj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Nj=!1;\nfunction Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Nj;Nj=!1;return n}\nfunction Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f)}e=e.next}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}var X=null,Xj=!1;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling}\nfunction Zj(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Lj(c,b);case 6:var d=X,e=Xj;X=null;Yj(a,b,c);X=d;Xj=e;null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Xj;X=c.stateNode.containerInfo;Xj=!0;\nYj(a,b,c);X=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next}while(e!==d)}Yj(a,b,c);break;case 1:if(!U&&(Lj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Yj(a,b,c),U=d):Yj(a,b,c);break;default:Yj(a,b,c)}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10a?16:a;if(null===wk)var d=!1;else{a=wk;wk=null;xk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-fk?Kk(a,0):rk|=c);Dk(a,b)}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c))}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c)}\nfunction bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Yk(a,c)}var Vk;\nVk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return dh=!1,yj(a,b,c);dh=0!==(a.flags&131072)?!0:!1}else dh=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ji(Error(p(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c)}b=b.child}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\ngj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Xi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,!0,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p(156,b.tag));};function Fk(a,b){return ac(a,b)}\nfunction $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Zk(a){if(\"function\"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction Rg(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)aj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3 batch = newBatch; // Supply a getter just to skip dealing with ESM bindings\n\nexport const getBatch = () => batch;","import * as React from 'react';\nconst ContextKey = Symbol.for(`react-redux-context`);\nconst gT = typeof globalThis !== \"undefined\" ? globalThis :\n/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */\n{};\n\nfunction getContext() {\n var _gT$ContextKey;\n\n if (!React.createContext) return {};\n const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map();\n let realContext = contextMap.get(React.createContext);\n\n if (!realContext) {\n realContext = React.createContext(null);\n\n if (process.env.NODE_ENV !== 'production') {\n realContext.displayName = 'ReactRedux';\n }\n\n contextMap.set(React.createContext, realContext);\n }\n\n return realContext;\n}\n\nexport const ReactReduxContext = /*#__PURE__*/getContext();\nexport default ReactReduxContext;","import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\n\n/**\r\n * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level\r\n * hook that you should usually not need to call directly.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\r\n * @returns {Function} A `useReduxContext` hook bound to the specified context.\r\n */\nexport function createReduxContextHook(context = ReactReduxContext) {\n return function useReduxContext() {\n const contextValue = useContext(context);\n\n if (process.env.NODE_ENV !== 'production' && !contextValue) {\n throw new Error('could not find react-redux context value; please ensure the component is wrapped in a ');\n }\n\n return contextValue;\n };\n}\n/**\r\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\r\n * hook that you should usually not need to call directly.\r\n *\r\n * @returns {any} the value of the `ReactReduxContext`\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useReduxContext } from 'react-redux'\r\n *\r\n * export const CounterComponent = () => {\r\n * const { store } = useReduxContext()\r\n * return
{store.getState()}
\r\n * }\r\n */\n\nexport const useReduxContext = /*#__PURE__*/createReduxContextHook();","export const notInitialized = () => {\n throw new Error('uSES not initialized!');\n};","import { useCallback, useDebugValue, useRef } from 'react';\nimport { createReduxContextHook, useReduxContext as useDefaultReduxContext } from './useReduxContext';\nimport { ReactReduxContext } from '../components/Context';\nimport { notInitialized } from '../utils/useSyncExternalStore';\nlet useSyncExternalStoreWithSelector = notInitialized;\nexport const initializeUseSelector = fn => {\n useSyncExternalStoreWithSelector = fn;\n};\n\nconst refEquality = (a, b) => a === b;\n/**\r\n * Hook factory, which creates a `useSelector` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\r\n * @returns {Function} A `useSelector` hook bound to the specified context.\r\n */\n\n\nexport function createSelectorHook(context = ReactReduxContext) {\n const useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : createReduxContextHook(context);\n return function useSelector(selector, equalityFnOrOptions = {}) {\n const {\n equalityFn = refEquality,\n stabilityCheck = undefined,\n noopCheck = undefined\n } = typeof equalityFnOrOptions === 'function' ? {\n equalityFn: equalityFnOrOptions\n } : equalityFnOrOptions;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!selector) {\n throw new Error(`You must pass a selector to useSelector`);\n }\n\n if (typeof selector !== 'function') {\n throw new Error(`You must pass a function as a selector to useSelector`);\n }\n\n if (typeof equalityFn !== 'function') {\n throw new Error(`You must pass a function as an equality function to useSelector`);\n }\n }\n\n const {\n store,\n subscription,\n getServerState,\n stabilityCheck: globalStabilityCheck,\n noopCheck: globalNoopCheck\n } = useReduxContext();\n const firstRun = useRef(true);\n const wrappedSelector = useCallback({\n [selector.name](state) {\n const selected = selector(state);\n\n if (process.env.NODE_ENV !== 'production') {\n const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck;\n\n if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) {\n const toCompare = selector(state);\n\n if (!equalityFn(selected, toCompare)) {\n let stack = undefined;\n\n try {\n throw new Error();\n } catch (e) {\n ;\n ({\n stack\n } = e);\n }\n\n console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {\n state,\n selected,\n selected2: toCompare,\n stack\n });\n }\n }\n\n const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck;\n\n if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {\n // @ts-ignore\n if (selected === state) {\n let stack = undefined;\n\n try {\n throw new Error();\n } catch (e) {\n ;\n ({\n stack\n } = e);\n }\n\n console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.', {\n stack\n });\n }\n }\n\n if (firstRun.current) firstRun.current = false;\n }\n\n return selected;\n }\n\n }[selector.name], [selector, globalStabilityCheck, stabilityCheck]);\n const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);\n useDebugValue(selectedState);\n return selectedState;\n };\n}\n/**\r\n * A hook to access the redux store's state. This hook takes a selector function\r\n * as an argument. The selector is called with the store state.\r\n *\r\n * This hook takes an optional equality comparison function as the second parameter\r\n * that allows you to customize the way the selected state is compared to determine\r\n * whether the component needs to be re-rendered.\r\n *\r\n * @param {Function} selector the selector function\r\n * @param {Function=} equalityFn the function that will be used to determine equality\r\n *\r\n * @returns {any} the selected state\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useSelector } from 'react-redux'\r\n *\r\n * export const CounterComponent = () => {\r\n * const counter = useSelector(state => state.counter)\r\n * return
{counter}
\r\n * }\r\n */\n\nexport const useSelector = /*#__PURE__*/createSelectorHook();","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import { getBatch } from './batch'; // encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\nfunction createListenerCollection() {\n const batch = getBatch();\n let first = null;\n let last = null;\n return {\n clear() {\n first = null;\n last = null;\n },\n\n notify() {\n batch(() => {\n let listener = first;\n\n while (listener) {\n listener.callback();\n listener = listener.next;\n }\n });\n },\n\n get() {\n let listeners = [];\n let listener = first;\n\n while (listener) {\n listeners.push(listener);\n listener = listener.next;\n }\n\n return listeners;\n },\n\n subscribe(callback) {\n let isSubscribed = true;\n let listener = last = {\n callback,\n next: null,\n prev: last\n };\n\n if (listener.prev) {\n listener.prev.next = listener;\n } else {\n first = listener;\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return;\n isSubscribed = false;\n\n if (listener.next) {\n listener.next.prev = listener.prev;\n } else {\n last = listener.prev;\n }\n\n if (listener.prev) {\n listener.prev.next = listener.next;\n } else {\n first = listener.next;\n }\n };\n }\n\n };\n}\n\nconst nullListeners = {\n notify() {},\n\n get: () => []\n};\nexport function createSubscription(store, parentSub) {\n let unsubscribe;\n let listeners = nullListeners; // Reasons to keep the subscription active\n\n let subscriptionsAmount = 0; // Is this specific subscription subscribed (or only nested ones?)\n\n let selfSubscribed = false;\n\n function addNestedSub(listener) {\n trySubscribe();\n const cleanupListener = listeners.subscribe(listener); // cleanup nested sub\n\n let removed = false;\n return () => {\n if (!removed) {\n removed = true;\n cleanupListener();\n tryUnsubscribe();\n }\n };\n }\n\n function notifyNestedSubs() {\n listeners.notify();\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange();\n }\n }\n\n function isSubscribed() {\n return selfSubscribed;\n }\n\n function trySubscribe() {\n subscriptionsAmount++;\n\n if (!unsubscribe) {\n unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);\n listeners = createListenerCollection();\n }\n }\n\n function tryUnsubscribe() {\n subscriptionsAmount--;\n\n if (unsubscribe && subscriptionsAmount === 0) {\n unsubscribe();\n unsubscribe = undefined;\n listeners.clear();\n listeners = nullListeners;\n }\n }\n\n function trySubscribeSelf() {\n if (!selfSubscribed) {\n selfSubscribed = true;\n trySubscribe();\n }\n }\n\n function tryUnsubscribeSelf() {\n if (selfSubscribed) {\n selfSubscribed = false;\n tryUnsubscribe();\n }\n }\n\n const subscription = {\n addNestedSub,\n notifyNestedSubs,\n handleChangeWrapper,\n isSubscribed,\n trySubscribe: trySubscribeSelf,\n tryUnsubscribe: tryUnsubscribeSelf,\n getListeners: () => listeners\n };\n return subscription;\n}","import * as React from 'react'; // React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store\n// subscription callback always has the selector from the latest render commit\n// available, otherwise a store update may happen between render and the effect,\n// which may cause missed updates; we also must ensure the store subscription\n// is created synchronously, otherwise a store update may occur before the\n// subscription is created and an inconsistent state may be observed\n// Matches logic in React's `shared/ExecutionEnvironment` file\n\nexport const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\nexport const useIsomorphicLayoutEffect = canUseDOM ? React.useLayoutEffect : React.useEffect;","import * as React from 'react';\nimport { ReactReduxContext } from './Context';\nimport { createSubscription } from '../utils/Subscription';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\n\nfunction Provider({\n store,\n context,\n children,\n serverState,\n stabilityCheck = 'once',\n noopCheck = 'once'\n}) {\n const contextValue = React.useMemo(() => {\n const subscription = createSubscription(store);\n return {\n store,\n subscription,\n getServerState: serverState ? () => serverState : undefined,\n stabilityCheck,\n noopCheck\n };\n }, [store, serverState, stabilityCheck, noopCheck]);\n const previousState = React.useMemo(() => store.getState(), [store]);\n useIsomorphicLayoutEffect(() => {\n const {\n subscription\n } = contextValue;\n subscription.onStateChange = subscription.notifyNestedSubs;\n subscription.trySubscribe();\n\n if (previousState !== store.getState()) {\n subscription.notifyNestedSubs();\n }\n\n return () => {\n subscription.tryUnsubscribe();\n subscription.onStateChange = undefined;\n };\n }, [contextValue, previousState]);\n const Context = context || ReactReduxContext; // @ts-ignore 'AnyAction' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype\n\n return /*#__PURE__*/React.createElement(Context.Provider, {\n value: contextValue\n }, children);\n}\n\nexport default Provider;","import { ReactReduxContext } from '../components/Context';\nimport { useReduxContext as useDefaultReduxContext, createReduxContextHook } from './useReduxContext';\n/**\r\n * Hook factory, which creates a `useStore` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\r\n * @returns {Function} A `useStore` hook bound to the specified context.\r\n */\n\nexport function createStoreHook(context = ReactReduxContext) {\n const useReduxContext = // @ts-ignore\n context === ReactReduxContext ? useDefaultReduxContext : // @ts-ignore\n createReduxContextHook(context);\n return function useStore() {\n const {\n store\n } = useReduxContext(); // @ts-ignore\n\n return store;\n };\n}\n/**\r\n * A hook to access the redux store.\r\n *\r\n * @returns {any} the redux store\r\n *\r\n * @example\r\n *\r\n * import React from 'react'\r\n * import { useStore } from 'react-redux'\r\n *\r\n * export const ExampleComponent = () => {\r\n * const store = useStore()\r\n * return
{store.getState()}
\r\n * }\r\n */\n\nexport const useStore = /*#__PURE__*/createStoreHook();","import { ReactReduxContext } from '../components/Context';\nimport { useStore as useDefaultStore, createStoreHook } from './useStore';\n/**\r\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\r\n *\r\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\r\n * @returns {Function} A `useDispatch` hook bound to the specified context.\r\n */\n\nexport function createDispatchHook(context = ReactReduxContext) {\n const useStore = // @ts-ignore\n context === ReactReduxContext ? useDefaultStore : createStoreHook(context);\n return function useDispatch() {\n const store = useStore(); // @ts-ignore\n\n return store.dispatch;\n };\n}\n/**\r\n * A hook to access the redux `dispatch` function.\r\n *\r\n * @returns {any|function} redux store's `dispatch` function\r\n *\r\n * @example\r\n *\r\n * import React, { useCallback } from 'react'\r\n * import { useDispatch } from 'react-redux'\r\n *\r\n * export const CounterComponent = ({ value }) => {\r\n * const dispatch = useDispatch()\r\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\r\n * return (\r\n *
\r\n * {value}\r\n * \r\n *
\r\n * )\r\n * }\r\n */\n\nexport const useDispatch = /*#__PURE__*/createDispatchHook();","// The primary entry point assumes we're working with standard ReactDOM/RN, but\n// older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).\n// Because of that, the useSyncExternalStore compat shim is needed.\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';\nimport { setBatch } from './utils/batch';\nimport { initializeUseSelector } from './hooks/useSelector';\nimport { initializeConnect } from './components/connect';\ninitializeUseSelector(useSyncExternalStoreWithSelector);\ninitializeConnect(useSyncExternalStore); // Enable batched updates in our subscriptions for use\n// with standard React renderers (ReactDOM, React Native)\n\nsetBatch(batch);\nexport { batch };\nexport * from './exports';","/**\n * @remix-run/router v1.23.2\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n // Treating this as a full URL will strip any trailing spaces so we need to\n // pre-encode them since they might be part of a matching splat param from\n // an ancestor route\n href = href.replace(/ $/, \"%20\");\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, String(index)];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/v6/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n return matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial) {\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n let decoded = decodePath(pathname);\n matches = matchRouteBranch(branches[i], decoded, allowPartial);\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial) {\n if (allowPartial === void 0) {\n allowPartial = false;\n }\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n let route = meta.route;\n if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {\n match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end: false\n }, remainingPathname);\n }\n if (!match) {\n return null;\n }\n Object.assign(matchedParams, match.params);\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/v6/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/v6/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction decodePath(value) {\n try {\n return value.split(\"/\").map(v => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\nconst ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/v6/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname;\n if (toPathname) {\n if (isAbsoluteUrl(toPathname)) {\n pathname = toPathname;\n } else {\n if (toPathname.includes(\"//\")) {\n let oldPathname = toPathname;\n toPathname = toPathname.replace(/\\/\\/+/g, \"/\");\n warning(false, \"Pathnames cannot have embedded double slashes - normalizing \" + (oldPathname + \" -> \" + toPathname));\n }\n if (toPathname.startsWith(\"/\")) {\n pathname = resolvePathname(toPathname.substring(1), \"/\");\n } else {\n pathname = resolvePathname(toPathname, fromPathname);\n }\n }\n } else {\n pathname = fromPathname;\n }\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n *\n * @deprecated The `json` method is deprecated in favor of returning raw objects.\n * This method will be removed in v7.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass DataWithResponseInit {\n constructor(data, init) {\n this.type = \"DataWithResponseInit\";\n this.data = data;\n this.init = init || null;\n }\n}\n/**\n * Create \"responses\" that contain `status`/`headers` without forcing\n * serialization into an actual `Response` - used by Remix single fetch\n */\nfunction data(data, init) {\n return new DataWithResponseInit(data, typeof init === \"number\" ? {\n status: init\n } : init);\n}\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\n/**\n * @deprecated The `defer` method is deprecated in favor of returning raw\n * objects. This method will be removed in v7.\n */\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * A redirect response that will perform a `history.replaceState` instead of a\n * `history.pushState` for client-side navigation redirects.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst replace = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Replace\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;\n let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false,\n v7_skipActionErrorRevalidation: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialMatchesIsFOW = false;\n let initialErrors = null;\n if (initialMatches == null && !patchRoutesOnNavigationImpl) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and\n // our initial match is a splat route, clear them out so we run through lazy\n // discovery on hydration in case there's a more accurate lazy route match.\n // In SSR apps (with `hydrationData`), we expect that the server will send\n // up the proper matched routes so we don't want to run lazy discovery on\n // initial hydration and want to hydrate into the splat route.\n if (initialMatches && !init.hydrationData) {\n let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active) {\n initialMatches = null;\n }\n }\n let initialized;\n if (!initialMatches) {\n initialized = false;\n initialMatches = [];\n // If partial hydration and fog of war is enabled, we will be running\n // `patchRoutesOnNavigation` during hydration so include any partial matches as\n // the initial matches so we can properly render `HydrateFallback`'s\n if (future.v7_partialHydration) {\n let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n initialMatchesIsFOW = true;\n initialMatches = fogOfWar.matches;\n }\n }\n } else if (initialMatches.some(m => m.route.lazy)) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!initialMatches.some(m => m.route.loader)) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n // If errors exist, don't consider routes below the boundary\n if (errors) {\n let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);\n initialized = initialMatches.slice(0, idx + 1).every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n } else {\n initialized = initialMatches.every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n }\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = new Set();\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let unblockBlockerHistoryUpdate = undefined;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (unblockBlockerHistoryUpdate) {\n unblockBlockerHistoryUpdate();\n unblockBlockerHistoryUpdate = undefined;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != 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.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n let nextHistoryUpdatePromise = new Promise(resolve => {\n unblockBlockerHistoryUpdate = resolve;\n });\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked, after the url\n // restoration is also complete. See:\n // https://github.com/remix-run/react-router/issues/11613\n nextHistoryUpdatePromise.then(() => init.history.go(delta));\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Remove any lingering deleted fetchers that have already been removed\n // from state.fetchers\n deletedFetchers.forEach(key => {\n if (!state.fetchers.has(key) && !fetchControllers.has(key)) {\n deletedFetchersKeys.push(key);\n }\n });\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n viewTransitionOpts: opts.viewTransitionOpts,\n flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n } else {\n // We already called deleteFetcher() on these, can remove them from this\n // Set now that we've handed the keys off to the data layer\n deletedFetchersKeys.forEach(key => deletedFetchers.delete(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n // Commit any in-flight routes at the end of the HMR revalidation \"navigation\"\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation,\n // Proxy through any rending view transition\n enableViewTransition: pendingViewTransitionEnabled === true\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?\n // `matchRoutes()` has already been called if we're in here via `router.initialize()`\n state.matches : matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial hydration will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionResult;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingActionResult = [findNearestBoundary(matches).route.id, {\n type: ResultType.error,\n error: opts.pendingError\n }];\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n // If we received a 404 from handleAction, it's because we couldn't lazily\n // discover the destination route so we don't want to call loaders\n if (actionResult.pendingActionResult) {\n let [routeId, result] = actionResult.pendingActionResult;\n if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n pendingNavigationController = null;\n completeNavigation(location, {\n matches: actionResult.matches,\n loaderData: {},\n errors: {\n [routeId]: result.error\n }\n });\n return;\n }\n }\n matches = actionResult.matches || matches;\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // No need to do fog of war matching again on loader execution\n fogOfWar.active = false;\n // Create a GET request for the loaders\n request = createClientSideRequest(init.history, request.url, request.signal);\n }\n // Call loaders\n let {\n shortCircuited,\n matches: updatedMatches,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches: updatedMatches || matches\n }, getActionDataForCommit(pendingActionResult), {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, isFogOfWar, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n pendingActionResult: [boundaryId, {\n type: ResultType.error,\n error: discoverResult.error\n }]\n };\n } else if (!discoverResult.matches) {\n let {\n notFoundMatches,\n error,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n error\n }]\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n let results = await callDataStrategy(\"action\", state, request, [actionMatch], matches, null);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n let location = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename, init.history);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, true, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions to the current location are REPLACE\n // navigations, but if the action threw an error that'll be rendered in\n // an errorElement, we fall back to PUSH so that the user can use the\n // back button to get back to the pre-submission form location to try\n // again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n matches,\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\n matches,\n pendingActionResult: [actionMatch.route.id, result]\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since it's not a \"navigation\"\n let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);\n // When fog of war is enabled, we enter our `loading` state earlier so we\n // can discover new routes during the `loading` state. We skip this if\n // we've already run actions since we would have done our matching already.\n // If the children() function threw then, we want to proceed with the\n // partial matches it discovered.\n if (isFogOfWar) {\n if (shouldUpdateNavigationState) {\n let actionData = getUpdatedActionData(pendingActionResult);\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}), {\n flushSync\n });\n }\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n loaderData: {},\n errors: {\n [boundaryId]: discoverResult.error\n }\n };\n } else if (!discoverResult.matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null\n }, getActionDataForCommit(pendingActionResult), updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n if (shouldUpdateNavigationState) {\n let updates = {};\n if (!isFogOfWar) {\n // Only update navigation/actionNData if we didn't already do it above\n updates.navigation = loadingNavigation;\n let actionData = getUpdatedActionData(pendingActionResult);\n if (actionData !== undefined) {\n updates.actionData = actionData;\n }\n }\n if (revalidatingFetchers.length > 0) {\n updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n }\n updateState(updates, {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n abortFetcher(rf.key);\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n // Preserve SSR errors during partial hydration\n if (future.v7_partialHydration && initialHydration && state.errors) {\n errors = _extends({}, state.errors, errors);\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n matches,\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getUpdatedActionData(pendingActionResult) {\n if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {\n // This is cast to `any` currently because `RouteData`uses any and it\n // would be a breaking change to use any.\n // TODO: v7 - change `RouteData` to use `unknown` instead of `any`\n return {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n return null;\n } else {\n return state.actionData;\n }\n }\n }\n function getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n return new Map(state.fetchers);\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n abortFetcher(key);\n let flushSync = (opts && opts.flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n let preventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n function detectAndHandle405Error(m) {\n if (!m.route.action && !m.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return true;\n }\n return false;\n }\n if (!isFogOfWar && detectAndHandle405Error(match)) {\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n requestMatches = discoverResult.matches;\n match = getTargetMatch(requestMatches, path);\n if (detectAndHandle405Error(match)) {\n return;\n }\n }\n }\n // Call the action for the fetcher\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", state, fetchRequest, [match], requestMatches, key);\n let actionResult = actionResults[match.route.id];\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(fetchRequest, actionResult, false, {\n fetcherSubmission: submission,\n preventScrollReset\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n abortFetcher(staleKey);\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n matches = discoverResult.matches;\n match = getTargetMatch(matches, path);\n }\n }\n // Call the loader for this fetcher route match\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", state, fetchRequest, [match], matches, key);\n let result = results[match.route.id];\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(fetchRequest, result, false, {\n preventScrollReset\n });\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(request, redirect, isNavigation, _temp2) {\n let {\n submission,\n fetcherSubmission,\n preventScrollReset,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.response.headers.has(\"X-Remix-Revalidate\")) {\n isRevalidationRequired = true;\n }\n let location = redirect.response.headers.get(\"Location\");\n invariant(location, \"Expected a Location header on the redirect Response\");\n location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);\n let redirectLocation = createLocation(state.location, location, {\n _isRedirect: true\n });\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.response.headers.has(\"X-Remix-Reload-Document\")) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(location)) {\n const url = init.history.createURL(location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(location);\n } else {\n routerWindow.location.assign(location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: location\n }),\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n }\n }\n // Utility wrapper for calling dataStrategy client-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, state, request, matchesToLoad, matches, fetcherKey) {\n let results;\n let dataResults = {};\n try {\n results = await callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties);\n } catch (e) {\n // If the outer dataStrategy method throws, just return the error for all\n // matches - and it'll naturally bubble to the root\n matchesToLoad.forEach(m => {\n dataResults[m.route.id] = {\n type: ResultType.error,\n error: e\n };\n });\n return dataResults;\n }\n for (let [routeId, result] of Object.entries(results)) {\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n dataResults[routeId] = {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath)\n };\n } else {\n dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n }\n }\n return dataResults;\n }\n async function callLoadersAndMaybeResolveData(state, matches, matchesToLoad, fetchersToLoad, request) {\n let currentMatches = state.matches;\n // Kick off loaders and fetchers in parallel\n let loaderResultsPromise = callDataStrategy(\"loader\", state, request, matchesToLoad, matches, null);\n let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async f => {\n if (f.matches && f.match && f.controller) {\n let results = await callDataStrategy(\"loader\", state, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key);\n let result = results[f.match.route.id];\n // Fetcher results are keyed by fetcher key from here on out, not routeId\n return {\n [f.key]: result\n };\n } else {\n return Promise.resolve({\n [f.key]: {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n }\n });\n }\n }));\n let loaderResults = await loaderResultsPromise;\n let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {});\n await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]);\n return {\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.add(key);\n }\n abortFetcher(key);\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n // If we opted into the flag we can clear this now since we're calling\n // deleteFetcher() at the end of updateState() and we've already handed the\n // deleted fetcher keys off to the data layer.\n // If not, we're eagerly calling deleteFetcher() and we need to keep this\n // Set populated until the next updateState call, and we'll clear\n // `deletedFetchers` then\n if (future.v7_fetcherPersist) {\n deletedFetchers.delete(key);\n }\n cancelledFetcherLoads.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n if (!future.v7_fetcherPersist) {\n deleteFetcher(key);\n }\n } else {\n activeFetchers.set(key, count);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n if (controller) {\n controller.abort();\n fetchControllers.delete(key);\n }\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function handleNavigational404(pathname) {\n let error = getInternalRouterError(404, {\n pathname\n });\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let {\n matches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n return {\n notFoundMatches: matches,\n route,\n error\n };\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function checkFogOfWar(matches, routesToUse, pathname) {\n if (patchRoutesOnNavigationImpl) {\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n if (Object.keys(matches[0].params).length > 0) {\n // If we matched a dynamic param or a splat, it might only be because\n // we haven't yet discovered other routes that would match with a\n // higher score. Call patchRoutesOnNavigation just to be sure\n let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: partialMatches\n };\n }\n }\n }\n return {\n active: false,\n matches: null\n };\n }\n async function discoverRoutes(matches, pathname, signal, fetcherKey) {\n if (!patchRoutesOnNavigationImpl) {\n return {\n type: \"success\",\n matches\n };\n }\n let partialMatches = matches;\n while (true) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let localManifest = manifest;\n try {\n await patchRoutesOnNavigationImpl({\n signal,\n path: pathname,\n matches: partialMatches,\n fetcherKey,\n patch: (routeId, children) => {\n if (signal.aborted) return;\n patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);\n }\n });\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n } finally {\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity so when we `updateState` at the end of\n // this navigation/fetch `router.routes` will be a new identity and\n // trigger a re-run of memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR && !signal.aborted) {\n dataRoutes = [...dataRoutes];\n }\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n if (newMatches) {\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // Avoid loops if the second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {\n return {\n type: \"success\",\n matches: null\n };\n }\n partialMatches = newPartialMatches;\n }\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n function patchRoutes(routeId, children) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity and trigger a reflow via `updateState`\n // to re-run memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n updateState({});\n }\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n patchRoutes,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false,\n v7_throwAbortReason: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n *\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n * the bubbling of errors which allows single-fetch-type implementations\n * where the client will handle the bubbling and we may need to return data\n * for the handling route\n */\n async function query(request, _temp3) {\n let {\n requestContext,\n skipLoaderErrorBubbling,\n dataStrategy\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n *\n * - `opts.routeId` allows you to specify the specific route handler to call.\n * If not provided the handler will determine the proper route by matching\n * against `request.url`\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext,\n dataStrategy\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction for a\n // `queryRoute` call, we throw the `DataStrategyResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isDataStrategyResult(e) && isResponse(e.result)) {\n if (e.type === ResultType.error) {\n throw e.result;\n }\n return e.result;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.response.status,\n headers: {\n Location: result.response.headers.get(\"Location\")\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null);\n return _extends({}, context, {\n actionData: {\n [actionMatch.route.id]: result.data\n }\n }, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionHeaders: result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {}\n });\n }\n async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await callDataStrategy(\"loader\", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy);\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n // Utility wrapper for calling dataStrategy server-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {\n let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext);\n let dataResults = {};\n await Promise.all(matches.map(async match => {\n if (!(match.route.id in results)) {\n return;\n }\n let result = results[match.route.id];\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath);\n }\n if (isResponse(result.result) && isRouteRequest) {\n // For SSR single-route requests, we want to hand Responses back\n // directly without unwrapping\n throw result;\n }\n dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n }));\n return dataResults;\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: isRouteErrorResponse(error) ? error.status : 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest, future) {\n if (future.v7_throwAbortReason && request.signal.reason !== undefined) {\n throw request.signal.reason;\n }\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Account for `?index` params when routing to the current location\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n let nakedIndex = hasNakedIndexQuery(path.search);\n if (activeRouteMatch.route.index && !nakedIndex) {\n // Add one when we're targeting an index route\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n } else if (!activeRouteMatch.route.index && nakedIndex) {\n // Remove existing ones when we're not\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes at/below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) {\n if (includeBoundary === void 0) {\n includeBoundary = false;\n }\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n return matches.slice(0, includeBoundary ? index + 1 : index);\n }\n return matches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {\n let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryMatches = matches;\n if (initialHydration && state.errors) {\n // On initial hydration, only consider matches up to _and including_ the boundary.\n // This is inclusive to handle cases where a server loader ran successfully,\n // a child server loader bubbled up to this route, but this route has\n // `clientLoader.hydrate` so we want to still run the `clientLoader` so that\n // we have a complete version of `loaderData`\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true);\n } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n // If an action threw an error, we call loaders up to, but not including the\n // boundary\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]);\n }\n // Don't revalidate loaders by default after action 4xx/5xx responses\n // when the flag is enabled. They can still opt-into revalidation via\n // `shouldRevalidate` via `actionResult`\n let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined;\n let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (initialHydration) {\n return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false :\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial hydration (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (initialHydration || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.has(key)) {\n // Always mark for revalidation if the fetcher was cancelled\n cancelledFetcherLoads.delete(key);\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction shouldLoadRouteOnHydration(route, loaderData, errors) {\n // We dunno if we have a loader - gotta find out!\n if (route.lazy) {\n return true;\n }\n // No loader, nothing to initialize\n if (!route.loader) {\n return false;\n }\n let hasData = loaderData != null && loaderData[route.id] !== undefined;\n let hasError = errors != null && errors[route.id] !== undefined;\n // Don't run if we error'd during SSR\n if (!hasData && hasError) {\n return false;\n }\n // Explicitly opting-in to running on hydration\n if (typeof route.loader === \"function\" && route.loader.hydrate === true) {\n return true;\n }\n // Otherwise, run if we're not yet initialized with anything\n return !hasData && !hasError;\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {\n var _childrenToPatch;\n let childrenToPatch;\n if (routeId) {\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n if (!route.children) {\n route.children = [];\n }\n childrenToPatch = route.children;\n } else {\n childrenToPatch = routesToUse;\n }\n // Don't patch in routes we already know about so that `patch` is idempotent\n // to simplify user-land code. This is useful because we re-call the\n // `patchRoutesOnNavigation` function for matched routes with params.\n let uniqueChildren = children.filter(newRoute => !childrenToPatch.some(existingRoute => isSameRoute(newRoute, existingRoute)));\n let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || \"_\", \"patch\", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || \"0\")], manifest);\n childrenToPatch.push(...newRoutes);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n // Most optimal check is by id\n if (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) {\n return true;\n }\n // Second is by pathing differences\n if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) {\n return false;\n }\n // Pathless layout routes are trickier since we need to check children.\n // If they have no children then they're the same as far as we can tell\n if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {\n return true;\n }\n // Otherwise, we look to see if every child in the new route is already\n // represented in the existing route's children\n return newRoute.children.every((aChild, i) => {\n var _existingRoute$childr;\n return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some(bChild => isSameRoute(aChild, bChild));\n });\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\n// Default implementation of `dataStrategy` which fetches all loaders in parallel\nasync function defaultDataStrategy(_ref4) {\n let {\n matches\n } = _ref4;\n let matchesToLoad = matches.filter(m => m.shouldLoad);\n let results = await Promise.all(matchesToLoad.map(m => m.resolve()));\n return results.reduce((acc, result, i) => Object.assign(acc, {\n [matchesToLoad[i].route.id]: result\n }), {});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) {\n let loadRouteDefinitionsPromises = matches.map(m => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : undefined);\n let dsMatches = matches.map((match, i) => {\n let loadRoutePromise = loadRouteDefinitionsPromises[i];\n let shouldLoad = matchesToLoad.some(m => m.route.id === match.route.id);\n // `resolve` encapsulates route.lazy(), executing the loader/action,\n // and mapping return values/thrown errors to a `DataStrategyResult`. Users\n // can pass a callback to take fine-grained control over the execution\n // of the loader/action\n let resolve = async handlerOverride => {\n if (handlerOverride && request.method === \"GET\" && (match.route.lazy || match.route.loader)) {\n shouldLoad = true;\n }\n return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n });\n // Send all matches here to allow for a middleware-type implementation.\n // handler will be a no-op for unneeded routes and we filter those results\n // back out below.\n let results = await dataStrategyImpl({\n matches: dsMatches,\n request,\n params: matches[0].params,\n fetcherKey,\n context: requestContext\n });\n // Wait for all routes to load here but 'swallow the error since we want\n // it to bubble up from the `await loadRoutePromise` in `callLoaderOrAction` -\n // called from `match.resolve()`\n try {\n await Promise.all(loadRouteDefinitionsPromises);\n } catch (e) {\n // No-op\n }\n return results;\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n // This will never resolve so safe to type it as Promise to\n // satisfy the function return value\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n let actualHandler = ctx => {\n if (typeof handler !== \"function\") {\n return Promise.reject(new Error(\"You cannot call the handler for a route which defines a boolean \" + (\"\\\"\" + type + \"\\\" [routeId: \" + match.route.id + \"]\")));\n }\n return handler({\n request,\n params: match.params,\n context: staticContext\n }, ...(ctx !== undefined ? [ctx] : []));\n };\n let handlerPromise = (async () => {\n try {\n let val = await (handlerOverride ? handlerOverride(ctx => actualHandler(ctx)) : actualHandler());\n return {\n type: \"data\",\n result: val\n };\n } catch (e) {\n return {\n type: \"error\",\n result: e\n };\n }\n })();\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n // If we have a route.lazy promise, await that first\n if (loadRoutePromise) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let [value] = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadRoutePromise]);\n if (handlerError !== undefined) {\n throw handlerError;\n }\n result = value;\n } else {\n // Load lazy route module, then run any returned handler\n await loadRoutePromise;\n handler = match.route[type];\n if (handler) {\n // Handler still runs even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n result: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result.result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n // We should already be catching and converting normal handler executions to\n // DataStrategyResults and returning them, so anything that throws here is an\n // unexpected error we still need to wrap\n return {\n type: ResultType.error,\n result: e\n };\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n return result;\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n let {\n result,\n type\n } = dataStrategyResult;\n if (isResponse(result)) {\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (type === ResultType.error) {\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(result.status, result.statusText, data),\n statusCode: result.status,\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (type === ResultType.error) {\n if (isDataWithResponseInit(result)) {\n var _result$init3, _result$init4;\n if (result.data instanceof Error) {\n var _result$init, _result$init2;\n return {\n type: ResultType.error,\n error: result.data,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined\n };\n }\n // Convert thrown data() to ErrorResponse instances\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),\n statusCode: isRouteErrorResponse(result) ? result.status : undefined,\n headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : undefined\n };\n }\n if (isDeferredData(result)) {\n var _result$init5, _result$init6;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,\n headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)\n };\n }\n if (isDataWithResponseInit(result)) {\n var _result$init7, _result$init8;\n return {\n type: ResultType.data,\n data: result.data,\n statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,\n headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Support relative routing in internal redirects\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {\n let location = response.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1);\n location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);\n response.headers.set(\"Location\", location);\n }\n return response;\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {\n // Match Chrome's behavior:\n // https://github.com/chromium/chromium/blob/216dbeb61db0c667e62082e5f5400a32d6983df3/content/public/common/url_utils.cc#L82\n let invalidProtocols = [\"about:\", \"blob:\", \"chrome:\", \"chrome-untrusted:\", \"content:\", \"data:\", \"devtools:\", \"file:\", \"filesystem:\",\n // eslint-disable-next-line no-script-url\n \"javascript:\"];\n if (ABSOLUTE_URL_REGEX.test(location)) {\n // Strip off the protocol+origin for same-origin + same-basename absolute redirects\n let normalizedLocation = location;\n let url = normalizedLocation.startsWith(\"//\") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return url.pathname + url.search + url.hash;\n }\n }\n try {\n let url = historyInstance.createURL(location);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n } catch (e) {}\n return location;\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined;\n // Process loader results into state.loaderData/state.errors\n matches.forEach(match => {\n if (!(match.route.id in results)) {\n return;\n }\n let id = match.route.id;\n let result = results[id];\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError !== undefined) {\n error = pendingError;\n pendingError = undefined;\n }\n errors = errors || {};\n if (skipLoaderErrorBubbling) {\n errors[id] = error;\n } else {\n // Look upwards from the matched route for the closest ancestor error\n // boundary, defaulting to the root match. Prefer higher error values\n // if lower errors bubble to the same boundary\n let boundaryMatch = findNearestBoundary(matches, id);\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n loaderData[id] = result.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError !== undefined && pendingActionResult) {\n errors = {\n [pendingActionResult[0]]: pendingError\n };\n loaderData[pendingActionResult[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble\n );\n // Process results from our revalidating fetchers\n revalidatingFetchers.forEach(rf => {\n let {\n key,\n match,\n controller\n } = rf;\n let result = fetcherResults[key];\n invariant(result, \"Did not find corresponding fetcher result\");\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n return;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n });\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n if (!pendingActionResult) {\n return {};\n }\n return isErrorResult(pendingActionResult[1]) ? {\n // Clear out prior actionData on errors\n actionData: {}\n } : {\n actionData: {\n [pendingActionResult[0]]: pendingActionResult[1].data\n }\n };\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type,\n message\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n let entries = Object.entries(results);\n for (let i = entries.length - 1; i >= 0; i--) {\n let [key, result] = entries[i];\n if (isRedirectResult(result)) {\n return {\n key,\n result\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDataStrategyResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectDataStrategyResultResult(result) {\n return isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDataWithResponseInit(value) {\n return typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) {\n let entries = Object.entries(results);\n for (let index = 0; index < entries.length; index++) {\n let [routeId, result] = entries[index];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && isRevalidatingLoader) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n await resolveDeferredData(result, signal, false).then(result => {\n if (result) {\n results[routeId] = result;\n }\n });\n }\n }\n}\nasync function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) {\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n routeId,\n controller\n } = revalidatingFetchers[index];\n let result = results[key];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n if (isDeferredResult(result)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n invariant(controller, \"Expected an AbortController for revalidating fetcher deferred result\");\n await resolveDeferredData(result, controller.signal, true).then(result => {\n if (result) {\n results[key] = result;\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, data, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.30.3\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/v6/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a ``.\n *\n * @see https://reactrouter.com/v6/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/v6/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * ``.\n *\n * @see https://reactrouter.com/v6/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by ``s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/v6/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `` to render child routes.\n *\n * @see https://reactrouter.com/v6/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/v6/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/v6/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/v6/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (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.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = pathname;\n if (parentPathnameBase !== \"/\") {\n // Determine the remaining pathname by removing the # of URL segments the\n // parentPathnameBase has, instead of removing based on character count.\n // This is because we can't guarantee that incoming/outgoing encodings/\n // decodings will match exactly.\n // We decode paths before matching on a per-segment basis with\n // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they\n // match what `window.location.pathname` would reflect. Those don't 100%\n // align when it comes to encoded URI characters such as % and &.\n //\n // So we may end up with:\n // pathname: \"/descendant/a%25b/match\"\n // parentPathnameBase: \"/descendant/a%b\"\n //\n // And the direct substring removal approach won't work :/\n let parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n let segments = pathname.replace(/^\\//, \"\").split(\"/\");\n remainingPathname = \"/\" + segments.slice(parentSegments.length).join(\"/\");\n }\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.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.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _future;\n if (!dataRouterState) {\n return null;\n }\n if (dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {\n // Don't bail if we're initializing with partial hydration and we have\n // router matches. That means we're actively running `patchRoutesOnNavigation`\n // so we should render down the partial matches to the appropriate\n // `HydrateFallback`. We only do this if `parentMatches` is empty so it\n // only impacts the root matches for `RouterProvider` and no descendant\n // ``\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned$1 = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned$1[key]) {\n alreadyWarned$1[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\nconst alreadyWarned = {};\nfunction warnOnce(key, message) {\n if (process.env.NODE_ENV !== \"production\" && !alreadyWarned[message]) {\n alreadyWarned[message] = true;\n console.warn(message);\n }\n}\nconst logDeprecation = (flag, msg, link) => warnOnce(flag, \"\\u26A0\\uFE0F React Router Future Flag Warning: \" + msg + \". \" + (\"You can use the `\" + flag + \"` future flag to opt-in early. \") + (\"For more information, see \" + link + \".\"));\nfunction logV6DeprecationWarnings(renderFuture, routerFuture) {\n if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {\n logDeprecation(\"v7_startTransition\", \"React Router will begin wrapping state updates in `React.startTransition` in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_starttransition\");\n }\n if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {\n logDeprecation(\"v7_relativeSplatPath\", \"Relative route resolution within Splat routes is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath\");\n }\n if (routerFuture) {\n if (routerFuture.v7_fetcherPersist === undefined) {\n logDeprecation(\"v7_fetcherPersist\", \"The persistence behavior of fetchers is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist\");\n }\n if (routerFuture.v7_normalizeFormMethod === undefined) {\n logDeprecation(\"v7_normalizeFormMethod\", \"Casing of `formMethod` fields is being normalized to uppercase in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod\");\n }\n if (routerFuture.v7_partialHydration === undefined) {\n logDeprecation(\"v7_partialHydration\", \"`RouterProvider` hydration behavior is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_partialhydration\");\n }\n if (routerFuture.v7_skipActionErrorRevalidation === undefined) {\n logDeprecation(\"v7_skipActionErrorRevalidation\", \"The revalidation behavior after 4xx/5xx `action` responses is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation\");\n }\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n React.useEffect(() => logV6DeprecationWarnings(future, router.future), [router, future]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a - - - -
- - diff --git a/crawler_platform/app/web/static/locales/en/common.json b/crawler_platform/app/web/static/locales/en/common.json deleted file mode 100644 index 7e7fa28..0000000 --- a/crawler_platform/app/web/static/locales/en/common.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "app": { - "title": "Ontology Builder", - "subtitle": "AI-powered ontology construction" - }, - "nav": { - "dashboard": "Dashboard", - "onboard": "New Project", - "sources": "Sources", - "crawl": "Crawl", - "research": "Research", - "editor": "Editor", - "review": "Review", - "toggleSidebar": "Toggle sidebar" - }, - "dashboard": { - "title": "Ontology Builder", - "subtitle": "Build and manage domain ontologies with AI-powered extraction", - "newProject": "New Project", - "projects": "Projects", - "projectCount": "{{count}} total", - "loadFailed": "Failed to load projects", - "empty": { - "title": "No projects yet", - "hint": "Create your first project to start building an ontology" - } - }, - "onboarding": { - "title": "Create New Project", - "formTitle": "Choose Ontology Domain", - "formDesc": "Pick the domain of ontology you want to build and give your project a name.", - "projectName": "Project Name", - "projectNameHint": "Letters, digits, _ and - only (2~64 chars)", - "domain": "Domain", - "domainSummary": "{{entities}} entity types · {{predicates}} predicates", - "submit": "Create Project", - "created": "Project created: {{name}}", - "createFailed": "Create failed: {{msg}}" - }, - "sources": { - "title": "Configure Sources", - "next": "Proceed to Crawl", - "listTitle": "Registered Sources", - "listDesc": "Reference sites used for ontology construction", - "empty": "No sources yet. Add one using the form on the right.", - "addTitle": "Add Source", - "addDesc": "Enter information about the reference site", - "name": "Name", - "type": "Type", - "baseUrl": "Base URL", - "trust": "Trust", - "rateLimit": "rate/min", - "respectRobots": "Respect robots.txt", - "add": "Add Source", - "delete": "Delete", - "confirmDelete": "Delete source '{{name}}'?", - "added": "Source added: {{name}}", - "addFailed": "Add failed: {{msg}}", - "deleted": "Source deleted: {{name}}", - "deleteFailed": "Delete failed: {{msg}}" - }, - "research": { - "title": "Autonomous Research", - "formTitle": "Research Settings", - "formDesc": "AI follows links from a seed to autonomously expand the ontology", - "source": "Source", - "pickSource": "Pick a source...", - "goal": "Goal", - "goalPlaceholder": "e.g. Collect note compositions and seasonal recommendations of popular perfume brands", - "seedUrl": "Seed URL", - "optional": "optional", - "maxSteps": "Max Steps", - "maxBranch": "Branch Width", - "maxDepth": "Max Depth", - "minRelevance": "Min Relevance", - "sameDomainOnly": "Same domain only", - "start": "Start Research", - "runningHint": "This may take a while. Don't close the page until it finishes.", - "runningTitle": "AI is researching...", - "completed": "Research completed", - "failed": "Failed: {{msg}}", - "doneHint": "Done", - "idleHint": "Start research on the left to see results here", - "resultTitle": "Latest Result", - "resultDesc": "Outcome of the research run in this session", - "stepsTaken": "Steps", - "pagesVisited": "Pages", - "entitiesFound": "Entities", - "claimsAdded": "Claims", - "rawResult": "Raw JSON", - "historyTitle": "Session History", - "historyDesc": "Past research sessions for this project", - "historyEmpty": "No sessions yet", - "pages": "pages" - }, - "editor": { - "title": "Ontology Editor", - "entitiesTab": "Entities", - "claimsTab": "Claims", - "bulkTab": "JSON Bulk", - "addEntity": "Add Entity", - "addEntityDesc": "Pick from the domain's entity_types", - "entityType": "Type", - "pickType": "Pick type...", - "entityName": "Name", - "add": "Add", - "entitiesList": "Entities", - "entityCount": "{{count}} total", - "entitiesEmpty": "No entities yet", - "entityAdded": "Entity added: {{name}}", - "entityAddFailed": "Add failed: {{msg}}", - "confirmDeleteEntity": "Delete entity '{{name}}'?", - "addClaim": "Add Claim", - "addClaimDesc": "Subject-Predicate-Object form", - "source": "Source", - "pickSource": "Pick source...", - "subject": "Subject", - "pickSubject": "Pick entity...", - "predicate": "Predicate", - "pickPredicate": "Pick predicate...", - "objectKind": "Object kind", - "objectEntity": "Other entity", - "objectValue": "Literal value", - "pickObject": "Pick entity...", - "confidence": "Confidence", - "claimsList": "Claims", - "claimCount": "{{count}} total", - "claimsEmpty": "No claims yet", - "claimAdded": "Claim added", - "claimAddFailed": "Add failed: {{msg}}", - "confirmDeleteClaim": "Delete this claim?", - "bulkTitle": "JSON Bulk Input", - "bulkDesc": "JSON of shape { entities: [{ entity_type, name, metadata? }] }", - "bulkSubmit": "Bulk Add", - "bulkAdded": "{{count}} entities added" - }, - "crawl": { - "title": "Seed Crawl", - "formTitle": "Crawl Settings", - "formDesc": "Start from a seed URL and follow links to extract information", - "source": "Source", - "pickSource": "Pick a source...", - "noSources": "No sources registered. Add a reference source first.", - "addSource": "Add Source", - "seedUrl": "Seed URL", - "maxDepth": "Max Depth", - "maxPages": "Max Pages", - "sameDomainOnly": "Same domain only", - "start": "Start Crawl", - "started": "Crawl started (job #{{id}})", - "startFailed": "Start failed: {{msg}}", - "cancel": "Cancel", - "cancelRequested": "Cancel requested", - "cancelFailed": "Cancel failed: {{msg}}", - "progressTitle": "Progress", - "idleHint": "Enter a seed URL and start the crawl", - "visited": "Visited", - "queued": "Queued", - "analyzed": "Analyzed", - "latestPage": "Latest Page", - "errorsCount": "{{count}} errors", - "doneHint": "Crawl complete. Go review the results.", - "review": "Review" - }, - "common": { - "retry": "Retry", - "cancel": "Cancel", - "next": "Next", - "back": "Back", - "complete": "Complete" - } -} diff --git a/crawler_platform/app/web/static/locales/ko/common.json b/crawler_platform/app/web/static/locales/ko/common.json deleted file mode 100644 index 5e698b7..0000000 --- a/crawler_platform/app/web/static/locales/ko/common.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "app": { - "title": "온톨로지 빌더", - "subtitle": "AI 기반 온톨로지 구축 플랫폼" - }, - "nav": { - "dashboard": "대시보드", - "onboard": "프로젝트 생성", - "sources": "참고 소스", - "crawl": "크롤 진행", - "research": "자율 연구", - "editor": "온톨로지 편집", - "review": "결과 검토", - "toggleSidebar": "사이드바 토글" - }, - "dashboard": { - "title": "온톨로지 빌더", - "subtitle": "도메인 온톨로지를 AI 추출로 구축하고 관리합니다", - "newProject": "새 프로젝트", - "projects": "프로젝트 목록", - "projectCount": "{{count}}개", - "loadFailed": "프로젝트를 불러오지 못했습니다", - "empty": { - "title": "아직 프로젝트가 없습니다", - "hint": "첫 프로젝트를 만들어 온톨로지 구축을 시작하세요" - } - }, - "onboarding": { - "title": "새 프로젝트 만들기", - "formTitle": "온톨로지 도메인 선택", - "formDesc": "어떤 종류의 온톨로지를 구축할지 도메인을 선택하고 프로젝트 이름을 정해주세요.", - "projectName": "프로젝트 이름", - "projectNameHint": "영문, 숫자, _ , - 만 사용 (2~64자)", - "domain": "도메인", - "domainSummary": "엔티티 {{entities}}종 · 관계 {{predicates}}개", - "submit": "프로젝트 만들기", - "created": "프로젝트가 생성되었습니다: {{name}}", - "createFailed": "생성 실패: {{msg}}" - }, - "sources": { - "title": "참고 소스 설정", - "next": "크롤 진행", - "listTitle": "등록된 소스", - "listDesc": "프로젝트 온톨로지 구축에 사용할 참고 사이트 목록", - "empty": "아직 등록된 소스가 없습니다. 오른쪽 폼에서 추가하세요.", - "addTitle": "소스 추가", - "addDesc": "참고할 사이트 정보를 입력하세요", - "name": "이름", - "type": "타입", - "baseUrl": "Base URL", - "trust": "신뢰도", - "rateLimit": "rate/분", - "respectRobots": "robots.txt 준수", - "add": "소스 추가", - "delete": "삭제", - "confirmDelete": "정말 '{{name}}' 소스를 삭제하시겠습니까?", - "added": "소스가 추가되었습니다: {{name}}", - "addFailed": "추가 실패: {{msg}}", - "deleted": "소스가 삭제되었습니다: {{name}}", - "deleteFailed": "삭제 실패: {{msg}}" - }, - "research": { - "title": "자율 연구", - "formTitle": "자율 연구 설정", - "formDesc": "AI가 시드에서 시작해 스스로 링크를 따라가며 온톨로지를 확장합니다", - "source": "참고 소스", - "pickSource": "소스를 선택하세요...", - "goal": "목표", - "goalPlaceholder": "예: 인기 브랜드 향수의 노트 구성과 시즌 추천 정보 수집", - "seedUrl": "시드 URL", - "optional": "선택", - "maxSteps": "최대 단계", - "maxBranch": "분기 폭", - "maxDepth": "최대 깊이", - "minRelevance": "최소 관련도", - "sameDomainOnly": "동일 도메인만 탐색", - "start": "자율 연구 시작", - "runningHint": "장시간 걸릴 수 있습니다. 완료될 때까지 페이지를 닫지 마세요.", - "runningTitle": "AI가 연구 중입니다...", - "completed": "자율 연구가 완료되었습니다", - "failed": "실패: {{msg}}", - "doneHint": "완료", - "idleHint": "왼쪽에서 자율 연구를 시작하면 결과가 여기에 표시됩니다", - "resultTitle": "최근 결과", - "resultDesc": "이번 세션에서 실행된 연구의 결과", - "stepsTaken": "단계", - "pagesVisited": "페이지", - "entitiesFound": "엔티티", - "claimsAdded": "클레임", - "rawResult": "원시 응답 JSON", - "historyTitle": "세션 이력", - "historyDesc": "이 프로젝트의 자율 연구 세션 기록", - "historyEmpty": "아직 실행된 세션이 없습니다", - "pages": "페이지" - }, - "editor": { - "title": "온톨로지 직접 편집", - "entitiesTab": "엔티티", - "claimsTab": "클레임", - "bulkTab": "JSON 일괄 입력", - "addEntity": "엔티티 추가", - "addEntityDesc": "온톨로지 도메인의 entity_types 중에서 선택", - "entityType": "타입", - "pickType": "타입 선택...", - "entityName": "이름", - "add": "추가", - "entitiesList": "엔티티 목록", - "entityCount": "{{count}}개", - "entitiesEmpty": "아직 등록된 엔티티가 없습니다", - "entityAdded": "엔티티가 추가되었습니다: {{name}}", - "entityAddFailed": "추가 실패: {{msg}}", - "confirmDeleteEntity": "엔티티 '{{name}}'을 삭제하시겠습니까?", - "addClaim": "클레임 추가", - "addClaimDesc": "주어-술어-목적어 형태로 직접 입력", - "source": "소스", - "pickSource": "소스 선택...", - "subject": "주어 (Subject)", - "pickSubject": "엔티티 선택...", - "predicate": "술어 (Predicate)", - "pickPredicate": "술어 선택...", - "objectKind": "목적어 유형", - "objectEntity": "다른 엔티티", - "objectValue": "리터럴 값", - "pickObject": "엔티티 선택...", - "confidence": "신뢰도", - "claimsList": "클레임 목록", - "claimCount": "{{count}}개", - "claimsEmpty": "아직 등록된 클레임이 없습니다", - "claimAdded": "클레임이 추가되었습니다", - "claimAddFailed": "추가 실패: {{msg}}", - "confirmDeleteClaim": "클레임을 삭제하시겠습니까?", - "bulkTitle": "JSON 일괄 입력", - "bulkDesc": "{ entities: [{ entity_type, name, metadata? }] } 형태의 JSON", - "bulkSubmit": "일괄 추가", - "bulkAdded": "{{count}}개 엔티티가 추가되었습니다" - }, - "crawl": { - "title": "시드 크롤", - "formTitle": "크롤 설정", - "formDesc": "시드 URL에서 시작해 링크를 따라가며 정보를 추출합니다", - "source": "참고 소스", - "pickSource": "소스를 선택하세요...", - "noSources": "등록된 소스가 없습니다. 먼저 참고 소스를 추가하세요.", - "addSource": "소스 추가", - "seedUrl": "시드 URL", - "maxDepth": "최대 깊이", - "maxPages": "최대 페이지", - "sameDomainOnly": "동일 도메인만 따라가기", - "start": "크롤 시작", - "started": "크롤이 시작되었습니다 (job #{{id}})", - "startFailed": "시작 실패: {{msg}}", - "cancel": "취소", - "cancelRequested": "취소 요청됨", - "cancelFailed": "취소 실패: {{msg}}", - "progressTitle": "진행 상태", - "idleHint": "왼쪽에서 시드 URL을 입력하고 시작하세요", - "visited": "방문", - "queued": "대기", - "analyzed": "분석", - "latestPage": "최근 페이지", - "errorsCount": "에러 {{count}}건", - "doneHint": "크롤 완료. 결과 검토로 이동하세요.", - "review": "결과 검토" - }, - "common": { - "retry": "다시 시도", - "cancel": "취소", - "next": "다음", - "back": "이전", - "complete": "완료" - } -} diff --git a/ontology_platform/.gitignore b/ontology_platform/.gitignore index 412ef23..1160b75 100644 --- a/ontology_platform/.gitignore +++ b/ontology_platform/.gitignore @@ -54,6 +54,7 @@ data/working/ data/cache/ data/raw/ data/artifacts/ +data/ui_projects.json # ─── 데이터베이스 ─────────────────────────────────────────────────── *.db @@ -81,3 +82,7 @@ docker-compose.override.yml # ─── OS ───────────────────────────────────────────────────────────── Thumbs.db Desktop.ini + +# Frontend +web/frontend/node_modules/ +web/static/ diff --git a/ontology_platform/configs/perfume_subscription.yaml b/ontology_platform/configs/perfume_subscription.yaml new file mode 100644 index 0000000..a0dbe5c --- /dev/null +++ b/ontology_platform/configs/perfume_subscription.yaml @@ -0,0 +1,113 @@ +project_name: perfume_subscription +domain: perfume +target_entities: + - Product + - Perfume + - Brand + - Event + - Article + - Promotion + - Category + - Notice + - Page + - Note + - Accord + - Mood + - Season + - Occasion +fields: + - name + - brand + - top_notes + - middle_notes + - base_notes + - accords + - mood_tags + - season_tags + - occasion_tags + - price + - review_keywords +sources: + - name: official_brand_site + type: official + trust_level: 0.95 + parser: generic + fetcher: playwright + rate_limit_per_minute: 20 + respect_robots_txt: false + - name: marketplace + type: marketplace + trust_level: 0.8 + parser: generic + fetcher: requests + rate_limit_per_minute: 15 + respect_robots_txt: false + - name: review_site + type: review + trust_level: 0.7 + parser: generic + fetcher: requests + rate_limit_per_minute: 10 + respect_robots_txt: false +ontology: + entity_types: + - Product + - Perfume + - Brand + - Event + - Article + - Promotion + - Category + - Notice + - Page + - Note + - Accord + - Mood + - Season + - Occasion + - Review + - Price + - ProductPage + - CommunityPage + - BrandStoryPage + - ListingPage + - PromotionPage + - ReviewPage + predicates: + - hasBrand + - hasTopNote + - hasMiddleNote + - hasBaseNote + - hasAccord + - evokesMood + - suitableForSeason + - suitableForOccasion + - similarTo + - soldBy + - hasPrice + - hasReviewKeyword + aliases: + top_notes: hasTopNote + middle_notes: hasMiddleNote + heart_notes: hasMiddleNote + base_notes: hasBaseNote + accords: hasAccord + mood_tags: evokesMood + season_tags: suitableForSeason + occasion_tags: suitableForOccasion + review_keywords: hasReviewKeyword +recommendation: + target_entity_type: Perfume + weights: + preferred_note: 2.0 + avoided_note: -3.0 + preferred_mood: 1.5 + season_context: 1.2 + occasion_context: 1.0 +update_policy: + official: + interval_days: 30 + marketplace: + interval_days: 7 + review: + interval_days: 14 diff --git a/crawler_platform/__init__.py b/ontology_platform/crawler_platform/__init__.py similarity index 100% rename from crawler_platform/__init__.py rename to ontology_platform/crawler_platform/__init__.py diff --git a/crawler_platform/app/__init__.py b/ontology_platform/crawler_platform/app/__init__.py similarity index 100% rename from crawler_platform/app/__init__.py rename to ontology_platform/crawler_platform/app/__init__.py diff --git a/crawler_platform/app/adapters/__init__.py b/ontology_platform/crawler_platform/app/adapters/__init__.py similarity index 100% rename from crawler_platform/app/adapters/__init__.py rename to ontology_platform/crawler_platform/app/adapters/__init__.py diff --git a/crawler_platform/app/adapters/base.py b/ontology_platform/crawler_platform/app/adapters/base.py similarity index 100% rename from crawler_platform/app/adapters/base.py rename to ontology_platform/crawler_platform/app/adapters/base.py diff --git a/crawler_platform/app/adapters/ecommerce/__init__.py b/ontology_platform/crawler_platform/app/adapters/ecommerce/__init__.py similarity index 100% rename from crawler_platform/app/adapters/ecommerce/__init__.py rename to ontology_platform/crawler_platform/app/adapters/ecommerce/__init__.py diff --git a/crawler_platform/app/adapters/ecommerce/perfume.py b/ontology_platform/crawler_platform/app/adapters/ecommerce/perfume.py similarity index 100% rename from crawler_platform/app/adapters/ecommerce/perfume.py rename to ontology_platform/crawler_platform/app/adapters/ecommerce/perfume.py diff --git a/crawler_platform/app/adapters/registry.py b/ontology_platform/crawler_platform/app/adapters/registry.py similarity index 100% rename from crawler_platform/app/adapters/registry.py rename to ontology_platform/crawler_platform/app/adapters/registry.py diff --git a/crawler_platform/app/api/__init__.py b/ontology_platform/crawler_platform/app/api/__init__.py similarity index 100% rename from crawler_platform/app/api/__init__.py rename to ontology_platform/crawler_platform/app/api/__init__.py diff --git a/crawler_platform/app/api/routes.py b/ontology_platform/crawler_platform/app/api/routes.py similarity index 100% rename from crawler_platform/app/api/routes.py rename to ontology_platform/crawler_platform/app/api/routes.py diff --git a/crawler_platform/app/cli/__init__.py b/ontology_platform/crawler_platform/app/cli/__init__.py similarity index 100% rename from crawler_platform/app/cli/__init__.py rename to ontology_platform/crawler_platform/app/cli/__init__.py diff --git a/crawler_platform/app/cli/main.py b/ontology_platform/crawler_platform/app/cli/main.py similarity index 100% rename from crawler_platform/app/cli/main.py rename to ontology_platform/crawler_platform/app/cli/main.py diff --git a/crawler_platform/app/config/__init__.py b/ontology_platform/crawler_platform/app/config/__init__.py similarity index 100% rename from crawler_platform/app/config/__init__.py rename to ontology_platform/crawler_platform/app/config/__init__.py diff --git a/crawler_platform/app/config/loader.py b/ontology_platform/crawler_platform/app/config/loader.py similarity index 100% rename from crawler_platform/app/config/loader.py rename to ontology_platform/crawler_platform/app/config/loader.py diff --git a/crawler_platform/app/core/__init__.py b/ontology_platform/crawler_platform/app/core/__init__.py similarity index 100% rename from crawler_platform/app/core/__init__.py rename to ontology_platform/crawler_platform/app/core/__init__.py diff --git a/crawler_platform/app/core/crawler/__init__.py b/ontology_platform/crawler_platform/app/core/crawler/__init__.py similarity index 100% rename from crawler_platform/app/core/crawler/__init__.py rename to ontology_platform/crawler_platform/app/core/crawler/__init__.py diff --git a/crawler_platform/app/core/crawler/content_zone.py b/ontology_platform/crawler_platform/app/core/crawler/content_zone.py similarity index 100% rename from crawler_platform/app/core/crawler/content_zone.py rename to ontology_platform/crawler_platform/app/core/crawler/content_zone.py diff --git a/crawler_platform/app/core/crawler/discovery.py b/ontology_platform/crawler_platform/app/core/crawler/discovery.py similarity index 100% rename from crawler_platform/app/core/crawler/discovery.py rename to ontology_platform/crawler_platform/app/core/crawler/discovery.py diff --git a/crawler_platform/app/core/crawler/fetchers.py b/ontology_platform/crawler_platform/app/core/crawler/fetchers.py similarity index 100% rename from crawler_platform/app/core/crawler/fetchers.py rename to ontology_platform/crawler_platform/app/core/crawler/fetchers.py diff --git a/crawler_platform/app/core/crawler/html_cleaner.py b/ontology_platform/crawler_platform/app/core/crawler/html_cleaner.py similarity index 100% rename from crawler_platform/app/core/crawler/html_cleaner.py rename to ontology_platform/crawler_platform/app/core/crawler/html_cleaner.py diff --git a/crawler_platform/app/core/crawler/page_classifier.py b/ontology_platform/crawler_platform/app/core/crawler/page_classifier.py similarity index 100% rename from crawler_platform/app/core/crawler/page_classifier.py rename to ontology_platform/crawler_platform/app/core/crawler/page_classifier.py diff --git a/crawler_platform/app/core/crawler/page_cleaner.py b/ontology_platform/crawler_platform/app/core/crawler/page_cleaner.py similarity index 100% rename from crawler_platform/app/core/crawler/page_cleaner.py rename to ontology_platform/crawler_platform/app/core/crawler/page_cleaner.py diff --git a/crawler_platform/app/core/crawler/pipeline.py b/ontology_platform/crawler_platform/app/core/crawler/pipeline.py similarity index 100% rename from crawler_platform/app/core/crawler/pipeline.py rename to ontology_platform/crawler_platform/app/core/crawler/pipeline.py diff --git a/crawler_platform/app/core/crawler/plugins.py b/ontology_platform/crawler_platform/app/core/crawler/plugins.py similarity index 100% rename from crawler_platform/app/core/crawler/plugins.py rename to ontology_platform/crawler_platform/app/core/crawler/plugins.py diff --git a/crawler_platform/app/core/crawler/site_crawler.py b/ontology_platform/crawler_platform/app/core/crawler/site_crawler.py similarity index 100% rename from crawler_platform/app/core/crawler/site_crawler.py rename to ontology_platform/crawler_platform/app/core/crawler/site_crawler.py diff --git a/crawler_platform/app/core/database/__init__.py b/ontology_platform/crawler_platform/app/core/database/__init__.py similarity index 100% rename from crawler_platform/app/core/database/__init__.py rename to ontology_platform/crawler_platform/app/core/database/__init__.py diff --git a/crawler_platform/app/core/database/models.py b/ontology_platform/crawler_platform/app/core/database/models.py similarity index 100% rename from crawler_platform/app/core/database/models.py rename to ontology_platform/crawler_platform/app/core/database/models.py diff --git a/crawler_platform/app/core/database/repository.py b/ontology_platform/crawler_platform/app/core/database/repository.py similarity index 100% rename from crawler_platform/app/core/database/repository.py rename to ontology_platform/crawler_platform/app/core/database/repository.py diff --git a/crawler_platform/app/core/database/session.py b/ontology_platform/crawler_platform/app/core/database/session.py similarity index 100% rename from crawler_platform/app/core/database/session.py rename to ontology_platform/crawler_platform/app/core/database/session.py diff --git a/crawler_platform/app/core/extractor/__init__.py b/ontology_platform/crawler_platform/app/core/extractor/__init__.py similarity index 100% rename from crawler_platform/app/core/extractor/__init__.py rename to ontology_platform/crawler_platform/app/core/extractor/__init__.py diff --git a/crawler_platform/app/core/extractor/ai_provider.py b/ontology_platform/crawler_platform/app/core/extractor/ai_provider.py similarity index 100% rename from crawler_platform/app/core/extractor/ai_provider.py rename to ontology_platform/crawler_platform/app/core/extractor/ai_provider.py diff --git a/crawler_platform/app/core/extractor/base.py b/ontology_platform/crawler_platform/app/core/extractor/base.py similarity index 100% rename from crawler_platform/app/core/extractor/base.py rename to ontology_platform/crawler_platform/app/core/extractor/base.py diff --git a/crawler_platform/app/core/extractor/factory.py b/ontology_platform/crawler_platform/app/core/extractor/factory.py similarity index 100% rename from crawler_platform/app/core/extractor/factory.py rename to ontology_platform/crawler_platform/app/core/extractor/factory.py diff --git a/crawler_platform/app/core/extractor/rule_based.py b/ontology_platform/crawler_platform/app/core/extractor/rule_based.py similarity index 100% rename from crawler_platform/app/core/extractor/rule_based.py rename to ontology_platform/crawler_platform/app/core/extractor/rule_based.py diff --git a/crawler_platform/app/core/extractor/validation.py b/ontology_platform/crawler_platform/app/core/extractor/validation.py similarity index 100% rename from crawler_platform/app/core/extractor/validation.py rename to ontology_platform/crawler_platform/app/core/extractor/validation.py diff --git a/crawler_platform/app/core/ontology/__init__.py b/ontology_platform/crawler_platform/app/core/ontology/__init__.py similarity index 100% rename from crawler_platform/app/core/ontology/__init__.py rename to ontology_platform/crawler_platform/app/core/ontology/__init__.py diff --git a/crawler_platform/app/core/ontology/definitions.py b/ontology_platform/crawler_platform/app/core/ontology/definitions.py similarity index 100% rename from crawler_platform/app/core/ontology/definitions.py rename to ontology_platform/crawler_platform/app/core/ontology/definitions.py diff --git a/crawler_platform/app/core/ontology/entity_normalizer.py b/ontology_platform/crawler_platform/app/core/ontology/entity_normalizer.py similarity index 100% rename from crawler_platform/app/core/ontology/entity_normalizer.py rename to ontology_platform/crawler_platform/app/core/ontology/entity_normalizer.py diff --git a/crawler_platform/app/core/ontology/gap_detector.py b/ontology_platform/crawler_platform/app/core/ontology/gap_detector.py similarity index 100% rename from crawler_platform/app/core/ontology/gap_detector.py rename to ontology_platform/crawler_platform/app/core/ontology/gap_detector.py diff --git a/crawler_platform/app/core/ontology/graph_merge.py b/ontology_platform/crawler_platform/app/core/ontology/graph_merge.py similarity index 100% rename from crawler_platform/app/core/ontology/graph_merge.py rename to ontology_platform/crawler_platform/app/core/ontology/graph_merge.py diff --git a/crawler_platform/app/core/ontology/mapper.py b/ontology_platform/crawler_platform/app/core/ontology/mapper.py similarity index 100% rename from crawler_platform/app/core/ontology/mapper.py rename to ontology_platform/crawler_platform/app/core/ontology/mapper.py diff --git a/crawler_platform/app/core/ontology/registry.py b/ontology_platform/crawler_platform/app/core/ontology/registry.py similarity index 100% rename from crawler_platform/app/core/ontology/registry.py rename to ontology_platform/crawler_platform/app/core/ontology/registry.py diff --git a/crawler_platform/app/core/ontology/relation_schema.py b/ontology_platform/crawler_platform/app/core/ontology/relation_schema.py similarity index 100% rename from crawler_platform/app/core/ontology/relation_schema.py rename to ontology_platform/crawler_platform/app/core/ontology/relation_schema.py diff --git a/crawler_platform/app/core/ontology/structured_output.py b/ontology_platform/crawler_platform/app/core/ontology/structured_output.py similarity index 100% rename from crawler_platform/app/core/ontology/structured_output.py rename to ontology_platform/crawler_platform/app/core/ontology/structured_output.py diff --git a/crawler_platform/app/core/ontology/triple_store.py b/ontology_platform/crawler_platform/app/core/ontology/triple_store.py similarity index 100% rename from crawler_platform/app/core/ontology/triple_store.py rename to ontology_platform/crawler_platform/app/core/ontology/triple_store.py diff --git a/crawler_platform/app/core/recommendation/__init__.py b/ontology_platform/crawler_platform/app/core/recommendation/__init__.py similarity index 100% rename from crawler_platform/app/core/recommendation/__init__.py rename to ontology_platform/crawler_platform/app/core/recommendation/__init__.py diff --git a/crawler_platform/app/core/recommendation/scorer.py b/ontology_platform/crawler_platform/app/core/recommendation/scorer.py similarity index 100% rename from crawler_platform/app/core/recommendation/scorer.py rename to ontology_platform/crawler_platform/app/core/recommendation/scorer.py diff --git a/crawler_platform/app/core/research/__init__.py b/ontology_platform/crawler_platform/app/core/research/__init__.py similarity index 100% rename from crawler_platform/app/core/research/__init__.py rename to ontology_platform/crawler_platform/app/core/research/__init__.py diff --git a/crawler_platform/app/core/research/entity_expansion.py b/ontology_platform/crawler_platform/app/core/research/entity_expansion.py similarity index 100% rename from crawler_platform/app/core/research/entity_expansion.py rename to ontology_platform/crawler_platform/app/core/research/entity_expansion.py diff --git a/crawler_platform/app/core/research/exploration_queue.py b/ontology_platform/crawler_platform/app/core/research/exploration_queue.py similarity index 100% rename from crawler_platform/app/core/research/exploration_queue.py rename to ontology_platform/crawler_platform/app/core/research/exploration_queue.py diff --git a/crawler_platform/app/core/research/gap_task_planner.py b/ontology_platform/crawler_platform/app/core/research/gap_task_planner.py similarity index 100% rename from crawler_platform/app/core/research/gap_task_planner.py rename to ontology_platform/crawler_platform/app/core/research/gap_task_planner.py diff --git a/crawler_platform/app/core/research/graph_query.py b/ontology_platform/crawler_platform/app/core/research/graph_query.py similarity index 100% rename from crawler_platform/app/core/research/graph_query.py rename to ontology_platform/crawler_platform/app/core/research/graph_query.py diff --git a/crawler_platform/app/core/research/graph_research_loop.py b/ontology_platform/crawler_platform/app/core/research/graph_research_loop.py similarity index 100% rename from crawler_platform/app/core/research/graph_research_loop.py rename to ontology_platform/crawler_platform/app/core/research/graph_research_loop.py diff --git a/crawler_platform/app/core/research/memory_store.py b/ontology_platform/crawler_platform/app/core/research/memory_store.py similarity index 100% rename from crawler_platform/app/core/research/memory_store.py rename to ontology_platform/crawler_platform/app/core/research/memory_store.py diff --git a/crawler_platform/app/core/research/relevance_engine.py b/ontology_platform/crawler_platform/app/core/research/relevance_engine.py similarity index 100% rename from crawler_platform/app/core/research/relevance_engine.py rename to ontology_platform/crawler_platform/app/core/research/relevance_engine.py diff --git a/crawler_platform/app/core/scheduler/__init__.py b/ontology_platform/crawler_platform/app/core/scheduler/__init__.py similarity index 100% rename from crawler_platform/app/core/scheduler/__init__.py rename to ontology_platform/crawler_platform/app/core/scheduler/__init__.py diff --git a/crawler_platform/app/core/scheduler/update_policy.py b/ontology_platform/crawler_platform/app/core/scheduler/update_policy.py similarity index 100% rename from crawler_platform/app/core/scheduler/update_policy.py rename to ontology_platform/crawler_platform/app/core/scheduler/update_policy.py diff --git a/crawler_platform/app/domains/__init__.py b/ontology_platform/crawler_platform/app/domains/__init__.py similarity index 100% rename from crawler_platform/app/domains/__init__.py rename to ontology_platform/crawler_platform/app/domains/__init__.py diff --git a/crawler_platform/app/domains/candle/__init__.py b/ontology_platform/crawler_platform/app/domains/candle/__init__.py similarity index 100% rename from crawler_platform/app/domains/candle/__init__.py rename to ontology_platform/crawler_platform/app/domains/candle/__init__.py diff --git a/crawler_platform/app/domains/coffee/__init__.py b/ontology_platform/crawler_platform/app/domains/coffee/__init__.py similarity index 100% rename from crawler_platform/app/domains/coffee/__init__.py rename to ontology_platform/crawler_platform/app/domains/coffee/__init__.py diff --git a/crawler_platform/app/domains/gift/__init__.py b/ontology_platform/crawler_platform/app/domains/gift/__init__.py similarity index 100% rename from crawler_platform/app/domains/gift/__init__.py rename to ontology_platform/crawler_platform/app/domains/gift/__init__.py diff --git a/crawler_platform/app/domains/perfume/__init__.py b/ontology_platform/crawler_platform/app/domains/perfume/__init__.py similarity index 100% rename from crawler_platform/app/domains/perfume/__init__.py rename to ontology_platform/crawler_platform/app/domains/perfume/__init__.py diff --git a/crawler_platform/app/domains/perfume/extractor.py b/ontology_platform/crawler_platform/app/domains/perfume/extractor.py similarity index 100% rename from crawler_platform/app/domains/perfume/extractor.py rename to ontology_platform/crawler_platform/app/domains/perfume/extractor.py diff --git a/crawler_platform/app/domains/supplement/__init__.py b/ontology_platform/crawler_platform/app/domains/supplement/__init__.py similarity index 100% rename from crawler_platform/app/domains/supplement/__init__.py rename to ontology_platform/crawler_platform/app/domains/supplement/__init__.py diff --git a/crawler_platform/app/domains/tea/__init__.py b/ontology_platform/crawler_platform/app/domains/tea/__init__.py similarity index 100% rename from crawler_platform/app/domains/tea/__init__.py rename to ontology_platform/crawler_platform/app/domains/tea/__init__.py diff --git a/crawler_platform/app/main.py b/ontology_platform/crawler_platform/app/main.py similarity index 80% rename from crawler_platform/app/main.py rename to ontology_platform/crawler_platform/app/main.py index a4d0c3c..ddefbcf 100644 --- a/crawler_platform/app/main.py +++ b/ontology_platform/crawler_platform/app/main.py @@ -10,8 +10,12 @@ from crawler_platform.app.api.routes import register_routes from crawler_platform.app.core.database.session import init_db -DATABASE_URL = os.getenv("CRAWLER_DATABASE_URL", "sqlite:///crawler_platform.db") -STATIC_DIR = Path(__file__).parent / "web" / "static" +ONTOLOGY_ROOT = Path(__file__).resolve().parents[2] +DATABASE_URL = os.getenv( + "CRAWLER_DATABASE_URL", + f"sqlite:///{(ONTOLOGY_ROOT / 'data' / 'crawler_platform.db').as_posix()}", +) +STATIC_DIR = Path(os.getenv("ONTOLOGY_PRODUCT_STATIC_DIR", str(ONTOLOGY_ROOT / "web" / "static"))) app = FastAPI(title="Ontology Crawler Platform", version="0.1.0") init_db(DATABASE_URL) diff --git a/ontology_platform/ont_platform/api/main.py b/ontology_platform/ont_platform/api/main.py index 4c25bd1..3245ea4 100644 --- a/ontology_platform/ont_platform/api/main.py +++ b/ontology_platform/ont_platform/api/main.py @@ -44,6 +44,7 @@ from ont_platform.api.deps import ( # noqa: E402 get_app_context, initialize_app_context, ) +from ont_platform.api.product_backend import include_product_backend # noqa: E402 platform_config = importlib.import_module("ont_platform.config") @@ -80,7 +81,7 @@ PLATFORM_VERSION = "0.0.1" def _include_phase_routers(app: FastAPI) -> None: """Attach routers whose dependencies are enabled for the configured phase.""" settings = platform_config.load_settings() - enabled_routes: list[str] = [] + enabled_routes: list[str] = ["product-backend"] if settings.phase >= platform_config.Phase.TRAFILATURA: try: @@ -144,6 +145,7 @@ def create_app() -> FastAPI: version=PLATFORM_VERSION, lifespan=lifespan, ) + include_product_backend(app) # ─── /health ────────────────────────────────────────────────────── @app.get("/health", tags=["meta"]) diff --git a/ontology_platform/ont_platform/api/product_backend.py b/ontology_platform/ont_platform/api/product_backend.py new file mode 100644 index 0000000..274a3d5 --- /dev/null +++ b/ontology_platform/ont_platform/api/product_backend.py @@ -0,0 +1,87 @@ +"""Product backend bridge for the migrated crawler platform. + +This module mounts the product API that the current frontend already uses: +projects, sources, crawl jobs, claims, ontology registry, graph views, and +exports. The implementation now lives inside ``ontology_platform`` so the root +``crawler_platform`` folder can be retired after verification. +""" + +from __future__ import annotations + +import os +from pathlib import Path + +from fastapi import FastAPI, Request +from fastapi.responses import FileResponse, JSONResponse + +from crawler_platform.app.api.routes import register_routes +from crawler_platform.app.core.database.session import init_db + + +_ONTOLOGY_ROOT = Path(__file__).resolve().parents[2] +_DEFAULT_DB_PATH = _ONTOLOGY_ROOT / "data" / "crawler_platform.db" +_DEFAULT_STATIC_DIR = _ONTOLOGY_ROOT / "web" / "static" + + +def product_database_url() -> str: + configured = os.getenv("CRAWLER_DATABASE_URL") + if configured: + return configured + _DEFAULT_DB_PATH.parent.mkdir(parents=True, exist_ok=True) + return f"sqlite:///{_DEFAULT_DB_PATH.as_posix()}" + + +def product_static_dir() -> Path: + configured = os.getenv("ONTOLOGY_PRODUCT_STATIC_DIR") + return Path(configured) if configured else _DEFAULT_STATIC_DIR + + +def include_product_backend(app: FastAPI) -> None: + """Mount the migrated product API and SPA routes on the given app.""" + + database_url = product_database_url() + init_db(database_url) + register_routes(app, database_url) + _remove_route(app, "/health", {"GET"}) + app.state.product_database_url = database_url + + app.add_exception_handler(KeyError, _handle_key_error) + + @app.get("/static/{asset_path:path}", include_in_schema=False) + def static_or_spa(asset_path: str): + static_root = product_static_dir().resolve() + target = (static_root / asset_path).resolve() + try: + target.relative_to(static_root) + except ValueError: + return JSONResponse(status_code=404, content={"detail": "not found"}) + + if target.is_file(): + return FileResponse(target) + index = static_root / "index.html" + if index.is_file(): + return FileResponse(index) + return JSONResponse(status_code=404, content={"detail": "frontend build not found"}) + + @app.get("/", include_in_schema=False) + def admin_ui(): + index = product_static_dir() / "index.html" + if index.is_file(): + return FileResponse(index) + return JSONResponse(status_code=404, content={"detail": "frontend build not found"}) + + +def _handle_key_error(_request: Request, exc: KeyError) -> JSONResponse: + detail = str(exc.args[0]) if exc.args else "not found" + return JSONResponse(status_code=404, content={"detail": detail}) + + +def _remove_route(app: FastAPI, path: str, methods: set[str]) -> None: + app.router.routes = [ + route + for route in app.router.routes + if not ( + getattr(route, "path", None) == path + and set(getattr(route, "methods", set())) == methods + ) + ] diff --git a/ontology_platform/pyproject.toml b/ontology_platform/pyproject.toml index 656f9de..a74f552 100644 --- a/ontology_platform/pyproject.toml +++ b/ontology_platform/pyproject.toml @@ -117,13 +117,13 @@ dev = [ ontology-platform = "ont_platform.api.main:cli" [tool.hatch.build.targets.wheel] -packages = ["ont_platform"] +packages = ["ont_platform", "crawler_platform"] # ─── Ruff (linter + formatter) ──────────────────────────────────────── [tool.ruff] line-length = 100 target-version = "py312" -src = ["ont_platform", "tests"] +src = ["ont_platform", "crawler_platform", "tests"] extend-exclude = ["vendored"] # vendored OntoCast 등은 원본 유지 [tool.ruff.lint] diff --git a/crawler_platform/app/web/frontend/.gitignore b/ontology_platform/web/frontend/.gitignore similarity index 100% rename from crawler_platform/app/web/frontend/.gitignore rename to ontology_platform/web/frontend/.gitignore diff --git a/crawler_platform/app/web/frontend/index.html b/ontology_platform/web/frontend/index.html similarity index 100% rename from crawler_platform/app/web/frontend/index.html rename to ontology_platform/web/frontend/index.html diff --git a/crawler_platform/app/web/frontend/package-lock.json b/ontology_platform/web/frontend/package-lock.json similarity index 99% rename from crawler_platform/app/web/frontend/package-lock.json rename to ontology_platform/web/frontend/package-lock.json index 8fab690..53a1d7e 100644 --- a/crawler_platform/app/web/frontend/package-lock.json +++ b/ontology_platform/web/frontend/package-lock.json @@ -1,11 +1,11 @@ { - "name": "crawler-platform-ui", + "name": "ontology-platform-ui", "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "crawler-platform-ui", + "name": "ontology-platform-ui", "version": "0.2.0", "dependencies": { "@hookform/resolvers": "^3.3.4", diff --git a/crawler_platform/app/web/frontend/package.json b/ontology_platform/web/frontend/package.json similarity index 97% rename from crawler_platform/app/web/frontend/package.json rename to ontology_platform/web/frontend/package.json index 84612d9..5bb09e9 100644 --- a/crawler_platform/app/web/frontend/package.json +++ b/ontology_platform/web/frontend/package.json @@ -1,5 +1,5 @@ { - "name": "crawler-platform-ui", + "name": "ontology-platform-ui", "version": "0.2.0", "private": true, "type": "module", diff --git a/crawler_platform/app/web/frontend/postcss.config.js b/ontology_platform/web/frontend/postcss.config.js similarity index 100% rename from crawler_platform/app/web/frontend/postcss.config.js rename to ontology_platform/web/frontend/postcss.config.js diff --git a/crawler_platform/app/web/frontend/public/locales/en/common.json b/ontology_platform/web/frontend/public/locales/en/common.json similarity index 100% rename from crawler_platform/app/web/frontend/public/locales/en/common.json rename to ontology_platform/web/frontend/public/locales/en/common.json diff --git a/crawler_platform/app/web/frontend/public/locales/ko/common.json b/ontology_platform/web/frontend/public/locales/ko/common.json similarity index 100% rename from crawler_platform/app/web/frontend/public/locales/ko/common.json rename to ontology_platform/web/frontend/public/locales/ko/common.json diff --git a/crawler_platform/app/web/frontend/src/App.tsx b/ontology_platform/web/frontend/src/App.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/App.tsx rename to ontology_platform/web/frontend/src/App.tsx diff --git a/crawler_platform/app/web/frontend/src/components/layout/AppShell.tsx b/ontology_platform/web/frontend/src/components/layout/AppShell.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/layout/AppShell.tsx rename to ontology_platform/web/frontend/src/components/layout/AppShell.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/badge.tsx b/ontology_platform/web/frontend/src/components/ui/badge.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/badge.tsx rename to ontology_platform/web/frontend/src/components/ui/badge.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/button.tsx b/ontology_platform/web/frontend/src/components/ui/button.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/button.tsx rename to ontology_platform/web/frontend/src/components/ui/button.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/card.tsx b/ontology_platform/web/frontend/src/components/ui/card.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/card.tsx rename to ontology_platform/web/frontend/src/components/ui/card.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/input.tsx b/ontology_platform/web/frontend/src/components/ui/input.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/input.tsx rename to ontology_platform/web/frontend/src/components/ui/input.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/label.tsx b/ontology_platform/web/frontend/src/components/ui/label.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/label.tsx rename to ontology_platform/web/frontend/src/components/ui/label.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/progress.tsx b/ontology_platform/web/frontend/src/components/ui/progress.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/progress.tsx rename to ontology_platform/web/frontend/src/components/ui/progress.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/select.tsx b/ontology_platform/web/frontend/src/components/ui/select.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/select.tsx rename to ontology_platform/web/frontend/src/components/ui/select.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/skeleton.tsx b/ontology_platform/web/frontend/src/components/ui/skeleton.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/skeleton.tsx rename to ontology_platform/web/frontend/src/components/ui/skeleton.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/tabs.tsx b/ontology_platform/web/frontend/src/components/ui/tabs.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/tabs.tsx rename to ontology_platform/web/frontend/src/components/ui/tabs.tsx diff --git a/crawler_platform/app/web/frontend/src/components/ui/textarea.tsx b/ontology_platform/web/frontend/src/components/ui/textarea.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/components/ui/textarea.tsx rename to ontology_platform/web/frontend/src/components/ui/textarea.tsx diff --git a/crawler_platform/app/web/frontend/src/hooks/queryKeys.ts b/ontology_platform/web/frontend/src/hooks/queryKeys.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/queryKeys.ts rename to ontology_platform/web/frontend/src/hooks/queryKeys.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useClaims.ts b/ontology_platform/web/frontend/src/hooks/useClaims.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useClaims.ts rename to ontology_platform/web/frontend/src/hooks/useClaims.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useCrawl.ts b/ontology_platform/web/frontend/src/hooks/useCrawl.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useCrawl.ts rename to ontology_platform/web/frontend/src/hooks/useCrawl.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useDomains.ts b/ontology_platform/web/frontend/src/hooks/useDomains.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useDomains.ts rename to ontology_platform/web/frontend/src/hooks/useDomains.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useEntities.ts b/ontology_platform/web/frontend/src/hooks/useEntities.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useEntities.ts rename to ontology_platform/web/frontend/src/hooks/useEntities.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/usePlatform.ts b/ontology_platform/web/frontend/src/hooks/usePlatform.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/usePlatform.ts rename to ontology_platform/web/frontend/src/hooks/usePlatform.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useProjects.ts b/ontology_platform/web/frontend/src/hooks/useProjects.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useProjects.ts rename to ontology_platform/web/frontend/src/hooks/useProjects.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useResearch.ts b/ontology_platform/web/frontend/src/hooks/useResearch.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useResearch.ts rename to ontology_platform/web/frontend/src/hooks/useResearch.ts diff --git a/crawler_platform/app/web/frontend/src/hooks/useSources.ts b/ontology_platform/web/frontend/src/hooks/useSources.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/hooks/useSources.ts rename to ontology_platform/web/frontend/src/hooks/useSources.ts diff --git a/crawler_platform/app/web/frontend/src/i18n.ts b/ontology_platform/web/frontend/src/i18n.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/i18n.ts rename to ontology_platform/web/frontend/src/i18n.ts diff --git a/crawler_platform/app/web/frontend/src/legacy/api.js b/ontology_platform/web/frontend/src/legacy/api.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/api.js rename to ontology_platform/web/frontend/src/legacy/api.js diff --git a/crawler_platform/app/web/frontend/src/legacy/graph.js b/ontology_platform/web/frontend/src/legacy/graph.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/graph.js rename to ontology_platform/web/frontend/src/legacy/graph.js diff --git a/crawler_platform/app/web/frontend/src/legacy/i18n.js b/ontology_platform/web/frontend/src/legacy/i18n.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/i18n.js rename to ontology_platform/web/frontend/src/legacy/i18n.js diff --git a/crawler_platform/app/web/frontend/src/legacy/inspector.js b/ontology_platform/web/frontend/src/legacy/inspector.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/inspector.js rename to ontology_platform/web/frontend/src/legacy/inspector.js diff --git a/crawler_platform/app/web/frontend/src/legacy/main.js b/ontology_platform/web/frontend/src/legacy/main.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/main.js rename to ontology_platform/web/frontend/src/legacy/main.js diff --git a/crawler_platform/app/web/frontend/src/legacy/pipeline.js b/ontology_platform/web/frontend/src/legacy/pipeline.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/pipeline.js rename to ontology_platform/web/frontend/src/legacy/pipeline.js diff --git a/crawler_platform/app/web/frontend/src/legacy/search.js b/ontology_platform/web/frontend/src/legacy/search.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/search.js rename to ontology_platform/web/frontend/src/legacy/search.js diff --git a/crawler_platform/app/web/frontend/src/legacy/shell.js b/ontology_platform/web/frontend/src/legacy/shell.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/shell.js rename to ontology_platform/web/frontend/src/legacy/shell.js diff --git a/crawler_platform/app/web/frontend/src/legacy/sidebar.js b/ontology_platform/web/frontend/src/legacy/sidebar.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/sidebar.js rename to ontology_platform/web/frontend/src/legacy/sidebar.js diff --git a/crawler_platform/app/web/frontend/src/legacy/state.js b/ontology_platform/web/frontend/src/legacy/state.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/state.js rename to ontology_platform/web/frontend/src/legacy/state.js diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/components.css b/ontology_platform/web/frontend/src/legacy/styles/components.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/components.css rename to ontology_platform/web/frontend/src/legacy/styles/components.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/graph.css b/ontology_platform/web/frontend/src/legacy/styles/graph.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/graph.css rename to ontology_platform/web/frontend/src/legacy/styles/graph.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/index.css b/ontology_platform/web/frontend/src/legacy/styles/index.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/index.css rename to ontology_platform/web/frontend/src/legacy/styles/index.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/inspector.css b/ontology_platform/web/frontend/src/legacy/styles/inspector.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/inspector.css rename to ontology_platform/web/frontend/src/legacy/styles/inspector.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/pipeline.css b/ontology_platform/web/frontend/src/legacy/styles/pipeline.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/pipeline.css rename to ontology_platform/web/frontend/src/legacy/styles/pipeline.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/search.css b/ontology_platform/web/frontend/src/legacy/styles/search.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/search.css rename to ontology_platform/web/frontend/src/legacy/styles/search.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/shell.css b/ontology_platform/web/frontend/src/legacy/styles/shell.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/shell.css rename to ontology_platform/web/frontend/src/legacy/styles/shell.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/sidebar.css b/ontology_platform/web/frontend/src/legacy/styles/sidebar.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/sidebar.css rename to ontology_platform/web/frontend/src/legacy/styles/sidebar.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/tokens.css b/ontology_platform/web/frontend/src/legacy/styles/tokens.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/tokens.css rename to ontology_platform/web/frontend/src/legacy/styles/tokens.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/workbench.css b/ontology_platform/web/frontend/src/legacy/styles/workbench.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/workbench.css rename to ontology_platform/web/frontend/src/legacy/styles/workbench.css diff --git a/crawler_platform/app/web/frontend/src/legacy/styles/workspace.css b/ontology_platform/web/frontend/src/legacy/styles/workspace.css similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/styles/workspace.css rename to ontology_platform/web/frontend/src/legacy/styles/workspace.css diff --git a/crawler_platform/app/web/frontend/src/legacy/utils.js b/ontology_platform/web/frontend/src/legacy/utils.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/utils.js rename to ontology_platform/web/frontend/src/legacy/utils.js diff --git a/crawler_platform/app/web/frontend/src/legacy/workbench.js b/ontology_platform/web/frontend/src/legacy/workbench.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/workbench.js rename to ontology_platform/web/frontend/src/legacy/workbench.js diff --git a/crawler_platform/app/web/frontend/src/legacy/workspace.js b/ontology_platform/web/frontend/src/legacy/workspace.js similarity index 100% rename from crawler_platform/app/web/frontend/src/legacy/workspace.js rename to ontology_platform/web/frontend/src/legacy/workspace.js diff --git a/crawler_platform/app/web/frontend/src/lib/api/claims.ts b/ontology_platform/web/frontend/src/lib/api/claims.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/claims.ts rename to ontology_platform/web/frontend/src/lib/api/claims.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/client.ts b/ontology_platform/web/frontend/src/lib/api/client.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/client.ts rename to ontology_platform/web/frontend/src/lib/api/client.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/crawl.ts b/ontology_platform/web/frontend/src/lib/api/crawl.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/crawl.ts rename to ontology_platform/web/frontend/src/lib/api/crawl.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/domains.ts b/ontology_platform/web/frontend/src/lib/api/domains.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/domains.ts rename to ontology_platform/web/frontend/src/lib/api/domains.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/entities.ts b/ontology_platform/web/frontend/src/lib/api/entities.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/entities.ts rename to ontology_platform/web/frontend/src/lib/api/entities.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/index.ts b/ontology_platform/web/frontend/src/lib/api/index.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/index.ts rename to ontology_platform/web/frontend/src/lib/api/index.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/ontology.ts b/ontology_platform/web/frontend/src/lib/api/ontology.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/ontology.ts rename to ontology_platform/web/frontend/src/lib/api/ontology.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/platform.ts b/ontology_platform/web/frontend/src/lib/api/platform.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/platform.ts rename to ontology_platform/web/frontend/src/lib/api/platform.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/projects.ts b/ontology_platform/web/frontend/src/lib/api/projects.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/projects.ts rename to ontology_platform/web/frontend/src/lib/api/projects.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/research.ts b/ontology_platform/web/frontend/src/lib/api/research.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/research.ts rename to ontology_platform/web/frontend/src/lib/api/research.ts diff --git a/crawler_platform/app/web/frontend/src/lib/api/sources.ts b/ontology_platform/web/frontend/src/lib/api/sources.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/api/sources.ts rename to ontology_platform/web/frontend/src/lib/api/sources.ts diff --git a/crawler_platform/app/web/frontend/src/lib/display.ts b/ontology_platform/web/frontend/src/lib/display.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/display.ts rename to ontology_platform/web/frontend/src/lib/display.ts diff --git a/crawler_platform/app/web/frontend/src/lib/queryClient.ts b/ontology_platform/web/frontend/src/lib/queryClient.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/queryClient.ts rename to ontology_platform/web/frontend/src/lib/queryClient.ts diff --git a/crawler_platform/app/web/frontend/src/lib/utils.ts b/ontology_platform/web/frontend/src/lib/utils.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/lib/utils.ts rename to ontology_platform/web/frontend/src/lib/utils.ts diff --git a/crawler_platform/app/web/frontend/src/main.tsx b/ontology_platform/web/frontend/src/main.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/main.tsx rename to ontology_platform/web/frontend/src/main.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/BuildPipelinePage.tsx b/ontology_platform/web/frontend/src/pages/BuildPipelinePage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/BuildPipelinePage.tsx rename to ontology_platform/web/frontend/src/pages/BuildPipelinePage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/ConfigureSourcesPage.tsx b/ontology_platform/web/frontend/src/pages/ConfigureSourcesPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/ConfigureSourcesPage.tsx rename to ontology_platform/web/frontend/src/pages/ConfigureSourcesPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/CrawlPage.tsx b/ontology_platform/web/frontend/src/pages/CrawlPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/CrawlPage.tsx rename to ontology_platform/web/frontend/src/pages/CrawlPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/DashboardPage.tsx b/ontology_platform/web/frontend/src/pages/DashboardPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/DashboardPage.tsx rename to ontology_platform/web/frontend/src/pages/DashboardPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/ExportApiPage.tsx b/ontology_platform/web/frontend/src/pages/ExportApiPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/ExportApiPage.tsx rename to ontology_platform/web/frontend/src/pages/ExportApiPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/GraphViewPage.tsx b/ontology_platform/web/frontend/src/pages/GraphViewPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/GraphViewPage.tsx rename to ontology_platform/web/frontend/src/pages/GraphViewPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/OnboardingPage.tsx b/ontology_platform/web/frontend/src/pages/OnboardingPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/OnboardingPage.tsx rename to ontology_platform/web/frontend/src/pages/OnboardingPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/OntologyEditorPage.tsx b/ontology_platform/web/frontend/src/pages/OntologyEditorPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/OntologyEditorPage.tsx rename to ontology_platform/web/frontend/src/pages/OntologyEditorPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/PageAnalysisPage.tsx b/ontology_platform/web/frontend/src/pages/PageAnalysisPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/PageAnalysisPage.tsx rename to ontology_platform/web/frontend/src/pages/PageAnalysisPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/QualityInspectorPage.tsx b/ontology_platform/web/frontend/src/pages/QualityInspectorPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/QualityInspectorPage.tsx rename to ontology_platform/web/frontend/src/pages/QualityInspectorPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/ResearchPage.tsx b/ontology_platform/web/frontend/src/pages/ResearchPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/ResearchPage.tsx rename to ontology_platform/web/frontend/src/pages/ResearchPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/ReviewPage.tsx b/ontology_platform/web/frontend/src/pages/ReviewPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/ReviewPage.tsx rename to ontology_platform/web/frontend/src/pages/ReviewPage.tsx diff --git a/crawler_platform/app/web/frontend/src/pages/SchemaDesignerPage.tsx b/ontology_platform/web/frontend/src/pages/SchemaDesignerPage.tsx similarity index 100% rename from crawler_platform/app/web/frontend/src/pages/SchemaDesignerPage.tsx rename to ontology_platform/web/frontend/src/pages/SchemaDesignerPage.tsx diff --git a/crawler_platform/app/web/frontend/src/stores/index.ts b/ontology_platform/web/frontend/src/stores/index.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/stores/index.ts rename to ontology_platform/web/frontend/src/stores/index.ts diff --git a/crawler_platform/app/web/frontend/src/stores/slices/crawlSlice.ts b/ontology_platform/web/frontend/src/stores/slices/crawlSlice.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/stores/slices/crawlSlice.ts rename to ontology_platform/web/frontend/src/stores/slices/crawlSlice.ts diff --git a/crawler_platform/app/web/frontend/src/stores/slices/ontologySlice.ts b/ontology_platform/web/frontend/src/stores/slices/ontologySlice.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/stores/slices/ontologySlice.ts rename to ontology_platform/web/frontend/src/stores/slices/ontologySlice.ts diff --git a/crawler_platform/app/web/frontend/src/stores/slices/uiSlice.ts b/ontology_platform/web/frontend/src/stores/slices/uiSlice.ts similarity index 100% rename from crawler_platform/app/web/frontend/src/stores/slices/uiSlice.ts rename to ontology_platform/web/frontend/src/stores/slices/uiSlice.ts diff --git a/crawler_platform/app/web/frontend/src/styles/globals.css b/ontology_platform/web/frontend/src/styles/globals.css similarity index 100% rename from crawler_platform/app/web/frontend/src/styles/globals.css rename to ontology_platform/web/frontend/src/styles/globals.css diff --git a/crawler_platform/app/web/frontend/tailwind.config.js b/ontology_platform/web/frontend/tailwind.config.js similarity index 100% rename from crawler_platform/app/web/frontend/tailwind.config.js rename to ontology_platform/web/frontend/tailwind.config.js diff --git a/crawler_platform/app/web/frontend/tsconfig.json b/ontology_platform/web/frontend/tsconfig.json similarity index 100% rename from crawler_platform/app/web/frontend/tsconfig.json rename to ontology_platform/web/frontend/tsconfig.json diff --git a/crawler_platform/app/web/frontend/tsconfig.node.json b/ontology_platform/web/frontend/tsconfig.node.json similarity index 100% rename from crawler_platform/app/web/frontend/tsconfig.node.json rename to ontology_platform/web/frontend/tsconfig.node.json diff --git a/crawler_platform/app/web/frontend/vite.config.js b/ontology_platform/web/frontend/vite.config.js similarity index 89% rename from crawler_platform/app/web/frontend/vite.config.js rename to ontology_platform/web/frontend/vite.config.js index 307b989..37b89e1 100644 --- a/crawler_platform/app/web/frontend/vite.config.js +++ b/ontology_platform/web/frontend/vite.config.js @@ -2,7 +2,7 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import path from "node:path"; -const BACKEND = "http://127.0.0.1:8000"; +const BACKEND = "http://127.0.0.1:8001"; const PROXY_PREFIXES = [ "/projects", "/ontology", @@ -17,6 +17,9 @@ const PROXY_PREFIXES = [ "/claims", "/entities", "/health", + "/info", + "/process", + "/api/v1", "/api/v1/graph", "/api/v1/llm", ]; @@ -37,7 +40,7 @@ export default defineConfig({ sourcemap: true, }, server: { - port: 5173, + port: 8000, strictPort: true, proxy: Object.fromEntries( PROXY_PREFIXES.map((prefix) => [prefix, { target: BACKEND, changeOrigin: false }]), diff --git a/restart_all_servers.bat b/restart_all_servers.bat index 9f2925f..4df51c0 100644 --- a/restart_all_servers.bat +++ b/restart_all_servers.bat @@ -75,7 +75,7 @@ function Stop-ExistingServers { $currentPid = $PID $rootPattern = [regex]::Escape($root) - $commandPattern = "uvicorn|crawler_platform\.app\.main|ont_platform\.api|phase[0-9]_app|vite|npm(\.cmd)?\s+run\s+(dev|preview|start)" + $commandPattern = "uvicorn|ont_platform\.api|phase[0-9]_app|vite|npm(\.cmd)?\s+run\s+(dev|preview|start)" $matched = Get-CimInstance Win32_Process | Where-Object { if (-not $_.CommandLine) { @@ -87,7 +87,7 @@ function Stop-ExistingServers { $cmd = $_.CommandLine return ($cmd -match $commandPattern) -and ( $cmd -match $rootPattern -or - $cmd -match "crawler_platform|ontology_platform|ont_platform" + $cmd -match "ontology_platform|ont_platform" ) } @@ -234,38 +234,20 @@ Stop-ExistingServers Start-Neo4jIfAvailable $npm = Get-CommandPath @("npm.cmd", "npm") -$frontendDir = Join-Path $root "crawler_platform\app\web\frontend" +$frontendDir = Join-Path $root "ontology_platform\web\frontend" +$frontendReady = $false if ((Test-Path -LiteralPath (Join-Path $frontendDir "package.json")) -and $npm) { if (-not (Test-Path -LiteralPath (Join-Path $frontendDir "node_modules"))) { Invoke-LoggedCommand -FilePath $npm -Arguments @("ci") -WorkingDirectory $frontendDir -LogName "frontend-npm-ci.log" } Invoke-LoggedCommand -FilePath $npm -Arguments @("run", "build") -WorkingDirectory $frontendDir -LogName "frontend-build.log" + $frontendReady = $true } elseif (Test-Path -LiteralPath (Join-Path $frontendDir "package.json")) { Write-Step "npm was not found; skipping frontend rebuild." } $servers = @() -$crawlerPython = Get-CommandPath @( - (Join-Path $root ".venv\Scripts\python.exe"), - (Join-Path $root "venv\Scripts\python.exe"), - "C:\Users\lasta\AppData\Local\Python\bin\python.exe", - "C:\Users\lasta\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe", - "python" -) - -if ((Test-Path -LiteralPath (Join-Path $root "crawler_platform\app\main.py")) -and $crawlerPython) { - $servers += Start-LoggedServer ` - -Name "crawler-platform-8000" ` - -Port 8000 ` - -FilePath $crawlerPython ` - -Arguments @("-m", "uvicorn", "crawler_platform.app.main:app", "--host", "127.0.0.1", "--port", "8000") ` - -WorkingDirectory $root ` - -Environment @{ CRAWLER_DATABASE_URL = "sqlite:///crawler_platform.db" } -} else { - Write-Step "crawler_platform server entrypoint or Python was not found; skipped." -} - $ontologyRoot = Join-Path $root "ontology_platform" $ontologyPython = Get-CommandPath @( (Join-Path $ontologyRoot ".venv\Scripts\python.exe"), @@ -292,6 +274,15 @@ if ((Test-Path -LiteralPath (Join-Path $ontologyRoot "ont_platform\api\main.py") Write-Step "ontology_platform server entrypoint or Python was not found; skipped." } +if ($frontendReady) { + $servers += Start-LoggedServer ` + -Name "ontology-frontend-8000" ` + -Port 8000 ` + -FilePath $npm ` + -Arguments @("run", "dev", "--", "--host", "127.0.0.1", "--port", "8000") ` + -WorkingDirectory $frontendDir +} + $pidFile = Join-Path $logDir "server-pids.txt" $servers | ForEach-Object { "{0} pid={1} stdout={2} stderr={3}" -f $_.Name, $_.Pid, $_.Stdout, $_.Stderr @@ -313,7 +304,6 @@ if ($missingPorts.Count -gt 0) { Write-Host "" Write-Step "Done." -Write-Host " Crawler UI/API: http://127.0.0.1:8000/static/" -Write-Host " Crawler crawl page: http://127.0.0.1:8000/static/crawl/PerfumeSubscribe_new" +Write-Host " Ontology UI: http://127.0.0.1:8000/static/" Write-Host " Ontology API: http://127.0.0.1:8001/docs" Write-Host " Logs: $logDir" diff --git a/shutdown_all_servers.bat b/shutdown_all_servers.bat new file mode 100644 index 0000000..129e9cd --- /dev/null +++ b/shutdown_all_servers.bat @@ -0,0 +1,67 @@ +@echo off +setlocal + +set "AI_SHUTDOWN_ROOT=%~dp0" + +powershell -NoProfile -ExecutionPolicy Bypass -Command "$p='%~f0'; $s=Get-Content -LiteralPath $p -Raw; $m=':ps1'; $i=$s.LastIndexOf($m); if ($i -lt 0) { throw 'PowerShell payload marker not found.' }; Invoke-Expression $s.Substring($i + $m.Length)" +set "EXIT_CODE=%ERRORLEVEL%" + +if "%~1"=="--no-pause" exit /b %EXIT_CODE% +echo. +if not "%EXIT_CODE%"=="0" echo [servers] Shutdown failed with exit code %EXIT_CODE%. +pause +exit /b %EXIT_CODE% + +:ps1 +$ErrorActionPreference = "Stop" + +$root = (Resolve-Path -LiteralPath $env:AI_SHUTDOWN_ROOT).Path +$ports = @(8000, 8001, 8002, 8003, 5173, 5174) + +function Write-Step { + param([string] $Message) + Write-Host "[servers] $Message" +} + +Write-Step "Stopping project server processes." + +$currentPid = $PID +$rootPattern = [regex]::Escape($root) +$commandPattern = "uvicorn|ont_platform\.api|crawler_platform\.app\.main|phase[0-9]_app|vite|npm(\.cmd)?\s+run\s+(dev|preview|start)" + +$matched = Get-CimInstance Win32_Process | Where-Object { + if (-not $_.CommandLine) { + return $false + } + if ($_.ProcessId -eq $currentPid) { + return $false + } + $cmd = $_.CommandLine + return ($cmd -match $commandPattern) -and ( + $cmd -match $rootPattern -or + $cmd -match "ontology_platform|ont_platform|crawler_platform" + ) +} + +foreach ($proc in $matched) { + Write-Step ("Killing process {0} ({1})" -f $proc.ProcessId, $proc.Name) + Stop-Process -Id $proc.ProcessId -Force -ErrorAction SilentlyContinue +} + +$listeners = Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | + Where-Object { $ports -contains $_.LocalPort } | + Select-Object -ExpandProperty OwningProcess -Unique + +foreach ($pidToStop in $listeners) { + if ($pidToStop -and $pidToStop -ne $currentPid) { + Write-Step ("Killing listener on configured dev port, pid {0}" -f $pidToStop) + Stop-Process -Id $pidToStop -Force -ErrorAction SilentlyContinue + } +} + +$pidFile = Join-Path $root ".server-logs\server-pids.txt" +if (Test-Path -LiteralPath $pidFile) { + Remove-Item -LiteralPath $pidFile -Force -ErrorAction SilentlyContinue +} + +Write-Step "Done."