From 2d0791f2282130119537a6ff458ea3075b7a1333 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Mon, 16 Nov 2026 21:38:52 +0800 Subject: [PATCH 1/3] fix: make the worker plane build again (engine 5.14.0) + wrangler types, package guards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI on main has been red since the WO15 merge: src/ml.ts imports createPlaneModel from "interscript/ml", but the pinned engine (^4.0.0) has no plane module. Bump the engine to ^5.14.0 — the parity suite still gates byte-identical behavior, 48/48 green. Also the code-only plane-completion round: - wrangler.jsonc: canonical self-deploy config in-repo (no routes, no secrets), and the generated worker-configuration.d.ts committed with a CI freshness gate (npm run gen:types + git diff --exit-code); @cloudflare/workers-types superseded by the generated runtime types - ci.yml: build before vitest (package.test guards the packed tarball), generated-types check, and the wrangler dry-run smoke is strict (no more `|| true`) - test/package.test.ts: phantom-file guard (every files entry ships), shipped-.d.ts import-closure guard, manifest entry-point guard - package.json: ./package.json in exports - prettier: src/ml.ts, src/rest.ts, test/ml.test.ts (drift since WO15) - dist/: regenerated from current src (the committed tree had drifted) --- .github/workflows/ci.yml | 9 +- .gitignore | 1 + README.md | 13 +- dist/src/docs.js | 6 + dist/src/engine.js | 20 +- dist/src/generated/models.json | 538 +- dist/src/index.js | 36 +- dist/src/ml.d.ts | 39 + dist/src/ml.js | 99 + dist/src/openapi.d.ts | 81 + dist/src/openapi.js | 46 + dist/src/rest.d.ts | 3 +- dist/src/rest.js | 101 +- dist/src/scripts.d.ts | 10 + dist/src/scripts.js | 145 + dist/test/detect.test.d.ts | 1 + dist/test/detect.test.js | 62 + dist/test/ml.test.d.ts | 6 + dist/test/ml.test.js | 85 + dist/test/package.test.d.ts | 1 + dist/test/package.test.js | 63 + dist/test/rest.test.js | 70 + dist/test/server.test.js | 4 +- package-lock.json | 16 +- package.json | 7 +- src/ml.ts | 13 +- src/rest.ts | 3 +- test/ml.test.ts | 8 +- test/package.test.ts | 89 +- tsconfig.json | 8 +- worker-configuration.d.ts | 14822 +++++++++++++++++++++++++++++++ wrangler.jsonc | 34 + 32 files changed, 16341 insertions(+), 98 deletions(-) create mode 100644 dist/src/ml.d.ts create mode 100644 dist/src/ml.js create mode 100644 dist/src/scripts.d.ts create mode 100644 dist/src/scripts.js create mode 100644 dist/test/detect.test.d.ts create mode 100644 dist/test/detect.test.js create mode 100644 dist/test/ml.test.d.ts create mode 100644 dist/test/ml.test.js create mode 100644 dist/test/package.test.d.ts create mode 100644 dist/test/package.test.js create mode 100644 worker-configuration.d.ts create mode 100644 wrangler.jsonc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6c1ce7..a222880 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,14 @@ jobs: - uses: actions/setup-node@v7 with: { node-version: "22" } - run: npm install + - name: Generated Worker types are fresh (wrangler types) + run: | + npm run gen:types + git diff --exit-code worker-configuration.d.ts - run: npm run typecheck - run: npm run lint - run: npm run format:check + - run: npm run build - name: Tests + production parity gate run: npx vitest run build: @@ -26,5 +31,7 @@ jobs: with: { node-version: "22" } - run: npm install - run: npm run build + # Strict bundle smoke: validate wrangler.jsonc and the full worker + # bundle without credentials. A failure fails the job. - name: Bundle smoke (wrangler dry run, no credentials) - run: npx wrangler deploy --dry-run --outdir dist-worker || true + run: npx wrangler deploy --dry-run --outdir dist-worker diff --git a/.gitignore b/.gitignore index 667d2a0..89aa4a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ # dist ships committed: git-dependent installs cannot run prepare coverage/ .wrangler/ +dist-worker/ diff --git a/README.md b/README.md index 34dd78c..328c637 100644 --- a/README.md +++ b/README.md @@ -58,18 +58,23 @@ Minimal `wrangler.jsonc`: } ``` -with `src/index.ts` re-exporting the package, then `wrangler deploy`. +A canonical `wrangler.jsonc` ships in this repository (no routes, no +secrets) — start from it, add your route, then `wrangler deploy`. If you +edit the config, regenerate the ambient runtime types with +`npm run gen:types` (writes `worker-configuration.d.ts`). See the [deployment repo](https://github.com/interscript/api.interscript.org) -for a complete, working example. +for a complete, working example (it pins this package and fetches a +release map artifact — the deploy commands there stay owner-run). ## Development ```bash npm install -npm run build # tsc -npm test # vitest +npm run build # tsc + esbuild bundle +npm test # vitest (incl. the production parity gate) npm run typecheck npm run lint +npm run gen:types # regenerate worker-configuration.d.ts after wrangler.jsonc edits ``` Regenerating the map corpus (requires the interscript/maps and diff --git a/dist/src/docs.js b/dist/src/docs.js index 5b673ec..952770c 100644 --- a/dist/src/docs.js +++ b/dist/src/docs.js @@ -13,6 +13,12 @@ const ENDPOINTS = [ { method: "GET", path: "/v1/models", note: "neural model index (IMF v1)" }, { method: "GET", path: "/v1/models/{id}", note: "one model's metadata" }, { method: "POST", path: "/v1/infer", note: "{model, input} → {output}" }, + { method: "POST", path: "/v1/infer/batch", note: "{model, inputs[]} → per-item results (≤50)" }, + { + method: "GET", + path: "/v1/assets/{tag}/{file}", + note: "CORS streaming proxy for release assets", + }, { method: "POST", path: "/graphql", note: "GraphQL endpoint (introspection enabled)" }, { method: "GET", path: "/openapi.json", note: "OpenAPI 3.1 document" }, ]; diff --git a/dist/src/engine.js b/dist/src/engine.js index 6138cd1..e00095a 100644 --- a/dist/src/engine.js +++ b/dist/src/engine.js @@ -4,6 +4,8 @@ */ import { configure, transliterateAsync } from "interscript"; import { bundledSystemCodes, detectableSystemCodes, loadMap } from "./maps.js"; +import { mapScripts } from "../maps/scripts.js"; +import { detectInputScript, sourceMatchesScript } from "./scripts.js"; let configuredFor; function ensureEngine(assets) { if (configuredFor === assets) @@ -33,14 +35,22 @@ function levenshtein(a, b) { } return prev[b.length]; } -// Mirrors interscript-ruby's detector: transliterate the input through -// every system, rank by Levenshtein distance to the output. Systems -// that fail (including ML-powered maps with no runtime configured) are -// skipped, exactly as the Ruby detector rescues per-map errors. +// Transliterate the input through every system whose source script +// matches the input, rank by Levenshtein distance to the output. +// Systems that fail (including ML-powered maps with no runtime +// configured) are skipped, exactly as the Ruby detector rescues +// per-map errors. The full-corpus walk is gone deliberately: it +// exceeded the Workers CPU budget (1102s in production). export async function detect(assets, input, output) { ensureEngine(assets); + // Only systems whose source script matches the input can rank: walking + // all 288 maps exhausts the Workers CPU budget (1102s in production). + const detected = detectInputScript(input); + const codes = detected + ? detectableSystemCodes().filter((code) => sourceMatchesScript(mapScripts[code], detected)) + : []; const candidates = []; - for (const code of detectableSystemCodes()) { + for (const code of codes) { try { const transliterated = await transliterateAsync(code, input); candidates.push({ mapName: code, distance: levenshtein(transliterated, output) }); diff --git a/dist/src/generated/models.json b/dist/src/generated/models.json index 238a2d0..000ddbc 100644 --- a/dist/src/generated/models.json +++ b/dist/src/generated/models.json @@ -3,11 +3,12 @@ "models": [ { "id": "khm-latn-1.0", + "kind": null, "task": "translit", "scripts": ["Khmr", "Latn"], "precision": "fp32", "filename": "khm-latn-1.0-fp32.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/khm-latn-1.0/khm-latn-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/khm-latn-1.0/khm-latn-1.0-fp32.zip", "parts": null, "sha256": "55993d473a2ed9489058779cad7e115db05e4020085b71616468cfae4f2f65cb", "size": 1418009977, @@ -31,11 +32,12 @@ }, { "id": "urd-g2p-1.0", + "kind": null, "task": "g2p", "scripts": ["Arab", "IPA"], "precision": "fp32", "filename": "urd-g2p-1.0-fp32.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/urd-g2p-1.0/urd-g2p-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/urd-g2p-1.0/urd-g2p-1.0-fp32.zip", "parts": null, "sha256": "9f0a248c7116aa7f6b9ac125fb9684a3556f3b8ce8b64567c05a5e7e7a018ebf", "size": 1418039605, @@ -59,11 +61,12 @@ }, { "id": "urd-diac-1.0", + "kind": null, "task": "diacritization", "scripts": ["Arab", "Arab"], "precision": "fp32", "filename": "urd-diac-1.0-fp32.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/urd-diac-1.0/urd-diac-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/urd-diac-1.0/urd-diac-1.0-fp32.zip", "parts": null, "sha256": "c299ea44a4da4851a52283f8e42d2fb6f8c7a9c443ba7eb0270f97372e10b8ea", "size": 1417851421, @@ -82,6 +85,7 @@ }, { "id": "heb-diac-1.0", + "kind": null, "task": "diacritization", "scripts": ["Hebr", "Hebr"], "precision": "fp32", @@ -89,12 +93,12 @@ "url": null, "parts": [ { - "url": "https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-00", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-00", "sha256": "5497f70cc3c96829e65f1eb0cc401c2d1ffeb4fa909acd4def824c2e019cbc37", "size": 1500000000 }, { - "url": "https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-01", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-01", "sha256": "a7d2011ab4f9326a86e234cc49cb50daf82949e51efbf03a21d5796c46465e9d", "size": 1281139753 } @@ -121,6 +125,7 @@ }, { "id": "tha-g2p-base-1.0", + "kind": null, "task": "g2p", "scripts": ["Thai", "IPA"], "precision": "fp32", @@ -128,12 +133,12 @@ "url": null, "parts": [ { - "url": "https://github.com/interscript/interscript-ml/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-00", + "url": "https://github.com/interscript/interscript-models/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-00", "sha256": "c4525414e5dec91a54d055ca9f1acd51c198f81fbfc55977aa82c1fb038d58d7", "size": 1500000000 }, { - "url": "https://github.com/interscript/interscript-ml/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-01", + "url": "https://github.com/interscript/interscript-models/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-01", "sha256": "f5d11fbd75f92e8b5471add867418e2dd4f49a5e258b9ded2f3b5ffa630abe24", "size": 1281174343 } @@ -144,12 +149,12 @@ { "name": "per_teacher", "value": 1.25, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-base-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-base-1.0" }, { "name": "per_student", "value": 3.53, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-base-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-base-1.0" } ], "parity": { @@ -160,11 +165,12 @@ }, { "id": "tha-g2p-small-1.0", + "kind": null, "task": "g2p", "scripts": ["Thai", "IPA"], "precision": "int8", "filename": "tha-g2p-small-1.0-int8.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int8.zip", "parts": null, "sha256": "f2cfa93a42d98aabf08fdc82dfc6bd1574e21993f36558aa581fbe29e0588a94", "size": 257468517, @@ -172,17 +178,17 @@ { "name": "per_teacher", "value": 4.43, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" }, { "name": "per_student_beam4", "value": 12.06, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" }, { "name": "per_student", "value": 2.85, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" } ], "parity": { @@ -193,11 +199,12 @@ }, { "id": "tha-g2p-small-1.0-int4", + "kind": null, "task": "g2p", "scripts": ["Thai", "IPA"], "precision": "int4", "filename": "tha-g2p-small-1.0-int4.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int4.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int4.zip", "parts": null, "sha256": "e5d12a3d65c6ac39fa08f52c975c99ff7a51c3e7b7aca7fbb461d2de2345e4cb", "size": 201958073, @@ -205,17 +212,17 @@ { "name": "per_teacher", "value": 4.43, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" }, { "name": "per_student_beam4", "value": 12.06, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" }, { "name": "per_student", "value": 2.85, - "source": "interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0" } ], "parity": { @@ -226,11 +233,12 @@ }, { "id": "heb-diac-small-1.0", + "kind": null, "task": "diacritization", "scripts": ["Hebr", "Hebr"], "precision": "fp32", "filename": "heb-diac-small-1.0-fp32.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/heb-diac-small-1.0/heb-diac-small-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-small-1.0/heb-diac-small-1.0-fp32.zip", "parts": null, "sha256": "905c53873d5a62bbe6252c6ec0ecef5f37e96e78cb01e8cd99b6b24c4d4d74ad", "size": 1418663344, @@ -238,12 +246,12 @@ { "name": "der_teacher_greedy", "value": 24.79, - "source": "interscript/interscript-ml docs/RESULTS.md#heb-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#heb-diac-small-1.0" }, { "name": "der_student_greedy", "value": 30.37, - "source": "interscript/interscript-ml docs/RESULTS.md#heb-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#heb-diac-small-1.0" } ], "parity": { @@ -254,6 +262,7 @@ }, { "id": "fas-g2p-1.0", + "kind": null, "task": "g2p", "scripts": ["Arab", "Latn"], "precision": "fp32", @@ -261,12 +270,12 @@ "url": null, "parts": [ { - "url": "https://github.com/interscript/interscript-ml/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-00", + "url": "https://github.com/interscript/interscript-models/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-00", "sha256": "6c475e53f3c7ef3edcef5a24d2d81f51d13ddf4c417de98440943c9a32b03e55", "size": 1500000000 }, { - "url": "https://github.com/interscript/interscript-ml/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-01", + "url": "https://github.com/interscript/interscript-models/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-01", "sha256": "c5656c649412f41e201c567e002514d31390b636d4650d9dcb6dfed1973fb3d5", "size": 1280254270 } @@ -277,12 +286,12 @@ { "name": "cer", "value": 1.6, - "source": "interscript/interscript-ml docs/RESULTS.md#fas-g2p-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#fas-g2p-1.0" }, { "name": "sb_homograph_ezafe_norm", "value": 77.34, - "source": "interscript/interscript-ml docs/RESULTS.md#fas-g2p-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#fas-g2p-1.0" } ], "parity": { @@ -293,11 +302,12 @@ }, { "id": "ara-diac-small-1.0", + "kind": null, "task": "diacritization", "scripts": ["Arab", "Arab"], "precision": "fp32", "filename": "ara-diac-small-1.0-fp32.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-fp32.zip", "parts": null, "sha256": "8b149beb04294a2e482af876a34ae0fca3e87412606116fae1a376845fd4111a", "size": 1418126835, @@ -305,22 +315,22 @@ { "name": "der_teacher_greedy", "value": 1.3205, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_student_greedy", "value": 3.658, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_teacher_fullset", "value": 2.5815, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_student_fullset", "value": 8.259, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" } ], "parity": { @@ -331,6 +341,7 @@ }, { "id": "heb-diac-1.1", + "kind": null, "task": "diacritization", "scripts": ["Hebr", "Hebr"], "precision": "fp32", @@ -338,12 +349,12 @@ "url": null, "parts": [ { - "url": "https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.1/heb.zip.part-00", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-1.1/heb.zip.part-00", "sha256": "8dac0d62e9b0ac4b137412eaf3a542953f11575f12f66f76cb93d3f5d788fc1b", "size": 1500000000 }, { - "url": "https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.1/heb.zip.part-01", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-1.1/heb.zip.part-01", "sha256": "230c5ab731ea5f001f802d60b9e9a328c10b43bc311a19ef1974f114384313ed", "size": 1280987905 } @@ -370,6 +381,7 @@ }, { "id": "ara-diac-1.0", + "kind": null, "task": "diacritization", "scripts": ["Arab", "Arab"], "precision": "fp32", @@ -377,12 +389,12 @@ "url": null, "parts": [ { - "url": "https://github.com/interscript/interscript-ml/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-00", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-00", "sha256": "6282a9291fb45ac7fcc3abe79d33b5913e91f87dcff8b305bf1d57ed98a3ed0b", "size": 1500000000 }, { - "url": "https://github.com/interscript/interscript-ml/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-01", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-01", "sha256": "7e7254a89ec75493871f6f61a993315097dad1bb0ba63c4584453c309e8cb906", "size": 1280311342 } @@ -409,11 +421,12 @@ }, { "id": "ara-diac-small-1.0-int8", + "kind": null, "task": "diacritization", "scripts": ["Arab", "Arab"], "precision": "int8", "filename": "ara-diac-small-1.0-int8.zip", - "url": "https://github.com/interscript/interscript-ml/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-int8.zip", "parts": null, "sha256": "af247d837bee7e755b5287102cfb715c48dc90c2cf41ec1c41e7238e1a72b678", "size": 256959713, @@ -421,22 +434,22 @@ { "name": "der_teacher_greedy", "value": 1.3205, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_student_greedy", "value": 3.658, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_teacher_fullset", "value": 2.5815, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" }, { "name": "der_student_fullset", "value": 8.259, - "source": "interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0" + "source": "interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0" } ], "parity": { @@ -444,6 +457,455 @@ "cer_delta": 0 }, "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-small-2.0", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "fp32", + "filename": "ara-diac-small-2.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.0/ara-diac-small-2.0-fp32.zip", + "parts": null, + "sha256": "d9aa95d0e8fd0d7da80fd2f7dabedf0ac65f55ba984de565d252f5e14906d98c", + "size": 1418516306, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 5.0821, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 600, + "cer_delta": 0.1187 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-small-2.0-int8", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-small-2.0-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.0/ara-diac-small-2.0-int8.zip", + "parts": null, + "sha256": "f4d07acdaf9c18cded97e15e0c5636e6cee90de2fa32c5a373a44c0cc912bf50", + "size": 264043016, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 4.8218, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 600, + "cer_delta": 0.1393 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-2.0", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "fp32", + "filename": "ara-diac-2.0-fp32.zip", + "url": null, + "parts": [ + { + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-fp32.zip.part-00", + "sha256": "28c272b5ce58031c356e75823eb581f12351a1675a52d8e4000f851c80d5e14d", + "size": 1500000000 + }, + { + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-fp32.zip.part-01", + "sha256": "86016da35e14a8fc05d4fbf3b1ad9ef24c29f9f7893f1716e40bef4b491effa2", + "size": 1280299051 + } + ], + "sha256": "872c655ec6750bf44e5986f958de26767eafa13f8e0a7c64340bc35fd8a4550e", + "size": 2780299051, + "metrics": [ + { + "name": "der_total_greedy", + "value": 2.2864, + "source": "rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28" + }, + { + "name": "der_morph_greedy", + "value": 1.3343, + "source": "rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28" + }, + { + "name": "wer_wikinews_multiref", + "value": 17.3794, + "source": "rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28" + }, + { + "name": "der_wikinews_multiref", + "value": 11.8273, + "source": "rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28" + } + ], + "parity": { + "samples": 600, + "cer_delta": 0.0903 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-2.0-int8", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-2.0-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-int8.zip", + "parts": null, + "sha256": "7f1d55d43f97564ad62fc14a7e0cabe52c01d8298b747677a75900de748bb6c6", + "size": 519207340, + "metrics": [ + { + "name": "der_total_greedy", + "value": 2.2864, + "source": "rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28" + }, + { + "name": "der_morph_greedy", + "value": 1.3343, + "source": "rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28" + }, + { + "name": "wer_wikinews_multiref", + "value": 17.3794, + "source": "rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28" + }, + { + "name": "der_wikinews_multiref", + "value": 11.8273, + "source": "rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28" + } + ], + "parity": { + "samples": 600, + "cer_delta": 0.0947 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-small-2.1", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "fp32", + "filename": "ara-diac-small-2.1-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-fp32.zip", + "parts": null, + "sha256": "a69918de9f87664fd97cdab3bf68b655966f608211dbeadd7b6fb3f7b03e5ffb", + "size": 1419756840, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 4.5701, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0714 + }, + "license": null + }, + { + "id": "ara-diac-small-2.1-int8", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-small-2.1-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-int8.zip", + "parts": null, + "sha256": "9b4e4aad2ab53a8cfbec432a78e27b409376627243aec3fd043f06574552a32b", + "size": 267965657, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 4.5701, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0857 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-layerdrop-1.0", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "fp32", + "filename": "ara-diac-layerdrop-1.0-fp32.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-fp32.zip", + "parts": null, + "sha256": "8f297bdc0e7eba5160c6ed8a2a437abbd399687fd14f2f2b640a4b4c639a3d16", + "size": 1015218371, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.2921, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + }, + { + "name": "der_student_fullset", + "value": 5.784, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0632 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-layerdrop-1.0-int8", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-layerdrop-1.0-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-int8.zip", + "parts": null, + "sha256": "68dcc06cd8861e017c4d4912ce3e1fe057d78b79b0a7b6246ae8603c99930963", + "size": 191603048, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.2921, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + }, + { + "name": "der_student_fullset", + "value": 5.784, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0538 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-layerdrop-1.0-int4", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int4", + "filename": "ara-diac-layerdrop-1.0-int4.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-int4.zip", + "parts": null, + "sha256": "352e02105645a6e283e2c3602505bea0e90085b741666fd863e478e4835e7bc9", + "size": 145195702, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.2921, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + }, + { + "name": "der_student_fullset", + "value": 5.784, + "source": "interscript/interscript-models docs/RESULTS.md#layerdrop-6ep" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0589 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-small-2.1-fp16", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "fp16", + "filename": "ara-diac-small-2.1-fp16.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-fp16.zip", + "parts": null, + "sha256": "395ee72137d1cdfa9cd53bf167ad0d2f5fe5cbf9a5b62f118e0c9e0fa63c972d", + "size": 706351903, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 4.5701, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.0714 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-small-int8static-2.1", + "kind": null, + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-small-int8static-2.1-int8.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-small-int8static-2.1/ara-diac-small-int8static-2.1-int8.zip", + "parts": null, + "sha256": "7836bfd5582ad054ee419bfbd45a2b4a87fe8dc91e1f849898428faefd0c95da", + "size": 515362212, + "metrics": [ + { + "name": "der_teacher_fullset", + "value": 2.289, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + }, + { + "name": "der_student_fullset", + "value": 4.5701, + "source": "interscript/interscript-models docs/RESULTS.md#run-006-r7-muon" + } + ], + "parity": { + "samples": 2480, + "cer_delta": 0.1038 + }, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-plane-1.0", + "kind": "plane", + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-plane-1.0.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-plane-1.0/ara-diac-plane-1.0.zip", + "parts": null, + "sha256": "1310204e36acc4fcbb988e9f9c46cf6422e7ea3860bd467fb469ea0ad4d39ef3", + "size": 219076965, + "metrics": [ + { + "name": "der_total_greedy", + "value": 3.5905, + "source": "interscript/interscript-models docs/RESULTS.md#run-018-plane-v2" + }, + { + "name": "der_morph_greedy", + "value": 2.2149, + "source": "interscript/interscript-models docs/RESULTS.md#run-018-plane-v2" + } + ], + "parity": null, + "license": "BSD-3-Clause" + }, + { + "id": "ara-diac-plane-large-1.0", + "kind": "plane", + "task": "diacritization", + "scripts": ["Arab", "Arab"], + "precision": "int8", + "filename": "ara-diac-plane-large-1.0.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/ara-diac-plane-large-1.0/ara-diac-plane-large-1.0.zip", + "parts": null, + "sha256": "a66df2e12ddc935e8ab59836fd45486f17ac40b764c1619c03b2b0e191608a52", + "size": 866052488, + "metrics": [ + { + "name": "der_total_greedy", + "value": 2.7397, + "source": "interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05" + }, + { + "name": "der_morph_greedy", + "value": 1.6717, + "source": "interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05" + }, + { + "name": "wer_total_greedy", + "value": 8.6083, + "source": "interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05" + } + ], + "parity": null, + "license": "BSD-3-Clause" + }, + { + "id": "heb-diac-plane-1.0", + "kind": "plane", + "task": "diacritization", + "scripts": ["Hebr", "Hebr"], + "precision": "int8", + "filename": "heb-diac-plane-1.0.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-plane-1.0/heb-diac-plane-1.0.zip", + "parts": null, + "sha256": "dd9ae811c60c38f28ead57bdefa022b281867401ee13e38563b990eaf7f81f95", + "size": 219322007, + "metrics": [ + { + "name": "der_total_greedy", + "value": 12.48, + "source": "interscript/interscript-models docs/RESULTS.md#run-021-heb-plane--1248-nakdimon-der-the-plane-family-generalizes-seq2seq-student-beaten-at-396pp-2026-10-07" + } + ], + "parity": null, + "license": "BSD-3-Clause" + }, + { + "id": "heb-diac-plane-2.0", + "kind": "plane", + "task": "diacritization", + "scripts": ["Hebr", "Hebr"], + "precision": "int8", + "filename": "heb-diac-plane-2.0.zip", + "url": "https://github.com/interscript/interscript-models/releases/download/heb-diac-plane-2.0/heb-diac-plane-2.0.zip", + "parts": null, + "sha256": "9c8f0432294ebae6abc847ddb79572c1ab979f4851f03d44a9bb6495ba767a9e", + "size": 415901226, + "metrics": [ + { + "name": "der_total_greedy", + "value": 8.18, + "source": "interscript/interscript-models docs/RESULTS.md#run-022-heb-plane-base--818-der-at-the-artifact-level-gate-cleared-hebrew--430pp-2026-10-07" + } + ], + "parity": null, + "license": "BSD-3-Clause" } ] } diff --git a/dist/src/index.js b/dist/src/index.js index aa36770..2df5922 100644 --- a/dist/src/index.js +++ b/dist/src/index.js @@ -1,7 +1,24 @@ -var hn=Object.defineProperty;var d=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var B=(e,t)=>{for(var n in t)hn(e,n,{get:t[n],enumerable:!0})};var ut={};B(ut,{createLitertSession:()=>Sn});async function wn(){return ee||(ee=(async()=>{try{return await import("@litertjs/core")}catch(e){throw ee=void 0,new Error("@litertjs/core is required for LiteRT inference. Install with: npm install @litertjs/core",{cause:e})}})()),ee}async function Sn(e,t={}){let n=t.accelerator??"webgpu",r=t.wasmPath??Ln,a=t.inputNames??["src","lengths"],s=t.outputNames??["output"],o=await wn();await o.loadLiteRt(r,{jspi:n==="webnn"});let c=new Blob([new Uint8Array(e)],{type:"application/octet-stream"}),i=URL.createObjectURL(c),l;return l=await o.loadAndCompile(i,{accelerator:n}),new Se(l,o,a,s,i)}function vn(e){return e instanceof Float32Array?"float32":e instanceof Int32Array?"int32":e instanceof BigInt64Array?"int64":e instanceof Uint8Array?"uint8":"float32"}var Ln,ee,Se,mt=d(()=>{Ln="https://cdn.jsdelivr.net/npm/@litertjs/core@2.5.2/wasm/";Se=class{inputNames;outputNames;model;core;blobUrl;disposed=!1;constructor(t,n,r,a,s){this.model=t,this.core=n,this.inputNames=r,this.outputNames=a,this.blobUrl=s}async run(t){if(this.disposed)throw new Error("Session disposed");let n=[];for(let s of this.inputNames){let o=t[s];if(!o)throw new Error(`Missing LiteRT input: ${s}`);n.push(new this.core.Tensor(o.data,o.dims))}let r=await this.model.run(n.length===1?n[0]:n),a={};try{for(let s=0;skn});async function An(){try{return await import("onnxruntime-node")}catch(e){throw new Error("onnxruntime-node is required for ML inference in Node. Install with: npm install onnxruntime-node",{cause:e})}}async function kn(e){return ve.create(e)}var ve,ht=d(()=>{ve=class e{session;ort;inputNames;outputNames;inputMetadata;constructor(t,n){this.session=t,this.ort=n,this.inputNames=t.inputNames,this.outputNames=t.outputNames;let r=t.inputMetadata;Array.isArray(r)&&(this.inputMetadata=r)}static async create(t){let n=await An(),r=await n.InferenceSession.create(t);return new e(r,n)}async run(t){let n={};for(let[s,o]of Object.entries(t))n[s]=new this.ort.Tensor(o.type,o.data,o.dims);let r=await this.session.run(n),a={};for(let[s,o]of Object.entries(r)){let c=o;a[s]={name:s,type:c.type,data:c.data,dims:c.dims}}return a}async dispose(){await this.session.release()}}});var gt={};B(gt,{createWebSession:()=>xn});async function _n(){return te||(te=(async()=>{try{let e=await import("onnxruntime-web");return e.env.wasm.simd=!0,e}catch(e){throw te=void 0,new Error("onnxruntime-web is required for ML inference in the browser. Install with: npm install onnxruntime-web",{cause:e})}})()),te}async function xn(e,t={}){return Ae.create(e,t)}var te,Ae,bt=d(()=>{Ae=class e{session;ort;inputNames;outputNames;constructor(t,n){this.session=t,this.ort=n,this.inputNames=t.inputNames,this.outputNames=t.outputNames}static async create(t,n={}){let r=await _n(),a=n.webgpu===!1?["wasm"]:["webgpu","wasm"],s=await r.InferenceSession.create(t,{executionProviders:a});return new e(s,r)}async run(t){let n={};for(let[s,o]of Object.entries(t))n[s]=new this.ort.Tensor(o.type,o.data,o.dims);let r=await this.session.run(n),a={};for(let[s,o]of Object.entries(r)){let c=o;a[s]={name:s,type:c.type,data:c.data,dims:c.dims}}return a}async dispose(){await this.session.release()}}});function ke(){let e=globalThis;return e.process?.versions?.node?"node":e.self!==void 0?"web":"unknown"}async function R(e,t={}){if((t.runtime??"onnx")==="litert"){let s={};return t.litertAccelerator!==void 0&&(s.accelerator=t.litertAccelerator),t.inputNames!==void 0&&(s.inputNames=t.inputNames),t.outputNames!==void 0&&(s.outputNames=t.outputNames),(await Promise.resolve().then(()=>(mt(),ut))).createLitertSession(e,s)}if((t.backend??ke()==="node"?"node":"web")==="node")return(await Promise.resolve().then(()=>(ht(),ft))).createNodeSession(e);let a=t.webgpu===void 0?{}:{webgpu:t.webgpu};return(await Promise.resolve().then(()=>(bt(),gt))).createWebSession(e,a)}var ne=d(()=>{});var Tn,En,yt,Lt,jr,wt,$r,Mn,St,Cn,_e,vt,xe,re,N=d(()=>{Tn=["\u0652","\u0651","\u064C","\u064D","\u0650","\u064B","\u064E","\u064F"],En="\u0649\u0639\u0638\u062D\u0631\u0633\u064A\u0634\u0636\u0642 \u062B\u0644\u0635\u0637\u0643\u0622\u0645\u0627\u0625\u0647\u0632\u0621\u0623\u0641\u0624\u063A\u062C\u0626\u062F\u0629\u062E\u0648\u0628\u0630\u062A\u0646",yt="\u0649\u0639\u0638\u062D\u0631\u0633\u064A\u0634\u0636\u0642\u062B\u0644\u0635\u0637\u0643\u0622\u0645\u0627\u0625\u0647\u0632\u0621\u0623\u0641\u0624\u063A\u062C\u0626\u062F\u0629\u062E\u0648\u0628\u0630\u062A\u0646",Lt=[...Tn,...En],jr=Object.freeze({"\u064E":"Fatha","\u064B":"Fathatah","\u064F":"Damma","\u064C":"Dammatan","\u0650":"Kasra","\u064D":"Kasratan","\u0652":"Sukun","\u0651":"Shaddah"}),wt=Object.freeze({"":"No Diacritic","\u064E":"Fatha","\u064B":"Fathatah","\u064F":"Damma","\u064C":"Dammatan","\u0650":"Kasra","\u064D":"Kasratan","\u0652":"Sukun","\u0651":"Shaddah","\u0651\u064E":"Shaddah + Fatha","\u0651\u064B":"Shaddah + Fathatah","\u0651\u064F":"Shaddah + Damma","\u0651\u064C":"Shaddah + Dammatan","\u0651\u0650":"Shaddah + Kasra","\u0651\u064D":"Shaddah + Kasratan"}),$r=Object.freeze(Object.fromEntries(Object.keys(wt).map((e,t)=>[e,t]))),Mn="P",St=[Mn,...Object.keys(wt),""],Cn="\u0628\u0636.\u063A\u0649\u0647\u0638\u062E\u0629\u061F:\u0637\u0633\u060C\u061B\u0641\u0646\u062F\u0624\u0644\u0648\u0626\u0622\u0643-\u064A\u0630\u0627\u0635\u0634\u062D\u0632\u0621\u0645\u0623\u062C\u0625 \u062A\u0631\u0642\u0639\u062B",_e="P",vt=[_e,...Cn],xe=Object.freeze(Object.fromEntries(vt.map((e,t)=>[e,t]))),re=vt});function At(e){return e.replace(/\s+/g," ")}function ae(e){return At(e).trim()}function Te(e){return ae(Array.from(e).filter(t=>In.has(t)).join(""))}var In,Ee=d(()=>{N();In=new Set(Lt)});var q,Me=d(()=>{N();Ee();q=class{inputSymbolToId=xe;inputIdToSymbol=re;inputPadId;startSymbolId;cleanerType;reverse;constructor(t={}){this.cleanerType=t.cleaner??"arabic",this.reverse=t.reverseInput??!1,this.inputPadId=xe[_e],this.startSymbolId=t.startSymbol?0:null}clean(t){return this.cleanerType==="arabic"?Te(t):ae(t)}removeDiacritics(t){return Array.from(t).filter(n=>!(!(n in this.inputSymbolToId)&&/[ً-ْ]/.test(n))).join("")}inputToSequence(t){let n=this.reverse?Array.from(t).reverse():Array.from(t),r=[];for(let a of n){let s=this.inputSymbolToId[a];s!==void 0&&r.push(s)}return r}}});function On(e,t){let n=[],r=0;for(let a=0;a!Rn.has(i)),r=Array.from(t),a=On(n,r),s="",o=0,c=0;for(let{idxDia:i,idxOri:l}of a){if(c{N();Rn=new Set(["\u0652","\u0651","\u064C","\u064D","\u0650","\u064B","\u064E","\u064F"]),Nn=new Set(yt)});function zn(e,t){let n=e.dims,r=n[n.length-1],a=[],s=e.data;for(let o=0;oi&&(i=u,c=p)}a.push(c)}return a}function jn(e,t,n){let r="";for(let a=0;a{Me();Ie();N();O={maxLen:200,batchSize:1,textEncoder:"ArabicEncoderWithStartSymbol",textCleaner:"valid_arabic_cleaners"},Re=class{kind="rababa";session;encoder;config;constructor(t,n){this.session=t,this.config=n,this.encoder=new q({cleaner:n.textCleaner==="valid_arabic_cleaners"?"arabic":"basic",startSymbol:n.textEncoder==="ArabicEncoderWithStartSymbol"})}async diacritize(t){let n=t;n.length>this.config.maxLen&&(n=n.slice(0,this.config.maxLen));let r=this.encoder.clean(n),a=this.stripDiacritics(r),s=this.encoder.inputToSequence(a);if(s.length===0)return n;let o=this.config.batchSize,c=this.config.maxLen,i=this.encoder.inputPadId,l=[];for(let k=0;kBigInt(k))),dims:[o,c]},u={name:"lengths",type:"int64",data:new BigInt64Array(Array(o).fill(BigInt(c))),dims:[o]},y=(await this.session.run({src:p,lengths:u}))[this.session.outputNames[0]];if(!y)throw new Error("Rababa model produced no output");let x=zn(y,s.length),v=jn(s,x,this.encoder.inputPadId);return Ce(r,v)}async transform(t){return this.diacritize(t)}stripDiacritics(t){return Array.from(t).filter(n=>!/[ً-ْ]/.test(n)).join("")}async dispose(){await this.session.dispose()}}});var _t={};B(_t,{rababa:()=>Gn,rababaReverse:()=>Hn,resetRababaConfigs:()=>Bn,setRababaConfig:()=>Dn});function Dn(e,t){ze.set(e,t)}function Bn(){ze=new Map(Object.entries(kt))}function Pn(e){let t=ze.get(e);if(!t)throw new Error(`No rababa config registered under '${e}'. Register one via setRababaConfig() before invoking rababa.`);return t}function Un(e){return{maxLen:Number(e.max_len??e.maxLen??200),batchSize:Number(e.batch_size??e.batchSize??32),textEncoder:e.text_encoder??"ArabicEncoderWithStartSymbol",textCleaner:e.text_cleaner??"valid_arabic_cleaners"}}async function Fn(e){let t=Oe.get(e);if(!t){let n=Pn(e);t=(async()=>{let r=await qn(n.model),a=await R(r),s=Un(n.config);return se({session:a,artifacts:{},config:s})})(),Oe.set(e,t),t.catch(()=>Oe.delete(e))}return t}async function qn(e){if(e.startsWith("file:")||e.startsWith(".")){let{readFile:n}=await import("node:fs/promises"),r=e.startsWith("file:")?e.slice(5):e;return new Uint8Array(await n(r))}let t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ${e}: ${t.status}`);return new Uint8Array(await t.arrayBuffer())}async function Gn(e,t={}){let n=t.config??"200";return(await Fn(n)).diacritize(e)}function Hn(e){return e.replace(/[ًٌٍَُِّْ]/g,"")}var kt,ze,Oe,xt=d(()=>{ne();Ne();kt=Object.freeze({200:Object.freeze({model:"https://github.com/secryst/rababa-models/releases/download/0.1/diacritization_model_arabic.onnx",config:Object.freeze({session_name:"base",text_encoder:"ArabicEncoderWithStartSymbol",text_cleaner:"valid_arabic_cleaners",max_len:200,batch_size:32})})}),ze=new Map(Object.entries(kt));Oe=new Map});function Et(e){Tt=e.replace(/\/$/,"")}function oe(){return Tt}var Tt,je=d(()=>{Tt="https://cdn.jsdelivr.net/gh/interscript/ml-models@main/npm/models"});function Ct(e){$e=e,E=null}function It(e){Mt=e,E=null}function Wn(){return`${oe()}/npm/models/manifest.json`}async function De(){if(E)return E;if($e)return E=$e,E;let e=Mt??Wn(),t=await fetch(e);if(!t.ok)throw new Error(`Failed to load model manifest from ${e}: ${t.status} ${t.statusText}`);let n=await t.json();return E=n,n}async function G(e,t){let n=await De(),r=t.startsWith(`${e}_`)?t:`${e}_${t}`;return n.models[r]??n.models[t]??null}function H(e,t="q8",n="onnx"){let r=Rt(e,t,n),a=e.cdn_base.replace("{version}",e.version),s=e.github_base.replace("{version}",e.version);return{primary:`${a}${r}`,fallback:`${s}${r}`,assetName:r}}function ie(e,t="q8",n="onnx"){return[`${Rt(e,t,n)}.sha256`,"vocab.json","config.json"]}function Rt(e,t,n="onnx"){return`${Qn(e)}${Vn[t]}${Kn[n]}`}function Qn(e){let t=e.github_base.split("/").filter(Boolean).pop()??"",n="-v{version}";if(t.endsWith(n))return t.slice(0,-n.length);throw new Error(`Cannot extract task name from manifest entry. github_base=${e.github_base}`)}var Vn,Kn,E,$e,Mt,Be=d(()=>{je();Vn={fp32:"",q8:"-q8",q4:"-q4",fp16:"-fp16"},Kn={onnx:".onnx",tflite:".tflite"},E=null,$e=null,Mt=null});async function Ot(e,t={}){let n=t.variant??"q8",r=t.format??"onnx",a=t.webgpu??!0,s=e.url??await Jn(e,n,r),o=await Nt(s),c=await Yn(e,n,r),i={};await Promise.all(c.map(async({filename:u,url:S})=>{try{let y=await Nt(S);u.endsWith(".json")||u.endsWith(".yaml")||u.endsWith(".yml")||u.endsWith(".sha256")?i[u]=new TextDecoder().decode(y):i[u]=y}catch{}}));let l={webgpu:a};return r==="tflite"&&(l.runtime="litert",t.litertAccelerator!==void 0&&(l.litertAccelerator=t.litertAccelerator),t.inputNames!==void 0&&(l.inputNames=t.inputNames),t.outputNames!==void 0&&(l.outputNames=t.outputNames)),{session:await R(o,l),artifacts:i}}async function Jn(e,t,n){let r=await G(e.kind,e.id);if(!r)throw new Error(`No manifest entry for kind=${e.kind} id=${e.id}. Pass an explicit \`url\` on the ModelRef or pin a task version in the manifest.`);let{primary:a}=H(r,t,n);return a}async function Yn(e,t,n){if(e.url)return[];let r=await G(e.kind,e.id);if(!r)return[];let{primary:a,assetName:s}=H(r,t,n),o=a.slice(0,a.lastIndexOf("/")+1);return ie(r,t,n).map(c=>({filename:c,url:`${o}${c.startsWith(s),c}`}))}async function Nt(e){if(e.startsWith("file:")||e.startsWith(".")&&typeof process<"u"&&process.versions?.node){let{readFile:n}=await import("node:fs/promises"),r=e.startsWith("file:")?e.slice(5):e;return new Uint8Array(await n(r))}let t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}var zt=d(()=>{ne();Be()});function z(e,t){if(ce.has(e))throw new Error(`Model kind "${e}" is already registered`);ce.set(e,t)}function Xn(e){return`${e.kind}/${e.id}/${e.url??"_default"}`}async function jt(e){let t=Xn(e),n=V.get(t);if(n)return n;let r=ce.get(e.kind);if(!r)throw new Error(`Unknown model kind: "${e.kind}". Register a factory via registerModel("${e.kind}", factory).`);let a=(async()=>{let{session:s,artifacts:o}=await Ot(e);return r({session:s,artifacts:o})})();return V.set(t,a),a.catch(()=>V.delete(t)),a}function $t(){return[...ce.keys()]}async function Dt(){let e=[...V.values()];V.clear(),await Promise.allSettled(e.map(async t=>{try{await(await t).dispose()}catch{}}))}var ce,V,le=d(()=>{zt();ce=new Map;V=new Map});var Bt=d(()=>{le();Ne();Me();Ie();Ee();N();z("rababa",async e=>se(e))});function Pe(e){let t=e.split(` -`),n=null,r=[],a=[];for(let s of t){let o=s.trimEnd();if(o==="input:"){n="input";continue}if(o==="target:"){n="target";continue}let c=o.match(/^\s+-\s+"?(.+?)"?\s*$/);if(c&&n){let i=c[1];n==="input"?r.push(i):a.push(i)}}return{input:r,target:a}}function Ue(e){return{input:new K(e.input),target:new K(e.target)}}var K,Fe=d(()=>{K=class{stoi;itos;length;constructor(t,n=[]){let r=[...n,...t];this.itos=r,this.stoi=Object.freeze(Object.fromEntries(r.map((a,s)=>[a,s]))),this.length=r.length}encode(t){return this.stoi[t]??-1}decode(t){return this.itos[t]??""}encodeSequence(t){return Array.from(t).map(n=>this.encode(n))}decodeSequence(t){return t.map(n=>this.decode(n)).join("")}}});function Pt(e){let t=new Uint8Array(e*e);for(let n=0;nn===t?0:1))}function Ge(e,t,n,r){let a=Pt(t),s=qe(n),o=qe(r);return{tgt_mask:{name:"tgt_mask",type:"int8",data:a,dims:[t,t]},src_key_padding_mask:{name:"src_key_padding_mask",type:"int8",data:s,dims:[1,e]},tgt_key_padding_mask:{name:"tgt_key_padding_mask",type:"int8",data:o,dims:[1,t]},memory_key_padding_mask:{name:"memory_key_padding_mask",type:"int8",data:s,dims:[1,e]}}}var He=d(()=>{});async function qt(e){let t=e.artifacts["vocabs.yaml"];if(!t)throw new Error("Secryst model missing vocabs.yaml");let n=typeof t=="string"?t:new TextDecoder().decode(t),r=Pe(n),{input:a,target:s}=Ue(r);return new Ve(e.session,a,s)}var Zn,Ut,Ft,Ve,Gt=d(()=>{Fe();He();Zn=100,Ut="",Ft="",Ve=class{kind="secryst";session;inputVocab;targetVocab;constructor(t,n,r){this.session=t,this.inputVocab=n,this.targetVocab=r}async translate(t,n=Zn){let r=[this.inputVocab.encode(Ut),...this.inputVocab.encodeSequence(t),this.inputVocab.encode(Ft)].filter(o=>o>=0),a=[this.targetVocab.encode(Ut)],s=this.targetVocab.encode(Ft);for(let o=0;oBigInt(f))),dims:[1,r.length]},tgt:{name:"tgt",type:"int64",data:new BigInt64Array(a.map(f=>BigInt(f))),dims:[1,a.length]},...c},p=(await this.session.run(i))[this.session.outputNames[0]];if(!p)throw new Error("Secryst model produced no output");let u=p.dims,S=u[u.length-1],y=p.data,x=o*S,v=0,k=-1/0;for(let f=0;fk&&(k=Y,v=f)}if(v===s)break;a.push(v)}return this.targetVocab.decodeSequence(a.slice(1))}async transform(t){let n=t.split(` +var Zi=Object.defineProperty;var L=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var ke=(e,t)=>{for(var n in t)Zi(e,n,{get:t[n],enumerable:!0})};var Ur={};ke(Ur,{createLitertSession:()=>ss});async function is(){return vt||(vt=(async()=>{try{return await import("@litertjs/core")}catch(e){throw vt=void 0,new Error("@litertjs/core is required for LiteRT inference. Install with: npm install @litertjs/core",{cause:e})}})()),vt}async function ss(e,t={}){let n=t.accelerator??"webgpu",r=t.wasmPath??as,a=t.inputNames??["src","lengths"],i=t.outputNames??["output"],s=await is();await s.loadLiteRt(r,{jspi:n==="webnn"});let o=new Blob([new Uint8Array(e)],{type:"application/octet-stream"}),c=URL.createObjectURL(o),u;return u=await s.loadAndCompile(c,{accelerator:n}),new nn(u,s,a,i,c)}function os(e){return e instanceof Float32Array?"float32":e instanceof Int32Array?"int32":e instanceof BigInt64Array?"int64":e instanceof Uint8Array?"uint8":"float32"}var as,vt,nn,jr=L(()=>{as="https://cdn.jsdelivr.net/npm/@litertjs/core@2.5.2/wasm/";nn=class{inputNames;outputNames;model;core;blobUrl;disposed=!1;constructor(t,n,r,a,i){this.model=t,this.core=n,this.inputNames=r,this.outputNames=a,this.blobUrl=i}async run(t){if(this.disposed)throw new Error("Session disposed");let n=[];for(let i of this.inputNames){let s=t[i];if(!s)throw new Error(`Missing LiteRT input: ${i}`);n.push(new this.core.Tensor(s.data,s.dims))}let r=await this.model.run(n.length===1?n[0]:n),a={};try{for(let i=0;ius});async function cs(){try{return await import("onnxruntime-node")}catch(e){throw new Error("onnxruntime-node is required for ML inference in Node. Install with: npm install onnxruntime-node",{cause:e})}}async function us(e){return rn.create(e)}var ls,rn,Hr=L(()=>{ls=typeof globalThis.Float16Array>"u",rn=class e{session;ort;inputNames;outputNames;inputMetadata;constructor(t,n){this.session=t,this.ort=n,this.inputNames=t.inputNames,this.outputNames=t.outputNames;let r=t.inputMetadata;Array.isArray(r)&&(this.inputMetadata=r)}static async create(t){let n=await cs(),r=await n.InferenceSession.create(t,{intraOpNumThreads:1});return new e(r,n)}async run(t){let n={};for(let[i,s]of Object.entries(t)){if(s.type==="float16"&&!ls)throw new Error(`input '${i}' is float16: float16 graph I/O cannot cross the onnxruntime-node binding on this runtime (the feed is converted to a Float16Array the binding reads as zero bytes, surfacing as "not enough space: expected N, got 0"). The artifact's graphs must expose fp32 graph I/O \u2014 re-export with interscript-models tools/normalize_fp16_io.py.`);n[i]=new this.ort.Tensor(s.type,s.data,s.dims)}let r=await this.session.run(n),a={};for(let[i,s]of Object.entries(r)){let o=s;a[i]={name:i,type:o.type,data:o.data,dims:o.dims}}return a}async dispose(){await this.session.release()}}});var qr={};ke(qr,{createWebSession:()=>ps});async function fs(){return Lt||(Lt=(async()=>{try{let e=await import("onnxruntime-web");return e.env.wasm.simd=!0,e}catch(e){throw Lt=void 0,new Error("onnxruntime-web is required for ML inference in the browser. Install with: npm install onnxruntime-web",{cause:e})}})()),Lt}async function ps(e,t={}){return an.create(e,t)}var Lt,an,Kr=L(()=>{an=class e{session;ort;inputNames;outputNames;constructor(t,n){this.session=t,this.ort=n,this.inputNames=t.inputNames,this.outputNames=t.outputNames}static async create(t,n={}){let r=await fs(),a=n.webgpu===!1?["wasm"]:["webgpu","wasm"],i=await r.InferenceSession.create(t,{executionProviders:a});return new e(i,r)}async run(t){let n={};for(let[i,s]of Object.entries(t))n[i]=new this.ort.Tensor(s.type,s.data,s.dims);let r=await this.session.run(n),a={};for(let[i,s]of Object.entries(r)){let o=s;a[i]={name:i,type:o.type,data:o.data,dims:o.dims}}return a}async dispose(){await this.session.release()}}});function sn(){let e=globalThis;return e.process?.versions?.node?"node":e.self!==void 0?"web":"unknown"}async function Z(e,t={}){if((t.runtime??"onnx")==="litert"){let i={};return t.litertAccelerator!==void 0&&(i.accelerator=t.litertAccelerator),t.inputNames!==void 0&&(i.inputNames=t.inputNames),t.outputNames!==void 0&&(i.outputNames=t.outputNames),(await Promise.resolve().then(()=>(jr(),Ur))).createLitertSession(e,i)}if((t.backend??sn()==="node"?"node":"web")==="node")return(await Promise.resolve().then(()=>(Hr(),Gr))).createNodeSession(e);let a=t.webgpu===void 0?{}:{webgpu:t.webgpu};return(await Promise.resolve().then(()=>(Kr(),qr))).createWebSession(e,a)}var _e=L(()=>{});var ds,hs,Yr,Vr,uu,Wr,fu,ms,Qr,gs,on,Zr,cn,wt,Ie=L(()=>{ds=["\u0652","\u0651","\u064C","\u064D","\u0650","\u064B","\u064E","\u064F"],hs="\u0649\u0639\u0638\u062D\u0631\u0633\u064A\u0634\u0636\u0642 \u062B\u0644\u0635\u0637\u0643\u0622\u0645\u0627\u0625\u0647\u0632\u0621\u0623\u0641\u0624\u063A\u062C\u0626\u062F\u0629\u062E\u0648\u0628\u0630\u062A\u0646",Yr="\u0649\u0639\u0638\u062D\u0631\u0633\u064A\u0634\u0636\u0642\u062B\u0644\u0635\u0637\u0643\u0622\u0645\u0627\u0625\u0647\u0632\u0621\u0623\u0641\u0624\u063A\u062C\u0626\u062F\u0629\u062E\u0648\u0628\u0630\u062A\u0646",Vr=[...ds,...hs],uu=Object.freeze({"\u064E":"Fatha","\u064B":"Fathatah","\u064F":"Damma","\u064C":"Dammatan","\u0650":"Kasra","\u064D":"Kasratan","\u0652":"Sukun","\u0651":"Shaddah"}),Wr=Object.freeze({"":"No Diacritic","\u064E":"Fatha","\u064B":"Fathatah","\u064F":"Damma","\u064C":"Dammatan","\u0650":"Kasra","\u064D":"Kasratan","\u0652":"Sukun","\u0651":"Shaddah","\u0651\u064E":"Shaddah + Fatha","\u0651\u064B":"Shaddah + Fathatah","\u0651\u064F":"Shaddah + Damma","\u0651\u064C":"Shaddah + Dammatan","\u0651\u0650":"Shaddah + Kasra","\u0651\u064D":"Shaddah + Kasratan"}),fu=Object.freeze(Object.fromEntries(Object.keys(Wr).map((e,t)=>[e,t]))),ms="P",Qr=[ms,...Object.keys(Wr),""],gs="\u0628\u0636.\u063A\u0649\u0647\u0638\u062E\u0629\u061F:\u0637\u0633\u060C\u061B\u0641\u0646\u062F\u0624\u0644\u0648\u0626\u0622\u0643-\u064A\u0630\u0627\u0635\u0634\u062D\u0632\u0621\u0645\u0623\u062C\u0625 \u062A\u0631\u0642\u0639\u062B",on="P",Zr=[on,...gs],cn=Object.freeze(Object.fromEntries(Zr.map((e,t)=>[e,t]))),wt=Zr});function Jr(e){return e.replace(/\s+/g," ")}function St(e){return Jr(e).trim()}function ln(e){return St(Array.from(e).filter(t=>ys.has(t)).join(""))}var ys,un=L(()=>{Ie();ys=new Set(Vr)});var Xe,fn=L(()=>{Ie();un();Xe=class{inputSymbolToId=cn;inputIdToSymbol=wt;inputPadId;startSymbolId;cleanerType;reverse;constructor(t={}){this.cleanerType=t.cleaner??"arabic",this.reverse=t.reverseInput??!1,this.inputPadId=cn[on],this.startSymbolId=t.startSymbol?0:null}clean(t){return this.cleanerType==="arabic"?ln(t):St(t)}removeDiacritics(t){return Array.from(t).filter(n=>!(!(n in this.inputSymbolToId)&&/[ً-ْ]/.test(n))).join("")}inputToSequence(t){let n=this.reverse?Array.from(t).reverse():Array.from(t),r=[];for(let a of n){let i=this.inputSymbolToId[a];i!==void 0&&r.push(i)}return r}}});function Ls(e,t){let n=[],r=0;for(let a=0;a!bs.has(c)),r=Array.from(t),a=Ls(n,r),i="",s=0,o=0;for(let{idxDia:c,idxOri:u}of a){if(o{Ie();bs=new Set(["\u0652","\u0651","\u064C","\u064D","\u0650","\u064B","\u064E","\u064F"]),vs=new Set(Yr)});function ws(e,t){let n=e.dims,r=n[n.length-1],a=[],i=e.data;for(let s=0;sc&&(c=f,o=l)}a.push(o)}return a}function Ss(e,t,n){let r="";for(let a=0;a{fn();dn();Ie();Ne={maxLen:200,batchSize:1,textEncoder:"ArabicEncoderWithStartSymbol",textCleaner:"valid_arabic_cleaners"},hn=class{kind="rababa";session;encoder;config;constructor(t,n){this.session=t,this.config=n,this.encoder=new Xe({cleaner:n.textCleaner==="valid_arabic_cleaners"?"arabic":"basic",startSymbol:n.textEncoder==="ArabicEncoderWithStartSymbol"})}async diacritize(t){let n=t;n.length>this.config.maxLen&&(n=n.slice(0,this.config.maxLen));let r=this.encoder.clean(n),a=this.stripDiacritics(r),i=this.encoder.inputToSequence(a);if(i.length===0)return n;let s=this.config.batchSize,o=this.config.maxLen,c=this.encoder.inputPadId,u=[];for(let b=0;bBigInt(b))),dims:[s,o]},f={name:"lengths",type:"int64",data:new BigInt64Array(Array(s).fill(BigInt(o))),dims:[s]},d=(await this.session.run({src:l,lengths:f}))[this.session.outputNames[0]];if(!d)throw new Error("Rababa model produced no output");let h=ws(d,i.length),g=Ss(i,h,this.encoder.inputPadId);return pn(r,g)}async transform(t){return this.diacritize(t)}stripDiacritics(t){return Array.from(t).filter(n=>!/[ً-ْ]/.test(n)).join("")}async dispose(){await this.session.dispose()}}});var ea={};ke(ea,{rababa:()=>Is,rababaReverse:()=>Ns,resetRababaConfigs:()=>Cs,setRababaConfig:()=>ks});function ks(e,t){yn.set(e,t)}function Cs(){yn=new Map(Object.entries(Xr))}function Ts(e){let t=yn.get(e);if(!t)throw new Error(`No rababa config registered under '${e}'. Register one via setRababaConfig() before invoking rababa.`);return t}function Es(e){return{maxLen:Number(e.max_len??e.maxLen??200),batchSize:Number(e.batch_size??e.batchSize??32),textEncoder:e.text_encoder??"ArabicEncoderWithStartSymbol",textCleaner:e.text_cleaner??"valid_arabic_cleaners"}}async function xs(e){let t=gn.get(e);if(!t){let n=Ts(e);t=(async()=>{let r=await _s(n.model),a=await Z(r),i=Es(n.config);return At({session:a,artifacts:{},config:i})})(),gn.set(e,t),t.catch(()=>gn.delete(e))}return t}async function _s(e){if(e.startsWith("file:")||e.startsWith(".")){let{readFile:n}=await import("node:fs/promises"),r=e.startsWith("file:")?e.slice(5):e;return new Uint8Array(await n(r))}let t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ${e}: ${t.status}`);return new Uint8Array(await t.arrayBuffer())}async function Is(e,t={}){let n=t.config??"200";return(await xs(n)).diacritize(e)}function Ns(e){return e.replace(/[ًٌٍَُِّْ]/g,"")}var Xr,yn,gn,ta=L(()=>{_e();mn();Xr=Object.freeze({200:Object.freeze({model:"https://github.com/secryst/rababa-models/releases/download/0.1/diacritization_model_arabic.onnx",config:Object.freeze({session_name:"base",text_encoder:"ArabicEncoderWithStartSymbol",text_cleaner:"valid_arabic_cleaners",max_len:200,batch_size:32})})}),yn=new Map(Object.entries(Xr));gn=new Map});async function na(e,t={}){let n=t.format??"onnx",r=t.webgpu??!0;if(!e.url)throw new Error(`No url on ModelRef kind=${e.kind} id=${e.id}. Load models via \`import { imf } from "interscript/ml"\` and \`imf.resolve("${e.id}")\` (GitHub Releases index, sha256-verified), or pass an explicit \`url\` on the ModelRef.`);let a=await Ms(e.url),i={},s={webgpu:r};return n==="tflite"&&(s.runtime="litert",t.litertAccelerator!==void 0&&(s.litertAccelerator=t.litertAccelerator),t.inputNames!==void 0&&(s.inputNames=t.inputNames),t.outputNames!==void 0&&(s.outputNames=t.outputNames)),{session:await Z(a,s),artifacts:i}}async function Ms(e){if(e.startsWith("file:")||e.startsWith(".")&&typeof process<"u"&&process.versions?.node){let{readFile:n}=await import("node:fs/promises"),r=e.startsWith("file:")?e.slice(5):e;return new Uint8Array(await n(r))}let t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}var ra=L(()=>{_e()});function ce(e,t){if(kt.has(e))throw new Error(`Model kind "${e}" is already registered`);kt.set(e,t)}function Os(e){return`${e.kind}/${e.id}/${e.url??"_default"}`}async function aa(e){let t=Os(e),n=et.get(t);if(n)return n;let r=kt.get(e.kind);if(!r)throw new Error(`Unknown model kind: "${e.kind}". Register a factory via registerModel("${e.kind}", factory).`);let a=(async()=>{let{session:i,artifacts:s}=await na(e);return r({session:i,artifacts:s})})();return et.set(t,a),a.catch(()=>et.delete(t)),a}function ia(){return[...kt.keys()]}async function sa(){let e=[...et.values()];et.clear(),await Promise.allSettled(e.map(async t=>{try{await(await t).dispose()}catch{}}))}var kt,et,tt=L(()=>{ra();kt=new Map;et=new Map});function Hs(e,t){return js(e,{i:2},t&&t.out,t&&t.dictionary)}function Ys(e,t){if(t){for(var n="",r=0;r65558)&&G(13);var a=ee(e,r+8);if(!a)return{};var i=Y(e,r+16),s=Y(e,r-20)==117853008;if(s){var o=Y(e,r-12);s=Y(e,o)==101075792,s&&(a=Y(e,o+32),i=Y(e,o+48))}for(var c=t&&t.filter,u=0;u{H=Uint8Array,Me=Uint16Array,Rs=Int32Array,oa=new H([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ca=new H([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ds=new H([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),la=function(e,t){for(var n=new Me(31),r=0;r<31;++r)n[r]=t+=1<>1|(A&21845)<<1,ie=(ie&52428)>>2|(ie&13107)<<2,ie=(ie&61680)>>4|(ie&3855)<<4,wn[A]=((ie&65280)>>8|(ie&255)<<8)>>1;nt=(function(e,t,n){for(var r=e.length,a=0,i=new Me(t);a>c]=u}else for(o=new Me(r),a=0;a>15-e[a]);return o}),rt=new H(288);for(A=0;A<144;++A)rt[A]=8;for(A=144;A<256;++A)rt[A]=9;for(A=256;A<280;++A)rt[A]=7;for(A=280;A<288;++A)rt[A]=8;da=new H(32);for(A=0;A<32;++A)da[A]=5;$s=nt(rt,9,1),Fs=nt(da,5,1),bn=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},J=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},vn=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Bs=function(e){return(e+7)/8|0},An=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new H(e.subarray(t,n))},Us=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(e,t,n){var r=new Error(t||Us[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,G),!n)throw r;return r},js=function(e,t,n,r){var a=e.length,i=r?r.length:0;if(!a||t.f&&!t.l)return n||new H(0);var s=!n,o=s||t.i!=2,c=t.i;s&&(n=new H(a*3));var u=function(wr){var Sr=n.length;if(wr>Sr){var Ar=new H(Math.max(Sr*2,wr));Ar.set(n),n=Ar}},l=t.f||0,f=t.p||0,p=t.b||0,d=t.l,h=t.d,g=t.m,b=t.n,m=a*8;do{if(!d){l=J(e,f,1);var S=J(e,f+1,3);if(f+=3,S)if(S==1)d=$s,h=Fs,g=9,b=5;else if(S==2){var _=J(e,f,31)+257,Ye=J(e,f+10,15)+4,Ve=_+J(e,f+5,31)+1;f+=14;for(var W=new H(Ve),Qt=new H(19),K=0;K>4;if(T<16)W[K++]=T;else{var Se=0,yt=0;for(T==16?(yt=3+J(e,f,3),f+=2,Se=W[K-1]):T==17?(yt=3+J(e,f,7),f+=3):T==18&&(yt=11+J(e,f,127),f+=7);yt--;)W[K++]=Se}}var yr=W.subarray(0,_),oe=W.subarray(_);g=bn(yr),b=bn(oe),d=nt(yr,g,1),h=nt(oe,b,1)}else G(1);else{var T=Bs(f)+4,x=e[T-4]|e[T-3]<<8,U=T+x;if(U>a){c&&G(0);break}o&&u(p+x),n.set(e.subarray(T,U),p),t.b=p+=x,t.p=f=U*8,t.f=l;continue}if(f>m){c&&G(0);break}}o&&u(p+131072);for(var Vi=(1<>4;if(f+=Se&15,f>m){c&&G(0);break}if(Se||G(2),Ae<256)n[p++]=Ae;else if(Ae==256){Zt=f,d=null;break}else{var br=Ae-254;if(Ae>264){var K=Ae-257,We=oa[K];br=J(e,f,(1<>4;Jt||G(3),f+=Jt&15;var oe=Ps[Xt];if(Xt>3){var We=ca[Xt];oe+=vn(e,f)&(1<m){c&&G(0);break}o&&u(p+131072);var vr=p+br;if(p>>0},Ln=function(e,t){return Y(e,t)+Y(e,t+4)*4294967296};Sn=typeof TextDecoder<"u"&&new TextDecoder,qs=0;try{Sn.decode(Gs,{stream:!0}),qs=1}catch{}Ks=function(e){for(var t="",n=0;;){var r=e[n++],a=(r>127)+(r>223)+(r>239);if(n+a>e.length)return{s:t,r:An(e,n-1)};a?a==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):a&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};Vs=function(e,t){return t+30+ee(e,t+26)+ee(e,t+28)},Ws=function(e,t,n){var r=ee(e,t+28),a=ee(e,t+30),i=Ys(e.subarray(t+46,t+46+r),!(ee(e,t+8)&2048)),s=t+46+r,o=Qs(e,s,a,n,Y(e,t+20),Y(e,t+24),Y(e,t+42)),c=o[0],u=o[1],l=o[2];return[ee(e,t+10),c,u,i,s+a+ee(e,t+32),l]},Qs=function(e,t,n,r,a,i,s){var o=a==4294967295,c=i==4294967295,u=s==4294967295,l=t+n,f=o+c+u;if(r&&f){for(;t+4String(n)),representTagName:t.representTagName??(()=>e)}}function zn(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:"sequence",implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addItem:t.addItem,finalize:t.finalize??(r=>r),carrierIsResult:n,identify:t.identify,represent:t.represent??(r=>r),representTagName:t.representTagName??(()=>e)}}function xt(e,t){let n=t.finalize===void 0;return{tagName:e,nodeKind:"mapping",implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addPair:t.addPair,has:t.has,keys:t.keys,get:t.get,finalize:t.finalize??(r=>r),carrierIsResult:n,identify:t.identify,represent:t.represent??(r=>r),representTagName:t.representTagName??(()=>e)}}function mo(e){let t=e,n=1;return(t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(n=-1),t=t.slice(1)),t.startsWith("0b")?n*parseInt(t.slice(2),2):t.startsWith("0o")?n*parseInt(t.slice(2),8):t.startsWith("0x")?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function go(e,t){if(t){if(!ho.test(e))return v}else if(!po.test(e))return v;let n=mo(e);return Number.isFinite(n)?n:v}function vo(e){let t=e,n=1;return(t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(n=-1),t=t.slice(1)),t.startsWith("0b")?n*parseInt(t.slice(2),2):t.startsWith("0o")?n*parseInt(t.slice(2),8):t.startsWith("0x")?n*parseInt(t.slice(2),16):n*parseInt(t,10)}function Lo(e,t){if(t){if(!bo.test(e))return v}else if(!yo.test(e))return v;let n=vo(e);return Number.isFinite(n)?n:v}function Ao(e){let t=e.replace(/_/g,""),n=1;if((t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(n=-1),t=t.slice(1)),t.startsWith("0b"))return n*parseInt(t.slice(2),2);if(t.startsWith("0x"))return n*parseInt(t.slice(2),16);if(t.includes(":")){let r=0;for(let a of t.split(":"))r=r*60+Number(a);return n*r}return t!=="0"&&t[0]==="0"?n*parseInt(t,8):n*parseInt(t,10)}function ko(e){if(!So.test(e))return v;let t=Ao(e);return Number.isFinite(t)?t:v}function Eo(e){if(!Co.test(e))return v;let t=e.toLowerCase(),n=t[0]==="-"?-1:1;if("+-".includes(t[0])&&(t=t.slice(1)),t===".inf")return n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;let r=n*parseFloat(t);return Number.isFinite(r)||To.test(e)?r:v}function xo(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}function No(e,t){if(t){if(!Io.test(e))return v;let r=e.toLowerCase(),a=r[0]==="-"?-1:1;if("+-".includes(r[0])&&(r=r.slice(1)),r===".inf")return a===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(r===".nan")return NaN;let i=a*parseFloat(r);return Number.isFinite(i)?i:v}if(!_o.test(e))return v;let n=Number(e);return Number.isFinite(n)?n:v}function Mo(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}function zo(e){if(!Ro.test(e))return v;let t=e.toLowerCase().replace(/_/g,""),n=t[0]==="-"?-1:1;if("+-".includes(t[0])&&(t=t.slice(1)),t===".inf")return n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;let r=0;if(t.includes(":")){for(let a of t.split(":"))r=r*60+Number(a);r*=n}else r=n*parseFloat(t);return Number.isFinite(r)||Do.test(e)?r:v}function Po(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}function Bo(e){let t=e.replace(/\s/g,"");if(t.length%4!==0||!Fo.test(t))return v;let n=atob(t),r=new Uint8Array(n.length);for(let a=0;a23||s>59||o>59)return v;if(t[7]){let l=t[7].slice(0,3);for(;l.length<3;)l+="0";c=+l}let u=ha(n,r,a,i,s,o,c);if(u.getUTCFullYear()!==n||u.getUTCMonth()!==r||u.getUTCDate()!==a)return v;if(t[9]){let l=+t[10],f=+(t[11]||0);if(l>23||f>59)return v;let p=(l*60+f)*6e4;u.setTime(u.getTime()-(t[9]==="-"?-p:p))}return u}function _t(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ma(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Jo(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function Xo(){return{scalar:[],sequence:[],mapping:[]}}function ec(e){let t=[];for(let n of e){let r=t.length;for(let a=0;ao&&(i=" ... ",t=r-o+i.length),n-r>o&&(s=" ...",n=r+o-s.length),{str:i+e.slice(t,n).replace(/\t/g,"\u2192")+s,pos:r-t+i.length}}function Tn(e,t){return" ".repeat(Math.max(t-e.length,0))+e}function ic(e,t){if(!e.buffer)return null;let n={...ac,...t},r=/\r?\n|\r|\0/g,a=[0],i=[],s,o=-1;for(;s=r.exec(e.buffer);)i.push(s.index),a.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=a.length-2);o<0&&(o=a.length-1);let c="",u=Math.min(e.line+n.linesAfter,i.length).toString().length,l=n.maxLength-(n.indent+u+3);for(let p=1;p<=n.linesBefore&&!(o-p<0);p++){let d=Cn(e.buffer,a[o-p],i[o-p],e.position-(a[o]-a[o-p]),l);c=`${" ".repeat(n.indent)}${Tn((e.line-p+1).toString(),u)} | ${d.str} +${c}`}let f=Cn(e.buffer,a[o],i[o],e.position,l);c+=`${" ".repeat(n.indent)}${Tn((e.line+1).toString(),u)} | ${f.str} +`,c+=`${"-".repeat(n.indent+u+3+f.pos)}^ +`;for(let p=1;p<=n.linesAfter&&!(o+p>=i.length);p++){let d=Cn(e.buffer,a[o+p],i[o+p],e.position-(a[o]-a[o+p]),l);c+=`${" ".repeat(n.indent)}${Tn((e.line+p+1).toString(),u)} | ${d.str} +`}return c.replace(/\n$/,"")}function ya(e,t){let n="";return e.mark?(e.mark.name&&(n+=`in "${e.mark.name}" `),n+=`(${e.mark.line+1}:${e.mark.column+1})`,!t&&e.mark.snippet&&(n+=` + +${e.mark.snippet}`),`${e.reason} ${n}`):e.reason}function ba(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return` +`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function oc(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function cc(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function lc(e){return e===120?2:e===117?4:8}function Ct(e,t,n){let r=0;for(;t0;u--){a++;let f=cc(e.charCodeAt(a));l=(l<<4)+f}r+=oc(l),a++}i=s=a}else if(o===10||o===13){r+=e.slice(i,s);let c=Ct(e,a,n);r+=$n(c.breaks),a=i=s=c.position}else a++,o!==32&&o!==9&&(s=a)}return r+e.slice(i,n)}function va(e,t,n,r,a,i){let s=r<0?0:r,o=e.slice(t,n).replace(/\r\n?/g,` +`),c=o===""?[]:(o.endsWith(` +`)?o.slice(0,-1):o).split(` +`),u="",l=!1,f=0,p=!1;for(let d of c){let h=0;for(;h=d.length){f++;continue}let g=d.slice(s),b=g.charCodeAt(0);i?b===32||b===9?(p=!0,u+=` +`.repeat(l?1+f:f)):p?(p=!1,u+=` +`.repeat(f+1)):f===0?l&&(u+=" "):u+=` +`.repeat(f):u+=` +`.repeat(l?1+f:f),u+=g,l=!0,f=0}return a===q.KEEP?u+=` +`.repeat(l?1+f:f):a!==q.STRIP&&l&&(u+=` +`),u}function dc(e,t){if(t.valueStart===sc)return"";let{valueStart:n,valueEnd:r}=t;if(t.fast)return e.slice(n,r);switch(t.style){case O.SINGLE_QUOTED:return fc(e,n,r);case O.DOUBLE_QUOTED:return pc(e,n,r);case O.LITERAL_BLOCK:return va(e,n,r,t.indent,t.chomping,!1);case O.FOLDED_BLOCK:return va(e,n,r,t.indent,t.chomping,!0);default:return uc(e,n,r)}}function Ma(e,t){if(e.startsWith("!<")&&e.endsWith(">"))return decodeURIComponent(e.slice(2,-1));let n=e.indexOf("!",1),r=n===-1?"!":e.slice(0,n+1),a=t?.[r]??hc[r]??r;return decodeURIComponent(a)+decodeURIComponent(e.slice(r.length))}function gc(e){return"tagStart"in e&&e.tagStart!==Oe?e.tagStart:"anchorStart"in e&&e.anchorStart!==Oe?e.anchorStart:"valueStart"in e&&e.valueStart!==Oe?e.valueStart:"start"in e?e.start:0}function D(e,t){be.throwAt(e.source,e.position,t,e.filename)}function Oa(e,t,n,r){try{return n.finalize(r)}catch(a){if(a instanceof be)throw a;be.throwAt(e.source,t,a instanceof Error?a.message:String(a),e.filename)}}function yc(e,t){let n=dc(e.source,t),r=t.tagStart===Oe?"":e.source.slice(t.tagStart,t.tagEnd),a=e.schema.defaultScalarTag;if(r!==""){if(r==="!")return{value:n,tag:a};let i=Ma(r,e.tagHandlers),s=e.schema.lookupScalarTag(i);if(s){let c=s.resolve(n,!0,i);return c===v&&D(e,`cannot resolve a node with !<${i}> explicit tag`),{value:c,tag:s}}let o=e.schema.lookupMappingTag(i)??e.schema.lookupSequenceTag(i);if(o){n!==""&&D(e,`cannot resolve a node with !<${i}> explicit tag`);let c=o.create(i);return{value:o.carrierIsResult?c:Oa(e,e.position,o,c),tag:o}}D(e,`unknown scalar tag !<${i}>`)}return t.style===O.PLAIN?e.schema.resolveImplicitScalarTag(n):{value:a.resolve(n,!1,a.tagName),tag:a}}function La(e,t,n){let r=t.tagStart===Oe?"":e.source.slice(t.tagStart,t.tagEnd);return r===""||r==="!"?n:Ma(r,e.tagHandlers)}function Ra(e){return e.nodeKind==="mapping"}function wa(e,t,n,r){for(let a of r.keys(n)){if(e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&D(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`),t.tag.has(t.value,a))continue;let i=t.tag.addPair(t.value,a,r.get(n,a));i&&D(e,i),(t.overridable??=new Set).add(a)}}function bc(e,t,n,r){if(e.position=t.keyPosition,Ra(r))wa(e,t,n,r);else if(r.nodeKind==="sequence"&&Array.isArray(n))for(let a of n){let i=e.nodeTags.get(a);i||D(e,"cannot merge mappings; the provided source object is unacceptable"),wa(e,t,a,i)}else D(e,"cannot merge mappings; the provided source object is unacceptable")}function vc(e,t,n,r,a){if(e.position=t.keyPosition,t.keyIsMerge){bc(e,t,r,a);return}!e.json&&t.tag.has(t.value,n)&&!t.overridable?.has(n)&&D(e,"duplicated mapping key");let i=t.tag.addPair(t.value,n,r);i&&D(e,i),t.overridable?.delete(n)}function En(e,t,n){let r=e.frames[e.frames.length-1];if(r.kind==="document")r.value=t,r.hasValue=!0;else if(r.kind==="sequence"){Ra(n)&&e.nodeTags.set(t,n);let a=r.tag.addItem(r.value,t,r.index++);a&&D(e,a)}else if(r.hasKey){let a=r.key;r.key=void 0,r.hasKey=!1,vc(e,r,a,t,n)}else r.key=t,r.keyPosition=e.position,r.hasKey=!0,r.keyIsMerge=n.tagName===mc}function xn(e,t,n,r,a){if(t.anchorStart!==Oe){let i={value:n,tag:r,isValueFinal:a};return e.anchors.set(e.source.slice(t.anchorStart,t.anchorEnd),i),i}return null}function Lc(e,t){let n={...Fn,...t,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;n.eventIndex`);let s=i.create(a),o=xn(n,r,s,i,i.carrierIsResult);n.frames.push({kind:"sequence",position:n.position,value:s,tag:i,anchor:o,index:0});break}case C.MAPPING:{let a=La(n,r,"tag:yaml.org,2002:map"),i=n.schema.lookupMappingTag(a);i||D(n,`unknown mapping tag !<${a}>`);let s=i.create(a),o=xn(n,r,s,i,i.carrierIsResult);n.frames.push({kind:"mapping",position:n.position,value:s,tag:i,anchor:o,key:void 0,keyPosition:n.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case C.ALIAS:{n.maxAliases!==-1&&++n.aliasCount>n.maxAliases&&D(n,`aliases exceeded maxAliases (${n.maxAliases})`);let a=n.source.slice(r.anchorStart,r.anchorEnd),i=n.anchors.get(a);i||D(n,`unidentified alias "${a}"`),i.isValueFinal||D(n,`recursive alias "${a}" is not supported for tag ${i.tag.tagName} because it uses finalize()`),En(n,i.value,i.tag);break}case C.POP:{let a=n.frames.pop();if(a.kind==="mapping"&&a.hasKey&&(n.position=a.keyPosition,D(n,"incomplete mapping pair in event stream")),a.kind==="document")n.documents.push(a.value);else{let i=a.tag.carrierIsResult?a.value:Oa(n,a.position,a.tag,a.value);a.anchor&&(a.anchor.value=i,a.anchor.isValueFinal=!0),En(n,i,a.tag)}break}}}return n.documents}function Tc(e,t,n){e.events.push({type:C.DOCUMENT,explicitStart:t,explicitEnd:n,directives:e.directives})}function Fa(e,t,n,r,a,i,s){e.events.push({type:C.SEQUENCE,start:t,anchorStart:n,anchorEnd:r,tagStart:a,tagEnd:i,style:s})}function Rn(e,t,n,r,a,i,s){e.events.push({type:C.MAPPING,start:t,anchorStart:n,anchorEnd:r,tagStart:a,tagEnd:i,style:s})}function Sa(e,t){e.events.splice(t.eventsLength,0,{type:C.MAPPING,start:t.position,anchorStart:w,anchorEnd:w,tagStart:w,tagEnd:w,style:le.FLOW})}function Pe(e,t,n,r,a,i,s,o,c=q.CLIP,u=-1,l=!1){e.events.push({type:C.SCALAR,valueStart:t,valueEnd:n,anchorStart:r,anchorEnd:a,tagStart:i,tagEnd:s,style:o,chomping:c,indent:u,fast:l})}function Ec(e,t,n){e.events.push({type:C.ALIAS,anchorStart:t,anchorEnd:n})}function Re(e){e.events.push({type:C.POP})}function P(e){Pe(e,w,w,w,w,w,w,O.PLAIN)}function Aa(){return{anchorStart:w,anchorEnd:w,tagStart:w,tagEnd:w}}function st(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function De(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.events.length=t.eventsLength}function y(e,t){be.throwAt(e.input.slice(0,e.length),e.position,t,e.filename)}function M(e){return e===10||e===13}function ve(e){return e===9||e===32}function X(e){return ve(e)||M(e)}function se(e){return e===0||X(e)}function Le(e){return e===44||e===91||e===93||e===123||e===125}function xc(e){return e>=48&&e<=57?e-48:-1}function _c(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function Ic(e){return e===120?2:e===117?4:e===85?8:0}function Nc(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function Et(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function $(e,t){let n=0,r=e.input.charCodeAt(e.position),a=e.position===e.lineStart||X(e.input.charCodeAt(e.position-1));for(;r!==0;){for(;ve(r);)a=!0,r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&a&&r===35)do r=e.input.charCodeAt(++e.position);while(!M(r)&&r!==0);if(!M(r))break;for(Et(e),n++,a=!0,r=e.input.charCodeAt(e.position);r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return n}function ge(e,t=e.position){let n=e.input.charCodeAt(t);if((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)){let r=e.input.charCodeAt(t+3);return r===0||X(r)}return!1}function ka(e){let t=e.input.charCodeAt(e.position);for(;t!==0&&!M(t);)t=e.input.charCodeAt(++e.position)}function Ba(e,t,n){wc.test(e.input.slice(t,n))&&y(e,"the stream contains non-printable characters")}function Mc(e,t,n){if(e.input.charCodeAt(e.position)!==33)return!1;t.tagStart!==w&&y(e,"duplication of a tag property");let r=e.position,a=!1,i=!1,s="!",o=e.input.charCodeAt(++e.position);o===60?(a=!0,o=e.input.charCodeAt(++e.position)):o===33&&(i=!0,s="!!",o=e.input.charCodeAt(++e.position));let c=e.position,u;if(a){for(;o!==0&&o!==62;)o=e.input.charCodeAt(++e.position);o!==62&&y(e,"unexpected end of the stream within a verbatim tag"),u=e.input.slice(c,e.position),e.position++}else{for(;o!==0&&!X(o)&&!(n&&Le(o));)o===33&&(i?y(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(c-1,e.position+1),Pa.test(s)||y(e,"named tag handle cannot contain such characters"),i=!0,c=e.position+1)),o=e.input.charCodeAt(++e.position);u=e.input.slice(c,e.position),Sc.test(u)&&y(e,"tag suffix cannot contain flow indicator characters")}return u&&!(a?Ac.test(u):kc.test(u))&&y(e,`tag name cannot contain such characters: ${u}`),!a&&s!=="!"&&s!=="!!"&&!Da.call(e.tagHandlers,s)&&y(e,`undeclared tag handle "${s}"`),t.tagStart=r,t.tagEnd=e.position,!0}function Oc(e,t){if(e.input.charCodeAt(e.position)!==38)return!1;t.anchorStart!==w&&y(e,"duplication of an anchor property"),e.position++;let n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!X(e.input.charCodeAt(e.position))&&!Le(e.input.charCodeAt(e.position));)e.position++;return e.position===n&&y(e,"name of an anchor node must contain at least one character"),t.anchorStart=n,t.anchorEnd=e.position,!0}function Rc(e,t){if(e.input.charCodeAt(e.position)!==42)return!1;(t.anchorStart!==w||t.tagStart!==w)&&y(e,"alias node should not have any properties"),e.position++;let n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!X(e.input.charCodeAt(e.position))&&!Le(e.input.charCodeAt(e.position));)e.position++;return e.position===n&&y(e,"name of an alias node must contain at least one character"),Ec(e,n,e.position),!0}function Dn(e,t){$(e,!1),e.lineIndent0;)e.position++,_c(e.input.charCodeAt(e.position))<0&&y(e,"expected hexadecimal character");e.position++}}else M(i)?(a=!1,Dn(e,t)):e.position===e.lineStart&&ge(e)?y(e,"unexpected end of the document within a double quoted scalar"):i!==9&&i<32?y(e,"expected valid JSON character"):e.position++}y(e,"unexpected end of the stream within a double quoted scalar")}function Pc(e,t,n){let r=e.input.charCodeAt(e.position),a=q.CLIP,i=-1,s=!1;if(r!==124&&r!==62)return!1;let o=r===124?O.LITERAL_BLOCK:O.FOLDED_BLOCK;for(e.position++;e.input.charCodeAt(e.position)!==0;){let d=e.input.charCodeAt(e.position),h=xc(d);if(d===43||d===45)a!==q.CLIP&&y(e,"repeat of a chomping mode identifier"),a=d===43?q.KEEP:q.STRIP,e.position++;else if(h>=0)h===0&&y(e,"bad explicit indentation width of a block scalar; it cannot be less than one"),s&&y(e,"repeat of an indentation width identifier"),i=t+h-1,s=!0,e.position++;else break}let c=!1;for(;ve(e.input.charCodeAt(e.position));)c=!0,e.position++;c&&e.input.charCodeAt(e.position)===35&&ka(e),M(e.input.charCodeAt(e.position))?Et(e):e.input.charCodeAt(e.position)!==0&&y(e,"a line break is expected");let u=s?i:-1,l=0,f=e.position,p=e.position;for(;e.input.charCodeAt(e.position)!==0;){let d=e.position,h=0;for(;e.input.charCodeAt(d+h)===32;)h++;let g=e.input.charCodeAt(d+h);if(g===0){u>=0?h>u&&(p=d+h):h>0&&(p=d+h);break}if(d===e.lineStart&&ge(e,d))break;if(!s&&u===-1&&M(g)&&(l=Math.max(l,h)),!s&&u===-1&&!M(g)&&(g===9&&h=t){c=!0,s=e.input.charCodeAt(e.position);continue}e.position=u,e.line=l,e.lineStart=f,e.lineIndent=p;break}}ve(s)||(i=e.position+1),s=e.input.charCodeAt(++e.position)}return i===a?!1:(Ba(e,a,i),Pe(e,a,i,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,O.PLAIN,q.CLIP,-1,!c),!0)}function it(e,t){let n=e.line;$(e,!0),(e.line>n&&e.lineIndent0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&se(e.input.charCodeAt(e.position+1))&&y(e,"bad indentation of a sequence entry"),a&&e.lineIndent<=t?P(e):ye(e,t,za,!1,!0),$(e,!0),e.lineIndent=e.length)break;e.lineIndent>t&&y(e,"bad indentation of a sequence entry"),e.line===r&&e.input.charCodeAt(e.position)===45&&se(e.input.charCodeAt(e.position+1))&&y(e,"bad indentation of a sequence entry")}return Re(e),!0}function _n(e,t,n,r){let a=!1,i=!1,s=!1,o=!1;if(e.firstTabInLine!==-1)return!1;let c=e.input.charCodeAt(e.position);for(;c!==0;){!a&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,y(e,"tab characters must not be used in indentation"));let u=e.input.charCodeAt(e.position+1),l=e.line;if((c===63||c===58)&&se(u))s||(Rn(e,e.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,le.BLOCK),s=!0),c===63?(a&&P(e),i=!0,a=!0):(a||(P(e),i=!0),a=!1),e.position+=1,o=!0;else{a&&(P(e),a=!1);let f=st(e);if(!ye(e,n,Mn,!1,!0))break;if(e.line===l){for(c=e.input.charCodeAt(e.position);ve(c);)c=e.input.charCodeAt(++e.position);if(c===58){if(c=e.input.charCodeAt(++e.position),se(c)||y(e,"a whitespace character is expected after the key-value separator within a block mapping"),!s){for(De(e,f),Rn(e,f.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,le.BLOCK),s=!0,ye(e,n,Mn,!1,!0),c=e.input.charCodeAt(e.position);ve(c);)c=e.input.charCodeAt(++e.position);e.position++}i=!0,a=!1,o=!1}else if(i)y(e,"expected ':' after a mapping key");else return r.anchorStart!==w||r.tagStart!==w?(De(e,f),!1):!0}else if(i)y(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return r.anchorStart!==w||r.tagStart!==w?(De(e,f),!1):!0}if(ye(e,t,Tt,!0,o)&&(o=!1),a||o&&(P(e),o=!1),$(e,!0),c=e.input.charCodeAt(e.position),(e.line===l||e.lineIndent>t)&&c!==0)y(e,"bad indentation of a mapping entry");else if(e.lineIndent=e.maxDepth&&y(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let s=1,o=!1,c=!1,u=null,l=Aa(),f=n===Tt||n===za,p=f,d=f;if(r&&$(e,!0)&&(o=!0,e.lineIndent>t?s=1:e.lineIndent===t?s=0:s=-1),s===1)for(;;){let h=e.input.charCodeAt(e.position),g=st(e);if(o&&s!==1&&(h===33||h===38))break;if(o&&d&&(l.tagStart!==w||l.anchorStart!==w)&&(h===33||h===38)){let b=st(e),m=t+1;if(_n(e,e.position-e.lineStart,m,l)&&e.events[b.eventsLength]?.type===C.MAPPING)return e.depth--,!0;De(e,b)}if(o&&(h===33&&l.tagStart!==w||h===38&&l.anchorStart!==w)||!Mc(e,l,n===ze)&&!Oc(e,l))break;u===null&&(u=g),$(e,!0)?(o=!0,p=d,e.lineIndent>t?s=1:e.lineIndent===t?s=0:s=-1):p=!1}if(p&&(p=o||a),s===1||n===Tt){let h=n===ze||n===Mn?t:t+1,g=e.position-e.lineStart;if(s===1)if(p&&(Ca(e,g,l)||_n(e,g,h,l))||Bc(e,h,l))c=!0;else{let b=e.input.charCodeAt(e.position);if(u!==null&&i&&d&&!p&&b!==124&&b!==62){let m=st(e),S=u.position-u.lineStart;De(e,u),_n(e,S,h,Aa())&&e.events[m.eventsLength]?.type===C.MAPPING?c=!0:De(e,m)}!c&&(f&&Pc(e,h,l)||Dc(e,h,l)||zc(e,h,l)||Rc(e,l)||Fc(e,h,n,l))&&(c=!0)}else s===0&&(c=p&&Ca(e,g,l))}return f=f&&!c,!c&&(l.anchorStart!==w||l.tagStart!==w||f)&&(Pe(e,w,w,l.anchorStart,l.anchorEnd,l.tagStart,l.tagEnd,O.PLAIN),c=!0),e.depth--,c||l.anchorStart!==w||l.tagStart!==w}function Uc(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!X(e.input.charCodeAt(e.position));)e.position++;let n=e.input.slice(t,e.position),r=[];for(n.length===0&&y(e,"directive name must not be less than one character in length");e.input.charCodeAt(e.position)!==0&&!M(e.input.charCodeAt(e.position));){for(;ve(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||M(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;let a=e.position;for(;e.input.charCodeAt(e.position)!==0&&!X(e.input.charCodeAt(e.position));)e.position++;r.push(e.input.slice(a,e.position))}if(M(e.input.charCodeAt(e.position))&&Et(e),n==="YAML"){e.directives.some(i=>i.kind==="yaml")&&y(e,"duplication of %YAML directive"),r.length!==1&&y(e,"YAML directive accepts exactly one argument");let a=/^([0-9]+)\.([0-9]+)$/.exec(r[0]);a===null&&y(e,"ill-formed argument of the YAML directive"),parseInt(a[1],10)!==1&&y(e,"unacceptable YAML version of the document"),e.directives.push({kind:"yaml",version:r[0]})}else if(n==="TAG"){r.length!==2&&y(e,"TAG directive accepts exactly two arguments");let[a,i]=r;Pa.test(a)||y(e,"ill-formed tag handle (first argument) of the TAG directive"),Da.call(e.tagHandlers,a)&&y(e,`there is a previously declared suffix for "${a}" tag handle`),Cc.test(i)||y(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagHandlers[a]=i,e.directives.push({kind:"tag",handle:a,prefix:i})}return!0}function jc(e){e.directives=[],e.tagHandlers=Object.create(null);let t=!1;for($(e,!0);Uc(e);)t=!0,$(e,!0);let n=!1,r=!1,a=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&se(e.input.charCodeAt(e.position+3))){n=!0;let o=e.line;e.position+=3,$(e,!0),a=e.line>o}else t&&y(e,"directives end mark is expected");let i=e.events.length;if(!n&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&ge(e)){e.position+=3,$(e,!0);return}if(Tc(e,n,!1),ye(e,e.lineIndent-1,Tt,!1,a,a)||P(e),$(e,!0),e.position===e.lineStart&&ge(e)&&(r=e.input.charCodeAt(e.position)===46,r)){let o=e.line;e.position+=3,$(e,!0),e.line===o&&e.position=r.length));){let i=r.position;jc(r),r.position===i&&y(r,"can not read a document")}return r.events}function qc(e,t={}){let n={...Hc,...t},r=String(e),a=Object.keys(Bn),i=Object.keys(Fn);return Lc(Gc(r,ma(n,a)),{...ma(n,i),source:r})}function $e(e,t){let n=qc(e,t);if(n.length===0)throw new be("expected a document, but the input is empty");if(n.length===1)return n[0];throw new be("expected a single document in the stream, but found more")}var v,Zs,Js,Xs,eo,to,no,ro,ao,io,so,oo,co,lo,uo,fo,po,ho,Ta,yo,bo,wo,So,In,Co,To,Ea,_o,Io,Oo,Ro,Do,Nn,$o,Fo,jo,Go,Ho,Ko,Yo,Vo,Wo,Qo,Zo,It,Pn,Mu,tc,nc,rc,Ou,Ru,ac,be,C,O,le,q,sc,Ia,Na,hc,Oe,mc,Fn,w,Da,ze,Mn,za,Tt,wc,Sc,Pa,On,$a,Ac,kc,Cc,Bn,Hc,F,Kc,Du,zu,Pu,$u,Fu,Bu,Uu,ju,Gu,Hu,qu,Ku,Yu,Vu,Wu,Qu,Zu,Nt=L(()=>{v=Symbol("NOT_RESOLVED");Zs=z("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e=="string"}),Js=["","~","null","Null","NULL"],Xs=z("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>Js.indexOf(e)!==-1?null:v,identify:e=>e===null,represent:()=>"null"}),eo=z("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(e,t)=>e==="null"||t&&e===""?null:v,identify:e=>e===null,represent:()=>"null"}),to=["","~","null","Null","NULL"],no=z("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>to.indexOf(e)!==-1?null:v,identify:e=>e===null,represent:()=>"null"}),ro=["true","True","TRUE"],ao=["false","False","FALSE"],io=z("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:e=>ro.indexOf(e)!==-1?!0:ao.indexOf(e)!==-1?!1:v,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),so=["true"],oo=["false"],co=z("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:e=>so.indexOf(e)!==-1?!0:oo.indexOf(e)!==-1?!1:v,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),lo=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],uo=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],fo=z("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>lo.indexOf(e)!==-1?!0:uo.indexOf(e)!==-1?!1:v,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),po=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),ho=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");Ta=z("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:go,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),yo=new RegExp("^-?(?:0|[1-9][0-9]*)$"),bo=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");wo=z("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Lo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),So=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");In=z("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:ko,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Co=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),To=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");Ea=z("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Eo,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:xo}),_o=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Io=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");Oo=z("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:No,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Mo}),Ro=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Do=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");Nn=z("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:zo,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:Po}),$o=z("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(e,t)=>e==="<<"||t&&e===""?"<<":v,identify:()=>!1}),Fo=/^[A-Za-z0-9+/]*={0,2}$/;jo=z("tag:yaml.org,2002:binary",{resolve:Bo,identify:e=>Object.prototype.toString.call(e)==="[object Uint8Array]",represent:Uo}),Go=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ho=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");Ko=z("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:qo,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Yo=zn("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,t)=>{e.push(t)},identify:Array.isArray});Vo=zn("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(e,t)=>{let n;if(t instanceof Map){if(t.size!==1)return"cannot resolve an ordered map item";n=t.keys().next().value}else if(_t(t)){let r=Object.keys(t);if(r.length!==1)return"cannot resolve an ordered map item";n=r[0]}else return"cannot resolve an ordered map item";return e.seen.has(n)?"duplicate key in ordered map":(e.seen.add(n),e.list.push(t),"")},finalize:e=>e.list,identify:()=>!1}),Wo=zn("tag:yaml.org,2002:pairs",{create:()=>[],addItem:(e,t)=>{if(t instanceof Map)return t.size!==1?"cannot resolve a pairs item":(e.push(t.entries().next().value),"");if(Object.prototype.toString.call(t)!=="[object Object]")return"cannot resolve a pairs item";let n=t,r=Object.keys(n);return r.length!==1?"cannot resolve a pairs item":(e.push([r[0],n[r[0]]]),"")},identify:()=>!1}),Qo=xt("tag:yaml.org,2002:map",{create:()=>({}),identify:_t,represent:e=>{let t=new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{if(t!==null&&typeof t=="object")return"object-based map does not support complex keys";let r=String(t);return r==="__proto__"?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,""},has:(e,t)=>t!==null&&typeof t=="object"?!1:Object.prototype.hasOwnProperty.call(e,String(t)),keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}}),Zo=xt("tag:yaml.org,2002:set",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{let t=new Map;for(let n of e)t.set(n,null);return t},addPair:(e,t,n)=>n!==null?"cannot resolve a set item":(e.add(t),""),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:()=>null});It=class xa{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(t){let n=ec(t),r=[],a=Jo(),i=Xo();for(let l of n){if(l.nodeKind==="scalar"&&l.implicit){if(l.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");r.push(l)}switch(l.nodeKind){case"scalar":l.matchByTagPrefix?i.scalar.push(l):a.scalar[l.tagName]=l;break;case"sequence":l.matchByTagPrefix?i.sequence.push(l):a.sequence[l.tagName]=l;break;case"mapping":l.matchByTagPrefix?i.mapping.push(l):a.mapping[l.tagName]=l;break}}let s=r.filter(l=>l.implicitFirstChars===null),o=new Set;for(let l of r)if(l.implicitFirstChars!==null)for(let f of l.implicitFirstChars)o.add(f);let c=new Map;for(let l of o)c.set(l,r.filter(f=>f.implicitFirstChars===null||f.implicitFirstChars.indexOf(l)!==-1));let u=a.scalar["tag:yaml.org,2002:str"];if(!u)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=n,this.implicitScalarTags=r,this.implicitScalarByFirstChar=c,this.implicitScalarAnyFirstChar=s,this.defaultScalarTag=u,this.defaultSequenceTag=a.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=a.mapping["tag:yaml.org,2002:map"],this.exact=a,this.prefix=i}lookupScalarTag(t){let n=this.exact.scalar[t];if(n)return n;for(let r of this.prefix.scalar)if(t.startsWith(r.tagName))return r}lookupSequenceTag(t){let n=this.exact.sequence[t];if(n)return n;for(let r of this.prefix.sequence)if(t.startsWith(r.tagName))return r}lookupMappingTag(t){let n=this.exact.mapping[t];if(n)return n;for(let r of this.prefix.mapping)if(t.startsWith(r.tagName))return r}resolveImplicitScalarTag(t){let n=this.implicitScalarByFirstChar.get(t.charAt(0))??this.implicitScalarAnyFirstChar;for(let a of n){let i=a.resolve(t,!1,a.tagName);if(i!==v)return{value:i,tag:a}}let r=this.defaultScalarTag;return{value:r.resolve(t,!1,r.tagName),tag:r}}withTags(...t){let n=[];for(let r of t)n=n.concat(r);return new xa([...this.tags,...n])}},Pn=new It([Zs,Yo,Qo]),Mu=new It([...Pn.tags,eo,co,wo,Oo]),tc=new It([...Pn.tags,Xs,io,Ta,Ea]),nc=new It([...Pn.tags,no,fo,In,Nn,Ko,$o,jo,Vo,Wo,Zo]),rc=nc.withTags({...In,resolve:(e,t,n)=>{let r=In.resolve(e,t,n);return r===v?Ta.resolve(e,t,n):r}},{...Nn,resolve:(e,t,n)=>{let r=Nn.resolve(e,t,n);return r===v?Ea.resolve(e,t,n):r}}),Ou=xt("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(e,t,n)=>(e.set(t,n),""),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:(e,t)=>e.get(t),identify:e=>e instanceof Map||_t(e),represent:e=>{if(e instanceof Map)return e;let t=new Map,n=e;for(let r of Object.keys(n))t.set(r,n[r]);return t}});Ru=xt("tag:yaml.org,2002:map",{create:()=>({}),identify:_t,represent:e=>{let t=new Map;for(let n of Object.keys(e))t.set(n,e[n]);return t},addPair:(e,t,n)=>{let r=ga(t);return r===null?"nested arrays are not supported inside keys":(r==="__proto__"?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,"")},has:(e,t)=>{let n=ga(t);return n!==null&&Object.prototype.hasOwnProperty.call(e,n)},keys:e=>Object.keys(e),get:(e,t)=>{let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}}),ac={maxLength:79,indent:1,linesBefore:3,linesAfter:2};be=class _a extends Error{reason;mark;constructor(t,n){super(),this.name="YAMLException",this.reason=t,this.mark=n,this.message=ya(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(t){return`${this.name}: ${ya(this,t)}`}static throwAt(t,n,r,a=""){let i=0,s=0;for(let c=0;c{}},zu=C.DOCUMENT,Pu=C.SEQUENCE,$u=C.MAPPING,Fu=C.SCALAR,Bu=C.ALIAS,Uu=C.POP,ju=O.PLAIN,Gu=O.SINGLE_QUOTED,Hu=O.DOUBLE_QUOTED,qu=O.LITERAL_BLOCK,Ku=O.FOLDED_BLOCK,Yu=le.BLOCK,Vu=le.FLOW,Wu=q.CLIP,Qu=q.STRIP,Zu=q.KEEP});function ot(e){let t=at(e),n=t["metadata.yaml"];if(!n)throw new te("missing metadata.yaml");let r=$e(new TextDecoder().decode(n));if(r.format!=="imf-v1")throw new te(`unsupported format: ${String(r.format)}`);if(r.tokenizer!=="bytes")throw new te(`tokenizer ${String(r.tokenizer)}: this runtime is byte-level only`);if(!t["encoder.onnx"]||!t["decoder.onnx"])throw new te("missing encoder.onnx / decoder.onnx");return{format:"imf-v1",id:String(r.id),task:String(r.task),decoder:r.decoder===void 0?"plain":String(r.decoder),precision:r.precision===void 0?"fp32":String(r.precision),opset:r.opset===void 0?14:Number(r.opset),sha256:r.sha256??{}}}async function Yc(e){let t=new Uint8Array(e).buffer,n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function Mt(e){let t=ot(e),n=at(e),r=new Map;for(let[a,i]of Object.entries(n)){if(!a.endsWith(".onnx"))continue;let s=t.sha256[a];if(!s)throw new te(`${a} is not covered by metadata sha256`);let o=await Yc(i);if(o!==s)throw new te(`${a} sha256 mismatch: zip has ${o}, metadata says ${s}`);r.set(a,i)}return r}var te,Un=L(()=>{kn();Nt();te=class extends Error{}});async function ja(){if(globalThis.process?.versions?.node)return await import("node:fs")}function Vc(){let e=globalThis.process?.env,t=e?.HOME??e?.USERPROFILE??".";return e?.INTERSCRIPT_ML_CACHE??e?.SECRYST_CACHE??`${t}/.cache/interscript`}async function Wc(e){let t=await fetch(e);if(!t.ok)throw new R(`fetch failed: ${e} -> ${t.status}`);return new Uint8Array(await t.arrayBuffer())}async function Qc(e){if(e.startsWith("http://")||e.startsWith("https://")){let n=await Wc(e),r=await fetch(`${Hn(e)}.sha256`);if(!r.ok)throw new R(`index sha256 sidecar missing: ${e}.sha256 -> ${r.status}`);let a=(await r.text()).trim().split(/\s+/)[0];if(!a||!/^[0-9a-f]{64}$/i.test(a))throw new R(`index sha256 sidecar malformed: ${e}.sha256`);let i=await Fe(n);if(i!==a.toLowerCase())throw new R(`index sha256 mismatch: got ${i}, sidecar says ${a.toLowerCase()}`);return jn(new TextDecoder().decode(n))}let t=new TextDecoder().decode((await ja()).readFileSync(e));return jn(t)}function jn(e){let t=$e(e);if(t.version!==1)throw new R("index must have version: 1");let n={};for(let[r,a]of Object.entries(t.models??{})){let i={filename:a.filename,url:a.url??"",sha256:a.sha256},s=a.parts;s&&(i.parts=s),n[r]=i}return n}async function Fe(e){let t=await crypto.subtle.digest("SHA-256",new Uint8Array(e).buffer);return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function Zc(e,t){if(t.startsWith("file://")){if(!e)throw new R("file:// parts require a Node host");return e.readFileSync(t.replace(/^file:\/\//,""))}return new Uint8Array(await(await fetch(t)).arrayBuffer())}async function Ua(e,t,n){let r=e.parts;for(let a=0;a"u"))try{let t=await fetch(Hn(e));t.ok&&await(await caches.open(Ga)).put(e,t.clone())}catch{}}async function Xc(e){let t=await Ha();if(!t)return;let n=await t.match(e);if(n)try{return await jn(new TextDecoder().decode(new Uint8Array(await n.arrayBuffer())))}catch{return}}async function el(e,t){try{let n=await e.keys(),r=new Set(Object.entries(t).map(([a,i])=>ct(a,i.filename)));for(let a of n){let i=String(a.url??a);i.startsWith("https://imf.interscript.org/cache/")&&!r.has(i)&&await e.delete(i)}}catch{}}async function tl(e,t){if(!t)return new Uint8Array(await(await fetch(e)).arrayBuffer());let n=[],r=0,a=0;for(let o=0;o<5;o++){let c;try{c=await fetch(e,r>0?{headers:{range:`bytes=${r}-`}}:{})}catch{continue}if(!c.ok&&c.status!==206)throw new R(`fetch failed: ${e} -> ${c.status}`);r===0?a=Number(c.headers.get("content-length")??0):c.status!==206&&(n.length=0,r=0,a=Number(c.headers.get("content-length")??0));let u=c.body?.getReader();if(!u)continue;let l=!1;for(;;)try{let{done:f,value:p}=await u.read();if(f)break;n.push(p),r+=p.length,t(a>0?Math.min(1,r/a):0,r)}catch{l=!0;break}if(!l)break}if(r===0)throw new R(`fetch produced zero bytes (5 attempts): ${e}`);let i=new Uint8Array(r),s=0;for(let o of n)i.set(o,s),s+=o.length;return i}function Hn(e){for(let t of[nl,al])if(e.startsWith(t))return rl+e.slice(t.length);return e}function ct(e,t){return`https://imf.interscript.org/cache/${e}/${t}`}async function Ha(){if(!(typeof caches>"u"))return await caches.open(Ga)}async function Ot(e,t,n={}){let r=globalThis.process?.env,a=t??r?.INTERSCRIPT_ML_INDEX??r?.SECRYST_INDEX??Gn,i;try{i=await Qc(a),await Jc(a)}catch(p){let d=await Xc(a);if(!d)throw p;i=d}let s=i[e];if(!s)throw new R(`unknown model id '${e}' (known: ${Object.keys(i).sort().join(", ")})`);let o=await ja(),c=`${Vc()}/models/${e}/${s.filename}`;if(o?.existsSync(c)){let p=o.readFileSync(c);if(await Fe(p)===s.sha256)return{bytes:p,path:c}}let u=await Ha();if(u){let p=await u.match(ct(e,s.filename));if(p){let d=new Uint8Array(await p.arrayBuffer());if(await Fe(d)===s.sha256)return{bytes:d};await u.delete(ct(e,s.filename))}await el(u,i)}if(s.parts?.length){if(o){let{createHash:m}=await import("node:crypto"),S=m("sha256"),T=c.substring(0,c.lastIndexOf("/"));o.mkdirSync(T,{recursive:!0});let x=`${c}.part.${globalThis.process?.pid??0}`;o.writeFileSync(x,new Uint8Array(0)),await Ua(s,o,_=>{S.update(_),o.appendFileSync(x,_)});let U=S.digest("hex");if(U!==s.sha256)throw new R(`assembled ${s.filename} sha256 mismatch: got ${U}, index says ${s.sha256}`);return o.renameSync(x,c),{bytes:o.readFileSync(c),path:c}}let p=[],d=0;await Ua(s,o,m=>{p.push(m),d+=m.length});let h=new Uint8Array(d),g=0;for(let m of p)h.set(m,g),g+=m.length;let b=await Fe(h);if(b!==s.sha256)throw new R(`assembled ${s.filename} sha256 mismatch: got ${b}, index says ${s.sha256}`);return u&&await u.put(ct(e,s.filename),new Response(h)),{bytes:h}}let l=s.url.startsWith("file://")?o.readFileSync(s.url.replace(/^file:\/\//,"")):await tl(Hn(s.url),n.onProgress),f=await Fe(l);if(f!==s.sha256)throw new R(`downloaded ${s.filename} sha256 mismatch: got ${f}, index says ${s.sha256}`);if(o){let p=c.substring(0,c.lastIndexOf("/"));o.mkdirSync(p,{recursive:!0});let d=`${c}.part.${globalThis.process?.pid??0}`;return o.writeFileSync(d,l),o.renameSync(d,c),{bytes:l,path:c}}return u&&await u.put(ct(e,s.filename),new Response(l)),{bytes:l}}var Gn,R,nl,rl,al,Ga,qn=L(()=>{Nt();Gn="https://github.com/interscript/interscript-models/releases/download/index-v12/models-index.yaml",R=class extends Error{};nl="https://github.com/interscript/interscript-models/releases/download/",rl="https://api.interscript.org/v1/assets/",al="https://github.com/interscript/interscript-ml/releases/download/";Ga="interscript-imf-models-v1"});function ue(e){let t=il.encode(e),n=new Array(t.length+1);for(let r=0;rt.length>0).map(t=>t.split("/")[0]).join(" ")}var qa,we,ne,Ka,il,sl,lt=L(()=>{qa=3,we=0,ne=1,Ka=2,il=new TextEncoder,sl=new TextDecoder("utf-8",{fatal:!1})});function Be(e){let t=e.replace(ol,"");for(let[n,r]of cl)t=t.replaceAll(n,r);return t}function fe(e,t){if(e.length>=2*Ya){let n=e.join(","),r=e.slice(-Ya).join(",");if(n.indexOf(r)=Va*Wa){let n=t.slice(-Va),r=0,a=t.indexOf(n);for(;a!==-1;)r++,a=t.indexOf(n,a+1);if(r>=Wa)return!0}return!1}var ol,cl,Ya,Va,Wa,Dt=L(()=>{ol=/[ً-ْٰٓ-ٕٖ-ٟۖ-ۭ]/g,cl=[["\uFEF5","\u0644\u0622"],["\uFEF6","\u0644\u0622"],["\uFEF7","\u0644\u0623"],["\uFEF8","\u0644\u0623"],["\uFEF9","\u0644\u0625"],["\uFEFA","\u0644\u0625"],["\uFEFB","\u0644\u0627"],["\uFEFC","\u0644\u0627"]];Ya=24,Va=16,Wa=3});function ll(e,t=1400){if(new TextEncoder().encode(e).length<=t)return[e];let n=[],r=[],a=0;for(let i of e.split(/\s+/).filter(s=>s!=="")){let s=new TextEncoder().encode(i).length+1;r.length>0&&a+s>t&&(n.push(r.join(" ")),r=[],a=0),r.push(i),a+=s}return r.length>0&&n.push(r.join(" ")),n}async function zt(e,t,n,r={}){let a=ll(t);if(a.length<=1)return e.translateDirect(t,n,r);let i=[];for(let s of a)i.push(await e.translateDirect(s,n,r));return i.join(" ")}var Kn=L(()=>{});var Pt,Qa=L(()=>{_e();Un();qn();Dt();lt();Kn();Pt=class e{id;manifest;encoder;decoder;kv;pasts;constructor(t,n,r){this.manifest=t,this.id=t.id,this.encoder=n,this.decoder=r,this.kv=t.decoder==="kv"&&r.inputNames.some(a=>a.startsWith("past_")),this.pasts=this.kv?this.zeroPastSpecs():[]}static async fromZipBytes(t){let n=ot(t),r=await Mt(t),a=await Z(r.get("encoder.onnx")),i=n.decoder==="kv"&&r.has("decoder-kv.onnx")?"decoder-kv.onnx":"decoder.onnx",s=await Z(r.get(i));return new e(n,a,s)}static async load(t,n){if(t instanceof Uint8Array)return e.fromZipBytes(t);if(t.endsWith(".zip")){let a=await import("node:fs");return e.fromZipBytes(a.readFileSync(t))}let r=await Ot(t,n);return e.fromZipBytes(r.bytes)}async translate(t,n=256,r={}){return zt(this,t,n,r)}async translateDirect(t,n=256,r={}){let a=await this.encode(t,r);if(!a)return"";let i=this.kv?await this.greedyKv(a,n,r):await this.greedyPlain(a,n,r);return Rt(re(i))}async encode(t,n={}){let r=n.raw===!0?t:Be(t),a=ue(r);return a.length===1?null:this.runEncoder(a)}cursor(t){let{decoder:n,kv:r}=this,a=(d,h)=>this.argmaxAt(d,h),i=d=>this.pastTensors(r?d:void 0),s=this.pasts,o=async d=>{let h=await n.run({input_ids:{name:"input_ids",type:"int64",data:new BigInt64Array(d.map(S=>BigInt(S))),dims:[1,d.length]},encoder_hidden_states:{name:"encoder_hidden_states",type:t.type,data:t.data,dims:t.dims},...i(l)}),g=h.logits,b=d.map((S,T)=>a(g,T).token),m=r?new Map(s.map(S=>[S.name,h[S.name.replace("past_","present_")]])):new Map;return{argmaxes:b,presents:m,logits:g}},c=0,u=-1,l,f=[],p=d=>{let h=new Map;for(let[g,b]of l??[]){let[m,S,T,x]=b.dims,U=b.data,_=U.constructor,Ye=new _(S*d*x),Ve=T*x;for(let W=0;Wa(g.logits,h+S).token);return u=a(g.logits,f.length-1).token,b},rewindToLen(d){r?l=p(d):f=f.slice(0,d),c=d,u=-1}}}async dispose(){await this.encoder.dispose(),await this.decoder.dispose()}async runEncoder(t){return(await this.encoder.run({input_ids:{name:"input_ids",type:"int64",data:new BigInt64Array(t.map(r=>BigInt(r))),dims:[1,t.length]}})).last_hidden_state}zeroPastSpecs(){let t=[],n=this.decoder.inputMetadata;for(let r of this.decoder.inputNames){if(!r.startsWith("past_"))continue;let a=6,i=64,s=n?.find(o=>o.name===r);s&&typeof s.shape[1]=="number"&&(a=s.shape[1]),s&&typeof s.shape[3]=="number"&&(i=s.shape[3]),t.push({name:r,dims:[1,a,0,i]})}return t}pastTensors(t){let n={};for(let r of this.pasts){let a=t?.get(r.name);a?n[r.name]={name:r.name,type:a.type,data:a.data,dims:a.dims}:n[r.name]={name:r.name,type:"float32",data:new Float32Array(0),dims:[...r.dims]}}return n}argmaxLastStep(t){return this.argmaxAt(t,t.dims[t.dims.length-2]-1)}argmaxAt(t,n){let r=t.dims,a=r[r.length-1],i=t.data,s=n*a,o=0,c=-1/0,u=-1/0;for(let l=0;lc?(u=c,c=f,o=l):f>u&&(u=f)}return{token:o,gap:c-u}}async greedyKv(t,n,r={}){let a=[],i=[0],s;for(let o=0;oBigInt(f))),dims:[1,i.length]},encoder_hidden_states:{name:"encoder_hidden_states",type:t.type,data:t.data,dims:t.dims},...this.pastTensors(s)}),{token:u,gap:l}=this.argmaxLastStep(c.logits);if(u===1||(a.push(u),r.onToken?.(u,o),r.onConfidence?.(l,o),fe(a,re(a))))break;s=new Map(this.pasts.map(f=>[f.name,c[f.name.replace("past_","present_")]])),i=[u]}return a}async greedyPlain(t,n,r={}){let a=[],i=[0];for(let s=0;sBigInt(l))),dims:[1,i.length]},encoder_hidden_states:{name:"encoder_hidden_states",type:t.type,data:t.data,dims:t.dims}}),{token:c,gap:u}=this.argmaxLastStep(o.logits);if(c===1||(a.push(c),i.push(c),r.onToken?.(c,s),r.onConfidence?.(u,s),fe(a,re(a))))break}return a}}});function ul(e,t){let n=(2166136261^t)>>>0;for(let r of e)n=Math.imul(n^r,16777619)>>>0;return n>>>0}function Za(e,t=Yn){let n=[];for(let r=0;r=i){let s=[];for(let c=r+1-i;c<=r;c++)s.push(e[c]-3&255);let o=ul(s,t.indexOf(i)+1);a.push(o===0?1:o)}else a.push(0);n.push(a)}return n}var Yn,Ja=L(()=>{Yn=[2,3,4]});function Vn(e,t){for(let n=0;n{Dt();lt();Kn();$t=class{drafter;verifier;blockSize;lastStats;lastNormalized;constructor(t,n,r={}){this.drafter=t,this.verifier=n,this.blockSize=r.blockSize??8}stats(){return this.lastStats}lastNormalizedInput(){return this.lastNormalized}async translate(t,n=256,r={}){return zt(this,t,n,r)}async translateDirect(t,n=256,r={}){let a=r.raw===!0?t:Be(t);if(this.lastNormalized=a,ue(a).length===1)return"";let i=await this.drafter.encode(a,{raw:!0}),s=await this.verifier.encode(a,{raw:!0});if(!i||!s)return"";let o=this.drafter.cursor(i),c=this.verifier.cursor(s),u=await o.seed(),l=await c.seed(),f=[],p={blocks:0,drafted:0,accepted:0,bonus:0};for(;f.lengthtypeof s=="string"?{id:s}:s);if(n.length===0)throw new Error("no tier candidates");let r=t===void 0?!0:t>=4,a=n.find(s=>/-int8$/.test(s.id));return r&&a?a.id:[...n].sort((s,o)=>(s.size??0)-(o.size??0))[0].id}async function ti(e){await e.translate("\u0643",8).catch(()=>{})}var ni=L(()=>{});var Wn={};ke(Wn,{BYTE_OFFSET:()=>qa,DEFAULT_INDEX_URL:()=>Gn,DEFAULT_ORDERS:()=>Yn,EOS_ID:()=>ne,IMFError:()=>te,IMFModel:()=>Pt,PAD_ID:()=>we,RegistryError:()=>R,SpeculativeModel:()=>$t,UNK_ID:()=>Ka,acceptBlock:()=>Vn,decode:()=>re,encode:()=>ue,firstAlternates:()=>Rt,ngramAddresses:()=>Za,normalizeArabicInput:()=>Be,parseManifest:()=>ot,pickTier:()=>ei,repetitionGuardCut:()=>fe,resolve:()=>Ot,verifyAndRead:()=>Mt,warmUp:()=>ti});var ri=L(()=>{Qa();Ja();Xa();Un();qn();ni();Dt();lt()});var ai=L(()=>{tt();mn();fn();dn();un();Ie();ce("rababa",async e=>At(e))});function Qn(e){let t=e.split(` +`),n=null,r=[],a=[];for(let i of t){let s=i.trimEnd();if(s==="input:"){n="input";continue}if(s==="target:"){n="target";continue}let o=s.match(/^\s+-\s+"?(.+?)"?\s*$/);if(o&&n){let c=o[1];n==="input"?r.push(c):a.push(c)}}return{input:r,target:a}}function Zn(e){return{input:new ut(e.input),target:new ut(e.target)}}var ut,Jn=L(()=>{ut=class{stoi;itos;length;constructor(t,n=[]){let r=[...n,...t];this.itos=r,this.stoi=Object.freeze(Object.fromEntries(r.map((a,i)=>[a,i]))),this.length=r.length}encode(t){return this.stoi[t]??-1}decode(t){return this.itos[t]??""}encodeSequence(t){return Array.from(t).map(n=>this.encode(n))}decodeSequence(t){return t.map(n=>this.decode(n)).join("")}}});function ii(e){let t=new Uint8Array(e*e);for(let n=0;nn===t?0:1))}function er(e,t,n,r){let a=ii(t),i=Xn(n),s=Xn(r);return{tgt_mask:{name:"tgt_mask",type:"int8",data:a,dims:[t,t]},src_key_padding_mask:{name:"src_key_padding_mask",type:"int8",data:i,dims:[1,e]},tgt_key_padding_mask:{name:"tgt_key_padding_mask",type:"int8",data:s,dims:[1,t]},memory_key_padding_mask:{name:"memory_key_padding_mask",type:"int8",data:i,dims:[1,e]}}}var tr=L(()=>{});async function ci(e){let t=e.artifacts["vocabs.yaml"];if(!t)throw new Error("Secryst model missing vocabs.yaml");let n=typeof t=="string"?t:new TextDecoder().decode(t),r=Qn(n),{input:a,target:i}=Zn(r);return new nr(e.session,a,i)}var pl,si,oi,nr,li=L(()=>{Jn();tr();pl=100,si="",oi="",nr=class{kind="secryst";session;inputVocab;targetVocab;constructor(t,n,r){this.session=t,this.inputVocab=n,this.targetVocab=r}async translate(t,n=pl){let r=[this.inputVocab.encode(si),...this.inputVocab.encodeSequence(t),this.inputVocab.encode(oi)].filter(s=>s>=0),a=[this.targetVocab.encode(si)],i=this.targetVocab.encode(oi);for(let s=0;sBigInt(m))),dims:[1,r.length]},tgt:{name:"tgt",type:"int64",data:new BigInt64Array(a.map(m=>BigInt(m))),dims:[1,a.length]},...o},l=(await this.session.run(c))[this.session.outputNames[0]];if(!l)throw new Error("Secryst model produced no output");let f=l.dims,p=f[f.length-1],d=l.data,h=s*p,g=0,b=-1/0;for(let m=0;mb&&(b=S,g=m)}if(g===i)break;a.push(g)}return this.targetVocab.decodeSequence(a.slice(1))}async transform(t){let n=t.split(` `),r=[];for(let a of n)r.push(await this.translate(a));return r.join(` -`)}async dispose(){await this.session.dispose()}}});var Ht=d(()=>{le();Gt();Fe();He();z("secryst",async e=>qt(e))});var Vt={};B(Vt,{artifactUrls:()=>H,createSession:()=>R,detectBackend:()=>ke,getModelBase:()=>oe,loadManifest:()=>De,loadModel:()=>jt,registerModel:()=>z,registeredKinds:()=>$t,resetModels:()=>Dt,resolveManifestEntry:()=>G,setInlineManifest:()=>Ct,setManifestUrl:()=>It,setModelBase:()=>Et,sidecarFilenames:()=>ie});var Kt=d(()=>{le();ne();je();Be();Bt();Ht()});import{createYoga as gr,createSchema as br}from"graphql-yoga";import{Hono as yr}from"hono";import{cors as Lr}from"hono/cors";var Le=` +`)}async dispose(){await this.session.dispose()}}});var ui=L(()=>{tt();li();Jn();tr();ce("secryst",async e=>ci(e))});async function dl(e){let t=await crypto.subtle.digest("SHA-256",new Uint8Array(e).buffer);return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}function hl(e){let t=at(e),n=t["metadata.yaml"];if(!n)throw new ae("plane zip: metadata.yaml missing");let r=$e(new TextDecoder().decode(n));if(r.kind!=="plane")throw new ae(`plane zip: kind=${String(r.kind)}, expected 'plane'`);let a=r.members??{};for(let i of["plane.onnx","classes.json"]){if(!t[i])throw new ae(`plane zip: ${i} missing`);if(!a[i])throw new ae(`plane zip: ${i} has no sha256 in metadata`)}return{manifest:{id:String(r.id??""),kPasses:Number(r.k_passes??2),members:a},files:t}}function fi(e,t){let n=new BigInt64Array(t.length);for(let r=0;ra&&(a=s,r=i)}return r}function di(e){return new TextEncoder().encode(e).length}function pi(e,t,n,r){let a=r.length,i=0,s=[];return e.forEach((o,c)=>{let u=di(o),l=t[c]??"";if(l===""){let f=[];for(let p=i;p0){let p=new Map;f.forEach(g=>p.set(g,(p.get(g)??0)+1));let d=f[0],h=-1;p.forEach((g,b)=>{g>h&&(h=g,d=b)}),l=d{kn();Nt();_e();lt();ae=class extends Error{};pe=class e{kind="plane";classes;kPasses;session;markChars;classToId;constructor(t,n,r){this.session=t,this.classes=n,this.kPasses=r,this.markChars=new Set(n.flatMap(a=>Array.from(a))),this.classToId=new Map(n.map((a,i)=>[a,i]))}static async fromZip(t){let{manifest:n,files:r}=hl(t);for(let s of["plane.onnx","classes.json"]){let o=await dl(r[s]);if(o!==n.members[s])throw new ae(`plane zip: ${s} sha256 mismatch (${o})`)}let a=JSON.parse(new TextDecoder().decode(r["classes.json"])),i=await Z(r["plane.onnx"]);return new e(i,a,n.kPasses)}dispose(){return this.session.dispose()}splitPlanes(t){let n=[],r=[],a=[],i=()=>{a.length!==0&&(n.length===0?(n.push("\0"),r.push(a.join(""))):r[r.length-1]=r[r.length-1]+a.join(""),a=[])};for(let s of t){if(this.markChars.has(s)){a.push(s);continue}i(),n.push(s),r.push("")}return i(),{skeleton:n,classes:r}}async decodePinned(t,n){let r=ue(t.join(""));r.pop();let a=[],i=this.classes.length;t.forEach((c,u)=>{let l=n[u],f=l===void 0||l===""?i:this.classToId.get(l)??i;for(let p=0;p{c!==i&&s.push(u)});let o=r.map(()=>i);s.forEach(c=>{o[c]=a[c]});for(let c=0;c{d[h]=a[h]}),o=d}return o}async transform(t,n={}){if(!n.preserveDiacritics){let s=await this.decodePinned(Array.from(t),[]);return pi(Array.from(t),Array.from(t).map(()=>""),s,this.classes)}let{skeleton:r,classes:a}=this.splitPlanes(t),i=await this.decodePinned(r,a);return pi(r,a,i,this.classes)}}});var ar=L(()=>{tt();rr();rr();ce("plane",async e=>{let t=e.artifacts["plane.zip"];if(!(t instanceof Uint8Array))throw new Error("plane factory: artifacts must carry plane.zip bytes");return pe.fromZip(t)})});var hi={};ke(hi,{PlaneError:()=>ae,PlaneModel:()=>pe,createPlaneModel:()=>ft,createSession:()=>Z,detectBackend:()=>sn,imf:()=>Wn,loadModel:()=>aa,registerModel:()=>ce,registeredKinds:()=>ia,resetModels:()=>sa});var ir=L(()=>{tt();_e();ri();ai();ui();ar();ar()});import{createYoga as Gl,createSchema as Hl}from"graphql-yoga";import{Hono as ql}from"hono";import{cors as Kl}from"hono/cors";var en=` type DetectionResult { mapName: String distance: Float @@ -13,7 +30,7 @@ var hn=Object.defineProperty;var d=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&( transliterate(systemCode: String!, input: String!): String detect(input: String!, output: String!): [DetectionResult] } -`;import{Hono as fr}from"hono";var L=class extends Error{cause;constructor(t,n){super(t,n),this.name=new.target.name,this.cause=n?.cause}},g=class extends L{systemCode;constructor(t){super(`Map not found: ${t}`),this.systemCode=t}},M=class extends L{},A=class extends L{},C=class extends L{dependency;constructor(t){super(`Map dependency missing: ${t}`),this.dependency=t}};var X=class{strategies;cache=new Map;known=new Map;options;constructor(t,n={}){this.strategies=t,this.options=n}load(t){let n=this.cache.get(t);if(n)return n;let r=this.known.get(t);if(r)return this.cache.set(t,r),r;for(let a of this.strategies){let s=a(t);if(s&&typeof s.then!="function"){let o=s;return this.cache.set(t,o),this.known.set(t,o),this.options.onLoaded?.(t,o),o}}throw new g(t)}async loadAsync(t){let n=this.cache.get(t);if(n)return n;let r=this.known.get(t);if(r)return this.cache.set(t,r),r;for(let a of this.strategies){let s=await a(t);if(s)return this.cache.set(t,s),this.known.set(t,s),this.options.onLoaded?.(t,s),s}throw new g(t)}clear(){this.cache.clear()}loadedMaps(){return Array.from(this.known.keys())}register(t,n){this.known.set(t,n),this.cache.set(t,n)}};var P=class e{current;map;loader;aliasCache=new Map;functions;constructor(t,n,r){this.map=t,this.current=n,this.functions=t.functions,this.loader=r}resolveAlias(t){if(this.aliasCache.has(t))return this.aliasCache.get(t);let n=this.map.aliases.get(t);if(!n&&this.loader)for(let r of this.map.dependencies)try{let s=this.loader.load(r).aliases.get(t);if(s){n=s;break}}catch{}return n&&this.aliasCache.set(t,n),n}withMap(t){return new e(t,this.current,this.loader)}loadDependency(t){if(!this.loader)throw new Error(`Cannot resolve dependency ${t}: no loader configured`);return this.loader.load(t)}};function we(){return{children:new Map,match:null}}function et(e){let t=we();for(let[n,r]of e){if(n.length===0)continue;let a=t;for(let c=0;c0?(n+=c,a+=o):(n+=e[a],a+=1)}return n}function U(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nt(e){return e.toLowerCase()}function rt(e){return e.toUpperCase()}function at(e,t={}){let n=t.wordSeparator??" ";return n===""?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.split(n).map(r=>r.length===0?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(n)}function st(e,t={}){let n=t.separator??" ";return e.split("").join(n)}function ot(e){return e.normalize("NFC")}function it(e){return e.normalize("NFD")}function ct(e,t){if(t.length===0)return e;let n=t.map((a,s)=>`(?<__r${s}>${a.pattern})`),r=new RegExp(n.join("|"),"gmu");return e.replace(r,(...a)=>{let s=a[a.length-1];for(let o=0;om(a,t).re),r=e.of.length>0?m(e.of[0],t).literal:"";return{re:`(?:${n.join("|")})`,literal:r}}case"any_char_class":{if(e.range){let[n,r]=e.range;return{re:`[${U(n)}-${U(r)}]`,literal:n??""}}return e.chars&&e.chars.length>0?{re:`[${e.chars.map(r=>U(r)).join("")}]`,literal:e.chars[0]}:{re:"[^]",literal:""}}case"group":{let n=e.items.map(s=>m(s,t)),r=n.map(s=>s.re).join(""),a=n.map(s=>s.literal).join("");return{re:`(?:${r})`,literal:a}}case"repeat":{let n=m(e.item,t).re,{min:r,max:a}=e,s=a===null?1/0:a,o=s===1/0?r===0?"*":"+":`{${r},${s}}`;return{re:`(?:${n})${o}`,literal:""}}case"stage_ref":return{re:"",literal:""}}}function F(e,t){switch(e.kind){case"string":return e.value;case"alias":{let n=Z[e.name];if(n)return n.literal===""?null:n.literal;let r=t.resolveAlias(e.name);return r?F(r,t):null}case"capture_group":case"capture_ref":case"repeat":case"stage_ref":return null;case"any_char_class":return e.chars&&e.chars.length>0?e.chars[0]:e.range?e.range[0]:null;case"any":return e.of.length===0?null:F(e.of[0],t);case"group":{let n="";for(let r of e.items){let a=F(r,t);if(a===null)return null;n+=a}return n}}}function I(e,t){switch(e.kind){case"string":return[e.value];case"alias":{if(Z[e.name])return null;let r=t.resolveAlias(e.name);return r?I(r,t):null}case"any_char_class":{if(e.chars)return[...e.chars];if(e.range){let[n,r]=e.range,a=n.codePointAt(0),s=r.codePointAt(0),o=[];for(let c=a;c<=s;c++)o.push(String.fromCodePoint(c));return o}return null}case"any":{let n=[];for(let r of e.of){let a=I(r,t);if(a===null)return null;n.push(...a)}return n}case"group":{let n=[""];for(let r of e.items){let a=I(r,t);if(a===null)return null;let s=[];for(let o of n)for(let c of a)s.push(o+c);n=s}return n}default:return null}}function w(e,t){switch(e.kind){case"string":return e.value.length;case"capture_group":return w(e.data,t);case"capture_ref":return 1;case"alias":{if(e.name==="none")return 0;if(Z[e.name])return 1;let n=t.resolveAlias(e.name);return n?w(n,t):1}case"any":return e.of.reduce((n,r)=>Math.max(n,w(r,t)),0);case"any_char_class":return 1;case"group":return e.items.reduce((n,r)=>n+w(r,t),0);case"repeat":return w(e.item,t);case"stage_ref":return 1}}var Z=Object.freeze({any_character:{re:".",literal:""},none:{re:"",literal:""},space:{re:" ",literal:" "},whitespace:{re:"\\s+",literal:" "},boundary:{re:"(?:(?at(e,t??{}),separate:(e,t)=>st(e,t??{}),compose:ot,decompose:it};function lt(e,t){let n=e.functions.get(t)?.impl;if(n)return n;let r=gn[t];if(r)return r}var bn={sub:(e,t)=>yn(e,t),run:(e,t)=>{let n=e.docName?t.loadDependency(e.docName):t.map,r=n.stages.find(s=>s.name===e.stage);if(!r)throw new A(`Stage not found: ${e.stage}`);let a=t.withMap(n);for(let s of r.rules)T(s,a);t.current=a.current},funcall:(e,t)=>{let n=lt(t,e.name);if(!n)throw new A(`Unknown function: ${e.name}`);t.current=n(t.current,e.kwargs??{})},parallel:(e,t)=>{let n=[],r=[];for(let o of e.rules)o.kind==="sub"&&o.from?n.push(o):r.push(o);let a=o=>!o.before&&!o.after&&!o.notBefore&&!o.notAfter&&I(o.from,t)!==null;if(n.some(o=>!a(o))){let c=n.map((i,l)=>({rule:i,idx:l,len:w(i.from,t)+(i.before?w(i.before,t):0)+(i.after?w(i.after,t):0)+(i.notBefore?w(i.notBefore,t):0)+(i.notAfter?w(i.notAfter,t):0)+(i.priority??0)})).sort((i,l)=>l.len-i.len||i.idx-l.idx).map(({rule:i})=>{let l=m(i.from,t),p=i.before?m(i.before,t).re:"",u=i.after?m(i.after,t).re:"",S=i.notBefore?m(i.notBefore,t).re:"",y=i.notAfter?m(i.notAfter,t).re:"",x=[p?`(?<=${p})`:"",S?`(?pt(v,f,Y):v}});t.current=ct(t.current,c)}else{let o=[];for(let c of n){if(c.to&&c.to.kind==="funcall_inline")continue;let i=c.to?F(c.to,t):"";if(i===null)continue;let l=I(c.from,t);if(l!==null)for(let p of l)o.push([p,i])}o.length>0&&(t.current=tt(t.current,et(o)))}for(let o of r)T(o,t)},sequential:(e,t)=>{for(let n of e.rules)T(n,t)}};function yn(e,t){if(!e.from)throw new A("Sub rule missing 'from'");let n=m(e.from,t),r=e.before?m(e.before,t).re:"",a=e.after?m(e.after,t).re:"",s=e.notBefore?m(e.notBefore,t).re:"",o=e.notAfter?m(e.notAfter,t).re:"",c=[];r&&c.push(`(?<=${r})`),s&&c.push(`(?{let p=l;return(u,...S)=>pt(p,u,S)})():l)}function pt(e,t,n){return e.replace(/\$(\d+)/g,(r,a)=>{let s=parseInt(a,10);return n[s-1]??t})}function dt(e,t){if(!e)return"";if(e.kind==="funcall_inline"){let r=lt(t,e.name);if(!r)throw new A(`Unknown inline function: ${e.name}`);return a=>r(a)}return m(e,t).literal}function T(e,t){let n=bn[e.kind];n(e,t)}var Ke=new Set(["rababa","secryst"]);function Wt(e){for(let t of e){if(t.kind==="funcall"&&Ke.has(t.name))return!0;if(t.kind==="parallel"||t.kind==="sequential"){for(let n of t.rules)if(n.kind==="funcall"&&Ke.has(n.name))return!0}}return!1}function W(e,t,n,r){let a=e.stages.find(o=>o.name===t);if(!a)return n;if(Wt(a.rules))throw new Error(`Stage "${t}" contains ML function calls (rababa/secryst). Use transliterateAsync() instead of transliterate().`);let s=new P(e,n,r);for(let o of a.rules)T(o,s);return s.current}async function Qt(e,t,n,r){let a=e.stages.find(o=>o.name===t);if(!a)return n;if(!Wt(a.rules))return W(e,t,n,r);let s=new P(e,n,r);for(let o of a.rules)await er(o,s);return s.current}async function er(e,t){if(e.kind==="funcall"){await tr(e,t);return}T(e,t)}async function tr(e,t){if(e.name==="rababa"){let{rababa:n}=await Promise.resolve().then(()=>(xt(),_t));t.current=await n(t.current,e.kwargs);return}if(Ke.has(e.name)){let{loadModel:n}=await Promise.resolve().then(()=>(Kt(),Vt)),r=e.kwargs?.config??e.kwargs?.model??"default",a=await n({kind:e.name,id:r});t.current=await a.transform(t.current);return}T({kind:"funcall",name:e.name,kwargs:e.kwargs},t)}function nr(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=new Array(t.length+1),r=new Array(t.length+1);for(let a=0;a<=t.length;a++)n[a]=a;for(let a=1;a<=e.length;a++){r[0]=a;for(let s=1;s<=t.length;s++){let o=e[a-1]===t[s-1]?0:1;r[s]=Math.min(n[s]+1,r[s-1]+1,n[s-1]+o)}[n,r]=[r,n]}return n[t.length]}function rr(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function Jt(e,t,n,r={},a){let s=[],o=r.mapPattern?rr(r.mapPattern):null,c=a??n.loadedMaps();for(let i of c){if(o&&!o.test(i))continue;let l;try{let p=n.load(i);l=W(p,"main",e,n)}catch(p){if(p instanceof L)continue;throw p}s.push({mapName:i,distance:nr(l,t)})}return s.sort((i,l)=>i.distance-l.distance)}function We(e){let t={schemaVersion:e.schemaVersion,systemCode:e.systemCode,dependencies:e.dependencies,stages:e.stages,aliases:new Map(Object.entries(e.aliases)),functions:new Map};return e.metadata&&(t.metadata=e.metadata),t}var ar="main",de=class{loader;defaultStage;constructor(t={}){this.loader=new X(t.strategies??[]),this.defaultStage=t.defaultStage??ar}loadMap(t){let n=this.loader.load(t);for(let r of n.dependencies)try{this.loader.load(r)}catch(a){throw a instanceof g?new C(r):a}return n}async loadMapAsync(t){let n=await this.loader.loadAsync(t),r=new Set,a=[...n.dependencies];for(;a.length>0;){let s=a.shift();if(!r.has(s)){r.add(s);try{let o=await this.loader.loadAsync(s);for(let c of o.dependencies)r.has(c)||a.push(c)}catch(o){throw o instanceof g?new C(s):o}}}return n}transliterate(t,n,r){try{let a=this.loadMap(t),s=r??this.defaultStage;return W(a,s,n,this.loader)}catch(a){throw a instanceof L?a:new M(`Transliteration failed for ${t}: ${a.message}`,{cause:a})}}async transliterateAsync(t,n,r){try{let a=await this.loadMapAsync(t),s=r??this.defaultStage;return await Qt(a,s,n,this.loader)}catch(a){throw a instanceof L?a:new M(`Transliteration failed for ${t}: ${a.message}`,{cause:a})}}loadedMaps(){return this.loader.loadedMaps()}getLoader(){return this.loader}detect(t,n,r={},a){return Jt(t,n,this.loader,r,a)}},pe;function Yt(e){pe=new de(e)}function sr(){return pe||(pe=new de),pe}function Qe(e,t,n){return sr().transliterateAsync(e,t,n)}var Xt=["acadsin-zho-Hani-Latn-2002","alalc-amh-Ethi-Latn-1997","alalc-amh-Ethi-Latn-2011","alalc-ara-Arab-Latn-1997","alalc-asm-Deva-Latn-1997","alalc-asm-Deva-Latn-2012","alalc-aze-Arab-Latn-1997","alalc-aze-Cyrl-Latn-1997","alalc-bel-Cyrl-Latn-1997","alalc-ben-Beng-Latn-1997","alalc-ben-Beng-Latn-2017","alalc-bul-Cyrl-Latn-1997","alalc-div-Thaa-Latn-1997","alalc-div-Thaa-Latn-2012","alalc-ell-Grek-Latn-1997","alalc-ell-Grek-Latn-2010","alalc-fas-Arab-Latn-1997","alalc-guj-Gujr-Latn-1997","alalc-guj-Gujr-Latn-2011","alalc-hin-Deva-Latn-1997","alalc-hin-Deva-Latn-2011","alalc-kan-Kana-Latn-1997","alalc-kan-Kana-Latn-2011","alalc-kat-Geok-Latn-1997","alalc-kat-Geok-Latn-2011","alalc-kat-Geor-Latn-1997","alalc-kat-Geor-Latn-2011","alalc-kor-Hang-Latn-1997","alalc-mal-Mlym-Latn-1997","alalc-mal-Mlym-Latn-2012","alalc-mar-Deva-Latn-1997","alalc-mar-Deva-Latn-2011","alalc-mkd-Cyrl-Latn-1997","alalc-mkd-Cyrl-Latn-2013","alalc-mon-Cyrl-Latn-1997","alalc-ori-Orya-Latn-1997","alalc-ori-Orya-Latn-2011","alalc-pan-Guru-Latn-1997","alalc-pan-Guru-Latn-2011","alalc-pli-Deva-Latn-2012","alalc-pra-Deva-Latn-2012","alalc-rus-Cyrl-Latn-1997","alalc-rus-Cyrl-Latn-2012","alalc-san-Deva-Latn-2012","alalc-sin-Sinh-Latn-1997","alalc-sin-Sinh-Latn-2011","alalc-srp-Cyrl-Latn-1997","alalc-srp-Cyrl-Latn-2013","alalc-tam-Taml-Latn-1997","alalc-tam-Taml-Latn-2011","alalc-tel-Telu-Latn-1997","alalc-tel-Telu-Latn-2011","alalc-tir-Ethi-Latn-1997","alalc-tir-Ethi-Latn-2011","alalc-ukr-Cyrl-Latn-1997","alalc-ukr-Cyrl-Latn-2011","apcbg-bul-Cyrl-Latn-1995","az-aze-Cyrl-Latn-1939","az-aze-Cyrl-Latn-1958","bas-rus-Cyrl-Latn-2017-bss","bas-rus-Cyrl-Latn-2017-oss","bgn-jpn-Hrkt-Latn-1962","bgn-kor-Hang-Latn-1943","bgn-kor-Kore-Latn-1943","bgna-bul-Cyrl-Latn-2006","bgna-bul-Cyrl-Latn-2009","bgnpcgn-amh-Ethi-Latn-1967","bgnpcgn-ara-Arab-Latn-1956","bgnpcgn-arm-Armn-Latn-1981","bgnpcgn-aze-Cyrl-Latn-1993","bgnpcgn-bak-Cyrl-Latn-2007","bgnpcgn-bal-Arab-Latn-2008","bgnpcgn-bel-Cyrl-Latn-1979","bgnpcgn-bul-Cyrl-Latn-1952","bgnpcgn-bul-Cyrl-Latn-2013","bgnpcgn-che-Cyrl-Latn-2008","bgnpcgn-deu-Latn-Latn-2000","bgnpcgn-div-Thaa-Latn-1972","bgnpcgn-div-Thaa-Latn-1988","bgnpcgn-ell-Grek-Latn-1962","bgnpcgn-ell-Grek-Latn-1996","bgnpcgn-fao-Latn-Latn-1964","bgnpcgn-fao-Latn-Latn-1968","bgnpcgn-fas-Arab-Latn-1956","bgnpcgn-isl-Latn-Latn-1964","bgnpcgn-isl-Latn-Latn-1968","bgnpcgn-jpn-Hrkt-Latn-1976","bgnpcgn-kat-Geor-Latn-1981","bgnpcgn-kat-Geor-Latn-2009","bgnpcgn-kaz-Cyrl-Latn-1979","bgnpcgn-kir-Cyrl-Latn-1979","bgnpcgn-kor-Hang-Latn-kn-1945","bgnpcgn-kor-Hang-Latn-rok-2011","bgnpcgn-kor-Kore-Latn-rok-2011","bgnpcgn-kur-Arab-Latn-2007","bgnpcgn-mkd-Cyrl-Latn-1981","bgnpcgn-mkd-Cyrl-Latn-2013","bgnpcgn-mon-Cyrl-Latn-1964","bgnpcgn-nep-Deva-Latn-2011","bgnpcgn-per-Arab-Latn-1958","bgnpcgn-prs-Arab-Latn-2007","bgnpcgn-prs-Arab-Latn-yaghoubi","bgnpcgn-pus-Arab-Latn-1968","bgnpcgn-ron-Cyrl-Latn-2002","bgnpcgn-rue-Cyrl-Latn-2016","bgnpcgn-rus-Cyrl-Latn-1947","bgnpcgn-sme-Latn-Latn-1984","bgnpcgn-srp-Cyrl-Latn-1962","bgnpcgn-srp-Cyrl-Latn-2005","bgnpcgn-tat-Cyrl-Latn-2007","bgnpcgn-tgk-Cyrl-Latn-1994","bgnpcgn-tir-Ethi-Latn-2007","bgnpcgn-ukr-Cyrl-Latn-1965","bgnpcgn-ukr-Cyrl-Latn-2019","bgnpcgn-urd-Arab-Latn-2007","bgnpcgn-uzb-Cyrl-Latn-1979","bgnpcgn-uzb-Cyrl-Latn-2000","bgnpcgn-zho-Hans-Latn-1979","bis-asm-Beng-Latn-13194-1991","bis-ben-Beng-Latn-13194-1991","bis-dev-Deva-Latn-13194-1991","bis-guj-Gujr-Latn-13194-1991","bis-kan-Kana-Latn-13194-1991","bis-mlm-Mlym-Latn-13194-1991","bis-ori-Orya-Latn-13194-1991","bis-pnj-Guru-Latn-13194-1991","bis-tel-Telu-Latn-13194-1991","bis-tml-Taml-Latn-13194-1991","by-bel-Cyrl-Latn-1998","by-bel-Cyrl-Latn-2007","din-grc-Grek-Latn-31634-2011-t1","din-hin-Deva-Latn-33904-2018","din-kat-Geor-Latn-32707-2010","din-mar-Deva-Latn-33904-2018","din-nep-Deva-Latn-33904-2018","din-pli-Deva-Latn-33904-2018","din-pra-Deva-Latn-33904-2018","din-san-Deva-Latn-33904-2018","din-tam-Taml-Latn-33903-2016","dos-nep-Deva-Latn-1997","elot-ell-Grek-Latn-743-1982-tl","elot-ell-Grek-Latn-743-1982-ts","elot-ell-Grek-Latn-743-2001-tl","elot-ell-Grek-Latn-743-2001-ts","ggg-kat-Geor-Latn-2002","gki-bel-Cyrl-Latn-1992","gki-bel-Cyrl-Latn-2000","gost-rus-Cyrl-Latn-16876-71-1983","gost-rus-Cyrl-Latn-7.79-2000-2002","hk-yue-Hani-Latn-1888","icao-bel-Cyrl-Latn-9303","icao-bul-Cyrl-Latn-9303","icao-fas-Arab-Latn-9303","icao-heb-Hebr-Latn-9303","icao-mkd-Cyrl-Latn-9303","icao-rus-Cyrl-Latn-9303","icao-srp-Cyrl-Latn-9303","icao-ukr-Cyrl-Latn-9303","iso-ara-Arab-Latn-233-1984","iso-ara-Arab-Latn-233-2-1993","iso-asm-Beng-Latn-15919-2001","iso-ben-Beng-Latn-15919-2001","iso-ell-Grek-Latn-843-1997-t1","iso-ell-Grek-Latn-843-1997-t2","iso-guj-Gujr-Latn-15919-2001","iso-hin-Deva-Latn-15919-2001","iso-inc-Deva-Latn-15919-2001","iso-jpn-Hrkt-Latn-3602-1989","iso-kan-Kana-Latn-15919-2001","iso-kat-Geor-Latn-9984-1996","iso-kor-Hang-Latn-1996-method1","iso-kor-Hang-Latn-1996-method2","iso-mal-Mlym-Latn-15919-2001","iso-mar-Deva-Latn-15919-2001","iso-nep-Deva-Latn-15919-2001","iso-ori-Orya-Latn-15919-2001","iso-pan-Guru-Latn-15919-2001","iso-pli-Beng-Latn-15919-2001","iso-pli-Deva-Latn-15919-2001","iso-pli-Sinh-Latn-15919-2001","iso-pli-Thai-Latn-15919-2001","iso-pra-Deva-Latn-15919-2001","iso-prs-Arab-Latn-233-3-1999","iso-rus-Cyrl-Latn-9-1995","iso-san-Deva-Latn-15919-2001","iso-tam-Taml-Latn-15919-2001","iso-tel-Telu-Latn-15919-2001","iso-tha-Thai-Latn-11940-1998","kp-kor-Hang-Latn-2002","lshk-yue-Hani-Latn-jyutping-1993","masm-mon-Cyrl-Latn-5217-2012","masm-mon-Latn-Cyrl-5217-2012","mext-jpn-Hrkt-Latn-1954","moct-kor-Hang-Latn-2000","mofa-jpn-Hrkt-Latn-1989","mv-div-Thaa-Latn-1987","mvd-bel-Cyrl-Latn-2008","mvd-bel-Cyrl-Latn-2010","mvd-rus-Cyrl-Latn-2008","mvd-rus-Cyrl-Latn-2010","odni-ara-Arab-Latn-2004","odni-ara-Arab-Latn-2015","odni-aze-Cyrl-Latn-2015","odni-bel-Cyrl-Latn-2015","odni-bul-Cyrl-Latn-2005","odni-bul-Cyrl-Latn-2015","odni-che-Cyrl-Latn-2015","odni-fas-Arab-Latn-2004","odni-fas-Arab-Latn-2015","odni-hin-Deva-Latn-2004","odni-hin-Deva-Latn-2015","odni-kat-Geor-Latn-2015","odni-kaz-Cyrl-Latn-2015","odni-kir-Cyrl-Latn-2015","odni-kor-Hang-Latn-2015","odni-mkd-Cyrl-Latn-2005","odni-mkd-Cyrl-Latn-2015","odni-prs-Arab-Latn-2004","odni-prs-Arab-Latn-2015","odni-pus-Arab-Latn-2011","odni-rus-Cyrl-Latn-2015","odni-srp-Cyrl-Latn-2005","odni-srp-Cyrl-Latn-2015","odni-tat-Cyrl-Latn-2015","odni-tgk-Cyrl-Latn-2015","odni-tuk-Cyrl-Latn-2015","odni-uig-Cyrl-Latn-2015","odni-ukr-Cyrl-Latn-2015","odni-urd-Arab-Latn-2015","odni-uzb-Cyrl-Latn-2015","posix","sac-zho-Hans-Latn-1979","sasm-mon-Mong-Latn-general-1978","sasm-mon-Mong-Latn-phonetic-1978","ses-ara-Arab-Latn-1930","stategeocadastre-ukr-Cyrl-Latn-1993","ua-ukr-Cyrl-Latn-1996","ua-ukr-Cyrl-Latn-2007","ua-ukr-Cyrl-Latn-2010","un-amh-Ethi-Latn-2016","un-ara-Arab-Latn-1971","un-ara-Arab-Latn-1972","un-ara-Arab-Latn-2017","un-asm-Beng-Latn-1972","un-bel-Cyrl-Latn-2007","un-ben-Beng-Latn-2016","un-bul-Cyrl-Latn-1977","un-ell-Grek-Latn-1987-phonetic","un-ell-Grek-Latn-1987-tl","un-ell-Grek-Latn-1987-ts","un-guj-Gujr-Latn-1972","un-hin-Deva-Latn-2016","un-kan-Kana-Latn-2016","un-mal-Mlym-Latn-1972","un-mar-Deva-Latn-2016","un-mkd-Cyrl-Latn-1977","un-mon-Mong-Latn-general-2013","un-mon-Mong-Latn-phonetic-2013","un-nep-Deva-Latn-1972","un-nep-Deva-Latn-2013","un-ori-Orya-Latn-1972","un-pan-Guru-Latn-1972","un-prs-Arab-Latn-1967","un-rus-Cyrl-Latn-1987","un-sin-Sinh-Latn-1972","un-srp-Cyrl-Latn-1997","un-tam-Taml-Latn-1972","un-tel-Telu-Latn-1972","un-ukr-Cyrl-Latn-1998","un-ukr-Cyrl-Latn-2012","un-urd-Arab-Latn-1972","unicode","var-Cyrl","var-amh-Ethi-Latn-eae-2003","var-ara-Arab-Arab-rababa","var-gez-Ethi-Latn-eae-2003","var-hin-Deva-Latn-hunterian-1872","var-jpn-Hrkt-Latn-hepburn-1886","var-jpn-Hrkt-Latn-hepburn-1954","var-kor","var-kor-Hang-Hang-jamo","var-kor-Hang-Latn-mr-1939","var-kor-Kore-Hang-2013","var-kor-Kore-Latn-mr-1939","var-mar-Deva-Latn-hunterian-1872","var-mon-Mong-Latn-1930","var-mon-Mong-Latn-lessing","var-mon-Mong-Latn-vpmc","var-pra-Deva-Latn-iast-1912","var-san-Deva-Latn-iast-1912","var-zho-Hani-Latn-wd-1979"];var or=new Set(["unicode","posix","var-Cyrl","var-kor"]),ir=new Set(["var-ara-Arab-Arab-rababa"]),en=Xt.filter(e=>!or.has(e)),cr=en.filter(e=>!ir.has(e)),Zt=new Map;function _(){return en}function tn(){return cr}async function nn(e,t){let n=Zt.get(t);if(n)return n;let r=await e.fetch(new Request(`https://assets.internal/${t}.json`));if(!r.ok)throw new g(t);let a=await r.json(),s=We(a);return Zt.set(t,s),s}var rn;function an(e){if(rn===e)return;Yt({strategies:[n=>nn(e,n)]}),rn=e}async function sn(e,t,n){return an(e),Qe(t,n)}function lr(e,t){if(e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let n=Array.from({length:t.length+1},(r,a)=>a);for(let r=1;r<=e.length;r++){let a=[r];for(let s=1;s<=t.length;s++)a[s]=Math.min(n[s]+1,a[s-1]+1,n[s-1]+(e[r-1]===t[s-1]?0:1));n=a}return n[t.length]}async function on(e,t,n){an(e);let r=[];for(let a of tn())try{let s=await Qe(a,t);r.push({mapName:a,distance:lr(s,n)})}catch{continue}return r.sort((a,s)=>a.distance-s.distance)}var j=class extends Error{constructor(n){super(`Input is too long (max ${n} characters)`);this.max=n;this.name="InputTooLongError"}max},$=class extends Error{constructor(n){super(`Couldn't locate ${n}`);this.systemCode=n;this.name="MapNotFoundError"}systemCode};var D={input_max_size:1e6},ue=12e4;var fe="3.0.0-cloudflare.1",Je;function Q(e){Je=e}var me;function cn(e,t){me=e&&t?{endpoint:e,token:t}:void 0}var pr={"var-ara-Arab-Arab-rababa":"ara-diac-1.0"};async function dr(e,t){if(!me)throw new Error("ML inference unavailable \u2014 ML_ENDPOINT/ML_TOKEN not set");let n=await fetch(`${me.endpoint}/infer`,{method:"POST",headers:{"content-type":"application/json","x-api-key":me.token},body:JSON.stringify({model:e,input:t}),signal:AbortSignal.timeout(ue)}).catch(()=>null);if(!n||!n.ok)throw new Error("ML inference upstream failed");let r=await n.json().catch(()=>null);if(!r||typeof r.output!="string")throw new Error("ML inference returned no output");return r.output}function ln(){if(!Je)throw new Error("ASSETS binding missing \u2014 see README deployment notes");return Je}async function pn(){return JSON.stringify({version:fe,engine:"interscript-ts@native-interpreter"})}function dn(){return[..._()]}async function he(e,t){if(t.length>D.input_max_size)throw new j(D.input_max_size);let n=pr[e];if(n)return dr(n,t);try{return await sn(ln(),e,t)}catch(r){throw r instanceof g?new $(e):r}}async function ge(e,t){return on(ln(),e,t)}var un={version:1,models:[{id:"khm-latn-1.0",task:"translit",scripts:["Khmr","Latn"],precision:"fp32",filename:"khm-latn-1.0-fp32.zip",url:"https://github.com/interscript/interscript-ml/releases/download/khm-latn-1.0/khm-latn-1.0-fp32.zip",parts:null,sha256:"55993d473a2ed9489058779cad7e115db05e4020085b71616468cfae4f2f65cb",size:1418009977,metrics:[{name:"cer",value:27.42,source:"secryst/docs/RESULTS.md#khmer-transliteration-2026-08-14"},{name:"em",value:59.66,source:"secryst/docs/RESULTS.md#khmer-transliteration-2026-08-14"}],parity:{samples:895,cer_delta:0},license:"BSD-3-Clause"},{id:"urd-g2p-1.0",task:"g2p",scripts:["Arab","IPA"],precision:"fp32",filename:"urd-g2p-1.0-fp32.zip",url:"https://github.com/interscript/interscript-ml/releases/download/urd-g2p-1.0/urd-g2p-1.0-fp32.zip",parts:null,sha256:"9f0a248c7116aa7f6b9ac125fb9684a3556f3b8ce8b64567c05a5e7e7a018ebf",size:1418039605,metrics:[{name:"cer",value:14.77,source:"rababa-urdu/docs/RESULTS.md#g2p-urdu-text--ipa"},{name:"em",value:33.6,source:"rababa-urdu/docs/RESULTS.md#g2p-urdu-text--ipa"}],parity:{samples:12699,cer_delta:0},license:"BSD-3-Clause"},{id:"urd-diac-1.0",task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"urd-diac-1.0-fp32.zip",url:"https://github.com/interscript/interscript-ml/releases/download/urd-diac-1.0/urd-diac-1.0-fp32.zip",parts:null,sha256:"c299ea44a4da4851a52283f8e42d2fb6f8c7a9c443ba7eb0270f97372e10b8ea",size:1417851421,metrics:[{name:"cer",value:3.74,source:"rababa-urdu/docs/RESULTS.md#diacritization-urdu-text--text--haraqat"}],parity:{samples:11940,cer_delta:0},license:"BSD-3-Clause"},{id:"heb-diac-1.0",task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb-diac-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-00",sha256:"5497f70cc3c96829e65f1eb0cc401c2d1ffeb4fa909acd4def824c2e019cbc37",size:15e8},{url:"https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-01",sha256:"a7d2011ab4f9326a86e234cc49cb50daf82949e51efbf03a21d5796c46465e9d",size:1281139753}],sha256:"b32fa239e0c56708b6004942de4b9e6e9f265e7cc3828f41d560e96386e20dd8",size:2781139753,metrics:[{name:"der_greedy",value:29,source:"rababa/docs/RESULTS.md#hebrew-diacritization"},{name:"der_beam4",value:17.46,source:"rababa/docs/RESULTS.md#hebrew-diacritization"}],parity:{samples:600,cer_delta:0},license:"BSD-3-Clause"},{id:"tha-g2p-base-1.0",task:"g2p",scripts:["Thai","IPA"],precision:"fp32",filename:"tha-g2p-base-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-ml/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-00",sha256:"c4525414e5dec91a54d055ca9f1acd51c198f81fbfc55977aa82c1fb038d58d7",size:15e8},{url:"https://github.com/interscript/interscript-ml/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-01",sha256:"f5d11fbd75f92e8b5471add867418e2dd4f49a5e258b9ded2f3b5ffa630abe24",size:1281174343}],sha256:"f341a5868867a9847d3f897d1fcc4d1d63b9a59b8913871bcf4ecab48f4fa895",size:2781174343,metrics:[{name:"per_teacher",value:1.25,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-base-1.0"},{name:"per_student",value:3.53,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-base-1.0"}],parity:{samples:1219,cer_delta:0},license:"BSD-3-Clause"},{id:"tha-g2p-small-1.0",task:"g2p",scripts:["Thai","IPA"],precision:"int8",filename:"tha-g2p-small-1.0-int8.zip",url:"https://github.com/interscript/interscript-ml/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int8.zip",parts:null,sha256:"f2cfa93a42d98aabf08fdc82dfc6bd1574e21993f36558aa581fbe29e0588a94",size:257468517,metrics:[{name:"per_teacher",value:4.43,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student_beam4",value:12.06,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student",value:2.85,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"}],parity:{samples:1219,cer_delta:.0803},license:null},{id:"tha-g2p-small-1.0-int4",task:"g2p",scripts:["Thai","IPA"],precision:"int4",filename:"tha-g2p-small-1.0-int4.zip",url:"https://github.com/interscript/interscript-ml/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int4.zip",parts:null,sha256:"e5d12a3d65c6ac39fa08f52c975c99ff7a51c3e7b7aca7fbb461d2de2345e4cb",size:201958073,metrics:[{name:"per_teacher",value:4.43,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student_beam4",value:12.06,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student",value:2.85,source:"interscript/interscript-ml docs/RESULTS.md#tha-g2p-small-1.0"}],parity:{samples:600,cer_delta:.0734},license:"BSD-3-Clause"},{id:"heb-diac-small-1.0",task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb-diac-small-1.0-fp32.zip",url:"https://github.com/interscript/interscript-ml/releases/download/heb-diac-small-1.0/heb-diac-small-1.0-fp32.zip",parts:null,sha256:"905c53873d5a62bbe6252c6ec0ecef5f37e96e78cb01e8cd99b6b24c4d4d74ad",size:1418663344,metrics:[{name:"der_teacher_greedy",value:24.79,source:"interscript/interscript-ml docs/RESULTS.md#heb-diac-small-1.0"},{name:"der_student_greedy",value:30.37,source:"interscript/interscript-ml docs/RESULTS.md#heb-diac-small-1.0"}],parity:{samples:1864,cer_delta:0},license:null},{id:"fas-g2p-1.0",task:"g2p",scripts:["Arab","Latn"],precision:"fp32",filename:"fas-g2p-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-ml/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-00",sha256:"6c475e53f3c7ef3edcef5a24d2d81f51d13ddf4c417de98440943c9a32b03e55",size:15e8},{url:"https://github.com/interscript/interscript-ml/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-01",sha256:"c5656c649412f41e201c567e002514d31390b636d4650d9dcb6dfed1973fb3d5",size:1280254270}],sha256:"b53fd69196127efcc596935d24e135b3c897006872c1646c674e70f3c0d9a0e3",size:2780254270,metrics:[{name:"cer",value:1.6,source:"interscript/interscript-ml docs/RESULTS.md#fas-g2p-1.0"},{name:"sb_homograph_ezafe_norm",value:77.34,source:"interscript/interscript-ml docs/RESULTS.md#fas-g2p-1.0"}],parity:{samples:1e3,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-small-1.0",task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-small-1.0-fp32.zip",url:"https://github.com/interscript/interscript-ml/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-fp32.zip",parts:null,sha256:"8b149beb04294a2e482af876a34ae0fca3e87412606116fae1a376845fd4111a",size:1418126835,metrics:[{name:"der_teacher_greedy",value:1.3205,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_greedy",value:3.658,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_teacher_fullset",value:2.5815,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_fullset",value:8.259,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"}],parity:{samples:800,cer_delta:0},license:"BSD-3-Clause"},{id:"heb-diac-1.1",task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.1/heb.zip.part-00",sha256:"8dac0d62e9b0ac4b137412eaf3a542953f11575f12f66f76cb93d3f5d788fc1b",size:15e8},{url:"https://github.com/interscript/interscript-ml/releases/download/heb-diac-1.1/heb.zip.part-01",sha256:"230c5ab731ea5f001f802d60b9e9a328c10b43bc311a19ef1974f114384313ed",size:1280987905}],sha256:"f0022dde8d06e46e8f08cf0b2f7bbb887a05ed686b90f1d5aa82ca3ef690a0b0",size:2780987905,metrics:[{name:"der_greedy",value:16.44,source:"rababa/docs/RESULTS.md#hebrew-diacritization"},{name:"der_beam4",value:16.43,source:"rababa/docs/RESULTS.md#hebrew-diacritization"}],parity:{samples:500,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-1.0",task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-ml/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-00",sha256:"6282a9291fb45ac7fcc3abe79d33b5913e91f87dcff8b305bf1d57ed98a3ed0b",size:15e8},{url:"https://github.com/interscript/interscript-ml/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-01",sha256:"7e7254a89ec75493871f6f61a993315097dad1bb0ba63c4584453c309e8cb906",size:1280311342}],sha256:"9e6d9777fe2474b150450774aaa1c9e8a9051b502b184fde298b91636dcfdac6",size:2780311342,metrics:[{name:"der_total_greedy",value:2.5793,source:"rababa/docs/RESULTS.md#r6-verdict-table-sadeeddiac-25-2026-08-21"},{name:"der_morph_greedy",value:1.5317,source:"rababa/docs/RESULTS.md#r6-verdict-table-sadeeddiac-25-2026-08-21"}],parity:{samples:500,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-small-1.0-int8",task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-small-1.0-int8.zip",url:"https://github.com/interscript/interscript-ml/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-int8.zip",parts:null,sha256:"af247d837bee7e755b5287102cfb715c48dc90c2cf41ec1c41e7238e1a72b678",size:256959713,metrics:[{name:"der_teacher_greedy",value:1.3205,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_greedy",value:3.658,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_teacher_fullset",value:2.5815,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_fullset",value:8.259,source:"interscript/interscript-ml docs/RESULTS.md#ara-diac-small-1.0"}],parity:{samples:800,cer_delta:0},license:"BSD-3-Clause"}]};var Ye=un;function be(){return Ye.models}function Xe(e){return Ye.models.find(t=>t.id===e)}var mn=Ye.version;var fn={openapi:"3.1.0",info:{title:"Interscript API",version:"1.0.0",description:"Transliteration and neural text processing. Maps run in-edge on the interscript-ts native interpreter (289 systems); neural models (diacritization, grapheme-to-phoneme) run on Interscript's inference service. GraphQL remains available at POST /graphql.",license:{name:"BSD-3-Clause"}},servers:[{url:"https://api.interscript.org"}],tags:[{name:"service"},{name:"maps"},{name:"transliteration"},{name:"models"},{name:"inference"}],paths:{"/":{get:{tags:["service"],summary:"Service index",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/info":{get:{tags:["service"],summary:"Version and capability summary",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/maps":{get:{tags:["maps"],summary:"Every bundled transliteration system code",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/maps/{code}":{get:{tags:["maps"],summary:"One system's compiled map (JSON IR)",parameters:[{name:"code",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{$ref:"#/components/responses/Ok"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/transliterate":{post:{tags:["transliteration"],summary:"Transliterate text with a system",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/TransliterateRequest"},examples:{gek:{value:{system:"ungegn-kor-Kore-Latn-1939",input:"\uD3C9\uC591"}}}}}},responses:{200:{description:"Transliterated output",content:{"application/json":{schema:{$ref:"#/components/schemas/TransliterateResponse"}}}},404:{$ref:"#/components/responses/NotFound"},413:{$ref:"#/components/responses/Error"}}}},"/v1/detect":{post:{tags:["transliteration"],summary:"Rank systems by how well they map input to output",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/DetectRequest"}}}},responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/models":{get:{tags:["models"],summary:"The neural model index (IMF v1)",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/models/{id}":{get:{tags:["models"],summary:"One model's full entry (metrics, parity, download)",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{$ref:"#/components/responses/Ok"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/infer":{post:{tags:["inference"],summary:"Run a neural model (diacritization or G2P)",description:"Proxy to Interscript's inference service. Only models whose task is diacritization or g2p are served; see GET /v1/models for the catalog.",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/InferRequest"},examples:{hebrew:{value:{model:"heb-diac-1.0",input:"\u05E9\u05DC\u05D5\u05DD \u05E2\u05DC\u05D9\u05DB\u05DD"},summary:"Hebrew nikud restoration"},urdu:{value:{model:"urd-g2p-1.0",input:"\u0627\u0631\u062F\u0648"},summary:"Urdu grapheme-to-phoneme"}}}}},responses:{200:{description:"Model output",content:{"application/json":{schema:{$ref:"#/components/schemas/InferResponse"}}}},404:{$ref:"#/components/responses/NotFound"},502:{$ref:"#/components/responses/Error"},503:{$ref:"#/components/responses/Error"}}}}},components:{schemas:{Error:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"}}}}},TransliterateRequest:{type:"object",required:["system","input"],properties:{system:{type:"string",description:"A system code from GET /v1/maps",examples:["ungegn-kor-Kore-Latn-1939"]},input:{type:"string",maxLength:1e6}}},TransliterateResponse:{type:"object",properties:{system:{type:"string"},input:{type:"string"},output:{type:"string"}}},DetectRequest:{type:"object",required:["input","output"],properties:{input:{type:"string"},output:{type:"string"}}},InferRequest:{type:"object",required:["model","input"],properties:{model:{type:"string",description:"A model id from GET /v1/models",examples:["heb-diac-1.0"]},input:{type:"string",maxLength:4e3}}},InferResponse:{type:"object",properties:{model:{type:"string"},task:{type:"string",enum:["diacritization","g2p"]},input:{type:"string"},output:{type:"string"}}}},responses:{Ok:{description:"Success",content:{"application/json":{schema:{type:"object"}}}},NotFound:{description:"Unknown system or model",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}},Error:{description:"Error",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}}}}};var mr=[{method:"GET",path:"/v1/info",note:"version + capability summary"},{method:"GET",path:"/v1/maps",note:"every transliteration system code"},{method:"GET",path:"/v1/maps/{code}",note:"one system's compiled map (JSON IR)"},{method:"POST",path:"/v1/transliterate",note:"{system, input} \u2192 {output}"},{method:"POST",path:"/v1/detect",note:"{input, output} \u2192 ranked systems"},{method:"GET",path:"/v1/models",note:"neural model index (IMF v1)"},{method:"GET",path:"/v1/models/{id}",note:"one model's metadata"},{method:"POST",path:"/v1/infer",note:"{model, input} \u2192 {output}"},{method:"POST",path:"/graphql",note:"GraphQL endpoint (introspection enabled)"},{method:"GET",path:"/openapi.json",note:"OpenAPI 3.1 document"}];function ye(e){return e.replace(/&/g,"&").replace(//g,">")}function Ze(e){return` +`;import{Hono as Bl}from"hono";var j=class extends Error{cause;constructor(t,n){super(t,n),this.name=new.target.name,this.cause=n?.cause}},I=class extends j{systemCode;constructor(t,n){let r=n?.asyncLoadersConfigured?" (async loaders configured \u2014 use loadMapAsync/transliterateAsync)":"";super(`Map not found: ${t}${r}`),this.systemCode=t}},Ce=class extends j{},E=class extends j{},he=class extends j{dependency;constructor(t){super(`Map dependency missing: ${t}`),this.dependency=t}};var Qe=class{strategies;cache=new Map;known=new Map;options;constructor(t,n={}){this.strategies=t,this.options=n}load(t){let n=this.cache.get(t);if(n)return n;let r=this.known.get(t);if(r)return this.cache.set(t,r),r;let a=!1;for(let i of this.strategies){let s=i(t);if(s&&typeof s.then=="function"){a=!0;continue}if(s){let o=s;return this.cache.set(t,o),this.known.set(t,o),this.options.onLoaded?.(t,o),o}}throw new I(t,{asyncLoadersConfigured:a})}async loadAsync(t){let n=this.cache.get(t);if(n)return n;let r=this.known.get(t);if(r)return this.cache.set(t,r),r;for(let a of this.strategies){let i=await a(t);if(i)return this.cache.set(t,i),this.known.set(t,i),this.options.onLoaded?.(t,i),i}throw new I(t)}clear(){this.cache.clear()}loadedMaps(){return Array.from(this.known.keys())}register(t,n){this.known.set(t,n),this.cache.set(t,n)}};var Ze=class e{current;map;selectedLanguage;loader;aliasCache=new Map;functions;constructor(t,n,r,a){this.map=t,this.current=n,this.functions=t.functions,this.loader=r,this.selectedLanguage=a}resolveAlias(t){if(this.aliasCache.has(t))return this.aliasCache.get(t);let n=this.map.aliases.get(t);if(!n&&this.loader)for(let r of this.map.dependencies)try{let i=this.loader.load(r).aliases.get(t);if(i){n=i;break}}catch{}return n&&this.aliasCache.set(t,n),n}withMap(t){return new e(t,this.current,this.loader,this.selectedLanguage)}loadDependency(t){if(!this.loader)throw new Error(`Cannot resolve dependency ${t}: no loader configured`);return this.loader.load(t)}};function tn(){return{children:new Map,match:null}}function kr(e){let t=tn();for(let[n,r]of e){if(n.length===0)continue;let a=t;for(let o=0;o0?(n+=o,a+=s):(n+=e[a],a+=1)}return n}function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ji(e){let t=0,n=0;for(;n0&&(r[0]=r[0].toUpperCase()),n==="")return r.join("");let a=Array.from(n),i=[],s=0;for(;sr[s+c]===o)?(i.push(n,r[s+a.length].toUpperCase()),s+=a.length+1):(i.push(r[s]),s+=1);return i.join("")}function _r(e,t={}){let n=t.separator??" ";return e.split("").join(n)}function Ir(e,t={}){let n=t.separator??" ";return e.split(n).join("")}function Nr(e){return e.normalize("NFC")}function Mr(e){return e.normalize("NFD")}function Or(e){return[...e].reverse().join("")}function Rr(e){return e.replace(/^[\0\t\n\v\f\r ]+/,"").replace(/[\0\t\n\v\f\r ]+$/,"")}function Dr(e){let t="";for(let n of e){let r=n.toLowerCase(),a=n.toUpperCase();t+=r!==n?r:a!==n?a:n}return t}function zr(e,t){if(t.length===0)return e;let n=t.map((o,c)=>`(?<__r${c}>${o.pattern})`),r=new RegExp(n.join("|"),"gmu"),a=[],i=[],s=0;for(let o of t){a.push(s);let c=Ji(o.pattern);i.push(c),s+=1+c}return e.replace(r,(...o)=>{let c=o[o.length-1];for(let u=0;uN(i,t,i.kind==="alias").re),a=e.of.length>0?N(e.of[0],t,e.of[0].kind==="alias").literal:"";return{re:`(?:${r.join("|")})`,literal:a}}case"any_char_class":{if(e.range){let[r,a]=e.range;return{re:`[${Te(r)}-${Te(a)}]`,literal:r??""}}return e.chars&&e.chars.length>0?{re:`[${e.chars.map(a=>Te(a)).join("")}]`,literal:e.chars[0]}:{re:"[^]",literal:""}}case"group":{let r=e.items.map(s=>N(s,t)),a=r.map(s=>s.re).join(""),i=r.map(s=>s.literal).join("");return{re:`(?:${a})`,literal:i}}case"repeat":{let r=N(e.item,t).re,{min:a,max:i}=e,s=i===null?1/0:i,o=s===1/0?a===0?"*":"+":`{${a},${s}}`;return{re:`(?:${r})${o}`,literal:""}}case"stage_ref":return{re:"",literal:""}}}function Xi(e){let t=Array.from(e);return{re:`(?:${t.map(n=>Te(n)).join("|")})`,literal:t[0]??""}}function Je(e,t){switch(e.kind){case"string":return e.value;case"alias":{let n=bt[e.name];if(n)return n.literal===""?null:n.literal;let r=t.resolveAlias(e.name);return r?Je(r,t):null}case"capture_group":case"capture_ref":case"repeat":case"stage_ref":return null;case"any_char_class":return e.chars&&e.chars.length>0?e.chars[0]:e.range?e.range[0]:null;case"any":return e.of.length===0?null:Je(e.of[0],t);case"group":{let n="";for(let r of e.items){let a=Je(r,t);if(a===null)return null;n+=a}return n}}}function Ee(e,t){switch(e.kind){case"string":return[e.value];case"alias":{if(bt[e.name])return null;let r=t.resolveAlias(e.name);return r?Ee(r,t):null}case"any_char_class":{if(e.chars)return[...e.chars];if(e.range){let[n,r]=e.range,a=n.codePointAt(0),i=r.codePointAt(0),s=[];for(let o=a;o<=i;o++)s.push(String.fromCodePoint(o));return s}return null}case"any":{let n=[];for(let r of e.of){let a=Ee(r,t);if(a===null)return null;n.push(...a)}return n}case"group":{let n=[""];for(let r of e.items){let a=Ee(r,t);if(a===null)return null;let i=[];for(let s of n)for(let o of a)i.push(s+o);n=i}return n}default:return null}}function Q(e,t){switch(e.kind){case"string":return e.value.length;case"capture_group":return Q(e.data,t);case"capture_ref":return 1;case"alias":{if(e.name==="none")return 0;if(bt[e.name])return 1;let n=t.resolveAlias(e.name);return n?Q(n,t):1}case"any":return e.of.reduce((n,r)=>Math.max(n,Q(r,t)),0);case"any_char_class":return 1;case"group":return e.items.reduce((n,r)=>n+Q(r,t),0);case"repeat":return Q(e.item,t);case"stage_ref":return 1}}var bt=Object.freeze({any_character:{re:".",literal:""},none:{re:"",literal:""},space:{re:" ",literal:" "},whitespace:{re:"\\s+",literal:" "},boundary:{re:"(?:(?xr(e,t??{}),reverse:Or,strip:Rr,swapcase:Dr,separate:(e,t)=>_r(e,t??{}),unseparate:(e,t)=>Ir(e,t??{}),compose:Nr,decompose:Mr};function Pr(e,t){let n=e.functions.get(t)?.impl;if(n)return n;let r=es[t];if(r)return r}function ts(e,t){let n=t.selectedLanguage;if(!n)return;let r=t.map.languages;if(!(!r||!r.includes(n)))return n}function $r(e,t){if(!e.when)return!0;let n=ts(e,t);return n!==void 0&&e.when.includes(n)}function xe(e){switch(e.kind){case"string":return`s:${JSON.stringify(e.value)}`;case"capture_group":return`g(${xe(e.data)})`;case"capture_ref":return`c:${e.id}`;case"alias":return`a:${e.name}${e.map?`@${e.map}`:""}`;case"any":return`any(${e.of.map(xe).join(",")})`;case"any_char_class":return e.range?`r:${e.range[0]}..${e.range[1]}`:`cc:${(e.chars??[]).join("")}`;case"group":return`+(${e.items.map(xe).join(",")})`;case"repeat":return`rep(${xe(e.item)},${e.min},${e.max??"*"})`;case"stage_ref":return`stage:${e.name}`}}var ns={sub:(e,t)=>rs(e,t),run:(e,t)=>{let n=e.docName?t.loadDependency(e.docName):t.map,r=n.stages.find(i=>i.name===e.stage);if(!r)throw new E(`Stage not found: ${e.stage}`);let a=t.withMap(n);for(let i of r.rules)me(i,a);t.current=a.current},funcall:(e,t)=>{let n=Pr(t,e.name);if(!n)throw new E(`Unknown function: ${e.name}`);t.current=n(t.current,e.kwargs??{})},parallel:(e,t)=>{let n=[],r=[];for(let c of e.rules)c.kind==="sub"&&c.from?$r(c,t)&&n.push(c):r.push(c);let a=new Set(n.filter(c=>c.when).map(c=>xe(c.from))),i=n.filter(c=>c.when||!a.has(xe(c.from))),s=c=>!c.before&&!c.after&&!c.notBefore&&!c.notAfter&&Ee(c.from,t)!==null;if(i.some(c=>!s(c))){let u=i.map((l,f)=>({rule:l,idx:f,len:Q(l.from,t)+(l.before?Q(l.before,t):0)+(l.after?Q(l.after,t):0)+(l.notBefore?Q(l.notBefore,t):0)+(l.notAfter?Q(l.notAfter,t):0)+(l.priority??0)})).sort((l,f)=>f.len-l.len||l.idx-f.idx).map(({rule:l})=>{let f=N(l.from,t),p=l.before?N(l.before,t,!0).re:"",d=l.after?N(l.after,t,!0).re:"",h=l.notBefore?N(l.notBefore,t,!0).re:"",g=l.notAfter?N(l.notAfter,t,!0).re:"",b=[p?`(?<=${p})`:"",h?`(?Fr(m,T,x):m}});t.current=zr(t.current,u)}else{let c=[];for(let u of i){if(u.to&&u.to.kind==="funcall_inline")continue;let l=u.to?Je(u.to,t):"";if(l===null)continue;let f=Ee(u.from,t);if(f!==null)for(let p of f)c.push([p,l])}c.length>0&&(t.current=Cr(t.current,kr(c)))}for(let c of r)me(c,t)},sequential:(e,t)=>{for(let n of e.rules)me(n,t)}};function rs(e,t){if(!$r(e,t))return;if(!e.from)throw new E("Sub rule missing 'from'");let n=N(e.from,t),r=e.before?N(e.before,t,!0).re:"",a=e.after?N(e.after,t,!0).re:"",i=e.notBefore?N(e.notBefore,t,!0).re:"",s=e.notAfter?N(e.notAfter,t,!0).re:"",o=[];r&&o.push(`(?<=${r})`),i&&o.push(`(?{let l=u;return(f,...p)=>Fr(l,f,p)})():u)}function Fr(e,t,n){return e.replace(/\$(\d+)/g,(r,a)=>{let i=parseInt(a,10);return n[i-1]??t})}function Br(e,t){if(!e)return"";if(e.kind==="funcall_inline"){let r=Pr(t,e.name);if(!r)throw new E(`Unknown inline function: ${e.name}`);return a=>r(a)}return N(e,t).literal}function me(e,t){let n=ns[e.kind];n(e,t)}var sr=new Set(["rababa","secryst"]);function mi(e,t){return new E(`stage "${t}" not found in ${e.systemCode}`)}function gi(e){for(let t of e){if(t.kind==="funcall"&&sr.has(t.name))return!0;if(t.kind==="parallel"||t.kind==="sequential"){for(let n of t.rules)if(n.kind==="funcall"&&sr.has(n.name))return!0}}return!1}function Ue(e,t,n,r,a){let i=e.stages.find(o=>o.name===t);if(!i)throw mi(e,t);if(gi(i.rules))throw new Error(`Stage "${t}" contains ML function calls (rababa/secryst). Use transliterateAsync() instead of transliterate().`);let s=new Ze(e,n,r,a);for(let o of i.rules)me(o,s);return s.current}async function Ft(e,t,n,r,a){let i=e.stages.find(o=>o.name===t);if(!i)throw mi(e,t);if(!gi(i.rules))return Ue(e,t,n,r,a);let s=new Ze(e,n,r,a);for(let o of i.rules)await gl(o,s);return s.current}async function gl(e,t){if(e.kind==="funcall"){await yl(e,t);return}me(e,t)}async function yl(e,t){if(e.name==="rababa"){let{rababa:n}=await Promise.resolve().then(()=>(ta(),ea));t.current=await n(t.current,e.kwargs);return}if(sr.has(e.name)){let{imf:n}=await Promise.resolve().then(()=>(ir(),hi)),r=e.kwargs?.config??e.kwargs?.model??"default",a=await n.IMFModel.load(r);try{t.current=await a.translate(t.current)}finally{await a.dispose()}return}me({kind:"funcall",name:e.name,kwargs:e.kwargs},t)}function yi(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=new Array(t.length+1),r=new Array(t.length+1);for(let a=0;a<=t.length;a++)n[a]=a;for(let a=1;a<=e.length;a++){r[0]=a;for(let i=1;i<=t.length;i++){let s=e[a-1]===t[i-1]?0:1;r[i]=Math.min(n[i]+1,r[i-1]+1,n[i-1]+s)}[n,r]=[r,n]}return n[t.length]}function bi(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function vi(e,t,n,r={},a){let i=[],s=r.mapPattern?bi(r.mapPattern):null,o=a??r.systems??n.loadedMaps();for(let c of o){if(s&&!s.test(c))continue;let u;try{let l=n.load(c);u=Ue(l,"main",e,n)}catch(l){if(l instanceof j)continue;throw l}i.push({mapName:c,distance:yi(u,t)})}return i.sort((c,u)=>c.distance-u.distance)}async function Li(e,t,n,r={},a=i=>n.loadAsync(i)){let i=[],s=r.mapPattern?bi(r.mapPattern):null,o=r.systems??n.loadedMaps();for(let c of o){if(s&&!s.test(c))continue;let u;try{let l=await a(c);u=await Ft(l,"main",e,n)}catch(l){if(l instanceof j)continue;throw l}i.push({mapName:c,distance:yi(u,t)})}return i.sort((c,u)=>c.distance-u.distance)}var bl=Object.freeze({title_case:"downcase",downcase:"title_case",compose:"decompose",decompose:"compose",separate:"unseparate",unseparate:"separate"}),vl=new Set(["boundary","non_boundary","non_word_boundary","line_start","line_end"]),lr={kind:"string",value:""};function Ut(e){let t=e.split("-");if(t.length>=4){let r=t.slice(),a=r[2];r[2]=r[3],r[3]=a;let i=r.join("-");if(i!==e)return i}let n=e.split("-reverse").join("");return n!==e?n:`${e}-reverse`}function dt(e){let t=e.stages.map(wl);return{schemaVersion:1,systemCode:Ut(e.systemCode),dependencies:[...e.dependencies],...e.languages?{languages:[...e.languages]}:{},...e.metadata?{metadata:Ll(e.metadata)}:{},stages:t,aliases:e.aliases,functions:e.functions}}function Ll(e){let t=e.source_script,n=e.destination_script,r={...e};return"source_script"in r&&n!==void 0&&(r.source_script=n),"destination_script"in r&&t!==void 0&&(r.destination_script=t),r}function wl(e){let t=[];for(let n=e.rules.length-1;n>=0;n--){let r=Si(e.rules[n]);r!==null&&t.push(r)}return{kind:"stage",name:e.name,rules:t}}function Si(e){switch(e.kind){case"sub":return Sl(e);case"run":return e;case"funcall":{let t=bl[e.name];if(!t)throw new E(`funcall ${e.name} has no reverse (the Ruby reverse_function map omits it)`);return{kind:"funcall",name:t,...e.kwargs?{kwargs:e.kwargs}:{}}}case"parallel":case"sequential":{let t=[];for(let r=e.rules.length-1;r>=0;r--){let a=Si(e.rules[r]);a!==null&&t.push(a)}return e.kind==="parallel"?{kind:"parallel",rules:t}:{kind:"sequential",rules:t}}}}function Sl(e){if(!e.from)throw new E("sub rule missing 'from'");let t,n,r=e.to;if(r&&r.kind==="funcall_inline")if(r.name==="upcase")t=pt(e.from,!1),n={kind:"funcall_inline",name:"downcase"};else if(r.name==="downcase")t=pt(e.from,!0),n={kind:"funcall_inline",name:"upcase"};else{let[s,o]=wi(e.from,r);t=s,n=o}else{let[s,o]=wi(e.from,r??lr);t=s,n=o}let a={kind:"sub",from:t,to:n,...e.before!==void 0?{before:e.before}:{},...e.notBefore!==void 0?{notBefore:e.notBefore}:{},...e.after!==void 0?{after:e.after}:{},...e.notAfter!==void 0?{notAfter:e.notAfter}:{},...e.priority!==void 0&&e.priority!==null?{priority:-e.priority}:{},...e.when!==void 0&&e.when.length>0?{when:e.when}:{}};return!!(e.before||e.notBefore||e.after||e.notAfter)||!Al(t)?a:null}function Al(e){return e.kind==="string"&&e.value===""}function pt(e,t){let n=r=>t?r.toUpperCase():r.toLowerCase();switch(e.kind){case"string":return{kind:"string",value:n(e.value)};case"alias":case"capture_ref":return e;case"capture_group":return{kind:"capture_group",data:pt(e.data,t)};case"group":return{kind:"group",items:e.items.map(r=>pt(r,t))};case"any":return{kind:"any",of:e.of.map(r=>pt(r,t))};case"any_char_class":{if(e.range){let[r,a]=e.range,i=[];for(let s=r.codePointAt(0);i.push({kind:"string",value:n(String.fromCodePoint(s))}),s!==a.codePointAt(0);s++);return{kind:"any",of:i}}return e.chars?{kind:"any",of:e.chars.map(r=>({kind:"string",value:n(r)}))}:e}case"repeat":throw new E("repeat item in a to-upcase/downcase sub (the Ruby reverse raises NoMethodError)");case"stage_ref":throw new E(`unhandled item kind ${e.kind} in a to-upcase/downcase sub (the Ruby reverse raises NoMethodError)`)}}function or(e){return e.kind==="alias"&&vl.has(e.name)}function cr(e){let t=e.filter(n=>!(n.kind==="string"&&n.value===""));return t.length===0?{...lr}:t.length===1?t[0]:{kind:"group",items:t}}function Bt(e,t){let n=e.slice();return t.kind==="group"?n.push(...t.items):n.push(t),cr(n)}function wi(e,t){let n=e,r=t;if(n.kind==="group"){let o=n.items,c=o[0],u=o[o.length-1];if(c&&or(c)&&(r=Bt([c],r),n=cr(o.slice(1))),u&&or(u)){if(n.kind!=="group")throw new E("boundary hoist consumed the whole from group (the Ruby reverse raises NoMethodError)");let l=n.items.slice(0,-1);r=Bt([r],u),n=cr(l)}}else if(or(n)){let o=n;r=o.kind==="alias"&&o.name==="line_end"?Bt([r],o):Bt([o],r),n={...lr}}let a={left:[],right:new Set},i=je(n,"from",a);return[je(r,"to",a),i]}function je(e,t,n){switch(e.kind){case"alias":return e.name==="kor_maybedash"?(n.left.push(e),{kind:"capture_ref",id:n.left.length}):e;case"string":return e;case"capture_ref":if(t==="from"||n.right.has(e.id))return e;n.right.add(e.id);{let r=n.left[e.id-1];if(!r)throw new E("Capture count doesn't match");return r}case"capture_group":{n.left.push(e);let r={kind:"capture_ref",id:n.left.length};return je(e.data,t,n),r}case"any":return{kind:"any",of:e.of.map(r=>je(r,t,n))};case"group":return{kind:"group",items:e.items.map(r=>je(r,t,n))};case"repeat":return{...e,item:je(e.item,t,n)};case"any_char_class":return e;case"stage_ref":case"funcall_inline":throw new E(`Type ${e.kind} unhandled in reverse_transfer_visit (the Ruby raises "Type ... unhandled!")`)}}function ur(e){let t={schemaVersion:e.schemaVersion,systemCode:e.systemCode,dependencies:e.dependencies,stages:e.stages,aliases:new Map(Object.entries(e.aliases)),functions:new Map};return e.metadata&&(t.metadata=e.metadata),e.languages&&(t.languages=e.languages),t}var kl="main",Gt=class{loader;defaultStage;constructor(t={}){this.loader=new Qe(t.strategies??[]),this.defaultStage=t.defaultStage??kl}loadMap(t){try{return this.loadMapWithDeps(t)}catch(n){if(n instanceof I)return this.loadReversedFallback(t,n);throw n}}loadMapWithDeps(t){let n=this.loader.load(t);for(let r of n.dependencies)try{this.loader.load(r)}catch(a){throw a instanceof I?new he(r):a}return n}loadReversedFallback(t,n){let r=Ut(t);if(r===t)throw n;let a;try{a=this.loadMapWithDeps(r)}catch(s){throw s instanceof I?n:s}let i=dt(a);return this.loader.register(t,i),i}async loadMapAsync(t){try{return await this.loadMapAsyncWithDeps(t)}catch(n){if(n instanceof I){let r=Ut(t);if(r!==t)try{let a=await this.loadMapAsyncWithDeps(r),i=dt(a);return this.loader.register(t,i),i}catch(a){throw a instanceof I?n:a}}throw n}}async loadMapAsyncWithDeps(t){let n=await this.loader.loadAsync(t),r=new Set,a=[...n.dependencies];for(;a.length>0;){let i=a.shift();if(!r.has(i)){r.add(i);try{let s=await this.loader.loadAsync(i);for(let o of s.dependencies)r.has(o)||a.push(o)}catch(s){throw s instanceof I?new he(i):s}}}return n}transliterate(t,n,r,a){try{let i=this.loadMap(t),s=r??this.defaultStage;return Ue(i,s,n,this.loader,a)}catch(i){throw i instanceof j?i:new Ce(`Transliteration failed for ${t}: ${i.message}`,{cause:i})}}async transliterateAsync(t,n,r,a){try{let i=await this.loadMapAsync(t),s=r??this.defaultStage;return await Ft(i,s,n,this.loader,a)}catch(i){throw i instanceof j?i:new Ce(`Transliteration failed for ${t}: ${i.message}`,{cause:i})}}reverse(t,n,r,a){let i=this.loadMap(t),s=new Map,o=f=>{for(let p of f.dependencies){if(s.has(p))continue;let d;try{d=this.loader.load(p)}catch(h){throw h instanceof I?new he(p):h}s.set(p,dt(d)),o(d)}};o(i);let c=dt(i),u=new Qe([]);for(let[f,p]of s)u.register(f,p);let l=r??this.defaultStage;return Ue(c,l,n,u,a)}loadedMaps(){return this.loader.loadedMaps()}getLoader(){return this.loader}detect(t,n,r={},a){return vi(t,n,this.loader,r,a)}async detectAsync(t,n,r={}){return Li(t,n,this.loader,r,a=>this.loadMapAsync(a))}},jt;function Ai(e){jt=new Gt(e)}function Cl(){return jt||(jt=new Gt),jt}function fr(e,t,n,r){return Cl().transliterateAsync(e,t,n,r)}var ki=["posix","unicode","var-Cyrl","var-kor","acadsin-zho-Hani-Latn-2002","alalc-amh-Ethi-Latn-1997","alalc-amh-Ethi-Latn-2011","alalc-ara-Arab-Latn-1997","alalc-asm-Deva-Latn-1997","alalc-asm-Deva-Latn-2012","alalc-aze-Arab-Latn-1997","alalc-aze-Cyrl-Latn-1997","alalc-bel-Cyrl-Latn-1997","alalc-ben-Beng-Latn-1997","alalc-ben-Beng-Latn-2017","alalc-bul-Cyrl-Latn-1997","alalc-div-Thaa-Latn-1997","alalc-div-Thaa-Latn-2012","alalc-ell-Grek-Latn-1997","alalc-ell-Grek-Latn-2010","alalc-fas-Arab-Latn-1997","alalc-guj-Gujr-Latn-1997","alalc-guj-Gujr-Latn-2011","alalc-hin-Deva-Latn-1997","alalc-hin-Deva-Latn-2011","alalc-kan-Kana-Latn-1997","alalc-kan-Kana-Latn-2011","alalc-kat-Geok-Latn-1997","alalc-kat-Geok-Latn-2011","alalc-kat-Geor-Latn-1997","alalc-kat-Geor-Latn-2011","alalc-kor-Hang-Latn-1997","alalc-mal-Mlym-Latn-1997","alalc-mal-Mlym-Latn-2012","alalc-mar-Deva-Latn-1997","alalc-mar-Deva-Latn-2011","alalc-mkd-Cyrl-Latn-1997","alalc-mkd-Cyrl-Latn-2013","alalc-mon-Cyrl-Latn-1997","alalc-ori-Orya-Latn-1997","alalc-ori-Orya-Latn-2011","alalc-pan-Guru-Latn-1997","alalc-pan-Guru-Latn-2011","alalc-pli-Deva-Latn-2012","alalc-pra-Deva-Latn-2012","alalc-rus-Cyrl-Latn-1997","alalc-rus-Cyrl-Latn-2012","alalc-san-Deva-Latn-2012","alalc-sin-Sinh-Latn-1997","alalc-sin-Sinh-Latn-2011","alalc-srp-Cyrl-Latn-1997","alalc-srp-Cyrl-Latn-2013","alalc-tam-Taml-Latn-1997","alalc-tam-Taml-Latn-2011","alalc-tel-Telu-Latn-1997","alalc-tel-Telu-Latn-2011","alalc-tir-Ethi-Latn-1997","alalc-tir-Ethi-Latn-2011","alalc-ukr-Cyrl-Latn-1997","alalc-ukr-Cyrl-Latn-2011","apcbg-bul-Cyrl-Latn-1995","az-aze-Cyrl-Latn-1939","az-aze-Cyrl-Latn-1958","bas-rus-Cyrl-Latn-2017-bss","bas-rus-Cyrl-Latn-2017-oss","bgn-jpn-Hrkt-Latn-1962","bgn-kor-Hang-Latn-1943","bgn-kor-Kore-Latn-1943","bgna-bul-Cyrl-Latn-2006","bgna-bul-Cyrl-Latn-2009","bgnpcgn-amh-Ethi-Latn-1967","bgnpcgn-ara-Arab-Latn-1956","bgnpcgn-arm-Armn-Latn-1981","bgnpcgn-aze-Cyrl-Latn-1993","bgnpcgn-bak-Cyrl-Latn-2007","bgnpcgn-bal-Arab-Latn-2008","bgnpcgn-bel-Cyrl-Latn-1979","bgnpcgn-bul-Cyrl-Latn-1952","bgnpcgn-bul-Cyrl-Latn-2013","bgnpcgn-che-Cyrl-Latn-2008","bgnpcgn-deu-Latn-Latn-2000","bgnpcgn-div-Thaa-Latn-1972","bgnpcgn-div-Thaa-Latn-1988","bgnpcgn-ell-Grek-Latn-1962","bgnpcgn-ell-Grek-Latn-1996","bgnpcgn-fao-Latn-Latn-1964","bgnpcgn-fao-Latn-Latn-1968","bgnpcgn-fas-Arab-Latn-1956","bgnpcgn-isl-Latn-Latn-1964","bgnpcgn-isl-Latn-Latn-1968","bgnpcgn-jpn-Hrkt-Latn-1976","bgnpcgn-kat-Geor-Latn-1981","bgnpcgn-kat-Geor-Latn-2009","bgnpcgn-kaz-Cyrl-Latn-1979","bgnpcgn-kir-Cyrl-Latn-1979","bgnpcgn-kor-Hang-Latn-kn-1945","bgnpcgn-kor-Hang-Latn-rok-2011","bgnpcgn-kor-Kore-Latn-rok-2011","bgnpcgn-kur-Arab-Latn-2007","bgnpcgn-mkd-Cyrl-Latn-1981","bgnpcgn-mkd-Cyrl-Latn-2013","bgnpcgn-mon-Cyrl-Latn-1964","bgnpcgn-nep-Deva-Latn-2011","bgnpcgn-per-Arab-Latn-1958","bgnpcgn-prs-Arab-Latn-2007","bgnpcgn-prs-Arab-Latn-yaghoubi","bgnpcgn-pus-Arab-Latn-1968","bgnpcgn-ron-Cyrl-Latn-2002","bgnpcgn-rue-Cyrl-Latn-2016","bgnpcgn-rus-Cyrl-Latn-1947","bgnpcgn-sme-Latn-Latn-1984","bgnpcgn-srp-Cyrl-Latn-1962","bgnpcgn-srp-Cyrl-Latn-2005","bgnpcgn-tat-Cyrl-Latn-2007","bgnpcgn-tgk-Cyrl-Latn-1994","bgnpcgn-tir-Ethi-Latn-2007","bgnpcgn-tuk-Cyrl-Latn-1979","bgnpcgn-tuk-Cyrl-Latn-1993","bgnpcgn-ukr-Cyrl-Latn-1965","bgnpcgn-ukr-Cyrl-Latn-2019","bgnpcgn-urd-Arab-Latn-2007","bgnpcgn-uzb-Cyrl-Latn-1979","bgnpcgn-uzb-Cyrl-Latn-2000","bgnpcgn-zho-Hans-Latn-1979","bis-asm-Beng-Latn-13194-1991","bis-ben-Beng-Latn-13194-1991","bis-dev-Deva-Latn-13194-1991","bis-guj-Gujr-Latn-13194-1991","bis-kan-Kana-Latn-13194-1991","bis-mlm-Mlym-Latn-13194-1991","bis-ori-Orya-Latn-13194-1991","bis-pnj-Guru-Latn-13194-1991","bis-tel-Telu-Latn-13194-1991","bis-tml-Taml-Latn-13194-1991","by-bel-Cyrl-Latn-1998","by-bel-Cyrl-Latn-2007","din-grc-Grek-Latn-31634-2011-t1","din-hin-Deva-Latn-33904-2018","din-kat-Geor-Latn-32707-2010","din-mar-Deva-Latn-33904-2018","din-nep-Deva-Latn-33904-2018","din-pli-Deva-Latn-33904-2018","din-pra-Deva-Latn-33904-2018","din-san-Deva-Latn-33904-2018","din-tam-Taml-Latn-33903-2016","dos-nep-Deva-Latn-1997","elot-ell-Grek-Latn-743-1982-tl","elot-ell-Grek-Latn-743-1982-ts","elot-ell-Grek-Latn-743-2001-tl","elot-ell-Grek-Latn-743-2001-ts","ggg-kat-Geor-Latn-2002","gki-bel-Cyrl-Latn-1992","gki-bel-Cyrl-Latn-2000","gost-rus-Cyrl-Latn-16876-71-1983","gost-rus-Cyrl-Latn-7.79-2000-2002","hk-yue-Hani-Latn-1888","icao-bel-Cyrl-Latn-9303","icao-bul-Cyrl-Latn-9303","icao-fas-Arab-Latn-9303","icao-heb-Hebr-Latn-9303","icao-mkd-Cyrl-Latn-9303","icao-rus-Cyrl-Latn-9303","icao-srp-Cyrl-Latn-9303","icao-ukr-Cyrl-Latn-9303","iso-ara-Arab-Latn-233-1984","iso-ara-Arab-Latn-233-2-1993","iso-asm-Beng-Latn-15919-2001","iso-ben-Beng-Latn-15919-2001","iso-ell-Grek-Latn-843-1997-t1","iso-ell-Grek-Latn-843-1997-t2","iso-guj-Gujr-Latn-15919-2001","iso-hin-Deva-Latn-15919-2001","iso-inc-Deva-Latn-15919-2001","iso-jpn-Hrkt-Latn-3602-1989","iso-kan-Kana-Latn-15919-2001","iso-kat-Geor-Latn-9984-1996","iso-kor-Hang-Latn-1996-method1","iso-kor-Hang-Latn-1996-method2","iso-mal-Mlym-Latn-15919-2001","iso-mar-Deva-Latn-15919-2001","iso-nep-Deva-Latn-15919-2001","iso-ori-Orya-Latn-15919-2001","iso-pan-Guru-Latn-15919-2001","iso-pli-Beng-Latn-15919-2001","iso-pli-Deva-Latn-15919-2001","iso-pli-Sinh-Latn-15919-2001","iso-pli-Thai-Latn-15919-2001","iso-pra-Deva-Latn-15919-2001","iso-prs-Arab-Latn-233-3-1999","iso-rus-Cyrl-Latn-9-1995","iso-san-Deva-Latn-15919-2001","iso-tam-Taml-Latn-15919-2001","iso-tel-Telu-Latn-15919-2001","iso-tha-Thai-Latn-11940-1998","kp-kor-Hang-Latn-2002","lshk-yue-Hani-Latn-jyutping-1993","masm-mon-Cyrl-Latn-5217-2012","masm-mon-Latn-Cyrl-5217-2012","mext-jpn-Hrkt-Latn-1954","moct-kor-Hang-Latn-2000","mofa-jpn-Hrkt-Latn-1989","mv-div-Thaa-Latn-1987","mvd-bel-Cyrl-Latn-2008","mvd-bel-Cyrl-Latn-2010","mvd-rus-Cyrl-Latn-2008","mvd-rus-Cyrl-Latn-2010","odni-ara-Arab-Latn-2004","odni-ara-Arab-Latn-2015","odni-aze-Cyrl-Latn-2015","odni-bel-Cyrl-Latn-2015","odni-bul-Cyrl-Latn-2005","odni-bul-Cyrl-Latn-2015","odni-che-Cyrl-Latn-2015","odni-fas-Arab-Latn-2004","odni-fas-Arab-Latn-2015","odni-hin-Deva-Latn-2004","odni-hin-Deva-Latn-2015","odni-kat-Geor-Latn-2015","odni-kaz-Cyrl-Latn-2015","odni-kir-Cyrl-Latn-2015","odni-kor-Hang-Latn-2015","odni-mkd-Cyrl-Latn-2005","odni-mkd-Cyrl-Latn-2015","odni-prs-Arab-Latn-2004","odni-prs-Arab-Latn-2015","odni-pus-Arab-Latn-2011","odni-rus-Cyrl-Latn-2015","odni-srp-Cyrl-Latn-2005","odni-srp-Cyrl-Latn-2015","odni-tat-Cyrl-Latn-2015","odni-tgk-Cyrl-Latn-2015","odni-tuk-Cyrl-Latn-2015","odni-uig-Cyrl-Latn-2015","odni-ukr-Cyrl-Latn-2015","odni-urd-Arab-Latn-2015","odni-uzb-Cyrl-Latn-2015","sac-zho-Hans-Latn-1979","sasm-mon-Mong-Latn-general-1978","sasm-mon-Mong-Latn-phonetic-1978","ses-ara-Arab-Latn-1930","stategeocadastre-ukr-Cyrl-Latn-1993","ua-ukr-Cyrl-Latn-1996","ua-ukr-Cyrl-Latn-2007","ua-ukr-Cyrl-Latn-2010","un-amh-Ethi-Latn-2016","un-ara-Arab-Latn-1971","un-ara-Arab-Latn-1972","un-ara-Arab-Latn-2017","un-asm-Beng-Latn-1972","un-bel-Cyrl-Latn-2007","un-ben-Beng-Latn-2016","un-bul-Cyrl-Latn-1977","un-ell-Grek-Latn-1987-phonetic","un-ell-Grek-Latn-1987-tl","un-ell-Grek-Latn-1987-ts","un-guj-Gujr-Latn-1972","un-hin-Deva-Latn-2016","un-kan-Kana-Latn-2016","un-mal-Mlym-Latn-1972","un-mar-Deva-Latn-2016","un-mkd-Cyrl-Latn-1977","un-mon-Mong-Latn-general-2013","un-mon-Mong-Latn-phonetic-2013","un-nep-Deva-Latn-1972","un-nep-Deva-Latn-2013","un-ori-Orya-Latn-1972","un-pan-Guru-Latn-1972","un-prs-Arab-Latn-1967","un-rus-Cyrl-Latn-1987","un-sin-Sinh-Latn-1972","un-srp-Cyrl-Latn-1997","un-tam-Taml-Latn-1972","un-tel-Telu-Latn-1972","un-ukr-Cyrl-Latn-1998","un-ukr-Cyrl-Latn-2012","un-urd-Arab-Latn-1972","var-amh-Ethi-Latn-eae-2003","var-ara-Arab-Arab-rababa","var-gez-Ethi-Latn-eae-2003","var-hin-Deva-Latn-hunterian-1872","var-jpn-Hrkt-Latn-hepburn-1886","var-jpn-Hrkt-Latn-hepburn-1954","var-kor-Hang-Hang-jamo","var-kor-Hang-Latn-mr-1939","var-kor-Kore-Hang-2013","var-kor-Kore-Latn-mr-1939","var-mar-Deva-Latn-hunterian-1872","var-mon-Mong-Latn-1930","var-mon-Mong-Latn-lessing","var-mon-Mong-Latn-vpmc","var-pra-Deva-Latn-iast-1912","var-san-Deva-Latn-iast-1912","var-zho-Hani-Latn-wd-1979"];var Tl=new Set(["unicode","posix","var-Cyrl","var-kor"]),El=new Set(["var-ara-Arab-Arab-rababa"]),Ti=ki.filter(e=>!Tl.has(e)),xl=Ti.filter(e=>!El.has(e)),Ci=new Map;function de(){return Ti}function Ei(){return xl}async function xi(e,t){let n=Ci.get(t);if(n)return n;let r=await e.fetch(new Request(`https://assets.internal/${t}.json`));if(!r.ok)throw new I(t);let a=await r.json(),i=ur(a);return Ci.set(t,i),i}var _i={"acadsin-zho-Hani-Latn-2002":"Hani","alalc-amh-Ethi-Latn-1997":"Ethi","alalc-amh-Ethi-Latn-2011":"Ethi","alalc-ara-Arab-Latn-1997":"Arab","alalc-asm-Deva-Latn-1997":"Deva","alalc-asm-Deva-Latn-2012":"Deva","alalc-aze-Arab-Latn-1997":"Arab","alalc-aze-Cyrl-Latn-1997":"Cyrl","alalc-bel-Cyrl-Latn-1997":"Cyrl","alalc-ben-Beng-Latn-1997":"Beng","alalc-ben-Beng-Latn-2017":"Beng","alalc-bul-Cyrl-Latn-1997":"Cyrl","alalc-div-Thaa-Latn-1997":"Thaa","alalc-div-Thaa-Latn-2012":"Thaa","alalc-ell-Grek-Latn-1997":"Grek","alalc-ell-Grek-Latn-2010":"Grek","alalc-fas-Arab-Latn-1997":"Arab","alalc-guj-Gujr-Latn-1997":"Gujr","alalc-guj-Gujr-Latn-2011":"Gujr","alalc-hin-Deva-Latn-1997":"Deva","alalc-hin-Deva-Latn-2011":"Deva","alalc-kan-Kana-Latn-1997":"Kana","alalc-kan-Kana-Latn-2011":"Kana","alalc-kat-Geok-Latn-1997":"Geok","alalc-kat-Geok-Latn-2011":"Geok","alalc-kat-Geor-Latn-1997":"Geor","alalc-kat-Geor-Latn-2011":"Geor","alalc-kor-Hang-Latn-1997":"Hang","alalc-mal-Mlym-Latn-1997":"Mlym","alalc-mal-Mlym-Latn-2012":"Mlym","alalc-mar-Deva-Latn-1997":"Deva","alalc-mar-Deva-Latn-2011":"Deva","alalc-mkd-Cyrl-Latn-1997":"Cyrl","alalc-mkd-Cyrl-Latn-2013":"Cyrl","alalc-mon-Cyrl-Latn-1997":"Cyrl","alalc-ori-Orya-Latn-1997":"Orya","alalc-ori-Orya-Latn-2011":"Orya","alalc-pan-Guru-Latn-1997":"Guru","alalc-pan-Guru-Latn-2011":"Guru","alalc-pli-Deva-Latn-2012":"Deva","alalc-pra-Deva-Latn-2012":"Deva","alalc-rus-Cyrl-Latn-1997":"Cyrl","alalc-rus-Cyrl-Latn-2012":"Cyrl","alalc-san-Deva-Latn-2012":"Deva","alalc-sin-Sinh-Latn-1997":"Sinh","alalc-sin-Sinh-Latn-2011":"Sinh","alalc-srp-Cyrl-Latn-1997":"Cyrl","alalc-srp-Cyrl-Latn-2013":"Cyrl","alalc-tam-Taml-Latn-1997":"Taml","alalc-tam-Taml-Latn-2011":"Taml","alalc-tel-Telu-Latn-1997":"Telu","alalc-tel-Telu-Latn-2011":"Telu","alalc-tir-Ethi-Latn-1997":"Ethi","alalc-tir-Ethi-Latn-2011":"Ethi","alalc-ukr-Cyrl-Latn-1997":"Cyrl","alalc-ukr-Cyrl-Latn-2011":"Cyrl","apcbg-bul-Cyrl-Latn-1995":"Cyrl","az-aze-Cyrl-Latn-1939":"Cyrl","az-aze-Cyrl-Latn-1958":"Cyrl","bas-rus-Cyrl-Latn-2017-bss":"Cyrl","bas-rus-Cyrl-Latn-2017-oss":"Cyrl","bgn-jpn-Hrkt-Latn-1962":"Hrkt","bgn-kor-Hang-Latn-1943":"Hang","bgn-kor-Kore-Latn-1943":"Kore","bgna-bul-Cyrl-Latn-2006":"Cyrl","bgna-bul-Cyrl-Latn-2009":"Cyrl","bgnpcgn-amh-Ethi-Latn-1967":"Ethi","bgnpcgn-ara-Arab-Latn-1956":"Arab","bgnpcgn-arm-Armn-Latn-1981":"Armn","bgnpcgn-aze-Cyrl-Latn-1993":"Cyrl","bgnpcgn-bak-Cyrl-Latn-2007":"Cyrl","bgnpcgn-bal-Arab-Latn-2008":"Arab","bgnpcgn-bel-Cyrl-Latn-1979":"Cyrl","bgnpcgn-bul-Cyrl-Latn-1952":"Cyrl","bgnpcgn-bul-Cyrl-Latn-2013":"Cyrl","bgnpcgn-che-Cyrl-Latn-2008":"Cyrl","bgnpcgn-deu-Latn-Latn-2000":"Latn","bgnpcgn-div-Thaa-Latn-1972":"Thaa","bgnpcgn-div-Thaa-Latn-1988":"Thaa","bgnpcgn-ell-Grek-Latn-1962":"Grek","bgnpcgn-ell-Grek-Latn-1996":"Grek","bgnpcgn-fao-Latn-Latn-1964":"Latn","bgnpcgn-fao-Latn-Latn-1968":"Latn","bgnpcgn-fas-Arab-Latn-1956":"Arab","bgnpcgn-isl-Latn-Latn-1964":"Latn","bgnpcgn-isl-Latn-Latn-1968":"Latn","bgnpcgn-jpn-Hrkt-Latn-1976":"Hrkt","bgnpcgn-kat-Geor-Latn-1981":"Geor","bgnpcgn-kat-Geor-Latn-2009":"Geor","bgnpcgn-kaz-Cyrl-Latn-1979":"Cyrl","bgnpcgn-kir-Cyrl-Latn-1979":"Cyrl","bgnpcgn-kor-Hang-Latn-kn-1945":"Hang","bgnpcgn-kor-Hang-Latn-rok-2011":"Hang","bgnpcgn-kor-Kore-Latn-rok-2011":"Kore","bgnpcgn-kur-Arab-Latn-2007":"Arab","bgnpcgn-mkd-Cyrl-Latn-1981":"Cyrl","bgnpcgn-mkd-Cyrl-Latn-2013":"Cyrl","bgnpcgn-mon-Cyrl-Latn-1964":"Cyrl","bgnpcgn-nep-Deva-Latn-2011":"Deva","bgnpcgn-per-Arab-Latn-1958":"Arab","bgnpcgn-prs-Arab-Latn-2007":"Arab","bgnpcgn-prs-Arab-Latn-yaghoubi":"Arab","bgnpcgn-pus-Arab-Latn-1968":"Arab","bgnpcgn-ron-Cyrl-Latn-2002":"Cyrl","bgnpcgn-rue-Cyrl-Latn-2016":"Cyrl","bgnpcgn-rus-Cyrl-Latn-1947":"Cyrl","bgnpcgn-sme-Latn-Latn-1984":"Latn","bgnpcgn-srp-Cyrl-Latn-1962":"Cyrl","bgnpcgn-srp-Cyrl-Latn-2005":"Cyrl","bgnpcgn-tat-Cyrl-Latn-2007":"Cyrl","bgnpcgn-tgk-Cyrl-Latn-1994":"Cyrl","bgnpcgn-tir-Ethi-Latn-2007":"Ethi","bgnpcgn-tuk-Cyrl-Latn-1979":"Cyrl","bgnpcgn-tuk-Cyrl-Latn-1993":"Cyrl","bgnpcgn-ukr-Cyrl-Latn-1965":"Cyrl","bgnpcgn-ukr-Cyrl-Latn-2019":"Cyrl","bgnpcgn-urd-Arab-Latn-2007":"Arab","bgnpcgn-uzb-Cyrl-Latn-1979":"Cyrl","bgnpcgn-uzb-Cyrl-Latn-2000":"Cyrl","bgnpcgn-zho-Hans-Latn-1979":"Hans","bis-asm-Beng-Latn-13194-1991":"Beng","bis-ben-Beng-Latn-13194-1991":"Beng","bis-dev-Deva-Latn-13194-1991":"Deva","bis-guj-Gujr-Latn-13194-1991":"Gujr","bis-kan-Kana-Latn-13194-1991":"Kana","bis-mlm-Mlym-Latn-13194-1991":"Mlym","bis-ori-Orya-Latn-13194-1991":"Orya","bis-pnj-Guru-Latn-13194-1991":"Guru","bis-tel-Telu-Latn-13194-1991":"Telu","bis-tml-Taml-Latn-13194-1991":"Taml","by-bel-Cyrl-Latn-1998":"Cyrl","by-bel-Cyrl-Latn-2007":"Cyrl","din-grc-Grek-Latn-31634-2011-t1":"Grek","din-hin-Deva-Latn-33904-2018":"Deva","din-kat-Geor-Latn-32707-2010":"Geor","din-mar-Deva-Latn-33904-2018":"Deva","din-nep-Deva-Latn-33904-2018":"Deva","din-pli-Deva-Latn-33904-2018":"Deva","din-pra-Deva-Latn-33904-2018":"Deva","din-san-Deva-Latn-33904-2018":"Deva","din-tam-Taml-Latn-33903-2016":"Taml","dos-nep-Deva-Latn-1997":"Deva","elot-ell-Grek-Latn-743-1982-tl":"Grek","elot-ell-Grek-Latn-743-1982-ts":"Grek","elot-ell-Grek-Latn-743-2001-tl":"Grek","elot-ell-Grek-Latn-743-2001-ts":"Grek","ggg-kat-Geor-Latn-2002":"Geor","gki-bel-Cyrl-Latn-1992":"Cyrl","gki-bel-Cyrl-Latn-2000":"Cyrl","gost-rus-Cyrl-Latn-16876-71-1983":"Cyrl","gost-rus-Cyrl-Latn-7.79-2000-2002":"Cyrl","hk-yue-Hani-Latn-1888":"Hani","icao-bel-Cyrl-Latn-9303":"Cyrl","icao-bul-Cyrl-Latn-9303":"Cyrl","icao-fas-Arab-Latn-9303":"Arab","icao-heb-Hebr-Latn-9303":"Hebr","icao-mkd-Cyrl-Latn-9303":"Cyrl","icao-rus-Cyrl-Latn-9303":"Cyrl","icao-srp-Cyrl-Latn-9303":"Cyrl","icao-ukr-Cyrl-Latn-9303":"Cyrl","iso-ara-Arab-Latn-233-1984":"Arab","iso-ara-Arab-Latn-233-2-1993":"Arab","iso-asm-Beng-Latn-15919-2001":"Beng","iso-ben-Beng-Latn-15919-2001":"Beng","iso-ell-Grek-Latn-843-1997-t1":"Grek","iso-ell-Grek-Latn-843-1997-t2":"Grek","iso-guj-Gujr-Latn-15919-2001":"Gujr","iso-hin-Deva-Latn-15919-2001":"Deva","iso-inc-Deva-Latn-15919-2001":"Deva","iso-jpn-Hrkt-Latn-3602-1989":"Hrkt","iso-kan-Kana-Latn-15919-2001":"Kana","iso-kat-Geor-Latn-9984-1996":"Geor","iso-kor-Hang-Latn-1996-method1":"Hang","iso-kor-Hang-Latn-1996-method2":"Hang","iso-mal-Mlym-Latn-15919-2001":"Mlym","iso-mar-Deva-Latn-15919-2001":"Deva","iso-nep-Deva-Latn-15919-2001":"Deva","iso-ori-Orya-Latn-15919-2001":"Orya","iso-pan-Guru-Latn-15919-2001":"Guru","iso-pli-Beng-Latn-15919-2001":"Beng","iso-pli-Deva-Latn-15919-2001":"Deva","iso-pli-Sinh-Latn-15919-2001":"Sinh","iso-pli-Thai-Latn-15919-2001":"Thai","iso-pra-Deva-Latn-15919-2001":"Deva","iso-prs-Arab-Latn-233-3-1999":"Arab","iso-rus-Cyrl-Latn-9-1995":"Cyrl","iso-san-Deva-Latn-15919-2001":"Deva","iso-tam-Taml-Latn-15919-2001":"Taml","iso-tel-Telu-Latn-15919-2001":"Telu","iso-tha-Thai-Latn-11940-1998":"Thai","kp-kor-Hang-Latn-2002":"Hang","lshk-yue-Hani-Latn-jyutping-1993":"Hani","masm-mon-Cyrl-Latn-5217-2012":"Cyrl","masm-mon-Latn-Cyrl-5217-2012":"Latn","mext-jpn-Hrkt-Latn-1954":"Hrkt","moct-kor-Hang-Latn-2000":"Hang","mofa-jpn-Hrkt-Latn-1989":"Hrkt","mv-div-Thaa-Latn-1987":"Thaa","mvd-bel-Cyrl-Latn-2008":"Cyrl","mvd-bel-Cyrl-Latn-2010":"Cyrl","mvd-rus-Cyrl-Latn-2008":"Cyrl","mvd-rus-Cyrl-Latn-2010":"Cyrl","odni-ara-Arab-Latn-2004":"Arab","odni-ara-Arab-Latn-2015":"Arab","odni-aze-Cyrl-Latn-2015":"Cyrl","odni-bel-Cyrl-Latn-2015":"Cyrl","odni-bul-Cyrl-Latn-2005":"Cyrl","odni-bul-Cyrl-Latn-2015":"Cyrl","odni-che-Cyrl-Latn-2015":"Cyrl","odni-fas-Arab-Latn-2004":"Arab","odni-fas-Arab-Latn-2015":"Arab","odni-hin-Deva-Latn-2004":"Deva","odni-hin-Deva-Latn-2015":"Deva","odni-kat-Geor-Latn-2015":"Geor","odni-kaz-Cyrl-Latn-2015":"Cyrl","odni-kir-Cyrl-Latn-2015":"Cyrl","odni-kor-Hang-Latn-2015":"Hang","odni-mkd-Cyrl-Latn-2005":"Cyrl","odni-mkd-Cyrl-Latn-2015":"Cyrl","odni-prs-Arab-Latn-2004":"Arab","odni-prs-Arab-Latn-2015":"Arab","odni-pus-Arab-Latn-2011":"Arab","odni-rus-Cyrl-Latn-2015":"Cyrl","odni-srp-Cyrl-Latn-2005":"Cyrl","odni-srp-Cyrl-Latn-2015":"Cyrl","odni-tat-Cyrl-Latn-2015":"Cyrl","odni-tgk-Cyrl-Latn-2015":"Cyrl","odni-tuk-Cyrl-Latn-2015":"Cyrl","odni-uig-Cyrl-Latn-2015":"Cyrl","odni-ukr-Cyrl-Latn-2015":"Cyrl","odni-urd-Arab-Latn-2015":"Arab","odni-uzb-Cyrl-Latn-2015":"Cyrl","sac-zho-Hans-Latn-1979":"Hans","sasm-mon-Mong-Latn-general-1978":"Mong","sasm-mon-Mong-Latn-phonetic-1978":"Mong","ses-ara-Arab-Latn-1930":"Arab","stategeocadastre-ukr-Cyrl-Latn-1993":"Cyrl","ua-ukr-Cyrl-Latn-1996":"Cyrl","ua-ukr-Cyrl-Latn-2007":"Cyrl","ua-ukr-Cyrl-Latn-2010":"Cyrl","un-amh-Ethi-Latn-2016":"Ethi","un-ara-Arab-Latn-1971":"Arab","un-ara-Arab-Latn-1972":"Arab","un-ara-Arab-Latn-2017":"Arab","un-asm-Beng-Latn-1972":"Beng","un-bel-Cyrl-Latn-2007":"Cyrl","un-ben-Beng-Latn-2016":"Beng","un-bul-Cyrl-Latn-1977":"Cyrl","un-ell-Grek-Latn-1987-phonetic":"Grek","un-ell-Grek-Latn-1987-tl":"Grek","un-ell-Grek-Latn-1987-ts":"Grek","un-guj-Gujr-Latn-1972":"Gujr","un-hin-Deva-Latn-2016":"Deva","un-kan-Kana-Latn-2016":"Kana","un-mal-Mlym-Latn-1972":"Mlym","un-mar-Deva-Latn-2016":"Deva","un-mkd-Cyrl-Latn-1977":"Cyrl","un-mon-Mong-Latn-general-2013":"Mong","un-mon-Mong-Latn-phonetic-2013":"Mong","un-nep-Deva-Latn-1972":"Deva","un-nep-Deva-Latn-2013":"Deva","un-ori-Orya-Latn-1972":"Orya","un-pan-Guru-Latn-1972":"Guru","un-prs-Arab-Latn-1967":"Arab","un-rus-Cyrl-Latn-1987":"Cyrl","un-sin-Sinh-Latn-1972":"Sinh","un-srp-Cyrl-Latn-1997":"Cyrl","un-tam-Taml-Latn-1972":"Taml","un-tel-Telu-Latn-1972":"Telu","un-ukr-Cyrl-Latn-1998":"Cyrl","un-ukr-Cyrl-Latn-2012":"Cyrl","un-urd-Arab-Latn-1972":"Arab","var-amh-Ethi-Latn-eae-2003":"Ethi","var-ara-Arab-Arab-rababa":"Arab","var-gez-Ethi-Latn-eae-2003":"Ethi","var-hin-Deva-Latn-hunterian-1872":"Deva","var-jpn-Hrkt-Latn-hepburn-1886":"Hrkt","var-jpn-Hrkt-Latn-hepburn-1954":"Hrkt","var-kor-Hang-Hang-jamo":"Hang","var-kor-Hang-Latn-mr-1939":"Hang","var-kor-Kore-Hang-2013":"Kore","var-kor-Kore-Latn-mr-1939":"Kore","var-mar-Deva-Latn-hunterian-1872":"Deva","var-mon-Mong-Latn-1930":"Mong","var-mon-Mong-Latn-lessing":"Mong","var-mon-Mong-Latn-vpmc":"Mong","var-pra-Deva-Latn-iast-1912":"Deva","var-san-Deva-Latn-iast-1912":"Deva","var-zho-Hani-Latn-wd-1979":"Hani"};var _l=[["Latn",[[65,90],[97,122],[192,255],[256,591]]],["Grek",[[880,1023],[7936,8191]]],["Cyrl",[[1024,1327]]],["Armn",[[1328,1423]]],["Hebr",[[1424,1535]]],["Arab",[[1536,1791],[1872,1919],[64336,65023],[65136,65279]]],["Deva",[[2304,2431]]],["Beng",[[2432,2559]]],["Guru",[[2560,2687]]],["Gujr",[[2688,2815]]],["Orya",[[2816,2943]]],["Taml",[[2944,3071]]],["Telu",[[3072,3199]]],["Kana",[[3200,3327]]],["Mlym",[[3328,3455]]],["Sinh",[[3456,3583]]],["Thaa",[[1920,1983]]],["Thai",[[3584,3711]]],["Geor",[[4256,4351],[7312,7359]]],["Ethi",[[4608,4991]]],["Mong",[[6144,6319]]],["Hang",[[4352,4607],[12592,12687],[44032,55215]]],["Hrkt",[[12352,12447],[12448,12543],[12784,12799]]],["Hani",[[11904,12031],[13312,19903],[19968,40959],[63744,64255],[131072,173791]]]];function Il(e){for(let[t,n]of _l)for(let[r,a]of n)if(e>=r&&e<=a)return t;return null}function Ii(e){let t=new Map;for(let a of e){let i=Il(a.codePointAt(0));i&&t.set(i,(t.get(i)??0)+1)}let n=null,r=0;for(let[a,i]of t){let s=a==="Latn"?i-.5:i;s>r&&(n=a,r=s)}return n}var Nl={Latn:["Latn"],Grek:["Grek"],Cyrl:["Cyrl"],Armn:["Armn"],Hebr:["Hebr"],Arab:["Arab"],Deva:["Deva"],Beng:["Beng"],Guru:["Guru"],Gujr:["Gujr"],Orya:["Orya"],Taml:["Taml"],Telu:["Telu"],Kana:["Kana"],Mlym:["Mlym"],Sinh:["Sinh"],Thai:["Thai"],Thaa:["Thaa"],Ethi:["Ethi"],Mong:["Mong"],Geor:["Geor"],Hang:["Hang","Kore"],Hrkt:["Hrkt","Kore"],Hani:["Hani","Hans","Kore","Hrkt"]};function Ni(e,t){let n=Nl[t];return!!e&&!!n&&n.includes(e)}var Mi;function Oi(e){if(Mi===e)return;Ai({strategies:[n=>xi(e,n)]}),Mi=e}async function Ri(e,t,n){return Oi(e),fr(t,n)}function Ml(e,t){if(e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let n=Array.from({length:t.length+1},(r,a)=>a);for(let r=1;r<=e.length;r++){let a=[r];for(let i=1;i<=t.length;i++)a[i]=Math.min(n[i]+1,a[i-1]+1,n[i-1]+(e[r-1]===t[i-1]?0:1));n=a}return n[t.length]}async function Di(e,t,n){Oi(e);let r=Ii(t),a=r?Ei().filter(s=>Ni(_i[s],r)):[],i=[];for(let s of a)try{let o=await fr(s,t);i.push({mapName:s,distance:Ml(o,n)})}catch{continue}return i.sort((s,o)=>s.distance-o.distance)}var Ge=class extends Error{constructor(n){super(`Input is too long (max ${n} characters)`);this.max=n;this.name="InputTooLongError"}max},He=class extends Error{constructor(n){super(`Couldn't locate ${n}`);this.systemCode=n;this.name="MapNotFoundError"}systemCode};var qe={input_max_size:1e6},ht=12e4;var qt="3.0.0-cloudflare.1",pr;function mt(e){pr=e}var Ht;function zi(e,t){Ht=e&&t?{endpoint:e,token:t}:void 0}var Ol={"var-ara-Arab-Arab-rababa":"ara-diac-1.0"};async function Rl(e,t){if(!Ht)throw new Error("ML inference unavailable \u2014 ML_ENDPOINT/ML_TOKEN not set");let n=await fetch(`${Ht.endpoint}/infer`,{method:"POST",headers:{"content-type":"application/json","x-api-key":Ht.token},body:JSON.stringify({model:e,input:t}),signal:AbortSignal.timeout(ht)}).catch(()=>null);if(!n||!n.ok)throw new Error("ML inference upstream failed");let r=await n.json().catch(()=>null);if(!r||typeof r.output!="string")throw new Error("ML inference returned no output");return r.output}function Pi(){if(!pr)throw new Error("ASSETS binding missing \u2014 see README deployment notes");return pr}async function $i(){return JSON.stringify({version:qt,engine:"interscript-ts@native-interpreter"})}function Fi(){return[...de()]}async function Kt(e,t){if(t.length>qe.input_max_size)throw new Ge(qe.input_max_size);let n=Ol[e];if(n)return Rl(n,t);try{return await Ri(Pi(),e,t)}catch(r){throw r instanceof I?new He(e):r}}async function Yt(e,t){return Di(Pi(),e,t)}var Bi={version:1,models:[{id:"khm-latn-1.0",kind:null,task:"translit",scripts:["Khmr","Latn"],precision:"fp32",filename:"khm-latn-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/khm-latn-1.0/khm-latn-1.0-fp32.zip",parts:null,sha256:"55993d473a2ed9489058779cad7e115db05e4020085b71616468cfae4f2f65cb",size:1418009977,metrics:[{name:"cer",value:27.42,source:"secryst/docs/RESULTS.md#khmer-transliteration-2026-08-14"},{name:"em",value:59.66,source:"secryst/docs/RESULTS.md#khmer-transliteration-2026-08-14"}],parity:{samples:895,cer_delta:0},license:"BSD-3-Clause"},{id:"urd-g2p-1.0",kind:null,task:"g2p",scripts:["Arab","IPA"],precision:"fp32",filename:"urd-g2p-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/urd-g2p-1.0/urd-g2p-1.0-fp32.zip",parts:null,sha256:"9f0a248c7116aa7f6b9ac125fb9684a3556f3b8ce8b64567c05a5e7e7a018ebf",size:1418039605,metrics:[{name:"cer",value:14.77,source:"rababa-urdu/docs/RESULTS.md#g2p-urdu-text--ipa"},{name:"em",value:33.6,source:"rababa-urdu/docs/RESULTS.md#g2p-urdu-text--ipa"}],parity:{samples:12699,cer_delta:0},license:"BSD-3-Clause"},{id:"urd-diac-1.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"urd-diac-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/urd-diac-1.0/urd-diac-1.0-fp32.zip",parts:null,sha256:"c299ea44a4da4851a52283f8e42d2fb6f8c7a9c443ba7eb0270f97372e10b8ea",size:1417851421,metrics:[{name:"cer",value:3.74,source:"rababa-urdu/docs/RESULTS.md#diacritization-urdu-text--text--haraqat"}],parity:{samples:11940,cer_delta:0},license:"BSD-3-Clause"},{id:"heb-diac-1.0",kind:null,task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb-diac-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-00",sha256:"5497f70cc3c96829e65f1eb0cc401c2d1ffeb4fa909acd4def824c2e019cbc37",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-1.0/heb-diac-1.0-fp32.zip.part-01",sha256:"a7d2011ab4f9326a86e234cc49cb50daf82949e51efbf03a21d5796c46465e9d",size:1281139753}],sha256:"b32fa239e0c56708b6004942de4b9e6e9f265e7cc3828f41d560e96386e20dd8",size:2781139753,metrics:[{name:"der_greedy",value:29,source:"rababa/docs/RESULTS.md#hebrew-diacritization"},{name:"der_beam4",value:17.46,source:"rababa/docs/RESULTS.md#hebrew-diacritization"}],parity:{samples:600,cer_delta:0},license:"BSD-3-Clause"},{id:"tha-g2p-base-1.0",kind:null,task:"g2p",scripts:["Thai","IPA"],precision:"fp32",filename:"tha-g2p-base-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-00",sha256:"c4525414e5dec91a54d055ca9f1acd51c198f81fbfc55977aa82c1fb038d58d7",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/tha-g2p-base-1.0/tha-g2p-base-1.0-fp32.zip.part-01",sha256:"f5d11fbd75f92e8b5471add867418e2dd4f49a5e258b9ded2f3b5ffa630abe24",size:1281174343}],sha256:"f341a5868867a9847d3f897d1fcc4d1d63b9a59b8913871bcf4ecab48f4fa895",size:2781174343,metrics:[{name:"per_teacher",value:1.25,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-base-1.0"},{name:"per_student",value:3.53,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-base-1.0"}],parity:{samples:1219,cer_delta:0},license:"BSD-3-Clause"},{id:"tha-g2p-small-1.0",kind:null,task:"g2p",scripts:["Thai","IPA"],precision:"int8",filename:"tha-g2p-small-1.0-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int8.zip",parts:null,sha256:"f2cfa93a42d98aabf08fdc82dfc6bd1574e21993f36558aa581fbe29e0588a94",size:257468517,metrics:[{name:"per_teacher",value:4.43,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student_beam4",value:12.06,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student",value:2.85,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"}],parity:{samples:1219,cer_delta:.0803},license:null},{id:"tha-g2p-small-1.0-int4",kind:null,task:"g2p",scripts:["Thai","IPA"],precision:"int4",filename:"tha-g2p-small-1.0-int4.zip",url:"https://github.com/interscript/interscript-models/releases/download/tha-g2p-small-1.0/tha-g2p-small-1.0-int4.zip",parts:null,sha256:"e5d12a3d65c6ac39fa08f52c975c99ff7a51c3e7b7aca7fbb461d2de2345e4cb",size:201958073,metrics:[{name:"per_teacher",value:4.43,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student_beam4",value:12.06,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"},{name:"per_student",value:2.85,source:"interscript/interscript-models docs/RESULTS.md#tha-g2p-small-1.0"}],parity:{samples:600,cer_delta:.0734},license:"BSD-3-Clause"},{id:"heb-diac-small-1.0",kind:null,task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb-diac-small-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-small-1.0/heb-diac-small-1.0-fp32.zip",parts:null,sha256:"905c53873d5a62bbe6252c6ec0ecef5f37e96e78cb01e8cd99b6b24c4d4d74ad",size:1418663344,metrics:[{name:"der_teacher_greedy",value:24.79,source:"interscript/interscript-models docs/RESULTS.md#heb-diac-small-1.0"},{name:"der_student_greedy",value:30.37,source:"interscript/interscript-models docs/RESULTS.md#heb-diac-small-1.0"}],parity:{samples:1864,cer_delta:0},license:null},{id:"fas-g2p-1.0",kind:null,task:"g2p",scripts:["Arab","Latn"],precision:"fp32",filename:"fas-g2p-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-00",sha256:"6c475e53f3c7ef3edcef5a24d2d81f51d13ddf4c417de98440943c9a32b03e55",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/fas-g2p-1.0/fas-g2p-1.0-fp32.zip.part-01",sha256:"c5656c649412f41e201c567e002514d31390b636d4650d9dcb6dfed1973fb3d5",size:1280254270}],sha256:"b53fd69196127efcc596935d24e135b3c897006872c1646c674e70f3c0d9a0e3",size:2780254270,metrics:[{name:"cer",value:1.6,source:"interscript/interscript-models docs/RESULTS.md#fas-g2p-1.0"},{name:"sb_homograph_ezafe_norm",value:77.34,source:"interscript/interscript-models docs/RESULTS.md#fas-g2p-1.0"}],parity:{samples:1e3,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-small-1.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-small-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-fp32.zip",parts:null,sha256:"8b149beb04294a2e482af876a34ae0fca3e87412606116fae1a376845fd4111a",size:1418126835,metrics:[{name:"der_teacher_greedy",value:1.3205,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_greedy",value:3.658,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_teacher_fullset",value:2.5815,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_fullset",value:8.259,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"}],parity:{samples:800,cer_delta:0},license:"BSD-3-Clause"},{id:"heb-diac-1.1",kind:null,task:"diacritization",scripts:["Hebr","Hebr"],precision:"fp32",filename:"heb.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-1.1/heb.zip.part-00",sha256:"8dac0d62e9b0ac4b137412eaf3a542953f11575f12f66f76cb93d3f5d788fc1b",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-1.1/heb.zip.part-01",sha256:"230c5ab731ea5f001f802d60b9e9a328c10b43bc311a19ef1974f114384313ed",size:1280987905}],sha256:"f0022dde8d06e46e8f08cf0b2f7bbb887a05ed686b90f1d5aa82ca3ef690a0b0",size:2780987905,metrics:[{name:"der_greedy",value:16.44,source:"rababa/docs/RESULTS.md#hebrew-diacritization"},{name:"der_beam4",value:16.43,source:"rababa/docs/RESULTS.md#hebrew-diacritization"}],parity:{samples:500,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-1.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-1.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-00",sha256:"6282a9291fb45ac7fcc3abe79d33b5913e91f87dcff8b305bf1d57ed98a3ed0b",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-1.0/ara-diac-1.0-fp32.zip.part-01",sha256:"7e7254a89ec75493871f6f61a993315097dad1bb0ba63c4584453c309e8cb906",size:1280311342}],sha256:"9e6d9777fe2474b150450774aaa1c9e8a9051b502b184fde298b91636dcfdac6",size:2780311342,metrics:[{name:"der_total_greedy",value:2.5793,source:"rababa/docs/RESULTS.md#r6-verdict-table-sadeeddiac-25-2026-08-21"},{name:"der_morph_greedy",value:1.5317,source:"rababa/docs/RESULTS.md#r6-verdict-table-sadeeddiac-25-2026-08-21"}],parity:{samples:500,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-small-1.0-int8",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-small-1.0-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-1.0/ara-diac-small-1.0-int8.zip",parts:null,sha256:"af247d837bee7e755b5287102cfb715c48dc90c2cf41ec1c41e7238e1a72b678",size:256959713,metrics:[{name:"der_teacher_greedy",value:1.3205,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_greedy",value:3.658,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_teacher_fullset",value:2.5815,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"},{name:"der_student_fullset",value:8.259,source:"interscript/interscript-models docs/RESULTS.md#ara-diac-small-1.0"}],parity:{samples:800,cer_delta:0},license:"BSD-3-Clause"},{id:"ara-diac-small-2.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-small-2.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.0/ara-diac-small-2.0-fp32.zip",parts:null,sha256:"d9aa95d0e8fd0d7da80fd2f7dabedf0ac65f55ba984de565d252f5e14906d98c",size:1418516306,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:5.0821,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:600,cer_delta:.1187},license:"BSD-3-Clause"},{id:"ara-diac-small-2.0-int8",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-small-2.0-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.0/ara-diac-small-2.0-int8.zip",parts:null,sha256:"f4d07acdaf9c18cded97e15e0c5636e6cee90de2fa32c5a373a44c0cc912bf50",size:264043016,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:4.8218,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:600,cer_delta:.1393},license:"BSD-3-Clause"},{id:"ara-diac-2.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-2.0-fp32.zip",url:null,parts:[{url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-fp32.zip.part-00",sha256:"28c272b5ce58031c356e75823eb581f12351a1675a52d8e4000f851c80d5e14d",size:15e8},{url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-fp32.zip.part-01",sha256:"86016da35e14a8fc05d4fbf3b1ad9ef24c29f9f7893f1716e40bef4b491effa2",size:1280299051}],sha256:"872c655ec6750bf44e5986f958de26767eafa13f8e0a7c64340bc35fd8a4550e",size:2780299051,metrics:[{name:"der_total_greedy",value:2.2864,source:"rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28"},{name:"der_morph_greedy",value:1.3343,source:"rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28"},{name:"wer_wikinews_multiref",value:17.3794,source:"rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28"},{name:"der_wikinews_multiref",value:11.8273,source:"rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28"}],parity:{samples:600,cer_delta:.0903},license:"BSD-3-Clause"},{id:"ara-diac-2.0-int8",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-2.0-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-2.0/ara-diac-2.0-int8.zip",parts:null,sha256:"7f1d55d43f97564ad62fc14a7e0cabe52c01d8298b747677a75900de748bb6c6",size:519207340,metrics:[{name:"der_total_greedy",value:2.2864,source:"rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28"},{name:"der_morph_greedy",value:1.3343,source:"rababa/docs/RESULTS.md#r7-verdict-table-sadeeddiac-25-2026-08-28"},{name:"wer_wikinews_multiref",value:17.3794,source:"rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28"},{name:"der_wikinews_multiref",value:11.8273,source:"rababa/docs/RESULTS.md#r7-ood-verdict-table-wikinews-2024-multiref-2026-08-28"}],parity:{samples:600,cer_delta:.0947},license:"BSD-3-Clause"},{id:"ara-diac-small-2.1",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-small-2.1-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-fp32.zip",parts:null,sha256:"a69918de9f87664fd97cdab3bf68b655966f608211dbeadd7b6fb3f7b03e5ffb",size:1419756840,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:4.5701,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:2480,cer_delta:.0714},license:null},{id:"ara-diac-small-2.1-int8",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-small-2.1-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-int8.zip",parts:null,sha256:"9b4e4aad2ab53a8cfbec432a78e27b409376627243aec3fd043f06574552a32b",size:267965657,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:4.5701,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:2480,cer_delta:.0857},license:"BSD-3-Clause"},{id:"ara-diac-layerdrop-1.0",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp32",filename:"ara-diac-layerdrop-1.0-fp32.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-fp32.zip",parts:null,sha256:"8f297bdc0e7eba5160c6ed8a2a437abbd399687fd14f2f2b640a4b4c639a3d16",size:1015218371,metrics:[{name:"der_teacher_fullset",value:2.2921,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"},{name:"der_student_fullset",value:5.784,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"}],parity:{samples:2480,cer_delta:.0632},license:"BSD-3-Clause"},{id:"ara-diac-layerdrop-1.0-int8",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-layerdrop-1.0-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-int8.zip",parts:null,sha256:"68dcc06cd8861e017c4d4912ce3e1fe057d78b79b0a7b6246ae8603c99930963",size:191603048,metrics:[{name:"der_teacher_fullset",value:2.2921,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"},{name:"der_student_fullset",value:5.784,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"}],parity:{samples:2480,cer_delta:.0538},license:"BSD-3-Clause"},{id:"ara-diac-layerdrop-1.0-int4",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int4",filename:"ara-diac-layerdrop-1.0-int4.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-layerdrop-1.0/ara-diac-layerdrop-1.0-int4.zip",parts:null,sha256:"352e02105645a6e283e2c3602505bea0e90085b741666fd863e478e4835e7bc9",size:145195702,metrics:[{name:"der_teacher_fullset",value:2.2921,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"},{name:"der_student_fullset",value:5.784,source:"interscript/interscript-models docs/RESULTS.md#layerdrop-6ep"}],parity:{samples:2480,cer_delta:.0589},license:"BSD-3-Clause"},{id:"ara-diac-small-2.1-fp16",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"fp16",filename:"ara-diac-small-2.1-fp16.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-2.1/ara-diac-small-2.1-fp16.zip",parts:null,sha256:"395ee72137d1cdfa9cd53bf167ad0d2f5fe5cbf9a5b62f118e0c9e0fa63c972d",size:706351903,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:4.5701,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:2480,cer_delta:.0714},license:"BSD-3-Clause"},{id:"ara-diac-small-int8static-2.1",kind:null,task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-small-int8static-2.1-int8.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-small-int8static-2.1/ara-diac-small-int8static-2.1-int8.zip",parts:null,sha256:"7836bfd5582ad054ee419bfbd45a2b4a87fe8dc91e1f849898428faefd0c95da",size:515362212,metrics:[{name:"der_teacher_fullset",value:2.289,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"},{name:"der_student_fullset",value:4.5701,source:"interscript/interscript-models docs/RESULTS.md#run-006-r7-muon"}],parity:{samples:2480,cer_delta:.1038},license:"BSD-3-Clause"},{id:"ara-diac-plane-1.0",kind:"plane",task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-plane-1.0.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-plane-1.0/ara-diac-plane-1.0.zip",parts:null,sha256:"1310204e36acc4fcbb988e9f9c46cf6422e7ea3860bd467fb469ea0ad4d39ef3",size:219076965,metrics:[{name:"der_total_greedy",value:3.5905,source:"interscript/interscript-models docs/RESULTS.md#run-018-plane-v2"},{name:"der_morph_greedy",value:2.2149,source:"interscript/interscript-models docs/RESULTS.md#run-018-plane-v2"}],parity:null,license:"BSD-3-Clause"},{id:"ara-diac-plane-large-1.0",kind:"plane",task:"diacritization",scripts:["Arab","Arab"],precision:"int8",filename:"ara-diac-plane-large-1.0.zip",url:"https://github.com/interscript/interscript-models/releases/download/ara-diac-plane-large-1.0/ara-diac-plane-large-1.0.zip",parts:null,sha256:"a66df2e12ddc935e8ab59836fd45486f17ac40b764c1619c03b2b0e191608a52",size:866052488,metrics:[{name:"der_total_greedy",value:2.7397,source:"interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05"},{name:"der_morph_greedy",value:1.6717,source:"interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05"},{name:"wer_total_greedy",value:8.6083,source:"interscript/interscript-models docs/RESULTS.md#run-019-epoch-2--27397-second-epoch-closes-a-third-of-the-gap-sota-gate-still-open-2026-10-05"}],parity:null,license:"BSD-3-Clause"},{id:"heb-diac-plane-1.0",kind:"plane",task:"diacritization",scripts:["Hebr","Hebr"],precision:"int8",filename:"heb-diac-plane-1.0.zip",url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-plane-1.0/heb-diac-plane-1.0.zip",parts:null,sha256:"dd9ae811c60c38f28ead57bdefa022b281867401ee13e38563b990eaf7f81f95",size:219322007,metrics:[{name:"der_total_greedy",value:12.48,source:"interscript/interscript-models docs/RESULTS.md#run-021-heb-plane--1248-nakdimon-der-the-plane-family-generalizes-seq2seq-student-beaten-at-396pp-2026-10-07"}],parity:null,license:"BSD-3-Clause"},{id:"heb-diac-plane-2.0",kind:"plane",task:"diacritization",scripts:["Hebr","Hebr"],precision:"int8",filename:"heb-diac-plane-2.0.zip",url:"https://github.com/interscript/interscript-models/releases/download/heb-diac-plane-2.0/heb-diac-plane-2.0.zip",parts:null,sha256:"9c8f0432294ebae6abc847ddb79572c1ab979f4851f03d44a9bb6495ba767a9e",size:415901226,metrics:[{name:"der_total_greedy",value:8.18,source:"interscript/interscript-models docs/RESULTS.md#run-022-heb-plane-base--818-der-at-the-artifact-level-gate-cleared-hebrew--430pp-2026-10-07"}],parity:null,license:"BSD-3-Clause"}]};var dr=Bi;function Vt(){return dr.models}function Ke(e){return dr.models.find(t=>t.id===e)}var Ui=dr.version;ir();var ji=100*1024*1024,V=class extends Error{constructor(n,r,a){super(a);this.status=n;this.code=r}status;code};function zl(){if(!(typeof caches>"u"))return caches.default}async function Pl(e,t){let n=zl(),r=`https://ml.interscript.internal/zip/${t}`,a=await n?.match(r);if(a)return new Uint8Array(await a.arrayBuffer());let i=await fetch(e);if(!i.ok)throw new V(502,"artifact_fetch_failed",`artifact fetch failed: ${i.status}`);let s=new Uint8Array(await i.arrayBuffer()),o=await crypto.subtle.digest("SHA-256",s.buffer),c=Array.from(new Uint8Array(o)).map(u=>u.toString(16).padStart(2,"0")).join("");if(c!==t)throw new V(502,"artifact_sha_mismatch",`artifact sha256 mismatch: ${c}`);return await n?.put(r,new Response(s)),s}function Gi(e){return e instanceof V&&e.status>=500}async function Hi(e){let t=Ke(e.id);if(!t)throw new V(404,"unknown_model",`unknown model id '${e.id}'`);let n=t.kind??"imf-v1";if(n!=="plane")throw new V(501,"kind_not_edge_executable",`kind '${n}' does not run in-worker yet; use the interscript runtime (py/ruby/ts)`);if(!t.url||!t.sha256)throw new V(503,"artifact_unresolvable","model has no release artifact");let a={artifact:{url:t.url,sha256:t.sha256,size:t.size??void 0},text:e.text};return e.preserveDiacritics!==void 0&&(a.preserveDiacritics=e.preserveDiacritics),$l(a)}async function $l(e){let{artifact:t,text:n}=e;if((t.size??0)>ji)throw new V(503,"model_too_large_for_worker",`artifact exceeds the in-worker budget (${ji} bytes); workerd isolates cap at 128 MB. Run via the interscript runtime (py/ruby/ts) or a self-hosted inference service.`);let r=await Pl(t.url,t.sha256),a=await ft(r);try{return await a.transform(n,{preserveDiacritics:e.preserveDiacritics??!1})}finally{await a.dispose()}}var qi={openapi:"3.1.0",info:{title:"Interscript API",version:"1.0.0",description:"Transliteration and neural text processing. Maps run in-edge on the interscript-ts native interpreter (289 systems); neural models (diacritization, grapheme-to-phoneme) run on Interscript's inference service. GraphQL remains available at POST /graphql.",license:{name:"BSD-3-Clause"}},servers:[{url:"https://api.interscript.org"}],tags:[{name:"service"},{name:"maps"},{name:"transliteration"},{name:"models"},{name:"inference"}],paths:{"/":{get:{tags:["service"],summary:"Service index",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/info":{get:{tags:["service"],summary:"Version and capability summary",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/maps":{get:{tags:["maps"],summary:"Every bundled transliteration system code",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/maps/{code}":{get:{tags:["maps"],summary:"One system's compiled map (JSON IR)",parameters:[{name:"code",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{$ref:"#/components/responses/Ok"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/transliterate":{post:{tags:["transliteration"],summary:"Transliterate text with a system",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/TransliterateRequest"},examples:{gek:{value:{system:"ungegn-kor-Kore-Latn-1939",input:"\uD3C9\uC591"}}}}}},responses:{200:{description:"Transliterated output",content:{"application/json":{schema:{$ref:"#/components/schemas/TransliterateResponse"}}}},404:{$ref:"#/components/responses/NotFound"},413:{$ref:"#/components/responses/Error"}}}},"/v1/detect":{post:{tags:["transliteration"],summary:"Rank systems by how well they map input to output",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/DetectRequest"}}}},responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/models":{get:{tags:["models"],summary:"The neural model index (IMF v1)",responses:{200:{$ref:"#/components/responses/Ok"}}}},"/v1/models/{id}":{get:{tags:["models"],summary:"One model's full entry (metrics, parity, download)",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{$ref:"#/components/responses/Ok"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/infer/batch":{post:{tags:["inference"],summary:"Batch neural inference",description:"Up to 50 inputs per request against one model; per-item error isolation.",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{model:{type:"string"},inputs:{type:"array",items:{type:"string"},maxItems:50}},required:["model","inputs"]}}}},responses:{200:{description:"Per-item results"},400:{$ref:"#/components/responses/BadRequest"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/assets/{tag}/{file}":{get:{tags:["maps"],summary:"Release asset (CORS proxy)",description:"Streaming pass-through to GitHub Releases assets with permissive CORS.",parameters:[{name:"tag",in:"path",required:!0,schema:{type:"string"}},{name:"file",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Asset bytes"},404:{$ref:"#/components/responses/NotFound"}}}},"/v1/infer":{post:{tags:["inference"],summary:"Run a neural model (diacritization or G2P)",description:"Proxy to Interscript's inference service. Only models whose task is diacritization or g2p are served; see GET /v1/models for the catalog.",requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/InferRequest"},examples:{hebrew:{value:{model:"heb-diac-1.0",input:"\u05E9\u05DC\u05D5\u05DD \u05E2\u05DC\u05D9\u05DB\u05DD"},summary:"Hebrew nikud restoration"},urdu:{value:{model:"urd-g2p-1.0",input:"\u0627\u0631\u062F\u0648"},summary:"Urdu grapheme-to-phoneme"}}}}},responses:{200:{description:"Model output",content:{"application/json":{schema:{$ref:"#/components/schemas/InferResponse"}}}},404:{$ref:"#/components/responses/NotFound"},502:{$ref:"#/components/responses/Error"},503:{$ref:"#/components/responses/Error"}}}}},components:{schemas:{Error:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"}}}}},TransliterateRequest:{type:"object",required:["system","input"],properties:{system:{type:"string",description:"A system code from GET /v1/maps",examples:["ungegn-kor-Kore-Latn-1939"]},input:{type:"string",maxLength:1e6}}},TransliterateResponse:{type:"object",properties:{system:{type:"string"},input:{type:"string"},output:{type:"string"}}},DetectRequest:{type:"object",required:["input","output"],properties:{input:{type:"string"},output:{type:"string"}}},InferRequest:{type:"object",required:["model","input"],properties:{model:{type:"string",description:"A model id from GET /v1/models",examples:["heb-diac-1.0"]},input:{type:"string",maxLength:4e3}}},InferResponse:{type:"object",properties:{model:{type:"string"},task:{type:"string",enum:["diacritization","g2p"]},input:{type:"string"},output:{type:"string"}}}},responses:{Ok:{description:"Success",content:{"application/json":{schema:{type:"object"}}}},BadRequest:{description:"Malformed request",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}},NotFound:{description:"Unknown system or model",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}},Error:{description:"Error",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}}}}};var Fl=[{method:"GET",path:"/v1/info",note:"version + capability summary"},{method:"GET",path:"/v1/maps",note:"every transliteration system code"},{method:"GET",path:"/v1/maps/{code}",note:"one system's compiled map (JSON IR)"},{method:"POST",path:"/v1/transliterate",note:"{system, input} \u2192 {output}"},{method:"POST",path:"/v1/detect",note:"{input, output} \u2192 ranked systems"},{method:"GET",path:"/v1/models",note:"neural model index (IMF v1)"},{method:"GET",path:"/v1/models/{id}",note:"one model's metadata"},{method:"POST",path:"/v1/infer",note:"{model, input} \u2192 {output}"},{method:"POST",path:"/v1/infer/batch",note:"{model, inputs[]} \u2192 per-item results (\u226450)"},{method:"GET",path:"/v1/assets/{tag}/{file}",note:"CORS streaming proxy for release assets"},{method:"POST",path:"/graphql",note:"GraphQL endpoint (introspection enabled)"},{method:"GET",path:"/openapi.json",note:"OpenAPI 3.1 document"}];function Wt(e){return e.replace(/&/g,"&").replace(//g,">")}function hr(e){return` @@ -51,7 +68,7 @@ var hn=Object.defineProperty;var d=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&( -${mr.map(n=>``).join(` +${Fl.map(n=>``).join(` `)}
MethodEndpointBehavior
${ye(n.method)}${ye(n.path)}${ye(n.note)}
${Wt(n.method)}${Wt(n.path)}${Wt(n.note)}
@@ -66,7 +83,7 @@ ${mr.map(n=>`${ye(n.method)}${ye(n

Machine-readable