@selvajs/selva 4.20.1-beta.4 → 4.21.0-beta.10
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.
- package/build/adapter-node.js +1 -1
- package/build/client/_app/immutable/assets/0.CqqJCiiV.css +2 -0
- package/build/client/_app/immutable/assets/0.CqqJCiiV.css.br +0 -0
- package/build/client/_app/immutable/assets/0.CqqJCiiV.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{CzfnuBzq.js → BAhtiTKe.js} +1 -1
- package/build/client/_app/immutable/chunks/BAhtiTKe.js.br +0 -0
- package/build/client/_app/immutable/chunks/BAhtiTKe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{qi43d-TM.js → CKbHmAlc.js} +1 -1
- package/build/client/_app/immutable/chunks/CKbHmAlc.js.br +0 -0
- package/build/client/_app/immutable/chunks/CKbHmAlc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{C6Y_BUwr.js → CmlXAF26.js} +1 -1
- package/build/client/_app/immutable/chunks/CmlXAF26.js.br +0 -0
- package/build/client/_app/immutable/chunks/CmlXAF26.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js +2 -0
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BDYCH-_Q.js → D5j4-ZO1.js} +1 -1
- package/build/client/_app/immutable/chunks/D5j4-ZO1.js.br +0 -0
- package/build/client/_app/immutable/chunks/D5j4-ZO1.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DW5EJMC7.js +1 -0
- package/build/client/_app/immutable/chunks/DW5EJMC7.js.br +0 -0
- package/build/client/_app/immutable/chunks/DW5EJMC7.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{D-uUm_OB.js → DptnDNFA.js} +61 -56
- package/build/client/_app/immutable/chunks/DptnDNFA.js.br +0 -0
- package/build/client/_app/immutable/chunks/{D-uUm_OB.js.gz → DptnDNFA.js.gz} +0 -0
- package/build/client/_app/immutable/chunks/DvJo0Zn0.js +1 -0
- package/build/client/_app/immutable/chunks/DvJo0Zn0.js.br +1 -0
- package/build/client/_app/immutable/chunks/DvJo0Zn0.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DzxE3j6C.js → qXnHMKD9.js} +1 -1
- package/build/client/_app/immutable/chunks/qXnHMKD9.js.br +0 -0
- package/build/client/_app/immutable/chunks/qXnHMKD9.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.BpT6WkO1.js → app.DPbjEDd3.js} +2 -2
- package/build/client/_app/immutable/entry/app.DPbjEDd3.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DPbjEDd3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.D3kiiIk_.js → 1.DWd6YbcT.js} +1 -1
- package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15._hpTnSzc.js +36 -0
- package/build/client/_app/immutable/nodes/15._hpTnSzc.js.br +0 -0
- package/build/client/_app/immutable/nodes/15._hpTnSzc.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.CUNbzjI_.js → 2.CS32Eh9m.js} +1 -1
- package/build/client/_app/immutable/nodes/2.CS32Eh9m.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CS32Eh9m.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.9OIre0ah.js → 20.CVaxGEhZ.js} +1 -1
- package/build/client/_app/immutable/nodes/20.CVaxGEhZ.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.CVaxGEhZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.DpKe0-GH.js +1 -0
- package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.gz +0 -0
- package/build/client/_app/immutable/nodes/24.DkL5kHzA.js +3 -0
- package/build/client/_app/immutable/nodes/24.DkL5kHzA.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.DkL5kHzA.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{25.DW1_vMxq.js → 25.DiYmTwXC.js} +2 -2
- package/build/client/_app/immutable/nodes/25.DiYmTwXC.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DiYmTwXC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/26.7nAJpm5P.js +5 -0
- package/build/client/_app/immutable/nodes/26.7nAJpm5P.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.7nAJpm5P.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.3Z4QUsQQ.js → 3.Ctd9OGCk.js} +1 -1
- package/build/client/_app/immutable/nodes/3.Ctd9OGCk.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.Ctd9OGCk.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{5.DmA9lTA-.js → 5.Wh_w3RkZ.js} +1 -1
- package/build/client/_app/immutable/nodes/5.Wh_w3RkZ.js.br +2 -0
- package/build/client/_app/immutable/nodes/5.Wh_w3RkZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.D6WLqCgl.js → 6.C-DiUI5R.js} +1 -1
- package/build/client/_app/immutable/nodes/6.C-DiUI5R.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.C-DiUI5R.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{7.CNuRjkv2.js → 7.B8yubYrv.js} +1 -1
- package/build/client/_app/immutable/nodes/7.B8yubYrv.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.B8yubYrv.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/runtime-meta.json +1 -1
- package/build/server/.vite/manifest.json +35 -45
- package/build/server/_app/immutable/assets/_layout.CqqJCiiV.css +2 -0
- package/build/server/chunks/DefinitionCard.js +3 -0
- package/build/server/chunks/DefinitionCard.js.map +1 -1
- package/build/server/chunks/access.js +15 -3
- package/build/server/chunks/access.js.map +1 -1
- package/build/server/chunks/api-errors.js +18 -3
- package/build/server/chunks/api-errors.js.map +1 -1
- package/build/server/chunks/api.js +9 -2
- package/build/server/chunks/api.js.map +1 -1
- package/build/server/chunks/auth-bootstrap.server.js +63 -39
- package/build/server/chunks/auth-bootstrap.server.js.map +1 -1
- package/build/server/chunks/boot.server.js +1 -1
- package/build/server/chunks/bootHealth.server.js +23 -23
- package/build/server/chunks/bootHealth.server.js.map +1 -1
- package/build/server/chunks/computeRateLimit.server.js +2 -2
- package/build/server/chunks/delete-with-blobs.js +1 -1
- package/build/server/chunks/engine.server.js +52 -5
- package/build/server/chunks/engine.server.js.map +1 -1
- package/build/server/chunks/grasshopper.js +217 -162
- package/build/server/chunks/grasshopper.js.map +1 -1
- package/build/server/chunks/handlers.js +70 -60
- package/build/server/chunks/handlers.js.map +1 -1
- package/build/server/chunks/http.js +24 -24
- package/build/server/chunks/http.js.map +1 -1
- package/build/server/chunks/http2.js +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/instanceAdmins.server.js +31 -16
- package/build/server/chunks/instanceAdmins.server.js.map +1 -1
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/{abort-Bfrdupaj.js → keepalive-vtcjhAV3.js} +6 -3
- package/build/server/chunks/keepalive-vtcjhAV3.js.map +1 -0
- package/build/server/chunks/liveSolve.server.js +1 -1
- package/build/server/chunks/localeContext.svelte.js +14 -0
- package/build/server/chunks/localeContext.svelte.js.map +1 -1
- package/build/server/chunks/oauth.js +70 -24
- package/build/server/chunks/oauth.js.map +1 -1
- package/build/server/chunks/{outcome-DNrffAXp.js → outcome-D28FgvFK.js} +9 -6
- package/build/server/chunks/outcome-D28FgvFK.js.map +1 -0
- package/build/server/chunks/package.js +2 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/permissions.server.js +1 -1
- package/build/server/chunks/presets.server.js +1 -1
- package/build/server/chunks/providers.server.js +324 -121
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/registry.js +1 -1
- package/build/server/chunks/resolve-server.js +1 -1
- package/build/server/chunks/schema-extraction.js +75 -8
- package/build/server/chunks/schema-extraction.js.map +1 -1
- package/build/server/chunks/schema.js +1 -1
- package/build/server/chunks/schema.js.map +1 -1
- package/build/server/chunks/server-config-write.js +6 -6
- package/build/server/chunks/server-config-write.js.map +1 -1
- package/build/server/chunks/server2.js +2 -2
- package/build/server/chunks/server2.js.map +1 -1
- package/build/server/chunks/serverStats.server.js +1 -1
- package/build/server/chunks/signInMaxAge.server.js +1 -1
- package/build/server/chunks/solve.server.js +34 -8
- package/build/server/chunks/solve.server.js.map +1 -1
- package/build/server/chunks/sveltekit.js +4 -5
- package/build/server/chunks/sveltekit.js.map +1 -1
- package/build/server/chunks/update-outcome.js +11 -0
- package/build/server/chunks/update-outcome.js.map +1 -1
- package/build/server/chunks/updateCheck.server.js +24 -12
- package/build/server/chunks/updateCheck.server.js.map +1 -1
- package/build/server/entries/endpoints/.well-known/oauth-authorization-server/_server.ts.js +6 -3
- package/build/server/entries/endpoints/.well-known/oauth-authorization-server/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/.well-known/oauth-protected-resource/_server.ts.js +6 -3
- package/build/server/entries/endpoints/.well-known/oauth-protected-resource/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/.well-known/oauth-protected-resource/mcp/_server.ts.js +6 -3
- package/build/server/entries/endpoints/.well-known/oauth-protected-resource/mcp/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/orgs/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +9 -2
- package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +59 -15
- package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +42 -16
- package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +24 -13
- package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js +2 -2
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +15 -6
- package/build/server/entries/endpoints/api/v1/compute/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +3 -3
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/publish/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_linkId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +5 -4
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/starred/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/token/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_tokenId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/members/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/members/_userId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/reclaim/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/solve/_solveId_/cancel/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/solve-events/_server.ts.js +1 -1
- package/build/server/entries/endpoints/auth/email/callback/_server.ts.js +2 -2
- package/build/server/entries/endpoints/auth/email/callback/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/auth/supabase/callback/_server.ts.js +2 -2
- package/build/server/entries/endpoints/auth/supabase/callback/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
- package/build/server/entries/endpoints/mcp/_server.ts.js +43 -13
- package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/oauth/register/_server.ts.js +1 -1
- package/build/server/entries/endpoints/oauth/token/_server.ts.js +1 -1
- package/build/server/entries/hooks.server.js +25 -6
- package/build/server/entries/hooks.server.js.map +1 -1
- package/build/server/entries/pages/admin/compute/_page.server.ts.js +1 -2
- package/build/server/entries/pages/admin/compute/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/admin/system/_page.server.ts.js +8 -3
- package/build/server/entries/pages/admin/system/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/admin/system/_page.svelte.js +18 -2
- package/build/server/entries/pages/admin/system/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +198 -99
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +693 -40
- package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/oauth/authorize/_page.server.ts.js +3 -2
- package/build/server/entries/pages/oauth/authorize/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/oauth/authorize/_page.svelte.js +8 -1
- package/build/server/entries/pages/oauth/authorize/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/projects/_page.svelte.js +2 -0
- package/build/server/entries/pages/projects/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/setup/_page.server.ts.js +62 -8
- package/build/server/entries/pages/setup/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/setup/_page.svelte.js +52 -33
- package/build/server/entries/pages/setup/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/team/tokens/_page.server.ts.js +1 -1
- package/build/server/manifest-full.js +1 -1
- package/build/server/manifest.js +1 -1
- package/build/server/nodes/0.js +2 -2
- package/build/server/nodes/1.js +1 -1
- package/build/server/nodes/15.js +1 -1
- package/build/server/nodes/2.js +1 -1
- package/build/server/nodes/20.js +1 -1
- package/build/server/nodes/21.js +1 -1
- package/build/server/nodes/24.js +1 -1
- package/build/server/nodes/25.js +1 -1
- package/build/server/nodes/26.js +1 -1
- package/build/server/nodes/3.js +1 -1
- package/build/server/nodes/5.js +1 -1
- package/build/server/nodes/6.js +1 -1
- package/build/server/nodes/7.js +1 -1
- package/build/server/server.js +1 -1
- package/package.json +16 -13
- package/templates/.env.example +15 -7
- package/build/client/_app/immutable/assets/0.2jDm0bqh.css +0 -2
- package/build/client/_app/immutable/assets/0.2jDm0bqh.css.br +0 -0
- package/build/client/_app/immutable/assets/0.2jDm0bqh.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BDYCH-_Q.js.br +0 -0
- package/build/client/_app/immutable/chunks/BDYCH-_Q.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C6Y_BUwr.js.br +0 -0
- package/build/client/_app/immutable/chunks/C6Y_BUwr.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CzfnuBzq.js.br +0 -0
- package/build/client/_app/immutable/chunks/CzfnuBzq.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D-uUm_OB.js.br +0 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js +0 -1
- package/build/client/_app/immutable/chunks/D84F7w9g.js.br +0 -1
- package/build/client/_app/immutable/chunks/D84F7w9g.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DQsP4nZb.js +0 -1
- package/build/client/_app/immutable/chunks/DQsP4nZb.js.br +0 -0
- package/build/client/_app/immutable/chunks/DQsP4nZb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DzeQucGI.js +0 -2
- package/build/client/_app/immutable/chunks/DzeQucGI.js.br +0 -0
- package/build/client/_app/immutable/chunks/DzeQucGI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DzxE3j6C.js.br +0 -0
- package/build/client/_app/immutable/chunks/DzxE3j6C.js.gz +0 -0
- package/build/client/_app/immutable/chunks/qi43d-TM.js.br +0 -0
- package/build/client/_app/immutable/chunks/qi43d-TM.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.D3kiiIk_.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.D3kiiIk_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.BXIV1QfS.js +0 -32
- package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.CUNbzjI_.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CUNbzjI_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.9OIre0ah.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.9OIre0ah.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js +0 -1
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/24.CPSunfJJ.js +0 -3
- package/build/client/_app/immutable/nodes/24.CPSunfJJ.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.CPSunfJJ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.DW1_vMxq.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DW1_vMxq.js.gz +0 -0
- package/build/client/_app/immutable/nodes/26.CqaMEm_t.js +0 -6
- package/build/client/_app/immutable/nodes/26.CqaMEm_t.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.CqaMEm_t.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.3Z4QUsQQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.3Z4QUsQQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.DmA9lTA-.js.br +0 -1
- package/build/client/_app/immutable/nodes/5.DmA9lTA-.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.D6WLqCgl.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.D6WLqCgl.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.CNuRjkv2.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.CNuRjkv2.js.gz +0 -0
- package/build/server/_app/immutable/assets/_layout.2jDm0bqh.css +0 -2
- package/build/server/chunks/abort-Bfrdupaj.js.map +0 -1
- package/build/server/chunks/computeLimits.js +0 -33
- package/build/server/chunks/computeLimits.js.map +0 -1
- package/build/server/chunks/outcome-DNrffAXp.js.map +0 -1
- /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js → 0.Ds0zeDAg.js} +0 -0
- /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.br → 0.Ds0zeDAg.js.br} +0 -0
- /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.gz → 0.Ds0zeDAg.js.gz} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeContext.svelte.js","names":[],"sources":["../../../../ui/src/lib/i18n/messages.ts","../../../../ui/src/lib/i18n/localeContext.svelte.ts"],"sourcesContent":["// ============================================================================\n// Viewer message catalog (library-owned strings)\n// ============================================================================\n//\n// Only the strings @selvajs/ui renders itself. Names coming from a Grasshopper\n// definition — meshes, layers, metadata keys — live in the user's .gh file and\n// cannot be translated here.\n//\n// A `{name}` in a message is a placeholder the component fills in. Pairs ending in\n// `One`/`Other` are the singular and plural forms of one message.\n\nexport type Locale = 'en' | 'de';\n\nexport interface ViewerMessages {\n\t// Tools menu\n\ttoolsMenu: string;\n\tswitchToOrthographic: string;\n\tswitchToPerspective: string;\n\tfitToView: string;\n\tviews: string;\n\tmeasure: string;\n\tgrid: string;\n\tdisplay: string;\n\tedges: string;\n\tsceneManager: string;\n\tscreenshot: string;\n\tfullscreen: string;\n\texitFullscreen: string;\n\n\t// View presets\n\tviewTop: string;\n\tviewFront: string;\n\tviewRight: string;\n\tviewBack: string;\n\tviewLeft: string;\n\tviewBottom: string;\n\tviewIso: string;\n\n\t// Display looks\n\tlookTechnical: string;\n\tlookStudio: string;\n\tlookShowcase: string;\n\tlookNight: string;\n\tnightMode: string;\n\tlookArctic: string;\n\tlookXray: string;\n\tlookLineart: string;\n\tlookWireframe: string;\n\n\t// Scene manager\n\tsearchObjects: string;\n\tclearSearch: string;\n\texpandLayer: string;\n\tcollapseLayer: string;\n\texpandAll: string;\n\tcollapseAll: string;\n\tshowLayer: string;\n\thideLayer: string;\n\tshowObject: string;\n\thideObject: string;\n\tnoObjects: string;\n\t/** `{query}` is replaced with the current search text. */\n\tnoResultsFor: string;\n\n\t// Metadata dialog\n\tobjectFallbackName: string;\n\tnoMetadata: string;\n\n\t// App layout / compute shell\n\tloadingSchema: string;\n\tsolveBlocked: string;\n\tsolveBlockedTitle: string;\n\tsolveMessagesTitle: string;\n\tsolveMessagesDescription: string;\n\tsolveMessagesConfirm: string;\n\tsolveMessagesDiscard: string;\n\tsolveMessagesAbort: string;\n\t/** Stands in for Abort where the page can't take a click mid-solve. */\n\tsolveMessagesEscHint: string;\n\tsolveMessagesDismiss: string;\n\tsolveSolving: string;\n\t/** A visible solve has landed; followed by how long it took. */\n\tsolveDone: string;\n\t/** A visible solve was aborted; the previous result stays. */\n\tsolveStopped: string;\n\tparametersTab: string;\n\tmoreTab: string;\n\tscrollTabsBack: string;\n\tscrollTabsForward: string;\n\t/** `{side}` is replaced with `panelSideLeft` / `panelSideRight`. */\n\texpandSidePanel: string;\n\tpanelSideLeft: string;\n\tpanelSideRight: string;\n\ttabNoGroups: string;\n\n\t// Solve controls\n\tsolving: string;\n\tsolvingEllipsis: string;\n\tsolvingSubtitle: string;\n\tpressToCalculate: string;\n\tcalculate: string;\n\tupToDate: string;\n\t/** The panel footer's ⋯ menu: saving and loading inputs, plus the host's own actions. */\n\tmoreActions: string;\n\t/** Under a menu action that solves before it runs, while the inputs have changed. */\n\tcalculatesFirst: string;\n\n\t// Footer and message centre\n\t/** `{count}` is replaced with the number of errors. */\n\terrorCountOne: string;\n\terrorCountOther: string;\n\t/** `{count}` is replaced with the number of warnings. */\n\twarningCountOne: string;\n\twarningCountOther: string;\n\t/** `{count}` is replaced with the number of notes. */\n\tnoteCountOne: string;\n\tnoteCountOther: string;\n\t/** `{count}` is replaced with the number of messages. */\n\tlastSolveMessagesOne: string;\n\tlastSolveMessagesOther: string;\n\tmessagesTitle: string;\n\t/** `{name}` is replaced with the copyright holder, `{year}` with the current year. */\n\tcopyright: string;\n\tclose: string;\n\ttoggleTheme: string;\n\terrorTitle: string;\n\tgoHome: string;\n\n\t// Input fields\n\tselectOption: string;\n\tnoOptionsYet: string;\n\t/** `{min}` is replaced with the field's minimum. */\n\tminValue: string;\n\t/** `{max}` is replaced with the field's maximum. */\n\tmaxValue: string;\n\tfineDragHint: string;\n\t/** `{max}` is replaced with the field's character limit. */\n\tmaxLength: string;\n\tinvalidFormat: string;\n\t/** Trigger label; `{color}` is the current hex value. */\n\tcolorPick: string;\n\tcolorArea: string;\n\t/** `{s}` and `{v}` are percentages. */\n\tcolorAreaValue: string;\n\tcolorHue: string;\n\tcolorHex: string;\n\tcolorHexInvalid: string;\n\tcolorPresets: string;\n\tcolorEyedropper: string;\n\tinvalidPattern: string;\n\n\t// Geometry input (Rhino only)\n\t/** The pick button when the input takes several kinds of object. */\n\tgeometryPickAnyOne: string;\n\tgeometryPickAnyOther: string;\n\t/** Shown while Rhino's viewport prompt for a pick is open. */\n\tgeometryPicking: string;\n\t/** Where this page may not pick, such as a browser tab beside the Rhino panel. */\n\tgeometryPickInPanel: string;\n\tgeometryPickAgain: string;\n\tgeometryClear: string;\n\t// The pick button when the input takes one kind: `One` picks a single object, `Other` several.\n\tgeometryPickPointOne: string;\n\tgeometryPickPointOther: string;\n\tgeometryPickPointCloudOne: string;\n\tgeometryPickPointCloudOther: string;\n\tgeometryPickCurveOne: string;\n\tgeometryPickCurveOther: string;\n\tgeometryPickLineOne: string;\n\tgeometryPickLineOther: string;\n\tgeometryPickPlaneOne: string;\n\tgeometryPickPlaneOther: string;\n\tgeometryPickSurfaceOne: string;\n\tgeometryPickSurfaceOther: string;\n\tgeometryPickPolysurfaceOne: string;\n\tgeometryPickPolysurfaceOther: string;\n\tgeometryPickExtrusionOne: string;\n\tgeometryPickExtrusionOther: string;\n\tgeometryPickMeshOne: string;\n\tgeometryPickMeshOther: string;\n\tgeometryPickSubdOne: string;\n\tgeometryPickSubdOther: string;\n\tgeometryPickBlockOne: string;\n\tgeometryPickBlockOther: string;\n\n\t// File input\n\tfileModeUpload: string;\n\tfileModeUrl: string;\n\tfileUrlLabel: string;\n\tfetchFile: string;\n\tfetchingFile: string;\n\tfileUrlPublic: string;\n\tchooseFile: string;\n\t/** `{formats}` is replaced with the accepted extensions. */\n\tacceptedFormats: string;\n\t/** `{ext}` is replaced with the file's extension. */\n\tuploadedFile: string;\n\t/** `{ext}` is replaced with the file's extension, `{size}` with its size in MB. */\n\tuploadedFileSize: string;\n\t/** `{ext}` is replaced with the file's extension, `{size}` with its size in KB. */\n\tfileLoaded: string;\n\turlInvalid: string;\n\turlProtocolUnsupported: string;\n\t/** `{status}` is replaced with the HTTP status the server answered with. */\n\turlServerError: string;\n\t/** `{ext}` is replaced with the rejected extension, `{formats}` with the accepted ones. */\n\tfileFormatNotAccepted: string;\n\t/** `{size}` is replaced with the file's size in MB, `{max}` with the limit in MB. */\n\tfileTooLarge: string;\n\tfileTooLargeUseUpload: string;\n\tfileReadFailed: string;\n\t/** `{host}` is replaced with the URL's host name. */\n\turlUnreachable: string;\n\turlUnreachableHint: string;\n\turlHintSharePoint: string;\n\turlHintGoogleDrive: string;\n\turlHintDropbox: string;\n\tunknownError: string;\n\n\t// Outputs\n\twaitingForData: string;\n\twaitingForFiles: string;\n\t/** `{count}` is replaced with the number of files. */\n\tfileCount: string;\n\tduplicateFilesTitle: string;\n\tduplicatePathsOne: string;\n\tduplicatePathsOther: string;\n\tduplicateFilesHint: string;\n\tdownloadFile: string;\n\t/** `{count}` is replaced with the number of files. */\n\tdownloadFiles: string;\n\tdownloading: string;\n\tdownloadFailed: string;\n\tcopy: string;\n\tcopied: string;\n\tchartReceiving: string;\n\tchartRenderFailed: string;\n\tdownloadChartImage: string;\n\t/** `{error}` is replaced with the browser's reason. */\n\tfullscreenUnavailable: string;\n\t/** `{error}` is replaced with the browser's reason. */\n\texitFullscreenFailed: string;\n\n\t// Image output\n\timageViewer: string;\n\timageLoading: string;\n\t/** `{ext}` is replaced with the file's extension, `{formats}` with the supported ones. */\n\timageUnsupported: string;\n\timageUnknownFormat: string;\n\t/** `{file}` is replaced with the file's name. */\n\timageDecodeFailed: string;\n\tpreviousImage: string;\n\tnextImage: string;\n\tzoomHint: string;\n\tzoomIn: string;\n\tzoomOut: string;\n\tzoomFit: string;\n\tzoomActual: string;\n\tdownloadImage: string;\n}\n\nconst en: ViewerMessages = {\n\ttoolsMenu: 'Viewer tools',\n\tswitchToOrthographic: 'Orthographic camera',\n\tswitchToPerspective: 'Perspective camera',\n\tfitToView: 'Fit to view',\n\tviews: 'Views',\n\tmeasure: 'Measure',\n\tgrid: 'Grid',\n\tdisplay: 'Display',\n\tedges: 'Edges',\n\tsceneManager: 'Scene manager',\n\tscreenshot: 'Screenshot',\n\tfullscreen: 'Fullscreen',\n\texitFullscreen: 'Exit fullscreen',\n\n\tviewTop: 'Top',\n\tviewFront: 'Front',\n\tviewRight: 'Right',\n\tviewBack: 'Back',\n\tviewLeft: 'Left',\n\tviewBottom: 'Bottom',\n\tviewIso: 'Isometric',\n\n\tlookTechnical: 'Technical',\n\tlookStudio: 'Studio',\n\tlookShowcase: 'Showcase',\n\tlookNight: 'Night',\n\tnightMode: 'Night mode',\n\tlookArctic: 'Arctic',\n\tlookXray: 'X-Ray',\n\tlookLineart: 'Line Art',\n\tlookWireframe: 'Wireframe',\n\n\tsearchObjects: 'Search objects...',\n\tclearSearch: 'Clear search',\n\texpandLayer: 'Expand layer',\n\tcollapseLayer: 'Collapse layer',\n\texpandAll: 'Expand all',\n\tcollapseAll: 'Collapse all',\n\tshowLayer: 'Show layer',\n\thideLayer: 'Hide layer',\n\tshowObject: 'Show object',\n\thideObject: 'Hide object',\n\tnoObjects: 'No objects',\n\tnoResultsFor: 'No results for \"{query}\"',\n\n\tobjectFallbackName: 'Object',\n\tnoMetadata: 'No metadata',\n\n\tloadingSchema: 'Loading…',\n\tsolveBlocked: 'The definition stopped this solve. No results were produced.',\n\tsolveBlockedTitle: 'Solve stopped',\n\tsolveMessagesTitle: 'Solve messages',\n\tsolveMessagesDescription: 'This solve reported the following. Continue to see the result.',\n\tsolveMessagesConfirm: 'Continue',\n\tsolveMessagesDiscard: 'Discard',\n\tsolveMessagesAbort: 'Abort',\n\tsolveMessagesEscHint: 'Esc aborts the solve',\n\tsolveMessagesDismiss: 'Dismiss',\n\tsolveSolving: 'Solving…',\n\tsolveDone: 'Done',\n\tsolveStopped: 'Stopped',\n\tparametersTab: 'Parameters',\n\tmoreTab: 'More',\n\tscrollTabsBack: 'Previous tabs',\n\tscrollTabsForward: 'More tabs',\n\texpandSidePanel: 'Expand {side} panel',\n\tpanelSideLeft: 'left',\n\tpanelSideRight: 'right',\n\ttabNoGroups: 'This tab has no groups configured.',\n\n\tsolving: 'Solving',\n\tsolvingEllipsis: 'Solving...',\n\tsolvingSubtitle: 'This can take a moment…',\n\tpressToCalculate: 'Press to calculate',\n\tcalculate: 'Calculate',\n\tupToDate: 'Up to date',\n\tmoreActions: 'More actions',\n\tcalculatesFirst: 'Calculates first',\n\n\terrorCountOne: '{count} error',\n\terrorCountOther: '{count} errors',\n\twarningCountOne: '{count} warning',\n\twarningCountOther: '{count} warnings',\n\tnoteCountOne: '{count} note',\n\tnoteCountOther: '{count} notes',\n\tlastSolveMessagesOne: '{count} message from the last solve',\n\tlastSolveMessagesOther: '{count} messages from the last solve',\n\tmessagesTitle: 'Messages',\n\tcopyright: 'by {name} © {year}',\n\tclose: 'Close',\n\ttoggleTheme: 'Toggle theme',\n\terrorTitle: 'Error',\n\tgoHome: 'Go Home',\n\n\tselectOption: 'Select an option...',\n\tnoOptionsYet: 'No options available yet.',\n\tminValue: 'Minimum value is {min}',\n\tmaxValue: 'Maximum value is {max}',\n\tfineDragHint: 'Hold Shift to drag finely',\n\tmaxLength: 'Maximum {max} characters allowed',\n\tinvalidFormat: 'Invalid format',\n\tcolorPick: 'Choose color, currently {color}',\n\tcolorArea: 'Saturation and brightness',\n\tcolorAreaValue: 'Saturation {s}%, brightness {v}%',\n\tcolorHue: 'Hue',\n\tcolorHex: 'Hex color',\n\tcolorHexInvalid: 'Enter a hex color such as #2f6fd6',\n\tcolorPresets: 'Presets',\n\tcolorEyedropper: 'Pick a color from the screen',\n\tinvalidPattern: 'Invalid validation pattern configured',\n\n\tgeometryPickAnyOne: 'Pick an object',\n\tgeometryPickAnyOther: 'Pick objects',\n\tgeometryPicking: 'Pick in the viewport, Esc to cancel',\n\tgeometryPickInPanel: 'Pick in the Rhino panel',\n\tgeometryPickAgain: 'Pick again',\n\tgeometryClear: 'Clear',\n\tgeometryPickPointOne: 'Pick a point',\n\tgeometryPickPointOther: 'Pick points',\n\tgeometryPickPointCloudOne: 'Pick a point cloud',\n\tgeometryPickPointCloudOther: 'Pick point clouds',\n\tgeometryPickCurveOne: 'Pick a curve',\n\tgeometryPickCurveOther: 'Pick curves',\n\tgeometryPickLineOne: 'Pick a line',\n\tgeometryPickLineOther: 'Pick lines',\n\tgeometryPickPlaneOne: 'Pick a plane',\n\tgeometryPickPlaneOther: 'Pick planes',\n\tgeometryPickSurfaceOne: 'Pick a surface',\n\tgeometryPickSurfaceOther: 'Pick surfaces',\n\tgeometryPickPolysurfaceOne: 'Pick a polysurface',\n\tgeometryPickPolysurfaceOther: 'Pick polysurfaces',\n\tgeometryPickExtrusionOne: 'Pick an extrusion',\n\tgeometryPickExtrusionOther: 'Pick extrusions',\n\tgeometryPickMeshOne: 'Pick a mesh',\n\tgeometryPickMeshOther: 'Pick meshes',\n\tgeometryPickSubdOne: 'Pick a SubD',\n\tgeometryPickSubdOther: 'Pick SubDs',\n\tgeometryPickBlockOne: 'Pick a block',\n\tgeometryPickBlockOther: 'Pick blocks',\n\n\tfileModeUpload: 'Upload',\n\tfileModeUrl: 'URL',\n\tfileUrlLabel: 'File URL',\n\tfetchFile: 'Fetch',\n\tfetchingFile: 'Fetching...',\n\tfileUrlPublic: 'URL must be publicly accessible (no login required).',\n\tchooseFile: 'Choose File or Drag & Drop',\n\tacceptedFormats: 'Accepted formats: {formats}',\n\tuploadedFile: 'Uploaded file ({ext})',\n\tuploadedFileSize: 'Uploaded file ({ext}, {size}MB)',\n\tfileLoaded: 'Loaded {ext} ({size} KB)',\n\turlInvalid: 'Invalid URL — make sure it starts with https://',\n\turlProtocolUnsupported: 'Only http:// and https:// URLs are supported.',\n\turlServerError: 'Server returned {status}. Check the URL is correct and publicly accessible.',\n\tfileFormatNotAccepted: 'File format \"{ext}\" is not accepted. Allowed: {formats}',\n\tfileTooLarge: 'File too large: {size}MB (max {max}MB).',\n\tfileTooLargeUseUpload: 'Download it and use Upload instead.',\n\tfileReadFailed: 'Failed to read the downloaded file.',\n\turlUnreachable:\n\t\t'Could not reach \"{host}\" — the file may not exist, or the server does not allow browser access.',\n\turlUnreachableHint:\n\t\t'Check that the URL is correct and the file is publicly accessible. If the server requires login, download the file and use the Upload option instead.',\n\turlHintSharePoint:\n\t\t'SharePoint/OneDrive blocks browser access. Open the file in SharePoint, use \"Download\" to save it locally, then upload it here.',\n\turlHintGoogleDrive:\n\t\t'Google Drive blocks browser access. Use \"Download\" in Google Drive to save the file locally, then upload it here.',\n\turlHintDropbox:\n\t\t'Dropbox links may block browser access. Try changing \"?dl=0\" to \"?dl=1\" in the URL, or download and upload instead.',\n\tunknownError: 'Unknown error',\n\n\twaitingForData: 'Waiting for data...',\n\twaitingForFiles: 'Waiting for file data...',\n\tfileCount: '{count} files',\n\tduplicateFilesTitle: 'Duplicate file names detected',\n\tduplicatePathsOne: 'The following path appears more than once:',\n\tduplicatePathsOther: 'The following paths appear more than once:',\n\tduplicateFilesHint:\n\t\t'Rename outputs in your Grasshopper definition so each file has a unique name.',\n\tdownloadFile: 'Download File',\n\tdownloadFiles: 'Download {count} Files',\n\tdownloading: 'Downloading...',\n\tdownloadFailed: 'Download failed',\n\tcopy: 'Copy',\n\tcopied: 'Copied!',\n\tchartReceiving: 'Receiving chart data...',\n\tchartRenderFailed: 'Failed to render chart',\n\tdownloadChartImage: 'Download plot as image',\n\tfullscreenUnavailable: 'Fullscreen unavailable: {error}',\n\texitFullscreenFailed: 'Exit fullscreen failed: {error}',\n\n\timageViewer: 'image viewer',\n\timageLoading: 'Loading image…',\n\timageUnsupported: 'Unsupported image format: {ext}. Supported: {formats}',\n\timageUnknownFormat: '(unknown)',\n\timageDecodeFailed: \"Couldn't decode {file}\",\n\tpreviousImage: 'Previous image',\n\tnextImage: 'Next image',\n\tzoomHint: 'Hold Ctrl or ⌘ and scroll to zoom',\n\tzoomIn: 'Zoom in',\n\tzoomOut: 'Zoom out',\n\tzoomFit: 'Fit',\n\tzoomActual: 'Actual pixels',\n\tdownloadImage: 'Download image'\n};\n\nconst de: ViewerMessages = {\n\ttoolsMenu: 'Viewer-Werkzeuge',\n\tswitchToOrthographic: 'Orthografische Kamera',\n\tswitchToPerspective: 'Perspektivische Kamera',\n\tfitToView: 'Ansicht anpassen',\n\tviews: 'Ansichten',\n\tmeasure: 'Messen',\n\tgrid: 'Raster',\n\tdisplay: 'Darstellung',\n\tedges: 'Kanten',\n\tsceneManager: 'Szenen-Manager',\n\tscreenshot: 'Screenshot',\n\tfullscreen: 'Vollbild',\n\texitFullscreen: 'Vollbild beenden',\n\n\tviewTop: 'Oben',\n\tviewFront: 'Vorne',\n\tviewRight: 'Rechts',\n\tviewBack: 'Hinten',\n\tviewLeft: 'Links',\n\tviewBottom: 'Unten',\n\tviewIso: 'Isometrisch',\n\n\tlookTechnical: 'Technisch',\n\tlookStudio: 'Studio',\n\tlookShowcase: 'Präsentation',\n\tlookNight: 'Nacht',\n\tnightMode: 'Nachtmodus',\n\tlookArctic: 'Arktis',\n\tlookXray: 'Röntgen',\n\tlookLineart: 'Strichzeichnung',\n\tlookWireframe: 'Drahtgitter',\n\n\tsearchObjects: 'Objekte suchen...',\n\tclearSearch: 'Suche löschen',\n\texpandLayer: 'Ebene aufklappen',\n\tcollapseLayer: 'Ebene zuklappen',\n\texpandAll: 'Alle aufklappen',\n\tcollapseAll: 'Alle zuklappen',\n\tshowLayer: 'Ebene einblenden',\n\thideLayer: 'Ebene ausblenden',\n\tshowObject: 'Objekt einblenden',\n\thideObject: 'Objekt ausblenden',\n\tnoObjects: 'Keine Objekte',\n\tnoResultsFor: 'Keine Ergebnisse für „{query}“',\n\n\tobjectFallbackName: 'Objekt',\n\tnoMetadata: 'Keine Metadaten',\n\n\tloadingSchema: 'Wird geladen…',\n\tsolveBlocked: 'Die Definition hat diese Berechnung gestoppt. Es wurden keine Ergebnisse erzeugt.',\n\tsolveBlockedTitle: 'Berechnung gestoppt',\n\tsolveMessagesTitle: 'Meldungen zur Berechnung',\n\tsolveMessagesDescription:\n\t\t'Diese Berechnung hat Folgendes gemeldet. Weiter, um das Ergebnis zu sehen.',\n\tsolveMessagesConfirm: 'Weiter',\n\tsolveMessagesDiscard: 'Verwerfen',\n\tsolveMessagesAbort: 'Abbrechen',\n\tsolveMessagesEscHint: 'Esc bricht die Berechnung ab',\n\tsolveMessagesDismiss: 'Schliessen',\n\tsolveSolving: 'Berechnung läuft…',\n\tsolveDone: 'Fertig',\n\tsolveStopped: 'Abgebrochen',\n\tparametersTab: 'Parameter',\n\tmoreTab: 'Mehr',\n\tscrollTabsBack: 'Vorherige Tabs',\n\tscrollTabsForward: 'Weitere Tabs',\n\texpandSidePanel: '{side} Bereich aufklappen',\n\tpanelSideLeft: 'Linken',\n\tpanelSideRight: 'Rechten',\n\ttabNoGroups: 'Für diesen Tab sind keine Gruppen konfiguriert.',\n\n\tsolving: 'Berechnung läuft',\n\tsolvingEllipsis: 'Berechnung läuft...',\n\tsolvingSubtitle: 'Das kann einen Moment dauern…',\n\tpressToCalculate: 'Berechnen',\n\tcalculate: 'Berechnen',\n\tupToDate: 'Berechnet',\n\tmoreActions: 'Weitere Aktionen',\n\tcalculatesFirst: 'Berechnet zuerst',\n\n\terrorCountOne: '{count} Fehler',\n\terrorCountOther: '{count} Fehler',\n\twarningCountOne: '{count} Warnung',\n\twarningCountOther: '{count} Warnungen',\n\tnoteCountOne: '{count} Hinweis',\n\tnoteCountOther: '{count} Hinweise',\n\tlastSolveMessagesOne: '{count} Meldung der letzten Berechnung',\n\tlastSolveMessagesOther: '{count} Meldungen der letzten Berechnung',\n\tmessagesTitle: 'Meldungen',\n\tcopyright: 'von {name} © {year}',\n\tclose: 'Schliessen',\n\ttoggleTheme: 'Farbschema wechseln',\n\terrorTitle: 'Fehler',\n\tgoHome: 'Zur Startseite',\n\n\tselectOption: 'Option wählen…',\n\tnoOptionsYet: 'Noch keine Optionen verfügbar.',\n\tminValue: 'Der kleinste erlaubte Wert ist {min}',\n\tmaxValue: 'Der grösste erlaubte Wert ist {max}',\n\tfineDragHint: 'Umschalttaste halten für feine Schritte',\n\tmaxLength: 'Höchstens {max} Zeichen erlaubt',\n\tinvalidFormat: 'Ungültiges Format',\n\tcolorPick: 'Farbe wählen, aktuell {color}',\n\tcolorArea: 'Sättigung und Helligkeit',\n\tcolorAreaValue: 'Sättigung {s} %, Helligkeit {v} %',\n\tcolorHue: 'Farbton',\n\tcolorHex: 'Hex-Farbe',\n\tcolorHexInvalid: 'Hex-Farbe eingeben, z. B. #2f6fd6',\n\tcolorPresets: 'Vorgaben',\n\tcolorEyedropper: 'Farbe vom Bildschirm aufnehmen',\n\tinvalidPattern: 'Ungültiges Prüfmuster hinterlegt',\n\n\tgeometryPickAnyOne: 'Objekt wählen',\n\tgeometryPickAnyOther: 'Objekte wählen',\n\tgeometryPicking: 'Im Ansichtsfenster wählen, Esc bricht ab',\n\tgeometryPickInPanel: 'Im Rhino-Panel wählen',\n\tgeometryPickAgain: 'Neu wählen',\n\tgeometryClear: 'Leeren',\n\tgeometryPickPointOne: 'Punkt wählen',\n\tgeometryPickPointOther: 'Punkte wählen',\n\tgeometryPickPointCloudOne: 'Punktwolke wählen',\n\tgeometryPickPointCloudOther: 'Punktwolken wählen',\n\tgeometryPickCurveOne: 'Kurve wählen',\n\tgeometryPickCurveOther: 'Kurven wählen',\n\tgeometryPickLineOne: 'Linie wählen',\n\tgeometryPickLineOther: 'Linien wählen',\n\tgeometryPickPlaneOne: 'Ebene wählen',\n\tgeometryPickPlaneOther: 'Ebenen wählen',\n\tgeometryPickSurfaceOne: 'Fläche wählen',\n\tgeometryPickSurfaceOther: 'Flächen wählen',\n\tgeometryPickPolysurfaceOne: 'Flächenverband wählen',\n\tgeometryPickPolysurfaceOther: 'Flächenverbände wählen',\n\tgeometryPickExtrusionOne: 'Extrusion wählen',\n\tgeometryPickExtrusionOther: 'Extrusionen wählen',\n\tgeometryPickMeshOne: 'Netz wählen',\n\tgeometryPickMeshOther: 'Netze wählen',\n\tgeometryPickSubdOne: 'SubD wählen',\n\tgeometryPickSubdOther: 'SubDs wählen',\n\tgeometryPickBlockOne: 'Block wählen',\n\tgeometryPickBlockOther: 'Blöcke wählen',\n\n\tfileModeUpload: 'Hochladen',\n\tfileModeUrl: 'URL',\n\tfileUrlLabel: 'Datei-URL',\n\tfetchFile: 'Abrufen',\n\tfetchingFile: 'Wird abgerufen…',\n\tfileUrlPublic: 'Die URL muss öffentlich erreichbar sein (ohne Anmeldung).',\n\tchooseFile: 'Datei wählen oder hierher ziehen',\n\tacceptedFormats: 'Erlaubte Formate: {formats}',\n\tuploadedFile: 'Hochgeladene Datei ({ext})',\n\tuploadedFileSize: 'Hochgeladene Datei ({ext}, {size} MB)',\n\tfileLoaded: '{ext} geladen ({size} KB)',\n\turlInvalid: 'Ungültige URL – sie muss mit https:// beginnen',\n\turlProtocolUnsupported: 'Nur http://- und https://-URLs werden unterstützt.',\n\turlServerError:\n\t\t'Der Server antwortete mit {status}. Ist die URL korrekt und öffentlich erreichbar?',\n\tfileFormatNotAccepted: 'Dateiformat „{ext}“ ist nicht erlaubt. Erlaubt: {formats}',\n\tfileTooLarge: 'Datei zu gross: {size} MB (höchstens {max} MB).',\n\tfileTooLargeUseUpload: 'Datei herunterladen und stattdessen über „Hochladen“ einfügen.',\n\tfileReadFailed: 'Die heruntergeladene Datei konnte nicht gelesen werden.',\n\turlUnreachable:\n\t\t'„{host}“ ist nicht erreichbar – die Datei existiert vielleicht nicht, oder der Server erlaubt keinen Zugriff aus dem Browser.',\n\turlUnreachableHint:\n\t\t'Prüfen, ob die URL stimmt und die Datei öffentlich erreichbar ist. Verlangt der Server eine Anmeldung: Datei herunterladen und über „Hochladen“ einfügen.',\n\turlHintSharePoint:\n\t\t'SharePoint/OneDrive sperrt den Zugriff aus dem Browser. Datei in SharePoint öffnen, mit „Herunterladen“ lokal speichern und hier hochladen.',\n\turlHintGoogleDrive:\n\t\t'Google Drive sperrt den Zugriff aus dem Browser. Datei in Google Drive mit „Herunterladen“ lokal speichern und hier hochladen.',\n\turlHintDropbox:\n\t\t'Dropbox-Links sperren den Zugriff aus dem Browser oft. In der URL „?dl=0“ durch „?dl=1“ ersetzen oder die Datei herunterladen und hochladen.',\n\tunknownError: 'Unbekannter Fehler',\n\n\twaitingForData: 'Noch keine Daten',\n\twaitingForFiles: 'Noch keine Dateien',\n\tfileCount: '{count} Dateien',\n\tduplicateFilesTitle: 'Doppelte Dateinamen',\n\tduplicatePathsOne: 'Dieser Pfad kommt mehrfach vor:',\n\tduplicatePathsOther: 'Diese Pfade kommen mehrfach vor:',\n\tduplicateFilesHint:\n\t\t'Ausgaben in der Grasshopper-Definition umbenennen, damit jede Datei einen eindeutigen Namen hat.',\n\tdownloadFile: 'Datei herunterladen',\n\tdownloadFiles: '{count} Dateien herunterladen',\n\tdownloading: 'Wird heruntergeladen…',\n\tdownloadFailed: 'Download fehlgeschlagen',\n\tcopy: 'Kopieren',\n\tcopied: 'Kopiert!',\n\tchartReceiving: 'Diagrammdaten werden empfangen…',\n\tchartRenderFailed: 'Diagramm konnte nicht dargestellt werden',\n\tdownloadChartImage: 'Diagramm als Bild herunterladen',\n\tfullscreenUnavailable: 'Vollbild nicht verfügbar: {error}',\n\texitFullscreenFailed: 'Vollbild konnte nicht beendet werden: {error}',\n\n\timageViewer: 'Bildbetrachter',\n\timageLoading: 'Bild wird geladen…',\n\timageUnsupported: 'Bildformat nicht unterstützt: {ext}. Unterstützt: {formats}',\n\timageUnknownFormat: '(unbekannt)',\n\timageDecodeFailed: '{file} konnte nicht gelesen werden',\n\tpreviousImage: 'Vorheriges Bild',\n\tnextImage: 'Nächstes Bild',\n\tzoomHint: 'Zum Zoomen Strg oder ⌘ halten und scrollen',\n\tzoomIn: 'Vergrössern',\n\tzoomOut: 'Verkleinern',\n\tzoomFit: 'Einpassen',\n\tzoomActual: 'Originalgrösse',\n\tdownloadImage: 'Bild herunterladen'\n};\n\nexport const VIEWER_MESSAGES: Record<Locale, ViewerMessages> = { en, de };\n\nexport const DEFAULT_LOCALE: Locale = 'en';\n\n/** Resolve a catalog for a locale, falling back to English for unknown locales. */\nexport function messagesFor(locale: Locale | undefined): ViewerMessages {\n\treturn VIEWER_MESSAGES[locale ?? DEFAULT_LOCALE] ?? VIEWER_MESSAGES[DEFAULT_LOCALE];\n}\n\n/** Layers a host's partial overrides over a full catalog. An `undefined` entry keeps the base string. */\nexport function withOverrides(\n\tbase: ViewerMessages,\n\toverrides: Partial<ViewerMessages> | undefined\n): ViewerMessages {\n\tif (!overrides) return base;\n\tconst merged = { ...base };\n\tfor (const [key, value] of Object.entries(overrides) as [keyof ViewerMessages, string][]) {\n\t\tif (value !== undefined) merged[key] = value;\n\t}\n\treturn merged;\n}\n\n/** Fills each `{name}` placeholder from `vars`; an unknown placeholder is left as written. */\nexport function formatMessage(template: string, vars: Record<string, string | number>): string {\n\treturn template.replace(/\\{(\\w+)\\}/g, (placeholder, name: string) =>\n\t\tname in vars ? String(vars[name]) : placeholder\n\t);\n}\n\n/** Picks the singular or plural form for `count` and fills its `{count}`. */\nexport function formatCount(count: number, one: string, other: string): string {\n\treturn formatMessage(count === 1 ? one : other, { count });\n}\n","import { getContext, setContext } from 'svelte';\nimport {\n\ttype Locale,\n\ttype ViewerMessages,\n\tmessagesFor,\n\twithOverrides,\n\tDEFAULT_LOCALE\n} from './messages';\n\n// Carries the UI locale down to the viewer and its panels without threading a\n// `lang` prop through every layer.\n//\n// Resolution order for any consuming component:\n// explicit `lang` prop → nearest locale context → English default\n// and the strings are that locale's catalog with any `messages` overrides on top.\n//\n// Two ways to provide it:\n// - Standalone: <Viewer lang=\"de\" /> — Viewer provides the context itself.\n// - In an app: call setLocaleContext(() => app.locale) once at the root; the\n// viewer (and anything else) reads it.\n\nconst LOCALE_CONTEXT_KEY = Symbol('viewer-locale-context');\n\nexport interface LocaleContext {\n\treadonly locale: Locale;\n\treadonly messages: ViewerMessages;\n}\n\n/**\n * Provide the locale to descendants. Pass getters, not values: they are re-read on every\n * consumer render, so a reactive source (a `$state`, the app's Paraglide locale) switches\n * the language live. `getOverrides` replaces individual strings of the resolved catalog.\n */\nexport function setLocaleContext(\n\tgetLocale: () => Locale | undefined,\n\tgetOverrides?: () => Partial<ViewerMessages> | undefined\n): void {\n\tconst ctx: LocaleContext = {\n\t\tget locale() {\n\t\t\treturn getLocale() ?? DEFAULT_LOCALE;\n\t\t},\n\t\tget messages() {\n\t\t\treturn withOverrides(messagesFor(getLocale()), getOverrides?.());\n\t\t}\n\t};\n\tsetContext(LOCALE_CONTEXT_KEY, ctx);\n}\n\n/**\n * Re-provides the nearest context for a component that takes its own `lang`/`messages` props.\n * Without `lang`, or with the inherited locale, the subtree keeps the overrides an outer provider\n * applied; a different `lang` starts from that locale's catalog, since those overrides were\n * written for another language.\n */\nexport function layerLocaleContext(\n\tgetLang: () => Locale | undefined,\n\tgetOverrides?: () => Partial<ViewerMessages> | undefined\n): LocaleContext {\n\tconst outer = getLocaleContext();\n\tconst ctx: LocaleContext = {\n\t\tget locale() {\n\t\t\treturn getLang() ?? outer.locale;\n\t\t},\n\t\tget messages() {\n\t\t\tconst lang = getLang();\n\t\t\tconst base = lang === undefined || lang === outer.locale ? outer.messages : messagesFor(lang);\n\t\t\treturn withOverrides(base, getOverrides?.());\n\t\t}\n\t};\n\tsetContext(LOCALE_CONTEXT_KEY, ctx);\n\treturn ctx;\n}\n\n/**\n * Falls back to an English-only context when no provider exists (a primitive used in\n * isolation), so consumers never need a null check.\n */\nexport function getLocaleContext(): LocaleContext {\n\treturn (\n\t\tgetContext<LocaleContext | undefined>(LOCALE_CONTEXT_KEY) ?? {\n\t\t\tget locale() {\n\t\t\t\treturn DEFAULT_LOCALE;\n\t\t\t},\n\t\t\tget messages() {\n\t\t\t\treturn messagesFor(DEFAULT_LOCALE);\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":";;AAmqBA,IAAa,kBAAkD;CAAE;EA7ZhE,WAAW;EACX,sBAAsB;EACtB,qBAAqB;EACrB,WAAW;EACX,OAAO;EACP,SAAS;EACT,MAAM;EACN,SAAS;EACT,OAAO;EACP,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAEhB,SAAS;EACT,WAAW;EACX,WAAW;EACX,UAAU;EACV,UAAU;EACV,YAAY;EACZ,SAAS;EAET,eAAe;EACf,YAAY;EACZ,cAAc;EACd,WAAW;EACX,WAAW;EACX,YAAY;EACZ,UAAU;EACV,aAAa;EACb,eAAe;EAEf,eAAe;EACf,aAAa;EACb,aAAa;EACb,eAAe;EACf,WAAW;EACX,aAAa;EACb,WAAW;EACX,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,WAAW;EACX,cAAc;EAEd,oBAAoB;EACpB,YAAY;EAEZ,eAAe;EACf,cAAc;EACd,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;EAC1B,sBAAsB;EACtB,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,sBAAsB;EACtB,cAAc;EACd,WAAW;EACX,cAAc;EACd,eAAe;EACf,SAAS;EACT,gBAAgB;EAChB,mBAAmB;EACnB,iBAAiB;EACjB,eAAe;EACf,gBAAgB;EAChB,aAAa;EAEb,SAAS;EACT,iBAAiB;EACjB,iBAAiB;E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"localeContext.svelte.js","names":[],"sources":["../../../../ui/src/lib/i18n/messages.ts","../../../../ui/src/lib/i18n/localeContext.svelte.ts"],"sourcesContent":["// ============================================================================\n// Viewer message catalog (library-owned strings)\n// ============================================================================\n//\n// Only the strings @selvajs/ui renders itself. Names coming from a Grasshopper\n// definition — meshes, layers, metadata keys — live in the user's .gh file and\n// cannot be translated here.\n//\n// A `{name}` in a message is a placeholder the component fills in. Pairs ending in\n// `One`/`Other` are the singular and plural forms of one message.\n\nexport type Locale = 'en' | 'de';\n\nexport interface ViewerMessages {\n\t// Tools menu\n\ttoolsMenu: string;\n\tswitchToOrthographic: string;\n\tswitchToPerspective: string;\n\tfitToView: string;\n\tviews: string;\n\tmeasure: string;\n\tgrid: string;\n\tdisplay: string;\n\tedges: string;\n\tsceneManager: string;\n\tscreenshot: string;\n\tfullscreen: string;\n\texitFullscreen: string;\n\n\t// View presets\n\tviewTop: string;\n\tviewFront: string;\n\tviewRight: string;\n\tviewBack: string;\n\tviewLeft: string;\n\tviewBottom: string;\n\tviewIso: string;\n\n\t// Display looks\n\tlookTechnical: string;\n\tlookStudio: string;\n\tlookShowcase: string;\n\tlookNight: string;\n\tnightMode: string;\n\tlookArctic: string;\n\tlookXray: string;\n\tlookLineart: string;\n\tlookWireframe: string;\n\n\t// Scene manager\n\tsearchObjects: string;\n\tclearSearch: string;\n\texpandLayer: string;\n\tcollapseLayer: string;\n\texpandAll: string;\n\tcollapseAll: string;\n\tshowLayer: string;\n\thideLayer: string;\n\tshowObject: string;\n\thideObject: string;\n\tnoObjects: string;\n\t/** `{query}` is replaced with the current search text. */\n\tnoResultsFor: string;\n\n\t// Metadata dialog\n\tobjectFallbackName: string;\n\tnoMetadata: string;\n\n\t// App layout / compute shell\n\tloadingSchema: string;\n\tsolveBlocked: string;\n\tsolveBlockedTitle: string;\n\tsolveMessagesTitle: string;\n\tsolveMessagesDescription: string;\n\tsolveMessagesConfirm: string;\n\tsolveMessagesDiscard: string;\n\tsolveMessagesAbort: string;\n\t/** Stands in for Abort where the page can't take a click mid-solve. */\n\tsolveMessagesEscHint: string;\n\tsolveMessagesDismiss: string;\n\tsolveSolving: string;\n\t/** A visible solve has landed; followed by how long it took. */\n\tsolveDone: string;\n\t/** A visible solve was aborted; the previous result stays. */\n\tsolveStopped: string;\n\tparametersTab: string;\n\tmoreTab: string;\n\tscrollTabsBack: string;\n\tscrollTabsForward: string;\n\t/** `{side}` is replaced with `panelSideLeft` / `panelSideRight`. */\n\texpandSidePanel: string;\n\tpanelSideLeft: string;\n\tpanelSideRight: string;\n\ttabNoGroups: string;\n\n\t// Solve controls\n\tsolving: string;\n\tsolvingEllipsis: string;\n\tsolvingSubtitle: string;\n\tpressToCalculate: string;\n\tcalculate: string;\n\tupToDate: string;\n\t/** The panel footer's ⋯ menu: saving and loading inputs, plus the host's own actions. */\n\tmoreActions: string;\n\t/** Under a menu action that solves before it runs, while the inputs have changed. */\n\tcalculatesFirst: string;\n\n\t// Footer and message centre\n\t/** `{count}` is replaced with the number of errors. */\n\terrorCountOne: string;\n\terrorCountOther: string;\n\t/** `{count}` is replaced with the number of warnings. */\n\twarningCountOne: string;\n\twarningCountOther: string;\n\t/** `{count}` is replaced with the number of notes. */\n\tnoteCountOne: string;\n\tnoteCountOther: string;\n\t/** `{count}` is replaced with the number of messages. */\n\tlastSolveMessagesOne: string;\n\tlastSolveMessagesOther: string;\n\tmessagesTitle: string;\n\t/** `{name}` is replaced with the copyright holder, `{year}` with the current year. */\n\tcopyright: string;\n\tclose: string;\n\ttoggleTheme: string;\n\terrorTitle: string;\n\tgoHome: string;\n\n\t// Input fields\n\tselectOption: string;\n\tnoOptionsYet: string;\n\t/** `{min}` is replaced with the field's minimum. */\n\tminValue: string;\n\t/** `{max}` is replaced with the field's maximum. */\n\tmaxValue: string;\n\tfineDragHint: string;\n\t/** `{max}` is replaced with the field's character limit. */\n\tmaxLength: string;\n\tinvalidFormat: string;\n\t/** Trigger label; `{color}` is the current hex value. */\n\tcolorPick: string;\n\tcolorArea: string;\n\t/** `{s}` and `{v}` are percentages. */\n\tcolorAreaValue: string;\n\tcolorHue: string;\n\tcolorHex: string;\n\tcolorHexInvalid: string;\n\tcolorPresets: string;\n\tcolorEyedropper: string;\n\tinvalidPattern: string;\n\n\t// Geometry input (Rhino only)\n\t/** The pick button when the input takes several kinds of object. */\n\tgeometryPickAnyOne: string;\n\tgeometryPickAnyOther: string;\n\t/** Shown while Rhino's viewport prompt for a pick is open. */\n\tgeometryPicking: string;\n\t/** Where this page may not pick, such as a browser tab beside the Rhino panel. */\n\tgeometryPickInPanel: string;\n\tgeometryPickAgain: string;\n\tgeometryClear: string;\n\t// The pick button when the input takes one kind: `One` picks a single object, `Other` several.\n\tgeometryPickPointOne: string;\n\tgeometryPickPointOther: string;\n\tgeometryPickPointCloudOne: string;\n\tgeometryPickPointCloudOther: string;\n\tgeometryPickCurveOne: string;\n\tgeometryPickCurveOther: string;\n\tgeometryPickLineOne: string;\n\tgeometryPickLineOther: string;\n\tgeometryPickPlaneOne: string;\n\tgeometryPickPlaneOther: string;\n\tgeometryPickSurfaceOne: string;\n\tgeometryPickSurfaceOther: string;\n\tgeometryPickPolysurfaceOne: string;\n\tgeometryPickPolysurfaceOther: string;\n\tgeometryPickExtrusionOne: string;\n\tgeometryPickExtrusionOther: string;\n\tgeometryPickMeshOne: string;\n\tgeometryPickMeshOther: string;\n\tgeometryPickSubdOne: string;\n\tgeometryPickSubdOther: string;\n\tgeometryPickBlockOne: string;\n\tgeometryPickBlockOther: string;\n\n\t// File input\n\tfileModeUpload: string;\n\tfileModeUrl: string;\n\tfileUrlLabel: string;\n\tfetchFile: string;\n\tfetchingFile: string;\n\tfileUrlPublic: string;\n\tchooseFile: string;\n\t/** `{formats}` is replaced with the accepted extensions. */\n\tacceptedFormats: string;\n\t/** `{ext}` is replaced with the file's extension. */\n\tuploadedFile: string;\n\t/** `{ext}` is replaced with the file's extension, `{size}` with its size in MB. */\n\tuploadedFileSize: string;\n\t/** `{ext}` is replaced with the file's extension, `{size}` with its size in KB. */\n\tfileLoaded: string;\n\turlInvalid: string;\n\turlProtocolUnsupported: string;\n\t/** `{status}` is replaced with the HTTP status the server answered with. */\n\turlServerError: string;\n\t/** `{ext}` is replaced with the rejected extension, `{formats}` with the accepted ones. */\n\tfileFormatNotAccepted: string;\n\t/** `{size}` is replaced with the file's size in MB, `{max}` with the limit in MB. */\n\tfileTooLarge: string;\n\tfileTooLargeUseUpload: string;\n\tfileReadFailed: string;\n\t/** `{host}` is replaced with the URL's host name. */\n\turlUnreachable: string;\n\turlUnreachableHint: string;\n\turlHintSharePoint: string;\n\turlHintGoogleDrive: string;\n\turlHintDropbox: string;\n\tunknownError: string;\n\n\t// Outputs\n\twaitingForData: string;\n\twaitingForFiles: string;\n\t/** `{count}` is replaced with the number of files. */\n\tfileCount: string;\n\tduplicateFilesTitle: string;\n\tduplicatePathsOne: string;\n\tduplicatePathsOther: string;\n\tduplicateFilesHint: string;\n\tdownloadFile: string;\n\t/** `{count}` is replaced with the number of files. */\n\tdownloadFiles: string;\n\tdownloading: string;\n\tdownloadFailed: string;\n\t/** A preview skipped this output's files; a click makes them. */\n\tfilesMadeOnDownload: string;\n\tdownload: string;\n\tmakingFiles: string;\n\t/** `{seconds}` is replaced with how long the full solve took. */\n\tfilesMadeIn: string;\n\tnoFilesForInputs: string;\n\ttryAgain: string;\n\tcancel: string;\n\tcopy: string;\n\tcopied: string;\n\tchartReceiving: string;\n\tchartRenderFailed: string;\n\tdownloadChartImage: string;\n\t/** `{error}` is replaced with the browser's reason. */\n\tfullscreenUnavailable: string;\n\t/** `{error}` is replaced with the browser's reason. */\n\texitFullscreenFailed: string;\n\n\t// Image output\n\timageViewer: string;\n\timageLoading: string;\n\t/** `{ext}` is replaced with the file's extension, `{formats}` with the supported ones. */\n\timageUnsupported: string;\n\timageUnknownFormat: string;\n\t/** `{file}` is replaced with the file's name. */\n\timageDecodeFailed: string;\n\tpreviousImage: string;\n\tnextImage: string;\n\tzoomHint: string;\n\tzoomIn: string;\n\tzoomOut: string;\n\tzoomFit: string;\n\tzoomActual: string;\n\tdownloadImage: string;\n}\n\nconst en: ViewerMessages = {\n\ttoolsMenu: 'Viewer tools',\n\tswitchToOrthographic: 'Orthographic camera',\n\tswitchToPerspective: 'Perspective camera',\n\tfitToView: 'Fit to view',\n\tviews: 'Views',\n\tmeasure: 'Measure',\n\tgrid: 'Grid',\n\tdisplay: 'Display',\n\tedges: 'Edges',\n\tsceneManager: 'Scene manager',\n\tscreenshot: 'Screenshot',\n\tfullscreen: 'Fullscreen',\n\texitFullscreen: 'Exit fullscreen',\n\n\tviewTop: 'Top',\n\tviewFront: 'Front',\n\tviewRight: 'Right',\n\tviewBack: 'Back',\n\tviewLeft: 'Left',\n\tviewBottom: 'Bottom',\n\tviewIso: 'Isometric',\n\n\tlookTechnical: 'Technical',\n\tlookStudio: 'Studio',\n\tlookShowcase: 'Showcase',\n\tlookNight: 'Night',\n\tnightMode: 'Night mode',\n\tlookArctic: 'Arctic',\n\tlookXray: 'X-Ray',\n\tlookLineart: 'Line Art',\n\tlookWireframe: 'Wireframe',\n\n\tsearchObjects: 'Search objects...',\n\tclearSearch: 'Clear search',\n\texpandLayer: 'Expand layer',\n\tcollapseLayer: 'Collapse layer',\n\texpandAll: 'Expand all',\n\tcollapseAll: 'Collapse all',\n\tshowLayer: 'Show layer',\n\thideLayer: 'Hide layer',\n\tshowObject: 'Show object',\n\thideObject: 'Hide object',\n\tnoObjects: 'No objects',\n\tnoResultsFor: 'No results for \"{query}\"',\n\n\tobjectFallbackName: 'Object',\n\tnoMetadata: 'No metadata',\n\n\tloadingSchema: 'Loading…',\n\tsolveBlocked: 'The definition stopped this solve. No results were produced.',\n\tsolveBlockedTitle: 'Solve stopped',\n\tsolveMessagesTitle: 'Solve messages',\n\tsolveMessagesDescription: 'This solve reported the following. Continue to see the result.',\n\tsolveMessagesConfirm: 'Continue',\n\tsolveMessagesDiscard: 'Discard',\n\tsolveMessagesAbort: 'Abort',\n\tsolveMessagesEscHint: 'Esc aborts the solve',\n\tsolveMessagesDismiss: 'Dismiss',\n\tsolveSolving: 'Solving…',\n\tsolveDone: 'Done',\n\tsolveStopped: 'Stopped',\n\tparametersTab: 'Parameters',\n\tmoreTab: 'More',\n\tscrollTabsBack: 'Previous tabs',\n\tscrollTabsForward: 'More tabs',\n\texpandSidePanel: 'Expand {side} panel',\n\tpanelSideLeft: 'left',\n\tpanelSideRight: 'right',\n\ttabNoGroups: 'This tab has no groups configured.',\n\n\tsolving: 'Solving',\n\tsolvingEllipsis: 'Solving...',\n\tsolvingSubtitle: 'This can take a moment…',\n\tpressToCalculate: 'Press to calculate',\n\tcalculate: 'Calculate',\n\tupToDate: 'Up to date',\n\tmoreActions: 'More actions',\n\tcalculatesFirst: 'Calculates first',\n\n\terrorCountOne: '{count} error',\n\terrorCountOther: '{count} errors',\n\twarningCountOne: '{count} warning',\n\twarningCountOther: '{count} warnings',\n\tnoteCountOne: '{count} note',\n\tnoteCountOther: '{count} notes',\n\tlastSolveMessagesOne: '{count} message from the last solve',\n\tlastSolveMessagesOther: '{count} messages from the last solve',\n\tmessagesTitle: 'Messages',\n\tcopyright: 'by {name} © {year}',\n\tclose: 'Close',\n\ttoggleTheme: 'Toggle theme',\n\terrorTitle: 'Error',\n\tgoHome: 'Go Home',\n\n\tselectOption: 'Select an option...',\n\tnoOptionsYet: 'No options available yet.',\n\tminValue: 'Minimum value is {min}',\n\tmaxValue: 'Maximum value is {max}',\n\tfineDragHint: 'Hold Shift to drag finely',\n\tmaxLength: 'Maximum {max} characters allowed',\n\tinvalidFormat: 'Invalid format',\n\tcolorPick: 'Choose color, currently {color}',\n\tcolorArea: 'Saturation and brightness',\n\tcolorAreaValue: 'Saturation {s}%, brightness {v}%',\n\tcolorHue: 'Hue',\n\tcolorHex: 'Hex color',\n\tcolorHexInvalid: 'Enter a hex color such as #2f6fd6',\n\tcolorPresets: 'Presets',\n\tcolorEyedropper: 'Pick a color from the screen',\n\tinvalidPattern: 'Invalid validation pattern configured',\n\n\tgeometryPickAnyOne: 'Pick an object',\n\tgeometryPickAnyOther: 'Pick objects',\n\tgeometryPicking: 'Pick in the viewport, Esc to cancel',\n\tgeometryPickInPanel: 'Pick in the Rhino panel',\n\tgeometryPickAgain: 'Pick again',\n\tgeometryClear: 'Clear',\n\tgeometryPickPointOne: 'Pick a point',\n\tgeometryPickPointOther: 'Pick points',\n\tgeometryPickPointCloudOne: 'Pick a point cloud',\n\tgeometryPickPointCloudOther: 'Pick point clouds',\n\tgeometryPickCurveOne: 'Pick a curve',\n\tgeometryPickCurveOther: 'Pick curves',\n\tgeometryPickLineOne: 'Pick a line',\n\tgeometryPickLineOther: 'Pick lines',\n\tgeometryPickPlaneOne: 'Pick a plane',\n\tgeometryPickPlaneOther: 'Pick planes',\n\tgeometryPickSurfaceOne: 'Pick a surface',\n\tgeometryPickSurfaceOther: 'Pick surfaces',\n\tgeometryPickPolysurfaceOne: 'Pick a polysurface',\n\tgeometryPickPolysurfaceOther: 'Pick polysurfaces',\n\tgeometryPickExtrusionOne: 'Pick an extrusion',\n\tgeometryPickExtrusionOther: 'Pick extrusions',\n\tgeometryPickMeshOne: 'Pick a mesh',\n\tgeometryPickMeshOther: 'Pick meshes',\n\tgeometryPickSubdOne: 'Pick a SubD',\n\tgeometryPickSubdOther: 'Pick SubDs',\n\tgeometryPickBlockOne: 'Pick a block',\n\tgeometryPickBlockOther: 'Pick blocks',\n\n\tfileModeUpload: 'Upload',\n\tfileModeUrl: 'URL',\n\tfileUrlLabel: 'File URL',\n\tfetchFile: 'Fetch',\n\tfetchingFile: 'Fetching...',\n\tfileUrlPublic: 'URL must be publicly accessible (no login required).',\n\tchooseFile: 'Choose File or Drag & Drop',\n\tacceptedFormats: 'Accepted formats: {formats}',\n\tuploadedFile: 'Uploaded file ({ext})',\n\tuploadedFileSize: 'Uploaded file ({ext}, {size}MB)',\n\tfileLoaded: 'Loaded {ext} ({size} KB)',\n\turlInvalid: 'Invalid URL — make sure it starts with https://',\n\turlProtocolUnsupported: 'Only http:// and https:// URLs are supported.',\n\turlServerError: 'Server returned {status}. Check the URL is correct and publicly accessible.',\n\tfileFormatNotAccepted: 'File format \"{ext}\" is not accepted. Allowed: {formats}',\n\tfileTooLarge: 'File too large: {size}MB (max {max}MB).',\n\tfileTooLargeUseUpload: 'Download it and use Upload instead.',\n\tfileReadFailed: 'Failed to read the downloaded file.',\n\turlUnreachable:\n\t\t'Could not reach \"{host}\" — the file may not exist, or the server does not allow browser access.',\n\turlUnreachableHint:\n\t\t'Check that the URL is correct and the file is publicly accessible. If the server requires login, download the file and use the Upload option instead.',\n\turlHintSharePoint:\n\t\t'SharePoint/OneDrive blocks browser access. Open the file in SharePoint, use \"Download\" to save it locally, then upload it here.',\n\turlHintGoogleDrive:\n\t\t'Google Drive blocks browser access. Use \"Download\" in Google Drive to save the file locally, then upload it here.',\n\turlHintDropbox:\n\t\t'Dropbox links may block browser access. Try changing \"?dl=0\" to \"?dl=1\" in the URL, or download and upload instead.',\n\tunknownError: 'Unknown error',\n\n\twaitingForData: 'Waiting for data...',\n\twaitingForFiles: 'Waiting for file data...',\n\tfileCount: '{count} files',\n\tduplicateFilesTitle: 'Duplicate file names detected',\n\tduplicatePathsOne: 'The following path appears more than once:',\n\tduplicatePathsOther: 'The following paths appear more than once:',\n\tduplicateFilesHint:\n\t\t'Rename outputs in your Grasshopper definition so each file has a unique name.',\n\tdownloadFile: 'Download File',\n\tdownloadFiles: 'Download {count} Files',\n\tdownloading: 'Downloading...',\n\tdownloadFailed: 'Download failed',\n\tfilesMadeOnDownload: 'Made when you download',\n\tdownload: 'Download',\n\tmakingFiles: 'Making files',\n\tfilesMadeIn: 'Made in {seconds} s',\n\tnoFilesForInputs: 'Nothing to download for these inputs.',\n\ttryAgain: 'Try again',\n\tcancel: 'Cancel',\n\tcopy: 'Copy',\n\tcopied: 'Copied!',\n\tchartReceiving: 'Receiving chart data...',\n\tchartRenderFailed: 'Failed to render chart',\n\tdownloadChartImage: 'Download plot as image',\n\tfullscreenUnavailable: 'Fullscreen unavailable: {error}',\n\texitFullscreenFailed: 'Exit fullscreen failed: {error}',\n\n\timageViewer: 'image viewer',\n\timageLoading: 'Loading image…',\n\timageUnsupported: 'Unsupported image format: {ext}. Supported: {formats}',\n\timageUnknownFormat: '(unknown)',\n\timageDecodeFailed: \"Couldn't decode {file}\",\n\tpreviousImage: 'Previous image',\n\tnextImage: 'Next image',\n\tzoomHint: 'Hold Ctrl or ⌘ and scroll to zoom',\n\tzoomIn: 'Zoom in',\n\tzoomOut: 'Zoom out',\n\tzoomFit: 'Fit',\n\tzoomActual: 'Actual pixels',\n\tdownloadImage: 'Download image'\n};\n\nconst de: ViewerMessages = {\n\ttoolsMenu: 'Viewer-Werkzeuge',\n\tswitchToOrthographic: 'Orthografische Kamera',\n\tswitchToPerspective: 'Perspektivische Kamera',\n\tfitToView: 'Ansicht anpassen',\n\tviews: 'Ansichten',\n\tmeasure: 'Messen',\n\tgrid: 'Raster',\n\tdisplay: 'Darstellung',\n\tedges: 'Kanten',\n\tsceneManager: 'Szenen-Manager',\n\tscreenshot: 'Screenshot',\n\tfullscreen: 'Vollbild',\n\texitFullscreen: 'Vollbild beenden',\n\n\tviewTop: 'Oben',\n\tviewFront: 'Vorne',\n\tviewRight: 'Rechts',\n\tviewBack: 'Hinten',\n\tviewLeft: 'Links',\n\tviewBottom: 'Unten',\n\tviewIso: 'Isometrisch',\n\n\tlookTechnical: 'Technisch',\n\tlookStudio: 'Studio',\n\tlookShowcase: 'Präsentation',\n\tlookNight: 'Nacht',\n\tnightMode: 'Nachtmodus',\n\tlookArctic: 'Arktis',\n\tlookXray: 'Röntgen',\n\tlookLineart: 'Strichzeichnung',\n\tlookWireframe: 'Drahtgitter',\n\n\tsearchObjects: 'Objekte suchen...',\n\tclearSearch: 'Suche löschen',\n\texpandLayer: 'Ebene aufklappen',\n\tcollapseLayer: 'Ebene zuklappen',\n\texpandAll: 'Alle aufklappen',\n\tcollapseAll: 'Alle zuklappen',\n\tshowLayer: 'Ebene einblenden',\n\thideLayer: 'Ebene ausblenden',\n\tshowObject: 'Objekt einblenden',\n\thideObject: 'Objekt ausblenden',\n\tnoObjects: 'Keine Objekte',\n\tnoResultsFor: 'Keine Ergebnisse für „{query}“',\n\n\tobjectFallbackName: 'Objekt',\n\tnoMetadata: 'Keine Metadaten',\n\n\tloadingSchema: 'Wird geladen…',\n\tsolveBlocked: 'Die Definition hat diese Berechnung gestoppt. Es wurden keine Ergebnisse erzeugt.',\n\tsolveBlockedTitle: 'Berechnung gestoppt',\n\tsolveMessagesTitle: 'Meldungen zur Berechnung',\n\tsolveMessagesDescription:\n\t\t'Diese Berechnung hat Folgendes gemeldet. Weiter, um das Ergebnis zu sehen.',\n\tsolveMessagesConfirm: 'Weiter',\n\tsolveMessagesDiscard: 'Verwerfen',\n\tsolveMessagesAbort: 'Abbrechen',\n\tsolveMessagesEscHint: 'Esc bricht die Berechnung ab',\n\tsolveMessagesDismiss: 'Schliessen',\n\tsolveSolving: 'Berechnung läuft…',\n\tsolveDone: 'Fertig',\n\tsolveStopped: 'Abgebrochen',\n\tparametersTab: 'Parameter',\n\tmoreTab: 'Mehr',\n\tscrollTabsBack: 'Vorherige Tabs',\n\tscrollTabsForward: 'Weitere Tabs',\n\texpandSidePanel: '{side} Bereich aufklappen',\n\tpanelSideLeft: 'Linken',\n\tpanelSideRight: 'Rechten',\n\ttabNoGroups: 'Für diesen Tab sind keine Gruppen konfiguriert.',\n\n\tsolving: 'Berechnung läuft',\n\tsolvingEllipsis: 'Berechnung läuft...',\n\tsolvingSubtitle: 'Das kann einen Moment dauern…',\n\tpressToCalculate: 'Berechnen',\n\tcalculate: 'Berechnen',\n\tupToDate: 'Berechnet',\n\tmoreActions: 'Weitere Aktionen',\n\tcalculatesFirst: 'Berechnet zuerst',\n\n\terrorCountOne: '{count} Fehler',\n\terrorCountOther: '{count} Fehler',\n\twarningCountOne: '{count} Warnung',\n\twarningCountOther: '{count} Warnungen',\n\tnoteCountOne: '{count} Hinweis',\n\tnoteCountOther: '{count} Hinweise',\n\tlastSolveMessagesOne: '{count} Meldung der letzten Berechnung',\n\tlastSolveMessagesOther: '{count} Meldungen der letzten Berechnung',\n\tmessagesTitle: 'Meldungen',\n\tcopyright: 'von {name} © {year}',\n\tclose: 'Schliessen',\n\ttoggleTheme: 'Farbschema wechseln',\n\terrorTitle: 'Fehler',\n\tgoHome: 'Zur Startseite',\n\n\tselectOption: 'Option wählen…',\n\tnoOptionsYet: 'Noch keine Optionen verfügbar.',\n\tminValue: 'Der kleinste erlaubte Wert ist {min}',\n\tmaxValue: 'Der grösste erlaubte Wert ist {max}',\n\tfineDragHint: 'Umschalttaste halten für feine Schritte',\n\tmaxLength: 'Höchstens {max} Zeichen erlaubt',\n\tinvalidFormat: 'Ungültiges Format',\n\tcolorPick: 'Farbe wählen, aktuell {color}',\n\tcolorArea: 'Sättigung und Helligkeit',\n\tcolorAreaValue: 'Sättigung {s} %, Helligkeit {v} %',\n\tcolorHue: 'Farbton',\n\tcolorHex: 'Hex-Farbe',\n\tcolorHexInvalid: 'Hex-Farbe eingeben, z. B. #2f6fd6',\n\tcolorPresets: 'Vorgaben',\n\tcolorEyedropper: 'Farbe vom Bildschirm aufnehmen',\n\tinvalidPattern: 'Ungültiges Prüfmuster hinterlegt',\n\n\tgeometryPickAnyOne: 'Objekt wählen',\n\tgeometryPickAnyOther: 'Objekte wählen',\n\tgeometryPicking: 'Im Ansichtsfenster wählen, Esc bricht ab',\n\tgeometryPickInPanel: 'Im Rhino-Panel wählen',\n\tgeometryPickAgain: 'Neu wählen',\n\tgeometryClear: 'Leeren',\n\tgeometryPickPointOne: 'Punkt wählen',\n\tgeometryPickPointOther: 'Punkte wählen',\n\tgeometryPickPointCloudOne: 'Punktwolke wählen',\n\tgeometryPickPointCloudOther: 'Punktwolken wählen',\n\tgeometryPickCurveOne: 'Kurve wählen',\n\tgeometryPickCurveOther: 'Kurven wählen',\n\tgeometryPickLineOne: 'Linie wählen',\n\tgeometryPickLineOther: 'Linien wählen',\n\tgeometryPickPlaneOne: 'Ebene wählen',\n\tgeometryPickPlaneOther: 'Ebenen wählen',\n\tgeometryPickSurfaceOne: 'Fläche wählen',\n\tgeometryPickSurfaceOther: 'Flächen wählen',\n\tgeometryPickPolysurfaceOne: 'Flächenverband wählen',\n\tgeometryPickPolysurfaceOther: 'Flächenverbände wählen',\n\tgeometryPickExtrusionOne: 'Extrusion wählen',\n\tgeometryPickExtrusionOther: 'Extrusionen wählen',\n\tgeometryPickMeshOne: 'Netz wählen',\n\tgeometryPickMeshOther: 'Netze wählen',\n\tgeometryPickSubdOne: 'SubD wählen',\n\tgeometryPickSubdOther: 'SubDs wählen',\n\tgeometryPickBlockOne: 'Block wählen',\n\tgeometryPickBlockOther: 'Blöcke wählen',\n\n\tfileModeUpload: 'Hochladen',\n\tfileModeUrl: 'URL',\n\tfileUrlLabel: 'Datei-URL',\n\tfetchFile: 'Abrufen',\n\tfetchingFile: 'Wird abgerufen…',\n\tfileUrlPublic: 'Die URL muss öffentlich erreichbar sein (ohne Anmeldung).',\n\tchooseFile: 'Datei wählen oder hierher ziehen',\n\tacceptedFormats: 'Erlaubte Formate: {formats}',\n\tuploadedFile: 'Hochgeladene Datei ({ext})',\n\tuploadedFileSize: 'Hochgeladene Datei ({ext}, {size} MB)',\n\tfileLoaded: '{ext} geladen ({size} KB)',\n\turlInvalid: 'Ungültige URL – sie muss mit https:// beginnen',\n\turlProtocolUnsupported: 'Nur http://- und https://-URLs werden unterstützt.',\n\turlServerError:\n\t\t'Der Server antwortete mit {status}. Ist die URL korrekt und öffentlich erreichbar?',\n\tfileFormatNotAccepted: 'Dateiformat „{ext}“ ist nicht erlaubt. Erlaubt: {formats}',\n\tfileTooLarge: 'Datei zu gross: {size} MB (höchstens {max} MB).',\n\tfileTooLargeUseUpload: 'Datei herunterladen und stattdessen über „Hochladen“ einfügen.',\n\tfileReadFailed: 'Die heruntergeladene Datei konnte nicht gelesen werden.',\n\turlUnreachable:\n\t\t'„{host}“ ist nicht erreichbar – die Datei existiert vielleicht nicht, oder der Server erlaubt keinen Zugriff aus dem Browser.',\n\turlUnreachableHint:\n\t\t'Prüfen, ob die URL stimmt und die Datei öffentlich erreichbar ist. Verlangt der Server eine Anmeldung: Datei herunterladen und über „Hochladen“ einfügen.',\n\turlHintSharePoint:\n\t\t'SharePoint/OneDrive sperrt den Zugriff aus dem Browser. Datei in SharePoint öffnen, mit „Herunterladen“ lokal speichern und hier hochladen.',\n\turlHintGoogleDrive:\n\t\t'Google Drive sperrt den Zugriff aus dem Browser. Datei in Google Drive mit „Herunterladen“ lokal speichern und hier hochladen.',\n\turlHintDropbox:\n\t\t'Dropbox-Links sperren den Zugriff aus dem Browser oft. In der URL „?dl=0“ durch „?dl=1“ ersetzen oder die Datei herunterladen und hochladen.',\n\tunknownError: 'Unbekannter Fehler',\n\n\twaitingForData: 'Noch keine Daten',\n\twaitingForFiles: 'Noch keine Dateien',\n\tfileCount: '{count} Dateien',\n\tduplicateFilesTitle: 'Doppelte Dateinamen',\n\tduplicatePathsOne: 'Dieser Pfad kommt mehrfach vor:',\n\tduplicatePathsOther: 'Diese Pfade kommen mehrfach vor:',\n\tduplicateFilesHint:\n\t\t'Ausgaben in der Grasshopper-Definition umbenennen, damit jede Datei einen eindeutigen Namen hat.',\n\tdownloadFile: 'Datei herunterladen',\n\tdownloadFiles: '{count} Dateien herunterladen',\n\tdownloading: 'Wird heruntergeladen…',\n\tdownloadFailed: 'Download fehlgeschlagen',\n\tfilesMadeOnDownload: 'Wird beim Herunterladen erstellt',\n\tdownload: 'Herunterladen',\n\tmakingFiles: 'Dateien werden erstellt',\n\tfilesMadeIn: 'Erstellt in {seconds} s',\n\tnoFilesForInputs: 'Für diese Eingaben gibt es nichts herunterzuladen.',\n\ttryAgain: 'Erneut versuchen',\n\tcancel: 'Abbrechen',\n\tcopy: 'Kopieren',\n\tcopied: 'Kopiert!',\n\tchartReceiving: 'Diagrammdaten werden empfangen…',\n\tchartRenderFailed: 'Diagramm konnte nicht dargestellt werden',\n\tdownloadChartImage: 'Diagramm als Bild herunterladen',\n\tfullscreenUnavailable: 'Vollbild nicht verfügbar: {error}',\n\texitFullscreenFailed: 'Vollbild konnte nicht beendet werden: {error}',\n\n\timageViewer: 'Bildbetrachter',\n\timageLoading: 'Bild wird geladen…',\n\timageUnsupported: 'Bildformat nicht unterstützt: {ext}. Unterstützt: {formats}',\n\timageUnknownFormat: '(unbekannt)',\n\timageDecodeFailed: '{file} konnte nicht gelesen werden',\n\tpreviousImage: 'Vorheriges Bild',\n\tnextImage: 'Nächstes Bild',\n\tzoomHint: 'Zum Zoomen Strg oder ⌘ halten und scrollen',\n\tzoomIn: 'Vergrössern',\n\tzoomOut: 'Verkleinern',\n\tzoomFit: 'Einpassen',\n\tzoomActual: 'Originalgrösse',\n\tdownloadImage: 'Bild herunterladen'\n};\n\nexport const VIEWER_MESSAGES: Record<Locale, ViewerMessages> = { en, de };\n\nexport const DEFAULT_LOCALE: Locale = 'en';\n\n/** Resolve a catalog for a locale, falling back to English for unknown locales. */\nexport function messagesFor(locale: Locale | undefined): ViewerMessages {\n\treturn VIEWER_MESSAGES[locale ?? DEFAULT_LOCALE] ?? VIEWER_MESSAGES[DEFAULT_LOCALE];\n}\n\n/** Layers a host's partial overrides over a full catalog. An `undefined` entry keeps the base string. */\nexport function withOverrides(\n\tbase: ViewerMessages,\n\toverrides: Partial<ViewerMessages> | undefined\n): ViewerMessages {\n\tif (!overrides) return base;\n\tconst merged = { ...base };\n\tfor (const [key, value] of Object.entries(overrides) as [keyof ViewerMessages, string][]) {\n\t\tif (value !== undefined) merged[key] = value;\n\t}\n\treturn merged;\n}\n\n/** Fills each `{name}` placeholder from `vars`; an unknown placeholder is left as written. */\nexport function formatMessage(template: string, vars: Record<string, string | number>): string {\n\treturn template.replace(/\\{(\\w+)\\}/g, (placeholder, name: string) =>\n\t\tname in vars ? String(vars[name]) : placeholder\n\t);\n}\n\n/** Picks the singular or plural form for `count` and fills its `{count}`. */\nexport function formatCount(count: number, one: string, other: string): string {\n\treturn formatMessage(count === 1 ? one : other, { count });\n}\n","import { getContext, setContext } from 'svelte';\nimport {\n\ttype Locale,\n\ttype ViewerMessages,\n\tmessagesFor,\n\twithOverrides,\n\tDEFAULT_LOCALE\n} from './messages';\n\n// Carries the UI locale down to the viewer and its panels without threading a\n// `lang` prop through every layer.\n//\n// Resolution order for any consuming component:\n// explicit `lang` prop → nearest locale context → English default\n// and the strings are that locale's catalog with any `messages` overrides on top.\n//\n// Two ways to provide it:\n// - Standalone: <Viewer lang=\"de\" /> — Viewer provides the context itself.\n// - In an app: call setLocaleContext(() => app.locale) once at the root; the\n// viewer (and anything else) reads it.\n\nconst LOCALE_CONTEXT_KEY = Symbol('viewer-locale-context');\n\nexport interface LocaleContext {\n\treadonly locale: Locale;\n\treadonly messages: ViewerMessages;\n}\n\n/**\n * Provide the locale to descendants. Pass getters, not values: they are re-read on every\n * consumer render, so a reactive source (a `$state`, the app's Paraglide locale) switches\n * the language live. `getOverrides` replaces individual strings of the resolved catalog.\n */\nexport function setLocaleContext(\n\tgetLocale: () => Locale | undefined,\n\tgetOverrides?: () => Partial<ViewerMessages> | undefined\n): void {\n\tconst ctx: LocaleContext = {\n\t\tget locale() {\n\t\t\treturn getLocale() ?? DEFAULT_LOCALE;\n\t\t},\n\t\tget messages() {\n\t\t\treturn withOverrides(messagesFor(getLocale()), getOverrides?.());\n\t\t}\n\t};\n\tsetContext(LOCALE_CONTEXT_KEY, ctx);\n}\n\n/**\n * Re-provides the nearest context for a component that takes its own `lang`/`messages` props.\n * Without `lang`, or with the inherited locale, the subtree keeps the overrides an outer provider\n * applied; a different `lang` starts from that locale's catalog, since those overrides were\n * written for another language.\n */\nexport function layerLocaleContext(\n\tgetLang: () => Locale | undefined,\n\tgetOverrides?: () => Partial<ViewerMessages> | undefined\n): LocaleContext {\n\tconst outer = getLocaleContext();\n\tconst ctx: LocaleContext = {\n\t\tget locale() {\n\t\t\treturn getLang() ?? outer.locale;\n\t\t},\n\t\tget messages() {\n\t\t\tconst lang = getLang();\n\t\t\tconst base = lang === undefined || lang === outer.locale ? outer.messages : messagesFor(lang);\n\t\t\treturn withOverrides(base, getOverrides?.());\n\t\t}\n\t};\n\tsetContext(LOCALE_CONTEXT_KEY, ctx);\n\treturn ctx;\n}\n\n/**\n * Falls back to an English-only context when no provider exists (a primitive used in\n * isolation), so consumers never need a null check.\n */\nexport function getLocaleContext(): LocaleContext {\n\treturn (\n\t\tgetContext<LocaleContext | undefined>(LOCALE_CONTEXT_KEY) ?? {\n\t\t\tget locale() {\n\t\t\t\treturn DEFAULT_LOCALE;\n\t\t\t},\n\t\t\tget messages() {\n\t\t\t\treturn messagesFor(DEFAULT_LOCALE);\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":";;AA0rBA,IAAa,kBAAkD;CAAE;EA3ahE,WAAW;EACX,sBAAsB;EACtB,qBAAqB;EACrB,WAAW;EACX,OAAO;EACP,SAAS;EACT,MAAM;EACN,SAAS;EACT,OAAO;EACP,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAEhB,SAAS;EACT,WAAW;EACX,WAAW;EACX,UAAU;EACV,UAAU;EACV,YAAY;EACZ,SAAS;EAET,eAAe;EACf,YAAY;EACZ,cAAc;EACd,WAAW;EACX,WAAW;EACX,YAAY;EACZ,UAAU;EACV,aAAa;EACb,eAAe;EAEf,eAAe;EACf,aAAa;EACb,aAAa;EACb,eAAe;EACf,WAAW;EACX,aAAa;EACb,WAAW;EACX,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,WAAW;EACX,cAAc;EAEd,oBAAoB;EACpB,YAAY;EAEZ,eAAe;EACf,cAAc;EACd,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;EAC1B,sBAAsB;EACtB,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,sBAAsB;EACtB,cAAc;EACd,WAAW;EACX,cAAc;EACd,eAAe;EACf,SAAS;EACT,gBAAgB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AAM,SAAS,MAAM,WAAW,YAAY,IAAI,GACjE,eAAA,CAAA;EAC5B;;CAED,WAAW,oBAAoB,GAAG;CAClC,OAAO;AACR;;;;;AAMA,SAAgB,mBAAkC;CACjD,OACC,WAAsC,kBAAkB,KAAA;EACvD,IAAI,SAAS;GACZ,OAAA;EACD;EACA,IAAI,WAAW;GACd,OAAO,YAAA,IAA0B;EAClC;;AAGH"}
|
|
@@ -19,15 +19,24 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, hkdfSync, ran
|
|
|
19
19
|
var OAUTH_SCOPES = [
|
|
20
20
|
"read",
|
|
21
21
|
"solve",
|
|
22
|
+
"write",
|
|
22
23
|
"upload",
|
|
23
24
|
"create_projects"
|
|
24
25
|
];
|
|
25
26
|
/**
|
|
26
|
-
* All a registered (DCR or CIMD)
|
|
27
|
+
* All a host may hand registered (DCR or CIMD) clients. Their name and redirects
|
|
27
28
|
* are whatever the registrant chose, so `upload`, which puts code on the org's
|
|
28
|
-
* Compute server, and `create_projects`
|
|
29
|
-
*
|
|
29
|
+
* Compute server, and `create_projects` aren't here. `write` is, but `write:all`
|
|
30
|
+
* covers both at `/api/v1` and can delete projects and definitions, so it is
|
|
31
|
+
* off by default. An allowlist: a new scope reaches registered clients only
|
|
32
|
+
* once it is added here.
|
|
30
33
|
*/
|
|
34
|
+
var REGISTERABLE_SCOPES = [
|
|
35
|
+
"read",
|
|
36
|
+
"solve",
|
|
37
|
+
"write"
|
|
38
|
+
];
|
|
39
|
+
/** The default `registeredClientScopes`. */
|
|
31
40
|
var REGISTERED_CLIENT_SCOPES = ["read", "solve"];
|
|
32
41
|
var GRASSHOPPER_CLIENT = {
|
|
33
42
|
clientId: "selva-grasshopper",
|
|
@@ -74,20 +83,26 @@ function mcpResourceUrl(origin) {
|
|
|
74
83
|
function resourceMetadataUrl(origin) {
|
|
75
84
|
return `${origin}/.well-known/oauth-protected-resource${MCP_PATH}`;
|
|
76
85
|
}
|
|
77
|
-
/**
|
|
78
|
-
|
|
86
|
+
/**
|
|
87
|
+
* RFC 9728. Claude uses only the first authorization server. `scopes` is what a
|
|
88
|
+
* registered client may be granted; prefer the server's own method, which
|
|
89
|
+
* passes its `registeredClientScopes`.
|
|
90
|
+
*/
|
|
91
|
+
function protectedResourceMetadata(origin, scopes = REGISTERED_CLIENT_SCOPES) {
|
|
79
92
|
return {
|
|
80
93
|
resource: mcpResourceUrl(origin),
|
|
81
94
|
authorization_servers: [origin],
|
|
82
|
-
scopes_supported: [...
|
|
95
|
+
scopes_supported: [...scopes],
|
|
83
96
|
bearer_methods_supported: ["header"]
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
99
|
/**
|
|
87
100
|
* RFC 8414. Claude picks Client ID Metadata Documents only when both
|
|
88
101
|
* `client_id_metadata_document_supported` and the `none` auth method appear.
|
|
102
|
+
* Advertises only scopes some client can be granted: a client that asks for one
|
|
103
|
+
* it can never get re-authorizes in a loop. Prefer the server's own method.
|
|
89
104
|
*/
|
|
90
|
-
function authorizationServerMetadata(origin) {
|
|
105
|
+
function authorizationServerMetadata(origin, registeredScopes = REGISTERED_CLIENT_SCOPES) {
|
|
91
106
|
return {
|
|
92
107
|
issuer: origin,
|
|
93
108
|
authorization_endpoint: `${origin}/oauth/authorize`,
|
|
@@ -97,11 +112,21 @@ function authorizationServerMetadata(origin) {
|
|
|
97
112
|
grant_types_supported: ["authorization_code"],
|
|
98
113
|
code_challenge_methods_supported: ["S256"],
|
|
99
114
|
token_endpoint_auth_methods_supported: ["none"],
|
|
100
|
-
scopes_supported:
|
|
115
|
+
scopes_supported: OAUTH_SCOPES.filter((s) => GRASSHOPPER_CLIENT.scopes.includes(s) || registeredScopes.includes(s)),
|
|
101
116
|
client_id_metadata_document_supported: true,
|
|
102
117
|
authorization_response_iss_parameter_supported: true
|
|
103
118
|
};
|
|
104
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* The host's list, checked: a JS host or a cast gets past the type, and a list
|
|
122
|
+
* without `read` would leave every consent page empty with a message blaming
|
|
123
|
+
* the user's account.
|
|
124
|
+
*/
|
|
125
|
+
function checkRegisteredScopes(scopes) {
|
|
126
|
+
for (const s of scopes) if (!REGISTERABLE_SCOPES.includes(s)) throw new TypeError(`registeredClientScopes: "${s}" can't be granted to a registered client.`);
|
|
127
|
+
if (!scopes.includes("read")) throw new TypeError("registeredClientScopes must include \"read\".");
|
|
128
|
+
return REGISTERABLE_SCOPES.filter((s) => scopes.includes(s));
|
|
129
|
+
}
|
|
105
130
|
function createOAuthServer(options) {
|
|
106
131
|
const { origin } = options;
|
|
107
132
|
const now = options.now ?? Date.now;
|
|
@@ -111,6 +136,7 @@ function createOAuthServer(options) {
|
|
|
111
136
|
const previousSignKey = previous ? derive(previous, "selva-oauth-client") : void 0;
|
|
112
137
|
const previousCodeKey = previous ? derive(previous, `selva-oauth-code:${origin}`) : void 0;
|
|
113
138
|
const redeemed = options.redeemedCodes ?? /* @__PURE__ */ new Map();
|
|
139
|
+
const registeredScopes = checkRegisteredScopes(options.registeredClientScopes ?? REGISTERED_CLIENT_SCOPES);
|
|
114
140
|
const metadataCache = /* @__PURE__ */ new Map();
|
|
115
141
|
/** RFC 7591. The client id carries the metadata, signed, so nothing is stored. */
|
|
116
142
|
function register(input) {
|
|
@@ -159,7 +185,7 @@ function createOAuthServer(options) {
|
|
|
159
185
|
name: meta.n || "An MCP client",
|
|
160
186
|
redirectUris: meta.r,
|
|
161
187
|
builtIn: false,
|
|
162
|
-
scopes:
|
|
188
|
+
scopes: registeredScopes
|
|
163
189
|
};
|
|
164
190
|
}
|
|
165
191
|
async function metadataClient(url) {
|
|
@@ -170,7 +196,7 @@ function createOAuthServer(options) {
|
|
|
170
196
|
}
|
|
171
197
|
if (!options.fetchClientMetadata) throw new OAuthError("invalid_client", "This server does not accept URL client ids.");
|
|
172
198
|
try {
|
|
173
|
-
const client = await readMetadata(url, options.fetchClientMetadata);
|
|
199
|
+
const client = await readMetadata(url, options.fetchClientMetadata, registeredScopes);
|
|
174
200
|
remember(url, {
|
|
175
201
|
at: now(),
|
|
176
202
|
client
|
|
@@ -284,15 +310,17 @@ function createOAuthServer(options) {
|
|
|
284
310
|
approve,
|
|
285
311
|
deny,
|
|
286
312
|
exchange,
|
|
287
|
-
|
|
288
|
-
|
|
313
|
+
/** All a registered client can be granted: the MCP 401 challenge's scopes. */
|
|
314
|
+
registeredScopes,
|
|
315
|
+
protectedResourceMetadata: () => protectedResourceMetadata(origin, registeredScopes),
|
|
316
|
+
authorizationServerMetadata: () => authorizationServerMetadata(origin, registeredScopes)
|
|
289
317
|
};
|
|
290
318
|
}
|
|
291
319
|
/** OAuth scopes to the API scopes a minted token gets. */
|
|
292
320
|
function apiScopesFor(scopes) {
|
|
293
321
|
return scopes.map((s) => `${s}:all`);
|
|
294
322
|
}
|
|
295
|
-
async function readMetadata(url, fetchClientMetadata) {
|
|
323
|
+
async function readMetadata(url, fetchClientMetadata, scopes) {
|
|
296
324
|
let doc;
|
|
297
325
|
try {
|
|
298
326
|
doc = await fetchClientMetadata(url);
|
|
@@ -305,7 +333,7 @@ async function readMetadata(url, fetchClientMetadata) {
|
|
|
305
333
|
name: typeof doc.client_name === "string" && doc.client_name.trim() ? doc.client_name.trim().slice(0, CLIENT_NAME_MAX) : new URL(url).host,
|
|
306
334
|
redirectUris: checkRedirectUris(doc.redirect_uris),
|
|
307
335
|
builtIn: false,
|
|
308
|
-
scopes
|
|
336
|
+
scopes
|
|
309
337
|
};
|
|
310
338
|
}
|
|
311
339
|
/**
|
|
@@ -313,34 +341,52 @@ async function readMetadata(url, fetchClientMetadata) {
|
|
|
313
341
|
* that is dropped, not refused, so a client that asks for every advertised
|
|
314
342
|
* scope still signs in with what it may have. No `scope` at all means all of
|
|
315
343
|
* them. Asking only for scopes it may not have gets `read`, never more than it
|
|
316
|
-
* asked for. `read` rides along with `solve`, which the consent
|
|
317
|
-
* "read and run solves".
|
|
344
|
+
* asked for. `read` rides along with `solve` and `write`, which the consent
|
|
345
|
+
* page offers as "read and run solves" and "read and change".
|
|
318
346
|
*/
|
|
319
347
|
function parseScopes(raw, allowed) {
|
|
320
348
|
const requested = (raw ?? "").split(" ").filter(Boolean);
|
|
321
349
|
if (!requested.length) return [...allowed];
|
|
322
350
|
const asked = requested.filter((s) => allowed.includes(s));
|
|
323
351
|
if (!asked.length) return allowed.includes("read") ? ["read"] : [];
|
|
324
|
-
|
|
352
|
+
const impliesRead = asked.includes("solve") || asked.includes("write");
|
|
353
|
+
return allowed.filter((s) => asked.includes(s) || s === "read" && impliesRead);
|
|
325
354
|
}
|
|
326
355
|
/**
|
|
327
|
-
* The access levels a consent page offers for a request
|
|
328
|
-
* user may narrow what the client asked for, never widen
|
|
329
|
-
* is offered
|
|
330
|
-
*
|
|
356
|
+
* The access levels a consent page offers for a request: `read` first, all it
|
|
357
|
+
* asked for last. The user may narrow what the client asked for, never widen
|
|
358
|
+
* it. `write` is offered with and without `solve`, so change access needn't
|
|
359
|
+
* spend compute budget, and a host policy that allows one can still grant it.
|
|
360
|
+
* An upload request is offered as asked: narrowing it to read would leave the
|
|
361
|
+
* client unable to do the one thing it signed in for.
|
|
331
362
|
*/
|
|
332
363
|
function consentChoices(scopes) {
|
|
364
|
+
if (!scopes.length) return [];
|
|
333
365
|
if (scopes.includes("upload")) return [{
|
|
334
366
|
access: "upload",
|
|
335
367
|
scopes: [...scopes]
|
|
336
368
|
}];
|
|
369
|
+
const solve = scopes.includes("solve");
|
|
370
|
+
const write = scopes.includes("write");
|
|
337
371
|
const choices = [{
|
|
338
372
|
access: "read",
|
|
339
373
|
scopes: ["read"]
|
|
340
374
|
}];
|
|
341
|
-
if (
|
|
375
|
+
if (solve) choices.push({
|
|
342
376
|
access: "solve",
|
|
343
|
-
scopes: [
|
|
377
|
+
scopes: ["read", "solve"]
|
|
378
|
+
});
|
|
379
|
+
if (write) choices.push({
|
|
380
|
+
access: "write",
|
|
381
|
+
scopes: ["read", "write"]
|
|
382
|
+
});
|
|
383
|
+
if (solve && write) choices.push({
|
|
384
|
+
access: "write_and_solve",
|
|
385
|
+
scopes: [
|
|
386
|
+
"read",
|
|
387
|
+
"solve",
|
|
388
|
+
"write"
|
|
389
|
+
]
|
|
344
390
|
});
|
|
345
391
|
return choices;
|
|
346
392
|
}
|
|
@@ -422,6 +468,6 @@ function safeEqual(a, b) {
|
|
|
422
468
|
const y = Buffer.from(b);
|
|
423
469
|
return x.length === y.length && timingSafeEqual(x, y);
|
|
424
470
|
}
|
|
425
|
-
export {
|
|
471
|
+
export { createOAuthServer as a, consentChoices as i, OAuthError as n, isLoopbackRedirect as o, apiScopesFor as r, resourceMetadataUrl as s, CODE_TTL_MS as t };
|
|
426
472
|
|
|
427
473
|
//# sourceMappingURL=oauth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","names":["sign"],"sources":["../../../../server/src/oauth/index.ts"],"sourcesContent":["/**\n * OAuth 2.1 for MCP clients and the Grasshopper plugin, with this instance as\n * its own authorization server.\n *\n * The access token is an ordinary API token. The host mints it while the user is\n * signed in, at consent, through the same path as Team → API tokens; this\n * module seals the raw key into the authorization code and hands it over at the\n * token endpoint. So `/mcp` and `/api/v1` keep one credential type.\n *\n * Nothing here is stored. A registered client's id is its own signed metadata,\n * and a code is its own encrypted grant, bound to the issuing origin. The only\n * state is the set of redeemed codes, in the host's memory, so on several\n * replicas a code could be redeemed once per replica within its minute, and only\n * by whoever holds the PKCE verifier.\n */\n\nimport {\n\tcreateCipheriv,\n\tcreateDecipheriv,\n\tcreateHash,\n\tcreateHmac,\n\thkdfSync,\n\trandomBytes,\n\ttimingSafeEqual\n} from 'node:crypto';\n\n/** The scopes a grant can carry. Each maps to one org-wide API scope. */\nexport const OAUTH_SCOPES = ['read', 'solve', 'upload', 'create_projects'] as const;\nexport type OAuthScope = (typeof OAUTH_SCOPES)[number];\n\n/**\n * All a registered (DCR or CIMD) client can be granted. Its name and redirects\n * are whatever the registrant chose, so `upload`, which puts code on the org's\n * Compute server, and `create_projects` stay with the built-in client and a\n * look-alike can't phish for them.\n */\nexport const REGISTERED_CLIENT_SCOPES = ['read', 'solve'] as const satisfies readonly OAuthScope[];\n\n/** The Grasshopper plugin's client id. Built in, so it needs no registration and works air-gapped. */\nexport const GRASSHOPPER_CLIENT_ID = 'selva-grasshopper';\n\n// Loopback on any port (RFC 8252 §7.3), but only this host and path: the code\n// can only ever reach a program on the user's own machine.\nconst GRASSHOPPER_CLIENT: OAuthClient = {\n\tclientId: GRASSHOPPER_CLIENT_ID,\n\tname: 'Selva for Grasshopper',\n\tredirectUris: ['http://127.0.0.1/callback'],\n\tbuiltIn: true,\n\tscopes: ['read', 'upload', 'create_projects']\n};\n\nexport const MCP_PATH = '/mcp';\n\nexport const CODE_TTL_MS = 60_000;\nconst CLIENT_NAME_MAX = 100;\nconst REDIRECT_URIS_MAX = 10;\nconst CIMD_TTL_MS = 60 * 60_000;\n// A failing metadata URL is not refetched for this long: each fetch is outbound\n// work an anonymous caller could otherwise trigger at will.\nconst CIMD_FAILURE_TTL_MS = 60_000;\nconst CIMD_CACHE_MAX = 500;\nconst LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);\n\nexport class OAuthError extends Error {\n\tconstructor(\n\t\t/** RFC 6749 / 7591 error code. */\n\t\treadonly error: string,\n\t\tdescription: string,\n\t\treadonly status = 400\n\t) {\n\t\tsuper(description);\n\t\tthis.name = 'OAuthError';\n\t}\n\n\ttoBody(): { error: string; error_description: string } {\n\t\treturn { error: this.error, error_description: this.message };\n\t}\n}\n\nexport interface OAuthClient {\n\tclientId: string;\n\t/** Shown on the consent page. Unverified for a registered client: whatever it claimed. */\n\tname: string;\n\tredirectUris: string[];\n\t/** Shipped with this server, so its name can be trusted. */\n\tbuiltIn: boolean;\n\t/** All this client can be granted, whatever it asks for. */\n\tscopes: readonly OAuthScope[];\n}\n\n/** A validated `/oauth/authorize` request, ready for the consent page. */\nexport interface AuthorizeRequest {\n\tclient: OAuthClient;\n\tredirectUri: string;\n\tstate?: string;\n\tcodeChallenge: string;\n\tscopes: OAuthScope[];\n\tresource: string;\n}\n\n/** What the host minted at consent. `secret` is the raw API key. */\nexport interface Grant {\n\ttokenId: string;\n\tsecret: string;\n\tscopes: OAuthScope[];\n\texpiresAt: string;\n}\n\nexport interface OAuthServerOptions {\n\t/** This instance's origin, e.g. `https://selva.example.com`. */\n\torigin: string;\n\t/** `SELVA_HMAC_KEY`. Signs client ids and seals codes. */\n\tsecret: string;\n\t/** The key before the last rotation: client ids and codes it made still verify. */\n\tpreviousSecret?: string;\n\t/**\n\t * Fetches a Client ID Metadata Document. The URL comes from an unknown client,\n\t * so the host must guard it against SSRF. Without it, URL client ids are refused.\n\t */\n\tfetchClientMetadata?: (url: string) => Promise<unknown>;\n\t/**\n\t * Redeemed code hashes and their expiry. Pass one map for the process so a\n\t * rebuilt server (a new origin, a rotated secret) still refuses a replay.\n\t */\n\tredeemedCodes?: Map<string, number>;\n\t/** Called once a code is exchanged, with the token its grant carries. */\n\tonRedeemed?: (tokenId: string) => void;\n\tnow?: () => number;\n}\n\ninterface HttpResult {\n\tstatus: number;\n\tbody: Record<string, unknown>;\n}\n\n// ============================================================================\n// Discovery documents\n// ============================================================================\n\nexport function mcpResourceUrl(origin: string): string {\n\treturn origin + MCP_PATH;\n}\n\nexport function resourceMetadataUrl(origin: string): string {\n\treturn `${origin}/.well-known/oauth-protected-resource${MCP_PATH}`;\n}\n\n/** RFC 9728. Claude uses only the first authorization server. */\nexport function protectedResourceMetadata(origin: string) {\n\treturn {\n\t\tresource: mcpResourceUrl(origin),\n\t\tauthorization_servers: [origin],\n\t\tscopes_supported: [...REGISTERED_CLIENT_SCOPES],\n\t\tbearer_methods_supported: ['header']\n\t};\n}\n\n/**\n * RFC 8414. Claude picks Client ID Metadata Documents only when both\n * `client_id_metadata_document_supported` and the `none` auth method appear.\n */\nexport function authorizationServerMetadata(origin: string) {\n\treturn {\n\t\tissuer: origin,\n\t\tauthorization_endpoint: `${origin}/oauth/authorize`,\n\t\ttoken_endpoint: `${origin}/oauth/token`,\n\t\tregistration_endpoint: `${origin}/oauth/register`,\n\t\tresponse_types_supported: ['code'],\n\t\tgrant_types_supported: ['authorization_code'],\n\t\tcode_challenge_methods_supported: ['S256'],\n\t\ttoken_endpoint_auth_methods_supported: ['none'],\n\t\tscopes_supported: [...OAUTH_SCOPES],\n\t\tclient_id_metadata_document_supported: true,\n\t\tauthorization_response_iss_parameter_supported: true\n\t};\n}\n\n// ============================================================================\n// Server\n// ============================================================================\n\nexport function createOAuthServer(options: OAuthServerOptions) {\n\tconst { origin } = options;\n\tconst now = options.now ?? Date.now;\n\tconst signKey = derive(options.secret, 'selva-oauth-client');\n\tconst codeKey = derive(options.secret, `selva-oauth-code:${origin}`);\n\tconst previous = options.previousSecret;\n\tconst previousSignKey = previous ? derive(previous, 'selva-oauth-client') : undefined;\n\tconst previousCodeKey = previous ? derive(previous, `selva-oauth-code:${origin}`) : undefined;\n\tconst redeemed = options.redeemedCodes ?? new Map<string, number>();\n\tconst metadataCache = new Map<\n\t\tstring,\n\t\t{ at: number; client: OAuthClient } | { at: number; failure: OAuthError }\n\t>();\n\n\t// ==========================================================================\n\t// Clients\n\t// ==========================================================================\n\n\t/** RFC 7591. The client id carries the metadata, signed, so nothing is stored. */\n\tfunction register(input: unknown): HttpResult {\n\t\ttry {\n\t\t\tconst meta = (input ?? {}) as { client_name?: unknown; redirect_uris?: unknown };\n\t\t\tconst redirectUris = checkRedirectUris(meta.redirect_uris);\n\t\t\tconst name = typeof meta.client_name === 'string' ? meta.client_name.trim() : '';\n\t\t\tconst payload = b64(\n\t\t\t\tJSON.stringify({ n: name.slice(0, CLIENT_NAME_MAX), r: redirectUris, t: now() })\n\t\t\t);\n\t\t\tconst clientId = `dcr_${payload}.${sign(signKey, payload)}`;\n\t\t\treturn {\n\t\t\t\tstatus: 201,\n\t\t\t\tbody: {\n\t\t\t\t\tclient_id: clientId,\n\t\t\t\t\tclient_id_issued_at: Math.floor(now() / 1000),\n\t\t\t\t\tclient_name: name || undefined,\n\t\t\t\t\tredirect_uris: redirectUris,\n\t\t\t\t\tgrant_types: ['authorization_code'],\n\t\t\t\t\tresponse_types: ['code'],\n\t\t\t\t\ttoken_endpoint_auth_method: 'none'\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) return { status: err.status, body: err.toBody() };\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tasync function resolveClient(clientId: string): Promise<OAuthClient> {\n\t\tif (clientId === GRASSHOPPER_CLIENT_ID) return GRASSHOPPER_CLIENT;\n\t\tif (clientId.startsWith('dcr_')) return registeredClient(clientId);\n\t\tif (clientId.startsWith('https://')) return metadataClient(clientId);\n\t\tthrow new OAuthError('invalid_client', 'Unknown client.');\n\t}\n\n\tfunction registeredClient(clientId: string): OAuthClient {\n\t\tconst [payload, signature] = clientId.slice('dcr_'.length).split('.');\n\t\tconst signedBy = (key: Buffer | undefined) =>\n\t\t\tkey !== undefined && safeEqual(signature, sign(key, payload));\n\t\tif (!payload || !signature || !(signedBy(signKey) || signedBy(previousSignKey))) {\n\t\t\tthrow new OAuthError('invalid_client', 'Unknown client.');\n\t\t}\n\t\tconst meta = JSON.parse(unb64(payload)) as { n: string; r: string[] };\n\t\treturn {\n\t\t\tclientId,\n\t\t\tname: meta.n || 'An MCP client',\n\t\t\tredirectUris: meta.r,\n\t\t\tbuiltIn: false,\n\t\t\tscopes: REGISTERED_CLIENT_SCOPES\n\t\t};\n\t}\n\n\tasync function metadataClient(url: string): Promise<OAuthClient> {\n\t\tconst cached = metadataCache.get(url);\n\t\tif (cached) {\n\t\t\tif ('client' in cached && now() - cached.at < CIMD_TTL_MS) return cached.client;\n\t\t\tif ('failure' in cached && now() - cached.at < CIMD_FAILURE_TTL_MS) throw cached.failure;\n\t\t}\n\t\tif (!options.fetchClientMetadata) {\n\t\t\tthrow new OAuthError('invalid_client', 'This server does not accept URL client ids.');\n\t\t}\n\t\ttry {\n\t\t\tconst client = await readMetadata(url, options.fetchClientMetadata);\n\t\t\tremember(url, { at: now(), client });\n\t\t\treturn client;\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof OAuthError)) throw err;\n\t\t\tremember(url, { at: now(), failure: err });\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tfunction remember(url: string, entry: Parameters<typeof metadataCache.set>[1]) {\n\t\tif (metadataCache.size >= CIMD_CACHE_MAX) {\n\t\t\tmetadataCache.delete(metadataCache.keys().next().value!);\n\t\t}\n\t\tmetadataCache.set(url, entry);\n\t}\n\n\t// ==========================================================================\n\t// Authorization\n\t// ==========================================================================\n\n\t/**\n\t * Validates the query `/oauth/authorize` arrives with. An `OAuthError` from a\n\t * bad client or redirect URI must be shown, not redirected: the redirect target\n\t * is exactly what can't be trusted.\n\t */\n\tasync function parseAuthorizeRequest(query: URLSearchParams): Promise<AuthorizeRequest> {\n\t\tconst client = await resolveClient(query.get('client_id') ?? '');\n\t\tconst redirectUri = query.get('redirect_uri') ?? '';\n\t\tif (!client.redirectUris.some((r) => redirectMatches(r, redirectUri))) {\n\t\t\tthrow new OAuthError(\n\t\t\t\t'invalid_request',\n\t\t\t\t'The redirect URI is not registered for this client.'\n\t\t\t);\n\t\t}\n\t\tif (query.get('response_type') !== 'code') {\n\t\t\tthrow new OAuthError('unsupported_response_type', 'Only response_type=code is supported.');\n\t\t}\n\t\tconst codeChallenge = query.get('code_challenge') ?? '';\n\t\tif (!codeChallenge || query.get('code_challenge_method') !== 'S256') {\n\t\t\tthrow new OAuthError('invalid_request', 'PKCE with code_challenge_method=S256 is required.');\n\t\t}\n\t\tconst resource = query.get('resource') ?? mcpResourceUrl(origin);\n\t\tif (!isThisResource(resource)) {\n\t\t\tthrow new OAuthError('invalid_target', 'The resource is not this server.');\n\t\t}\n\t\treturn {\n\t\t\tclient,\n\t\t\tredirectUri,\n\t\t\tstate: query.get('state') ?? undefined,\n\t\t\tcodeChallenge,\n\t\t\tscopes: parseScopes(query.get('scope'), client.scopes),\n\t\t\tresource\n\t\t};\n\t}\n\n\t/** Where to send the browser after consent: the client's redirect URI with a code. */\n\tfunction approve(request: AuthorizeRequest, grant: Grant): string {\n\t\tconst code = seal(codeKey, {\n\t\t\tc: request.client.clientId,\n\t\t\tr: request.redirectUri,\n\t\t\tp: request.codeChallenge,\n\t\t\tx: now() + CODE_TTL_MS,\n\t\t\tg: grant\n\t\t});\n\t\treturn withParams(request.redirectUri, { code, state: request.state, iss: origin });\n\t}\n\n\tfunction deny(request: AuthorizeRequest): string {\n\t\treturn withParams(request.redirectUri, {\n\t\t\terror: 'access_denied',\n\t\t\tstate: request.state,\n\t\t\tiss: origin\n\t\t});\n\t}\n\n\t// ==========================================================================\n\t// Token endpoint\n\t// ==========================================================================\n\n\tfunction exchange(form: URLSearchParams): HttpResult {\n\t\ttry {\n\t\t\tif (form.get('grant_type') !== 'authorization_code') {\n\t\t\t\tthrow new OAuthError('unsupported_grant_type', 'Only authorization_code is supported.');\n\t\t\t}\n\t\t\tconst code = form.get('code') ?? '';\n\t\t\tconst sealed = (open(codeKey, code) ??\n\t\t\t\t(previousCodeKey ? open(previousCodeKey, code) : null)) as {\n\t\t\t\tc: string;\n\t\t\t\tr: string;\n\t\t\t\tp: string;\n\t\t\t\tx: number;\n\t\t\t\tg: Grant;\n\t\t\t} | null;\n\t\t\tif (!sealed || sealed.x < now()) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code is invalid or expired.');\n\t\t\t}\n\t\t\tif (sealed.c !== form.get('client_id') || sealed.r !== form.get('redirect_uri')) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code was issued to another client.');\n\t\t\t}\n\t\t\tconst verifier = form.get('code_verifier') ?? '';\n\t\t\tif (!safeEqual(createHash('sha256').update(verifier).digest('base64url'), sealed.p)) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code_verifier does not match.');\n\t\t\t}\n\t\t\tconst resource = form.get('resource');\n\t\t\tif (resource !== null && !isThisResource(resource)) {\n\t\t\t\tthrow new OAuthError('invalid_target', 'The resource is not this server.');\n\t\t\t}\n\t\t\tif (!markRedeemed(code, sealed.x)) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code was already used.');\n\t\t\t}\n\t\t\tconst { g } = sealed;\n\t\t\toptions.onRedeemed?.(g.tokenId);\n\t\t\treturn {\n\t\t\t\tstatus: 200,\n\t\t\t\tbody: {\n\t\t\t\t\taccess_token: g.secret,\n\t\t\t\t\ttoken_type: 'Bearer',\n\t\t\t\t\texpires_in: Math.max(0, Math.floor((Date.parse(g.expiresAt) - now()) / 1000)),\n\t\t\t\t\tscope: g.scopes.join(' ')\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) return { status: err.status, body: err.toBody() };\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tfunction markRedeemed(code: string, expiresAt: number): boolean {\n\t\tconst t = now();\n\t\tfor (const [k, x] of redeemed) if (x < t) redeemed.delete(k);\n\t\tconst id = createHash('sha256').update(code).digest('base64url');\n\t\tif (redeemed.has(id)) return false;\n\t\tredeemed.set(id, expiresAt);\n\t\treturn true;\n\t}\n\n\tfunction isThisResource(resource: string): boolean {\n\t\tconst r = resource.replace(/\\/$/, '');\n\t\treturn r === origin || r === mcpResourceUrl(origin);\n\t}\n\n\treturn {\n\t\tregister,\n\t\tresolveClient,\n\t\tparseAuthorizeRequest,\n\t\tapprove,\n\t\tdeny,\n\t\texchange,\n\t\tprotectedResourceMetadata: () => protectedResourceMetadata(origin),\n\t\tauthorizationServerMetadata: () => authorizationServerMetadata(origin)\n\t};\n}\n\nexport type OAuthServer = ReturnType<typeof createOAuthServer>;\n\n/** OAuth scopes to the API scopes a minted token gets. */\nexport function apiScopesFor(scopes: readonly OAuthScope[]): string[] {\n\treturn scopes.map((s) => `${s}:all`);\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nasync function readMetadata(\n\turl: string,\n\tfetchClientMetadata: (url: string) => Promise<unknown>\n): Promise<OAuthClient> {\n\tlet doc: { client_id?: unknown; client_name?: unknown; redirect_uris?: unknown };\n\ttry {\n\t\tdoc = (await fetchClientMetadata(url)) as typeof doc;\n\t} catch {\n\t\tthrow new OAuthError('invalid_client', 'The client metadata document could not be read.');\n\t}\n\tif (doc?.client_id !== url) {\n\t\tthrow new OAuthError('invalid_client', 'The metadata document names a different client_id.');\n\t}\n\treturn {\n\t\tclientId: url,\n\t\tname:\n\t\t\ttypeof doc.client_name === 'string' && doc.client_name.trim()\n\t\t\t\t? doc.client_name.trim().slice(0, CLIENT_NAME_MAX)\n\t\t\t\t: new URL(url).host,\n\t\tredirectUris: checkRedirectUris(doc.redirect_uris),\n\t\tbuiltIn: false,\n\t\tscopes: REGISTERED_CLIENT_SCOPES\n\t};\n}\n\n/**\n * What the request asks for, within what its client may have. A scope outside\n * that is dropped, not refused, so a client that asks for every advertised\n * scope still signs in with what it may have. No `scope` at all means all of\n * them. Asking only for scopes it may not have gets `read`, never more than it\n * asked for. `read` rides along with `solve`, which the consent page offers as\n * \"read and run solves\".\n */\nfunction parseScopes(raw: string | null, allowed: readonly OAuthScope[]): OAuthScope[] {\n\tconst requested = (raw ?? '').split(' ').filter(Boolean);\n\tif (!requested.length) return [...allowed];\n\tconst asked = requested.filter((s): s is OAuthScope =>\n\t\t(allowed as readonly string[]).includes(s)\n\t);\n\tif (!asked.length) return allowed.includes('read') ? ['read'] : [];\n\treturn allowed.filter((s) => asked.includes(s) || (s === 'read' && asked.includes('solve')));\n}\n\n/** One access level a consent page offers, and the scopes approving it grants. */\nexport interface ConsentChoice {\n\taccess: 'read' | 'solve' | 'upload';\n\tscopes: OAuthScope[];\n}\n\n/**\n * The access levels a consent page offers for a request, narrowest first. The\n * user may narrow what the client asked for, never widen it. An upload request\n * is offered as asked: narrowing it to read would leave the client unable to\n * do the one thing it signed in for.\n */\nexport function consentChoices(scopes: readonly OAuthScope[]): ConsentChoice[] {\n\tif (scopes.includes('upload')) return [{ access: 'upload', scopes: [...scopes] }];\n\tconst choices: ConsentChoice[] = [{ access: 'read', scopes: ['read'] }];\n\tif (scopes.includes('solve')) choices.push({ access: 'solve', scopes: [...scopes] });\n\treturn choices;\n}\n\nfunction checkRedirectUris(value: unknown): string[] {\n\tif (!Array.isArray(value) || !value.length || value.length > REDIRECT_URIS_MAX) {\n\t\tthrow new OAuthError('invalid_redirect_uri', 'Give between 1 and 10 redirect_uris.');\n\t}\n\tfor (const uri of value) {\n\t\tif (typeof uri !== 'string' || !isAllowedRedirect(uri)) {\n\t\t\tthrow new OAuthError(\n\t\t\t\t'invalid_redirect_uri',\n\t\t\t\t'Redirect URIs must be https, or http on a loopback address.'\n\t\t\t);\n\t\t}\n\t}\n\treturn value as string[];\n}\n\nfunction isAllowedRedirect(uri: string): boolean {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(uri);\n\t} catch {\n\t\treturn false;\n\t}\n\tif (url.hash) return false;\n\treturn (\n\t\turl.protocol === 'https:' || (url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname))\n\t);\n}\n\n/** A redirect to a program on the user's own machine, which any local process can claim. */\nexport function isLoopbackRedirect(uri: string): boolean {\n\ttry {\n\t\treturn LOOPBACK_HOSTS.has(new URL(uri).hostname);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Exact, except a loopback redirect matches on any port (RFC 8252 §7.3). */\nexport function redirectMatches(registered: string, requested: string): boolean {\n\tif (registered === requested) return true;\n\tlet a: URL, b: URL;\n\ttry {\n\t\ta = new URL(registered);\n\t\tb = new URL(requested);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn (\n\t\ta.protocol === 'http:' &&\n\t\tb.protocol === 'http:' &&\n\t\tLOOPBACK_HOSTS.has(a.hostname) &&\n\t\ta.hostname === b.hostname &&\n\t\ta.pathname === b.pathname &&\n\t\ta.search === b.search &&\n\t\t!b.hash &&\n\t\t!b.username &&\n\t\t!b.password\n\t);\n}\n\nfunction withParams(uri: string, params: Record<string, string | undefined>): string {\n\tconst url = new URL(uri);\n\tfor (const [k, v] of Object.entries(params)) if (v !== undefined) url.searchParams.set(k, v);\n\treturn url.toString();\n}\n\nfunction derive(secret: string, info: string): Buffer {\n\treturn Buffer.from(hkdfSync('sha256', secret, '', info, 32));\n}\n\nfunction sign(key: Buffer, data: string): string {\n\treturn createHmac('sha256', key).update(data).digest('base64url');\n}\n\nfunction seal(key: Buffer, value: unknown): string {\n\tconst iv = randomBytes(12);\n\tconst cipher = createCipheriv('aes-256-gcm', key, iv);\n\tconst body = Buffer.concat([cipher.update(JSON.stringify(value)), cipher.final()]);\n\treturn Buffer.concat([iv, cipher.getAuthTag(), body]).toString('base64url');\n}\n\nfunction open(key: Buffer, sealed: string): unknown {\n\ttry {\n\t\tconst raw = Buffer.from(sealed, 'base64url');\n\t\t// Without the length, a short code is checked against however many tag bytes it has.\n\t\tconst decipher = createDecipheriv('aes-256-gcm', key, raw.subarray(0, 12), {\n\t\t\tauthTagLength: 16\n\t\t});\n\t\tdecipher.setAuthTag(raw.subarray(12, 28));\n\t\tconst body = Buffer.concat([decipher.update(raw.subarray(28)), decipher.final()]);\n\t\treturn JSON.parse(body.toString('utf8'));\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction b64(text: string): string {\n\treturn Buffer.from(text).toString('base64url');\n}\n\nfunction unb64(text: string): string {\n\treturn Buffer.from(text, 'base64url').toString('utf8');\n}\n\nfunction safeEqual(a: string, b: string): boolean {\n\tconst x = Buffer.from(a);\n\tconst y = Buffer.from(b);\n\treturn x.length === y.length && timingSafeEqual(x, y);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,IAAa,eAAe;CAAC;CAAQ;CAAS;CAAU;AAAiB;;;;;;;AASzE,IAAa,2BAA2B,CAAC,QAAQ,OAAO;AAOxD,IAAM,qBAAkC;CACvC,UAAU;CACV,MAAM;CACN,cAAc,CAAC,2BAA2B;CAC1C,SAAS;CACT,QAAQ;EAAC;EAAQ;EAAU;CAAiB;AAC7C;AAEA,IAAa,WAAW;AAExB,IAAa,cAAc;AA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;AAC9C;AAEA,SAAS,MAAM,MAAsB;CACpC,OAAO,OAAO,KAAK,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM;AACtD;AAEA,SAAS,UAAU,GAAW,GAAoB;CACjD,MAAM,IAAI,OAAO,KAAK,CAAC;CACvB,MAAM,IAAI,OAAO,KAAK,CAAC;CACvB,OAAO,EAAE,WAAW,EAAE,UAAU,gBAAgB,GAAG,CAAC;AACrD"}
|
|
1
|
+
{"version":3,"file":"oauth.js","names":["sign"],"sources":["../../../../server/src/oauth/index.ts"],"sourcesContent":["/**\n * OAuth 2.1 for MCP clients and the Grasshopper plugin, with this instance as\n * its own authorization server.\n *\n * The access token is an ordinary API token. The host mints it while the user is\n * signed in, at consent, through the same path as Team → API tokens; this\n * module seals the raw key into the authorization code and hands it over at the\n * token endpoint. So `/mcp` and `/api/v1` keep one credential type.\n *\n * Nothing here is stored. A registered client's id is its own signed metadata,\n * and a code is its own encrypted grant, bound to the issuing origin. The only\n * state is the set of redeemed codes, in the host's memory, so on several\n * replicas a code could be redeemed once per replica within its minute, and only\n * by whoever holds the PKCE verifier.\n */\n\nimport {\n\tcreateCipheriv,\n\tcreateDecipheriv,\n\tcreateHash,\n\tcreateHmac,\n\thkdfSync,\n\trandomBytes,\n\ttimingSafeEqual\n} from 'node:crypto';\n\n/** The scopes a grant can carry. Each maps to one org-wide API scope. */\nexport const OAUTH_SCOPES = ['read', 'solve', 'write', 'upload', 'create_projects'] as const;\nexport type OAuthScope = (typeof OAUTH_SCOPES)[number];\n\n/**\n * All a host may hand registered (DCR or CIMD) clients. Their name and redirects\n * are whatever the registrant chose, so `upload`, which puts code on the org's\n * Compute server, and `create_projects` aren't here. `write` is, but `write:all`\n * covers both at `/api/v1` and can delete projects and definitions, so it is\n * off by default. An allowlist: a new scope reaches registered clients only\n * once it is added here.\n */\nexport const REGISTERABLE_SCOPES = [\n\t'read',\n\t'solve',\n\t'write'\n] as const satisfies readonly OAuthScope[];\nexport type RegisteredClientScope = (typeof REGISTERABLE_SCOPES)[number];\n\n/** The default `registeredClientScopes`. */\nexport const REGISTERED_CLIENT_SCOPES = [\n\t'read',\n\t'solve'\n] as const satisfies readonly RegisteredClientScope[];\n\n/** The Grasshopper plugin's client id. Built in, so it needs no registration and works air-gapped. */\nexport const GRASSHOPPER_CLIENT_ID = 'selva-grasshopper';\n\n// Loopback on any port (RFC 8252 §7.3), but only this host and path: the code\n// can only ever reach a program on the user's own machine.\nconst GRASSHOPPER_CLIENT: OAuthClient = {\n\tclientId: GRASSHOPPER_CLIENT_ID,\n\tname: 'Selva for Grasshopper',\n\tredirectUris: ['http://127.0.0.1/callback'],\n\tbuiltIn: true,\n\tscopes: ['read', 'upload', 'create_projects']\n};\n\nexport const MCP_PATH = '/mcp';\n\nexport const CODE_TTL_MS = 60_000;\nconst CLIENT_NAME_MAX = 100;\nconst REDIRECT_URIS_MAX = 10;\nconst CIMD_TTL_MS = 60 * 60_000;\n// A failing metadata URL is not refetched for this long: each fetch is outbound\n// work an anonymous caller could otherwise trigger at will.\nconst CIMD_FAILURE_TTL_MS = 60_000;\nconst CIMD_CACHE_MAX = 500;\nconst LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);\n\nexport class OAuthError extends Error {\n\tconstructor(\n\t\t/** RFC 6749 / 7591 error code. */\n\t\treadonly error: string,\n\t\tdescription: string,\n\t\treadonly status = 400\n\t) {\n\t\tsuper(description);\n\t\tthis.name = 'OAuthError';\n\t}\n\n\ttoBody(): { error: string; error_description: string } {\n\t\treturn { error: this.error, error_description: this.message };\n\t}\n}\n\nexport interface OAuthClient {\n\tclientId: string;\n\t/** Shown on the consent page. Unverified for a registered client: whatever it claimed. */\n\tname: string;\n\tredirectUris: string[];\n\t/** Shipped with this server, so its name can be trusted. */\n\tbuiltIn: boolean;\n\t/** All this client can be granted, whatever it asks for. */\n\tscopes: readonly OAuthScope[];\n}\n\n/** A validated `/oauth/authorize` request, ready for the consent page. */\nexport interface AuthorizeRequest {\n\tclient: OAuthClient;\n\tredirectUri: string;\n\tstate?: string;\n\tcodeChallenge: string;\n\tscopes: OAuthScope[];\n\tresource: string;\n}\n\n/** What the host minted at consent. `secret` is the raw API key. */\nexport interface Grant {\n\ttokenId: string;\n\tsecret: string;\n\tscopes: OAuthScope[];\n\texpiresAt: string;\n}\n\nexport interface OAuthServerOptions {\n\t/** This instance's origin, e.g. `https://selva.example.com`. */\n\torigin: string;\n\t/** `SELVA_HMAC_KEY`. Signs client ids and seals codes. */\n\tsecret: string;\n\t/** The key before the last rotation: client ids and codes it made still verify. */\n\tpreviousSecret?: string;\n\t/**\n\t * All a DCR or CIMD client can be granted, from {@link REGISTERABLE_SCOPES}\n\t * and including `read`. Default {@link REGISTERED_CLIENT_SCOPES}. Serve the\n\t * server's discovery documents and pass its `registeredScopes` as the MCP\n\t * 401 challenge's scopes, so clients ask for this same list.\n\t */\n\tregisteredClientScopes?: readonly RegisteredClientScope[];\n\t/**\n\t * Fetches a Client ID Metadata Document. The URL comes from an unknown client,\n\t * so the host must guard it against SSRF. Without it, URL client ids are refused.\n\t */\n\tfetchClientMetadata?: (url: string) => Promise<unknown>;\n\t/**\n\t * Redeemed code hashes and their expiry. Pass one map for the process so a\n\t * rebuilt server (a new origin, a rotated secret) still refuses a replay.\n\t */\n\tredeemedCodes?: Map<string, number>;\n\t/** Called once a code is exchanged, with the token its grant carries. */\n\tonRedeemed?: (tokenId: string) => void;\n\tnow?: () => number;\n}\n\ninterface HttpResult {\n\tstatus: number;\n\tbody: Record<string, unknown>;\n}\n\n// ============================================================================\n// Discovery documents\n// ============================================================================\n\nexport function mcpResourceUrl(origin: string): string {\n\treturn origin + MCP_PATH;\n}\n\nexport function resourceMetadataUrl(origin: string): string {\n\treturn `${origin}/.well-known/oauth-protected-resource${MCP_PATH}`;\n}\n\n/**\n * RFC 9728. Claude uses only the first authorization server. `scopes` is what a\n * registered client may be granted; prefer the server's own method, which\n * passes its `registeredClientScopes`.\n */\nexport function protectedResourceMetadata(\n\torigin: string,\n\tscopes: readonly RegisteredClientScope[] = REGISTERED_CLIENT_SCOPES\n) {\n\treturn {\n\t\tresource: mcpResourceUrl(origin),\n\t\tauthorization_servers: [origin],\n\t\tscopes_supported: [...scopes],\n\t\tbearer_methods_supported: ['header']\n\t};\n}\n\n/**\n * RFC 8414. Claude picks Client ID Metadata Documents only when both\n * `client_id_metadata_document_supported` and the `none` auth method appear.\n * Advertises only scopes some client can be granted: a client that asks for one\n * it can never get re-authorizes in a loop. Prefer the server's own method.\n */\nexport function authorizationServerMetadata(\n\torigin: string,\n\tregisteredScopes: readonly RegisteredClientScope[] = REGISTERED_CLIENT_SCOPES\n) {\n\treturn {\n\t\tissuer: origin,\n\t\tauthorization_endpoint: `${origin}/oauth/authorize`,\n\t\ttoken_endpoint: `${origin}/oauth/token`,\n\t\tregistration_endpoint: `${origin}/oauth/register`,\n\t\tresponse_types_supported: ['code'],\n\t\tgrant_types_supported: ['authorization_code'],\n\t\tcode_challenge_methods_supported: ['S256'],\n\t\ttoken_endpoint_auth_methods_supported: ['none'],\n\t\tscopes_supported: OAUTH_SCOPES.filter(\n\t\t\t(s) =>\n\t\t\t\tGRASSHOPPER_CLIENT.scopes.includes(s) ||\n\t\t\t\t(registeredScopes as readonly OAuthScope[]).includes(s)\n\t\t),\n\t\tclient_id_metadata_document_supported: true,\n\t\tauthorization_response_iss_parameter_supported: true\n\t};\n}\n\n/**\n * The host's list, checked: a JS host or a cast gets past the type, and a list\n * without `read` would leave every consent page empty with a message blaming\n * the user's account.\n */\nfunction checkRegisteredScopes(scopes: readonly string[]): RegisteredClientScope[] {\n\tfor (const s of scopes) {\n\t\tif (!(REGISTERABLE_SCOPES as readonly string[]).includes(s)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`registeredClientScopes: \"${s}\" can't be granted to a registered client.`\n\t\t\t);\n\t\t}\n\t}\n\tif (!scopes.includes('read')) throw new TypeError('registeredClientScopes must include \"read\".');\n\treturn REGISTERABLE_SCOPES.filter((s) => scopes.includes(s));\n}\n\n// ============================================================================\n// Server\n// ============================================================================\n\nexport function createOAuthServer(options: OAuthServerOptions) {\n\tconst { origin } = options;\n\tconst now = options.now ?? Date.now;\n\tconst signKey = derive(options.secret, 'selva-oauth-client');\n\tconst codeKey = derive(options.secret, `selva-oauth-code:${origin}`);\n\tconst previous = options.previousSecret;\n\tconst previousSignKey = previous ? derive(previous, 'selva-oauth-client') : undefined;\n\tconst previousCodeKey = previous ? derive(previous, `selva-oauth-code:${origin}`) : undefined;\n\tconst redeemed = options.redeemedCodes ?? new Map<string, number>();\n\tconst registeredScopes = checkRegisteredScopes(\n\t\toptions.registeredClientScopes ?? REGISTERED_CLIENT_SCOPES\n\t);\n\tconst metadataCache = new Map<\n\t\tstring,\n\t\t{ at: number; client: OAuthClient } | { at: number; failure: OAuthError }\n\t>();\n\n\t// ==========================================================================\n\t// Clients\n\t// ==========================================================================\n\n\t/** RFC 7591. The client id carries the metadata, signed, so nothing is stored. */\n\tfunction register(input: unknown): HttpResult {\n\t\ttry {\n\t\t\tconst meta = (input ?? {}) as { client_name?: unknown; redirect_uris?: unknown };\n\t\t\tconst redirectUris = checkRedirectUris(meta.redirect_uris);\n\t\t\tconst name = typeof meta.client_name === 'string' ? meta.client_name.trim() : '';\n\t\t\tconst payload = b64(\n\t\t\t\tJSON.stringify({ n: name.slice(0, CLIENT_NAME_MAX), r: redirectUris, t: now() })\n\t\t\t);\n\t\t\tconst clientId = `dcr_${payload}.${sign(signKey, payload)}`;\n\t\t\treturn {\n\t\t\t\tstatus: 201,\n\t\t\t\tbody: {\n\t\t\t\t\tclient_id: clientId,\n\t\t\t\t\tclient_id_issued_at: Math.floor(now() / 1000),\n\t\t\t\t\tclient_name: name || undefined,\n\t\t\t\t\tredirect_uris: redirectUris,\n\t\t\t\t\tgrant_types: ['authorization_code'],\n\t\t\t\t\tresponse_types: ['code'],\n\t\t\t\t\ttoken_endpoint_auth_method: 'none'\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) return { status: err.status, body: err.toBody() };\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tasync function resolveClient(clientId: string): Promise<OAuthClient> {\n\t\tif (clientId === GRASSHOPPER_CLIENT_ID) return GRASSHOPPER_CLIENT;\n\t\tif (clientId.startsWith('dcr_')) return registeredClient(clientId);\n\t\tif (clientId.startsWith('https://')) return metadataClient(clientId);\n\t\tthrow new OAuthError('invalid_client', 'Unknown client.');\n\t}\n\n\tfunction registeredClient(clientId: string): OAuthClient {\n\t\tconst [payload, signature] = clientId.slice('dcr_'.length).split('.');\n\t\tconst signedBy = (key: Buffer | undefined) =>\n\t\t\tkey !== undefined && safeEqual(signature, sign(key, payload));\n\t\tif (!payload || !signature || !(signedBy(signKey) || signedBy(previousSignKey))) {\n\t\t\tthrow new OAuthError('invalid_client', 'Unknown client.');\n\t\t}\n\t\tconst meta = JSON.parse(unb64(payload)) as { n: string; r: string[] };\n\t\treturn {\n\t\t\tclientId,\n\t\t\tname: meta.n || 'An MCP client',\n\t\t\tredirectUris: meta.r,\n\t\t\tbuiltIn: false,\n\t\t\tscopes: registeredScopes\n\t\t};\n\t}\n\n\tasync function metadataClient(url: string): Promise<OAuthClient> {\n\t\tconst cached = metadataCache.get(url);\n\t\tif (cached) {\n\t\t\tif ('client' in cached && now() - cached.at < CIMD_TTL_MS) return cached.client;\n\t\t\tif ('failure' in cached && now() - cached.at < CIMD_FAILURE_TTL_MS) throw cached.failure;\n\t\t}\n\t\tif (!options.fetchClientMetadata) {\n\t\t\tthrow new OAuthError('invalid_client', 'This server does not accept URL client ids.');\n\t\t}\n\t\ttry {\n\t\t\tconst client = await readMetadata(url, options.fetchClientMetadata, registeredScopes);\n\t\t\tremember(url, { at: now(), client });\n\t\t\treturn client;\n\t\t} catch (err) {\n\t\t\tif (!(err instanceof OAuthError)) throw err;\n\t\t\tremember(url, { at: now(), failure: err });\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tfunction remember(url: string, entry: Parameters<typeof metadataCache.set>[1]) {\n\t\tif (metadataCache.size >= CIMD_CACHE_MAX) {\n\t\t\tmetadataCache.delete(metadataCache.keys().next().value!);\n\t\t}\n\t\tmetadataCache.set(url, entry);\n\t}\n\n\t// ==========================================================================\n\t// Authorization\n\t// ==========================================================================\n\n\t/**\n\t * Validates the query `/oauth/authorize` arrives with. An `OAuthError` from a\n\t * bad client or redirect URI must be shown, not redirected: the redirect target\n\t * is exactly what can't be trusted.\n\t */\n\tasync function parseAuthorizeRequest(query: URLSearchParams): Promise<AuthorizeRequest> {\n\t\tconst client = await resolveClient(query.get('client_id') ?? '');\n\t\tconst redirectUri = query.get('redirect_uri') ?? '';\n\t\tif (!client.redirectUris.some((r) => redirectMatches(r, redirectUri))) {\n\t\t\tthrow new OAuthError(\n\t\t\t\t'invalid_request',\n\t\t\t\t'The redirect URI is not registered for this client.'\n\t\t\t);\n\t\t}\n\t\tif (query.get('response_type') !== 'code') {\n\t\t\tthrow new OAuthError('unsupported_response_type', 'Only response_type=code is supported.');\n\t\t}\n\t\tconst codeChallenge = query.get('code_challenge') ?? '';\n\t\tif (!codeChallenge || query.get('code_challenge_method') !== 'S256') {\n\t\t\tthrow new OAuthError('invalid_request', 'PKCE with code_challenge_method=S256 is required.');\n\t\t}\n\t\tconst resource = query.get('resource') ?? mcpResourceUrl(origin);\n\t\tif (!isThisResource(resource)) {\n\t\t\tthrow new OAuthError('invalid_target', 'The resource is not this server.');\n\t\t}\n\t\treturn {\n\t\t\tclient,\n\t\t\tredirectUri,\n\t\t\tstate: query.get('state') ?? undefined,\n\t\t\tcodeChallenge,\n\t\t\tscopes: parseScopes(query.get('scope'), client.scopes),\n\t\t\tresource\n\t\t};\n\t}\n\n\t/** Where to send the browser after consent: the client's redirect URI with a code. */\n\tfunction approve(request: AuthorizeRequest, grant: Grant): string {\n\t\tconst code = seal(codeKey, {\n\t\t\tc: request.client.clientId,\n\t\t\tr: request.redirectUri,\n\t\t\tp: request.codeChallenge,\n\t\t\tx: now() + CODE_TTL_MS,\n\t\t\tg: grant\n\t\t});\n\t\treturn withParams(request.redirectUri, { code, state: request.state, iss: origin });\n\t}\n\n\tfunction deny(request: AuthorizeRequest): string {\n\t\treturn withParams(request.redirectUri, {\n\t\t\terror: 'access_denied',\n\t\t\tstate: request.state,\n\t\t\tiss: origin\n\t\t});\n\t}\n\n\t// ==========================================================================\n\t// Token endpoint\n\t// ==========================================================================\n\n\tfunction exchange(form: URLSearchParams): HttpResult {\n\t\ttry {\n\t\t\tif (form.get('grant_type') !== 'authorization_code') {\n\t\t\t\tthrow new OAuthError('unsupported_grant_type', 'Only authorization_code is supported.');\n\t\t\t}\n\t\t\tconst code = form.get('code') ?? '';\n\t\t\tconst sealed = (open(codeKey, code) ??\n\t\t\t\t(previousCodeKey ? open(previousCodeKey, code) : null)) as {\n\t\t\t\tc: string;\n\t\t\t\tr: string;\n\t\t\t\tp: string;\n\t\t\t\tx: number;\n\t\t\t\tg: Grant;\n\t\t\t} | null;\n\t\t\tif (!sealed || sealed.x < now()) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code is invalid or expired.');\n\t\t\t}\n\t\t\tif (sealed.c !== form.get('client_id') || sealed.r !== form.get('redirect_uri')) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code was issued to another client.');\n\t\t\t}\n\t\t\tconst verifier = form.get('code_verifier') ?? '';\n\t\t\tif (!safeEqual(createHash('sha256').update(verifier).digest('base64url'), sealed.p)) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code_verifier does not match.');\n\t\t\t}\n\t\t\tconst resource = form.get('resource');\n\t\t\tif (resource !== null && !isThisResource(resource)) {\n\t\t\t\tthrow new OAuthError('invalid_target', 'The resource is not this server.');\n\t\t\t}\n\t\t\tif (!markRedeemed(code, sealed.x)) {\n\t\t\t\tthrow new OAuthError('invalid_grant', 'The code was already used.');\n\t\t\t}\n\t\t\tconst { g } = sealed;\n\t\t\toptions.onRedeemed?.(g.tokenId);\n\t\t\treturn {\n\t\t\t\tstatus: 200,\n\t\t\t\tbody: {\n\t\t\t\t\taccess_token: g.secret,\n\t\t\t\t\ttoken_type: 'Bearer',\n\t\t\t\t\texpires_in: Math.max(0, Math.floor((Date.parse(g.expiresAt) - now()) / 1000)),\n\t\t\t\t\tscope: g.scopes.join(' ')\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) return { status: err.status, body: err.toBody() };\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tfunction markRedeemed(code: string, expiresAt: number): boolean {\n\t\tconst t = now();\n\t\tfor (const [k, x] of redeemed) if (x < t) redeemed.delete(k);\n\t\tconst id = createHash('sha256').update(code).digest('base64url');\n\t\tif (redeemed.has(id)) return false;\n\t\tredeemed.set(id, expiresAt);\n\t\treturn true;\n\t}\n\n\tfunction isThisResource(resource: string): boolean {\n\t\tconst r = resource.replace(/\\/$/, '');\n\t\treturn r === origin || r === mcpResourceUrl(origin);\n\t}\n\n\treturn {\n\t\tregister,\n\t\tresolveClient,\n\t\tparseAuthorizeRequest,\n\t\tapprove,\n\t\tdeny,\n\t\texchange,\n\t\t/** All a registered client can be granted: the MCP 401 challenge's scopes. */\n\t\tregisteredScopes: registeredScopes as readonly RegisteredClientScope[],\n\t\tprotectedResourceMetadata: () => protectedResourceMetadata(origin, registeredScopes),\n\t\tauthorizationServerMetadata: () => authorizationServerMetadata(origin, registeredScopes)\n\t};\n}\n\nexport type OAuthServer = ReturnType<typeof createOAuthServer>;\n\n/** OAuth scopes to the API scopes a minted token gets. */\nexport function apiScopesFor(scopes: readonly OAuthScope[]): string[] {\n\treturn scopes.map((s) => `${s}:all`);\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nasync function readMetadata(\n\turl: string,\n\tfetchClientMetadata: (url: string) => Promise<unknown>,\n\tscopes: readonly OAuthScope[]\n): Promise<OAuthClient> {\n\tlet doc: { client_id?: unknown; client_name?: unknown; redirect_uris?: unknown };\n\ttry {\n\t\tdoc = (await fetchClientMetadata(url)) as typeof doc;\n\t} catch {\n\t\tthrow new OAuthError('invalid_client', 'The client metadata document could not be read.');\n\t}\n\tif (doc?.client_id !== url) {\n\t\tthrow new OAuthError('invalid_client', 'The metadata document names a different client_id.');\n\t}\n\treturn {\n\t\tclientId: url,\n\t\tname:\n\t\t\ttypeof doc.client_name === 'string' && doc.client_name.trim()\n\t\t\t\t? doc.client_name.trim().slice(0, CLIENT_NAME_MAX)\n\t\t\t\t: new URL(url).host,\n\t\tredirectUris: checkRedirectUris(doc.redirect_uris),\n\t\tbuiltIn: false,\n\t\tscopes\n\t};\n}\n\n/**\n * What the request asks for, within what its client may have. A scope outside\n * that is dropped, not refused, so a client that asks for every advertised\n * scope still signs in with what it may have. No `scope` at all means all of\n * them. Asking only for scopes it may not have gets `read`, never more than it\n * asked for. `read` rides along with `solve` and `write`, which the consent\n * page offers as \"read and run solves\" and \"read and change\".\n */\nfunction parseScopes(raw: string | null, allowed: readonly OAuthScope[]): OAuthScope[] {\n\tconst requested = (raw ?? '').split(' ').filter(Boolean);\n\tif (!requested.length) return [...allowed];\n\tconst asked = requested.filter((s): s is OAuthScope =>\n\t\t(allowed as readonly string[]).includes(s)\n\t);\n\tif (!asked.length) return allowed.includes('read') ? ['read'] : [];\n\tconst impliesRead = asked.includes('solve') || asked.includes('write');\n\treturn allowed.filter((s) => asked.includes(s) || (s === 'read' && impliesRead));\n}\n\n/** One access level a consent page offers, and the scopes approving it grants. */\nexport interface ConsentChoice {\n\taccess: 'read' | 'solve' | 'write' | 'write_and_solve' | 'upload';\n\tscopes: OAuthScope[];\n}\n\n/**\n * The access levels a consent page offers for a request: `read` first, all it\n * asked for last. The user may narrow what the client asked for, never widen\n * it. `write` is offered with and without `solve`, so change access needn't\n * spend compute budget, and a host policy that allows one can still grant it.\n * An upload request is offered as asked: narrowing it to read would leave the\n * client unable to do the one thing it signed in for.\n */\nexport function consentChoices(scopes: readonly OAuthScope[]): ConsentChoice[] {\n\tif (!scopes.length) return [];\n\tif (scopes.includes('upload')) return [{ access: 'upload', scopes: [...scopes] }];\n\tconst solve = scopes.includes('solve');\n\tconst write = scopes.includes('write');\n\tconst choices: ConsentChoice[] = [{ access: 'read', scopes: ['read'] }];\n\tif (solve) choices.push({ access: 'solve', scopes: ['read', 'solve'] });\n\tif (write) choices.push({ access: 'write', scopes: ['read', 'write'] });\n\tif (solve && write) {\n\t\tchoices.push({ access: 'write_and_solve', scopes: ['read', 'solve', 'write'] });\n\t}\n\treturn choices;\n}\n\nfunction checkRedirectUris(value: unknown): string[] {\n\tif (!Array.isArray(value) || !value.length || value.length > REDIRECT_URIS_MAX) {\n\t\tthrow new OAuthError('invalid_redirect_uri', 'Give between 1 and 10 redirect_uris.');\n\t}\n\tfor (const uri of value) {\n\t\tif (typeof uri !== 'string' || !isAllowedRedirect(uri)) {\n\t\t\tthrow new OAuthError(\n\t\t\t\t'invalid_redirect_uri',\n\t\t\t\t'Redirect URIs must be https, or http on a loopback address.'\n\t\t\t);\n\t\t}\n\t}\n\treturn value as string[];\n}\n\nfunction isAllowedRedirect(uri: string): boolean {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(uri);\n\t} catch {\n\t\treturn false;\n\t}\n\tif (url.hash) return false;\n\treturn (\n\t\turl.protocol === 'https:' || (url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname))\n\t);\n}\n\n/** A redirect to a program on the user's own machine, which any local process can claim. */\nexport function isLoopbackRedirect(uri: string): boolean {\n\ttry {\n\t\treturn LOOPBACK_HOSTS.has(new URL(uri).hostname);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Exact, except a loopback redirect matches on any port (RFC 8252 §7.3). */\nexport function redirectMatches(registered: string, requested: string): boolean {\n\tif (registered === requested) return true;\n\tlet a: URL, b: URL;\n\ttry {\n\t\ta = new URL(registered);\n\t\tb = new URL(requested);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn (\n\t\ta.protocol === 'http:' &&\n\t\tb.protocol === 'http:' &&\n\t\tLOOPBACK_HOSTS.has(a.hostname) &&\n\t\ta.hostname === b.hostname &&\n\t\ta.pathname === b.pathname &&\n\t\ta.search === b.search &&\n\t\t!b.hash &&\n\t\t!b.username &&\n\t\t!b.password\n\t);\n}\n\nfunction withParams(uri: string, params: Record<string, string | undefined>): string {\n\tconst url = new URL(uri);\n\tfor (const [k, v] of Object.entries(params)) if (v !== undefined) url.searchParams.set(k, v);\n\treturn url.toString();\n}\n\nfunction derive(secret: string, info: string): Buffer {\n\treturn Buffer.from(hkdfSync('sha256', secret, '', info, 32));\n}\n\nfunction sign(key: Buffer, data: string): string {\n\treturn createHmac('sha256', key).update(data).digest('base64url');\n}\n\nfunction seal(key: Buffer, value: unknown): string {\n\tconst iv = randomBytes(12);\n\tconst cipher = createCipheriv('aes-256-gcm', key, iv);\n\tconst body = Buffer.concat([cipher.update(JSON.stringify(value)), cipher.final()]);\n\treturn Buffer.concat([iv, cipher.getAuthTag(), body]).toString('base64url');\n}\n\nfunction open(key: Buffer, sealed: string): unknown {\n\ttry {\n\t\tconst raw = Buffer.from(sealed, 'base64url');\n\t\t// Without the length, a short code is checked against however many tag bytes it has.\n\t\tconst decipher = createDecipheriv('aes-256-gcm', key, raw.subarray(0, 12), {\n\t\t\tauthTagLength: 16\n\t\t});\n\t\tdecipher.setAuthTag(raw.subarray(12, 28));\n\t\tconst body = Buffer.concat([decipher.update(raw.subarray(28)), decipher.final()]);\n\t\treturn JSON.parse(body.toString('utf8'));\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction b64(text: string): string {\n\treturn Buffer.from(text).toString('base64url');\n}\n\nfunction unb64(text: string): string {\n\treturn Buffer.from(text, 'base64url').toString('utf8');\n}\n\nfunction safeEqual(a: string, b: string): boolean {\n\tconst x = Buffer.from(a);\n\tconst y = Buffer.from(b);\n\treturn x.length === y.length && timingSafeEqual(x, y);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,IAAa,eAAe;CAAC;CAAQ;CAAS;CAAS;CAA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AO,KAAK,CAAC;CACvB,OAAO,EAAE,WAAW,EAAE,UAAU,gBAAgB,GAAG,CAAC;AACrD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../solve/dist/outcome-
|
|
1
|
+
// ../solve/dist/outcome-D28FgvFK.js
|
|
2
2
|
/**
|
|
3
3
|
* The solve contract — what a solve returns and what a caller supplies to run one.
|
|
4
4
|
*
|
|
@@ -105,7 +105,7 @@ function decodeDiagnostic(entry) {
|
|
|
105
105
|
...d.isGate === true ? { isGate: true } : {}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function normalizeOutcome(entries, blocked, aborted) {
|
|
108
|
+
function normalizeOutcome(entries, blocked, aborted, deferred) {
|
|
109
109
|
const seen = /* @__PURE__ */ new Set();
|
|
110
110
|
const diagnostics = [];
|
|
111
111
|
for (const entry of entries) {
|
|
@@ -119,7 +119,8 @@ function normalizeOutcome(entries, blocked, aborted) {
|
|
|
119
119
|
return {
|
|
120
120
|
diagnostics,
|
|
121
121
|
blocked: blocked || aborted,
|
|
122
|
-
aborted
|
|
122
|
+
aborted,
|
|
123
|
+
...deferred && deferred.length > 0 ? { deferred } : {}
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
@@ -130,11 +131,12 @@ function normalizeOutcome(entries, blocked, aborted) {
|
|
|
130
131
|
*/
|
|
131
132
|
function decodeOutcome(wire) {
|
|
132
133
|
if (!wire || typeof wire !== "object") return null;
|
|
133
|
-
const { diagnostics, blocked, aborted } = wire;
|
|
134
|
+
const { diagnostics, blocked, aborted, deferred } = wire;
|
|
134
135
|
const hasList = Array.isArray(diagnostics);
|
|
135
136
|
if (!hasList && blocked === void 0 && aborted === void 0) return null;
|
|
136
137
|
const isTrue = (flag) => flag === true || flag === "true";
|
|
137
|
-
|
|
138
|
+
const deferredIds = Array.isArray(deferred) ? deferred.filter((id) => typeof id === "string" && id !== "") : void 0;
|
|
139
|
+
return normalizeOutcome(hasList ? diagnostics : [], isTrue(blocked), isTrue(aborted), deferredIds);
|
|
138
140
|
}
|
|
139
141
|
/** The legacy verdict, read from Compute's flattened `errors`/`warnings` and their markers. */
|
|
140
142
|
function outcomeFromComputeMessages(errors, warnings) {
|
|
@@ -159,9 +161,10 @@ function finalizeResult(partial, outcome) {
|
|
|
159
161
|
diagnostics: outcome.diagnostics,
|
|
160
162
|
blocked: outcome.blocked,
|
|
161
163
|
aborted: outcome.aborted,
|
|
164
|
+
...outcome.deferred && !rejected ? { deferred: outcome.deferred } : {},
|
|
162
165
|
...partial.source !== void 0 && !rejected ? { source: partial.source } : {}
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
export { outcomeFromComputeMessages as i, decodeOutcome as n, finalizeResult as r, decodeDiagnostic as t };
|
|
166
169
|
|
|
167
|
-
//# sourceMappingURL=outcome-
|
|
170
|
+
//# sourceMappingURL=outcome-D28FgvFK.js.map
|