codemble 0.5.0__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codemble-0.5.0 → codemble-0.5.2}/CHANGELOG.md +33 -0
- {codemble-0.5.0 → codemble-0.5.2}/PKG-INFO +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/codemble/__init__.py +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/parse_progress.py +6 -2
- {codemble-0.5.0 → codemble-0.5.2}/codemble/server/parse_job.py +5 -0
- codemble-0.5.0/codemble/web_dist/assets/index-BlkEA_-c.js → codemble-0.5.2/codemble/web_dist/assets/index-DTjcBtZj.js +1 -1
- codemble-0.5.0/codemble/web_dist/assets/index-xOQxhaMB.css → codemble-0.5.2/codemble/web_dist/assets/index-Dbk76SAB.css +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/index.html +2 -2
- codemble-0.5.2/docs/releases/v0.5.1.md +38 -0
- codemble-0.5.2/docs/releases/v0.5.2.md +49 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/package.json +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/pyproject.toml +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_parse_job.py +33 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/package-lock.json +2 -2
- {codemble-0.5.0 → codemble-0.5.2}/web/package.json +1 -1
- {codemble-0.5.0 → codemble-0.5.2}/web/scripts/check_learner_session.mjs +222 -1
- {codemble-0.5.0 → codemble-0.5.2}/web/src/App.jsx +43 -6
- {codemble-0.5.0 → codemble-0.5.2}/web/src/MapView.jsx +16 -2
- {codemble-0.5.0 → codemble-0.5.2}/web/src/learnerSession.js +72 -9
- {codemble-0.5.0 → codemble-0.5.2}/web/src/styles.css +18 -0
- {codemble-0.5.0 → codemble-0.5.2}/.env.example +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.gitattributes +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/ISSUE_TEMPLATE/early_tester.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/dependabot.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/workflows/ci.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/workflows/pages.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.github/workflows/publish-pypi.yml +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/.gitignore +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/AGENTS.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/CLAUDE.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/CODE_OF_CONDUCT.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/CONTRIBUTING.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/LICENSE +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/NOTICE +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/README.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/SECURITY.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/TESTING.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/assets/demo.gif +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/base.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/discovery.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/project.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/python_ast.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/adapters/typescript_tree_sitter.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/checks/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/checks/service.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/cli.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/graph/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/graph/finalize.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/graph/layout.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/graph/mapview.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/lens/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/lens/javascript_typescript.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/lens/python.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/llm/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/llm/local_status.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/llm/providers.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/llm/structural.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/llm/study.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/paths.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/progress/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/progress/store.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/server/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/server/app.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/server/runtime.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/shippori-mincho-latin-500-normal-C-QwvIb3.woff +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/shippori-mincho-latin-500-normal-XI1O8euf.woff2 +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/shippori-mincho-latin-700-normal-CkoCYOiI.woff +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/shippori-mincho-latin-700-normal-DHcmzUO5.woff2 +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/zen-kaku-gothic-new-latin-400-normal-BEdayliK.woff2 +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/codemble/web_dist/assets/zen-kaku-gothic-new-latin-400-normal-CPSmNJAU.woff +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/adr/README.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/2026-07-19-audience-modes-and-local-narration-design.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/2026-07-19-audience-modes-backend-plan.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/2026-07-19-audience-modes-frontend-plan.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/2026-07-19-install-ux-folder-picker-design.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/2026-07-19-install-ux-folder-picker-plan.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/README.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/plans/phase-1.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/releases/checklist.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/releases/v0.1.0.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/releases/v0.2.0.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/releases/v0.4.0.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/releases/v0.5.0.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/research/README.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/superpowers/plans/2026-07-19-galaxy-ux-phase-a.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/superpowers/plans/2026-07-19-galaxy-ux-phase-b.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/superpowers/plans/2026-07-19-galaxy-ux-phase-c.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/superpowers/plans/2026-07-19-galaxy-ux-shared-contract.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs/superpowers/specs/2026-07-19-galaxy-ux-overhaul-design.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/.gitignore +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/astro.config.mjs +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/design.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/favicon-16.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/favicon-32.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icon-180.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icon-192.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icon-512.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icon.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icons/asterism.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/icons/install.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/mark-animated.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/mark.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/hero-chart.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/hero-field.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/hero-gold.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/kasumi-rule.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/plate-galaxy.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/plate-study.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/plate-system.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/brand/plates/seal.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/favicon.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/easy-mode.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/galaxy-lit.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/galaxy.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/loading.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/map-architecture.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/map-workflow.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/study-panel.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/public/shots/system.png +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/scripts/build-plates.mjs +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/assets/codemble-mark-dark.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/assets/codemble-mark-light.svg +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/components/Search.astro +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/components/Tatebanko.astro +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/architecture.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/build-from-source.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/checks-and-lighting.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/contributing.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/correctness.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/early-testing.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/installation.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/introduction.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m1-parser.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m10-polyglot-release.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m12-galaxy-look.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m13-scale.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m2-galaxy.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m3-study.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m4-lens.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m5-checks.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m6-release.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m8-typescript.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/progress/m9-typescript-lens.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/quickstart.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/roadmap.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/star-chart.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/study-panel.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content/docs/the-galaxy.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/content.config.ts +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/pages/index.astro +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/styles/custom.css +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/styles/landing.css +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/docs-site/src/styles/tokens.css +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/scripts/dev.sh +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/scripts/record_demo.sh +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/conftest.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/check_suites.json +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/concepts_sample.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/impact/alpha.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/impact/beta.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/impact/gamma.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/impact/helpers.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/impact/noisy.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/python_worker.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/broken.ts +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/legacy.js +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/local.js +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/main.ts +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/reexport.ts +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/util.ts +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/polyglot/src/widget.tsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/repeated_calls.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/.gitignore +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/ambiguous.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/api.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/app.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/broken.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/cli.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/pkg/__init__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/pkg/helpers.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/pkg/service.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/pkg/util.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/runner/__main__.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/fixtures/sampleproj/shared.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_checks.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_graph_finalization.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_mapview.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_parse_progress.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_progress.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_project_parser.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_providers.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_python_ast.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_server.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_smoke.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_structural.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_study.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/tests/test_typescript_tree_sitter.py +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/README.md +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/index.html +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/scripts/check_graph_data.mjs +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/scripts/record_demo.mjs +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/GalaxyCanvas.jsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/GuidanceLayer.jsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/ModeControl.jsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/StudyPanel.jsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/galaxyEffects.js +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/galaxyMaterials.js +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/graphData.js +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/main.jsx +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/src/tokens.css +0 -0
- {codemble-0.5.0 → codemble-0.5.2}/web/vite.config.js +0 -0
|
@@ -5,6 +5,39 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) · Versioning:
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.5.2] - 2026-07-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- "Cancel and pick another project" now works when the local server has stopped.
|
|
12
|
+
The teardown that returns you to the picker used to run only after the reset
|
|
13
|
+
request came back, so when that request could not reach the server at all, the
|
|
14
|
+
loading screen never released you — the one escape hatch depended on the very
|
|
15
|
+
server it was escaping. A reset the server *refuses* still stays put and
|
|
16
|
+
reports inline, because the project is genuinely still bound there.
|
|
17
|
+
- The loading screen stops over-reassuring during a long outage. A brief failed
|
|
18
|
+
poll still says the parse may be running fine; after eight consecutive
|
|
19
|
+
failures (~18 seconds of no answer) it says instead that the local server has
|
|
20
|
+
not responded and may have stopped, and points at cancelling and running
|
|
21
|
+
`codemble` again. It keeps retrying either way.
|
|
22
|
+
- A load failure with no server on the other end now names the local server and
|
|
23
|
+
what to do about it, instead of showing the browser's bare "Failed to fetch".
|
|
24
|
+
|
|
25
|
+
## [0.5.1] - 2026-07-20
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- Cancelling a parse (returning to the picker) now stops the `resolving` stage
|
|
29
|
+
too, not only the file-reading loop. Resolving is the slowest stage on a large
|
|
30
|
+
project and only reported sub-steps, so a cancel there left a worker burning
|
|
31
|
+
CPU to completion — and a second selection could run two parses at once. Each
|
|
32
|
+
resolving sub-step is now a cancellation checkpoint, matching the per-file one.
|
|
33
|
+
- Clicking a module box on the 2D Map now visibly highlights it (in the
|
|
34
|
+
interaction accent, never the amber that means "understood"), so a click on
|
|
35
|
+
the Easy-default layer no longer looks like it did nothing. The system-level
|
|
36
|
+
copy on the Map now says plainly that a module's internal structures are drawn
|
|
37
|
+
as planets in the Galaxy layer and that the Map shows how modules connect, not
|
|
38
|
+
what is inside them — it no longer points at the Workflow tab, which has no
|
|
39
|
+
rows for a module the program never reaches.
|
|
40
|
+
|
|
8
41
|
## [0.5.0] - 2026-07-20
|
|
9
42
|
|
|
10
43
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codemble
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: A learning game that turns the code AI wrote for you into a galaxy you light up by understanding it.
|
|
5
5
|
Project-URL: Homepage, https://udhawan97.github.io/Codemble/
|
|
6
6
|
Project-URL: Repository, https://github.com/udhawan97/Codemble
|
|
@@ -40,8 +40,12 @@ class ParseProgress(Protocol):
|
|
|
40
40
|
|
|
41
41
|
The ``resolving`` stage is one label over several seconds of cross-file
|
|
42
42
|
work; a sub-step keeps the screen honestly changing instead of frozen.
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
An implementation MAY treat a detail boundary as a cancellation
|
|
44
|
+
checkpoint and raise ``ParseCancelled`` — the ``resolving`` stage calls
|
|
45
|
+
no ``file_parsed`` and would otherwise run to completion after a cancel.
|
|
46
|
+
The picker's ``ParseJob`` does; the CLI's ``TerminalProgress`` does not,
|
|
47
|
+
because that parse is not cancellable. A reporter that ignores it loses
|
|
48
|
+
nothing but the finer copy.
|
|
45
49
|
"""
|
|
46
50
|
|
|
47
51
|
|
|
@@ -127,6 +127,11 @@ class ParseJob:
|
|
|
127
127
|
self._stage = stage
|
|
128
128
|
|
|
129
129
|
def detail(self, detail: str) -> None:
|
|
130
|
+
# The resolving stage only ever calls detail(), so it is the sole
|
|
131
|
+
# cancellation checkpoint there — symmetric with file_parsed(). A cancel
|
|
132
|
+
# is noticed at the next sub-step boundary instead of at the very end.
|
|
133
|
+
if self._cancelled.is_set():
|
|
134
|
+
raise ParseCancelled("the learner reset the picker during this parse")
|
|
130
135
|
with self._lock:
|
|
131
136
|
self._detail = detail
|
|
132
137
|
|
|
@@ -5349,4 +5349,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
5349
5349
|
float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
|
|
5350
5350
|
gl_FragColor = vec4( bloom, bloomAlpha );
|
|
5351
5351
|
|
|
5352
|
-
}`})}};UW.BlurDirectionX=new L(1,0),UW.BlurDirectionY=new L(0,1);var WW=.9,GW=.45,KW=.52,qW=1600;function JW(e){let t=e.postProcessingComposer(),n=new UW(new L(t._width??1,t._height??1),WW,GW,KW),r=n.setSize.bind(n);n.setSize=(e,t)=>{let n=Math.min(1,qW/Math.max(e,t,1));r(Math.max(1,Math.round(e*n)),Math.max(1,Math.round(t*n)))},t.addPass(n);let i=new Ez(xz);return t.addPass(i),{pass:n,composer:t,dispose(){t.removePass(i),i.dispose(),t.removePass(n),n.dispose()}}}var YW=1200;function XW(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function ZW({scene:e,regionId:t,palette:n}){if(XW())return()=>{};let r=e.getObjectByName(`codemble-system-${t}`);if(!r)return()=>{};let i=[];r.traverse(e=>{e.isSprite&&i.push([e,e.material.opacity,e.scale.x])});let a=new B(n.star),o=i.map(([e])=>e.material.color.clone()),s=0,c=performance.now(),l=()=>{let e=Math.min(1,(performance.now()-c)/YW);1-(1-e)**3;let t=Math.sin(e*Math.PI);if(i.forEach(([e,n,r],i)=>{e.material.color.copy(o[i]).lerp(a,t*.85),e.material.opacity=n+t*.5,e.scale.setScalar(r*(1+t*.45))}),e<1){s=requestAnimationFrame(l);return}i.forEach(([e,t,n],r)=>{e.material.color.copy(o[r]),e.material.opacity=t,e.scale.setScalar(n)})};return s=requestAnimationFrame(l),()=>{cancelAnimationFrame(s),i.forEach(([e,t,n],r)=>{e.material.color.copy(o[r]),e.material.opacity=t,e.scale.setScalar(n)})}}var QW=128,$W=256;function eG(e,t){let n=document.createElement(`canvas`);n.width=e,n.height=e;let r=n.getContext(`2d`),i=r.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);for(let[e,n]of t)i.addColorStop(e,`rgba(255, 255, 255, ${n})`);r.fillStyle=i,r.fillRect(0,0,e,e);let a=new Ra(n);return a.colorSpace=lt,a}function tG(e){let t=document.createElement(`canvas`);t.width=e,t.height=e;let n=t.getContext(`2d`);n.strokeStyle=`rgba(255, 255, 255, 1)`,n.lineWidth=e*.05,n.beginPath(),n.arc(e/2,e/2,e*.4,0,Math.PI*2),n.stroke();let r=new Ra(t);return r.colorSpace=lt,r}function nG(e){let t=[];function n(e){let n=e.dispose.bind(e);return e.dispose=()=>{},t.push(n),e}let r=n(eG(QW,[[0,.85],[.25,.42],[.6,.1],[1,0]])),i=n(eG($W,[[0,.32],[.45,.14],[.8,.03],[1,0]])),a=n(tG(QW)),o=new Map,s=new Map;function c(t){return o.has(t)||o.set(t,n(new Si({map:r,color:new B(t).multiply(new B(e.starHalo)),blending:2,transparent:!0,depthWrite:!1,opacity:.6}))),o.get(t)}return{halo(e,t){let n=new Ii(c(e.color));return n.scale.setScalar(t*6.5),n.renderOrder=-1,n},nebula(e,t){s.has(e)||s.set(e,n(new Si({map:i,color:new B(e),blending:2,transparent:!0,depthWrite:!1,opacity:.16})));let r=new Ii(s.get(e));return r.scale.setScalar(t),r.renderOrder=-2,r},reticle(t){let n=new Ii(new Si({map:a,color:new B(e.orbit),transparent:!0,depthWrite:!1,depthTest:!1}));return n.scale.setScalar(t*5),n.renderOrder=3,n},dispose(){for(let e of t)e();t.length=0,o.clear(),s.clear()}}}function rG(e){return Object.entries(e??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}:${t}`).join(`|`)}function iG(e){let t=e>>>0;return function(){t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function aG(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function oG(e,t,n=1400,r=1600){let i=iG(aG(e)),a=new Float32Array(n*3);for(let e=0;e<n;e+=1){let t=i()*Math.PI*2,n=Math.acos(2*i()-1),o=r*(.65+i()*.35);a[e*3]=o*Math.sin(n)*Math.cos(t),a[e*3+1]=o*Math.cos(n),a[e*3+2]=o*Math.sin(n)*Math.sin(t)}let o=new gi;o.setAttribute(`position`,new ei(a,3));let s=new Pa(o,new ka({color:new B(t.nodeDim),size:2.2,sizeAttenuation:!0,transparent:!0,opacity:.5,depthWrite:!1}));return s.name=`codemble-starfield`,s}var sG=Object.freeze({GALAXY:`GALAXY`,SYSTEM:`SYSTEM`,STUDY:`STUDY`});function cG(e,t){if(!t||t===`all`)return e;let n=e.nodes.filter(e=>e.language===t),r=new Set(n.map(e=>e.id)),i=new Set(e.nodes.map(e=>e.id)),a=new Set(n.map(e=>e.region)),o=new Set(n.map(e=>e.file));return{...e,nodes:n,edges:e.edges.filter(e=>r.has(e.src)&&(r.has(e.dst)||e.external||!i.has(e.dst))),entrypoint_candidates:e.entrypoint_candidates.filter(e=>r.has(e)),selected_entrypoint:r.has(e.selected_entrypoint)?e.selected_entrypoint:null,file_hashes:Object.fromEntries(Object.entries(e.file_hashes).filter(([e])=>o.has(e))),concept_annotations:e.concept_annotations.filter(e=>e.language===t&&r.has(e.node_id)),regions:e.regions.filter(e=>a.has(e.id)),region_edges:e.region_edges.filter(e=>a.has(e.src)&&a.has(e.dst)),partial_files:e.partial_files.filter(e=>o.has(e))}}function lG(e,t){if(!e||!t||t===`all`)return e;let n=e.architecture,r=n.boxes.filter(e=>e.language===t),i=new Set(r.map(e=>e.id)),a=e.workflow,o=`${t}:`;return{...e,architecture:{...n,boxes:r,edges:n.edges.filter(e=>i.has(e.src)&&i.has(e.dst)),unreachable:n.unreachable.filter(e=>i.has(e))},workflow:{...a,nodes:a.nodes.filter(e=>e.language===t),unreachable:a.unreachable.filter(e=>e.startsWith(o))}}}function uG(e){let t=new Map;for(let n of e.regions)t.set(n.language,(t.get(n.language)??0)+1);let n=[...t].map(([e,t])=>({id:e,label:pG(e),shortLabel:mG(e),count:t})).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`all`,label:`All languages`,shortLabel:`All`,count:e.regions.length},...n]}function dG(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map;for(let i of e.concept_annotations??[]){let e=`${i.language}:${i.concept}`,a=r.get(e)??{language:i.language,concept:i.concept,occurrences:0,nodeIds:new Set,studiedNodeIds:new Set,understoodNodeIds:new Set};a.occurrences+=1,a.nodeIds.add(i.node_id),t.has(i.node_id)&&a.studiedNodeIds.add(i.node_id),n.get(i.node_id)?.understood&&a.understoodNodeIds.add(i.node_id),r.set(e,a)}return[...r.values()].map(e=>({language:e.language,concept:e.concept,occurrences:e.occurrences,nodes:e.nodeIds.size,studied_nodes:e.studiedNodeIds.size,understood_nodes:e.understoodNodeIds.size})).sort((e,t)=>e.language.localeCompare(t.language)||e.concept.localeCompare(t.concept))}function fG(e){let t={javascript:`JavaScript`,jsx:`JSX`,typescript:`TypeScript`};return t[e]?t[e]:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function pG(e){return fG(e)}function mG(e){return e===`javascript`?`JS`:e===`typescript`?`TS`:pG(e)}function hG(e){return e===`python`?`nebPython`:e===`javascript`?`nebJs`:e===`typescript`?`nebTs`:null}var gG=5,_G=2;function vG(e,t){return{nodes:e.regions.map(n=>({...n,kind:`region`,name:n.id,fx:n.x,fy:n.y,fz:n.z,val:CG(n.loc,5,24),color:n.understood?t.star:e.nodes.some(e=>e.region===n.id&&e.partial)?t.routePossible:wG(n.centrality,t,gG),focusDim:!1})),links:e.region_edges.map(e=>({...e,source:e.src,target:e.dst,color:e.certain?t.route:t.routePossible,focusDim:!1}))}}function yG(e,t,n,{selectedId:r=null}={}){let i=e.nodes.filter(e=>e.region===t),a=new Set(i.map(e=>e.id)),o=e.edges.filter(e=>e.kind===`call`&&!e.external&&a.has(e.src)&&a.has(e.dst)),s=new Set(r?[r]:[]);if(r)for(let e of o)e.src===r&&s.add(e.dst),e.dst===r&&s.add(e.src);return{nodes:i.map(e=>({...e,fx:e.system_x,fy:e.system_y,fz:e.system_z,val:CG(e.loc,2.8,11),color:e.understood?n.star:e.partial?n.routePossible:wG(e.centrality,n,_G),selected:e.id===r,focusDim:!!r&&!s.has(e.id)})),links:o.map(e=>({...e,source:e.src,target:e.dst,color:e.certain?n.route:n.routePossible,focusDim:!!r&&e.src!==r&&e.dst!==r}))}}function bG(e){return e.regions.find(e=>e.home)??e.regions[0]??null}function xG(e){let t=e.kind===`region`?`star system`:e.kind,n=e.partial?` · unchartable · syntax error`:``,r=e.home?` · Home`:``;return`${e.name} · ${t} · ${e.loc} LOC${r}${n}`}function SG(e){let t=e.kind===`import`?`import`:e.kind===`call`?`call`:`import route`,n=e.certain?`certain`:t===`call`?`possible call`:`possible import`,r=typeof e.weight==`number`?` · ${e.weight} ${e.weight===1?`import`:`imports`}`:``,i=typeof e.lineno==`number`?` · line ${e.lineno}`:``;return`${e.src} → ${e.dst} · ${t} · ${n}${r}${i}`}function CG(e,t,n){return Math.min(n,Math.max(t,Math.sqrt(Math.max(1,e))*1.15))}function wG(e,t,n){return e>=n?t.nodeBright:e>=1?t.node:t.nodeDim}var TG=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=TG()}))(),EG=420,DG=1.6,OG=6;function kG({graph:e,level:t,region:n,selectedNode:r,hoverNodeId:i,pendingDawnRegionId:a,mode:o,onHoverNode:s,onAdvance:c,onRetreat:l,onDawnConsumed:u}){let d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(c),m=(0,_.useRef)(l),h=(0,_.useRef)(s),g=(0,_.useRef)(a),v=(0,_.useRef)(u),y=(0,_.useRef)(null),b=(0,_.useRef)({activeId:null,neighborIds:new Set}),x=(0,_.useRef)(0),S=(0,_.useRef)(null),C=(0,_.useRef)(null),w=(0,_.useRef)(null),[T,E]=(0,_.useState)(0),[D,O]=(0,_.useState)(``),k=(0,_.useMemo)(NG,[]),A=(0,_.useMemo)(XW,[]),ee=rG(e.file_hashes),te=(0,_.useMemo)(()=>t===sG.GALAXY?vG(e,k):yG(e,n?.id,k,{selectedId:r?.id}),[e,t,k,n?.id,r?.id]);(0,_.useEffect)(()=>{p.current=c,m.current=l,h.current=s,g.current=a,v.current=u},[c,l,s,a,u]);function ne(e){let{activeId:t,neighborIds:n}=b.current;return t?e.id===t?k.orbit:n.has(e.id)?e.color:k.faded:e.color}function re(e){if(e.focusDim)return k.faded;let{activeId:t,neighborIds:n}=b.current,r=e.certain?k.route:k.routePossible;if(!t)return r;let i=jG(e.source),a=jG(e.target);return i===t||a===t?k.orbit:n.has(i)&&n.has(a)?r:k.faded}function ie(e){if(e.focusDim)return .4;let{activeId:t}=b.current,n=Math.min(2.2,.45+(e.weight??1)*.25);if(!t)return n;let r=jG(e.source),i=jG(e.target);return r===t||i===t?n+.9:n}(0,_.useEffect)(()=>{let e=d.current;if(!e)return;let t=document.createElement(`canvas`);if(!t.getContext(`webgl2`)&&!t.getContext(`webgl`)){O(`Codemble needs WebGL to draw your galaxy. Enable WebGL and reload.`);return}try{let t=nG(k);S.current=t;let n=BW()(e).backgroundColor(k.ground).showNavInfo(!1).enableNavigationControls(!1).warmupTicks(0).cooldownTicks(0).nodeId(`id`).nodeLabel(xG).nodeVal(`val`).nodeColor(ne).nodeRelSize(DG).nodeResolution(8).nodeOpacity(.82).nodeThreeObject(e=>AG(e,k,t,w.current)).nodeThreeObjectExtend(!0).linkColor(re).linkLabel(SG).linkOpacity(.32).linkWidth(ie).linkCurvature(.12).linkVisibility(e=>!(o===`easy`&&e.focusDim)).linkHoverPrecision(4).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(re).linkDirectionalParticles(e=>e.kind===`call`&&e.certain&&!e.focusDim&&!A?2:0).linkDirectionalParticleSpeed(.006).linkDirectionalParticleWidth(1.1).linkDirectionalParticleColor(()=>k.orbit).onNodeHover(t=>{e.style.cursor=t?`pointer`:`default`,h.current(t?.id??null)}).onNodeClick(e=>p.current(e)),r=requestAnimationFrame(()=>{e.querySelector(`.scene-nav-info`)?.remove()});C.current=JW(n),f.current=n;let i=new ResizeObserver(([e])=>{n.width(e.contentRect.width).height(e.contentRect.height)});return i.observe(e),()=>{i.disconnect(),cancelAnimationFrame(r),n.pauseAnimation(),C.current?.dispose(),C.current=null,n._destructor(),t.dispose(),S.current=null,e.replaceChildren(),f.current=null}}catch(e){O(`The galaxy could not start: ${e.message}`);return}},[k]),(0,_.useEffect)(()=>{let e=f.current;e&&(e.nodeResolution(te.nodes.length>=900?4:8).linkVisibility(e=>!(o===`easy`&&e.focusDim)).linkDirectionalArrowLength(t===sG.GALAXY?0:3.2).graphData(te),t===sG.GALAXY?e.cameraPosition({x:0,y:105,z:310},{x:0,y:0,z:0},EG):e.cameraPosition({x:0,y:52,z:150},{x:0,y:0,z:0},EG),E(0))},[te,t,o]),(0,_.useEffect)(()=>{w.current=te.nodes[T]?.id??null,f.current?.refresh()},[te.nodes,T]),(0,_.useEffect)(()=>{let e=f.current;if(!e)return;let t=e.scene(),n=t.getObjectByName(`codemble-starfield`);n&&(t.remove(n),n.geometry.dispose(),n.material.dispose());let r=oG(ee,k);return t.add(r),()=>{t.remove(r),r.geometry.dispose(),r.material.dispose()}},[ee,k]),(0,_.useEffect)(()=>{let e=f.current;if(!e||t!==sG.GALAXY)return;let n=g.current;if(!n||y.current===n)return;y.current=n,v.current?.(n);let r=!1,i=()=>{},a=t=>{if(r)return;let s=e.scene();if(s.getObjectByName(`codemble-system-${n}`)||t>=OG){i=ZW({scene:s,regionId:n,palette:k});return}o=requestAnimationFrame(()=>a(t+1))},o=requestAnimationFrame(()=>a(0));return()=>{r=!0,cancelAnimationFrame(o),i()}},[t,k]),(0,_.useEffect)(()=>{let e=i??(t===sG.STUDY?r?.id??null:null),n=new Set;if(e)for(let t of te.links){let r=jG(t.source),i=jG(t.target);r===e&&n.add(i),i===e&&n.add(r)}b.current={activeId:e,neighborIds:n};let a=f.current;a&&a.nodeColor(a.nodeColor()).linkColor(a.linkColor()).linkWidth(a.linkWidth()).linkDirectionalArrowColor(a.linkDirectionalArrowColor())},[te,i,t,r?.id]),(0,_.useEffect)(()=>{if(!new URLSearchParams(window.location.search).has(`benchmark`)||te.nodes.length<900)return;document.documentElement.removeAttribute(`data-codemble-fps`);let e=setTimeout(()=>{let e=f.current;if(!e)return;let t=e.renderer(),n=e.postProcessingComposer(),r=performance.now();for(let e=0;e<60;e+=1)n.render();t.getContext().finish();let i=performance.now()-r;document.documentElement.dataset.codembleFps=(60*1e3/i).toFixed(1)},1e3);return()=>clearTimeout(e)},[te.nodes.length]),(0,_.useEffect)(()=>{!r||!f.current||t!==sG.STUDY||f.current.cameraPosition({x:r.system_x+20,y:r.system_y+15,z:r.system_z+42},{x:r.system_x,y:r.system_y,z:r.system_z},EG)},[t,r]);let j=te.nodes[T]??null;function M(e){e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),E(e=>(e+1)%Math.max(1,te.nodes.length))):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),E(e=>(e-1+te.nodes.length)%Math.max(1,te.nodes.length))):e.key===`Enter`&&j?(e.preventDefault(),p.current(j)):(e.key===`Escape`||e.key===`Backspace`)&&(e.preventDefault(),m.current())}function ae(e){let t=performance.now();t<x.current||Math.abs(e.deltaY)<24||(x.current=t+620,e.deltaY>0&&j&&p.current(j),e.deltaY<0&&m.current())}return D?(0,$.jsxs)(`section`,{className:`webgl-error`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The sky could not open.`}),(0,$.jsx)(`p`,{children:D}),(0,$.jsxs)(`p`,{children:[`The `,o===`easy`?`Diagram`:`Map`,` layer works without WebGL — switch to it at the top of the window to explore the same code.`]})]}):(0,$.jsxs)(`div`,{className:`galaxy-frame`,role:`application`,tabIndex:`0`,"aria-label":`Codemble ${t.toLowerCase()} view. Use arrow keys to choose a node and Enter to move closer.`,onKeyDown:M,onWheel:ae,children:[(0,$.jsx)(`div`,{ref:d,className:`galaxy-canvas`,"aria-hidden":`true`}),j?(0,$.jsx)(`output`,{className:`keyboard-focus`,"aria-live":`polite`,children:xG(j)}):null]})}function AG(e,t,n,r){let i=new lr;i.name=e.kind===`region`?`codemble-system-${e.id}`:`codemble-node-${e.id}`;let a=Math.cbrt(e.val??1)*DG;if(e.focusDim||i.add(n.halo(e,a)),e.kind===`region`){let r=hG(e.language);r&&i.add(n.nebula(t[r],a*14))}if(e.home){let e=new ia(new xo(a*1.7,Math.max(.18,a*.07),8,36),new Ki({color:t.home}));e.rotation.x=Math.PI/2.8,i.add(e)}if(e.selected){let e=new ia(new xo(a*2.1,Math.max(.16,a*.05),6,24),new Ki({color:t.orbit}));e.rotation.x=Math.PI/2.8,i.add(e)}return e.id===r&&i.add(n.reticle(a)),i}function jG(e){return typeof e==`object`&&e?e.id:e}function MG(e){let t=document.createElement(`canvas`).getContext(`2d`);t.fillStyle=`#000000`,t.fillStyle=e,t.fillRect(0,0,1,1);let[n,r,i]=t.getImageData(0,0,1,1).data;return`rgb(${n}, ${r}, ${i})`}function NG(){let e=getComputedStyle(document.documentElement),t=t=>MG(e.getPropertyValue(t).trim());return Object.freeze({ground:t(`--cm-ground`),home:t(`--cm-ink`),orbit:t(`--cm-orbit`),nodeBright:t(`--cm-ink-2`),node:t(`--cm-ink-3`),nodeDim:t(`--cm-node-unlit`),route:t(`--cm-hairline`),routePossible:t(`--cm-route-possible`),faded:t(`--cm-hairline-soft`),star:t(`--cm-star-high`),starHalo:t(`--cm-star-halo`),nebPython:t(`--cm-neb-python`),nebJs:t(`--cm-neb-js`),nebTs:t(`--cm-neb-ts`)})}function PG({hint:e,onStudy:t}){return e?(0,$.jsxs)(`output`,{className:`hint-chip`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,$.jsxs)(`span`,{children:[`Study `,(0,$.jsx)(`strong`,{children:e.regionId}),` next`]}),(0,$.jsx)(`small`,{children:e.reason}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>t(e.regionId),children:`Take me there`})]}):null}var FG=[{title:`What you see`,body:`Every star system is one file. Size is how much code it holds; brightness is how many places in your project call it.`},{title:`How to move`,body:`Scroll or press Enter to move closer, Escape to move back. Arrow keys step between systems. The camera stays on rails — you cannot get lost.`},{title:`What lights stars`,body:`A system lights up only after you answer questions drawn from your own code. Nothing lights up just by looking at it.`}],IG=[{title:`What you see`,body:`Every box is one file, placed by how your imports connect them. A dashed link is a relationship the parser could not fully prove.`},{title:`How to move`,body:`Click a box to study that module. The tabs above show how it fits together and what runs first. Switch to the Galaxy anytime to fly through the same code.`},{title:`What lights up`,body:`A module lights up only after you answer questions drawn from your own code. Nothing lights up just by looking at it.`}];function LG({layer:e,onDismiss:t}){let[n,r]=(0,_.useState)(0),i=(0,_.useRef)(null),a=e===`map`?IG:FG,o=a[n];(0,_.useLayoutEffect)(()=>{let e=i.current;e&&!e.open&&e.showModal()},[]);function s(){i.current?.close(),t()}return(0,$.jsxs)(`dialog`,{ref:i,className:`coach-marks`,"aria-labelledby":`coach-heading`,onCancel:e=>{e.preventDefault(),s()},children:[(0,$.jsxs)(`p`,{className:`coach-marks__progress`,children:[`Step `,n+1,` of `,a.length]}),(0,$.jsx)(`h1`,{id:`coach-heading`,children:o.title}),(0,$.jsx)(`p`,{children:o.body}),(0,$.jsxs)(`div`,{className:`coach-marks__actions`,children:[(0,$.jsx)(`button`,{type:`button`,className:`coach-skip`,onClick:s,children:`Skip`}),(0,$.jsx)(`button`,{type:`button`,className:`check-primary`,onClick:()=>n+1<a.length?r(n+1):s(),children:n+1<a.length?`Next`:`Start exploring`})]})]})}var RG={nebPython:`var(--cm-neb-python)`,nebJs:`var(--cm-neb-js)`,nebTs:`var(--cm-neb-ts)`};function zG(e){let t=hG(e);return t?RG[t]:`var(--cm-hairline)`}var BG=13,VG=.62,HG=14,UG=10;function WG(e,t){let n=t-HG-UG,r=Math.max(1,Math.floor(n/(BG*VG)));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function GG({data:e,mapTab:t,mode:n,hasEntrypointCandidates:r,error:i,onSelectTab:a,onSelectRegion:o,onSelectNode:s,onRetry:c}){return(0,$.jsxs)(`section`,{className:`map-view`,"aria-label":`Two-dimensional project map`,children:[(0,$.jsxs)(`nav`,{className:`map-tabs`,"aria-label":`Map view`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t===`architecture`,onClick:()=>a(`architecture`),children:n===`easy`?`How it fits together`:`Architecture`}),(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t===`workflow`,onClick:()=>a(`workflow`),children:n===`easy`?`What runs first`:`Workflow`})]}),i?(0,$.jsxs)(`div`,{className:`map-state`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`The map did not load.`}),(0,$.jsxs)(`p`,{children:[i,` The galaxy layer is unaffected.`]}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:c,children:`Try again`})]}):e?t===`architecture`?(0,$.jsx)(KG,{architecture:e.architecture,mode:n,hasEntrypointCandidates:r,onSelectRegion:o}):(0,$.jsx)(qG,{workflow:e.workflow,mode:n,hasEntrypointCandidates:r,onSelectNode:s}):(0,$.jsx)(`p`,{className:`map-loading`,role:`status`,children:`Laying out parser evidence…`})]})}function KG({architecture:e,mode:t,hasEntrypointCandidates:n,onSelectRegion:r}){let i=new Map(e.boxes.map(e=>[e.id,e]));return(0,$.jsxs)(`div`,{className:`map-scroll`,children:[(0,$.jsxs)(`svg`,{className:`architecture-map`,viewBox:`-32 -32 ${e.width+64} ${e.height+64}`,role:`group`,"aria-label":e.home?`${e.boxes.length} modules in ${e.layer_count} import layers from Home`:`${e.boxes.length} modules in ${e.layer_count} import layers, measured from the modules nothing imports`,children:[(0,$.jsx)(`g`,{className:`architecture-map__edges`,children:e.edges.map(e=>{let t=i.get(e.src),n=i.get(e.dst);return!t||!n?null:(0,$.jsx)(`line`,{x1:t.x+t.width/2,y1:t.y+t.height,x2:n.x+n.width/2,y2:n.y,strokeDasharray:e.certain?void 0:`5 4`,className:e.cycle?`is-cycle`:void 0},`${e.src}->${e.dst}`)})}),e.boxes.map(e=>(0,$.jsxs)(`g`,{className:`architecture-map__box`,"data-understood":e.understood,"data-home":e.home,"data-reachable":e.reachable,"data-partial":e.partial,transform:`translate(${e.x} ${e.y})`,role:`button`,tabIndex:0,"aria-label":`${e.label}, ${e.node_count} structures, ${e.loc} lines${e.understood?`, understood`:`, not yet understood`}${e.home?`, Home`:``}${e.reachable?``:`, no import route from Home`}${e.partial?`, unchartable, syntax error`:``}`,onClick:()=>r(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e.id))},children:[(0,$.jsxs)(`title`,{children:[e.label,e.partial?` — unchartable, syntax error`:``]}),(0,$.jsx)(`rect`,{width:e.width,height:e.height,rx:`3`}),(0,$.jsx)(`rect`,{className:`box-tint`,width:`4`,height:e.height,fill:zG(e.language)}),e.partial?(0,$.jsx)(`path`,{className:`box-partial`,d:`M ${e.width-16} 2 L ${e.width-2} 2 L ${e.width-2} 16 Z`}):null,(0,$.jsx)(`text`,{x:HG,y:`24`,children:WG(e.label,e.width)}),(0,$.jsx)(`text`,{className:`box-meta`,x:`14`,y:`42`,children:t===`easy`?`${e.node_count} ${e.node_count===1?`piece`:`pieces`}`:`${e.node_count} nodes · ${e.loc} LOC`})]},e.id))]}),e.home?null:(0,$.jsxs)(`p`,{className:`map-note`,children:[`No Home is selected, so these layers run from the modules nothing else imports rather than from your entrypoint. Both are read from your imports, not guessed.`,` `,n?`Pick your starting point with “Change Home” to see the same modules layered by what the project runs first.`:`This project has no parser-recognisable entrypoint, so there is no “runs first” order to layer by instead.`]}),e.unreachable.length?(0,$.jsxs)(`p`,{className:`map-note`,children:[e.unreachable.length,` `,e.unreachable.length===1?`module has`:`modules have`,` no import route from Home, so `,e.unreachable.length===1?`it sits`:`they sit`,` `,`in the bottom row rather than being placed by guesswork.`]}):null]})}function qG({workflow:e,mode:t,hasEntrypointCandidates:n,onSelectNode:r}){if(!e.root)return n?(0,$.jsxs)(`div`,{className:`map-state`,children:[(0,$.jsx)(`h2`,{children:`No Home is selected.`}),(0,$.jsx)(`p`,{children:`The workflow tree starts at your entrypoint. Pick Home and this tab will show what runs first, then what that calls.`})]}):(0,$.jsxs)(`div`,{className:`map-state`,children:[(0,$.jsx)(`h2`,{children:`No “runs first” order to show.`}),(0,$.jsx)(`p`,{children:`This project has no parser-recognisable entrypoint — nothing here declares a startup structure Codemble recognises, and it will not guess one. The other tab still maps how your modules import each other.`})]});let i=new Map(e.nodes.map(e=>[e.order,e]));return(0,$.jsxs)(`div`,{className:`map-scroll`,children:[(0,$.jsxs)(`svg`,{className:`workflow-tree`,viewBox:`-16 -16 ${e.width+32} ${e.height+32}`,role:`group`,"aria-label":`Call tree from ${e.root}, ${e.nodes.length} steps deep to ${e.depth_count} levels`,children:[(0,$.jsx)(`g`,{className:`workflow-tree__edges`,children:e.nodes.map(e=>{if(e.parent===null)return null;let t=[...i.values()].filter(t=>t.id===e.parent&&t.order<e.order).at(-1);return t?(0,$.jsx)(`path`,{d:`M ${t.x+8} ${t.y+20} V ${e.y+12} H ${e.x+8}`,strokeDasharray:e.certain?void 0:`5 4`},`${e.order}`):null})}),e.nodes.map(e=>(0,$.jsxs)(`g`,{className:`workflow-tree__row`,"data-understood":e.understood,"data-cut":e.cut??void 0,"data-partial":e.partial,"data-relation":e.relation,transform:`translate(${e.x} ${e.y})`,role:`button`,tabIndex:0,"aria-label":`${e.label} at ${e.file}:${e.lineno}${e.certain?``:`, possible call`}${e.cut===`cycle`?`, repeats an earlier step`:``}${e.cut===`repeat`?`, already shown above`:``}${e.partial?`, unchartable, syntax error`:``}`,onClick:()=>r(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e.id))},children:[(0,$.jsx)(`circle`,{cx:`8`,cy:`16`,r:`4`}),(0,$.jsx)(`text`,{x:`20`,y:`20`,children:e.label}),(0,$.jsxs)(`text`,{className:`row-meta`,x:`20`,y:`20`,dx:`${e.label.length*.62}em`,children:[e.relation===`defines`?t===`easy`?` — lives here`:` — defined in this module`:e.certain?``:` — possible call`,e.cut===`cycle`?` — loops back`:``,e.cut===`repeat`?` — shown above`:``,e.partial?t===`easy`?` — could not be read`:` — unchartable`:``]})]},e.order))]}),e.unreachable.length?(0,$.jsxs)(`p`,{className:`map-note`,children:[e.unreachable.length,` `,e.unreachable.length===1?`structure is`:`structures are`,` never reached from Home by a parser-proven call. They are listed as unreached rather than attached to the tree by guesswork.`]}):null]})}var JG=[{mode:`easy`,label:`New to coding?`},{mode:`expert`,label:`I build software`}],YG=[{mode:`easy`,label:`Easy`},{mode:`expert`,label:`Expert`}];function XG({mode:e,modeChosen:t,onChoose:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(t);(0,_.useLayoutEffect)(()=>{let e=r.current;e&&t===!1&&!e.open&&e.showModal()},[t]),(0,_.useEffect)(()=>{t===!0&&a.current===!1&&i.current?.focus(),a.current=t},[t]);function o(e){r.current?.close(),n(e)}return t===null?null:t?(0,$.jsxs)(`fieldset`,{className:`mode-toggle`,children:[(0,$.jsx)(`legend`,{className:`mode-toggle__label`,children:`Audience`}),(0,$.jsx)(`div`,{className:`mode-toggle__options`,children:YG.map(t=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,name:`audience-mode`,value:t.mode,checked:e===t.mode,ref:e===t.mode?i:void 0,onChange:()=>o(t.mode)}),(0,$.jsx)(`span`,{children:t.label})]},t.mode))})]}):(0,$.jsxs)(`dialog`,{ref:r,className:`mode-gate`,"aria-labelledby":`mode-gate-heading`,"aria-describedby":`mode-gate-detail`,onCancel:e=>e.preventDefault(),children:[(0,$.jsx)(`h1`,{id:`mode-gate-heading`,children:`New to coding, or do you build software already?`}),(0,$.jsx)(`p`,{id:`mode-gate-detail`,children:`This changes how much Codemble explains and how much it assumes you already know.`}),(0,$.jsx)(`div`,{className:`mode-gate__options`,children:JG.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e.mode),children:e.label},e.mode))})]})}function ZG({node:e,study:t,error:n,mode:r,explanation:i,explanationLoading:a,explanationError:o,llmStatus:s,onSelectNode:c,onRetryNarration:l}){return(0,$.jsxs)(`aside`,{className:`study-preview`,"aria-label":`Selected source structure`,"aria-busy":!t&&!n,children:[(0,$.jsxs)(`header`,{className:`study-preview__header`,children:[(0,$.jsxs)(`p`,{className:`study-preview__path`,children:[e.file,`:`,e.lineno]}),(0,$.jsx)(`h1`,{children:e.name}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Kind`}),(0,$.jsx)(`dd`,{children:e.kind})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Span`}),(0,$.jsxs)(`dd`,{children:[e.loc,` lines`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:r===`easy`?`Used by`:`Callers`}),(0,$.jsx)(`dd`,{children:e.centrality})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Resolution`}),(0,$.jsx)(`dd`,{children:e.partial?`Partial parse`:`Parser-proven`})]})]})]}),n?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`Study data did not load.`}),(0,$.jsxs)(`p`,{children:[n,` The parser map is still available.`]}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>c(e.id),children:`Try again`})]}):null,!t&&!n?(0,$.jsx)(`p`,{className:`study-loading`,role:`status`,children:`Reading parser evidence…`}):null,t?(0,$.jsxs)(`div`,{className:`study-content`,children:[(0,$.jsx)(QG,{structural:t.structural,mode:r}),(0,$.jsx)(sK,{explanation:i,loading:a,error:o,llmStatus:s,mode:r,node:e,onSelectNode:c,onRetry:l}),(0,$.jsx)(eK,{neighbors:t.neighbors,node:e,mode:r,onSelectNode:c}),(0,$.jsx)(oK,{source:t.source}),(0,$.jsx)(aK,{lens:t.lens,language:e.language,mode:r})]}):null]})}function QG({structural:e,mode:t}){return e?(0,$.jsxs)(`section`,{className:`structural-summary`,"aria-labelledby":`structural-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`structural-heading`,children:t===`easy`?`What this is`:`Structural summary`}),(0,$.jsx)(`span`,{children:`No model needed`})]}),(0,$.jsx)(`p`,{children:e[t]??e.easy})]}):null}var $G=8;function eK({neighbors:e,node:t,mode:n,onSelectNode:r}){let i=e??[],a=i.filter(e=>e.direction===`inbound`),o=i.filter(e=>e.direction===`outbound`);return(0,$.jsxs)(`section`,{className:`connections`,"aria-labelledby":`connections-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`connections-heading`,children:n===`easy`?`What this connects to`:`Parser connections`}),(0,$.jsxs)(`span`,{children:[i.length,` parser `,i.length===1?`relationship`:`relationships`]})]}),i.length===0?(0,$.jsx)(`p`,{className:`study-loading`,children:n===`easy`?`Nothing in your code reaches this yet, and it does not reach anything else.`:`The parser observed no relationship into or out of this structure.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(iK,{inbound:a,outbound:o,node:t}),(0,$.jsx)(tK,{title:n===`easy`?`Uses this`:`Inbound`,items:a,mode:n,onSelectNode:r}),(0,$.jsx)(tK,{title:n===`easy`?`This uses`:`Outbound`,items:o,mode:n,onSelectNode:r})]})]})}function tK({title:e,items:t,mode:n,onSelectNode:r}){return t.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{children:e}),(0,$.jsx)(`ul`,{className:`connection-list`,children:t.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.node_id),children:[(0,$.jsx)(`span`,{className:`connection-name`,children:e.name}),(0,$.jsxs)(`span`,{className:`connection-meta`,children:[nK(e,n),` · `,rK(e,n)]}),(0,$.jsx)(`span`,{className:`source-citation`,children:e.citation})]})},`${e.direction}-${e.node_id}`))})]}):null}function nK(e,t){return e.relationship===`import`?e.direction===`inbound`?t===`easy`?`brings this in`:`import · inbound`:t===`easy`?`this brings it in`:`import · outbound`:e.direction===`inbound`?t===`easy`?`calls this`:`call · inbound`:t===`easy`?`this calls it`:`call · outbound`}function rK(e,t){return e.certain?`certain`:e.relationship===`import`?t===`easy`?`possible link, not certain`:`possible import`:t===`easy`?`possible link, not certain`:`possible call`}function iK({inbound:e,outbound:t,node:n}){let r=e.slice(0,$G),i=t.slice(0,$G),a=Math.max(r.length,i.length,1)*22+16,o=a/2,s=(e,t)=>(e+1)*a/(t+1);return(0,$.jsxs)(`svg`,{className:`mini-constellation`,viewBox:`0 0 280 ${a}`,role:`img`,"aria-label":`${e.length} inbound and ${t.length} outbound parser relationships for ${n.name}`,children:[r.map((e,t)=>(0,$.jsx)(`line`,{x1:`26`,y1:s(t,r.length),x2:`132`,y2:o,strokeDasharray:e.certain?void 0:`3 3`},`in-line-${e.node_id}`)),i.map((e,t)=>(0,$.jsx)(`line`,{x1:`148`,y1:o,x2:`254`,y2:s(t,i.length),strokeDasharray:e.certain?void 0:`3 3`},`out-line-${e.node_id}`)),r.map((e,t)=>(0,$.jsx)(`circle`,{cx:`22`,cy:s(t,r.length),r:`4`},`in-dot-${e.node_id}`)),i.map((e,t)=>(0,$.jsx)(`circle`,{cx:`258`,cy:s(t,i.length),r:`4`},`out-dot-${e.node_id}`)),(0,$.jsx)(`circle`,{className:`mini-constellation__self`,cx:`140`,cy:o,r:`6`})]})}function aK({lens:e,language:t,mode:n}){return e?.length?(0,$.jsxs)(`section`,{className:`lens-study`,"aria-labelledby":`lens-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsxs)(`h2`,{id:`lens-heading`,children:[fG(t),` lens`]}),(0,$.jsxs)(`span`,{children:[e.length,` detected`]})]}),(0,$.jsx)(`div`,{className:`lens-notes`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`lens-note`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{children:e.title}),(0,$.jsx)(lK,{citation:e.citation,fallbackLine:e.line})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{children:e.note_voices[n]}),(0,$.jsx)(`code`,{children:e.snippet})]})]},`${e.concept}-${e.line}-${e.snippet}`))})]}):null}function oK({source:e}){return(0,$.jsxs)(`section`,{className:`source-study`,"aria-labelledby":`source-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`source-heading`,children:`Real source`}),(0,$.jsxs)(`span`,{children:[e.file,`:`,e.start_line,`–`,e.end_line]})]}),(0,$.jsx)(`ol`,{className:`source-code`,start:e.start_line,"aria-label":`Source excerpt from ${e.file}`,children:e.lines.map(e=>(0,$.jsx)(`li`,{id:`source-L${e.number}`,"data-line":e.number,children:(0,$.jsx)(`code`,{children:e.text||` `})},e.number))})]})}function sK({explanation:e,loading:t,error:n,llmStatus:r,mode:i,node:a,onSelectNode:o,onRetry:s}){return t?(0,$.jsx)(`p`,{className:`study-loading`,role:`status`,children:i===`easy`?`Asking your model to explain this in plain language…`:`Requesting a grounded narration for this structure…`}):n?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`The explanation request failed.`}),(0,$.jsx)(`p`,{children:n}),(0,$.jsx)(`p`,{children:`Every fact above and below this block came from the parser and is unaffected.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:s,children:`Try again`})]}):e?e.status===`no_key`?(0,$.jsx)(cK,{message:e.message,llmStatus:r,mode:i}):e.status===`error`?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`The explanation was withheld.`}),(0,$.jsx)(`p`,{children:e.message}),(0,$.jsx)(`p`,{children:`Codemble will not display provider output that falls outside parser evidence.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:s,children:`Try again`})]}):e.status===`partial`?(0,$.jsxs)(`section`,{className:`study-notice`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`Narration stays off for partial source.`}),(0,$.jsx)(`p`,{children:e.message})]}):(0,$.jsxs)(`section`,{className:`grounded-explanation`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,role:`status`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:i===`easy`?`In plain language`:`Grounded explanation`}),(0,$.jsx)(`span`,{children:e.cached?`Local cache`:e.provider})]}),(0,$.jsxs)(`p`,{children:[e.summary.text,` `,(0,$.jsx)(lK,{citation:e.summary.citation,fallbackLine:a.lineno})]}),(0,$.jsx)(`h3`,{children:i===`easy`?`Line by line`:`Walkthrough`}),(0,$.jsx)(`ul`,{className:`evidence-list`,children:e.walkthrough.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`p`,{children:e.text}),(0,$.jsx)(lK,{citation:e.citation,fallbackLine:e.line})]},`${e.citation}-${e.text}`))}),e.relationships.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{children:i===`easy`?`How it fits in`:`Parser relationships`}),(0,$.jsx)(`ul`,{className:`evidence-list`,children:e.relationships.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.certain?e.node_id:`Possible: ${e.node_id}`}),(0,$.jsx)(`p`,{children:e.text}),(0,$.jsxs)(`button`,{className:`source-citation source-citation--button`,type:`button`,onClick:()=>o(e.node_id),children:[`Study `,e.citation]})]},`${e.node_id}-${e.text}`))})]}):null]}):null}function cK({message:e,llmStatus:t,mode:n}){let r=t?.ollama??null;return(0,$.jsxs)(`section`,{className:`study-notice`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:n===`easy`?`The plain-language write-up needs a model.`:`No narration provider is configured.`}),(0,$.jsx)(`p`,{children:e}),r?(0,$.jsx)(`p`,{children:r.running?`Ollama is already running on this machine. Set CODEMBLE_PROVIDER=ollama and CODEMBLE_OLLAMA_MODEL=${r.recommended}, then restart Codemble to narrate without sending code anywhere.`:`Want to stay fully local? Install Ollama, run "ollama pull ${r.recommended}" (or ${r.fallback} on a smaller machine), set CODEMBLE_PROVIDER=ollama, then restart Codemble.`}):null,(0,$.jsx)(`p`,{children:`Everything else on this panel is parser evidence and works without any model at all.`})]})}function lK({citation:e,fallbackLine:t}){return(0,$.jsx)(`a`,{className:`source-citation`,href:`#source-L${Number(e.split(`:`).at(-1))||t}`,children:e})}var uK=Object.freeze({setTimeout(e,t){return globalThis.setTimeout(e,t)},clearTimeout(e){globalThis.clearTimeout(e)}}),dK=300,fK=400,pK=4e3;function mK({adapter:e=hK(),clock:t=uK}={}){let n=new Set,r=gK({status:`idle`,error:``,graph:null,level:sG.GALAXY,region:null,selectedNode:null,studyData:null,studyError:``,explanation:null,explanationLoading:!1,explanationError:``,showChart:!1,studiedNodeIds:new Set,showChecks:!1,checkData:null,checkError:``,entrypointDismissed:!1,entrypointError:``,litRegionId:null,pendingDawnRegionId:null,languageFocus:`all`,picker:null,parseProgress:null,layer:`galaxy`,layerChosen:!1,mapTab:`architecture`,mapData:null,mapError:``,coachmarksSeen:bK(),llmStatus:null,hoverNodeId:null,mode:`easy`,modeChosen:null}),i=0,a=0,o=null,s=null,c=null,l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=null,v=null;function y(){return r}function b(e){return n.add(e),()=>n.delete(e)}function x(e,{preserveChecks:t=!1}={}){let i=r,a=gK({...i,...e});if(a.level!==i.level||a.region?.id!==i.region?.id){let e={hoverNodeId:null};t||(SK(l),SK(u),l=null,u=null,e.showChecks=!1,e.checkData=null,e.checkError=``),a=gK({...a,...e})}r=Object.freeze(a);for(let e of n)e()}async function S(){i+=1;let t=i;SK(o),o=new AbortController;let n=o;x({status:`loading`,error:``});let a;try{a=await e.loadPickerState({signal:n.signal})}catch(e){return!CK(e)&&t===i&&x({status:`error`,error:wK(e)}),r}return t!==i||n.signal.aborted?r:a.state===`unpicked`?T(n,t):C(n,t)}async function C(t,n){x({status:`loading`,error:``,picker:null});try{let a=await e.loadGraph({signal:t.signal});if(n!==i||t.signal.aborted)return r;x({status:`ready`,graph:a,region:bG(a),error:``,entrypointDismissed:!!a.selected_entrypoint})}catch(e){!CK(e)&&n===i&&x({status:`error`,error:wK(e)})}return await w(t,n),r}async function w(t,n){let o=a,[s,c]=await Promise.allSettled([(async()=>e.loadMode({signal:t.signal}))(),(async()=>e.fetchLlmStatus({signal:t.signal}))()]);if(!(n!==i||t.signal.aborted)){if(o===a){let e=s.status===`fulfilled`?s.value:null;e?.mode===`easy`||e?.mode===`expert`?oe(e.mode,e.chosen===!0):r.modeChosen===null&&x({modeChosen:!0})}c.status===`fulfilled`&&x({llmStatus:c.value})}}async function T(t,n){try{let[a,o]=await Promise.all([e.loadRecents({signal:t.signal}),e.browsePicker(null,{signal:t.signal})]);if(n!==i||t.signal.aborted)return r;x({status:`picking`,picker:{...o,recents:a.recents,error:``,scale:null,busy:!1}})}catch(e){!CK(e)&&n===i&&x({status:`error`,error:wK(e)})}return r}async function E(t){if(r.status!==`picking`||r.picker?.busy)return;SK(f),f=new AbortController;let n=f;try{let i=await e.browsePicker(t,{signal:n.signal});!n.signal.aborted&&r.status===`picking`&&x({picker:{...r.picker,...i,error:``}})}catch(e){f===n&&!CK(e)&&r.status===`picking`&&x({picker:{...r.picker,error:wK(e)}})}}async function D(t){if(r.status!==`picking`||r.picker?.busy)return;SK(f),f=new AbortController;let n=f;x({picker:{...r.picker,busy:!0,error:``,scale:null}});try{let a=await e.selectProject(t,{signal:n.signal});if(n.signal.aborted||r.status!==`picking`)return a;if(a.state===`parsing`)return x({parseProgress:{state:`parsing`,stage:`discovering`,files_done:0,files_total:0,error:null,pollError:``,attempts:0,path:t}}),O(0),a;if(a.state===`ready`){i+=1;let e=i;return SK(o),o=new AbortController,C(o,e)}if(a.state===`scale`){let t=await e.browsePicker(a.root,{signal:n.signal});return!n.signal.aborted&&r.status===`picking`&&x({picker:{...r.picker,...t,busy:!1,scale:a}}),a}return x({picker:{...r.picker,busy:!1,error:a.detail}}),a}catch(e){!CK(e)&&r.status===`picking`&&x({picker:{...r.picker,busy:!1,error:wK(e)}});return}}function O(e){v!==null&&t.clearTimeout(v),v=t.setTimeout(async()=>{v=null,await A()},e)}function k(){SK(g),g=null,v!==null&&(t.clearTimeout(v),v=null)}async function A(){if(!r.parseProgress)return;SK(g),g=new AbortController;let t=g,n=i,a=r.parseProgress,s;try{s=await e.fetchParseProgress({signal:t.signal})}catch(e){if(g!==t||n!==i||CK(e)||!r.parseProgress)return;let o=a.attempts+1;x({parseProgress:{...a,pollError:wK(e),attempts:o}}),O(Math.min(pK,fK*2**(o-1)));return}if(!(g!==t||n!==i||!r.parseProgress)){if(s.state===`ready`){k(),x({parseProgress:null,picker:null}),i+=1;let e=i;SK(o),o=new AbortController,await C(o,e);return}if(s.state===`error`||s.state===`idle`){k(),x({parseProgress:null,picker:{...r.picker,busy:!1,error:s.error??``}});return}x({parseProgress:{...a,...s,pollError:``,attempts:0}}),O(dK)}}async function ee(){let t=i;if(await e.clearProgress({}),t!==i)return r;i+=1;let n=i;return SK(o),o=new AbortController,C(o,n)}async function te(){SK(h),h=new AbortController;let t=h;return await e.resetProject({signal:t.signal}),t.signal.aborted?r:(le(),SK(d),d=null,SK(p),p=null,SK(m),m=null,k(),x({graph:null,parseProgress:null,region:null,selectedNode:null,level:sG.GALAXY,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1,showChart:!1,studiedNodeIds:new Set,showChecks:!1,checkData:null,checkError:``,entrypointDismissed:!1,entrypointError:``,litRegionId:null,pendingDawnRegionId:null,languageFocus:`all`,llmStatus:null,picker:null,mapData:null,mapError:``}),S())}async function ne(e){switch(e.type){case`ADVANCE`:return ie(e.node);case`ADVANCE_REGION`:re(e.regionId);return;case`RETREAT`:j();return;case`SELECT_STUDY_NODE`:return M(e.nodeId);case`SET_LANGUAGE_FOCUS`:ae(e.language);return;case`SET_MODE`:return se(e.mode);case`HOVER_NODE`:r.hoverNodeId!==(e.nodeId??null)&&x({hoverNodeId:e.nodeId??null});return;case`SHOW_CHART`:x({showChart:!0});return;case`HIDE_CHART`:x({showChart:!1});return;case`OPEN_CHECKS`:return de();case`CLOSE_CHECKS`:pe();return;case`SUBMIT_CHECK`:return me(e.checkId,e.selectedIds);case`CONSUME_DAWN`:be(e.regionId);return;case`SELECT_ENTRYPOINT`:return he(e.nodeId);case`DISMISS_ENTRYPOINT`:x({entrypointDismissed:!0});return;case`CHANGE_HOME`:le(),x({entrypointDismissed:!1,entrypointError:``,level:sG.GALAXY,selectedNode:null,showChart:!1,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1});return;case`BROWSE_PICKER`:return E(e.path);case`SELECT_PROJECT`:return D(e.path);case`RESET_PROJECT`:return te();case`CLEAR_PROGRESS`:return ee();case`SET_LAYER`:return ge(e.layer);case`SET_MAP_TAB`:x({mapTab:e.tab});return;case`DISMISS_COACHMARKS`:xK(),x({coachmarksSeen:!0});return;case`SET_LEVEL_GALAXY`:le(),x({level:sG.GALAXY,selectedNode:null});return;default:throw Error(`Unknown learner-session event: ${e.type}`)}}function re(e){let t=r.graph?.regions.find(t=>t.id===e);t&&(le(),x({languageFocus:r.languageFocus!==`all`&&t.language!==r.languageFocus?t.language:r.languageFocus,region:t,selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1}))}async function ie(e){if(!(!r.focusedGraph||!e)){if(r.level===sG.GALAXY){let t=r.focusedGraph.regions.find(t=>t.id===e.id)??e;le(),x({region:t,selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``});return}if(r.level===sG.SYSTEM){let t=r.focusedGraph.nodes.find(t=>t.id===e.id)??e;return x({selectedNode:t,level:sG.STUDY}),ce(t.id)}}}function j(){r.level===sG.STUDY?(le(),x({selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1})):r.level===sG.SYSTEM&&x({level:sG.GALAXY})}async function M(e){let t=r.graph?.nodes.find(t=>t.id===e);if(!t)return;let n=r.graph.regions.find(e=>e.id===t.region);return x({languageFocus:r.languageFocus!==`all`&&t.language!==r.languageFocus?t.language:r.languageFocus,region:n??r.region,selectedNode:t,level:sG.STUDY}),ce(t.id)}function ae(e){let t=r.selectedNode?.id;x({languageFocus:e}),t&&r.selectedNode?.id!==t&&(le(),x({studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1}))}function oe(e,t){let n=r.layerChosen?r.layer:e===`easy`?`map`:`galaxy`;x({mode:e,layer:n,modeChosen:t}),n===`map`&&_e()}async function se(t){if(t!==`easy`&&t!==`expert`)return;let n=r.mode,o=r.modeChosen;if(t===n&&r.modeChosen)return;a+=1,SK(m),m=new AbortController;let s=m,c=i;oe(t,!0);try{await e.saveMode(t,{signal:s.signal})}catch(e){m===s&&c===i&&!CK(e)&&oe(n,o);return}if(!(c!==i||s.signal.aborted)&&r.level===sG.STUDY&&r.selectedNode)return ue(r.selectedNode.id)}async function ce(t){le(),s=new AbortController;let n=s;x({studyData:null,studyError:``}),ue(t);try{let i=await e.loadStudy(t,{signal:n.signal});if(n.signal.aborted||r.level!==sG.STUDY||r.selectedNode?.id!==t)return;x({studyData:i,studiedNodeIds:new Set(r.studiedNodeIds).add(i.node.id)})}catch(e){s===n&&!n.signal.aborted&&!CK(e)&&r.selectedNode?.id===t&&x({studyError:wK(e)})}}function le(){SK(s),s=null,SK(c),c=null}async function ue(t){SK(c),c=new AbortController;let n=c;x({explanation:null,explanationError:``,explanationLoading:!0});try{let i=await e.loadExplanation(t,r.mode,{signal:n.signal});if(n.signal.aborted||r.level!==sG.STUDY||r.selectedNode?.id!==t)return;x({explanation:i,explanationLoading:!1})}catch(e){c===n&&!n.signal.aborted&&!CK(e)&&r.selectedNode?.id===t&&x({explanationError:wK(e),explanationLoading:!1})}}async function de(){if(!r.region)return;let e=r.region.id;return x({showChecks:!0,checkData:null,checkError:``}),fe(e)}async function fe(t){SK(l),l=new AbortController;let n=l;try{let i=await e.loadChecks(t,{signal:n.signal});return!n.signal.aborted&&r.showChecks&&r.region?.id===t&&x({checkData:i,checkError:``},{preserveChecks:!0}),i}catch(e){l===n&&!CK(e)&&!n.signal.aborted&&r.showChecks&&r.region?.id===t&&x({checkError:wK(e)},{preserveChecks:!0});return}}function pe(){SK(l),l=null,x({showChecks:!1,checkData:null,checkError:``})}async function me(t,n){if(!r.region)return;let i=r.region.id;SK(u),u=new AbortController;let a=u,o=await e.submitCheck(i,t,n,{signal:a.signal});if(a.signal.aborted||r.region?.id!==i)return o;if(o.correct&&await fe(i),o.region_understood){let t=await e.loadGraph({signal:a.signal});!a.signal.aborted&&r.region?.id===i&&(SK(p),p=null,x({graph:t,region:t.regions.find(e=>e.id===i),mapData:null,mapError:``},{preserveChecks:!0}),ye(i),r.layer===`map`&&await _e())}return o}async function he(t){let n=i;SK(d),d=new AbortController;let a=d;x({entrypointError:``});try{let o=await e.selectEntrypoint(t,{signal:a.signal});return n!==i||a.signal.aborted?r:(SK(p),p=null,x({graph:o,region:bG(o),entrypointError:``,entrypointDismissed:!0,mapData:null,mapError:``}),r.layer===`map`&&await _e(),o)}catch(e){d===a&&n===i&&!a.signal.aborted&&!CK(e)&&x({entrypointError:wK(e)});return}}async function ge(e){if(x({layer:e,layerChosen:!0}),e===`map`)return _e()}function _e(){if(!r.mapData)return p&&!p.signal.aborted&&!r.mapError?void 0:ve()}async function ve(){let t=i;SK(p),p=new AbortController;let n=p;x({mapError:``});try{let r=await e.fetchMap({signal:n.signal});return t===i&&!n.signal.aborted&&x({mapData:r,mapError:``}),r}catch(e){p===n&&t===i&&!n.signal.aborted&&!CK(e)&&x({mapError:wK(e),mapData:null});return}}function ye(e){_!==null&&t.clearTimeout(_),x({litRegionId:e,pendingDawnRegionId:e}),_=t.setTimeout(()=>{_=null,r.litRegionId===e&&x({litRegionId:null})},520)}function be(e){r.pendingDawnRegionId===e&&x({pendingDawnRegionId:null})}function xe(){i+=1;for(let e of[o,s,c,l,u,d,f,p,m,h,g])SK(e);o=null,s=null,c=null,l=null,u=null,d=null,f=null,p=null,m=null,h=null,k(),_!==null&&(t.clearTimeout(_),_=null)}return Object.freeze({dispatch:ne,dispose:xe,getSnapshot:y,start:S,subscribe:b})}function hK(e=globalThis.fetch){if(typeof e!=`function`)throw TypeError(`Learner-session HTTP adapter requires fetch.`);async function t(t,n,r={}){let i=await e(t,r);if(!i.ok){let e=(await i.json().catch(()=>null))?.detail;throw Error(typeof e==`string`&&e?e:`${n} returned ${i.status}.`)}return i.json()}return Object.freeze({loadGraph(e={}){return t(`/api/graph`,`Graph request`,e)},fetchMap(e={}){return t(`/api/map`,`Map request`,e)},loadStudy(e,n={}){return t(`/api/node/${encodeURIComponent(e)}/study`,`Study request`,n)},loadExplanation(e,n,r={}){return t(`/api/node/${encodeURIComponent(e)}/explanation?mode=${encodeURIComponent(n)}`,`Explanation request`,r)},loadChecks(e,n={}){return t(`/api/regions/${encodeURIComponent(e)}/checks`,`Checks request`,n)},submitCheck(e,n,r,i={}){return t(`/api/regions/${encodeURIComponent(e)}/checks/${encodeURIComponent(n)}`,`Check submission`,{...i,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selected_ids:r})})},selectEntrypoint(e,n={}){return t(`/api/entrypoint`,`Home selection`,{...n,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({node_id:e})})},loadMode(e={}){return t(`/api/mode`,`Mode request`,e)},saveMode(e,n={}){return t(`/api/mode`,`Mode update`,{...n,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})})},fetchLlmStatus(e={}){return t(`/api/llm/status`,`Model status`,e)},resetProject(e={}){return t(`/api/picker/reset`,`Project reset`,{...e,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({confirmed:!0})})},loadPickerState(e={}){return t(`/api/picker/state`,`Picker state`,e)},browsePicker(e,n={}){return t(`/api/picker/browse${e?`?path=${encodeURIComponent(e)}`:``}`,`Folder listing`,n)},loadRecents(e={}){return t(`/api/picker/recents`,`Recent projects`,e)},fetchParseProgress(e={}){return t(`/api/picker/progress`,`Parse progress`,e)},clearProgress(e={}){return t(`/api/progress`,`Progress reset`,{...e,method:`DELETE`})},async selectProject(t,n={}){let r=await e(`/api/picker/select`,{...n,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})}),i=await r.json().catch(()=>null);if(r.ok)return{state:r.status===202?`parsing`:`ready`};let a=i?.detail;return a&&typeof a==`object`&&a.reason===`scale`?{state:`scale`,...a}:{state:`error`,detail:typeof a==`string`?a:`Project selection returned ${r.status}.`}}})}function gK(e){let t=e.graph,n=t?cG(t,e.languageFocus):null,r=e.level,i=e.region,a=e.selectedNode;n&&(i=n.regions.find(e=>e.id===i?.id)??null,i?a&&(a=n.nodes.find(e=>e.id===a.id)??null,!a&&r===sG.STUDY&&(r=sG.SYSTEM)):(i=bG(n),a=null,r=sG.GALAXY));let o=e.studiedNodeIds,s=n?_K(n,e.mode):null;return{...e,focusedGraph:n,focusedMapData:lG(e.mapData,e.languageFocus),entrypointOpen:!!t&&!e.entrypointDismissed,level:r,region:i,selectedNode:a,languageOptions:t?uG(t):[],projectName:t?t.project_root.split(`/`).filter(Boolean).at(-1)??t.project_root:`Loading local project`,chart:n?dG(n,o):[],focusedStudiedCount:n?n.nodes.filter(e=>o.has(e.id)).length:0,hint:s}}function _K(e,t){if(t!==`easy`)return null;let n=e.regions.filter(e=>!e.understood);if(!n.length)return null;let r=e.regions.find(e=>e.home),i=new Map;if(r){let t=new Map;for(let n of e.region_edges)t.has(n.src)||t.set(n.src,[]),t.has(n.dst)||t.set(n.dst,[]),t.get(n.src).push(n.dst),t.get(n.dst).push(n.src);i.set(r.id,0);let n=[r.id];for(;n.length;){let e=n.shift();for(let r of(t.get(e)??[]).slice().sort())i.has(r)||(i.set(r,i.get(e)+1),n.push(r))}}let a=n.map(e=>({regionId:e.id,hops:i.has(e.id)?i.get(e.id):1/0})).sort((e,t)=>e.hops-t.hops||e.regionId.localeCompare(t.regionId))[0];return{...a,reason:a.hops===0?`Home is not lit yet.`:Number.isFinite(a.hops)?`${a.hops} ${a.hops===1?`route`:`routes`} from Home.`:`No import route reaches it from Home.`}}var vK=`codemble.coachmarks.seen`;function yK(){if(typeof document>`u`)return null;try{return globalThis.localStorage??null}catch{return null}}function bK(){try{return yK()?.getItem(vK)===`1`}catch{return!1}}function xK(){try{yK()?.setItem(vK,`1`)}catch{}}function SK(e){e&&!e.signal.aborted&&e.abort()}function CK(e){return e instanceof Error&&e.name===`AbortError`}function wK(e){return e instanceof Error?e.message:String(e)}function TK(){let e=(0,_.useMemo)(()=>mK({adapter:hK()}),[]),t=(0,_.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);(0,_.useEffect)(()=>(e.start(),()=>e.dispose()),[e]);let[n,r]=(0,_.useState)(``),{chart:i,checkData:a,checkError:o,coachmarksSeen:s,entrypointError:c,entrypointOpen:l,error:u,explanation:d,explanationError:f,explanationLoading:p,focusedGraph:m,focusedMapData:h,focusedStudiedCount:g,graph:v,hint:y,hoverNodeId:b,languageFocus:x,languageOptions:S,layer:C,level:w,litRegionId:T,llmStatus:E,mapError:D,mapTab:O,mode:k,modeChosen:A,parseProgress:ee,pendingDawnRegionId:te,picker:ne,projectName:re,region:ie,selectedNode:j,showChart:M,showChecks:ae,status:oe,studyData:se,studyError:ce}=t;return u?(0,$.jsxs)(`main`,{className:`load-state`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The graph did not load.`}),(0,$.jsx)(`p`,{children:u}),(0,$.jsx)(`p`,{children:`Your progress is stored on this machine and is not affected.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>e.start(),children:`Try again`})]}):ee?(0,$.jsx)(OK,{progress:ee,onCancel:()=>e.dispatch({type:`RESET_PROJECT`})}):oe===`picking`&&ne?(0,$.jsx)(kK,{picker:ne,failure:n&&ne.error?{path:n,detail:ne.error}:null,onBrowse:t=>(r(``),e.dispatch({type:`BROWSE_PICKER`,path:t})),onSelect:t=>(r(t),e.dispatch({type:`SELECT_PROJECT`,path:t}))}):!v||!m||!ie?(0,$.jsx)(`main`,{className:`load-state`,"aria-busy":`true`,children:(0,$.jsx)(`p`,{children:`Mapping parser evidence…`})}):(0,$.jsxs)(`main`,{className:`app-shell`,"data-level":M?`chart`:w.toLowerCase(),"data-mode":k,children:[(0,$.jsxs)(`header`,{className:`instrument-rail`,children:[(0,$.jsxs)(`div`,{className:`brand-lockup`,children:[(0,$.jsx)(`span`,{className:`brand-mark`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Codemble`}),(0,$.jsx)(`span`,{children:re})]})]}),(0,$.jsx)(`nav`,{className:`location`,"aria-label":`Breadcrumb`,"aria-live":`polite`,children:M?(0,$.jsx)(`span`,{"aria-current":`page`,children:`Star chart`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,disabled:w===sG.GALAXY,"aria-current":w===sG.GALAXY?`page`:void 0,onClick:()=>e.dispatch({type:`SET_LEVEL_GALAXY`}),children:`Galaxy`}),w===sG.GALAXY?(0,$.jsxs)(`small`,{children:[` · Home `,v.selected_entrypoint?bG(v)?.id??`unresolved`:`unselected`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,$.jsx)(`button`,{type:`button`,disabled:w===sG.SYSTEM,"aria-current":w===sG.SYSTEM?`page`:void 0,onClick:()=>e.dispatch({type:`RETREAT`}),children:ie.id})]}),w===sG.STUDY&&j?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,$.jsx)(`span`,{"aria-current":`page`,children:j.name})]}):null,x===`all`?null:(0,$.jsxs)(`small`,{children:[` · `,pG(x),` focus`]})]})}),(0,$.jsxs)(`div`,{className:`rail-actions`,children:[M?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`HIDE_CHART`}),children:`Return to galaxy`}):w===sG.GALAXY?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`SHOW_CHART`}),children:`Star chart`}):(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`RETREAT`}),children:w===sG.STUDY?`Return to system`:`Return to galaxy`}),v.entrypoint_candidates.length?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`CHANGE_HOME`}),children:`Change Home`}):null,(0,$.jsx)(FK,{onConfirm:()=>e.dispatch({type:`RESET_PROJECT`})})]}),(0,$.jsxs)(`div`,{className:`rail-controls`,children:[(0,$.jsx)(NK,{layer:C,mode:k,onChange:t=>e.dispatch({type:`SET_LAYER`,layer:t})}),(0,$.jsx)(PK,{options:S,value:x,onChange:t=>e.dispatch({type:`SET_LANGUAGE_FOCUS`,language:t})}),(0,$.jsx)(XG,{mode:k,modeChosen:A,onChoose:t=>e.dispatch({type:`SET_MODE`,mode:t})})]})]}),M?(0,$.jsx)(RK,{chart:i,studiedCount:g,projectName:re,onClearProgress:()=>e.dispatch({type:`CLEAR_PROGRESS`})}):(0,$.jsxs)(`section`,{className:`map-stage`,"aria-label":`Parser-proven project map`,children:[C===`map`?(0,$.jsx)(GG,{data:h,mapTab:O,mode:k,hasEntrypointCandidates:v.entrypoint_candidates.length>0,error:D,onSelectTab:t=>e.dispatch({type:`SET_MAP_TAB`,tab:t}),onSelectRegion:t=>e.dispatch({type:`ADVANCE_REGION`,regionId:t}),onSelectNode:t=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:t}),onRetry:()=>e.dispatch({type:`SET_LAYER`,layer:`map`})}):(0,$.jsx)(kG,{graph:m,level:w,region:ie,selectedNode:j,hoverNodeId:b,pendingDawnRegionId:te,mode:k,onHoverNode:t=>e.dispatch({type:`HOVER_NODE`,nodeId:t}),onAdvance:t=>e.dispatch({type:`ADVANCE`,node:t}),onRetreat:()=>e.dispatch({type:`RETREAT`}),onDawnConsumed:t=>e.dispatch({type:`CONSUME_DAWN`,regionId:t})}),(0,$.jsxs)(`aside`,{className:`map-legend`,"aria-label":C===`map`?`Map legend`:`Galaxy legend`,children:[C===`galaxy`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-size`}),`Size · `,k===`easy`?`how much code`:`lines of code`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-brightness`}),`Brighter · `,k===`easy`?`used in more places`:`more distinct callers`]})]}):null,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--dim`}),`Dim · `,k===`easy`?`not proven yet`:`not understood`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--lit`}),`Amber · `,k===`easy`?`you proved you understand it`:`understood`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--partial`}),k===`easy`?`Could not be read`:`Unchartable · syntax error`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-route`}),k===`easy`?`Certain connection`:`Parser edge · certain`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:C===`map`?`legend-route legend-route--possible legend-route--dashed`:`legend-route legend-route--possible`}),k===`easy`?`Possible connection`:`Possible relationship`]}),C===`galaxy`&&w===sG.GALAXY||C===`map`&&O===`architecture`?S.filter(e=>e.id!==`all`).map(e=>(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-tint legend-tint--${e.id}`}),` `,e.label]},e.id)):null]}),C===`galaxy`&&w===sG.GALAXY?(0,$.jsxs)(`section`,{className:`orientation-copy`,children:[(0,$.jsxs)(`h1`,{children:[m.regions.length,` `,x===`all`?m.regions.length===1?`system`:`systems`:`${pG(x)} ${m.regions.length===1?`system`:`systems`}`,` from real source.`]}),(0,$.jsx)(`p`,{children:`Choose a system. Size follows lines of code; brightness follows how many places call it.`}),m.partial_files.length?(0,$.jsxs)(`p`,{className:`partial-summary`,children:[m.partial_files.length,` `,m.partial_files.length===1?`file is`:`files are`,` unchartable because `,m.partial_files.length===1?`its`:`their`,` language parser reported a syntax error.`]}):null]}):null,w===sG.SYSTEM?(0,$.jsxs)(`section`,{className:`orientation-copy orientation-copy--system`,children:[(0,$.jsx)(`h1`,{children:ie.id}),(0,$.jsx)(`p`,{children:m.nodes.some(e=>e.region===ie.id&&e.partial)?`${ie.node_count} source ${ie.node_count===1?`file remains`:`files remain`} visible · ${ie.loc} lines. The module is unchartable beyond raw source because it has a syntax error.`:`${ie.node_count} parser-proven structures · ${ie.loc} lines in this system.`}),(0,$.jsx)(`button`,{className:`check-launch`,type:`button`,onClick:()=>e.dispatch({type:`OPEN_CHECKS`}),children:m.nodes.some(e=>e.region===ie.id&&e.partial)?`Check availability`:ie.understood?`Review understanding`:`Prove understanding`})]}):null,w===sG.SYSTEM&&ae?(0,$.jsx)(LK,{suite:a,error:o,mode:k,onClose:()=>e.dispatch({type:`CLOSE_CHECKS`}),onSubmit:(t,n)=>e.dispatch({type:`SUBMIT_CHECK`,checkId:t,selectedIds:n})}):null,l&&w===sG.GALAXY?(0,$.jsx)(IK,{candidates:v.entrypoint_candidates,nodes:v.nodes,selectedEntrypoint:v.selected_entrypoint,error:c,onSelect:t=>e.dispatch({type:`SELECT_ENTRYPOINT`,nodeId:t}),onContinue:()=>e.dispatch({type:`DISMISS_ENTRYPOINT`})}):null,T?(0,$.jsxs)(`output`,{className:`illumination-pulse`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),(0,$.jsxs)(`strong`,{children:[T,` understood`]})]}):null,w===sG.STUDY&&j?(0,$.jsx)(ZG,{node:j,study:se,error:ce,mode:k,explanation:d,explanationLoading:p,explanationError:f,llmStatus:E,onSelectNode:t=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:t}),onRetryNarration:()=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:j.id})}):null,A===!0&&!s?(0,$.jsx)(LG,{layer:C,onDismiss:()=>e.dispatch({type:`DISMISS_COACHMARKS`})}):null,(0,$.jsx)(PG,{hint:y,onStudy:t=>e.dispatch({type:`ADVANCE_REGION`,regionId:t})})]}),(0,$.jsxs)(`footer`,{className:`status-line`,children:[(0,$.jsx)(`span`,{children:M?`${i.length} concepts detected`:x===`all`?`${v.nodes.length} nodes · ${v.edges.length} edges`:`${m.nodes.length}/${v.nodes.length} nodes · ${m.edges.length} focused edges`}),(0,$.jsx)(`span`,{children:M?`${g} focused structures studied this session`:C===`map`?`Click a box or row to study · Switch tabs to change view`:`Scroll or Enter to move closer · Escape to move back`}),(0,$.jsx)(`span`,{children:`Local only`})]})]})}var EK={discovering:`Finding your source files`,parsing:`Reading each file`,resolving:`Connecting imports and calls`,checks:`Building graph-only checks`,layout:`Placing your galaxy`},DK=[`discovering`,`parsing`,`resolving`,`checks`,`layout`];function OK({progress:e,onCancel:t}){let{stage:n,detail:r,files_done:i,files_total:a,pollError:o,path:s}=e,[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),f=(0,_.useRef)(null),p=DK.indexOf(n);(0,_.useEffect)(()=>{f.current?.focus()},[]);async function m(){l(!0),d(``);try{await t()}catch(e){d(e.message),l(!1)}}return(0,$.jsxs)(`main`,{className:`loading-screen`,children:[(0,$.jsxs)(`header`,{className:`loading-header`,children:[(0,$.jsx)(`p`,{className:`picker-wordmark`,children:`Codemble`}),(0,$.jsxs)(`h1`,{ref:f,tabIndex:-1,children:[`Mapping `,(0,$.jsx)(`span`,{className:`loading-path`,children:s})]}),(0,$.jsx)(`p`,{className:`loading-subtitle`,children:`Parsing runs on your machine. Nothing is sent anywhere.`})]}),(0,$.jsx)(`ol`,{className:`loading-stages`,"aria-label":`Parse stages`,children:DK.map((e,t)=>{let n=t<p?`done`:t===p?`active`:`waiting`;return(0,$.jsxs)(`li`,{"data-state":n,children:[(0,$.jsx)(`span`,{children:EK[e]}),(0,$.jsxs)(`small`,{children:[e===`parsing`&&a?`${i}/${a} files · `:``,n===`done`?`done`:n===`active`?r?`working · ${r}`:`working`:`waiting`]})]},e)})}),a?(0,$.jsx)(`progress`,{className:`loading-meter`,value:i,max:a,"aria-label":`${i} of ${a} files read`}):null,(0,$.jsx)(`p`,{className:`loading-live`,role:`status`,children:r??EK[n]??`Starting`}),o?(0,$.jsxs)(`p`,{className:`loading-error`,role:`status`,children:[`Lost contact with the local server (`,o,`). Still retrying — the parse itself may be running fine.`]}):null,u?(0,$.jsx)(`p`,{className:`loading-error`,role:`alert`,children:u}):null,(0,$.jsx)(`div`,{className:`loading-actions`,children:(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,disabled:c,onClick:m,children:c?`Stopping…`:`Cancel and pick another project`})})]})}function kK({picker:e,failure:t,onBrowse:n,onSelect:r}){let{path:i,parent:a,entries:o,recents:s,error:c,scale:l,busy:u}=e;return(0,$.jsxs)(`main`,{className:`picker-screen`,"aria-busy":u,children:[(0,$.jsxs)(`header`,{className:`picker-header`,children:[(0,$.jsx)(`p`,{className:`picker-wordmark`,children:`Codemble`}),(0,$.jsx)(`h1`,{children:`Choose the project to chart`}),(0,$.jsx)(`p`,{className:`picker-subtitle`,children:`Codemble reads the folder locally and turns it into a galaxy. Nothing leaves this machine.`})]}),s.length?(0,$.jsxs)(`section`,{className:`picker-recents`,"aria-labelledby":`picker-recents-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-recents-heading`,children:`Continue where you left off`}),(0,$.jsx)(`ul`,{children:s.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>r(e.project_root),children:[(0,$.jsx)(`span`,{className:`picker-recent-path`,children:e.project_root}),(0,$.jsxs)(`span`,{className:`picker-recent-lit`,children:[e.understood_count,` `,e.understood_count===1?`system`:`systems`,` lit last visit`]})]})},e.project_root))})]}):null,l?(0,$.jsx)(AK,{scale:l,busy:u,onBrowse:n}):null,t?(0,$.jsx)(MK,{failure:t,busy:u,onSelect:r}):c?(0,$.jsx)(`p`,{className:`picker-error`,role:`alert`,children:c}):null,(0,$.jsxs)(`section`,{className:`picker-browser`,"aria-labelledby":`picker-browser-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-browser-heading`,children:`Browse folders`}),(0,$.jsx)(`p`,{className:`picker-path`,children:i}),(0,$.jsxs)(`ul`,{children:[a?(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>n(a),children:`↑ Up`})}):null,o.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>n(e.path),children:[e.name,`/`]})},e.path))]}),(0,$.jsx)(`button`,{className:`picker-select`,type:`button`,disabled:u,onClick:()=>r(i),children:u?`Mapping…`:`Map this folder`})]})]})}function AK({scale:e,busy:t,onBrowse:n}){let r=e.suggestions.filter(e=>e.path!==`.`);return(0,$.jsxs)(`section`,{className:`picker-scale`,role:`alert`,"aria-labelledby":`picker-scale-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-scale-heading`,children:`That folder is too big to map at once.`}),(0,$.jsxs)(`p`,{children:[`It has `,e.file_count,` supported source files; Codemble maps up to`,` `,e.scale_cap,`. Choose a smaller scope — busiest first.`]}),r.length?(0,$.jsx)(`ul`,{className:`picker-scale-scopes`,children:r.map(r=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>n(`${e.root}/${r.path}`),children:[(0,$.jsxs)(`span`,{children:[r.path,`/`]}),(0,$.jsxs)(`small`,{children:[r.file_count,` files`]})]})},r.path))}):null,(0,$.jsx)(jK,{busy:t,onBrowse:n})]})}function jK({busy:e,onBrowse:t}){let[n,r]=(0,_.useState)(``);return(0,$.jsxs)(`form`,{className:`picker-path-entry`,onSubmit:e=>{e.preventDefault();let r=n.trim();r&&t(r)},children:[(0,$.jsx)(`label`,{htmlFor:`picker-path-input`,children:`Or type a folder path`}),(0,$.jsx)(`input`,{id:`picker-path-input`,type:`text`,value:n,disabled:e,placeholder:`/Users/you/project/src`,onChange:e=>r(e.target.value)}),(0,$.jsx)(`button`,{type:`submit`,disabled:e||!n.trim(),children:`Go`})]})}function MK({failure:e,busy:t,onSelect:n}){return(0,$.jsxs)(`section`,{className:`picker-failure`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`Codemble could not map that folder.`}),(0,$.jsx)(`p`,{children:`Nothing on disk changed, and no project's saved progress was touched. Try it again, or choose a different folder below.`}),(0,$.jsxs)(`p`,{className:`picker-failure__detail`,children:[(0,$.jsx)(`span`,{children:`What the parser reported`}),(0,$.jsx)(`code`,{children:e.detail})]}),(0,$.jsxs)(`button`,{className:`picker-select`,type:`button`,disabled:t,onClick:()=>n(e.path),children:[`Try `,(0,$.jsx)(`span`,{className:`picker-recent-path`,children:e.path}),` again`]})]})}function NK({layer:e,mode:t,onChange:n}){return(0,$.jsx)(`nav`,{className:`layer-switcher`,"aria-label":`View layer`,children:[{id:`galaxy`,label:`Galaxy`},{id:`map`,label:t===`easy`?`Diagram`:`Map`}].map(t=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e===t.id,onClick:()=>n(t.id),children:t.label},t.id))})}function PK({options:e,value:t,onChange:n}){return e.length<=2?null:(0,$.jsxs)(`nav`,{className:`language-focus`,"aria-label":`Language focus`,children:[(0,$.jsx)(`span`,{className:`language-focus__label`,children:`Focus`}),(0,$.jsx)(`div`,{children:e.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Focus ${e.label}: ${e.count} ${e.count===1?`system`:`systems`}`,"aria-pressed":t===e.id,title:e.label,onClick:()=>n(e.id),children:[(0,$.jsx)(`span`,{children:e.shortLabel}),(0,$.jsx)(`small`,{children:e.count})]},e.id))})]})}function FK({onConfirm:e}){let[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(``),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{t?c.current?.focus():l.current&&s.current?.focus(),l.current=t},[t]);function u(){n(!1),o(``)}async function d(){i(!0),o(``);try{await e()}catch(e){o(e.message),i(!1)}}return t?(0,$.jsxs)(`div`,{className:`switch-project`,role:`group`,"aria-label":`Switch project`,tabIndex:-1,ref:c,onKeyDown:e=>{e.key===`Escape`&&!r&&u()},children:[(0,$.jsx)(`p`,{children:`Progress is saved per project, so this galaxy comes back lit.`}),a?(0,$.jsx)(`p`,{className:`switch-project__error`,role:`alert`,children:a}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,disabled:r,onClick:d,children:r?`Releasing…`:`Switch`}),(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,disabled:r,onClick:u,children:`Cancel`})]})]}):(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,ref:s,onClick:()=>n(!0),children:`Switch project`})}function IK({candidates:e,nodes:t,selectedEntrypoint:n,error:r,onSelect:i,onContinue:a}){let o=new Map(t.map(e=>[e.id,e]));return(0,$.jsxs)(`aside`,{className:`entrypoint-picker`,"aria-labelledby":`entrypoint-heading`,children:[(0,$.jsx)(`p`,{children:`Home calibration`}),(0,$.jsx)(`h1`,{id:`entrypoint-heading`,children:e.length?`Where does your project start?`:`No clear entrypoint found.`}),(0,$.jsx)(`p`,{children:e.length?`The parser found ranked candidates but cannot choose one honestly. Select the structure you run.`:`No file here declares a startup structure the parser recognises, and Codemble will not guess one. Explore the map without Home — every system, check, explanation, and lens note still works.`}),e.length?(0,$.jsx)(`div`,{className:`entrypoint-candidates`,children:e.map(e=>{let t=o.get(e);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>i(e),children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsxs)(`small`,{children:[t?.file,`:`,t?.lineno,` · parser rank `,t?.entrypoint_rank]})]},e)})}):null,r?(0,$.jsx)(`p`,{className:`entrypoint-error`,role:`alert`,children:r}):null,(0,$.jsx)(`button`,{className:`entrypoint-continue`,type:`button`,onClick:a,children:n?`Keep current Home`:`Explore without Home`})]})}function LK({suite:e,error:t,mode:n,onClose:r,onSubmit:i}){let a=e?.checks.find(e=>!e.passed)??null,o=e?.checks.filter(e=>e.passed).length??0,[s,c]=(0,_.useState)(()=>new Set),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``);(0,_.useEffect)(()=>{c(new Set),u(null),g(``)},[a?.id]);function v(e,t){f(``),c(n=>{if(!t)return new Set([e]);let r=new Set(n);return r.has(e)?r.delete(e):r.add(e),r})}async function y(e){if(e.preventDefault(),!(!a||s.size===0)){m(!0),g(``);try{let e=await i(a.id,[...s]);e.correct?(f(e.message),u(null)):(f(``),u(e))}catch(e){g(e.message)}finally{m(!1)}}}return(0,$.jsxs)(`aside`,{className:`check-panel`,"aria-label":`Graph-derived understanding checks`,children:[(0,$.jsxs)(`header`,{className:`check-panel__header`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{children:`Active recall · graph only`}),(0,$.jsx)(`h1`,{children:e?.region_id??`Loading checks`})]}),(0,$.jsx)(`button`,{className:`check-close`,type:`button`,onClick:r,children:`Close`})]}),t||h?(0,$.jsxs)(`div`,{className:`check-state`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`The checks did not load.`}),(0,$.jsxs)(`p`,{children:[t||h,` The galaxy remains available.`]})]}):null,!e&&!t?(0,$.jsx)(`p`,{className:`check-loading`,role:`status`,children:`Deriving answers from parser edges…`}):null,e?.region_understood?(0,$.jsxs)(`div`,{className:`check-complete`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`check-complete__star`,"aria-hidden":`true`,children:`✦`}),(0,$.jsx)(`h2`,{children:`System lit.`}),(0,$.jsx)(`p`,{children:`This region's source hash matches the checks you passed. Edit its file and only this system will dim again.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:r,children:`Return to the system`})]}):null,e&&!e.region_understood&&e.checks.length===0?(0,$.jsxs)(`div`,{className:`check-state`,children:[(0,$.jsx)(`h2`,{children:`No safe check yet.`}),(0,$.jsx)(`p`,{children:`Every question here is answered by the parser graph, and this region has no certain relationship Codemble can build one from. It stays dim rather than lighting on a question that would prove nothing. Import this module somewhere, or call something inside it, and its checks appear.`})]}):null,a&&!e.region_understood?(0,$.jsxs)(`form`,{className:`active-check`,onSubmit:y,children:[(0,$.jsxs)(`div`,{className:`check-progress`,children:[(0,$.jsxs)(`span`,{children:[`Check `,o+1,` of `,e.checks.length]}),(0,$.jsx)(`progress`,{value:o,max:e.checks.length})]}),d?(0,$.jsxs)(`p`,{className:`check-affirmation`,role:`status`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),` `,d]}):null,(0,$.jsxs)(`fieldset`,{children:[(0,$.jsx)(`legend`,{children:a.prompt_voices[n]}),a.multiple?(0,$.jsx)(`p`,{children:`Select every answer supported by the graph.`}):null,(0,$.jsx)(`div`,{className:`check-options`,children:a.options.map(e=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:a.multiple?`checkbox`:`radio`,name:`answer-${a.id}`,value:e.id,checked:s.has(e.id),onChange:()=>v(e.id,a.multiple)}),(0,$.jsx)(`span`,{children:e.label})]},e.id))})]}),l&&!l.correct?(0,$.jsxs)(`div`,{className:`check-feedback`,role:`status`,children:[(0,$.jsx)(`strong`,{children:l.message}),(0,$.jsxs)(`span`,{children:[`Parser answer: `,l.answer_labels.join(`, `)]}),(0,$.jsxs)(`span`,{children:[`Evidence: `,l.evidence.join(`, `)]})]}):null,(0,$.jsx)(`button`,{className:`check-primary`,type:`submit`,disabled:!s.size||p,children:p?`Checking parser evidence…`:`Check answer`})]}):null]})}function RK({chart:e,studiedCount:t,projectName:n,onClearProgress:r}){let i=e.filter(e=>e.understood_nodes>0).length;return(0,$.jsxs)(`section`,{className:`star-chart-screen`,"aria-labelledby":`star-chart-heading`,children:[(0,$.jsxs)(`header`,{className:`star-chart-intro`,children:[(0,$.jsx)(`p`,{children:`Parser-detected concepts`}),(0,$.jsx)(`h1`,{id:`star-chart-heading`,children:`Your language star chart.`}),(0,$.jsx)(`p`,{children:`Encountered comes from real syntax. Studied tracks this session. Understood lights only after graph-derived checks pass.`}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Concepts encountered`}),(0,$.jsx)(`dd`,{children:e.length})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Studied this session`}),(0,$.jsx)(`dd`,{children:t})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Concepts understood`}),(0,$.jsx)(`dd`,{children:i})]})]})]}),(0,$.jsx)(`div`,{className:`concept-ledger`,role:`list`,"aria-label":`Language concept progress`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`concept-row`,role:`listitem`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:fG(e.concept)}),(0,$.jsxs)(`span`,{children:[fG(e.language),` · `,e.occurrences,` parser `,e.occurrences===1?`occurrence`:`occurrences`]})]}),(0,$.jsx)(`div`,{className:`concept-meter`,"aria-label":`${e.understood_nodes} of ${e.nodes} structures understood`,children:(0,$.jsx)(`span`,{style:{width:`${e.nodes?e.understood_nodes/e.nodes*100:0}%`}})}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Studied (session)`}),(0,$.jsxs)(`dd`,{children:[e.studied_nodes,`/`,e.nodes]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Understood`}),(0,$.jsxs)(`dd`,{children:[e.understood_nodes,`/`,e.nodes]})]})]})]},`${e.language}:${e.concept}`))}),(0,$.jsx)(zK,{projectName:n,onConfirm:r})]})}function zK({projectName:e,onConfirm:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(``),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{n?l.current?.focus():u.current&&c.current?.focus(),u.current=n},[n]);function d(){r(!1),s(``)}async function f(){a(!0),s(``);try{await t(),r(!1)}catch(e){s(e.message)}finally{a(!1)}}return n?(0,$.jsxs)(`section`,{className:`progress-reset progress-reset--confirming`,role:`group`,"aria-label":`Clear this project's progress`,tabIndex:-1,ref:l,onKeyDown:e=>{e.key===`Escape`&&!i&&d()},children:[(0,$.jsxs)(`p`,{role:`alert`,children:[`This dims every system you lit in `,e,` and cannot be undone. Your other projects keep their progress, and no source file is touched.`]}),o?(0,$.jsx)(`p`,{className:`progress-reset__error`,role:`alert`,children:o}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`button`,{className:`check-primary progress-reset__confirm`,type:`button`,disabled:i,onClick:f,children:i?`Clearing…`:`Yes, clear ${e}`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,disabled:i,onClick:d,children:`Keep it`})]})]}):(0,$.jsxs)(`section`,{className:`progress-reset`,children:[(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,ref:c,onClick:()=>r(!0),children:`Clear this project's progress`}),(0,$.jsxs)(`p`,{children:[`Start `,e,` over with every system dim again.`]})]})}var BK=class extends _.Component{constructor(e){super(e),this.state={message:``}}static getDerivedStateFromError(e){return{message:e instanceof Error?e.message:String(e)}}componentDidCatch(e,t){console.error(`Codemble stopped rendering:`,e,t?.componentStack)}render(){return this.state.message?(0,$.jsxs)(`main`,{className:`load-state`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The galaxy stopped rendering.`}),(0,$.jsx)(`p`,{children:this.state.message}),(0,$.jsx)(`p`,{children:`Your progress is saved on this machine; reloading re-reads it.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>window.location.reload(),children:`Reload Codemble`})]}):this.props.children}};(0,v.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(_.StrictMode,{children:(0,$.jsx)(BK,{children:(0,$.jsx)(TK,{})})}));
|
|
5352
|
+
}`})}};UW.BlurDirectionX=new L(1,0),UW.BlurDirectionY=new L(0,1);var WW=.9,GW=.45,KW=.52,qW=1600;function JW(e){let t=e.postProcessingComposer(),n=new UW(new L(t._width??1,t._height??1),WW,GW,KW),r=n.setSize.bind(n);n.setSize=(e,t)=>{let n=Math.min(1,qW/Math.max(e,t,1));r(Math.max(1,Math.round(e*n)),Math.max(1,Math.round(t*n)))},t.addPass(n);let i=new Ez(xz);return t.addPass(i),{pass:n,composer:t,dispose(){t.removePass(i),i.dispose(),t.removePass(n),n.dispose()}}}var YW=1200;function XW(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function ZW({scene:e,regionId:t,palette:n}){if(XW())return()=>{};let r=e.getObjectByName(`codemble-system-${t}`);if(!r)return()=>{};let i=[];r.traverse(e=>{e.isSprite&&i.push([e,e.material.opacity,e.scale.x])});let a=new B(n.star),o=i.map(([e])=>e.material.color.clone()),s=0,c=performance.now(),l=()=>{let e=Math.min(1,(performance.now()-c)/YW);1-(1-e)**3;let t=Math.sin(e*Math.PI);if(i.forEach(([e,n,r],i)=>{e.material.color.copy(o[i]).lerp(a,t*.85),e.material.opacity=n+t*.5,e.scale.setScalar(r*(1+t*.45))}),e<1){s=requestAnimationFrame(l);return}i.forEach(([e,t,n],r)=>{e.material.color.copy(o[r]),e.material.opacity=t,e.scale.setScalar(n)})};return s=requestAnimationFrame(l),()=>{cancelAnimationFrame(s),i.forEach(([e,t,n],r)=>{e.material.color.copy(o[r]),e.material.opacity=t,e.scale.setScalar(n)})}}var QW=128,$W=256;function eG(e,t){let n=document.createElement(`canvas`);n.width=e,n.height=e;let r=n.getContext(`2d`),i=r.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);for(let[e,n]of t)i.addColorStop(e,`rgba(255, 255, 255, ${n})`);r.fillStyle=i,r.fillRect(0,0,e,e);let a=new Ra(n);return a.colorSpace=lt,a}function tG(e){let t=document.createElement(`canvas`);t.width=e,t.height=e;let n=t.getContext(`2d`);n.strokeStyle=`rgba(255, 255, 255, 1)`,n.lineWidth=e*.05,n.beginPath(),n.arc(e/2,e/2,e*.4,0,Math.PI*2),n.stroke();let r=new Ra(t);return r.colorSpace=lt,r}function nG(e){let t=[];function n(e){let n=e.dispose.bind(e);return e.dispose=()=>{},t.push(n),e}let r=n(eG(QW,[[0,.85],[.25,.42],[.6,.1],[1,0]])),i=n(eG($W,[[0,.32],[.45,.14],[.8,.03],[1,0]])),a=n(tG(QW)),o=new Map,s=new Map;function c(t){return o.has(t)||o.set(t,n(new Si({map:r,color:new B(t).multiply(new B(e.starHalo)),blending:2,transparent:!0,depthWrite:!1,opacity:.6}))),o.get(t)}return{halo(e,t){let n=new Ii(c(e.color));return n.scale.setScalar(t*6.5),n.renderOrder=-1,n},nebula(e,t){s.has(e)||s.set(e,n(new Si({map:i,color:new B(e),blending:2,transparent:!0,depthWrite:!1,opacity:.16})));let r=new Ii(s.get(e));return r.scale.setScalar(t),r.renderOrder=-2,r},reticle(t){let n=new Ii(new Si({map:a,color:new B(e.orbit),transparent:!0,depthWrite:!1,depthTest:!1}));return n.scale.setScalar(t*5),n.renderOrder=3,n},dispose(){for(let e of t)e();t.length=0,o.clear(),s.clear()}}}function rG(e){return Object.entries(e??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}:${t}`).join(`|`)}function iG(e){let t=e>>>0;return function(){t=t+1831565813>>>0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function aG(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function oG(e,t,n=1400,r=1600){let i=iG(aG(e)),a=new Float32Array(n*3);for(let e=0;e<n;e+=1){let t=i()*Math.PI*2,n=Math.acos(2*i()-1),o=r*(.65+i()*.35);a[e*3]=o*Math.sin(n)*Math.cos(t),a[e*3+1]=o*Math.cos(n),a[e*3+2]=o*Math.sin(n)*Math.sin(t)}let o=new gi;o.setAttribute(`position`,new ei(a,3));let s=new Pa(o,new ka({color:new B(t.nodeDim),size:2.2,sizeAttenuation:!0,transparent:!0,opacity:.5,depthWrite:!1}));return s.name=`codemble-starfield`,s}var sG=Object.freeze({GALAXY:`GALAXY`,SYSTEM:`SYSTEM`,STUDY:`STUDY`});function cG(e,t){if(!t||t===`all`)return e;let n=e.nodes.filter(e=>e.language===t),r=new Set(n.map(e=>e.id)),i=new Set(e.nodes.map(e=>e.id)),a=new Set(n.map(e=>e.region)),o=new Set(n.map(e=>e.file));return{...e,nodes:n,edges:e.edges.filter(e=>r.has(e.src)&&(r.has(e.dst)||e.external||!i.has(e.dst))),entrypoint_candidates:e.entrypoint_candidates.filter(e=>r.has(e)),selected_entrypoint:r.has(e.selected_entrypoint)?e.selected_entrypoint:null,file_hashes:Object.fromEntries(Object.entries(e.file_hashes).filter(([e])=>o.has(e))),concept_annotations:e.concept_annotations.filter(e=>e.language===t&&r.has(e.node_id)),regions:e.regions.filter(e=>a.has(e.id)),region_edges:e.region_edges.filter(e=>a.has(e.src)&&a.has(e.dst)),partial_files:e.partial_files.filter(e=>o.has(e))}}function lG(e,t){if(!e||!t||t===`all`)return e;let n=e.architecture,r=n.boxes.filter(e=>e.language===t),i=new Set(r.map(e=>e.id)),a=e.workflow,o=`${t}:`;return{...e,architecture:{...n,boxes:r,edges:n.edges.filter(e=>i.has(e.src)&&i.has(e.dst)),unreachable:n.unreachable.filter(e=>i.has(e))},workflow:{...a,nodes:a.nodes.filter(e=>e.language===t),unreachable:a.unreachable.filter(e=>e.startsWith(o))}}}function uG(e){let t=new Map;for(let n of e.regions)t.set(n.language,(t.get(n.language)??0)+1);let n=[...t].map(([e,t])=>({id:e,label:pG(e),shortLabel:mG(e),count:t})).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`all`,label:`All languages`,shortLabel:`All`,count:e.regions.length},...n]}function dG(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map;for(let i of e.concept_annotations??[]){let e=`${i.language}:${i.concept}`,a=r.get(e)??{language:i.language,concept:i.concept,occurrences:0,nodeIds:new Set,studiedNodeIds:new Set,understoodNodeIds:new Set};a.occurrences+=1,a.nodeIds.add(i.node_id),t.has(i.node_id)&&a.studiedNodeIds.add(i.node_id),n.get(i.node_id)?.understood&&a.understoodNodeIds.add(i.node_id),r.set(e,a)}return[...r.values()].map(e=>({language:e.language,concept:e.concept,occurrences:e.occurrences,nodes:e.nodeIds.size,studied_nodes:e.studiedNodeIds.size,understood_nodes:e.understoodNodeIds.size})).sort((e,t)=>e.language.localeCompare(t.language)||e.concept.localeCompare(t.concept))}function fG(e){let t={javascript:`JavaScript`,jsx:`JSX`,typescript:`TypeScript`};return t[e]?t[e]:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function pG(e){return fG(e)}function mG(e){return e===`javascript`?`JS`:e===`typescript`?`TS`:pG(e)}function hG(e){return e===`python`?`nebPython`:e===`javascript`?`nebJs`:e===`typescript`?`nebTs`:null}var gG=5,_G=2;function vG(e,t){return{nodes:e.regions.map(n=>({...n,kind:`region`,name:n.id,fx:n.x,fy:n.y,fz:n.z,val:CG(n.loc,5,24),color:n.understood?t.star:e.nodes.some(e=>e.region===n.id&&e.partial)?t.routePossible:wG(n.centrality,t,gG),focusDim:!1})),links:e.region_edges.map(e=>({...e,source:e.src,target:e.dst,color:e.certain?t.route:t.routePossible,focusDim:!1}))}}function yG(e,t,n,{selectedId:r=null}={}){let i=e.nodes.filter(e=>e.region===t),a=new Set(i.map(e=>e.id)),o=e.edges.filter(e=>e.kind===`call`&&!e.external&&a.has(e.src)&&a.has(e.dst)),s=new Set(r?[r]:[]);if(r)for(let e of o)e.src===r&&s.add(e.dst),e.dst===r&&s.add(e.src);return{nodes:i.map(e=>({...e,fx:e.system_x,fy:e.system_y,fz:e.system_z,val:CG(e.loc,2.8,11),color:e.understood?n.star:e.partial?n.routePossible:wG(e.centrality,n,_G),selected:e.id===r,focusDim:!!r&&!s.has(e.id)})),links:o.map(e=>({...e,source:e.src,target:e.dst,color:e.certain?n.route:n.routePossible,focusDim:!!r&&e.src!==r&&e.dst!==r}))}}function bG(e){return e.regions.find(e=>e.home)??e.regions[0]??null}function xG(e){let t=e.kind===`region`?`star system`:e.kind,n=e.partial?` · unchartable · syntax error`:``,r=e.home?` · Home`:``;return`${e.name} · ${t} · ${e.loc} LOC${r}${n}`}function SG(e){let t=e.kind===`import`?`import`:e.kind===`call`?`call`:`import route`,n=e.certain?`certain`:t===`call`?`possible call`:`possible import`,r=typeof e.weight==`number`?` · ${e.weight} ${e.weight===1?`import`:`imports`}`:``,i=typeof e.lineno==`number`?` · line ${e.lineno}`:``;return`${e.src} → ${e.dst} · ${t} · ${n}${r}${i}`}function CG(e,t,n){return Math.min(n,Math.max(t,Math.sqrt(Math.max(1,e))*1.15))}function wG(e,t,n){return e>=n?t.nodeBright:e>=1?t.node:t.nodeDim}var TG=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=TG()}))(),EG=420,DG=1.6,OG=6;function kG({graph:e,level:t,region:n,selectedNode:r,hoverNodeId:i,pendingDawnRegionId:a,mode:o,onHoverNode:s,onAdvance:c,onRetreat:l,onDawnConsumed:u}){let d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(c),m=(0,_.useRef)(l),h=(0,_.useRef)(s),g=(0,_.useRef)(a),v=(0,_.useRef)(u),y=(0,_.useRef)(null),b=(0,_.useRef)({activeId:null,neighborIds:new Set}),x=(0,_.useRef)(0),S=(0,_.useRef)(null),C=(0,_.useRef)(null),w=(0,_.useRef)(null),[T,E]=(0,_.useState)(0),[D,O]=(0,_.useState)(``),k=(0,_.useMemo)(NG,[]),A=(0,_.useMemo)(XW,[]),ee=rG(e.file_hashes),te=(0,_.useMemo)(()=>t===sG.GALAXY?vG(e,k):yG(e,n?.id,k,{selectedId:r?.id}),[e,t,k,n?.id,r?.id]);(0,_.useEffect)(()=>{p.current=c,m.current=l,h.current=s,g.current=a,v.current=u},[c,l,s,a,u]);function ne(e){let{activeId:t,neighborIds:n}=b.current;return t?e.id===t?k.orbit:n.has(e.id)?e.color:k.faded:e.color}function re(e){if(e.focusDim)return k.faded;let{activeId:t,neighborIds:n}=b.current,r=e.certain?k.route:k.routePossible;if(!t)return r;let i=jG(e.source),a=jG(e.target);return i===t||a===t?k.orbit:n.has(i)&&n.has(a)?r:k.faded}function ie(e){if(e.focusDim)return .4;let{activeId:t}=b.current,n=Math.min(2.2,.45+(e.weight??1)*.25);if(!t)return n;let r=jG(e.source),i=jG(e.target);return r===t||i===t?n+.9:n}(0,_.useEffect)(()=>{let e=d.current;if(!e)return;let t=document.createElement(`canvas`);if(!t.getContext(`webgl2`)&&!t.getContext(`webgl`)){O(`Codemble needs WebGL to draw your galaxy. Enable WebGL and reload.`);return}try{let t=nG(k);S.current=t;let n=BW()(e).backgroundColor(k.ground).showNavInfo(!1).enableNavigationControls(!1).warmupTicks(0).cooldownTicks(0).nodeId(`id`).nodeLabel(xG).nodeVal(`val`).nodeColor(ne).nodeRelSize(DG).nodeResolution(8).nodeOpacity(.82).nodeThreeObject(e=>AG(e,k,t,w.current)).nodeThreeObjectExtend(!0).linkColor(re).linkLabel(SG).linkOpacity(.32).linkWidth(ie).linkCurvature(.12).linkVisibility(e=>!(o===`easy`&&e.focusDim)).linkHoverPrecision(4).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(re).linkDirectionalParticles(e=>e.kind===`call`&&e.certain&&!e.focusDim&&!A?2:0).linkDirectionalParticleSpeed(.006).linkDirectionalParticleWidth(1.1).linkDirectionalParticleColor(()=>k.orbit).onNodeHover(t=>{e.style.cursor=t?`pointer`:`default`,h.current(t?.id??null)}).onNodeClick(e=>p.current(e)),r=requestAnimationFrame(()=>{e.querySelector(`.scene-nav-info`)?.remove()});C.current=JW(n),f.current=n;let i=new ResizeObserver(([e])=>{n.width(e.contentRect.width).height(e.contentRect.height)});return i.observe(e),()=>{i.disconnect(),cancelAnimationFrame(r),n.pauseAnimation(),C.current?.dispose(),C.current=null,n._destructor(),t.dispose(),S.current=null,e.replaceChildren(),f.current=null}}catch(e){O(`The galaxy could not start: ${e.message}`);return}},[k]),(0,_.useEffect)(()=>{let e=f.current;e&&(e.nodeResolution(te.nodes.length>=900?4:8).linkVisibility(e=>!(o===`easy`&&e.focusDim)).linkDirectionalArrowLength(t===sG.GALAXY?0:3.2).graphData(te),t===sG.GALAXY?e.cameraPosition({x:0,y:105,z:310},{x:0,y:0,z:0},EG):e.cameraPosition({x:0,y:52,z:150},{x:0,y:0,z:0},EG),E(0))},[te,t,o]),(0,_.useEffect)(()=>{w.current=te.nodes[T]?.id??null,f.current?.refresh()},[te.nodes,T]),(0,_.useEffect)(()=>{let e=f.current;if(!e)return;let t=e.scene(),n=t.getObjectByName(`codemble-starfield`);n&&(t.remove(n),n.geometry.dispose(),n.material.dispose());let r=oG(ee,k);return t.add(r),()=>{t.remove(r),r.geometry.dispose(),r.material.dispose()}},[ee,k]),(0,_.useEffect)(()=>{let e=f.current;if(!e||t!==sG.GALAXY)return;let n=g.current;if(!n||y.current===n)return;y.current=n,v.current?.(n);let r=!1,i=()=>{},a=t=>{if(r)return;let s=e.scene();if(s.getObjectByName(`codemble-system-${n}`)||t>=OG){i=ZW({scene:s,regionId:n,palette:k});return}o=requestAnimationFrame(()=>a(t+1))},o=requestAnimationFrame(()=>a(0));return()=>{r=!0,cancelAnimationFrame(o),i()}},[t,k]),(0,_.useEffect)(()=>{let e=i??(t===sG.STUDY?r?.id??null:null),n=new Set;if(e)for(let t of te.links){let r=jG(t.source),i=jG(t.target);r===e&&n.add(i),i===e&&n.add(r)}b.current={activeId:e,neighborIds:n};let a=f.current;a&&a.nodeColor(a.nodeColor()).linkColor(a.linkColor()).linkWidth(a.linkWidth()).linkDirectionalArrowColor(a.linkDirectionalArrowColor())},[te,i,t,r?.id]),(0,_.useEffect)(()=>{if(!new URLSearchParams(window.location.search).has(`benchmark`)||te.nodes.length<900)return;document.documentElement.removeAttribute(`data-codemble-fps`);let e=setTimeout(()=>{let e=f.current;if(!e)return;let t=e.renderer(),n=e.postProcessingComposer(),r=performance.now();for(let e=0;e<60;e+=1)n.render();t.getContext().finish();let i=performance.now()-r;document.documentElement.dataset.codembleFps=(60*1e3/i).toFixed(1)},1e3);return()=>clearTimeout(e)},[te.nodes.length]),(0,_.useEffect)(()=>{!r||!f.current||t!==sG.STUDY||f.current.cameraPosition({x:r.system_x+20,y:r.system_y+15,z:r.system_z+42},{x:r.system_x,y:r.system_y,z:r.system_z},EG)},[t,r]);let j=te.nodes[T]??null;function M(e){e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),E(e=>(e+1)%Math.max(1,te.nodes.length))):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),E(e=>(e-1+te.nodes.length)%Math.max(1,te.nodes.length))):e.key===`Enter`&&j?(e.preventDefault(),p.current(j)):(e.key===`Escape`||e.key===`Backspace`)&&(e.preventDefault(),m.current())}function ae(e){let t=performance.now();t<x.current||Math.abs(e.deltaY)<24||(x.current=t+620,e.deltaY>0&&j&&p.current(j),e.deltaY<0&&m.current())}return D?(0,$.jsxs)(`section`,{className:`webgl-error`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The sky could not open.`}),(0,$.jsx)(`p`,{children:D}),(0,$.jsxs)(`p`,{children:[`The `,o===`easy`?`Diagram`:`Map`,` layer works without WebGL — switch to it at the top of the window to explore the same code.`]})]}):(0,$.jsxs)(`div`,{className:`galaxy-frame`,role:`application`,tabIndex:`0`,"aria-label":`Codemble ${t.toLowerCase()} view. Use arrow keys to choose a node and Enter to move closer.`,onKeyDown:M,onWheel:ae,children:[(0,$.jsx)(`div`,{ref:d,className:`galaxy-canvas`,"aria-hidden":`true`}),j?(0,$.jsx)(`output`,{className:`keyboard-focus`,"aria-live":`polite`,children:xG(j)}):null]})}function AG(e,t,n,r){let i=new lr;i.name=e.kind===`region`?`codemble-system-${e.id}`:`codemble-node-${e.id}`;let a=Math.cbrt(e.val??1)*DG;if(e.focusDim||i.add(n.halo(e,a)),e.kind===`region`){let r=hG(e.language);r&&i.add(n.nebula(t[r],a*14))}if(e.home){let e=new ia(new xo(a*1.7,Math.max(.18,a*.07),8,36),new Ki({color:t.home}));e.rotation.x=Math.PI/2.8,i.add(e)}if(e.selected){let e=new ia(new xo(a*2.1,Math.max(.16,a*.05),6,24),new Ki({color:t.orbit}));e.rotation.x=Math.PI/2.8,i.add(e)}return e.id===r&&i.add(n.reticle(a)),i}function jG(e){return typeof e==`object`&&e?e.id:e}function MG(e){let t=document.createElement(`canvas`).getContext(`2d`);t.fillStyle=`#000000`,t.fillStyle=e,t.fillRect(0,0,1,1);let[n,r,i]=t.getImageData(0,0,1,1).data;return`rgb(${n}, ${r}, ${i})`}function NG(){let e=getComputedStyle(document.documentElement),t=t=>MG(e.getPropertyValue(t).trim());return Object.freeze({ground:t(`--cm-ground`),home:t(`--cm-ink`),orbit:t(`--cm-orbit`),nodeBright:t(`--cm-ink-2`),node:t(`--cm-ink-3`),nodeDim:t(`--cm-node-unlit`),route:t(`--cm-hairline`),routePossible:t(`--cm-route-possible`),faded:t(`--cm-hairline-soft`),star:t(`--cm-star-high`),starHalo:t(`--cm-star-halo`),nebPython:t(`--cm-neb-python`),nebJs:t(`--cm-neb-js`),nebTs:t(`--cm-neb-ts`)})}function PG({hint:e,onStudy:t}){return e?(0,$.jsxs)(`output`,{className:`hint-chip`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),(0,$.jsxs)(`span`,{children:[`Study `,(0,$.jsx)(`strong`,{children:e.regionId}),` next`]}),(0,$.jsx)(`small`,{children:e.reason}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>t(e.regionId),children:`Take me there`})]}):null}var FG=[{title:`What you see`,body:`Every star system is one file. Size is how much code it holds; brightness is how many places in your project call it.`},{title:`How to move`,body:`Scroll or press Enter to move closer, Escape to move back. Arrow keys step between systems. The camera stays on rails — you cannot get lost.`},{title:`What lights stars`,body:`A system lights up only after you answer questions drawn from your own code. Nothing lights up just by looking at it.`}],IG=[{title:`What you see`,body:`Every box is one file, placed by how your imports connect them. A dashed link is a relationship the parser could not fully prove.`},{title:`How to move`,body:`Click a box to study that module. The tabs above show how it fits together and what runs first. Switch to the Galaxy anytime to fly through the same code.`},{title:`What lights up`,body:`A module lights up only after you answer questions drawn from your own code. Nothing lights up just by looking at it.`}];function LG({layer:e,onDismiss:t}){let[n,r]=(0,_.useState)(0),i=(0,_.useRef)(null),a=e===`map`?IG:FG,o=a[n];(0,_.useLayoutEffect)(()=>{let e=i.current;e&&!e.open&&e.showModal()},[]);function s(){i.current?.close(),t()}return(0,$.jsxs)(`dialog`,{ref:i,className:`coach-marks`,"aria-labelledby":`coach-heading`,onCancel:e=>{e.preventDefault(),s()},children:[(0,$.jsxs)(`p`,{className:`coach-marks__progress`,children:[`Step `,n+1,` of `,a.length]}),(0,$.jsx)(`h1`,{id:`coach-heading`,children:o.title}),(0,$.jsx)(`p`,{children:o.body}),(0,$.jsxs)(`div`,{className:`coach-marks__actions`,children:[(0,$.jsx)(`button`,{type:`button`,className:`coach-skip`,onClick:s,children:`Skip`}),(0,$.jsx)(`button`,{type:`button`,className:`check-primary`,onClick:()=>n+1<a.length?r(n+1):s(),children:n+1<a.length?`Next`:`Start exploring`})]})]})}var RG={nebPython:`var(--cm-neb-python)`,nebJs:`var(--cm-neb-js)`,nebTs:`var(--cm-neb-ts)`};function zG(e){let t=hG(e);return t?RG[t]:`var(--cm-hairline)`}var BG=13,VG=.62,HG=14,UG=10;function WG(e,t){let n=t-HG-UG,r=Math.max(1,Math.floor(n/(BG*VG)));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function GG({data:e,mapTab:t,mode:n,selectedRegionId:r,hasEntrypointCandidates:i,error:a,onSelectTab:o,onSelectRegion:s,onSelectNode:c,onRetry:l}){return(0,$.jsxs)(`section`,{className:`map-view`,"aria-label":`Two-dimensional project map`,children:[(0,$.jsxs)(`nav`,{className:`map-tabs`,"aria-label":`Map view`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t===`architecture`,onClick:()=>o(`architecture`),children:n===`easy`?`How it fits together`:`Architecture`}),(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t===`workflow`,onClick:()=>o(`workflow`),children:n===`easy`?`What runs first`:`Workflow`})]}),a?(0,$.jsxs)(`div`,{className:`map-state`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`The map did not load.`}),(0,$.jsxs)(`p`,{children:[a,` The galaxy layer is unaffected.`]}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:l,children:`Try again`})]}):e?t===`architecture`?(0,$.jsx)(KG,{architecture:e.architecture,mode:n,selectedRegionId:r,hasEntrypointCandidates:i,onSelectRegion:s}):(0,$.jsx)(qG,{workflow:e.workflow,mode:n,selectedRegionId:r,hasEntrypointCandidates:i,onSelectNode:c}):(0,$.jsx)(`p`,{className:`map-loading`,role:`status`,children:`Laying out parser evidence…`})]})}function KG({architecture:e,mode:t,selectedRegionId:n,hasEntrypointCandidates:r,onSelectRegion:i}){let a=new Map(e.boxes.map(e=>[e.id,e]));return(0,$.jsxs)(`div`,{className:`map-scroll`,children:[(0,$.jsxs)(`svg`,{className:`architecture-map`,viewBox:`-32 -32 ${e.width+64} ${e.height+64}`,role:`group`,"aria-label":e.home?`${e.boxes.length} modules in ${e.layer_count} import layers from Home`:`${e.boxes.length} modules in ${e.layer_count} import layers, measured from the modules nothing imports`,children:[(0,$.jsx)(`g`,{className:`architecture-map__edges`,children:e.edges.map(e=>{let t=a.get(e.src),n=a.get(e.dst);return!t||!n?null:(0,$.jsx)(`line`,{x1:t.x+t.width/2,y1:t.y+t.height,x2:n.x+n.width/2,y2:n.y,strokeDasharray:e.certain?void 0:`5 4`,className:e.cycle?`is-cycle`:void 0},`${e.src}->${e.dst}`)})}),e.boxes.map(e=>(0,$.jsxs)(`g`,{className:`architecture-map__box`,"data-understood":e.understood,"data-home":e.home,"data-reachable":e.reachable,"data-partial":e.partial,"data-selected":e.id===n,transform:`translate(${e.x} ${e.y})`,role:`button`,tabIndex:0,"aria-label":`${e.label}, ${e.node_count} structures, ${e.loc} lines${e.understood?`, understood`:`, not yet understood`}${e.home?`, Home`:``}${e.reachable?``:`, no import route from Home`}${e.partial?`, unchartable, syntax error`:``}`,onClick:()=>i(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e.id))},children:[(0,$.jsxs)(`title`,{children:[e.label,e.partial?` — unchartable, syntax error`:``]}),(0,$.jsx)(`rect`,{width:e.width,height:e.height,rx:`3`}),(0,$.jsx)(`rect`,{className:`box-tint`,width:`4`,height:e.height,fill:zG(e.language)}),e.partial?(0,$.jsx)(`path`,{className:`box-partial`,d:`M ${e.width-16} 2 L ${e.width-2} 2 L ${e.width-2} 16 Z`}):null,(0,$.jsx)(`text`,{x:HG,y:`24`,children:WG(e.label,e.width)}),(0,$.jsx)(`text`,{className:`box-meta`,x:`14`,y:`42`,children:t===`easy`?`${e.node_count} ${e.node_count===1?`piece`:`pieces`}`:`${e.node_count} nodes · ${e.loc} LOC`})]},e.id))]}),e.home?null:(0,$.jsxs)(`p`,{className:`map-note`,children:[`No Home is selected, so these layers run from the modules nothing else imports rather than from your entrypoint. Both are read from your imports, not guessed.`,` `,r?`Pick your starting point with “Change Home” to see the same modules layered by what the project runs first.`:`This project has no parser-recognisable entrypoint, so there is no “runs first” order to layer by instead.`]}),e.unreachable.length?(0,$.jsxs)(`p`,{className:`map-note`,children:[e.unreachable.length,` `,e.unreachable.length===1?`module has`:`modules have`,` no import route from Home, so `,e.unreachable.length===1?`it sits`:`they sit`,` `,`in the bottom row rather than being placed by guesswork.`]}):null]})}function qG({workflow:e,mode:t,selectedRegionId:n,hasEntrypointCandidates:r,onSelectNode:i}){if(!e.root)return r?(0,$.jsxs)(`div`,{className:`map-state`,children:[(0,$.jsx)(`h2`,{children:`No Home is selected.`}),(0,$.jsx)(`p`,{children:`The workflow tree starts at your entrypoint. Pick Home and this tab will show what runs first, then what that calls.`})]}):(0,$.jsxs)(`div`,{className:`map-state`,children:[(0,$.jsx)(`h2`,{children:`No “runs first” order to show.`}),(0,$.jsx)(`p`,{children:`This project has no parser-recognisable entrypoint — nothing here declares a startup structure Codemble recognises, and it will not guess one. The other tab still maps how your modules import each other.`})]});let a=new Map(e.nodes.map(e=>[e.order,e]));return(0,$.jsxs)(`div`,{className:`map-scroll`,children:[(0,$.jsxs)(`svg`,{className:`workflow-tree`,viewBox:`-16 -16 ${e.width+32} ${e.height+32}`,role:`group`,"aria-label":`Call tree from ${e.root}, ${e.nodes.length} steps deep to ${e.depth_count} levels`,children:[(0,$.jsx)(`g`,{className:`workflow-tree__edges`,children:e.nodes.map(e=>{if(e.parent===null)return null;let t=[...a.values()].filter(t=>t.id===e.parent&&t.order<e.order).at(-1);return t?(0,$.jsx)(`path`,{d:`M ${t.x+8} ${t.y+20} V ${e.y+12} H ${e.x+8}`,strokeDasharray:e.certain?void 0:`5 4`},`${e.order}`):null})}),e.nodes.map(e=>(0,$.jsxs)(`g`,{className:`workflow-tree__row`,"data-understood":e.understood,"data-cut":e.cut??void 0,"data-partial":e.partial,"data-relation":e.relation,"data-selected":e.region===n,transform:`translate(${e.x} ${e.y})`,role:`button`,tabIndex:0,"aria-label":`${e.label} at ${e.file}:${e.lineno}${e.certain?``:`, possible call`}${e.cut===`cycle`?`, repeats an earlier step`:``}${e.cut===`repeat`?`, already shown above`:``}${e.partial?`, unchartable, syntax error`:``}`,onClick:()=>i(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e.id))},children:[(0,$.jsx)(`circle`,{cx:`8`,cy:`16`,r:`4`}),(0,$.jsx)(`text`,{x:`20`,y:`20`,children:e.label}),(0,$.jsxs)(`text`,{className:`row-meta`,x:`20`,y:`20`,dx:`${e.label.length*.62}em`,children:[e.relation===`defines`?t===`easy`?` — lives here`:` — defined in this module`:e.certain?``:` — possible call`,e.cut===`cycle`?` — loops back`:``,e.cut===`repeat`?` — shown above`:``,e.partial?t===`easy`?` — could not be read`:` — unchartable`:``]})]},e.order))]}),e.unreachable.length?(0,$.jsxs)(`p`,{className:`map-note`,children:[e.unreachable.length,` `,e.unreachable.length===1?`structure is`:`structures are`,` never reached from Home by a parser-proven call. They are listed as unreached rather than attached to the tree by guesswork.`]}):null]})}var JG=[{mode:`easy`,label:`New to coding?`},{mode:`expert`,label:`I build software`}],YG=[{mode:`easy`,label:`Easy`},{mode:`expert`,label:`Expert`}];function XG({mode:e,modeChosen:t,onChoose:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(t);(0,_.useLayoutEffect)(()=>{let e=r.current;e&&t===!1&&!e.open&&e.showModal()},[t]),(0,_.useEffect)(()=>{t===!0&&a.current===!1&&i.current?.focus(),a.current=t},[t]);function o(e){r.current?.close(),n(e)}return t===null?null:t?(0,$.jsxs)(`fieldset`,{className:`mode-toggle`,children:[(0,$.jsx)(`legend`,{className:`mode-toggle__label`,children:`Audience`}),(0,$.jsx)(`div`,{className:`mode-toggle__options`,children:YG.map(t=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,name:`audience-mode`,value:t.mode,checked:e===t.mode,ref:e===t.mode?i:void 0,onChange:()=>o(t.mode)}),(0,$.jsx)(`span`,{children:t.label})]},t.mode))})]}):(0,$.jsxs)(`dialog`,{ref:r,className:`mode-gate`,"aria-labelledby":`mode-gate-heading`,"aria-describedby":`mode-gate-detail`,onCancel:e=>e.preventDefault(),children:[(0,$.jsx)(`h1`,{id:`mode-gate-heading`,children:`New to coding, or do you build software already?`}),(0,$.jsx)(`p`,{id:`mode-gate-detail`,children:`This changes how much Codemble explains and how much it assumes you already know.`}),(0,$.jsx)(`div`,{className:`mode-gate__options`,children:JG.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e.mode),children:e.label},e.mode))})]})}function ZG({node:e,study:t,error:n,mode:r,explanation:i,explanationLoading:a,explanationError:o,llmStatus:s,onSelectNode:c,onRetryNarration:l}){return(0,$.jsxs)(`aside`,{className:`study-preview`,"aria-label":`Selected source structure`,"aria-busy":!t&&!n,children:[(0,$.jsxs)(`header`,{className:`study-preview__header`,children:[(0,$.jsxs)(`p`,{className:`study-preview__path`,children:[e.file,`:`,e.lineno]}),(0,$.jsx)(`h1`,{children:e.name}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Kind`}),(0,$.jsx)(`dd`,{children:e.kind})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Span`}),(0,$.jsxs)(`dd`,{children:[e.loc,` lines`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:r===`easy`?`Used by`:`Callers`}),(0,$.jsx)(`dd`,{children:e.centrality})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Resolution`}),(0,$.jsx)(`dd`,{children:e.partial?`Partial parse`:`Parser-proven`})]})]})]}),n?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`Study data did not load.`}),(0,$.jsxs)(`p`,{children:[n,` The parser map is still available.`]}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>c(e.id),children:`Try again`})]}):null,!t&&!n?(0,$.jsx)(`p`,{className:`study-loading`,role:`status`,children:`Reading parser evidence…`}):null,t?(0,$.jsxs)(`div`,{className:`study-content`,children:[(0,$.jsx)(QG,{structural:t.structural,mode:r}),(0,$.jsx)(sK,{explanation:i,loading:a,error:o,llmStatus:s,mode:r,node:e,onSelectNode:c,onRetry:l}),(0,$.jsx)(eK,{neighbors:t.neighbors,node:e,mode:r,onSelectNode:c}),(0,$.jsx)(oK,{source:t.source}),(0,$.jsx)(aK,{lens:t.lens,language:e.language,mode:r})]}):null]})}function QG({structural:e,mode:t}){return e?(0,$.jsxs)(`section`,{className:`structural-summary`,"aria-labelledby":`structural-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`structural-heading`,children:t===`easy`?`What this is`:`Structural summary`}),(0,$.jsx)(`span`,{children:`No model needed`})]}),(0,$.jsx)(`p`,{children:e[t]??e.easy})]}):null}var $G=8;function eK({neighbors:e,node:t,mode:n,onSelectNode:r}){let i=e??[],a=i.filter(e=>e.direction===`inbound`),o=i.filter(e=>e.direction===`outbound`);return(0,$.jsxs)(`section`,{className:`connections`,"aria-labelledby":`connections-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`connections-heading`,children:n===`easy`?`What this connects to`:`Parser connections`}),(0,$.jsxs)(`span`,{children:[i.length,` parser `,i.length===1?`relationship`:`relationships`]})]}),i.length===0?(0,$.jsx)(`p`,{className:`study-loading`,children:n===`easy`?`Nothing in your code reaches this yet, and it does not reach anything else.`:`The parser observed no relationship into or out of this structure.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(iK,{inbound:a,outbound:o,node:t}),(0,$.jsx)(tK,{title:n===`easy`?`Uses this`:`Inbound`,items:a,mode:n,onSelectNode:r}),(0,$.jsx)(tK,{title:n===`easy`?`This uses`:`Outbound`,items:o,mode:n,onSelectNode:r})]})]})}function tK({title:e,items:t,mode:n,onSelectNode:r}){return t.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{children:e}),(0,$.jsx)(`ul`,{className:`connection-list`,children:t.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.node_id),children:[(0,$.jsx)(`span`,{className:`connection-name`,children:e.name}),(0,$.jsxs)(`span`,{className:`connection-meta`,children:[nK(e,n),` · `,rK(e,n)]}),(0,$.jsx)(`span`,{className:`source-citation`,children:e.citation})]})},`${e.direction}-${e.node_id}`))})]}):null}function nK(e,t){return e.relationship===`import`?e.direction===`inbound`?t===`easy`?`brings this in`:`import · inbound`:t===`easy`?`this brings it in`:`import · outbound`:e.direction===`inbound`?t===`easy`?`calls this`:`call · inbound`:t===`easy`?`this calls it`:`call · outbound`}function rK(e,t){return e.certain?`certain`:e.relationship===`import`?t===`easy`?`possible link, not certain`:`possible import`:t===`easy`?`possible link, not certain`:`possible call`}function iK({inbound:e,outbound:t,node:n}){let r=e.slice(0,$G),i=t.slice(0,$G),a=Math.max(r.length,i.length,1)*22+16,o=a/2,s=(e,t)=>(e+1)*a/(t+1);return(0,$.jsxs)(`svg`,{className:`mini-constellation`,viewBox:`0 0 280 ${a}`,role:`img`,"aria-label":`${e.length} inbound and ${t.length} outbound parser relationships for ${n.name}`,children:[r.map((e,t)=>(0,$.jsx)(`line`,{x1:`26`,y1:s(t,r.length),x2:`132`,y2:o,strokeDasharray:e.certain?void 0:`3 3`},`in-line-${e.node_id}`)),i.map((e,t)=>(0,$.jsx)(`line`,{x1:`148`,y1:o,x2:`254`,y2:s(t,i.length),strokeDasharray:e.certain?void 0:`3 3`},`out-line-${e.node_id}`)),r.map((e,t)=>(0,$.jsx)(`circle`,{cx:`22`,cy:s(t,r.length),r:`4`},`in-dot-${e.node_id}`)),i.map((e,t)=>(0,$.jsx)(`circle`,{cx:`258`,cy:s(t,i.length),r:`4`},`out-dot-${e.node_id}`)),(0,$.jsx)(`circle`,{className:`mini-constellation__self`,cx:`140`,cy:o,r:`6`})]})}function aK({lens:e,language:t,mode:n}){return e?.length?(0,$.jsxs)(`section`,{className:`lens-study`,"aria-labelledby":`lens-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsxs)(`h2`,{id:`lens-heading`,children:[fG(t),` lens`]}),(0,$.jsxs)(`span`,{children:[e.length,` detected`]})]}),(0,$.jsx)(`div`,{className:`lens-notes`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`lens-note`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{children:e.title}),(0,$.jsx)(lK,{citation:e.citation,fallbackLine:e.line})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{children:e.note_voices[n]}),(0,$.jsx)(`code`,{children:e.snippet})]})]},`${e.concept}-${e.line}-${e.snippet}`))})]}):null}function oK({source:e}){return(0,$.jsxs)(`section`,{className:`source-study`,"aria-labelledby":`source-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,children:[(0,$.jsx)(`h2`,{id:`source-heading`,children:`Real source`}),(0,$.jsxs)(`span`,{children:[e.file,`:`,e.start_line,`–`,e.end_line]})]}),(0,$.jsx)(`ol`,{className:`source-code`,start:e.start_line,"aria-label":`Source excerpt from ${e.file}`,children:e.lines.map(e=>(0,$.jsx)(`li`,{id:`source-L${e.number}`,"data-line":e.number,children:(0,$.jsx)(`code`,{children:e.text||` `})},e.number))})]})}function sK({explanation:e,loading:t,error:n,llmStatus:r,mode:i,node:a,onSelectNode:o,onRetry:s}){return t?(0,$.jsx)(`p`,{className:`study-loading`,role:`status`,children:i===`easy`?`Asking your model to explain this in plain language…`:`Requesting a grounded narration for this structure…`}):n?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`The explanation request failed.`}),(0,$.jsx)(`p`,{children:n}),(0,$.jsx)(`p`,{children:`Every fact above and below this block came from the parser and is unaffected.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:s,children:`Try again`})]}):e?e.status===`no_key`?(0,$.jsx)(cK,{message:e.message,llmStatus:r,mode:i}):e.status===`error`?(0,$.jsxs)(`section`,{className:`study-notice`,role:`alert`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`The explanation was withheld.`}),(0,$.jsx)(`p`,{children:e.message}),(0,$.jsx)(`p`,{children:`Codemble will not display provider output that falls outside parser evidence.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:s,children:`Try again`})]}):e.status===`partial`?(0,$.jsxs)(`section`,{className:`study-notice`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:`Narration stays off for partial source.`}),(0,$.jsx)(`p`,{children:e.message})]}):(0,$.jsxs)(`section`,{className:`grounded-explanation`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsxs)(`div`,{className:`study-section-heading`,role:`status`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:i===`easy`?`In plain language`:`Grounded explanation`}),(0,$.jsx)(`span`,{children:e.cached?`Local cache`:e.provider})]}),(0,$.jsxs)(`p`,{children:[e.summary.text,` `,(0,$.jsx)(lK,{citation:e.summary.citation,fallbackLine:a.lineno})]}),(0,$.jsx)(`h3`,{children:i===`easy`?`Line by line`:`Walkthrough`}),(0,$.jsx)(`ul`,{className:`evidence-list`,children:e.walkthrough.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`p`,{children:e.text}),(0,$.jsx)(lK,{citation:e.citation,fallbackLine:e.line})]},`${e.citation}-${e.text}`))}),e.relationships.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{children:i===`easy`?`How it fits in`:`Parser relationships`}),(0,$.jsx)(`ul`,{className:`evidence-list`,children:e.relationships.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.certain?e.node_id:`Possible: ${e.node_id}`}),(0,$.jsx)(`p`,{children:e.text}),(0,$.jsxs)(`button`,{className:`source-citation source-citation--button`,type:`button`,onClick:()=>o(e.node_id),children:[`Study `,e.citation]})]},`${e.node_id}-${e.text}`))})]}):null]}):null}function cK({message:e,llmStatus:t,mode:n}){let r=t?.ollama??null;return(0,$.jsxs)(`section`,{className:`study-notice`,"aria-labelledby":`explanation-heading`,children:[(0,$.jsx)(`h2`,{id:`explanation-heading`,children:n===`easy`?`The plain-language write-up needs a model.`:`No narration provider is configured.`}),(0,$.jsx)(`p`,{children:e}),r?(0,$.jsx)(`p`,{children:r.running?`Ollama is already running on this machine. Set CODEMBLE_PROVIDER=ollama and CODEMBLE_OLLAMA_MODEL=${r.recommended}, then restart Codemble to narrate without sending code anywhere.`:`Want to stay fully local? Install Ollama, run "ollama pull ${r.recommended}" (or ${r.fallback} on a smaller machine), set CODEMBLE_PROVIDER=ollama, then restart Codemble.`}):null,(0,$.jsx)(`p`,{children:`Everything else on this panel is parser evidence and works without any model at all.`})]})}function lK({citation:e,fallbackLine:t}){return(0,$.jsx)(`a`,{className:`source-citation`,href:`#source-L${Number(e.split(`:`).at(-1))||t}`,children:e})}var uK=Object.freeze({setTimeout(e,t){return globalThis.setTimeout(e,t)},clearTimeout(e){globalThis.clearTimeout(e)}}),dK=300,fK=400,pK=4e3,mK=8;function hK({adapter:e=gK(),clock:t=uK}={}){let n=new Set,r=_K({status:`idle`,error:``,graph:null,level:sG.GALAXY,region:null,selectedNode:null,studyData:null,studyError:``,explanation:null,explanationLoading:!1,explanationError:``,showChart:!1,studiedNodeIds:new Set,showChecks:!1,checkData:null,checkError:``,entrypointDismissed:!1,entrypointError:``,litRegionId:null,pendingDawnRegionId:null,languageFocus:`all`,picker:null,parseProgress:null,layer:`galaxy`,layerChosen:!1,mapTab:`architecture`,mapData:null,mapError:``,coachmarksSeen:xK(),llmStatus:null,hoverNodeId:null,mode:`easy`,modeChosen:null}),i=0,a=0,o=null,s=null,c=null,l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=null,v=null;function y(){return r}function b(e){return n.add(e),()=>n.delete(e)}function x(e,{preserveChecks:t=!1}={}){let i=r,a=_K({...i,...e});if(a.level!==i.level||a.region?.id!==i.region?.id){let e={hoverNodeId:null};t||(CK(l),CK(u),l=null,u=null,e.showChecks=!1,e.checkData=null,e.checkError=``),a=_K({...a,...e})}r=Object.freeze(a);for(let e of n)e()}async function S(){i+=1;let t=i;CK(o),o=new AbortController;let n=o;x({status:`loading`,error:``});let a;try{a=await e.loadPickerState({signal:n.signal})}catch(e){return!wK(e)&&t===i&&x({status:`error`,error:DK(e)}),r}return t!==i||n.signal.aborted?r:a.state===`unpicked`?T(n,t):C(n,t)}async function C(t,n){x({status:`loading`,error:``,picker:null});try{let a=await e.loadGraph({signal:t.signal});if(n!==i||t.signal.aborted)return r;x({status:`ready`,graph:a,region:bG(a),error:``,entrypointDismissed:!!a.selected_entrypoint})}catch(e){!wK(e)&&n===i&&x({status:`error`,error:DK(e)})}return await w(t,n),r}async function w(t,n){let o=a,[s,c]=await Promise.allSettled([(async()=>e.loadMode({signal:t.signal}))(),(async()=>e.fetchLlmStatus({signal:t.signal}))()]);if(!(n!==i||t.signal.aborted)){if(o===a){let e=s.status===`fulfilled`?s.value:null;e?.mode===`easy`||e?.mode===`expert`?oe(e.mode,e.chosen===!0):r.modeChosen===null&&x({modeChosen:!0})}c.status===`fulfilled`&&x({llmStatus:c.value})}}async function T(t,n){try{let[a,o]=await Promise.all([e.loadRecents({signal:t.signal}),e.browsePicker(null,{signal:t.signal})]);if(n!==i||t.signal.aborted)return r;x({status:`picking`,picker:{...o,recents:a.recents,error:``,scale:null,busy:!1}})}catch(e){!wK(e)&&n===i&&x({status:`error`,error:EK(e)})}return r}async function E(t){if(r.status!==`picking`||r.picker?.busy)return;CK(f),f=new AbortController;let n=f;try{let i=await e.browsePicker(t,{signal:n.signal});!n.signal.aborted&&r.status===`picking`&&x({picker:{...r.picker,...i,error:``}})}catch(e){f===n&&!wK(e)&&r.status===`picking`&&x({picker:{...r.picker,error:EK(e)}})}}async function D(t){if(r.status!==`picking`||r.picker?.busy)return;CK(f),f=new AbortController;let n=f;x({picker:{...r.picker,busy:!0,error:``,scale:null}});try{let a=await e.selectProject(t,{signal:n.signal});if(n.signal.aborted||r.status!==`picking`)return a;if(a.state===`parsing`)return x({parseProgress:{state:`parsing`,stage:`discovering`,files_done:0,files_total:0,error:null,pollError:``,attempts:0,pollOutage:!1,path:t}}),O(0),a;if(a.state===`ready`){i+=1;let e=i;return CK(o),o=new AbortController,C(o,e)}if(a.state===`scale`){let t=await e.browsePicker(a.root,{signal:n.signal});return!n.signal.aborted&&r.status===`picking`&&x({picker:{...r.picker,...t,busy:!1,scale:a}}),a}return x({picker:{...r.picker,busy:!1,error:a.detail}}),a}catch(e){!wK(e)&&r.status===`picking`&&x({picker:{...r.picker,busy:!1,error:EK(e)}});return}}function O(e){v!==null&&t.clearTimeout(v),v=t.setTimeout(async()=>{v=null,await A()},e)}function k(){CK(g),g=null,v!==null&&(t.clearTimeout(v),v=null)}async function A(){if(!r.parseProgress)return;CK(g),g=new AbortController;let t=g,n=i,a=r.parseProgress,s;try{s=await e.fetchParseProgress({signal:t.signal})}catch(e){if(g!==t||n!==i||wK(e)||!r.parseProgress)return;let o=a.attempts+1;x({parseProgress:{...a,pollError:EK(e),attempts:o,pollOutage:o>=mK}}),O(Math.min(pK,fK*2**(o-1)));return}if(!(g!==t||n!==i||!r.parseProgress)){if(s.state===`ready`){k(),x({parseProgress:null,picker:null}),i+=1;let e=i;CK(o),o=new AbortController,await C(o,e);return}if(s.state===`error`||s.state===`idle`){k(),x({parseProgress:null,picker:{...r.picker,busy:!1,error:s.error??``}});return}x({parseProgress:{...a,...s,pollError:``,attempts:0,pollOutage:!1}}),O(dK)}}async function ee(){let t=i;if(await e.clearProgress({}),t!==i)return r;i+=1;let n=i;return CK(o),o=new AbortController,C(o,n)}async function te(){CK(h),h=new AbortController;let t=h;try{await e.resetProject({signal:t.signal})}catch(e){if(wK(e))return r;if(TK(e))throw e}return t.signal.aborted?r:(le(),CK(d),d=null,CK(p),p=null,CK(m),m=null,k(),x({graph:null,parseProgress:null,region:null,selectedNode:null,level:sG.GALAXY,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1,showChart:!1,studiedNodeIds:new Set,showChecks:!1,checkData:null,checkError:``,entrypointDismissed:!1,entrypointError:``,litRegionId:null,pendingDawnRegionId:null,languageFocus:`all`,llmStatus:null,picker:null,mapData:null,mapError:``}),S())}async function ne(e){switch(e.type){case`ADVANCE`:return ie(e.node);case`ADVANCE_REGION`:re(e.regionId);return;case`RETREAT`:j();return;case`SELECT_STUDY_NODE`:return M(e.nodeId);case`SET_LANGUAGE_FOCUS`:ae(e.language);return;case`SET_MODE`:return se(e.mode);case`HOVER_NODE`:r.hoverNodeId!==(e.nodeId??null)&&x({hoverNodeId:e.nodeId??null});return;case`SHOW_CHART`:x({showChart:!0});return;case`HIDE_CHART`:x({showChart:!1});return;case`OPEN_CHECKS`:return de();case`CLOSE_CHECKS`:pe();return;case`SUBMIT_CHECK`:return me(e.checkId,e.selectedIds);case`CONSUME_DAWN`:be(e.regionId);return;case`SELECT_ENTRYPOINT`:return he(e.nodeId);case`DISMISS_ENTRYPOINT`:x({entrypointDismissed:!0});return;case`CHANGE_HOME`:le(),x({entrypointDismissed:!1,entrypointError:``,level:sG.GALAXY,selectedNode:null,showChart:!1,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1});return;case`BROWSE_PICKER`:return E(e.path);case`SELECT_PROJECT`:return D(e.path);case`RESET_PROJECT`:return te();case`CLEAR_PROGRESS`:return ee();case`SET_LAYER`:return ge(e.layer);case`SET_MAP_TAB`:x({mapTab:e.tab});return;case`DISMISS_COACHMARKS`:SK(),x({coachmarksSeen:!0});return;case`SET_LEVEL_GALAXY`:le(),x({level:sG.GALAXY,selectedNode:null});return;default:throw Error(`Unknown learner-session event: ${e.type}`)}}function re(e){let t=r.graph?.regions.find(t=>t.id===e);t&&(le(),x({languageFocus:r.languageFocus!==`all`&&t.language!==r.languageFocus?t.language:r.languageFocus,region:t,selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1}))}async function ie(e){if(!(!r.focusedGraph||!e)){if(r.level===sG.GALAXY){let t=r.focusedGraph.regions.find(t=>t.id===e.id)??e;le(),x({region:t,selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``});return}if(r.level===sG.SYSTEM){let t=r.focusedGraph.nodes.find(t=>t.id===e.id)??e;return x({selectedNode:t,level:sG.STUDY}),ce(t.id)}}}function j(){r.level===sG.STUDY?(le(),x({selectedNode:null,level:sG.SYSTEM,studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1})):r.level===sG.SYSTEM&&x({level:sG.GALAXY})}async function M(e){let t=r.graph?.nodes.find(t=>t.id===e);if(!t)return;let n=r.graph.regions.find(e=>e.id===t.region);return x({languageFocus:r.languageFocus!==`all`&&t.language!==r.languageFocus?t.language:r.languageFocus,region:n??r.region,selectedNode:t,level:sG.STUDY}),ce(t.id)}function ae(e){let t=r.selectedNode?.id;x({languageFocus:e}),t&&r.selectedNode?.id!==t&&(le(),x({studyData:null,studyError:``,explanation:null,explanationError:``,explanationLoading:!1}))}function oe(e,t){let n=r.layerChosen?r.layer:e===`easy`?`map`:`galaxy`;x({mode:e,layer:n,modeChosen:t}),n===`map`&&_e()}async function se(t){if(t!==`easy`&&t!==`expert`)return;let n=r.mode,o=r.modeChosen;if(t===n&&r.modeChosen)return;a+=1,CK(m),m=new AbortController;let s=m,c=i;oe(t,!0);try{await e.saveMode(t,{signal:s.signal})}catch(e){m===s&&c===i&&!wK(e)&&oe(n,o);return}if(!(c!==i||s.signal.aborted)&&r.level===sG.STUDY&&r.selectedNode)return ue(r.selectedNode.id)}async function ce(t){le(),s=new AbortController;let n=s;x({studyData:null,studyError:``}),ue(t);try{let i=await e.loadStudy(t,{signal:n.signal});if(n.signal.aborted||r.level!==sG.STUDY||r.selectedNode?.id!==t)return;x({studyData:i,studiedNodeIds:new Set(r.studiedNodeIds).add(i.node.id)})}catch(e){s===n&&!n.signal.aborted&&!wK(e)&&r.selectedNode?.id===t&&x({studyError:EK(e)})}}function le(){CK(s),s=null,CK(c),c=null}async function ue(t){CK(c),c=new AbortController;let n=c;x({explanation:null,explanationError:``,explanationLoading:!0});try{let i=await e.loadExplanation(t,r.mode,{signal:n.signal});if(n.signal.aborted||r.level!==sG.STUDY||r.selectedNode?.id!==t)return;x({explanation:i,explanationLoading:!1})}catch(e){c===n&&!n.signal.aborted&&!wK(e)&&r.selectedNode?.id===t&&x({explanationError:EK(e),explanationLoading:!1})}}async function de(){if(!r.region)return;let e=r.region.id;return x({showChecks:!0,checkData:null,checkError:``}),fe(e)}async function fe(t){CK(l),l=new AbortController;let n=l;try{let i=await e.loadChecks(t,{signal:n.signal});return!n.signal.aborted&&r.showChecks&&r.region?.id===t&&x({checkData:i,checkError:``},{preserveChecks:!0}),i}catch(e){l===n&&!wK(e)&&!n.signal.aborted&&r.showChecks&&r.region?.id===t&&x({checkError:EK(e)},{preserveChecks:!0});return}}function pe(){CK(l),l=null,x({showChecks:!1,checkData:null,checkError:``})}async function me(t,n){if(!r.region)return;let i=r.region.id;CK(u),u=new AbortController;let a=u,o=await e.submitCheck(i,t,n,{signal:a.signal});if(a.signal.aborted||r.region?.id!==i)return o;if(o.correct&&await fe(i),o.region_understood){let t=await e.loadGraph({signal:a.signal});!a.signal.aborted&&r.region?.id===i&&(CK(p),p=null,x({graph:t,region:t.regions.find(e=>e.id===i),mapData:null,mapError:``},{preserveChecks:!0}),ye(i),r.layer===`map`&&await _e())}return o}async function he(t){let n=i;CK(d),d=new AbortController;let a=d;x({entrypointError:``});try{let o=await e.selectEntrypoint(t,{signal:a.signal});return n!==i||a.signal.aborted?r:(CK(p),p=null,x({graph:o,region:bG(o),entrypointError:``,entrypointDismissed:!0,mapData:null,mapError:``}),r.layer===`map`&&await _e(),o)}catch(e){d===a&&n===i&&!a.signal.aborted&&!wK(e)&&x({entrypointError:EK(e)});return}}async function ge(e){if(x({layer:e,layerChosen:!0}),e===`map`)return _e()}function _e(){if(!r.mapData)return p&&!p.signal.aborted&&!r.mapError?void 0:ve()}async function ve(){let t=i;CK(p),p=new AbortController;let n=p;x({mapError:``});try{let r=await e.fetchMap({signal:n.signal});return t===i&&!n.signal.aborted&&x({mapData:r,mapError:``}),r}catch(e){p===n&&t===i&&!n.signal.aborted&&!wK(e)&&x({mapError:EK(e),mapData:null});return}}function ye(e){_!==null&&t.clearTimeout(_),x({litRegionId:e,pendingDawnRegionId:e}),_=t.setTimeout(()=>{_=null,r.litRegionId===e&&x({litRegionId:null})},520)}function be(e){r.pendingDawnRegionId===e&&x({pendingDawnRegionId:null})}function xe(){i+=1;for(let e of[o,s,c,l,u,d,f,p,m,h,g])CK(e);o=null,s=null,c=null,l=null,u=null,d=null,f=null,p=null,m=null,h=null,k(),_!==null&&(t.clearTimeout(_),_=null)}return Object.freeze({dispatch:ne,dispose:xe,getSnapshot:y,start:S,subscribe:b})}function gK(e=globalThis.fetch){if(typeof e!=`function`)throw TypeError(`Learner-session HTTP adapter requires fetch.`);async function t(t,n,r={}){let i=await e(t,r);if(!i.ok){let e=(await i.json().catch(()=>null))?.detail,t=Error(typeof e==`string`&&e?e:`${n} returned ${i.status}.`);throw t.status=i.status,t}return i.json()}return Object.freeze({loadGraph(e={}){return t(`/api/graph`,`Graph request`,e)},fetchMap(e={}){return t(`/api/map`,`Map request`,e)},loadStudy(e,n={}){return t(`/api/node/${encodeURIComponent(e)}/study`,`Study request`,n)},loadExplanation(e,n,r={}){return t(`/api/node/${encodeURIComponent(e)}/explanation?mode=${encodeURIComponent(n)}`,`Explanation request`,r)},loadChecks(e,n={}){return t(`/api/regions/${encodeURIComponent(e)}/checks`,`Checks request`,n)},submitCheck(e,n,r,i={}){return t(`/api/regions/${encodeURIComponent(e)}/checks/${encodeURIComponent(n)}`,`Check submission`,{...i,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selected_ids:r})})},selectEntrypoint(e,n={}){return t(`/api/entrypoint`,`Home selection`,{...n,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({node_id:e})})},loadMode(e={}){return t(`/api/mode`,`Mode request`,e)},saveMode(e,n={}){return t(`/api/mode`,`Mode update`,{...n,method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})})},fetchLlmStatus(e={}){return t(`/api/llm/status`,`Model status`,e)},resetProject(e={}){return t(`/api/picker/reset`,`Project reset`,{...e,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({confirmed:!0})})},loadPickerState(e={}){return t(`/api/picker/state`,`Picker state`,e)},browsePicker(e,n={}){return t(`/api/picker/browse${e?`?path=${encodeURIComponent(e)}`:``}`,`Folder listing`,n)},loadRecents(e={}){return t(`/api/picker/recents`,`Recent projects`,e)},fetchParseProgress(e={}){return t(`/api/picker/progress`,`Parse progress`,e)},clearProgress(e={}){return t(`/api/progress`,`Progress reset`,{...e,method:`DELETE`})},async selectProject(t,n={}){let r=await e(`/api/picker/select`,{...n,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})}),i=await r.json().catch(()=>null);if(r.ok)return{state:r.status===202?`parsing`:`ready`};let a=i?.detail;return a&&typeof a==`object`&&a.reason===`scale`?{state:`scale`,...a}:{state:`error`,detail:typeof a==`string`?a:`Project selection returned ${r.status}.`}}})}function _K(e){let t=e.graph,n=t?cG(t,e.languageFocus):null,r=e.level,i=e.region,a=e.selectedNode;n&&(i=n.regions.find(e=>e.id===i?.id)??null,i?a&&(a=n.nodes.find(e=>e.id===a.id)??null,!a&&r===sG.STUDY&&(r=sG.SYSTEM)):(i=bG(n),a=null,r=sG.GALAXY));let o=e.studiedNodeIds,s=n?vK(n,e.mode):null;return{...e,focusedGraph:n,focusedMapData:lG(e.mapData,e.languageFocus),entrypointOpen:!!t&&!e.entrypointDismissed,level:r,region:i,selectedNode:a,languageOptions:t?uG(t):[],projectName:t?t.project_root.split(`/`).filter(Boolean).at(-1)??t.project_root:`Loading local project`,chart:n?dG(n,o):[],focusedStudiedCount:n?n.nodes.filter(e=>o.has(e.id)).length:0,hint:s}}function vK(e,t){if(t!==`easy`)return null;let n=e.regions.filter(e=>!e.understood);if(!n.length)return null;let r=e.regions.find(e=>e.home),i=new Map;if(r){let t=new Map;for(let n of e.region_edges)t.has(n.src)||t.set(n.src,[]),t.has(n.dst)||t.set(n.dst,[]),t.get(n.src).push(n.dst),t.get(n.dst).push(n.src);i.set(r.id,0);let n=[r.id];for(;n.length;){let e=n.shift();for(let r of(t.get(e)??[]).slice().sort())i.has(r)||(i.set(r,i.get(e)+1),n.push(r))}}let a=n.map(e=>({regionId:e.id,hops:i.has(e.id)?i.get(e.id):1/0})).sort((e,t)=>e.hops-t.hops||e.regionId.localeCompare(t.regionId))[0];return{...a,reason:a.hops===0?`Home is not lit yet.`:Number.isFinite(a.hops)?`${a.hops} ${a.hops===1?`route`:`routes`} from Home.`:`No import route reaches it from Home.`}}var yK=`codemble.coachmarks.seen`;function bK(){if(typeof document>`u`)return null;try{return globalThis.localStorage??null}catch{return null}}function xK(){try{return bK()?.getItem(yK)===`1`}catch{return!1}}function SK(){try{bK()?.setItem(yK,`1`)}catch{}}function CK(e){e&&!e.signal.aborted&&e.abort()}function wK(e){return e instanceof Error&&e.name===`AbortError`}function TK(e){return Number.isInteger(e?.status)}function EK(e){return e instanceof Error?e.message:String(e)}function DK(e){return TK(e)?EK(e):`Codemble's local server is not responding, so nothing can be loaded from it. It may have stopped — start it again by running codemble in your terminal. (${EK(e)})`}function OK(){let e=(0,_.useMemo)(()=>hK({adapter:gK()}),[]),t=(0,_.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);(0,_.useEffect)(()=>(e.start(),()=>e.dispose()),[e]);let[n,r]=(0,_.useState)(``),{chart:i,checkData:a,checkError:o,coachmarksSeen:s,entrypointError:c,entrypointOpen:l,error:u,explanation:d,explanationError:f,explanationLoading:p,focusedGraph:m,focusedMapData:h,focusedStudiedCount:g,graph:v,hint:y,hoverNodeId:b,languageFocus:x,languageOptions:S,layer:C,level:w,litRegionId:T,llmStatus:E,mapError:D,mapTab:O,mode:k,modeChosen:A,parseProgress:ee,pendingDawnRegionId:te,picker:ne,projectName:re,region:ie,selectedNode:j,showChart:M,showChecks:ae,status:oe,studyData:se,studyError:ce}=t;return u?(0,$.jsxs)(`main`,{className:`load-state`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The graph did not load.`}),(0,$.jsx)(`p`,{children:u}),(0,$.jsx)(`p`,{children:`Your progress is stored on this machine and is not affected.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>e.start(),children:`Try again`})]}):ee?(0,$.jsx)(jK,{progress:ee,onCancel:()=>e.dispatch({type:`RESET_PROJECT`})}):oe===`picking`&&ne?(0,$.jsx)(MK,{picker:ne,failure:n&&ne.error?{path:n,detail:ne.error}:null,onBrowse:t=>(r(``),e.dispatch({type:`BROWSE_PICKER`,path:t})),onSelect:t=>(r(t),e.dispatch({type:`SELECT_PROJECT`,path:t}))}):!v||!m||!ie?(0,$.jsx)(`main`,{className:`load-state`,"aria-busy":`true`,children:(0,$.jsx)(`p`,{children:`Mapping parser evidence…`})}):(0,$.jsxs)(`main`,{className:`app-shell`,"data-level":M?`chart`:w.toLowerCase(),"data-mode":k,children:[(0,$.jsxs)(`header`,{className:`instrument-rail`,children:[(0,$.jsxs)(`div`,{className:`brand-lockup`,children:[(0,$.jsx)(`span`,{className:`brand-mark`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Codemble`}),(0,$.jsx)(`span`,{children:re})]})]}),(0,$.jsx)(`nav`,{className:`location`,"aria-label":`Breadcrumb`,"aria-live":`polite`,children:M?(0,$.jsx)(`span`,{"aria-current":`page`,children:`Star chart`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,disabled:w===sG.GALAXY,"aria-current":w===sG.GALAXY?`page`:void 0,onClick:()=>e.dispatch({type:`SET_LEVEL_GALAXY`}),children:`Galaxy`}),w===sG.GALAXY?(0,$.jsxs)(`small`,{children:[` · Home `,v.selected_entrypoint?bG(v)?.id??`unresolved`:`unselected`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,$.jsx)(`button`,{type:`button`,disabled:w===sG.SYSTEM,"aria-current":w===sG.SYSTEM?`page`:void 0,onClick:()=>e.dispatch({type:`RETREAT`}),children:ie.id})]}),w===sG.STUDY&&j?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,$.jsx)(`span`,{"aria-current":`page`,children:j.name})]}):null,x===`all`?null:(0,$.jsxs)(`small`,{children:[` · `,pG(x),` focus`]})]})}),(0,$.jsxs)(`div`,{className:`rail-actions`,children:[M?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`HIDE_CHART`}),children:`Return to galaxy`}):w===sG.GALAXY?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`SHOW_CHART`}),children:`Star chart`}):(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`RETREAT`}),children:w===sG.STUDY?`Return to system`:`Return to galaxy`}),v.entrypoint_candidates.length?(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,onClick:()=>e.dispatch({type:`CHANGE_HOME`}),children:`Change Home`}):null,(0,$.jsx)(RK,{onConfirm:()=>e.dispatch({type:`RESET_PROJECT`})})]}),(0,$.jsxs)(`div`,{className:`rail-controls`,children:[(0,$.jsx)(IK,{layer:C,mode:k,onChange:t=>e.dispatch({type:`SET_LAYER`,layer:t})}),(0,$.jsx)(LK,{options:S,value:x,onChange:t=>e.dispatch({type:`SET_LANGUAGE_FOCUS`,language:t})}),(0,$.jsx)(XG,{mode:k,modeChosen:A,onChoose:t=>e.dispatch({type:`SET_MODE`,mode:t})})]})]}),M?(0,$.jsx)(VK,{chart:i,studiedCount:g,projectName:re,onClearProgress:()=>e.dispatch({type:`CLEAR_PROGRESS`})}):(0,$.jsxs)(`section`,{className:`map-stage`,"aria-label":`Parser-proven project map`,children:[C===`map`?(0,$.jsx)(GG,{data:h,mapTab:O,mode:k,selectedRegionId:w===sG.GALAXY?void 0:ie?.id,hasEntrypointCandidates:v.entrypoint_candidates.length>0,error:D,onSelectTab:t=>e.dispatch({type:`SET_MAP_TAB`,tab:t}),onSelectRegion:t=>e.dispatch({type:`ADVANCE_REGION`,regionId:t}),onSelectNode:t=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:t}),onRetry:()=>e.dispatch({type:`SET_LAYER`,layer:`map`})}):(0,$.jsx)(kG,{graph:m,level:w,region:ie,selectedNode:j,hoverNodeId:b,pendingDawnRegionId:te,mode:k,onHoverNode:t=>e.dispatch({type:`HOVER_NODE`,nodeId:t}),onAdvance:t=>e.dispatch({type:`ADVANCE`,node:t}),onRetreat:()=>e.dispatch({type:`RETREAT`}),onDawnConsumed:t=>e.dispatch({type:`CONSUME_DAWN`,regionId:t})}),(0,$.jsxs)(`aside`,{className:`map-legend`,"aria-label":C===`map`?`Map legend`:`Galaxy legend`,children:[C===`galaxy`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-size`}),`Size · `,k===`easy`?`how much code`:`lines of code`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-brightness`}),`Brighter · `,k===`easy`?`used in more places`:`more distinct callers`]})]}):null,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--dim`}),`Dim · `,k===`easy`?`not proven yet`:`not understood`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--lit`}),`Amber · `,k===`easy`?`you proved you understand it`:`understood`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-dot legend-dot--partial`}),k===`easy`?`Could not be read`:`Unchartable · syntax error`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-route`}),k===`easy`?`Certain connection`:`Parser edge · certain`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:C===`map`?`legend-route legend-route--possible legend-route--dashed`:`legend-route legend-route--possible`}),k===`easy`?`Possible connection`:`Possible relationship`]}),C===`galaxy`&&w===sG.GALAXY||C===`map`&&O===`architecture`?S.filter(e=>e.id!==`all`).map(e=>(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{className:`legend-tint legend-tint--${e.id}`}),` `,e.label]},e.id)):null]}),C===`galaxy`&&w===sG.GALAXY?(0,$.jsxs)(`section`,{className:`orientation-copy`,children:[(0,$.jsxs)(`h1`,{children:[m.regions.length,` `,x===`all`?m.regions.length===1?`system`:`systems`:`${pG(x)} ${m.regions.length===1?`system`:`systems`}`,` from real source.`]}),(0,$.jsx)(`p`,{children:`Choose a system. Size follows lines of code; brightness follows how many places call it.`}),m.partial_files.length?(0,$.jsxs)(`p`,{className:`partial-summary`,children:[m.partial_files.length,` `,m.partial_files.length===1?`file is`:`files are`,` unchartable because `,m.partial_files.length===1?`its`:`their`,` language parser reported a syntax error.`]}):null]}):null,w===sG.SYSTEM?(0,$.jsxs)(`section`,{className:`orientation-copy orientation-copy--system`,children:[(0,$.jsx)(`h1`,{children:ie.id}),(0,$.jsx)(`p`,{children:m.nodes.some(e=>e.region===ie.id&&e.partial)?`${ie.node_count} source ${ie.node_count===1?`file remains`:`files remain`} visible · ${ie.loc} lines. The module is unchartable beyond raw source because it has a syntax error.`:C===`map`?`The ${ie.node_count} parser-proven ${ie.node_count===1?`structure`:`structures`} inside this module ${ie.node_count===1?`is`:`are`} drawn as planets in the Galaxy layer. This map shows how modules connect, not what is inside them.`:`${ie.node_count} parser-proven structures · ${ie.loc} lines in this system.`}),(0,$.jsx)(`button`,{className:`check-launch`,type:`button`,onClick:()=>e.dispatch({type:`OPEN_CHECKS`}),children:m.nodes.some(e=>e.region===ie.id&&e.partial)?`Check availability`:ie.understood?`Review understanding`:`Prove understanding`})]}):null,w===sG.SYSTEM&&ae?(0,$.jsx)(BK,{suite:a,error:o,mode:k,onClose:()=>e.dispatch({type:`CLOSE_CHECKS`}),onSubmit:(t,n)=>e.dispatch({type:`SUBMIT_CHECK`,checkId:t,selectedIds:n})}):null,l&&w===sG.GALAXY?(0,$.jsx)(zK,{candidates:v.entrypoint_candidates,nodes:v.nodes,selectedEntrypoint:v.selected_entrypoint,error:c,onSelect:t=>e.dispatch({type:`SELECT_ENTRYPOINT`,nodeId:t}),onContinue:()=>e.dispatch({type:`DISMISS_ENTRYPOINT`})}):null,T?(0,$.jsxs)(`output`,{className:`illumination-pulse`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),(0,$.jsxs)(`strong`,{children:[T,` understood`]})]}):null,w===sG.STUDY&&j?(0,$.jsx)(ZG,{node:j,study:se,error:ce,mode:k,explanation:d,explanationLoading:p,explanationError:f,llmStatus:E,onSelectNode:t=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:t}),onRetryNarration:()=>e.dispatch({type:`SELECT_STUDY_NODE`,nodeId:j.id})}):null,A===!0&&!s?(0,$.jsx)(LG,{layer:C,onDismiss:()=>e.dispatch({type:`DISMISS_COACHMARKS`})}):null,(0,$.jsx)(PG,{hint:y,onStudy:t=>e.dispatch({type:`ADVANCE_REGION`,regionId:t})})]}),(0,$.jsxs)(`footer`,{className:`status-line`,children:[(0,$.jsx)(`span`,{children:M?`${i.length} concepts detected`:x===`all`?`${v.nodes.length} nodes · ${v.edges.length} edges`:`${m.nodes.length}/${v.nodes.length} nodes · ${m.edges.length} focused edges`}),(0,$.jsx)(`span`,{children:M?`${g} focused structures studied this session`:C===`map`?`Click a box or row to study · Switch tabs to change view`:`Scroll or Enter to move closer · Escape to move back`}),(0,$.jsx)(`span`,{children:`Local only`})]})]})}var kK={discovering:`Finding your source files`,parsing:`Reading each file`,resolving:`Connecting imports and calls`,checks:`Building graph-only checks`,layout:`Placing your galaxy`},AK=[`discovering`,`parsing`,`resolving`,`checks`,`layout`];function jK({progress:e,onCancel:t}){let{stage:n,detail:r,files_done:i,files_total:a,pollError:o,pollOutage:s,attempts:c,path:l}=e,[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(``),m=(0,_.useRef)(null),h=AK.indexOf(n);(0,_.useEffect)(()=>{m.current?.focus()},[]);async function g(){d(!0),p(``);try{await t()}catch(e){p(e.message),d(!1)}}return(0,$.jsxs)(`main`,{className:`loading-screen`,children:[(0,$.jsxs)(`header`,{className:`loading-header`,children:[(0,$.jsx)(`p`,{className:`picker-wordmark`,children:`Codemble`}),(0,$.jsxs)(`h1`,{ref:m,tabIndex:-1,children:[`Mapping `,(0,$.jsx)(`span`,{className:`loading-path`,children:l})]}),(0,$.jsx)(`p`,{className:`loading-subtitle`,children:`Parsing runs on your machine. Nothing is sent anywhere.`})]}),(0,$.jsx)(`ol`,{className:`loading-stages`,"aria-label":`Parse stages`,children:AK.map((e,t)=>{let n=t<h?`done`:t===h?`active`:`waiting`;return(0,$.jsxs)(`li`,{"data-state":n,children:[(0,$.jsx)(`span`,{children:kK[e]}),(0,$.jsxs)(`small`,{children:[e===`parsing`&&a?`${i}/${a} files · `:``,n===`done`?`done`:n===`active`?r?`working · ${r}`:`working`:`waiting`]})]},e)})}),a?(0,$.jsx)(`progress`,{className:`loading-meter`,value:i,max:a,"aria-label":`${i} of ${a} files read`}):null,(0,$.jsx)(`p`,{className:`loading-live`,role:`status`,children:r??kK[n]??`Starting`}),o?s?(0,$.jsxs)(`p`,{className:`loading-error`,role:`alert`,children:[`The local server has not answered for the last `,c,` tries (`,o,`). It may have stopped. Codemble keeps retrying, but it cannot tell you whether the parse is still running. Cancel below, then run codemble again in your terminal — nothing you have already lit is lost.`]},`outage`):(0,$.jsxs)(`p`,{className:`loading-error`,role:`status`,children:[`Lost contact with the local server (`,o,`). Still retrying — the parse itself may be running fine.`]},`blip`):null,f?(0,$.jsx)(`p`,{className:`loading-error`,role:`alert`,children:f}):null,(0,$.jsx)(`div`,{className:`loading-actions`,children:(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,disabled:u,onClick:g,children:u?`Stopping…`:`Cancel and pick another project`})})]})}function MK({picker:e,failure:t,onBrowse:n,onSelect:r}){let{path:i,parent:a,entries:o,recents:s,error:c,scale:l,busy:u}=e;return(0,$.jsxs)(`main`,{className:`picker-screen`,"aria-busy":u,children:[(0,$.jsxs)(`header`,{className:`picker-header`,children:[(0,$.jsx)(`p`,{className:`picker-wordmark`,children:`Codemble`}),(0,$.jsx)(`h1`,{children:`Choose the project to chart`}),(0,$.jsx)(`p`,{className:`picker-subtitle`,children:`Codemble reads the folder locally and turns it into a galaxy. Nothing leaves this machine.`})]}),s.length?(0,$.jsxs)(`section`,{className:`picker-recents`,"aria-labelledby":`picker-recents-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-recents-heading`,children:`Continue where you left off`}),(0,$.jsx)(`ul`,{children:s.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>r(e.project_root),children:[(0,$.jsx)(`span`,{className:`picker-recent-path`,children:e.project_root}),(0,$.jsxs)(`span`,{className:`picker-recent-lit`,children:[e.understood_count,` `,e.understood_count===1?`system`:`systems`,` lit last visit`]})]})},e.project_root))})]}):null,l?(0,$.jsx)(NK,{scale:l,busy:u,onBrowse:n}):null,t?(0,$.jsx)(FK,{failure:t,busy:u,onSelect:r}):c?(0,$.jsx)(`p`,{className:`picker-error`,role:`alert`,children:c}):null,(0,$.jsxs)(`section`,{className:`picker-browser`,"aria-labelledby":`picker-browser-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-browser-heading`,children:`Browse folders`}),(0,$.jsx)(`p`,{className:`picker-path`,children:i}),(0,$.jsxs)(`ul`,{children:[a?(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>n(a),children:`↑ Up`})}):null,o.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>n(e.path),children:[e.name,`/`]})},e.path))]}),(0,$.jsx)(`button`,{className:`picker-select`,type:`button`,disabled:u,onClick:()=>r(i),children:u?`Mapping…`:`Map this folder`})]})]})}function NK({scale:e,busy:t,onBrowse:n}){let r=e.suggestions.filter(e=>e.path!==`.`);return(0,$.jsxs)(`section`,{className:`picker-scale`,role:`alert`,"aria-labelledby":`picker-scale-heading`,children:[(0,$.jsx)(`h2`,{id:`picker-scale-heading`,children:`That folder is too big to map at once.`}),(0,$.jsxs)(`p`,{children:[`It has `,e.file_count,` supported source files; Codemble maps up to`,` `,e.scale_cap,`. Choose a smaller scope — busiest first.`]}),r.length?(0,$.jsx)(`ul`,{className:`picker-scale-scopes`,children:r.map(r=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>n(`${e.root}/${r.path}`),children:[(0,$.jsxs)(`span`,{children:[r.path,`/`]}),(0,$.jsxs)(`small`,{children:[r.file_count,` files`]})]})},r.path))}):null,(0,$.jsx)(PK,{busy:t,onBrowse:n})]})}function PK({busy:e,onBrowse:t}){let[n,r]=(0,_.useState)(``);return(0,$.jsxs)(`form`,{className:`picker-path-entry`,onSubmit:e=>{e.preventDefault();let r=n.trim();r&&t(r)},children:[(0,$.jsx)(`label`,{htmlFor:`picker-path-input`,children:`Or type a folder path`}),(0,$.jsx)(`input`,{id:`picker-path-input`,type:`text`,value:n,disabled:e,placeholder:`/Users/you/project/src`,onChange:e=>r(e.target.value)}),(0,$.jsx)(`button`,{type:`submit`,disabled:e||!n.trim(),children:`Go`})]})}function FK({failure:e,busy:t,onSelect:n}){return(0,$.jsxs)(`section`,{className:`picker-failure`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`Codemble could not map that folder.`}),(0,$.jsx)(`p`,{children:`Nothing on disk changed, and no project's saved progress was touched. Try it again, or choose a different folder below.`}),(0,$.jsxs)(`p`,{className:`picker-failure__detail`,children:[(0,$.jsx)(`span`,{children:`What the parser reported`}),(0,$.jsx)(`code`,{children:e.detail})]}),(0,$.jsxs)(`button`,{className:`picker-select`,type:`button`,disabled:t,onClick:()=>n(e.path),children:[`Try `,(0,$.jsx)(`span`,{className:`picker-recent-path`,children:e.path}),` again`]})]})}function IK({layer:e,mode:t,onChange:n}){return(0,$.jsx)(`nav`,{className:`layer-switcher`,"aria-label":`View layer`,children:[{id:`galaxy`,label:`Galaxy`},{id:`map`,label:t===`easy`?`Diagram`:`Map`}].map(t=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e===t.id,onClick:()=>n(t.id),children:t.label},t.id))})}function LK({options:e,value:t,onChange:n}){return e.length<=2?null:(0,$.jsxs)(`nav`,{className:`language-focus`,"aria-label":`Language focus`,children:[(0,$.jsx)(`span`,{className:`language-focus__label`,children:`Focus`}),(0,$.jsx)(`div`,{children:e.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Focus ${e.label}: ${e.count} ${e.count===1?`system`:`systems`}`,"aria-pressed":t===e.id,title:e.label,onClick:()=>n(e.id),children:[(0,$.jsx)(`span`,{children:e.shortLabel}),(0,$.jsx)(`small`,{children:e.count})]},e.id))})]})}function RK({onConfirm:e}){let[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(``),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{t?c.current?.focus():l.current&&s.current?.focus(),l.current=t},[t]);function u(){n(!1),o(``)}async function d(){i(!0),o(``);try{await e()}catch(e){o(e.message),i(!1)}}return t?(0,$.jsxs)(`div`,{className:`switch-project`,role:`group`,"aria-label":`Switch project`,tabIndex:-1,ref:c,onKeyDown:e=>{e.key===`Escape`&&!r&&u()},children:[(0,$.jsx)(`p`,{children:`Progress is saved per project, so this galaxy comes back lit.`}),a?(0,$.jsx)(`p`,{className:`switch-project__error`,role:`alert`,children:a}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,disabled:r,onClick:d,children:r?`Releasing…`:`Switch`}),(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,disabled:r,onClick:u,children:`Cancel`})]})]}):(0,$.jsx)(`button`,{className:`rail-action`,type:`button`,ref:s,onClick:()=>n(!0),children:`Switch project`})}function zK({candidates:e,nodes:t,selectedEntrypoint:n,error:r,onSelect:i,onContinue:a}){let o=new Map(t.map(e=>[e.id,e]));return(0,$.jsxs)(`aside`,{className:`entrypoint-picker`,"aria-labelledby":`entrypoint-heading`,children:[(0,$.jsx)(`p`,{children:`Home calibration`}),(0,$.jsx)(`h1`,{id:`entrypoint-heading`,children:e.length?`Where does your project start?`:`No clear entrypoint found.`}),(0,$.jsx)(`p`,{children:e.length?`The parser found ranked candidates but cannot choose one honestly. Select the structure you run.`:`No file here declares a startup structure the parser recognises, and Codemble will not guess one. Explore the map without Home — every system, check, explanation, and lens note still works.`}),e.length?(0,$.jsx)(`div`,{className:`entrypoint-candidates`,children:e.map(e=>{let t=o.get(e);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>i(e),children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsxs)(`small`,{children:[t?.file,`:`,t?.lineno,` · parser rank `,t?.entrypoint_rank]})]},e)})}):null,r?(0,$.jsx)(`p`,{className:`entrypoint-error`,role:`alert`,children:r}):null,(0,$.jsx)(`button`,{className:`entrypoint-continue`,type:`button`,onClick:a,children:n?`Keep current Home`:`Explore without Home`})]})}function BK({suite:e,error:t,mode:n,onClose:r,onSubmit:i}){let a=e?.checks.find(e=>!e.passed)??null,o=e?.checks.filter(e=>e.passed).length??0,[s,c]=(0,_.useState)(()=>new Set),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``);(0,_.useEffect)(()=>{c(new Set),u(null),g(``)},[a?.id]);function v(e,t){f(``),c(n=>{if(!t)return new Set([e]);let r=new Set(n);return r.has(e)?r.delete(e):r.add(e),r})}async function y(e){if(e.preventDefault(),!(!a||s.size===0)){m(!0),g(``);try{let e=await i(a.id,[...s]);e.correct?(f(e.message),u(null)):(f(``),u(e))}catch(e){g(e.message)}finally{m(!1)}}}return(0,$.jsxs)(`aside`,{className:`check-panel`,"aria-label":`Graph-derived understanding checks`,children:[(0,$.jsxs)(`header`,{className:`check-panel__header`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{children:`Active recall · graph only`}),(0,$.jsx)(`h1`,{children:e?.region_id??`Loading checks`})]}),(0,$.jsx)(`button`,{className:`check-close`,type:`button`,onClick:r,children:`Close`})]}),t||h?(0,$.jsxs)(`div`,{className:`check-state`,role:`alert`,children:[(0,$.jsx)(`h2`,{children:`The checks did not load.`}),(0,$.jsxs)(`p`,{children:[t||h,` The galaxy remains available.`]})]}):null,!e&&!t?(0,$.jsx)(`p`,{className:`check-loading`,role:`status`,children:`Deriving answers from parser edges…`}):null,e?.region_understood?(0,$.jsxs)(`div`,{className:`check-complete`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`check-complete__star`,"aria-hidden":`true`,children:`✦`}),(0,$.jsx)(`h2`,{children:`System lit.`}),(0,$.jsx)(`p`,{children:`This region's source hash matches the checks you passed. Edit its file and only this system will dim again.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:r,children:`Return to the system`})]}):null,e&&!e.region_understood&&e.checks.length===0?(0,$.jsxs)(`div`,{className:`check-state`,children:[(0,$.jsx)(`h2`,{children:`No safe check yet.`}),(0,$.jsx)(`p`,{children:`Every question here is answered by the parser graph, and this region has no certain relationship Codemble can build one from. It stays dim rather than lighting on a question that would prove nothing. Import this module somewhere, or call something inside it, and its checks appear.`})]}):null,a&&!e.region_understood?(0,$.jsxs)(`form`,{className:`active-check`,onSubmit:y,children:[(0,$.jsxs)(`div`,{className:`check-progress`,children:[(0,$.jsxs)(`span`,{children:[`Check `,o+1,` of `,e.checks.length]}),(0,$.jsx)(`progress`,{value:o,max:e.checks.length})]}),d?(0,$.jsxs)(`p`,{className:`check-affirmation`,role:`status`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`✦`}),` `,d]}):null,(0,$.jsxs)(`fieldset`,{children:[(0,$.jsx)(`legend`,{children:a.prompt_voices[n]}),a.multiple?(0,$.jsx)(`p`,{children:`Select every answer supported by the graph.`}):null,(0,$.jsx)(`div`,{className:`check-options`,children:a.options.map(e=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:a.multiple?`checkbox`:`radio`,name:`answer-${a.id}`,value:e.id,checked:s.has(e.id),onChange:()=>v(e.id,a.multiple)}),(0,$.jsx)(`span`,{children:e.label})]},e.id))})]}),l&&!l.correct?(0,$.jsxs)(`div`,{className:`check-feedback`,role:`status`,children:[(0,$.jsx)(`strong`,{children:l.message}),(0,$.jsxs)(`span`,{children:[`Parser answer: `,l.answer_labels.join(`, `)]}),(0,$.jsxs)(`span`,{children:[`Evidence: `,l.evidence.join(`, `)]})]}):null,(0,$.jsx)(`button`,{className:`check-primary`,type:`submit`,disabled:!s.size||p,children:p?`Checking parser evidence…`:`Check answer`})]}):null]})}function VK({chart:e,studiedCount:t,projectName:n,onClearProgress:r}){let i=e.filter(e=>e.understood_nodes>0).length;return(0,$.jsxs)(`section`,{className:`star-chart-screen`,"aria-labelledby":`star-chart-heading`,children:[(0,$.jsxs)(`header`,{className:`star-chart-intro`,children:[(0,$.jsx)(`p`,{children:`Parser-detected concepts`}),(0,$.jsx)(`h1`,{id:`star-chart-heading`,children:`Your language star chart.`}),(0,$.jsx)(`p`,{children:`Encountered comes from real syntax. Studied tracks this session. Understood lights only after graph-derived checks pass.`}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Concepts encountered`}),(0,$.jsx)(`dd`,{children:e.length})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Studied this session`}),(0,$.jsx)(`dd`,{children:t})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Concepts understood`}),(0,$.jsx)(`dd`,{children:i})]})]})]}),(0,$.jsx)(`div`,{className:`concept-ledger`,role:`list`,"aria-label":`Language concept progress`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`concept-row`,role:`listitem`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:fG(e.concept)}),(0,$.jsxs)(`span`,{children:[fG(e.language),` · `,e.occurrences,` parser `,e.occurrences===1?`occurrence`:`occurrences`]})]}),(0,$.jsx)(`div`,{className:`concept-meter`,"aria-label":`${e.understood_nodes} of ${e.nodes} structures understood`,children:(0,$.jsx)(`span`,{style:{width:`${e.nodes?e.understood_nodes/e.nodes*100:0}%`}})}),(0,$.jsxs)(`dl`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Studied (session)`}),(0,$.jsxs)(`dd`,{children:[e.studied_nodes,`/`,e.nodes]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Understood`}),(0,$.jsxs)(`dd`,{children:[e.understood_nodes,`/`,e.nodes]})]})]})]},`${e.language}:${e.concept}`))}),(0,$.jsx)(HK,{projectName:n,onConfirm:r})]})}function HK({projectName:e,onConfirm:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(``),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{n?l.current?.focus():u.current&&c.current?.focus(),u.current=n},[n]);function d(){r(!1),s(``)}async function f(){a(!0),s(``);try{await t(),r(!1)}catch(e){s(e.message)}finally{a(!1)}}return n?(0,$.jsxs)(`section`,{className:`progress-reset progress-reset--confirming`,role:`group`,"aria-label":`Clear this project's progress`,tabIndex:-1,ref:l,onKeyDown:e=>{e.key===`Escape`&&!i&&d()},children:[(0,$.jsxs)(`p`,{role:`alert`,children:[`This dims every system you lit in `,e,` and cannot be undone. Your other projects keep their progress, and no source file is touched.`]}),o?(0,$.jsx)(`p`,{className:`progress-reset__error`,role:`alert`,children:o}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`button`,{className:`check-primary progress-reset__confirm`,type:`button`,disabled:i,onClick:f,children:i?`Clearing…`:`Yes, clear ${e}`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,disabled:i,onClick:d,children:`Keep it`})]})]}):(0,$.jsxs)(`section`,{className:`progress-reset`,children:[(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,ref:c,onClick:()=>r(!0),children:`Clear this project's progress`}),(0,$.jsxs)(`p`,{children:[`Start `,e,` over with every system dim again.`]})]})}var UK=class extends _.Component{constructor(e){super(e),this.state={message:``}}static getDerivedStateFromError(e){return{message:e instanceof Error?e.message:String(e)}}componentDidCatch(e,t){console.error(`Codemble stopped rendering:`,e,t?.componentStack)}render(){return this.state.message?(0,$.jsxs)(`main`,{className:`load-state`,role:`alert`,children:[(0,$.jsx)(`h1`,{children:`The galaxy stopped rendering.`}),(0,$.jsx)(`p`,{children:this.state.message}),(0,$.jsx)(`p`,{children:`Your progress is saved on this machine; reloading re-reads it.`}),(0,$.jsx)(`button`,{className:`check-primary`,type:`button`,onClick:()=>window.location.reload(),children:`Reload Codemble`})]}):this.props.children}};(0,v.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(_.StrictMode,{children:(0,$.jsx)(UK,{children:(0,$.jsx)(OK,{})})}));
|