diff --git a/.gitignore b/.gitignore index 685c3b7f..24c9bfdd 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ todo/ fuzz-*.log .claude/settings.local.json .deepsec/ +plans/ diff --git a/examples/cjs-consumer/pnpm-lock.yaml b/examples/cjs-consumer/pnpm-lock.yaml index 0aa2ae81..679bc608 100644 --- a/examples/cjs-consumer/pnpm-lock.yaml +++ b/examples/cjs-consumer/pnpm-lock.yaml @@ -57,6 +57,10 @@ packages: dev: false optional: true + /@standard-schema/spec@1.1.0: + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + dev: false + /@tokenizer/inflate@0.4.1: resolution: {integrity: sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==} engines: {node: '>=18'} @@ -179,6 +183,13 @@ packages: engines: {node: '>=0.3.1'} dev: false + /effect@3.21.0: + resolution: {integrity: sha512-PPN80qRokCd1f015IANNhrwOnLO7GrrMQfk4/lnZRE/8j7UPWrNNjPV0uBrZutI/nHzernbW+J0hdqQysHiSnQ==} + dependencies: + '@standard-schema/spec': 1.1.0 + fast-check: 3.23.2 + dev: false + /end-of-stream@1.4.5: resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} requiresBuild: true @@ -194,6 +205,13 @@ packages: dev: false optional: true + /fast-check@3.23.2: + resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==} + engines: {node: '>=8.0.0'} + dependencies: + pure-rand: 6.1.0 + dev: false + /fast-xml-builder@1.0.0: resolution: {integrity: sha512-fpZuDogrAgnyt9oDDz+5DBz0zgPdPZz6D4IR7iESxRXElrlGTRkHJ9eEt+SACRJwT0FNFrt71DFQIUFBJfX/uQ==} dev: false @@ -373,6 +391,10 @@ packages: dev: false optional: true + /pure-rand@6.1.0: + resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} + dev: false + /pyodide@0.27.7: resolution: {integrity: sha512-RUSVJlhQdfWfgO9hVHCiXoG+nVZQRS5D9FzgpLJ/VcgGBLSAKoPL8kTiOikxbHQm1kRISeWUBdulEgO26qpSRA==} engines: {node: '>=18.0.0'} @@ -593,6 +615,7 @@ packages: dependencies: compressjs: 1.0.3 diff: 8.0.3 + effect: 3.21.0 fast-xml-parser: 5.4.2 file-type: 21.3.0 ini: 6.0.0 diff --git a/examples/custom-command/commands.ts b/examples/custom-command/commands.ts index 7bbc5af3..b92df25f 100644 --- a/examples/custom-command/commands.ts +++ b/examples/custom-command/commands.ts @@ -13,7 +13,7 @@ import { buildLinkSummaryPrompt, pickSummaryLengthForCharacters, } from "@steipete/summarize-core/prompts"; -import { defineCommand } from "just-bash"; +import { decodeBytesToUtf8, defineCommand } from "just-bash"; /** * Generate a random UUID @@ -50,10 +50,11 @@ export const uuidCommand = defineCommand("uuid", async (args) => { * Usage: json-format [file] or pipe JSON to it */ export const jsonFormatCommand = defineCommand("json-format", async (args, ctx) => { - let input = ctx.stdin; + // Decode bytes to text — JSON.parse requires real Unicode. + let input = decodeBytesToUtf8(ctx.stdin); // Read from file if provided - if (args[0] && !ctx.stdin) { + if (args[0] && !input) { try { input = await ctx.fs.readFile(ctx.fs.resolvePath(ctx.cwd, args[0])); } catch { @@ -134,10 +135,12 @@ export const loremCommand = defineCommand("lorem", async (args) => { * Similar to wc but with labeled output */ export const wordcountCommand = defineCommand("wordcount", async (args, ctx) => { - let input = ctx.stdin; + // ctx.stdin is a `ByteString` (the pipeline carries raw bytes); decode + // for the line/word/char math, which only makes sense on Unicode text. + let input = decodeBytesToUtf8(ctx.stdin); // Read from file if provided - if (args[0] && !ctx.stdin) { + if (args[0] && !input) { try { input = await ctx.fs.readFile(ctx.fs.resolvePath(ctx.cwd, args[0])); } catch { @@ -151,7 +154,7 @@ export const wordcountCommand = defineCommand("wordcount", async (args, ctx) => const lines = input.split("\n").length - (input.endsWith("\n") ? 1 : 0); const words = input.trim().split(/\s+/).filter(Boolean).length; - const chars = input.length; + const chars = Array.from(input).length; return { stdout: `Lines: ${lines}\nWords: ${words}\nChars: ${chars}\n`, @@ -166,8 +169,12 @@ export const wordcountCommand = defineCommand("wordcount", async (args, ctx) => * Usage: reverse or pipe text to it */ export const reverseCommand = defineCommand("reverse", async (_args, ctx) => { - const lines = ctx.stdin.split("\n"); - const reversed = lines.map((line) => line.split("").reverse().join("")); + // Decode bytes to text so reversing happens by codepoint (multibyte + // characters stay intact). `Array.from` splits on Unicode codepoints + // rather than UTF-16 code units, so emoji / surrogate pairs survive. + const text = decodeBytesToUtf8(ctx.stdin); + const lines = text.split("\n"); + const reversed = lines.map((line) => Array.from(line).reverse().join("")); return { stdout: reversed.join("\n"), stderr: "", diff --git a/examples/executor-tools/CHANGELOG.md b/examples/executor-tools/CHANGELOG.md new file mode 100644 index 00000000..272e467a --- /dev/null +++ b/examples/executor-tools/CHANGELOG.md @@ -0,0 +1,24 @@ +# executor-tools-example + +## 1.0.3 + +### Patch Changes + +- Updated dependencies [[`01a4721`](https://github.com/vercel-labs/just-bash/commit/01a4721324350adea4b035b311f0b60ccdbb65ff)]: + - just-bash@3.0.1 + - @just-bash/executor@1.0.2 + +## 1.0.2 + +### Patch Changes + +- Updated dependencies [[`fd98df8`](https://github.com/vercel-labs/just-bash/commit/fd98df8048d658454ed0769c020594754bf6e43d)]: + - @just-bash/executor@1.0.1 + +## 1.0.1 + +### Patch Changes + +- Updated dependencies [[`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79), [`b3bd85e`](https://github.com/vercel-labs/just-bash/commit/b3bd85ed816445e6d148290163a1900f49ebea82), [`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79)]: + - just-bash@3.0.0 + - @just-bash/executor@1.0.0 diff --git a/examples/executor-tools/README.md b/examples/executor-tools/README.md new file mode 100644 index 00000000..df68ebe4 --- /dev/null +++ b/examples/executor-tools/README.md @@ -0,0 +1,56 @@ +# Executor Tools Examples + +Demonstrates executor tool invocation in just-bash. Sandboxed JavaScript code running in `js-exec` calls tools that fetch from real public APIs — no API keys needed. + +## Run + +```bash +cd examples/executor-tools +pnpm install + +# Run all examples +pnpm start + +# Run a specific example +npx tsx inline-tools.ts +npx tsx multi-turn-discovery.ts +npx tsx multi-api-agent.ts # default country: JP +npx tsx multi-api-agent.ts BR # override + +# Or via main.ts +npx tsx main.ts 1 # inline tools +npx tsx main.ts 2 # SDK discovery +npx tsx main.ts 3 # multi-API agent loop +``` + +## Examples + +### Example 1: Inline Tools (`inline-tools.ts`) + +Defines tools directly in the `Bash` constructor — no SDK required. + +1. **GraphQL tools** — Countries API queries exposed as `tools.countries.*` +2. **Utility tools** — `tools.util.timestamp()`, `tools.util.random()` +3. **Cross-tool scripts** — one js-exec script calling tools from multiple namespaces +4. **Tools + filesystem** — fetch data via tools, write to virtual fs, read with bash commands +5. **Error handling** — tool errors propagate as catchable exceptions + +### Example 2: Multi-Turn Tool Discovery (`multi-turn-discovery.ts`) + +Uses `experimental_executor.setup` with the real `@executor/sdk` to auto-discover tools from a live GraphQL schema — no inline tool definitions. The SDK introspects the countries API and registers one tool per query type. + +1. **Discover** — Agent reads `/.executor/config.json` to see registered sources +2. **Use** — Agent calls a discovered tool (`tools.countries.country({ code: "JP" })`) +3. **Filter** — Agent queries a list endpoint with filters (`tools.countries.countries()`) +4. **Chain** — Agent chains multiple tools: continents → countries per continent +5. **Persist** — Agent writes all 250 countries as CSV to the virtual filesystem + +### Example 3: Multi-API Agent Loop (`multi-api-agent.ts`) + +Three real public APIs (REST Countries, Open-Meteo, Wikipedia) are wrapped as inline executor tools and orchestrated across multiple turns to produce a "country snapshot" markdown report. Demonstrates the multi-source pattern from the upstream `@executor-js` examples — using inline tools instead of SDK-discovered ones, so it runs anywhere with no plugin dependencies. + +1. **Parallel lookup** — One js-exec script fetches country, weather, and Wikipedia data in sequence and stashes JSON results in the virtual filesystem +2. **Bash composition** — A pure-bash heredoc reads the saved JSON via `jq` and writes a markdown report +3. **CLI surface** — The same tools are also auto-exposed as bash commands (`country lookup code=BR | jq -r .name`) + +Pass a country code to override the default: `npx tsx multi-api-agent.ts US`. diff --git a/examples/executor-tools/inline-tools.ts b/examples/executor-tools/inline-tools.ts new file mode 100644 index 00000000..69aa036f --- /dev/null +++ b/examples/executor-tools/inline-tools.ts @@ -0,0 +1,141 @@ +/** + * Example 1: Inline Tools + * + * Demonstrates defining tools and calling them from sandboxed js-exec scripts. + * No @executor-js/sdk plugins required for inline tools — only the SDK itself + * is needed via @just-bash/executor's peer deps. + * + * Uses: + * - countries.trevorblades.com (GraphQL) — country data + * + * Run with: npx tsx inline-tools.ts + */ + +import { createExecutor } from "@just-bash/executor"; +import { Bash } from "just-bash"; + +const executor = await createExecutor({ + tools: { + // GraphQL tool — queries countries.trevorblades.com + "countries.list": { + description: "List countries, optionally filtered by continent code", + execute: async (args?: { continent?: string }) => { + const query = args?.continent + ? `query($code: String!) { countries(filter: { continent: { eq: $code } }) { code name capital emoji } }` + : `{ countries { code name capital emoji } }`; + const variables = args?.continent + ? { code: args.continent } + : undefined; + const res = await fetch("https://countries.trevorblades.com/graphql", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ query, variables }), + }); + const json = (await res.json()) as { data: { countries: unknown[] } }; + return json.data.countries; + }, + }, + + "countries.get": { + description: "Get a single country by ISO code", + execute: async (args: { code: string }) => { + const query = `query($code: ID!) { country(code: $code) { name capital currency emoji languages { name } continent { name } } }`; + const res = await fetch("https://countries.trevorblades.com/graphql", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ query, variables: { code: args.code } }), + }); + const json = (await res.json()) as { data: { country: unknown } }; + return json.data.country; + }, + }, + + // Simple sync tools + "util.timestamp": { + description: "Current Unix timestamp", + execute: () => ({ ts: Math.floor(Date.now() / 1000) }), + }, + "util.random": { + description: "Random number between min and max", + execute: (args: { min?: number; max?: number }) => ({ + value: Math.floor( + Math.random() * ((args.max ?? 100) - (args.min ?? 0)) + + (args.min ?? 0), + ), + }), + }, + }, +}); + +const bash = new Bash({ + executionLimits: { maxJsTimeoutMs: 60000 }, + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, +}); + +// 1. List European countries +console.log("1. European countries:"); +let r = await bash.exec(`js-exec -c ' + const countries = await tools.countries.list({ continent: "EU" }); + console.log(countries.length + " countries in Europe"); + for (const c of countries.slice(0, 5)) { + console.log(" " + c.emoji + " " + c.name + " — " + c.capital); + } + console.log(" ..."); +'`); +console.log(r.stdout); + +// 2. Country detail +console.log("2. Country detail:"); +r = await bash.exec(`js-exec -c ' + const c = await tools.countries.get({ code: "JP" }); + console.log(c.emoji + " " + c.name); + console.log(" Capital: " + c.capital); + console.log(" Currency: " + c.currency); + console.log(" Continent: " + c.continent.name); + console.log(" Languages: " + c.languages.map(l => l.name).join(", ")); +'`); +console.log(r.stdout); + +// 3. Mix tools from different sources +console.log("3. Cross-tool script:"); +r = await bash.exec(`js-exec -c ' + const ts = await tools.util.timestamp(); + const rand = await tools.util.random({ min: 0, max: 249 }); + const all = await tools.countries.list(); + const pick = all[rand.value]; + + console.log("Report at " + ts.ts); + console.log("Random country #" + rand.value + ": " + pick.emoji + " " + pick.name); +'`); +console.log(r.stdout); + +// 4. Tools + virtual filesystem +console.log("4. Fetch → write to fs → read with bash:"); +r = await bash.exec(`js-exec -c ' + const fs = require("fs"); + const countries = await tools.countries.list({ continent: "SA" }); + const csv = "code,name,capital\\n" + + countries.map(c => c.code + "," + c.name + "," + c.capital).join("\\n"); + fs.writeFileSync("/tmp/south-america.csv", csv); + console.log("Wrote " + countries.length + " rows to /tmp/south-america.csv"); +'`); +console.log(r.stdout); + +r = await bash.exec("cat /tmp/south-america.csv | head -5"); +console.log(" " + r.stdout.split("\n").join("\n ")); + +// 5. Error handling +console.log("5. Error handling:"); +r = await bash.exec(`js-exec -c ' + try { + await tools.countries.get({ code: "NOPE" }); + } catch (e) { + console.error("Caught: " + e.message); + } + console.log("Script continued after error"); +'`); +console.log(r.stdout); +if (r.stderr) console.log(" stderr: " + r.stderr); + +console.log("Done!"); diff --git a/examples/executor-tools/main.ts b/examples/executor-tools/main.ts new file mode 100644 index 00000000..08e5de33 --- /dev/null +++ b/examples/executor-tools/main.ts @@ -0,0 +1,37 @@ +/** + * Executor Tools Examples + * + * Runs all examples sequentially. You can also run each individually: + * npx tsx inline-tools.ts + * npx tsx multi-turn-discovery.ts + * npx tsx multi-api-agent.ts + */ + +const example = process.argv[2]; + +if (!example || example === "all") { + console.log("╔══════════════════════════════════════════╗"); + console.log("║ Executor Tools — All Examples ║"); + console.log("╚══════════════════════════════════════════╝\n"); + + console.log("─── Example 1: Inline Tools ───────────────────────\n"); + await import("./inline-tools.js"); + + console.log("\n─── Example 2: SDK Discovery ──────────────────────\n"); + await import("./multi-turn-discovery.js"); + + console.log("\n─── Example 3: Multi-API Agent Loop ───────────────\n"); + await import("./multi-api-agent.js"); +} else if (example === "1" || example === "inline") { + await import("./inline-tools.js"); +} else if (example === "2" || example === "discovery") { + await import("./multi-turn-discovery.js"); +} else if (example === "3" || example === "multi-api") { + await import("./multi-api-agent.js"); +} else { + console.error(`Unknown example: ${example}`); + console.error( + "Usage: npx tsx main.ts [all|1|2|3|inline|discovery|multi-api]", + ); + process.exit(1); +} diff --git a/examples/executor-tools/multi-api-agent.ts b/examples/executor-tools/multi-api-agent.ts new file mode 100644 index 00000000..0ca97f9e --- /dev/null +++ b/examples/executor-tools/multi-api-agent.ts @@ -0,0 +1,220 @@ +/** + * Example 3: Multi-API agent loop + * + * Three real public APIs, exposed as inline executor tools and orchestrated + * across multiple js-exec turns to produce a combined "country snapshot." + * + * Sources: + * - REST Countries (https://restcountries.com) — geo + currency + * - Open-Meteo (https://open-meteo.com) — current weather + * - Wikipedia REST (https://en.wikipedia.org) — summary blurb + * + * No auth required for any of them. Tools that need auth would live next to + * these as inline tools that read tokens from env vars and add the header + * before fetching — the same pattern as the upstream `headers:` config on + * SDK-discovered sources, just expressed in JS. + * + * Run with: npx tsx multi-api-agent.ts [COUNTRY_CODE] (default: JP) + */ + +import { createExecutor } from "@just-bash/executor"; +import { Bash } from "just-bash"; + +const ARG = process.argv[2] ?? "JP"; + +interface CountryRecord { + cca2: string; + name: { common: string }; + capital?: string[]; + capitalInfo?: { latlng?: [number, number] }; + currencies?: Record; + population: number; +} + +interface WeatherCurrent { + temperature_2m: number; + wind_speed_10m: number; + weather_code: number; + time: string; +} + +interface WikiSummary { + title: string; + extract: string; + content_urls?: { desktop?: { page?: string } }; +} + +// ── Inline tools ───────────────────────────────────────────────────────── + +const callLog: string[] = []; + +const executor = await createExecutor({ + tools: { + "country.lookup": { + description: "Get a country by ISO 3166-1 alpha-2 code (e.g. JP, US, DE)", + execute: async (args: { code: string }) => { + callLog.push(`country.lookup(${args.code})`); + const url = `https://restcountries.com/v3.1/alpha/${encodeURIComponent( + args.code, + )}?fields=cca2,name,capital,capitalInfo,currencies,population`; + const res = await fetch(url); + if (!res.ok) throw new Error(`restcountries: ${res.status}`); + const body = (await res.json()) as CountryRecord | CountryRecord[]; + // The API returns an array for query lookups but a single object for + // alpha-code lookups. Normalize. + const record = Array.isArray(body) ? body[0] : body; + if (!record) throw new Error(`no country for code ${args.code}`); + const currencyEntry = Object.entries(record.currencies ?? {})[0]; + return { + code: record.cca2, + name: record.name.common, + capital: record.capital?.[0] ?? null, + latlng: record.capitalInfo?.latlng ?? null, + population: record.population, + currency: currencyEntry + ? { code: currencyEntry[0], name: currencyEntry[1].name } + : null, + }; + }, + }, + + "weather.current": { + description: "Current weather for a lat/long (Open-Meteo)", + execute: async (args: { lat: number; lon: number }) => { + callLog.push(`weather.current(${args.lat},${args.lon})`); + const url = + `https://api.open-meteo.com/v1/forecast?latitude=${args.lat}` + + `&longitude=${args.lon}` + + `¤t=temperature_2m,wind_speed_10m,weather_code`; + const res = await fetch(url); + if (!res.ok) throw new Error(`open-meteo: ${res.status}`); + const json = (await res.json()) as { current: WeatherCurrent }; + return { + temperatureC: json.current.temperature_2m, + windKph: json.current.wind_speed_10m, + weatherCode: json.current.weather_code, + observedAt: json.current.time, + }; + }, + }, + + "wiki.summary": { + description: "Wikipedia REST summary for a page title", + execute: async (args: { title: string }) => { + callLog.push(`wiki.summary(${args.title})`); + const url = `https://en.wikipedia.org/api/rest_v1/page/summary/${encodeURIComponent( + args.title, + )}`; + const res = await fetch(url, { + headers: { "User-Agent": "just-bash-executor-example/1.0" }, + }); + if (!res.ok) throw new Error(`wikipedia: ${res.status}`); + const json = (await res.json()) as WikiSummary; + return { + title: json.title, + summary: json.extract, + url: json.content_urls?.desktop?.page ?? null, + }; + }, + }, + + "util.now": { + description: "Current ISO timestamp", + execute: () => { + callLog.push("util.now()"); + return { ts: new Date().toISOString() }; + }, + }, + }, +}); + +const bash = new Bash({ + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, + executionLimits: { maxJsTimeoutMs: 60_000 }, +}); + +console.log(`\n=== Country snapshot: ${ARG} ===\n`); + +// ── Turn 1: agent gathers all three pieces in parallel ────────────────── + +console.log("--- Turn 1: parallel lookup (country → weather + wiki) ---"); +let r = await bash.exec(`js-exec -c ' + var country = await tools.country.lookup({ code: ${JSON.stringify(ARG)} }); + console.log("Country: " + country.name + " (" + country.code + ")"); + console.log("Capital: " + (country.capital || "—")); + console.log("Population: " + country.population.toLocaleString()); + console.log("Currency: " + (country.currency ? country.currency.name + " (" + country.currency.code + ")" : "—")); + console.log("Coords: " + (country.latlng ? country.latlng.join(", ") : "—")); + + if (!country.latlng) throw new Error("no coords for capital"); + + var weather = await tools.weather.current({ lat: country.latlng[0], lon: country.latlng[1] }); + console.log(); + console.log("Weather at capital (" + weather.observedAt + "):"); + console.log(" " + weather.temperatureC + " °C, wind " + weather.windKph + " km/h"); + + var wiki = await tools.wiki.summary({ title: country.name }); + console.log(); + console.log("Wikipedia: " + wiki.title); + console.log(" " + wiki.summary.slice(0, 220) + (wiki.summary.length > 220 ? "…" : "")); + if (wiki.url) console.log(" " + wiki.url); + + // Stash the pieces in the virtual filesystem for the next turn to pick up. + var fs = require("fs"); + fs.writeFileSync("/tmp/country.json", JSON.stringify(country, null, 2)); + fs.writeFileSync("/tmp/weather.json", JSON.stringify(weather, null, 2)); + fs.writeFileSync("/tmp/wiki.json", JSON.stringify(wiki, null, 2)); +'`); +process.stdout.write(r.stdout); +if (r.stderr) process.stderr.write("[stderr] " + r.stderr); + +// ── Turn 2: bash composes the report from saved JSON ──────────────────── + +console.log("\n--- Turn 2: bash composes a markdown report ---"); +r = await bash.exec(` + set -e + ts=$(date -u +%Y-%m-%dT%H:%M:%SZ) + name=$(jq -r .name /tmp/country.json) + capital=$(jq -r '.capital // "—"' /tmp/country.json) + pop=$(jq -r .population /tmp/country.json) + temp=$(jq -r .temperatureC /tmp/weather.json) + wind=$(jq -r .windKph /tmp/weather.json) + blurb=$(jq -r .summary /tmp/wiki.json | head -c 200) + + cat > /tmp/snapshot.md < $blurb … + +_Generated: \${ts}_ +EOF + cat /tmp/snapshot.md +`); +process.stdout.write(r.stdout); +if (r.stderr) process.stderr.write("[stderr] " + r.stderr); + +// ── Turn 3: bash CLI form of the same tools ───────────────────────────── + +console.log("\n--- Turn 3: same tools via the auto-generated bash CLI ---"); +console.log("$ country lookup code=BR | jq -r '.name, .capital'"); +r = await bash.exec(`country lookup code=BR | jq -r '.name, .capital'`); +process.stdout.write(r.stdout); + +console.log("\n$ wiki summary title=Brazil | jq -r .title"); +r = await bash.exec(`wiki summary title=Brazil | jq -r .title`); +process.stdout.write(r.stdout); + +// ── Diagnostic: which tools were called ───────────────────────────────── + +console.log("\n--- Diagnostic ---"); +console.log(`Total tool calls: ${callLog.length}`); +for (const c of callLog) console.log(` - ${c}`); + +console.log("\nDone."); diff --git a/examples/executor-tools/multi-turn-discovery.ts b/examples/executor-tools/multi-turn-discovery.ts new file mode 100644 index 00000000..fe368dc5 --- /dev/null +++ b/examples/executor-tools/multi-turn-discovery.ts @@ -0,0 +1,166 @@ +/** + * Example 2: Multi-Turn Tool Discovery via createExecutor.setup + * + * Demonstrates an AI-agent pattern where tools are registered through the + * `@executor-js/sdk` discovery pipeline rather than inline. The SDK applies + * approval/elicitation gates to every call. + * + * The agent: + * 1. Inspects the SDK handle to see what sources were registered + * 2. Calls a discovered tool (single country) + * 3. Filters a list endpoint + * 4. Chains multiple discovered tools in a single script + * 5. Writes results to the virtual filesystem + * + * Run with: npx tsx multi-turn-discovery.ts + */ + +import { createExecutor } from "@just-bash/executor"; +import { Bash } from "just-bash"; + +const COUNTRIES = { + JP: { name: "Japan", capital: "Tokyo", continent: "Asia" }, + US: { name: "United States", capital: "Washington D.C.", continent: "North America" }, + BR: { name: "Brazil", capital: "Brasília", continent: "South America" }, + AR: { name: "Argentina", capital: "Buenos Aires", continent: "South America" }, + DE: { name: "Germany", capital: "Berlin", continent: "Europe" }, + FR: { name: "France", capital: "Paris", continent: "Europe" }, + KE: { name: "Kenya", capital: "Nairobi", continent: "Africa" }, +} as const; + +// Tools are registered via the SDK's discovery pipeline (kind: "custom"), +// so calls flow through approval/elicitation gates. For real GraphQL/OpenAPI/ +// MCP sources, swap the source kind — same architecture, different upstream. +const executor = await createExecutor({ + setup: async (sdk) => { + await sdk.sources.add({ + kind: "custom", + name: "countries", + tools: { + country: { + description: "Get a country by ISO code", + execute: (args: { code: keyof typeof COUNTRIES }) => + COUNTRIES[args.code] ?? null, + }, + list: { + description: "List all countries (optionally filtered by continent)", + execute: (args?: { continent?: string }) => { + const all = Object.entries(COUNTRIES).map(([code, c]) => ({ + code, + ...c, + })); + if (args?.continent) { + return all.filter((c) => c.continent === args.continent); + } + return all; + }, + }, + }, + }); + }, + // Approve every tool call. Real apps would check req.toolPath / req.args + // against a policy and prompt the user for sensitive operations. + onToolApproval: "allow-all", +}); + +const bash = new Bash({ + executionLimits: { maxJsTimeoutMs: 60000 }, + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, +}); + +// ── Turn 1: List discovered tools via the host-side SDK handle ─── +// `executor.sdk` is the SDK instance, exposed for inspection. + +console.log("=== Turn 1: Discover available sources ===\n"); + +if (executor.sdk) { + const sources = await executor.sdk.sources.list(); + console.log(`Registered sources: ${sources.length}`); + for (const src of sources as { id: string; kind: string }[]) { + console.log(` - ${src.id} (${src.kind})`); + } + const allTools = await executor.sdk.tools.list(); + console.log(`\nDiscovered tools: ${allTools.length}`); + for (const t of (allTools as { id: string }[]).slice(0, 6)) { + console.log(` - ${t.id}`); + } +} +console.log(); + +// ── Turn 2: Agent calls a discovered query tool ───────────────── +// The SDK registered tools matching the GraphQL queries: country, +// countries, continent, continents, language, languages. +// invokeTool unwraps the SDK's `.data` envelope, so scripts get the +// query result directly. + +console.log("=== Turn 2: Use a discovered tool (single country) ===\n"); + +let r = await bash.exec(`js-exec -c ' + var c = await tools.countries.country({ code: "JP" }); + console.log(c.name); + console.log(" Capital: " + c.capital); + console.log(" Continent: " + c.continent); +'`); +console.log(r.stdout); +if (r.stderr) console.log(" stderr:", r.stderr); + +// ── Turn 3: Agent filters a list endpoint ─────────────────────── + +console.log("=== Turn 3: List with filter ===\n"); + +r = await bash.exec(`js-exec -c ' + var countries = await tools.countries.list({ continent: "South America" }); + console.log("South American countries (" + countries.length + "):"); + for (var i = 0; i < countries.length; i++) { + var c = countries[i]; + console.log(" " + c.name + " — " + c.capital); + } +'`); +console.log(r.stdout); +if (r.stderr) console.log(" stderr:", r.stderr); + +// ── Turn 4: Agent chains tools — group by continent ───────────── + +console.log("=== Turn 4: Chain multiple tools in one script ===\n"); + +r = await bash.exec(`js-exec -c ' + var all = await tools.countries.list({}); + var byContinent = {}; + for (var i = 0; i < all.length; i++) { + var c = all[i]; + (byContinent[c.continent] = byContinent[c.continent] || []).push(c.name); + } + console.log("Countries by continent:\\n"); + var keys = Object.keys(byContinent).sort(); + for (var k = 0; k < keys.length; k++) { + var key = keys[k]; + console.log(" " + key + " (" + byContinent[key].length + ")"); + console.log(" " + byContinent[key].join(", ")); + } +'`); +console.log(r.stdout); +if (r.stderr) console.log(" stderr:", r.stderr); + +// ── Turn 5: Agent writes results to virtual filesystem ────────── + +console.log("=== Turn 5: Write results to filesystem ===\n"); + +r = await bash.exec(`js-exec -c ' + var fs = require("fs"); + var all = await tools.countries.list({}); + var lines = ["code,name,capital,continent"]; + for (var i = 0; i < all.length; i++) { + var c = all[i]; + lines.push(c.code + "," + c.name + "," + c.capital + "," + c.continent); + } + fs.writeFileSync("/tmp/all-countries.csv", lines.join("\\n")); + console.log("Wrote " + all.length + " countries to /tmp/all-countries.csv"); +'`); +console.log(r.stdout); +if (r.stderr) console.log(" stderr:", r.stderr); + +r = await bash.exec("echo '--- First 8 rows:' && head -8 /tmp/all-countries.csv && echo && echo '--- Row count:' && wc -l < /tmp/all-countries.csv"); +console.log(r.stdout); + +console.log("Done!"); diff --git a/examples/executor-tools/package.json b/examples/executor-tools/package.json new file mode 100644 index 00000000..e8517dc4 --- /dev/null +++ b/examples/executor-tools/package.json @@ -0,0 +1,21 @@ +{ + "name": "executor-tools-example", + "version": "1.0.3", + "description": "Example of @just-bash/executor — inline tools + GraphQL/OpenAPI/MCP discovery", + "type": "module", + "scripts": { + "start": "npx tsx main.ts", + "start:inline": "npx tsx inline-tools.ts", + "start:discovery": "npx tsx multi-turn-discovery.ts", + "start:multi-api": "npx tsx multi-api-agent.ts" + }, + "dependencies": { + "just-bash": "workspace:*", + "@just-bash/executor": "workspace:*", + "@executor-js/sdk": "^0.2.0", + "@executor-js/plugin-graphql": "^0.2.0", + "@executor-js/plugin-mcp": "^0.2.0", + "@executor-js/plugin-openapi": "^0.2.0" + }, + "private": true +} diff --git a/examples/executor-tools/pnpm-lock.yaml b/examples/executor-tools/pnpm-lock.yaml new file mode 100644 index 00000000..84e21c82 --- /dev/null +++ b/examples/executor-tools/pnpm-lock.yaml @@ -0,0 +1,10 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +dependencies: + just-bash: + specifier: link:../.. + version: link:../.. diff --git a/examples/executor-tools/tsconfig.json b/examples/executor-tools/tsconfig.json new file mode 100644 index 00000000..79a314b3 --- /dev/null +++ b/examples/executor-tools/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "noEmit": true, + "paths": { + "just-bash": ["../../src/index.ts"] + } + }, + "include": ["*.ts", "../../src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/examples/website/app/components/terminal-content.ts b/examples/website/app/components/terminal-content.ts index e04b7b66..c0724751 100644 --- a/examples/website/app/components/terminal-content.ts +++ b/examples/website/app/components/terminal-content.ts @@ -386,6 +386,37 @@ await env.exec('js-exec -c "console.log(API_BASE)"'); **Note:** The \`js-exec\` command only exists when \`javascript\` is configured. It is not available in browser environments. Execution runs in a QuickJS WASM sandbox with a 64 MB memory limit and configurable timeout (default: 10s, 60s with network). +#### Tool Invocation Hook + +\`js-exec\` scripts can call host-defined tools through a global \`tools\` proxy +when \`javascript.invokeTool\` is provided: + +\`\`\`typescript +const bash = new Bash({ + javascript: { + // path: "math.add" (dot-separated) + // argsJson: '{"a":1,"b":2}' (or "" for no args) + // return: JSON-stringified result, or "" for undefined + // throw: propagates as a sandbox exception + invokeTool: async (path, argsJson) => { + const args = argsJson ? JSON.parse(argsJson) : {}; + if (path === "math.add") { + return JSON.stringify({ sum: args.a + args.b }); + } + throw new Error(\`Unknown tool: \${path}\`); + }, + }, +}); + +await bash.exec(\`js-exec -c 'console.log((await tools.math.add({a:3,b:4})).sum)'\`); +\`\`\` + +The hook is generic — wire any tool framework through it (raw maps, MCP, +Anthropic tool-use, etc.). For full GraphQL / OpenAPI / MCP discovery via +\`@executor-js/sdk\`, plus auto-generated bash namespace commands, use the +companion package +[**\`@just-bash/executor\`**](../just-bash-executor/README.md). + ### Python Support Python (CPython compiled to WASM) is opt-in due to additional security surface. Enable with \`python: true\`: @@ -810,7 +841,7 @@ limitations under the License. export const FILE_PACKAGE_JSON = `{ "name": "just-bash", - "version": "2.14.2", + "version": "2.14.3", "description": "A simulated bash environment with virtual filesystem", "repository": { "type": "git", diff --git a/package.json b/package.json index 9f5a09ab..f3f17a8c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "pnpm --filter './packages/*' build", "build:worker": "pnpm --filter just-bash build:worker", - "typecheck": "pnpm --filter './packages/*' typecheck", + "typecheck": "pnpm --filter just-bash build && pnpm --filter './packages/*' typecheck", "lint": "biome check . && pnpm --filter './packages/*' lint:banned", "lint:fix": "biome check --write .", "knip": "pnpm --filter './packages/*' knip", diff --git a/packages/just-bash-executor/CHANGELOG.md b/packages/just-bash-executor/CHANGELOG.md new file mode 100644 index 00000000..cf4e5a6f --- /dev/null +++ b/packages/just-bash-executor/CHANGELOG.md @@ -0,0 +1,25 @@ +# @just-bash/executor + +## 1.0.2 + +### Patch Changes + +- Updated dependencies [[`01a4721`](https://github.com/vercel-labs/just-bash/commit/01a4721324350adea4b035b311f0b60ccdbb65ff)]: + - just-bash@3.0.1 + +## 1.0.1 + +### Patch Changes + +- [#235](https://github.com/vercel-labs/just-bash/pull/235) [`fd98df8`](https://github.com/vercel-labs/just-bash/commit/fd98df8048d658454ed0769c020594754bf6e43d) Thanks [@cramforce](https://github.com/cramforce)! - Upgrade to version that actually works beyond custom tools + +## 1.0.0 + +### Minor Changes + +- [#209](https://github.com/vercel-labs/just-bash/pull/209) [`b3bd85e`](https://github.com/vercel-labs/just-bash/commit/b3bd85ed816445e6d148290163a1900f49ebea82) Thanks [@cramforce](https://github.com/cramforce)! - Introducing plumbing for integrating executor and adding a peer package for the implememtation + +### Patch Changes + +- Updated dependencies [[`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79), [`b3bd85e`](https://github.com/vercel-labs/just-bash/commit/b3bd85ed816445e6d148290163a1900f49ebea82), [`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79)]: + - just-bash@3.0.0 diff --git a/packages/just-bash-executor/README.md b/packages/just-bash-executor/README.md new file mode 100644 index 00000000..d63e9d88 --- /dev/null +++ b/packages/just-bash-executor/README.md @@ -0,0 +1,384 @@ +# @just-bash/executor + +Experimental tool-invocation companion for [`just-bash`](../just-bash). Wires +`@executor-js/sdk` (and its GraphQL / OpenAPI / MCP plugins) into `just-bash`'s +generic `invokeTool` hook so JavaScript code running in `js-exec` can call +host-defined tools, and so those tools also appear as bash CLI commands. + +> **Experimental.** This package is published under the `experimental` npm +> dist-tag and its API is expected to change. The `@executor-js/*` packages are +> optional peer dependencies; install `@executor-js/sdk` when using `setup`, and +> install the plugin packages for the source kinds you enable. + +## Quick start + +```ts +import { Bash } from "just-bash"; +import { createExecutor } from "@just-bash/executor"; + +const executor = await createExecutor({ + tools: { + "math.add": { + description: "Add two numbers", + execute: (args: { a: number; b: number }) => ({ sum: args.a + args.b }), + }, + }, +}); + +const bash = new Bash({ + javascript: { invokeTool: executor.invokeTool }, + customCommands: executor.commands, +}); + +await bash.exec(`js-exec -c ' + const r = await tools.math.add({ a: 3, b: 4 }); + console.log(r.sum); // 7 +'`); + +// Tools are also available as bash commands: +await bash.exec("math add a=1 b=2"); // → {"sum":3} +``` + +## Three surfaces, one tool + +Every tool you register appears in three places, all derived from the same +`{ description, execute }` definition: + +```text +"math.add": { description: "Add two numbers", execute: ({a,b}) => ({ sum: a+b }) } + +→ Tool path: math.add +→ JS in js-exec: await tools.math.add({ a: 2, b: 3 }) // → { sum: 5 } +→ Bash CLI: math add a=2 b=3 // → {"sum":5} + echo '{"a":2,"b":3}' | math add // → {"sum":5} + math add --json '{"a":2,"b":3}' // → {"sum":5} +``` + +The same surfaces apply to tools discovered from GraphQL, OpenAPI, and MCP +sources — only the source of the registration differs. + +## What it gives you + +- **Inline tools** — define `{ description, execute }` maps directly +- **SDK-driven discovery** — register GraphQL endpoints, OpenAPI specs, or MCP + servers and have tools auto-discovered +- **Approval and elicitation hooks** — gate which tools can run; handle + user-input requests +- **Auto-generated bash commands** — tools become `namespace subcommand` bash + commands (`gh`-style help, kebab-case, JSON/flag/stdin input) + +## Installation + +```bash +npm install just-bash @just-bash/executor + +# For SDK-driven discovery: +npm install @executor-js/sdk + +# Then whichever source plugins you use: +npm install @executor-js/plugin-graphql +npm install @executor-js/plugin-openapi +npm install @executor-js/plugin-mcp +``` + +## Inline tools + +Define tools directly in the config — no SDK plugins required. + +```ts +const executor = await createExecutor({ + tools: { + "math.add": { + description: "Add two numbers", + execute: (args) => ({ sum: args.a + args.b }), + }, + "db.query": { + description: "Run a SQL query", + execute: async (args) => { + const rows = await queryDatabase(args.sql); + return { rows }; + }, + }, + }, +}); +``` + +### Calling tools from `js-exec` + +Tools are accessed through a global `tools` proxy. Property access builds the +tool path; calling invokes it: + +```js +// Object return → JS gets a normal object +const r = await tools.math.add({ a: 3, b: 4 }); +console.log(r.sum); // 7 + +// Array return +const data = await tools.db.query({ sql: "SELECT * FROM users" }); +for (const row of data.rows) console.log(row.name); + +// Primitive return → returned as-is +const ts = await tools.util.timestamp(); +console.log(ts.ts); + +// undefined return → JS gets undefined +const ack = await tools.cache.invalidate({ key: "u:1" }); +console.log(ack); // undefined + +// Thrown errors → catchable as Error in the script +try { + await tools.math.divide({ a: 1, b: 0 }); +} catch (e) { + console.log("caught:", e.message); +} +``` + +Deeply nested paths work — `await tools.a.b.c.d()` invokes the tool registered +as `"a.b.c.d"`. Tool calls are synchronous under the hood (the worker blocks +via `Atomics.wait`), so `await` is technically a no-op — but it keeps code +portable between just-bash and the SDK's own runtimes. + +### Tool definition shape + +```ts +interface ToolDef { + description?: string; + execute: (args: unknown) => unknown; // sync or async +} +``` + +- `execute` receives the arguments object passed from the script +- Return value is JSON-serialized back to the script +- Returning `undefined` gives `undefined` in the script +- Throwing propagates to the script as a catchable exception +- `async` functions are awaited before returning to the script + +## SDK-driven discovery + +When you provide `setup`, `@just-bash/executor` boots `@executor-js/sdk` and +auto-discovers tools from your sources. + +```ts +const executor = await createExecutor({ + setup: async (sdk) => { + // GraphQL: introspects schema, registers one tool per query/mutation + await sdk.sources.add({ + kind: "graphql", + endpoint: "https://countries.trevorblades.com/graphql", + name: "countries", + }); + + // OpenAPI: parses spec, registers one tool per operation + await sdk.sources.add({ + kind: "openapi", + spec: openApiSpecText, + endpoint: "https://api.example.com", + name: "myapi", + }); + + // MCP: connects to server, discovers tools from capabilities + await sdk.sources.add({ + kind: "mcp", + transport: "remote", + endpoint: "https://mcp.example.com/sse", + name: "internal", + }); + }, +}); +``` + +Each source kind produces tool paths under its `name` namespace. Quick +reference: + +| Source kind | Tool path | Args come from | +| ----------- | ------------------------------- | ------------------------------------ | +| `graphql` | `.query.` / `.mutation.` | field args | +| `openapi` | `..` | path + query params + requestBody | +| `mcp` | `.` | the server tool's input schema | +| inline | the literal key in `tools: {…}` | the `args` parameter to `execute` | + +For step-by-step source-conversion guidance with copy-paste snippets, see +[`SKILL.md`](./SKILL.md) — written for AI agents but useful as a reference. + +Mix inline `tools` and `setup` freely — both produce commands and route through +the same `invokeTool` callback. Inline tools win when paths conflict with +SDK-discovered ones. + +## Approval and elicitation hooks + +```ts +await createExecutor({ + setup: async (sdk) => { /* ... */ }, + onToolApproval: async (request) => { + if (request.toolPath.startsWith("ops.")) { + return { approved: false, reason: "ops tools need manual review" }; + } + return { approved: true }; + }, + onElicitation: async (ctx) => { + return { action: "decline" }; + }, +}); +``` + +`onToolApproval` is an adapter-level pre-invocation gate and defaults to +`"allow-all"`. SDK-native approval prompts and mid-tool user-input requests are +delivered through `onElicitation`, which defaults to declining all requests. Use +`"deny-all"` or a callback for stricter tool approval, and use `"accept-all"` +only for non-interactive elicitation flows you trust. + +Approval metadata is intentionally conservative while this package is +experimental. In particular, `operationKind` may be `"unknown"`; prefer +decisions based on `toolPath`, `sourceId`, and `approvalLabel`. + +## Tools as bash commands + +By default, every registered tool also becomes a bash command. Each namespace +(the part of the path before the first `.`) becomes a top-level command and +the rest of the path becomes a subcommand. + +### Naming rules + +| Tool path | Namespace command | Subcommand | Aliases | +| --------------------- | ----------------- | ----------------- | ------------- | +| `math.add` | `math` | `add` | — | +| `petstore.listPets` | `petstore` | `list-pets` | `listPets` | +| `petstore.getPetById` | `petstore` | `get-pet-by-id` | `getPetById` | +| `docs.read_file` | `docs` | `read-file` | `read_file` | + +Subcommand names are kebab-cased; the original form is registered as an alias +when it differs. + +### Argument input modes + +```bash +math add a=2 b=3 # key=value +math add --a 2 --b 3 # --key value +math add --a=2 --b=3 # --key=value +math add --json '{"a":2,"b":3}' # JSON via flag +echo '{"a":2,"b":3}' | math add # JSON via stdin +math add --verbose # bare flag → { verbose: true } +``` + +Values are coerced through `JSON.parse` first (so `a=2`, `--ok=true`, +`xs=[1,2]`, and `cfg='{"k":1}'` produce the natural JSON types) and fall back +to strings when parsing fails. + +When more than one mode is used in a single invocation, the higher-precedence +mode wins: + +```text +flags > --json > piped stdin +``` + +So `echo '{"a":1}' | math add --a=99` calls `math.add({ a: 99 })`. + +### Output and exit codes + +```text +$ math add a=2 b=3 +{"sum":5} + # exit 0; JSON to stdout, newline-terminated + +$ math add a=2 b=3 | jq -r .sum +5 # composes with standard tools + +$ math divide a=1 b=0 +math: divide: divide by zero # thrown error → stderr; exit 1 + +$ math nope +math: unknown command "nope" # unknown subcommand → stderr; exit 1 +Run 'math --help' for usage. +``` + +### Auto-generated help + +` --help` lists subcommands: + +```text +$ math --help +Executor tools: math + +USAGE + math [flags] + +COMMANDS + add Add two numbers + divide Integer divide; throws on zero + +EXAMPLES + math add key=value + math divide --key value + +LEARN MORE + math --help +``` + +` --help` shows input modes: + +```text +$ math add --help +Add two numbers + +USAGE + math add [key=value ...] + math add [--key value ...] + math add --json '{...}' + | math add + +FLAGS + --json string Pass all arguments as a JSON object + --help Show this help + +EXAMPLES + math add key=value + math add --key value + math add --json '{"key":"value"}' + echo '{"key":"value"}' | math add + math add key=value | jq -r .field +``` + +### Disabling + +Pass `exposeToolsAsCommands: false` to `createExecutor` if you only want the +`tools` proxy in `js-exec` and no bash commands. + +## Configuration reference + +| Option | Type | Description | +| --- | --- | --- | +| `tools` | `Record` | Inline tool definitions, keyed by dot-separated path | +| `setup` | `(sdk) => Promise` | Async SDK initialization for tool discovery | +| `plugins` | `AnyPlugin[]` | Additional `@executor-js/sdk` plugins | +| `onToolApproval` | `"allow-all" \| "deny-all" \| fn` | Approval hook (default: `"allow-all"`) | +| `onElicitation` | `"accept-all" \| fn` | Elicitation hook (default: decline) | +| `exposeToolsAsCommands` | `boolean` | Register tools as bash commands (default: `true`) | + +## Examples + +See [`examples/executor-tools/`](../../examples/executor-tools/) for runnable +examples (`inline-tools.ts`, `multi-turn-discovery.ts`). + +## How `invokeTool` works + +The bridge between QuickJS (where your script runs) and the host (where your +tools execute) is just-bash's `invokeTool` callback on `JavaScriptConfig`. This +package produces an `invokeTool` that routes through the executor pipeline +(approval → invoke → elicitation), but you can write your own `invokeTool` for +any tool framework — it's a generic `(path, argsJson) => Promise` hook. + +```ts +new Bash({ + javascript: { + invokeTool: async (path, argsJson) => { + // path: "math.add" (dot-separated) + // argsJson: '{"a":1,"b":2}' (or "" for no args) + // return: JSON-stringified result, or "" for undefined + // throw: propagates as an exception inside the sandbox + }, + }, +}); +``` + +`@just-bash/executor` is one consumer of this hook; raw maps, MCP clients, or +custom dispatchers are equally valid producers. diff --git a/packages/just-bash-executor/SKILL.md b/packages/just-bash-executor/SKILL.md new file mode 100644 index 00000000..9b0ae0fe --- /dev/null +++ b/packages/just-bash-executor/SKILL.md @@ -0,0 +1,561 @@ +--- +name: just-bash-executor +description: Convert a GraphQL endpoint, OpenAPI spec, or MCP server into bash CLI commands and a `tools.*` JS API runnable inside `just-bash`'s `js-exec` sandbox. Use when the user wants to expose a remote API to a sandboxed bash agent, build a tool-calling agent on top of just-bash, or generate CLI commands from an existing API spec. +--- + +# `@just-bash/executor` — agent guide + +This file is for an AI agent writing code that uses `@just-bash/executor`. It +maps each input (an OpenAPI spec, a GraphQL endpoint, an MCP server, or your +own JS functions) to the exact code to write and the exact surfaces (JS API + +bash CLI) the user gets back. + +Read top to bottom on the first task; jump by section number on later tasks. + +## §1. Decide which source kind you have + +```text +Have an OpenAPI spec / Swagger doc? → §3 OpenAPI +Have a GraphQL endpoint or SDL? → §4 GraphQL +Have an MCP server (URL or stdio)? → §5 MCP +Defining tools yourself in code? → §2 Inline +Mixing several of the above? → call sources.add() once per source + inside the same setup(); paths stay + namespaced by `name` +``` + +For all four, the consuming code is identical (§6, §7) — what changes is the +`createExecutor` config. + +## §2. Inline tools + +Use when there's no upstream spec — the user wants to expose specific JS +functions to the sandbox. + +```ts +import { Bash } from "just-bash"; +import { createExecutor } from "@just-bash/executor"; + +const executor = await createExecutor({ + tools: { + "ns.action": { + description: "What it does", + execute: async (args: { /* shape */ }) => ({ /* JSON-serializable */ }), + }, + }, +}); + +const bash = new Bash({ + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, +}); +``` + +Conversion (single rule): + +```text +key in tools: {…} JS bash +"ns.action" → await tools.ns.action(args) ns action key=value + ns action --key value + ns action --json '{"key":1}' +``` + +The first dot-segment is the namespace command; the rest is the subcommand +(kebab-cased, with the original form as an alias when different). + +## §3. OpenAPI → tools + +Ask the user for: spec source, base endpoint, namespace `name`, and optional +auth headers. + +The `spec` field accepts three forms: + +```ts +spec: "https://petstore3.swagger.io/api/v3/openapi.json" // URL — fetched at setup +spec: fs.readFileSync("./openapi.yaml", "utf8") // YAML text +spec: JSON.stringify(specObject) // JSON text +``` + +For authenticated APIs, pass `headers` (and optionally `queryParams`): + +```ts +await sdk.sources.add({ + kind: "openapi", + spec: "https://api.github.com/openapi.json", + endpoint: "https://api.github.com", + name: "github", + headers: { + Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, + Accept: "application/vnd.github+json", + }, +}); +``` + +Full inline example: + +```ts +import { createExecutor } from "@just-bash/executor"; +import { Bash } from "just-bash"; + +// `spec` is the raw OpenAPI document as a STRING (JSON or YAML text), +// not a parsed object. Read it from disk if you have a file. +const PETSTORE_SPEC = JSON.stringify({ + openapi: "3.0.0", + info: { title: "Petstore", version: "1.0.0" }, + paths: { + "/pets": { + get: { + operationId: "listPets", + parameters: [ + { name: "status", in: "query", schema: { type: "string" } }, + ], + responses: { "200": { description: "ok" } }, + }, + post: { + operationId: "createPet", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { name: { type: "string" } }, + }, + }, + }, + }, + responses: { "201": { description: "ok" } }, + }, + }, + "/pets/{petId}": { + get: { + operationId: "getPetById", + parameters: [ + { name: "petId", in: "path", required: true, schema: { type: "string" } }, + ], + responses: { "200": { description: "ok" } }, + }, + }, + }, +}); + +const executor = await createExecutor({ + setup: async (sdk) => { + await sdk.sources.add({ + kind: "openapi", + spec: PETSTORE_SPEC, + endpoint: "https://petstore.example.com", + name: "pets", // becomes the namespace + }); + }, + onToolApproval: "allow-all", +}); + +const bash = new Bash({ + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, +}); +``` + +Conversion rules: + +- One tool per operation in the spec +- Tool path: `..` — the first URL path + segment is included as a grouping prefix (camelCase preserved on the operationId) +- Args object = path params + query params + requestBody fields, flattened +- Bash subcommand: kebab-case of `.`; original + camelCase form is kept as an alias + +Example (from the spec above — all under `/pets/*`): + +```text +operationId → tool path JS call bash +listPets → pets.pets.listPets await tools.pets.pets.listPets({ status }) pets pets.list-pets --status open +createPet → pets.pets.createPet await tools.pets.pets.createPet({ name }) pets pets.create-pet --name Fido +getPetById → pets.pets.getPetById await tools.pets.pets.getPetById({ petId }) pets pets.get-pet-by-id --pet-id 42 +``` + +(The double `pets.pets` looks awkward but is deterministic: the first `pets` +is your `name`, the second is the URL's first path segment.) + +Pitfalls: + +- `spec` must be a **string** (URL, JSON text, or YAML text), not a parsed object +- Operations missing `operationId` are skipped; if the user's spec lacks them, + add them or fall back to inline tools +- All param locations (path, query, body) flatten into one args object — name + collisions across locations are the user's problem to resolve +- `headers` are sent on every invocation — fine for static tokens, but for + per-request auth wire an inline tool that adds the header dynamically +- The plugin is loaded lazily via `setup`; install `@executor-js/plugin-openapi` + alongside `@executor-js/sdk` or `createExecutor` will throw + +## §4. GraphQL → tools + +Ask the user for: endpoint URL, optional introspection JSON, a namespace `name`, +and optional auth headers. + +```ts +const executor = await createExecutor({ + setup: async (sdk) => { + await sdk.sources.add({ + kind: "graphql", + endpoint: "https://api.github.com/graphql", + name: "github", + headers: { + Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, + }, + // Optional: pre-fetched schema; skips the introspection round-trip and + // lets discovery work offline. Recommended for unstable upstreams. + // introspectionJson: INTROSPECTION_JSON, + }); + }, + onToolApproval: "allow-all", +}); +``` + +Conversion rules: + +- One tool per top-level Query and Mutation field +- Tool path: `.query.` for queries and + `.mutation.` for mutations (camelCase preserved) +- Args object = the field's argument definitions +- Result is the raw GraphQL response envelope: `{ status, data, errors }`. + Scripts must check `errors` and read `data` themselves — there is no + auto-unwrap. +- The plugin auto-generates a shallow selection set. Queries whose return + types contain nested object fields will fail server-side validation + ("Field X of type Y must have a selection of subfields"). For these, + wrap the call in an inline tool that posts a hand-written GraphQL query + via `fetch` instead of going through the SDK plugin. +- Subscriptions are not currently exposed as callable tools + +Example, from the public Countries schema (all queries): + +```text +Query field → tool path JS call bash +country(code) → geo.query.country await tools.geo.query.country({ code: "JP" }) geo query.country code=JP +countries(filter)→ geo.query.countries await tools.geo.query.countries({ filter: { ... } }) geo query.countries --json '{"filter":{...}}' +continent(code) → geo.query.continent await tools.geo.query.continent({ code: "EU" }) geo query.continent code=EU +continents → geo.query.continents await tools.geo.query.continents({}) geo query.continents +language(code) → geo.query.language await tools.geo.query.language({ code: "en" }) geo query.language code=en +languages → geo.query.languages await tools.geo.query.languages({}) geo query.languages +``` + +Reading the response in a script: + +```js +const r = await tools.geo.query.country({ code: "JP" }); +if (r.errors && r.errors.length) { + throw new Error(r.errors.map((e) => e.message).join("; ")); +} +const country = r.data.country; +console.log(country.name); +``` + +Pitfalls: + +- Required GraphQL args (`String!`, `ID!`) must be passed; the SDK surfaces + validation errors as thrown exceptions inside scripts — wrap calls in + `try/catch` if the agent might call with empty args +- For complex `filter`/input-object args, prefer `--json` over `key=value` +- `headers` apply to introspection AND every tool call — useful for tokens, + but don't put per-user identity here +- Install `@executor-js/plugin-graphql` alongside `@executor-js/sdk` + +## §5. MCP → tools + +Ask the user for: transport (`"remote"` or `"stdio"`), endpoint URL or +command+args, a namespace `name`. + +```ts +const executor = await createExecutor({ + setup: async (sdk) => { + // Remote (SSE / HTTP) + await sdk.sources.add({ + kind: "mcp", + transport: "remote", + endpoint: "https://mcp.example.com/sse", + name: "docs", + }); + + // Remote with auth headers + await sdk.sources.add({ + kind: "mcp", + transport: "remote", + endpoint: "https://mcp.context7.com/mcp", + name: "context7", + headers: { + Authorization: `Bearer ${process.env.CONTEXT7_TOKEN}`, + }, + }); + + // Stdio (local process) — env vars and cwd are passed to the child + await sdk.sources.add({ + kind: "mcp", + transport: "stdio", + command: "npx", + args: ["-y", "@modelcontextprotocol/server-filesystem", "/data"], + env: { LOG_LEVEL: "info" }, + cwd: "/work", + name: "fs", + }); + }, + onToolApproval: async (req) => { + // MCP servers can do destructive things — gate by tool path + if (req.toolPath.endsWith(".write_file")) { + return { approved: false, reason: "writes need review" }; + } + return { approved: true }; + }, + onElicitation: async (ctx) => { + // MCP servers may request user input mid-tool (forms, OAuth URLs). + // Decline by default; implement a real handler for interactive flows. + return { action: "decline" }; + }, +}); +``` + +Conversion rules: + +- One tool per tool advertised by the MCP server's `tools/list` capability +- Tool path: `.` — server tool names are preserved + verbatim (often `snake_case` like `read_file`) +- Args object = the MCP tool's input schema +- Subcommand: server tool name → kebab-case; original (snake_case or otherwise) + is kept as an alias when different + +Example (filesystem-style MCP server with `read_file`, `list_dir`): + +```text +server tool → tool path JS call bash kebab bash snake alias +read_file → fs.read_file await tools.fs.read_file({ path: "/x.md" }) fs read-file path=/x.md fs read_file path=/x.md +list_dir → fs.list_dir await tools.fs.list_dir({ path: "/" }) fs list-dir path=/ fs list_dir path=/ +``` + +Pitfalls: + +- `transport: "remote"` requires `endpoint`; `transport: "stdio"` requires + `command` + `args` +- MCP servers with elicitation flows need an `onElicitation` handler other + than the default decline-all, otherwise interactive tools will fail +- Install `@executor-js/plugin-mcp` alongside `@executor-js/sdk` + +## §5b. Combining multiple sources in one executor + +Real agents usually need more than one upstream. Add as many `sources.add()` +calls as you want inside the same `setup`; each registers its own namespace and +tools land in a single unified `tools` proxy / bash command set. + +```ts +const executor = await createExecutor({ + setup: async (sdk) => { + // OpenAPI from a URL (no auth) + await sdk.sources.add({ + kind: "openapi", + spec: "https://petstore3.swagger.io/api/v3/openapi.json", + name: "petstore", + }); + + // GraphQL with bearer auth + await sdk.sources.add({ + kind: "graphql", + endpoint: "https://api.github.com/graphql", + name: "github", + headers: { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` }, + }); + + // Remote MCP for context lookups + await sdk.sources.add({ + kind: "mcp", + transport: "remote", + endpoint: "https://mcp.example.com/sse", + name: "context", + }); + }, + // Inline tools coexist with discovered ones; inline wins on path conflict. + tools: { + "util.now": { + description: "Wall-clock ISO timestamp", + execute: () => ({ ts: new Date().toISOString() }), + }, + }, + onToolApproval: async (req) => { + // Different policy per source + if (req.sourceId === "github" && req.toolPath.includes("delete")) { + return { approved: false, reason: "github deletes need review" }; + } + return { approved: true }; + }, +}); +``` + +A js-exec script can then call across all sources in one turn. Remember the +shape per source kind: GraphQL paths are `.query.`, OpenAPI paths +are `..`, MCP paths are +`.`, inline paths are exactly your key. + +```js +const repos = await tools.github.query.search({ query: "stars:>10000", type: "REPOSITORY" }); +const pet = await tools.petstore.pet.findPetById({ petId: 1 }); +const ctx = await tools.context.lookup({ name: "react" }); +const ts = await tools.util.now(); +// GraphQL responses are wrapped — unwrap before reading +console.log({ + repos: repos.data?.search?.repositoryCount ?? null, + pet, ctx, ts, +}); +``` + +Use distinct `name` values per source — collisions silently overwrite tool +paths within the namespace. + +## §6. Calling generated tools — the rules to internalize + +These two tables are the only things you need to memorize. They apply to all +four source kinds — the conversion is uniform. + +### JS API (inside `js-exec` scripts) + +| Want | Write | +| ------------------------- | ---------------------------------------------- | +| Call any tool | `await tools..(args)` | +| Pass no args | `await tools.ns.name()` or `({})` | +| Catch tool errors | `try { ... } catch (e) { e.message }` | +| Snake-case server tool | `await tools.docs["read_file"]({ path })` | +| Deeply nested path | `await tools.a.b.c.d(args)` — works as written | + +`undefined` returns reach the script as `undefined`; everything else is +JSON-serialized and parsed back into a JS value. + +### Bash CLI (inside `bash.exec(...)` scripts) + +| Want | Write | +| ------------------- | --------------------------------------- | +| key=value | `ns name a=1 b=2` | +| flags | `ns name --a 1 --b 2` | +| `--key=value` | `ns name --a=1` | +| Bool flag | `ns name --verbose` → `{verbose: true}` | +| Inline JSON | `ns name --json '{"a":1,"b":2}'` | +| Piped JSON | `echo '{"a":1}' \| ns name` | +| Compose with jq | `ns name a=1 \| jq -r .field` | +| Show help | `ns --help` or `ns name --help` | + +Mode precedence when more than one is used: **flags > `--json` > stdin**. + +Values are coerced via `JSON.parse` first (`a=2` → number `2`, +`ok=true` → boolean `true`, `xs=[1,2]` → array), falling back to string when +parsing fails. + +Tool errors land on stderr with format `: : ` +and exit code 1. + +## §7. Skeleton an agent can copy and adapt + +Self-contained — pick a source kind, fill in the spec, run with `tsx`. + +```ts +import { Bash } from "just-bash"; +import { createExecutor } from "@just-bash/executor"; + +const executor = await createExecutor({ + // Pick ONE of: `tools` (inline) or `setup` (SDK), or both. + tools: { + "math.add": { + description: "Add two numbers", + execute: ({ a, b }: { a: number; b: number }) => ({ sum: a + b }), + }, + }, + // setup: async (sdk) => { + // await sdk.sources.add({ kind: "openapi", spec, endpoint, name }); + // }, + onToolApproval: "allow-all", +}); + +const bash = new Bash({ + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, + executionLimits: { maxJsTimeoutMs: 30_000 }, +}); + +// 1. JS API +const r1 = await bash.exec(`js-exec -c ' + try { + const r = await tools.math.add({ a: 2, b: 3 }); + console.log("sum=" + r.sum); + } catch (e) { + console.error("tool failed:", e.message); + } +'`); +process.stdout.write(r1.stdout); +if (r1.stderr) process.stderr.write(r1.stderr); + +// 2. Bash CLI — three input modes, all equivalent +for (const cmd of [ + "math add a=2 b=3", + "math add --a 2 --b 3", + `echo '{"a":2,"b":3}' | math add`, +]) { + const r = await bash.exec(cmd); + console.log(`${cmd} → ${r.stdout.trim()} (exit=${r.exitCode})`); +} + +// 3. Help text +process.stdout.write((await bash.exec("math --help")).stdout); +``` + +## §8. Verification before reporting "done" + +Run these checks in order. Stop at the first failure. + +1. **Exec works.** A simple call returns exit 0 with parseable JSON on stdout: + ```ts + const r = await bash.exec(` `); + JSON.parse(r.stdout); // should not throw + ``` +2. **Wrong path errors clearly.** `await tools.ns.nope({})` throws with + `Unknown tool` in the message — confirms dispatch is wired. +3. **Help reflects discovery.** `bash.exec(" --help")` lists every tool + the user expected. If a tool's missing, the source registration didn't pick + it up (most often: missing `operationId` for OpenAPI; subscription field + for GraphQL; capability not advertised for MCP). +4. **Inspect via SDK handle (when `setup` was used):** + ```ts + // List everything + const all = await executor.sdk!.tools.list(); + console.log(all.map(t => t.id)); + + // Filter by source + const ghOnly = await executor.sdk!.tools.list({ sourceId: "github" }); + + // Search descriptions/names + const writes = await executor.sdk!.tools.list({ query: "create" }); + ``` +5. **Approval gates work.** If you wired `onToolApproval`, deny one path and + confirm the call throws inside `js-exec` rather than silently succeeding. + +## §9. Anti-patterns + +- **Don't pass parsed objects to `kind: "openapi"`.** `spec` is a string + (JSON or YAML text). Use `JSON.stringify(...)` or `fs.readFileSync(path, "utf8")`. +- **Don't put tool logic inside the `js-exec` script.** `execute` runs on the + host; the script just calls it. Putting fetches or DB calls in the script + defeats the sandbox. +- **Don't rely on `await` doing real async work.** Tool calls are synchronous + via `Atomics.wait` from the script's perspective; `await` is for portability + with other runtimes. +- **Don't expose host-FS or shell tools without an `onToolApproval` gate.** + The default `"allow-all"` is fine for read-only or pure-compute tools; for + anything destructive, gate by `toolPath`. +- **Don't reuse a namespace across sources.** Two `sources.add` calls with the + same `name` will collide. Use distinct names per source. +- **Don't skip installing the plugin package.** `@executor-js/sdk` alone is not + enough — each source kind requires its plugin (`@executor-js/plugin-openapi`, + `…-graphql`, `…-mcp`). + +## §10. Cross-references + +- [`README.md`](./README.md) — conceptual overview, configuration reference +- [`examples/executor-tools/`](../../examples/executor-tools/) — runnable + end-to-end examples (`inline-tools.ts`, `multi-turn-discovery.ts`) +- [`@executor-js/sdk`](https://www.npmjs.com/package/@executor-js/sdk) — + upstream SDK whose plugins drive discovery diff --git a/packages/just-bash-executor/dist/create-executor.d.ts b/packages/just-bash-executor/dist/create-executor.d.ts new file mode 100644 index 00000000..2913705c --- /dev/null +++ b/packages/just-bash-executor/dist/create-executor.d.ts @@ -0,0 +1,41 @@ +/** + * `createExecutor` — main entry point. + * + * Builds an `ExecutorHandle` containing: + * - `commands`: bash namespace commands derived from inline tools and/or + * SDK-discovered tools, ready to pass to `new Bash({ customCommands })` + * - `invokeTool`: a `(path, argsJson) => Promise` callback to wire + * into `new Bash({ javascript: { invokeTool } })` + * - `sdk?`: the SDK handle when `setup` was provided, exposed for advanced + * use (e.g. listing sources) + */ +import type { Command } from "just-bash"; +import type { ExecutorConfig, ExecutorSDKHandle } from "./types.js"; +export interface ExecutorHandle { + /** Bash namespace commands; pass to `new Bash({ customCommands })`. */ + commands: Command[]; + /** + * Tool invocation callback for `JavaScriptConfig.invokeTool`. + * Routes inline tool calls directly and SDK-tool calls through the + * approval/elicitation pipeline. + */ + invokeTool: (path: string, argsJson: string) => Promise; + /** + * SDK handle. Present only when `setup` was provided. Use it to inspect + * sources, list tools, or close the executor when done. + */ + sdk?: ExecutorSDKHandle; +} +/** + * Build an `ExecutorHandle` from a config of inline tools and/or an SDK setup. + * + * - **Inline tools** (`tools`): registered locally; calls go through + * `tool.execute(args)` directly. + * - **SDK setup** (`setup`): boots `@executor-js/sdk` with the GraphQL, + * OpenAPI, MCP, and discovery plugins; calls go through + * `sdk.tools.invoke()` with approval/elicitation gates applied. + * + * Both can be present in one call. Inline tools take precedence over + * SDK-discovered tools with the same path. + */ +export declare function createExecutor(config?: ExecutorConfig): Promise; diff --git a/packages/just-bash-executor/dist/create-executor.js b/packages/just-bash-executor/dist/create-executor.js new file mode 100644 index 00000000..3550fb95 --- /dev/null +++ b/packages/just-bash-executor/dist/create-executor.js @@ -0,0 +1,110 @@ +/** + * `createExecutor` — main entry point. + * + * Builds an `ExecutorHandle` containing: + * - `commands`: bash namespace commands derived from inline tools and/or + * SDK-discovered tools, ready to pass to `new Bash({ customCommands })` + * - `invokeTool`: a `(path, argsJson) => Promise` callback to wire + * into `new Bash({ javascript: { invokeTool } })` + * - `sdk?`: the SDK handle when `setup` was provided, exposed for advanced + * use (e.g. listing sources) + */ +import { initExecutorSDK } from "./executor-init.js"; +import { parseToolArgs } from "./parse-tool-args.js"; +import { buildNamespaceCommands } from "./tool-command.js"; +function readString(value) { + return typeof value === "string" && value.length > 0 ? value : undefined; +} +/** + * Build an `ExecutorHandle` from a config of inline tools and/or an SDK setup. + * + * - **Inline tools** (`tools`): registered locally; calls go through + * `tool.execute(args)` directly. + * - **SDK setup** (`setup`): boots `@executor-js/sdk` with the GraphQL, + * OpenAPI, MCP, and discovery plugins; calls go through + * `sdk.tools.invoke()` with approval/elicitation gates applied. + * + * Both can be present in one call. Inline tools take precedence over + * SDK-discovered tools with the same path. + */ +export async function createExecutor(config = {}) { + const inlineTools = Object.assign(Object.create(null), config.tools ?? {}); + const exposeAsCommands = config.exposeToolsAsCommands !== false; + const allEntries = []; + for (const path of Object.keys(inlineTools)) { + allEntries.push({ + path, + description: inlineTools[path].description, + }); + } + const inlineInvokeTool = async (path, argsJson) => { + const tool = inlineTools[path]; + if (!tool) + throw new Error(`Unknown tool: ${path}`); + const args = parseToolArgs(argsJson); + const result = await tool.execute(args); + return result !== undefined ? JSON.stringify(result) : ""; + }; + // No SDK setup → inline-only path. Done. + if (!config.setup) { + return { + commands: exposeAsCommands + ? buildNamespaceCommands(allEntries, inlineInvokeTool) + : [], + invokeTool: inlineInvokeTool, + }; + } + // SDK path: boot SDK, run user setup, list discovered tools, build a merged + // invokeTool that prefers inline tools and falls through to the SDK pipeline. + const { sdk, rawExecutor } = await initExecutorSDK(config.setup, config.plugins, config.onElicitation); + const discoveredTools = (await sdk.tools.list()); + for (const tool of discoveredTools) { + if (Object.hasOwn(inlineTools, tool.id)) + continue; // inline wins + allEntries.push({ path: tool.id, description: tool.description }); + } + const approval = config.onToolApproval; + const sdkInvokeTool = async (path, argsJson) => { + const args = parseToolArgs(argsJson); + if (approval && approval !== "allow-all") { + if (approval === "deny-all") { + throw new Error(`Tool invocation denied: ${path}`); + } + const allTools = (await rawExecutor.tools.list()); + const toolMeta = allTools.find((t) => t.id === path); + const sourceId = readString(toolMeta?.sourceId) ?? + readString(toolMeta?.source_id) ?? + "unknown"; + const allSources = (await rawExecutor.sources.list()); + const sourceMeta = allSources.find((source) => source.id === sourceId); + const approvalLabel = readString(toolMeta?.annotations?.approvalDescription) ?? null; + const decision = await approval({ + toolPath: path, + sourceId, + sourceName: readString(sourceMeta?.name) ?? sourceId, + operationKind: "unknown", + args, + reason: approvalLabel ?? `Tool ${path} invoked`, + approvalLabel, + }); + if (!decision.approved) { + throw new Error(`Tool invocation denied: ${path}${decision.reason ? ` (${decision.reason})` : ""}`); + } + } + const result = await rawExecutor.tools.invoke(path, args); + return result !== undefined ? JSON.stringify(result) : ""; + }; + const invokeTool = async (path, argsJson) => { + if (Object.hasOwn(inlineTools, path)) { + return inlineInvokeTool(path, argsJson); + } + return sdkInvokeTool(path, argsJson); + }; + return { + commands: exposeAsCommands + ? buildNamespaceCommands(allEntries, invokeTool) + : [], + invokeTool, + sdk, + }; +} diff --git a/packages/just-bash-executor/dist/executor-discovery-plugin.d.ts b/packages/just-bash-executor/dist/executor-discovery-plugin.d.ts new file mode 100644 index 00000000..d4bf9d16 --- /dev/null +++ b/packages/just-bash-executor/dist/executor-discovery-plugin.d.ts @@ -0,0 +1,49 @@ +/** + * Custom discovery plugin for @executor-js/sdk. + * + * Provides a `sources.add()` extension that registers tools dynamically + * at runtime. Supports a "custom" source kind where tools are provided + * directly as `{ description?, execute(args) }` objects. + */ +import { Effect, type Plugin } from "@executor-js/sdk/core"; +export interface DiscoveryToolDef { + description?: string; + execute: (args: any) => unknown | Promise; +} +export interface SourceDefinition { + /** Source kind. Currently only "custom" is supported. */ + kind: string; + /** Unique name for this source (becomes the tool namespace). */ + name: string; + /** Tool definitions (for kind: "custom"). Keys are tool names. */ + tools?: Record; + /** Auth config (reserved for future plugin kinds). */ + auth?: Record; + /** Endpoint URL (reserved for future plugin kinds). */ + endpoint?: string; +} +export interface DiscoveryPluginExtension { + sources: { + add: (def: SourceDefinition) => Effect.Effect; + }; +} +/** + * Create a discovery plugin instance. + * + * Usage with createExecutor: + * ```ts + * import { createExecutor } from "@executor-js/sdk"; + * import { discoveryPlugin } from "./executor-discovery-plugin.js"; + * + * const sdk = await createExecutor({ + * plugins: [discoveryPlugin()], + * onElicitation: "accept-all", + * }); + * await sdk.justBashDiscovery.sources.add({ + * kind: "custom", + * name: "math", + * tools: { ... }, + * }); + * ``` + */ +export declare function discoveryPlugin(): Plugin<"justBashDiscovery", DiscoveryPluginExtension, null>; diff --git a/packages/just-bash-executor/dist/executor-discovery-plugin.js b/packages/just-bash-executor/dist/executor-discovery-plugin.js new file mode 100644 index 00000000..b9dc55e2 --- /dev/null +++ b/packages/just-bash-executor/dist/executor-discovery-plugin.js @@ -0,0 +1,76 @@ +/** + * Custom discovery plugin for @executor-js/sdk. + * + * Provides a `sources.add()` extension that registers tools dynamically + * at runtime. Supports a "custom" source kind where tools are provided + * directly as `{ description?, execute(args) }` objects. + */ +import { definePlugin, Effect, } from "@executor-js/sdk/core"; +/** + * Create a discovery plugin instance. + * + * Usage with createExecutor: + * ```ts + * import { createExecutor } from "@executor-js/sdk"; + * import { discoveryPlugin } from "./executor-discovery-plugin.js"; + * + * const sdk = await createExecutor({ + * plugins: [discoveryPlugin()], + * onElicitation: "accept-all", + * }); + * await sdk.justBashDiscovery.sources.add({ + * kind: "custom", + * name: "math", + * tools: { ... }, + * }); + * ``` + */ +export function discoveryPlugin() { + const handlers = new Map(); + return definePlugin(() => ({ + id: "justBashDiscovery", + storage: () => null, + extension: (ctx) => ({ + sources: { + add: (def) => Effect.gen(function* () { + if (def.kind !== "custom" || !def.tools) { + return yield* Effect.fail(new Error(`Unsupported source kind: "${def.kind}" for discovery plugin. ` + + `Only "custom" is supported here.`)); + } + const scope = ctx.scopes[0]?.id ?? "default-scope"; + const tools = []; + for (const [name, tool] of Object.entries(def.tools)) { + const toolId = `${def.name}.${name}`; + handlers.set(toolId, tool); + tools.push({ + name, + description: tool.description ?? name, + }); + } + yield* ctx.core.sources.register({ + id: def.name, + scope, + kind: "custom", + name: def.name, + canRemove: true, + canRefresh: false, + tools, + }); + }), + }, + }), + invokeTool: ({ toolRow, args }) => Effect.tryPromise({ + try: async () => { + const handler = handlers.get(toolRow.id); + if (!handler) { + throw new Error(`Unknown tool: ${toolRow.id}`); + } + return handler.execute(args); + }, + catch: (error) => error instanceof Error ? error : new Error(String(error)), + }), + close: () => Effect.sync(() => { + handlers.clear(); + }), + }))(); +} diff --git a/packages/just-bash-executor/dist/executor-init.d.ts b/packages/just-bash-executor/dist/executor-init.d.ts new file mode 100644 index 00000000..2f316c3f --- /dev/null +++ b/packages/just-bash-executor/dist/executor-init.d.ts @@ -0,0 +1,19 @@ +/** + * Lazy initialization of `@executor-js/sdk`. + * + * Kept in its own module so consumers who only use inline tools never load + * the SDK or optional discovery plugins. + */ +import type { ExecutorConfig, ExecutorSDKHandle } from "./types.js"; +type SDKExecutor = { + tools: ExecutorSDKHandle["tools"]; + sources: { + list: ExecutorSDKHandle["sources"]["list"]; + }; + close: ExecutorSDKHandle["close"]; +} & Record; +export declare function initExecutorSDK(setup: ((sdk: ExecutorSDKHandle) => Promise) | undefined, plugins: ExecutorConfig["plugins"] | undefined, onElicitation: ExecutorConfig["onElicitation"] | undefined): Promise<{ + sdk: ExecutorSDKHandle; + rawExecutor: SDKExecutor; +}>; +export {}; diff --git a/packages/just-bash-executor/dist/executor-init.js b/packages/just-bash-executor/dist/executor-init.js new file mode 100644 index 00000000..65c65eda --- /dev/null +++ b/packages/just-bash-executor/dist/executor-init.js @@ -0,0 +1,425 @@ +/** + * Lazy initialization of `@executor-js/sdk`. + * + * Kept in its own module so consumers who only use inline tools never load + * the SDK or optional discovery plugins. + */ +import { readFile, realpath } from "node:fs/promises"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; +const DEFAULT_SCOPE_ID = "default-scope"; +const DECLINE_ALL_ELICITATIONS = async () => ({ + action: "decline", +}); +const EXECUTOR_API_PACKAGE = "@executor-js/api"; +const transformedModuleCache = new Map(); +const executorApiShimUrlCache = new Map(); +// @executor-js 0.1.0 plugin core bundles import @executor-js/api for HTTP +// route helpers, but that package is not published. just-bash only needs the +// SDK plugin objects, so the fallback below loads those chunks with a tiny +// in-memory shim for the unused route helpers. +function toSDKElicitationHandler(Effect, handler) { + if (handler === "accept-all") + return "accept-all"; + const publicHandler = handler ?? DECLINE_ALL_ELICITATIONS; + return (ctx) => Effect.promise(async () => { + const response = await publicHandler(ctx); + return response; + }); +} +function getExtension(executor, key) { + const extension = executor[key]; + if (!extension) { + throw new Error(`Executor plugin not loaded: ${key}`); + } + return extension; +} +function pluginLoadError(kind, error) { + const message = error instanceof Error ? error.message : String(error); + return new Error(`Failed to load @executor-js ${kind} plugin: ${message}`); +} +function isMissingExecutorApiError(error) { + const message = error instanceof Error ? error.message : String(error); + return message.includes(EXECUTOR_API_PACKAGE); +} +async function importOfficialPluginExport(specifier, exportName) { + try { + const mod = (await import(specifier)); + return mod[exportName]; + } + catch (error) { + if (!isMissingExecutorApiError(error)) + throw error; + const mod = await importOfficialPluginChunkWithoutApi(specifier); + return mod[exportName]; + } +} +async function importOfficialPluginChunkWithoutApi(specifier) { + const fromFile = fileURLToPath(import.meta.url); + const corePath = await resolveExistingPath(await resolveModuleSpecifier(specifier, fromFile)); + const coreSource = await readFile(corePath, "utf8"); + const chunkMatch = coreSource.match(/from\s+["'](\.\/[^"']+\.js)["']/); + if (!chunkMatch) { + throw new Error(`Could not locate ${specifier} SDK bundle`); + } + const chunkPath = resolve(dirname(corePath), chunkMatch[1]); + return importTransformedModule(chunkPath); +} +async function importTransformedModule(modulePath) { + let pending = transformedModuleCache.get(modulePath); + if (!pending) { + pending = (async () => { + const source = await readFile(modulePath, "utf8"); + const transformed = await rewriteModuleSpecifiers(source, modulePath); + const url = `data:text/javascript;base64,${Buffer.from(transformed).toString("base64")}`; + return (await import(url)); + })(); + transformedModuleCache.set(modulePath, pending); + } + return pending; +} +async function rewriteModuleSpecifiers(source, fromFile) { + const specifiers = new Set(); + collectModuleSpecifiers(source, specifiers); + const resolved = new Map(); + for (const specifier of specifiers) { + if (specifier === EXECUTOR_API_PACKAGE) { + resolved.set(specifier, await getExecutorApiShimUrl(fromFile)); + continue; + } + resolved.set(specifier, pathToFileURL(await resolveModuleSpecifier(specifier, fromFile)).href); + } + return source + .replace(/\bfrom\s*(["'])([^"']+)\1/g, (_match, quote, specifier) => { + return `from ${quote}${resolved.get(specifier) ?? specifier}${quote}`; + }) + .replace(/\bimport\s*(["'])([^"']+)\1/g, (_match, quote, specifier) => { + return `import ${quote}${resolved.get(specifier) ?? specifier}${quote}`; + }) + .replace(/\bimport\s*\(\s*(["'])([^"']+)\1\s*\)/g, (_match, quote, specifier) => { + return `import(${quote}${resolved.get(specifier) ?? specifier}${quote})`; + }); +} +function collectModuleSpecifiers(source, specifiers) { + for (const regex of [ + /\bfrom\s*["']([^"']+)["']/g, + /\bimport\s*["']([^"']+)["']/g, + /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g, + ]) { + for (const match of source.matchAll(regex)) { + specifiers.add(match[1]); + } + } +} +async function getExecutorApiShimUrl(fromFile) { + let pending = executorApiShimUrlCache.get(fromFile); + if (!pending) { + pending = (async () => { + const effectUrl = pathToFileURL(await resolveModuleSpecifier("effect", fromFile)).href; + const httpApiUrl = pathToFileURL(await resolveModuleSpecifier("effect/unstable/httpapi", fromFile)).href; + const source = ` + import { Schema } from ${JSON.stringify(effectUrl)}; + import { HttpApi } from ${JSON.stringify(httpApiUrl)}; + + export class InternalError extends Schema.TaggedErrorClass()( + "InternalError", + { message: Schema.String }, + { httpApiStatus: 500 }, + ) {} + + export function addGroup(group) { + return HttpApi.make("executor").add(group); + } + + export function capture(effect) { + return effect; + } + `; + return `data:text/javascript;base64,${Buffer.from(source).toString("base64")}`; + })(); + executorApiShimUrlCache.set(fromFile, pending); + } + return pending; +} +async function resolveModuleSpecifier(specifier, fromFile) { + if (specifier.startsWith("file:")) + return fileURLToPath(specifier); + if (specifier.startsWith("node:") || specifier.startsWith("data:")) { + throw new Error(`Cannot rewrite non-file module specifier: ${specifier}`); + } + if (specifier.startsWith(".") || specifier.startsWith("/")) { + const resolvedPath = specifier.startsWith("/") + ? specifier + : resolve(dirname(fromFile), specifier); + return resolveExistingPath(resolvedPath); + } + const { packageName, subpath } = splitPackageSpecifier(specifier); + const packageRoot = await findPackageRoot(packageName, fromFile); + const packageJsonPath = join(packageRoot, "package.json"); + const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8")); + const target = resolvePackageExport(packageJson, subpath); + if (!target) { + throw new Error(`Could not resolve ${specifier} from ${fromFile}`); + } + return resolveExistingPath(resolve(packageRoot, target)); +} +function splitPackageSpecifier(specifier) { + const parts = specifier.split("/"); + if (specifier.startsWith("@")) { + return { + packageName: parts.slice(0, 2).join("/"), + subpath: parts.slice(2).join("/"), + }; + } + return { + packageName: parts[0], + subpath: parts.slice(1).join("/"), + }; +} +async function findPackageRoot(packageName, fromFile) { + let current = dirname(fromFile); + while (true) { + const candidate = join(current, "node_modules", packageName); + if (await pathExists(join(candidate, "package.json"))) { + return candidate; + } + const parent = dirname(current); + if (parent === current) + break; + current = parent; + } + throw new Error(`Cannot find package ${packageName} from ${fromFile}`); +} +async function pathExists(path) { + try { + await readFile(path); + return true; + } + catch { + return false; + } +} +async function resolveExistingPath(path) { + try { + return await realpath(path); + } + catch { + return path; + } +} +function resolvePackageExport(packageJson, subpath) { + const exportKey = subpath ? `./${subpath}` : "."; + if (packageJson.exports !== undefined) { + const entry = selectExportEntry(packageJson.exports, exportKey); + const target = selectExportTarget(entry); + if (target) + return target; + return undefined; + } + if (subpath) + return subpath; + return packageJson.module ?? packageJson.main ?? "index.js"; +} +function selectExportEntry(exportsField, exportKey) { + if (typeof exportsField === "string" || + Array.isArray(exportsField) || + exportsField === null) { + return exportKey === "." ? exportsField : undefined; + } + if (typeof exportsField !== "object") + return undefined; + const map = exportsField; + if (Object.hasOwn(map, exportKey)) + return map[exportKey]; + for (const [key, value] of Object.entries(map)) { + if (!key.includes("*")) + continue; + const [prefix, suffix] = key.split("*"); + if (exportKey.startsWith(prefix) && exportKey.endsWith(suffix)) { + const replacement = exportKey.slice(prefix.length, exportKey.length - suffix.length); + return replaceExportTargetPattern(value, replacement); + } + } + return undefined; +} +function replaceExportTargetPattern(entry, replacement) { + if (typeof entry === "string") + return entry.replaceAll("*", replacement); + if (Array.isArray(entry)) { + return entry.map((item) => replaceExportTargetPattern(item, replacement)); + } + if (entry && typeof entry === "object") { + return Object.fromEntries(Object.entries(entry).map(([key, value]) => [ + key, + replaceExportTargetPattern(value, replacement), + ])); + } + return entry; +} +function selectExportTarget(entry) { + if (typeof entry === "string") + return entry; + if (Array.isArray(entry)) { + for (const item of entry) { + const target = selectExportTarget(item); + if (target) + return target; + } + return undefined; + } + if (!entry || typeof entry !== "object") + return undefined; + const conditions = entry; + for (const key of ["import", "node", "default"]) { + if (Object.hasOwn(conditions, key)) { + const target = selectExportTarget(conditions[key]); + if (target) + return target; + } + } + return undefined; +} +async function loadOfficialPlugins(kinds) { + const plugins = []; + if (kinds.has("graphql")) { + try { + const graphqlPlugin = await importOfficialPluginExport("@executor-js/plugin-graphql/core", "graphqlPlugin"); + plugins.push(graphqlPlugin()); + } + catch (error) { + throw pluginLoadError("GraphQL", error); + } + } + if (kinds.has("openapi")) { + try { + const openApiPlugin = await importOfficialPluginExport("@executor-js/plugin-openapi/core", "openApiPlugin"); + plugins.push(openApiPlugin()); + } + catch (error) { + throw pluginLoadError("OpenAPI", error); + } + } + if (kinds.has("mcp")) { + try { + const mcpPlugin = await importOfficialPluginExport("@executor-js/plugin-mcp/core", "mcpPlugin"); + plugins.push(mcpPlugin()); + } + catch (error) { + throw pluginLoadError("MCP", error); + } + } + return plugins; +} +export async function initExecutorSDK(setup, plugins, onElicitation) { + const queuedSources = []; + const setupRecorder = { + tools: { + list: async () => [], + invoke: async () => { + throw new Error("sdk.tools.invoke() is not available during executor setup"); + }, + }, + sources: { + add: async (input) => { + queuedSources.push(input); + }, + list: async () => [], + }, + close: async () => { }, + }; + if (setup) { + await setup(setupRecorder); + } + const sourceKinds = new Set(queuedSources.map((source) => String(source.kind ?? "custom"))); + const { createExecutor } = await import("@executor-js/sdk"); + const { Effect } = await import("@executor-js/sdk/core"); + const { discoveryPlugin } = await import("./executor-discovery-plugin.js"); + const officialPlugins = await loadOfficialPlugins(sourceKinds); + const allPlugins = [ + discoveryPlugin(), + ...officialPlugins, + ...(plugins ?? []), + ]; + const createSDKExecutor = createExecutor; + const executor = (await createSDKExecutor({ + plugins: allPlugins, + onElicitation: toSDKElicitationHandler(Effect, onElicitation), + })); + const addSource = createAddSource(executor); + const sdk = { + tools: { + list: executor.tools.list, + invoke: executor.tools.invoke, + }, + sources: { + add: addSource, + list: executor.sources.list, + }, + close: executor.close, + }; + for (const source of queuedSources) { + await addSource(source); + } + return { sdk, rawExecutor: executor }; +} +function createAddSource(executor) { + const discoveryExt = getExtension(executor, "justBashDiscovery"); + return async (def) => { + const kind = String(def.kind ?? "custom"); + if (kind === "graphql") { + const graphqlExt = getExtension(executor, "graphql"); + await graphqlExt.addSource({ + endpoint: def.endpoint, + scope: def.scope ?? DEFAULT_SCOPE_ID, + name: def.name, + namespace: def.name, + headers: def.headers, + queryParams: def.queryParams, + introspectionJson: def.introspectionJson, + }); + return; + } + if (kind === "openapi") { + const openapiExt = getExtension(executor, "openapi"); + await openapiExt.addSpec({ + spec: def.spec, + scope: def.scope ?? DEFAULT_SCOPE_ID, + baseUrl: (def.endpoint ?? def.baseUrl), + name: def.name, + namespace: def.name, + headers: def.headers, + queryParams: def.queryParams, + }); + return; + } + if (kind === "mcp") { + const mcpExt = getExtension(executor, "mcp"); + const transport = def.transport ?? "remote"; + if (transport === "stdio") { + await mcpExt.addSource({ + transport: "stdio", + scope: def.scope ?? DEFAULT_SCOPE_ID, + name: def.name, + command: def.command, + args: def.args, + env: def.env, + cwd: def.cwd, + namespace: def.name, + }); + return; + } + await mcpExt.addSource({ + transport: "remote", + scope: def.scope ?? DEFAULT_SCOPE_ID, + name: def.name, + endpoint: def.endpoint, + namespace: def.name, + headers: def.headers, + remoteTransport: def.remoteTransport, + queryParams: def.queryParams, + }); + return; + } + await discoveryExt.sources.add(def); + }; +} diff --git a/packages/just-bash-executor/dist/index.d.ts b/packages/just-bash-executor/dist/index.d.ts new file mode 100644 index 00000000..cabcd346 --- /dev/null +++ b/packages/just-bash-executor/dist/index.d.ts @@ -0,0 +1,3 @@ +export { createExecutor, type ExecutorHandle } from "./create-executor.js"; +export { parseToolArgs } from "./parse-tool-args.js"; +export type { ExecutorApprovalRequest, ExecutorApprovalResponse, ExecutorConfig, ExecutorElicitationContext, ExecutorElicitationHandler, ExecutorElicitationResponse, ExecutorSDKHandle, ExecutorToolDef, } from "./types.js"; diff --git a/packages/just-bash-executor/dist/index.js b/packages/just-bash-executor/dist/index.js new file mode 100644 index 00000000..6568546c --- /dev/null +++ b/packages/just-bash-executor/dist/index.js @@ -0,0 +1,2 @@ +export { createExecutor } from "./create-executor.js"; +export { parseToolArgs } from "./parse-tool-args.js"; diff --git a/packages/just-bash-executor/dist/parse-tool-args.d.ts b/packages/just-bash-executor/dist/parse-tool-args.d.ts new file mode 100644 index 00000000..acf68bd3 --- /dev/null +++ b/packages/just-bash-executor/dist/parse-tool-args.d.ts @@ -0,0 +1,5 @@ +/** + * Parse JSON tool arguments. Empty/missing string yields undefined; + * malformed JSON throws so callers get a clear error. + */ +export declare function parseToolArgs(argsJson: string): unknown; diff --git a/packages/just-bash-executor/dist/parse-tool-args.js b/packages/just-bash-executor/dist/parse-tool-args.js new file mode 100644 index 00000000..1b027b32 --- /dev/null +++ b/packages/just-bash-executor/dist/parse-tool-args.js @@ -0,0 +1,9 @@ +/** + * Parse JSON tool arguments. Empty/missing string yields undefined; + * malformed JSON throws so callers get a clear error. + */ +export function parseToolArgs(argsJson) { + if (!argsJson) + return undefined; + return JSON.parse(argsJson); +} diff --git a/packages/just-bash-executor/dist/tool-command.d.ts b/packages/just-bash-executor/dist/tool-command.d.ts new file mode 100644 index 00000000..7c116b25 --- /dev/null +++ b/packages/just-bash-executor/dist/tool-command.d.ts @@ -0,0 +1,53 @@ +/** + * Auto-generated CLI commands from executor tools. + * + * Converts executor tool definitions into bash namespace commands: + * math.add → `math add --a 1 --b 2` + * petstore.listPets → `petstore list-pets --status available` + * + * Input modes (highest precedence first): + * 1. Flags: --key value, --key=value, key=value + * 2. --json: --json '{"key":"value"}' + * 3. stdin: echo '{"key":"value"}' | namespace command + */ +import { type Command } from "just-bash"; +/** + * Convert camelCase to kebab-case. + * `listPets` → `list-pets`, `getPetById` → `get-pet-by-id` + */ +export declare function camelToKebab(name: string): string; +/** Sentinel returned when --help is detected. */ +declare const HELP_SENTINEL: unique symbol; +/** + * Parse CLI arguments into a JSON object for tool invocation. + * + * Precedence (highest wins): + * 1. Flags (--key value, --key=value, key=value) + * 2. --json '{...}' + * 3. Piped stdin JSON + * + * Returns HELP_SENTINEL if --help is detected. + */ +export declare function parseToolCliArgs(args: string[], stdin: string): Record | typeof HELP_SENTINEL; +export interface ToolSubcommand { + /** Kebab-case subcommand name */ + name: string; + /** Original tool path (e.g. "math.add") */ + originalPath: string; + /** Tool description */ + description?: string; + /** Additional aliases (e.g. original camelCase name) */ + aliases?: string[]; +} +export interface ToolEntry { + /** Full tool path (e.g. "math.add", "petstore.listPets") */ + path: string; + /** Tool description */ + description?: string; +} +/** + * Group tool entries by namespace (first dot-segment) and build + * namespace commands. + */ +export declare function buildNamespaceCommands(tools: ToolEntry[], invokeTool: (path: string, argsJson: string) => Promise): Command[]; +export {}; diff --git a/packages/just-bash-executor/dist/tool-command.js b/packages/just-bash-executor/dist/tool-command.js new file mode 100644 index 00000000..793889c0 --- /dev/null +++ b/packages/just-bash-executor/dist/tool-command.js @@ -0,0 +1,305 @@ +/** + * Auto-generated CLI commands from executor tools. + * + * Converts executor tool definitions into bash namespace commands: + * math.add → `math add --a 1 --b 2` + * petstore.listPets → `petstore list-pets --status available` + * + * Input modes (highest precedence first): + * 1. Flags: --key value, --key=value, key=value + * 2. --json: --json '{"key":"value"}' + * 3. stdin: echo '{"key":"value"}' | namespace command + */ +import { decodeBytesToUtf8, } from "just-bash"; +// ── Naming ────────────────────────────────────────────────────── +/** + * Convert camelCase to kebab-case. + * `listPets` → `list-pets`, `getPetById` → `get-pet-by-id` + */ +export function camelToKebab(name) { + return name + .replace(/([a-z0-9])([A-Z])/g, "$1-$2") + .replace(/([A-Z])([A-Z][a-z])/g, "$1-$2") + .toLowerCase(); +} +// ── Arg Parsing ───────────────────────────────────────────────── +/** Sentinel returned when --help is detected. */ +const HELP_SENTINEL = Symbol("help"); +/** + * Coerce a string value to its natural JSON type. + * Try JSON.parse first (handles numbers, booleans, arrays, objects). + * Fall back to string. + */ +function coerceValue(raw) { + if (raw === "") + return ""; + try { + return JSON.parse(raw); + } + catch { + return raw; + } +} +function assertJsonObject(value, label) { + if (value && typeof value === "object" && !Array.isArray(value)) { + return value; + } + throw new Error(`${label} must be a JSON object`); +} +/** + * Parse CLI arguments into a JSON object for tool invocation. + * + * Precedence (highest wins): + * 1. Flags (--key value, --key=value, key=value) + * 2. --json '{...}' + * 3. Piped stdin JSON + * + * Returns HELP_SENTINEL if --help is detected. + */ +export function parseToolCliArgs(args, stdin) { + // Base: piped stdin JSON + let result = Object.create(null); + const trimmedStdin = stdin.trim(); + if (trimmedStdin) { + try { + const parsed = JSON.parse(trimmedStdin); + if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) { + Object.assign(result, parsed); + } + } + catch { + // Not JSON stdin — ignore + } + } + // Layer: --json flag (overrides stdin) + let jsonFlagValue; + const remainingArgs = []; + for (let i = 0; i < args.length; i++) { + if (args[i] === "--help") + return HELP_SENTINEL; + if (args[i] === "--json" && i + 1 < args.length) { + jsonFlagValue = args[++i]; + } + else if (args[i].startsWith("--json=")) { + jsonFlagValue = args[i].slice(7); + } + else { + remainingArgs.push(args[i]); + } + } + if (jsonFlagValue !== undefined) { + try { + const parsed = JSON.parse(jsonFlagValue); + result = Object.assign(Object.create(null), result, assertJsonObject(parsed, "--json")); + } + catch (error) { + const detail = error instanceof Error ? error.message : String(error); + throw new Error(`Invalid --json value: ${detail}`); + } + } + // Top layer: flags and key=value pairs (highest precedence) + for (let i = 0; i < remainingArgs.length; i++) { + const arg = remainingArgs[i]; + // --key=value + if (arg.startsWith("--") && arg.includes("=")) { + const eqIdx = arg.indexOf("="); + const key = arg.slice(2, eqIdx); + if (key) + result[key] = coerceValue(arg.slice(eqIdx + 1)); + continue; + } + // --key value + if (arg.startsWith("--") && arg.length > 2) { + const key = arg.slice(2); + if (i + 1 < remainingArgs.length && + !remainingArgs[i + 1].startsWith("--")) { + result[key] = coerceValue(remainingArgs[++i]); + } + else { + // Boolean flag: --verbose → { verbose: true } + result[key] = true; + } + continue; + } + // key=value + const eqIdx = arg.indexOf("="); + if (eqIdx > 0) { + const key = arg.slice(0, eqIdx); + result[key] = coerceValue(arg.slice(eqIdx + 1)); + continue; + } + // Single positional arg that looks like JSON object + if (remainingArgs.length === 1 && arg.startsWith("{")) { + try { + const parsed = JSON.parse(arg); + Object.assign(result, assertJsonObject(parsed, "positional JSON")); + } + catch (error) { + const detail = error instanceof Error ? error.message : String(error); + throw new Error(`Invalid positional JSON: ${detail}`); + } + } + } + return result; +} +function formatNamespaceHelp(namespace, subcommands) { + const lines = []; + lines.push(`Executor tools: ${namespace}`); + lines.push(""); + lines.push("USAGE"); + lines.push(` ${namespace} [flags]`); + lines.push(""); + lines.push("COMMANDS"); + // Align descriptions + const maxLen = Math.max(...subcommands.map((s) => s.name.length), 0); + for (const sub of subcommands) { + const pad = " ".repeat(Math.max(2, maxLen - sub.name.length + 4)); + const desc = sub.description ?? ""; + lines.push(` ${sub.name}${pad}${desc}`); + } + lines.push(""); + lines.push("EXAMPLES"); + if (subcommands.length > 0) { + const first = subcommands[0]; + lines.push(` ${namespace} ${first.name} key=value`); + } + if (subcommands.length > 1) { + const second = subcommands[1]; + lines.push(` ${namespace} ${second.name} --key value`); + } + lines.push(""); + lines.push("LEARN MORE"); + lines.push(` ${namespace} --help`); + lines.push(""); + return lines.join("\n"); +} +function formatSubcommandHelp(namespace, sub) { + const full = `${namespace} ${sub.name}`; + const lines = []; + if (sub.description) { + lines.push(sub.description); + lines.push(""); + } + lines.push("USAGE"); + lines.push(` ${full} [key=value ...]`); + lines.push(` ${full} [--key value ...]`); + lines.push(` ${full} --json '{...}'`); + lines.push(` | ${full}`); + lines.push(""); + lines.push("FLAGS"); + lines.push(" --json string Pass all arguments as a JSON object"); + lines.push(" --help Show this help"); + lines.push(""); + lines.push("EXAMPLES"); + lines.push(` ${full} key=value`); + lines.push(` ${full} --key value`); + lines.push(` ${full} --json '{"key":"value"}'`); + lines.push(` echo '{"key":"value"}' | ${full}`); + lines.push(` ${full} key=value | jq -r .field`); + lines.push(""); + return lines.join("\n"); +} +// ── Command Factory ───────────────────────────────────────────── +/** + * Create a namespace command that dispatches to tool subcommands. + * + * @param namespace - Command name (e.g. "math", "countries") + * @param subcommands - Subcommand definitions + * @param invokeTool - Tool invoker: (toolPath, argsJson) → resultJson + */ +function createNamespaceCommand(namespace, subcommands, invokeTool) { + // Build lookup: subcommand name → tool info (including aliases) + const lookup = new Map(); + for (const sub of subcommands) { + lookup.set(sub.name, sub); + if (sub.aliases) { + for (const alias of sub.aliases) { + if (!lookup.has(alias)) { + lookup.set(alias, sub); + } + } + } + } + return { + name: namespace, + trusted: true, + async execute(args, ctx) { + // No args or --help → namespace help + if (args.length === 0 || (args.length === 1 && args[0] === "--help")) { + return { + stdout: formatNamespaceHelp(namespace, subcommands), + stderr: "", + exitCode: 0, + }; + } + // First arg is the subcommand + const subName = args[0]; + const sub = lookup.get(subName); + if (!sub) { + return { + stdout: "", + stderr: `${namespace}: unknown command "${subName}"\nRun '${namespace} --help' for usage.\n`, + exitCode: 1, + }; + } + const subArgs = args.slice(1); + try { + // ctx.stdin is a ByteString; decode for the JSON parser inside + // `parseToolCliArgs`, which expects real Unicode text. + const parsed = parseToolCliArgs(subArgs, decodeBytesToUtf8(ctx.stdin)); + if (parsed === HELP_SENTINEL) { + return { + stdout: formatSubcommandHelp(namespace, sub), + stderr: "", + exitCode: 0, + }; + } + const argsJson = Object.keys(parsed).length > 0 ? JSON.stringify(parsed) : ""; + const resultJson = await invokeTool(sub.originalPath, argsJson); + const stdout = resultJson ? `${resultJson}\n` : ""; + return { stdout, stderr: "", exitCode: 0 }; + } + catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`${sub.name}: ${message}`); + } + }, + }; +} +/** + * Group tool entries by namespace (first dot-segment) and build + * namespace commands. + */ +export function buildNamespaceCommands(tools, invokeTool) { + // Group by namespace + const groups = new Map(); + for (const tool of tools) { + const dotIdx = tool.path.indexOf("."); + if (dotIdx === -1) + continue; // Skip tools without a namespace + const namespace = tool.path.slice(0, dotIdx); + const rawName = tool.path.slice(dotIdx + 1); + const kebabName = camelToKebab(rawName); + const sub = { + name: kebabName, + originalPath: tool.path, + description: tool.description, + }; + // Add camelCase alias if different from kebab + if (kebabName !== rawName) { + sub.aliases = [rawName]; + } + let group = groups.get(namespace); + if (!group) { + group = []; + groups.set(namespace, group); + } + group.push(sub); + } + // Build one command per namespace + const commands = []; + for (const [namespace, subs] of groups) { + commands.push(createNamespaceCommand(namespace, subs, invokeTool)); + } + return commands; +} diff --git a/packages/just-bash-executor/dist/types.d.ts b/packages/just-bash-executor/dist/types.d.ts new file mode 100644 index 00000000..1f51277d --- /dev/null +++ b/packages/just-bash-executor/dist/types.d.ts @@ -0,0 +1,120 @@ +/** + * Public types for `@just-bash/executor`. + * + * Mirror `@executor-js/sdk` shapes without importing the SDK at type-resolution + * time, so consumers who only use inline tools don't pay for SDK imports. + */ +/** Tool definition for inline registration. */ +export interface ExecutorToolDef { + description?: string; + execute: (...args: any[]) => unknown; +} +/** + * Elicitation context passed to the handler when a tool requests user input. + * Mirrors @executor-js/sdk's ElicitationContext without importing the SDK. + */ +export interface ExecutorElicitationContext { + readonly toolId: string; + readonly args: unknown; + readonly request: { + readonly _tag: "FormElicitation"; + readonly message: string; + readonly requestedSchema: Record; + } | { + readonly _tag: "UrlElicitation"; + readonly message: string; + readonly url: string; + readonly elicitationId: string; + }; +} +/** + * Response from an elicitation handler. + */ +export interface ExecutorElicitationResponse { + readonly action: "accept" | "decline" | "cancel"; + readonly content?: Record; +} +/** + * Handler for tool elicitation requests (form input, OAuth URLs, etc.). + * Compatible with @executor-js/sdk's ElicitationHandler. + */ +export type ExecutorElicitationHandler = (ctx: ExecutorElicitationContext) => Promise; +/** + * Executor SDK instance type (subset of `@executor-js/sdk`'s public API). + * Kept as an opaque type to avoid requiring the SDK at import time. + */ +export interface ExecutorSDKHandle { + tools: { + list: (filter?: { + sourceId?: string; + query?: string; + }) => Promise; + invoke: (toolId: string, args: unknown) => Promise; + }; + sources: { + add: (input: Record) => Promise; + list: () => Promise; + }; + close: () => Promise; +} +/** Approval request payload passed to the onToolApproval callback. */ +export interface ExecutorApprovalRequest { + toolPath: string; + sourceId: string; + sourceName: string; + operationKind: "read" | "write" | "delete" | "execute" | "unknown"; + args: unknown; + reason: string; + approvalLabel: string | null; +} +/** Approval response from a custom onToolApproval callback. */ +export type ExecutorApprovalResponse = { + approved: true; +} | { + approved: false; + reason?: string; +}; +/** Configuration for createExecutor. */ +export interface ExecutorConfig { + /** Tool map: keys are dot-separated paths (e.g. "math.add"), values are tool definitions. */ + tools?: Record; + /** + * Async setup function that receives the SDK instance. + * Use this to add sources that auto-discover tools. + * + * Supported source kinds: + * - `"custom"` — direct tool registration (inline `{ execute }` functions) + * - `"graphql"` — auto-discovers tools via schema introspection (`@executor-js/plugin-graphql`) + * - `"openapi"` — auto-discovers tools from an OpenAPI spec (`@executor-js/plugin-openapi`) + * - `"mcp"` — connects to an MCP server and discovers tools (`@executor-js/plugin-mcp`) + */ + setup?: (sdk: ExecutorSDKHandle) => Promise; + /** + * Additional @executor-js/sdk plugins to load. + * Passed directly to createExecutor({ plugins: [...] }). + */ + plugins?: any[]; + /** + * Tool approval callback for the SDK pipeline. + * Called when an SDK-registered tool invocation requires approval. + * Defaults to "allow-all" when not provided. + * + * Note: inline tools (registered via `tools`) bypass approval — the user + * controls `execute()` directly. + */ + onToolApproval?: "allow-all" | "deny-all" | ((request: ExecutorApprovalRequest) => Promise); + /** + * Elicitation handler for the SDK pipeline. + * Called when a tool requests user input (form data, OAuth approval, etc.). + * Defaults to declining all elicitation requests. + * + * Pass "accept-all" to auto-approve (not recommended for untrusted tools). + */ + onElicitation?: ExecutorElicitationHandler | "accept-all"; + /** + * When true (default), executor tools are returned as bash namespace + * commands in `executor.commands`. Set to false if you only want script-level + * `tools` proxy access via `invokeTool`. + */ + exposeToolsAsCommands?: boolean; +} diff --git a/packages/just-bash-executor/dist/types.js b/packages/just-bash-executor/dist/types.js new file mode 100644 index 00000000..4a046f22 --- /dev/null +++ b/packages/just-bash-executor/dist/types.js @@ -0,0 +1,7 @@ +/** + * Public types for `@just-bash/executor`. + * + * Mirror `@executor-js/sdk` shapes without importing the SDK at type-resolution + * time, so consumers who only use inline tools don't pay for SDK imports. + */ +export {}; diff --git a/packages/just-bash-executor/package.json b/packages/just-bash-executor/package.json new file mode 100644 index 00000000..720632b9 --- /dev/null +++ b/packages/just-bash-executor/package.json @@ -0,0 +1,74 @@ +{ + "name": "@just-bash/executor", + "version": "1.0.2", + "description": "Experimental tool-invocation companion for just-bash. Wires @executor-js/sdk into js-exec via the invokeTool hook.", + "repository": { + "type": "git", + "url": "git+https://github.com/vercel-labs/just-bash.git", + "directory": "packages/just-bash-executor" + }, + "homepage": "https://github.com/vercel-labs/just-bash/tree/main/packages/just-bash-executor#readme", + "bugs": { + "url": "https://github.com/vercel-labs/just-bash/issues" + }, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "files": [ + "dist/", + "README.md", + "SKILL.md" + ], + "publishConfig": { + "access": "public", + "tag": "experimental" + }, + "keywords": [ + "just-bash", + "executor", + "experimental" + ], + "scripts": { + "build": "rm -rf dist && tsc && pnpm build:clean", + "build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete", + "typecheck": "tsc --noEmit", + "test": "vitest", + "test:run": "vitest run", + "test:unit": "vitest run", + "lint:fix": "pnpm --workspace-root lint:fix" + }, + "license": "Apache-2.0", + "author": "Malte and Claude", + "peerDependencies": { + "just-bash": "workspace:*", + "@executor-js/sdk": "^0.2.0", + "@executor-js/plugin-graphql": "^0.2.0", + "@executor-js/plugin-mcp": "^0.2.0", + "@executor-js/plugin-openapi": "^0.2.0" + }, + "peerDependenciesMeta": { + "@executor-js/sdk": { + "optional": true + }, + "@executor-js/plugin-graphql": { + "optional": true + }, + "@executor-js/plugin-mcp": { + "optional": true + }, + "@executor-js/plugin-openapi": { + "optional": true + } + }, + "devDependencies": { + "@types/node": "^25.0.3", + "typescript": "^5.9.3", + "vitest": "^4.0.16" + } +} diff --git a/packages/just-bash-executor/src/create-executor.ts b/packages/just-bash-executor/src/create-executor.ts new file mode 100644 index 00000000..4c2f2906 --- /dev/null +++ b/packages/just-bash-executor/src/create-executor.ts @@ -0,0 +1,187 @@ +/** + * `createExecutor` — main entry point. + * + * Builds an `ExecutorHandle` containing: + * - `commands`: bash namespace commands derived from inline tools and/or + * SDK-discovered tools, ready to pass to `new Bash({ customCommands })` + * - `invokeTool`: a `(path, argsJson) => Promise` callback to wire + * into `new Bash({ javascript: { invokeTool } })` + * - `sdk?`: the SDK handle when `setup` was provided, exposed for advanced + * use (e.g. listing sources) + */ + +import type { Command } from "just-bash"; +import { initExecutorSDK } from "./executor-init.js"; +import { parseToolArgs } from "./parse-tool-args.js"; +import { buildNamespaceCommands, type ToolEntry } from "./tool-command.js"; +import type { + ExecutorConfig, + ExecutorSDKHandle, + ExecutorToolDef, +} from "./types.js"; + +type SDKToolMeta = { + id: string; + sourceId?: string; + source_id?: string; + name?: string; + annotations?: { + approvalDescription?: string; + }; +}; + +type SDKSourceMeta = { + id?: string; + name?: string; +}; + +function readString(value: unknown): string | undefined { + return typeof value === "string" && value.length > 0 ? value : undefined; +} + +export interface ExecutorHandle { + /** Bash namespace commands; pass to `new Bash({ customCommands })`. */ + commands: Command[]; + /** + * Tool invocation callback for `JavaScriptConfig.invokeTool`. + * Routes inline tool calls directly and SDK-tool calls through the + * approval/elicitation pipeline. + */ + invokeTool: (path: string, argsJson: string) => Promise; + /** + * SDK handle. Present only when `setup` was provided. Use it to inspect + * sources, list tools, or close the executor when done. + */ + sdk?: ExecutorSDKHandle; +} + +/** + * Build an `ExecutorHandle` from a config of inline tools and/or an SDK setup. + * + * - **Inline tools** (`tools`): registered locally; calls go through + * `tool.execute(args)` directly. + * - **SDK setup** (`setup`): boots `@executor-js/sdk` with the GraphQL, + * OpenAPI, MCP, and discovery plugins; calls go through + * `sdk.tools.invoke()` with approval/elicitation gates applied. + * + * Both can be present in one call. Inline tools take precedence over + * SDK-discovered tools with the same path. + */ +export async function createExecutor( + config: ExecutorConfig = {}, +): Promise { + const inlineTools: Record = Object.assign( + Object.create(null) as Record, + config.tools ?? {}, + ); + + const exposeAsCommands = config.exposeToolsAsCommands !== false; + const allEntries: ToolEntry[] = []; + + for (const path of Object.keys(inlineTools)) { + allEntries.push({ + path, + description: inlineTools[path].description, + }); + } + + const inlineInvokeTool = async ( + path: string, + argsJson: string, + ): Promise => { + const tool = inlineTools[path]; + if (!tool) throw new Error(`Unknown tool: ${path}`); + const args = parseToolArgs(argsJson); + const result = await tool.execute(args); + return result !== undefined ? JSON.stringify(result) : ""; + }; + + // No SDK setup → inline-only path. Done. + if (!config.setup) { + return { + commands: exposeAsCommands + ? buildNamespaceCommands(allEntries, inlineInvokeTool) + : [], + invokeTool: inlineInvokeTool, + }; + } + + // SDK path: boot SDK, run user setup, list discovered tools, build a merged + // invokeTool that prefers inline tools and falls through to the SDK pipeline. + const { sdk, rawExecutor } = await initExecutorSDK( + config.setup, + config.plugins, + config.onElicitation, + ); + + const discoveredTools = (await sdk.tools.list()) as { + id: string; + description?: string; + }[]; + for (const tool of discoveredTools) { + if (Object.hasOwn(inlineTools, tool.id)) continue; // inline wins + allEntries.push({ path: tool.id, description: tool.description }); + } + + const approval = config.onToolApproval; + const sdkInvokeTool = async ( + path: string, + argsJson: string, + ): Promise => { + const args = parseToolArgs(argsJson); + + if (approval && approval !== "allow-all") { + if (approval === "deny-all") { + throw new Error(`Tool invocation denied: ${path}`); + } + const allTools = (await rawExecutor.tools.list()) as SDKToolMeta[]; + const toolMeta = allTools.find((t) => t.id === path); + const sourceId = + readString(toolMeta?.sourceId) ?? + readString(toolMeta?.source_id) ?? + "unknown"; + const allSources = (await rawExecutor.sources.list()) as SDKSourceMeta[]; + const sourceMeta = allSources.find((source) => source.id === sourceId); + const approvalLabel = + readString(toolMeta?.annotations?.approvalDescription) ?? null; + const decision = await approval({ + toolPath: path, + sourceId, + sourceName: readString(sourceMeta?.name) ?? sourceId, + operationKind: "unknown", + args, + reason: approvalLabel ?? `Tool ${path} invoked`, + approvalLabel, + }); + if (!decision.approved) { + throw new Error( + `Tool invocation denied: ${path}${ + decision.reason ? ` (${decision.reason})` : "" + }`, + ); + } + } + + const result = await rawExecutor.tools.invoke(path, args); + + return result !== undefined ? JSON.stringify(result) : ""; + }; + + const invokeTool = async ( + path: string, + argsJson: string, + ): Promise => { + if (Object.hasOwn(inlineTools, path)) { + return inlineInvokeTool(path, argsJson); + } + return sdkInvokeTool(path, argsJson); + }; + + return { + commands: exposeAsCommands + ? buildNamespaceCommands(allEntries, invokeTool) + : [], + invokeTool, + sdk, + }; +} diff --git a/packages/just-bash-executor/src/docs.test.ts b/packages/just-bash-executor/src/docs.test.ts new file mode 100644 index 00000000..a2eb48b8 --- /dev/null +++ b/packages/just-bash-executor/src/docs.test.ts @@ -0,0 +1,165 @@ +/** + * Documentation validation for README.md and SKILL.md. + * + * Goals: + * 1. Both files exist and have substantive content. + * 2. SKILL.md has the expected agent-facing structure (frontmatter, sections). + * 3. Every fenced TypeScript code block in either file parses as valid TS + * syntax. We do NOT type-check (many snippets reference undeclared + * identifiers like INTROSPECTION_JSON or `tools.foo.bar` proxy access); + * syntax-only catches typos that would mislead readers. + */ + +import * as fs from "node:fs"; +import * as path from "node:path"; +import * as ts from "typescript"; +import { describe, expect, it } from "vitest"; + +const README_PATH = path.join(import.meta.dirname, "..", "README.md"); +const SKILL_PATH = path.join(import.meta.dirname, "..", "SKILL.md"); + +function read(filePath: string): string { + return fs.readFileSync(filePath, "utf-8"); +} + +/** + * Pull every ```ts / ```typescript code block out of a markdown file. + */ +function extractTsBlocks(markdown: string): string[] { + const blocks: string[] = []; + const pattern = /```(?:ts|typescript)\n([\s\S]*?)```/g; + for (const match of markdown.matchAll(pattern)) { + blocks.push(match[1]); + } + return blocks; +} + +/** + * Parse a TS source string and return any syntactic diagnostics. We use + * `createSourceFile` rather than a full Program so we don't pay for + * cross-file type checking — these snippets aren't meant to be standalone. + */ +function syntaxDiagnostics(source: string): ts.Diagnostic[] { + const sourceFile = ts.createSourceFile( + "snippet.ts", + source, + ts.ScriptTarget.ES2022, + /*setParentNodes*/ true, + ts.ScriptKind.TS, + ); + // `parseDiagnostics` is internal but stable; cast through unknown to access. + return (sourceFile as unknown as { parseDiagnostics: ts.Diagnostic[] }) + .parseDiagnostics; +} + +function formatDiagnostics( + diagnostics: ts.Diagnostic[], + source: string, +): string { + return diagnostics + .map((d) => { + const message = ts.flattenDiagnosticMessageText(d.messageText, "\n"); + if (d.file && d.start !== undefined) { + const { line, character } = d.file.getLineAndCharacterOfPosition( + d.start, + ); + const lines = source.split("\n"); + const ctx = lines[line] ?? ""; + return ` line ${line + 1}:${character + 1}: ${message}\n | ${ctx}`; + } + return ` ${message}`; + }) + .join("\n"); +} + +describe("README.md", () => { + it("exists and has substantive content", () => { + const content = read(README_PATH); + expect(content.length).toBeGreaterThan(2000); + expect(content).toContain("@just-bash/executor"); + expect(content).toContain("createExecutor"); + }); + + it("links to SKILL.md", () => { + const content = read(README_PATH); + expect(content).toContain("SKILL.md"); + }); + + it("has TypeScript code blocks", () => { + const blocks = extractTsBlocks(read(README_PATH)); + expect(blocks.length).toBeGreaterThan(3); + }); + + it("all TypeScript code blocks parse without syntax errors", () => { + const blocks = extractTsBlocks(read(README_PATH)); + const failures: string[] = []; + for (let i = 0; i < blocks.length; i++) { + const diagnostics = syntaxDiagnostics(blocks[i]); + if (diagnostics.length > 0) { + failures.push( + `README.md block #${i + 1}:\n${formatDiagnostics(diagnostics, blocks[i])}`, + ); + } + } + if (failures.length > 0) { + expect.fail( + `TypeScript syntax errors in README.md code blocks:\n\n${failures.join("\n\n")}`, + ); + } + }); +}); + +describe("SKILL.md", () => { + it("exists and has substantive content", () => { + const content = read(SKILL_PATH); + expect(content.length).toBeGreaterThan(2000); + }); + + it("has YAML frontmatter with name and description", () => { + const content = read(SKILL_PATH); + expect(content.startsWith("---\n")).toBe(true); + const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n/); + expect(frontmatterMatch).not.toBeNull(); + const frontmatter = frontmatterMatch?.[1] ?? ""; + expect(frontmatter).toMatch(/^name:\s*just-bash-executor\s*$/m); + expect(frontmatter).toMatch(/^description:\s*\S/m); + }); + + it("covers all source kinds (OpenAPI, GraphQL, MCP, Inline)", () => { + const content = read(SKILL_PATH); + expect(content).toMatch(/§3.*OpenAPI/i); + expect(content).toMatch(/§4.*GraphQL/i); + expect(content).toMatch(/§5.*MCP/i); + expect(content).toMatch(/§2.*Inline/i); + }); + + it("includes the JS API and bash CLI reference tables", () => { + const content = read(SKILL_PATH); + expect(content).toContain("await tools"); + expect(content).toContain("--json"); + expect(content).toContain("Mode precedence"); + }); + + it("has TypeScript code blocks", () => { + const blocks = extractTsBlocks(read(SKILL_PATH)); + expect(blocks.length).toBeGreaterThan(3); + }); + + it("all TypeScript code blocks parse without syntax errors", () => { + const blocks = extractTsBlocks(read(SKILL_PATH)); + const failures: string[] = []; + for (let i = 0; i < blocks.length; i++) { + const diagnostics = syntaxDiagnostics(blocks[i]); + if (diagnostics.length > 0) { + failures.push( + `SKILL.md block #${i + 1}:\n${formatDiagnostics(diagnostics, blocks[i])}`, + ); + } + } + if (failures.length > 0) { + expect.fail( + `TypeScript syntax errors in SKILL.md code blocks:\n\n${failures.join("\n\n")}`, + ); + } + }); +}); diff --git a/packages/just-bash-executor/src/executor-discovery-plugin.ts b/packages/just-bash-executor/src/executor-discovery-plugin.ts new file mode 100644 index 00000000..9c91d78f --- /dev/null +++ b/packages/just-bash-executor/src/executor-discovery-plugin.ts @@ -0,0 +1,125 @@ +/** + * Custom discovery plugin for @executor-js/sdk. + * + * Provides a `sources.add()` extension that registers tools dynamically + * at runtime. Supports a "custom" source kind where tools are provided + * directly as `{ description?, execute(args) }` objects. + */ + +import { + definePlugin, + Effect, + type Plugin, + type PluginCtx, + type SourceInputTool, +} from "@executor-js/sdk/core"; + +export interface DiscoveryToolDef { + description?: string; + // biome-ignore lint/suspicious/noExplicitAny: tool execute accepts any args shape + execute: (args: any) => unknown | Promise; +} + +export interface SourceDefinition { + /** Source kind. Currently only "custom" is supported. */ + kind: string; + /** Unique name for this source (becomes the tool namespace). */ + name: string; + /** Tool definitions (for kind: "custom"). Keys are tool names. */ + tools?: Record; + /** Auth config (reserved for future plugin kinds). */ + auth?: Record; + /** Endpoint URL (reserved for future plugin kinds). */ + endpoint?: string; +} + +export interface DiscoveryPluginExtension { + sources: { + add: (def: SourceDefinition) => Effect.Effect; + }; +} + +/** + * Create a discovery plugin instance. + * + * Usage with createExecutor: + * ```ts + * import { createExecutor } from "@executor-js/sdk"; + * import { discoveryPlugin } from "./executor-discovery-plugin.js"; + * + * const sdk = await createExecutor({ + * plugins: [discoveryPlugin()], + * onElicitation: "accept-all", + * }); + * await sdk.justBashDiscovery.sources.add({ + * kind: "custom", + * name: "math", + * tools: { ... }, + * }); + * ``` + */ +export function discoveryPlugin(): Plugin< + "justBashDiscovery", + DiscoveryPluginExtension, + null +> { + const handlers = new Map(); + + return definePlugin(() => ({ + id: "justBashDiscovery", + storage: () => null, + extension: (ctx: PluginCtx) => ({ + sources: { + add: (def: SourceDefinition) => + Effect.gen(function* () { + if (def.kind !== "custom" || !def.tools) { + return yield* Effect.fail( + new Error( + `Unsupported source kind: "${def.kind}" for discovery plugin. ` + + `Only "custom" is supported here.`, + ), + ); + } + + const scope = ctx.scopes[0]?.id ?? "default-scope"; + const tools: SourceInputTool[] = []; + + for (const [name, tool] of Object.entries(def.tools)) { + const toolId = `${def.name}.${name}`; + handlers.set(toolId, tool); + tools.push({ + name, + description: tool.description ?? name, + }); + } + + yield* ctx.core.sources.register({ + id: def.name, + scope, + kind: "custom", + name: def.name, + canRemove: true, + canRefresh: false, + tools, + }); + }), + }, + }), + invokeTool: ({ toolRow, args }) => + Effect.tryPromise({ + try: async () => { + const handler = handlers.get(toolRow.id); + if (!handler) { + throw new Error(`Unknown tool: ${toolRow.id}`); + } + return handler.execute(args); + }, + catch: (error) => + error instanceof Error ? error : new Error(String(error)), + }), + close: () => + Effect.sync(() => { + handlers.clear(); + }), + }))(); +} diff --git a/packages/just-bash-executor/src/executor-examples.test.ts b/packages/just-bash-executor/src/executor-examples.test.ts new file mode 100644 index 00000000..49578715 --- /dev/null +++ b/packages/just-bash-executor/src/executor-examples.test.ts @@ -0,0 +1,577 @@ +/** + * Tests for executor tool discovery via the @executor-js/sdk plugin system. + * + * Uses the custom discovery plugin to exercise the full discovery code path: + * setup(sdk) → sdk.sources.add() → tool registration → tool invocation via bridge. + * + * defense-in-depth is disabled because Effect's runtime sets Error.stackTraceLimit, + * which conflicts with the frozen Error constructor in defense-in-depth mode. + */ +import { Bash } from "just-bash"; +import { afterAll, beforeAll, describe, expect, it } from "vitest"; +import { createExecutor } from "./create-executor.js"; +import type { ExecutorConfig, ExecutorSDKHandle } from "./types.js"; + +// ── Network isolation ────────────────────────────────────────── +// +// The GraphQL and OpenAPI plugins make real HTTP calls when a discovered tool +// is invoked. The tests below use real-looking endpoints (countries.trevorblades.com, +// petstore.example.com) and rely on invocation failing to assert discovery +// worked. Letting those requests actually hit the network is flaky — the +// public endpoint can be slow/down, and `petstore.example.com` DNS behavior +// varies — so we intercept fetch and return a captured "fetch failed" response +// for those hosts. Effect's FetchHttpClient layer reads `globalThis.fetch` +// lazily via a Ref default, so installing the override before the first SDK +// init is sufficient. + +const HOSTS_TO_BLOCK = ["countries.trevorblades.com", "petstore.example.com"]; +const originalFetch = globalThis.fetch; + +function getRequestUrl(input: Parameters[0]): string { + if (typeof input === "string") return input; + if (input instanceof URL) return input.href; + return input.url; +} + +beforeAll(() => { + globalThis.fetch = (async (input, init) => { + const url = getRequestUrl(input); + if (HOSTS_TO_BLOCK.some((host) => url.includes(host))) { + throw new TypeError(`fetch blocked in tests: ${url}`); + } + return originalFetch(input, init); + }) as typeof fetch; +}); + +afterAll(() => { + globalThis.fetch = originalFetch; +}); + +function javascriptWithInvokeTool( + invokeTool: (path: string, argsJson: string) => Promise, +): NonNullable< + NonNullable[0]>["javascript"] +> { + return { invokeTool } as unknown as NonNullable< + NonNullable[0]>["javascript"] + >; +} + +async function makeBash(config: ExecutorConfig): Promise { + const executor = await createExecutor(config); + return new Bash({ + executionLimits: { maxJsTimeoutMs: 60000 }, + defenseInDepth: false, + customCommands: executor.commands, + javascript: javascriptWithInvokeTool(executor.invokeTool), + }); +} + +// ── Custom discovery plugin tests ─────────────────────────────── + +async function createBashWithCustomSource(): Promise { + return makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "custom", + name: "countries", + tools: { + country: { + description: "Get a country by code", + execute: (args: { code: string }) => { + const db: Record = Object.create(null); + db.JP = { + name: "Japan", + capital: "Tokyo", + continent: "Asia", + }; + db.US = { + name: "United States", + capital: "Washington D.C.", + continent: "North America", + }; + db.BR = { + name: "Brazil", + capital: "Brasília", + continent: "South America", + }; + db.AR = { + name: "Argentina", + capital: "Buenos Aires", + continent: "South America", + }; + return db[args.code] ?? null; + }, + }, + list: { + description: "List all countries", + execute: (args?: { continent?: string }) => { + const all = [ + { + code: "JP", + name: "Japan", + continent: "Asia", + }, + { + code: "US", + name: "United States", + continent: "North America", + }, + { + code: "BR", + name: "Brazil", + continent: "South America", + }, + { + code: "AR", + name: "Argentina", + continent: "South America", + }, + ]; + if (args?.continent) { + return all.filter((c) => c.continent === args.continent); + } + return all; + }, + }, + }, + }); + }, + onToolApproval: "allow-all", + }); +} + +describe("executor.setup: custom source discovery", () => { + let bash: Bash; + beforeAll(async () => { + bash = await createBashWithCustomSource(); + }); + + it("should call a discovered tool and get a result", async () => { + const r = await bash.exec(`js-exec -c ' + var result = await tools.countries.country({ code: "JP" }); + console.log(result.name); + console.log("capital=" + result.capital); + console.log("continent=" + result.continent); + '`); + expect(r.exitCode).toBe(0); + expect(r.stderr).toBe(""); + expect(r.stdout).toBe("Japan\ncapital=Tokyo\ncontinent=Asia\n"); + }); + + it("should list all items from a discovered tool", async () => { + const r = await bash.exec(`js-exec -c ' + var countries = await tools.countries.list({}); + console.log("count=" + countries.length); + for (var i = 0; i < countries.length; i++) { + console.log(countries[i].name); + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stderr).toBe(""); + expect(r.stdout).toBe("count=4\nJapan\nUnited States\nBrazil\nArgentina\n"); + }); + + it("should filter results with arguments", async () => { + const r = await bash.exec(`js-exec -c ' + var countries = await tools.countries.list({ continent: "South America" }); + console.log("count=" + countries.length); + for (var i = 0; i < countries.length; i++) { + console.log(countries[i].name + " — " + countries[i].code); + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stderr).toBe(""); + expect(r.stdout).toBe("count=2\nBrazil — BR\nArgentina — AR\n"); + }); + + it("should chain multiple discovered tools", async () => { + const r = await bash.exec(`js-exec -c ' + var countries = await tools.countries.list({}); + console.log("total=" + countries.length); + for (var i = 0; i < countries.length; i++) { + var detail = await tools.countries.country({ code: countries[i].code }); + console.log(countries[i].code + ": capital=" + detail.capital); + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stderr).toBe(""); + expect(r.stdout).toBe( + [ + "total=4", + "JP: capital=Tokyo", + "US: capital=Washington D.C.", + "BR: capital=Brasília", + "AR: capital=Buenos Aires", + "", + ].join("\n"), + ); + }); + + it("should write discovered data to virtual filesystem", async () => { + let r = await bash.exec(`js-exec -c ' + var fs = require("fs"); + var countries = await tools.countries.list({}); + var lines = ["name,code"]; + for (var i = 0; i < countries.length; i++) { + lines.push(countries[i].name + "," + countries[i].code); + } + fs.writeFileSync("/tmp/countries.csv", lines.join("\\n")); + console.log("wrote " + countries.length); + '`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe("wrote 4\n"); + + r = await bash.exec("cat /tmp/countries.csv"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe( + "name,code\nJapan,JP\nUnited States,US\nBrazil,BR\nArgentina,AR", + ); + }); +}); + +// ── Tool approval tests ───────────────────────────────────────── + +describe("executor.setup: tool approval", () => { + it("should allow tools when onToolApproval is allow-all", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "custom", + name: "math", + tools: { + add: { + execute: (a: { x: number; y: number }) => ({ sum: a.x + a.y }), + }, + }, + }); + }, + onToolApproval: "allow-all", + }); + const r = await bash.exec(`js-exec -c ' + var r = await tools.math.add({ x: 3, y: 4 }); + console.log(r.sum); + '`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe("7\n"); + }); + + it("should deny all tools when onToolApproval is deny-all", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "custom", + name: "math", + tools: { + add: { + execute: (a: { x: number; y: number }) => ({ sum: a.x + a.y }), + }, + }, + }); + }, + onToolApproval: "deny-all", + }); + const r = await bash.exec(`js-exec -c ' + try { + await tools.math.add({ x: 1, y: 2 }); + console.log("should not reach"); + } catch (e) { + console.error(e.message); + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe(""); + expect(r.stderr).toContain("Tool invocation denied: math.add"); + }); + + it("should call custom approval callback with tool metadata", async () => { + const approvalLog: string[] = []; + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "custom", + name: "api", + tools: { + read: { + description: "Read data", + execute: () => ({ data: "ok" }), + }, + write: { + description: "Write data", + execute: () => ({ written: true }), + }, + }, + }); + }, + onToolApproval: async (req) => { + approvalLog.push(`${req.toolPath}:${req.sourceId}`); + // Allow reads, deny writes + if (req.toolPath.endsWith(".read")) return { approved: true }; + return { approved: false, reason: "writes not allowed" }; + }, + }); + + // Read should succeed + const r1 = await bash.exec(`js-exec -c ' + var r = await tools.api.read({}); + console.log(r.data); + '`); + expect(r1.exitCode).toBe(0); + expect(r1.stdout).toBe("ok\n"); + + // Write should be denied + const r2 = await bash.exec(`js-exec -c ' + try { + await tools.api.write({}); + console.log("should not reach"); + } catch (e) { + console.error(e.message); + } + '`); + expect(r2.exitCode).toBe(0); + expect(r2.stdout).toBe(""); + expect(r2.stderr).toContain("writes not allowed"); + + // Verify approval callback received correct metadata + expect(approvalLog).toEqual(["api.read:api", "api.write:api"]); + }); + + it("should include denial reason in error message", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "custom", + name: "ops", + tools: { + deploy: { execute: () => ({}) }, + }, + }); + }, + onToolApproval: async () => ({ + approved: false, + reason: "requires admin role", + }), + }); + const r = await bash.exec(`js-exec -c ' + try { + await tools.ops.deploy({}); + } catch (e) { + console.error(e.message); + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stderr).toContain("Tool invocation denied: ops.deploy"); + expect(r.stderr).toContain("requires admin role"); + }); +}); + +// ── GraphQL plugin: offline introspection → tool discovery ────── + +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; + +const INTROSPECTION_JSON = readFileSync( + fileURLToPath( + new URL("./fixtures/countries-introspection.json", import.meta.url), + ), + "utf8", +); + +describe("executor.setup: GraphQL tool discovery", () => { + it("should discover tools from introspection JSON", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "graphql", + // endpoint is required by the schema but not called when introspectionJson is provided + endpoint: "https://countries.trevorblades.com/graphql", + name: "countries", + introspectionJson: INTROSPECTION_JSON, + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + // List tools via SDK handle — the tools proxy doesn't expose list(), + // so we check by attempting to call a discovered tool. + // The countries schema has query types: country, countries, continent, + // continents, language, languages. + // Tool invocation will fail (no real server) but tool *discovery* should succeed. + // We verify discovery by listing tools via js-exec reading /.executor/ config. + const r = await bash.exec(`js-exec -c ' + var fs = require("fs"); + // The GraphQL plugin registered tools — verify via the executor config + // by attempting to call a known tool and catching the network error + try { + await tools.countries.continents({}); + console.log("unexpected success"); + } catch (e) { + // Expected: invocation fails (no real server), but the tool WAS discovered + // The error should be about the HTTP call, not "Unknown tool" + var msg = e.message || ""; + if (msg.indexOf("Unknown tool") !== -1) { + console.log("FAIL: tool not discovered"); + } else { + console.log("OK: tool discovered, invocation failed as expected"); + } + } + '`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toContain("OK: tool discovered"); + }); + + it("should discover multiple query tools from schema", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "graphql", + endpoint: "https://countries.trevorblades.com/graphql", + name: "geo", + introspectionJson: INTROSPECTION_JSON, + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + // Test multiple tools are discovered under the namespace + const toolNames = [ + "country", + "countries", + "continent", + "continents", + "language", + "languages", + ]; + for (const name of toolNames) { + const r = await bash.exec(`js-exec -c ' + try { + await tools.geo.${name}({}); + } catch (e) { + var msg = e.message || ""; + if (msg.indexOf("Unknown tool") !== -1) { + console.log("NOT_FOUND"); + } else { + console.log("FOUND"); + } + } + '`); + expect(r.stdout.trim()).toBe("FOUND"); + } + }); +}); + +// ── OpenAPI plugin: static spec → tool discovery ──────────────── + +const PETSTORE_SPEC = JSON.stringify({ + openapi: "3.0.0", + info: { title: "Petstore", version: "1.0.0" }, + paths: { + "/pets": { + get: { + operationId: "listPets", + summary: "List all pets", + responses: { "200": { description: "A list of pets" } }, + }, + post: { + operationId: "createPet", + summary: "Create a pet", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + properties: { name: { type: "string" } }, + }, + }, + }, + }, + responses: { "201": { description: "Created" } }, + }, + }, + "/pets/{petId}": { + get: { + operationId: "getPet", + summary: "Get a pet by ID", + parameters: [ + { + name: "petId", + in: "path", + required: true, + schema: { type: "string" }, + }, + ], + responses: { "200": { description: "A pet" } }, + }, + }, + }, +}); + +describe("executor.setup: OpenAPI tool discovery", () => { + it("should discover tools from OpenAPI spec", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "openapi", + spec: PETSTORE_SPEC, + endpoint: "https://petstore.example.com", + name: "pets", + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + // Verify that listPets, createPet, and getPet are discovered + const r = await bash.exec(`js-exec -c ' + var found = []; + var ops = ["listPets", "createPet", "getPet"]; + for (var i = 0; i < ops.length; i++) { + try { + await tools.pets[ops[i]]({}); + } catch (e) { + var msg = e.message || ""; + if (msg.indexOf("Unknown tool") === -1) { + found.push(ops[i]); + } + } + } + console.log("discovered: " + found.join(", ")); + '`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toContain("listPets"); + expect(r.stdout).toContain("createPet"); + expect(r.stdout).toContain("getPet"); + }); + + it("should discover tools with correct namespace", async () => { + const bash = await makeBash({ + setup: async (sdk: ExecutorSDKHandle) => { + await sdk.sources.add({ + kind: "openapi", + spec: PETSTORE_SPEC, + endpoint: "https://petstore.example.com", + name: "myapi", + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + // Tools should be under myapi namespace, not pets + const r = await bash.exec(`js-exec -c ' + try { + await tools.myapi.listPets({}); + } catch (e) { + var msg = e.message || ""; + if (msg.indexOf("Unknown tool") !== -1) { + console.log("NOT_FOUND"); + } else { + console.log("FOUND"); + } + } + '`); + expect(r.stdout.trim()).toBe("FOUND"); + }); +}); diff --git a/packages/just-bash-executor/src/executor-init.ts b/packages/just-bash-executor/src/executor-init.ts new file mode 100644 index 00000000..de0fe4d4 --- /dev/null +++ b/packages/just-bash-executor/src/executor-init.ts @@ -0,0 +1,603 @@ +/** + * Lazy initialization of `@executor-js/sdk`. + * + * Kept in its own module so consumers who only use inline tools never load + * the SDK or optional discovery plugins. + */ + +import { readFile, realpath } from "node:fs/promises"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; +import type { + ExecutorConfig, + ExecutorElicitationHandler, + ExecutorElicitationResponse, + ExecutorSDKHandle, +} from "./types.js"; + +const DEFAULT_SCOPE_ID = "default-scope"; + +type SDKExecutor = { + tools: ExecutorSDKHandle["tools"]; + sources: { + list: ExecutorSDKHandle["sources"]["list"]; + }; + close: ExecutorSDKHandle["close"]; +} & Record; + +type SDKPlugin = unknown; +type ModuleNamespace = Record; + +type SDKEffect = { + promise: (evaluate: () => Promise) => unknown; +}; + +type SDKElicitationHandler = "accept-all" | ((ctx: unknown) => unknown); + +const DECLINE_ALL_ELICITATIONS: ExecutorElicitationHandler = async () => ({ + action: "decline", +}); +const EXECUTOR_API_PACKAGE = "@executor-js/api"; +const transformedModuleCache = new Map>(); +const executorApiShimUrlCache = new Map>(); + +// @executor-js 0.1.0 plugin core bundles import @executor-js/api for HTTP +// route helpers, but that package is not published. just-bash only needs the +// SDK plugin objects, so the fallback below loads those chunks with a tiny +// in-memory shim for the unused route helpers. +function toSDKElicitationHandler( + Effect: SDKEffect, + handler: ExecutorElicitationHandler | "accept-all" | undefined, +): SDKElicitationHandler { + if (handler === "accept-all") return "accept-all"; + const publicHandler = handler ?? DECLINE_ALL_ELICITATIONS; + return (ctx: unknown) => + Effect.promise(async () => { + const response = await publicHandler( + ctx as Parameters[0], + ); + return response satisfies ExecutorElicitationResponse; + }); +} + +function getExtension(executor: SDKExecutor, key: string): T { + const extension = executor[key]; + if (!extension) { + throw new Error(`Executor plugin not loaded: ${key}`); + } + return extension as T; +} + +function pluginLoadError(kind: string, error: unknown): Error { + const message = error instanceof Error ? error.message : String(error); + return new Error(`Failed to load @executor-js ${kind} plugin: ${message}`); +} + +function isMissingExecutorApiError(error: unknown): boolean { + const message = error instanceof Error ? error.message : String(error); + return message.includes(EXECUTOR_API_PACKAGE); +} + +async function importOfficialPluginExport( + specifier: string, + exportName: string, +): Promise { + try { + const mod = (await import(specifier)) as ModuleNamespace; + return mod[exportName] as T; + } catch (error) { + if (!isMissingExecutorApiError(error)) throw error; + const mod = await importOfficialPluginChunkWithoutApi(specifier); + return mod[exportName] as T; + } +} + +async function importOfficialPluginChunkWithoutApi( + specifier: string, +): Promise { + const fromFile = fileURLToPath(import.meta.url); + const corePath = await resolveExistingPath( + await resolveModuleSpecifier(specifier, fromFile), + ); + const coreSource = await readFile(corePath, "utf8"); + const chunkMatch = coreSource.match(/from\s+["'](\.\/[^"']+\.js)["']/); + if (!chunkMatch) { + throw new Error(`Could not locate ${specifier} SDK bundle`); + } + const chunkPath = resolve(dirname(corePath), chunkMatch[1]); + return importTransformedModule(chunkPath); +} + +async function importTransformedModule( + modulePath: string, +): Promise { + let pending = transformedModuleCache.get(modulePath); + if (!pending) { + pending = (async () => { + const source = await readFile(modulePath, "utf8"); + const transformed = await rewriteModuleSpecifiers(source, modulePath); + const url = `data:text/javascript;base64,${Buffer.from(transformed).toString("base64")}`; + return (await import(url)) as ModuleNamespace; + })(); + transformedModuleCache.set(modulePath, pending); + } + return pending; +} + +async function rewriteModuleSpecifiers( + source: string, + fromFile: string, +): Promise { + const specifiers = new Set(); + collectModuleSpecifiers(source, specifiers); + + const resolved = new Map(); + for (const specifier of specifiers) { + if (specifier === EXECUTOR_API_PACKAGE) { + resolved.set(specifier, await getExecutorApiShimUrl(fromFile)); + continue; + } + resolved.set( + specifier, + pathToFileURL(await resolveModuleSpecifier(specifier, fromFile)).href, + ); + } + + return source + .replace(/\bfrom\s*(["'])([^"']+)\1/g, (_match, quote, specifier) => { + return `from ${quote}${resolved.get(specifier) ?? specifier}${quote}`; + }) + .replace(/\bimport\s*(["'])([^"']+)\1/g, (_match, quote, specifier) => { + return `import ${quote}${resolved.get(specifier) ?? specifier}${quote}`; + }) + .replace( + /\bimport\s*\(\s*(["'])([^"']+)\1\s*\)/g, + (_match, quote, specifier) => { + return `import(${quote}${resolved.get(specifier) ?? specifier}${quote})`; + }, + ); +} + +function collectModuleSpecifiers( + source: string, + specifiers: Set, +): void { + for (const regex of [ + /\bfrom\s*["']([^"']+)["']/g, + /\bimport\s*["']([^"']+)["']/g, + /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g, + ]) { + for (const match of source.matchAll(regex)) { + specifiers.add(match[1]); + } + } +} + +async function getExecutorApiShimUrl(fromFile: string): Promise { + let pending = executorApiShimUrlCache.get(fromFile); + if (!pending) { + pending = (async () => { + const effectUrl = pathToFileURL( + await resolveModuleSpecifier("effect", fromFile), + ).href; + const httpApiUrl = pathToFileURL( + await resolveModuleSpecifier("effect/unstable/httpapi", fromFile), + ).href; + const source = ` + import { Schema } from ${JSON.stringify(effectUrl)}; + import { HttpApi } from ${JSON.stringify(httpApiUrl)}; + + export class InternalError extends Schema.TaggedErrorClass()( + "InternalError", + { message: Schema.String }, + { httpApiStatus: 500 }, + ) {} + + export function addGroup(group) { + return HttpApi.make("executor").add(group); + } + + export function capture(effect) { + return effect; + } + `; + return `data:text/javascript;base64,${Buffer.from(source).toString("base64")}`; + })(); + executorApiShimUrlCache.set(fromFile, pending); + } + return pending; +} + +async function resolveModuleSpecifier( + specifier: string, + fromFile: string, +): Promise { + if (specifier.startsWith("file:")) return fileURLToPath(specifier); + if (specifier.startsWith("node:") || specifier.startsWith("data:")) { + throw new Error(`Cannot rewrite non-file module specifier: ${specifier}`); + } + if (specifier.startsWith(".") || specifier.startsWith("/")) { + const resolvedPath = specifier.startsWith("/") + ? specifier + : resolve(dirname(fromFile), specifier); + return resolveExistingPath(resolvedPath); + } + + const { packageName, subpath } = splitPackageSpecifier(specifier); + const packageRoot = await findPackageRoot(packageName, fromFile); + const packageJsonPath = join(packageRoot, "package.json"); + const packageJson = JSON.parse( + await readFile(packageJsonPath, "utf8"), + ) as PackageJson; + const target = resolvePackageExport(packageJson, subpath); + if (!target) { + throw new Error(`Could not resolve ${specifier} from ${fromFile}`); + } + return resolveExistingPath(resolve(packageRoot, target)); +} + +type PackageJson = { + exports?: unknown; + module?: string; + main?: string; +}; + +function splitPackageSpecifier(specifier: string): { + packageName: string; + subpath: string; +} { + const parts = specifier.split("/"); + if (specifier.startsWith("@")) { + return { + packageName: parts.slice(0, 2).join("/"), + subpath: parts.slice(2).join("/"), + }; + } + return { + packageName: parts[0], + subpath: parts.slice(1).join("/"), + }; +} + +async function findPackageRoot( + packageName: string, + fromFile: string, +): Promise { + let current = dirname(fromFile); + while (true) { + const candidate = join(current, "node_modules", packageName); + if (await pathExists(join(candidate, "package.json"))) { + return candidate; + } + const parent = dirname(current); + if (parent === current) break; + current = parent; + } + throw new Error(`Cannot find package ${packageName} from ${fromFile}`); +} + +async function pathExists(path: string): Promise { + try { + await readFile(path); + return true; + } catch { + return false; + } +} + +async function resolveExistingPath(path: string): Promise { + try { + return await realpath(path); + } catch { + return path; + } +} + +function resolvePackageExport( + packageJson: PackageJson, + subpath: string, +): string | undefined { + const exportKey = subpath ? `./${subpath}` : "."; + if (packageJson.exports !== undefined) { + const entry = selectExportEntry(packageJson.exports, exportKey); + const target = selectExportTarget(entry); + if (target) return target; + return undefined; + } + if (subpath) return subpath; + return packageJson.module ?? packageJson.main ?? "index.js"; +} + +function selectExportEntry(exportsField: unknown, exportKey: string): unknown { + if ( + typeof exportsField === "string" || + Array.isArray(exportsField) || + exportsField === null + ) { + return exportKey === "." ? exportsField : undefined; + } + if (typeof exportsField !== "object") return undefined; + + const map = exportsField as Record; + if (Object.hasOwn(map, exportKey)) return map[exportKey]; + for (const [key, value] of Object.entries(map)) { + if (!key.includes("*")) continue; + const [prefix, suffix] = key.split("*"); + if (exportKey.startsWith(prefix) && exportKey.endsWith(suffix)) { + const replacement = exportKey.slice( + prefix.length, + exportKey.length - suffix.length, + ); + return replaceExportTargetPattern(value, replacement); + } + } + return undefined; +} + +function replaceExportTargetPattern( + entry: unknown, + replacement: string, +): unknown { + if (typeof entry === "string") return entry.replaceAll("*", replacement); + if (Array.isArray(entry)) { + return entry.map((item) => replaceExportTargetPattern(item, replacement)); + } + if (entry && typeof entry === "object") { + return Object.fromEntries( + Object.entries(entry).map(([key, value]) => [ + key, + replaceExportTargetPattern(value, replacement), + ]), + ); + } + return entry; +} + +function selectExportTarget(entry: unknown): string | undefined { + if (typeof entry === "string") return entry; + if (Array.isArray(entry)) { + for (const item of entry) { + const target = selectExportTarget(item); + if (target) return target; + } + return undefined; + } + if (!entry || typeof entry !== "object") return undefined; + + const conditions = entry as Record; + for (const key of ["import", "node", "default"]) { + if (Object.hasOwn(conditions, key)) { + const target = selectExportTarget(conditions[key]); + if (target) return target; + } + } + return undefined; +} + +async function loadOfficialPlugins(kinds: Set): Promise { + const plugins: SDKPlugin[] = []; + + if (kinds.has("graphql")) { + try { + const graphqlPlugin = await importOfficialPluginExport<() => SDKPlugin>( + "@executor-js/plugin-graphql/core", + "graphqlPlugin", + ); + plugins.push(graphqlPlugin()); + } catch (error) { + throw pluginLoadError("GraphQL", error); + } + } + + if (kinds.has("openapi")) { + try { + const openApiPlugin = await importOfficialPluginExport<() => SDKPlugin>( + "@executor-js/plugin-openapi/core", + "openApiPlugin", + ); + plugins.push(openApiPlugin()); + } catch (error) { + throw pluginLoadError("OpenAPI", error); + } + } + + if (kinds.has("mcp")) { + try { + const mcpPlugin = await importOfficialPluginExport<() => SDKPlugin>( + "@executor-js/plugin-mcp/core", + "mcpPlugin", + ); + plugins.push(mcpPlugin()); + } catch (error) { + throw pluginLoadError("MCP", error); + } + } + + return plugins; +} + +export async function initExecutorSDK( + setup: ((sdk: ExecutorSDKHandle) => Promise) | undefined, + plugins: ExecutorConfig["plugins"] | undefined, + onElicitation: ExecutorConfig["onElicitation"] | undefined, +): Promise<{ + sdk: ExecutorSDKHandle; + rawExecutor: SDKExecutor; +}> { + const queuedSources: Record[] = []; + const setupRecorder: ExecutorSDKHandle = { + tools: { + list: async () => [], + invoke: async () => { + throw new Error( + "sdk.tools.invoke() is not available during executor setup", + ); + }, + }, + sources: { + add: async (input) => { + queuedSources.push(input); + }, + list: async () => [], + }, + close: async () => {}, + }; + + if (setup) { + await setup(setupRecorder); + } + + const sourceKinds = new Set( + queuedSources.map((source) => String(source.kind ?? "custom")), + ); + + const { createExecutor } = await import("@executor-js/sdk"); + const { Effect } = await import("@executor-js/sdk/core"); + const { discoveryPlugin } = await import("./executor-discovery-plugin.js"); + const officialPlugins = await loadOfficialPlugins(sourceKinds); + + const allPlugins = [ + discoveryPlugin(), + ...officialPlugins, + ...((plugins ?? []) as SDKPlugin[]), + ]; + + const createSDKExecutor = createExecutor as (config: { + plugins: SDKPlugin[]; + onElicitation: SDKElicitationHandler; + }) => Promise; + + const executor = (await createSDKExecutor({ + plugins: allPlugins, + onElicitation: toSDKElicitationHandler(Effect, onElicitation), + })) as SDKExecutor; + + const addSource = createAddSource(executor); + const sdk: ExecutorSDKHandle = { + tools: { + list: executor.tools.list, + invoke: executor.tools.invoke, + }, + sources: { + add: addSource, + list: executor.sources.list, + }, + close: executor.close, + }; + + for (const source of queuedSources) { + await addSource(source); + } + + return { sdk, rawExecutor: executor }; +} + +function createAddSource( + executor: SDKExecutor, +): (def: Record) => Promise { + const discoveryExt = getExtension<{ + sources: { add: (def: Record) => Promise }; + }>(executor, "justBashDiscovery"); + + return async (def: Record): Promise => { + const kind = String(def.kind ?? "custom"); + + if (kind === "graphql") { + const graphqlExt = getExtension<{ + addSource: (config: { + endpoint: string; + scope: string; + name?: string; + namespace?: string; + headers?: Record; + queryParams?: Record; + introspectionJson?: string; + }) => Promise<{ toolCount: number; namespace: string }>; + }>(executor, "graphql"); + + await graphqlExt.addSource({ + endpoint: def.endpoint as string, + scope: (def.scope as string | undefined) ?? DEFAULT_SCOPE_ID, + name: def.name as string | undefined, + namespace: def.name as string | undefined, + headers: def.headers as Record | undefined, + queryParams: def.queryParams as Record | undefined, + introspectionJson: def.introspectionJson as string | undefined, + }); + return; + } + + if (kind === "openapi") { + const openapiExt = getExtension<{ + addSpec: (config: { + spec: string; + scope: string; + name?: string; + baseUrl?: string; + namespace?: string; + headers?: Record; + queryParams?: Record; + }) => Promise<{ sourceId: string; toolCount: number }>; + }>(executor, "openapi"); + + await openapiExt.addSpec({ + spec: def.spec as string, + scope: (def.scope as string | undefined) ?? DEFAULT_SCOPE_ID, + baseUrl: (def.endpoint ?? def.baseUrl) as string | undefined, + name: def.name as string | undefined, + namespace: def.name as string | undefined, + headers: def.headers as Record | undefined, + queryParams: def.queryParams as Record | undefined, + }); + return; + } + + if (kind === "mcp") { + const mcpExt = getExtension<{ + addSource: (config: { + transport: string; + scope: string; + name: string; + endpoint?: string; + command?: string; + args?: string[]; + env?: Record; + cwd?: string; + namespace?: string; + headers?: Record; + remoteTransport?: string; + queryParams?: Record; + }) => Promise<{ toolCount: number; namespace: string }>; + }>(executor, "mcp"); + + const transport = (def.transport as string | undefined) ?? "remote"; + if (transport === "stdio") { + await mcpExt.addSource({ + transport: "stdio", + scope: (def.scope as string | undefined) ?? DEFAULT_SCOPE_ID, + name: def.name as string, + command: def.command as string, + args: def.args as string[] | undefined, + env: def.env as Record | undefined, + cwd: def.cwd as string | undefined, + namespace: def.name as string | undefined, + }); + return; + } + + await mcpExt.addSource({ + transport: "remote", + scope: (def.scope as string | undefined) ?? DEFAULT_SCOPE_ID, + name: def.name as string, + endpoint: def.endpoint as string, + namespace: def.name as string | undefined, + headers: def.headers as Record | undefined, + remoteTransport: def.remoteTransport as string | undefined, + queryParams: def.queryParams as Record | undefined, + }); + return; + } + + await discoveryExt.sources.add(def); + }; +} diff --git a/packages/just-bash-executor/src/fixtures/countries-introspection.json b/packages/just-bash-executor/src/fixtures/countries-introspection.json new file mode 100644 index 00000000..03c8251e --- /dev/null +++ b/packages/just-bash-executor/src/fixtures/countries-introspection.json @@ -0,0 +1,1848 @@ +{ + "data": { + "__schema": { + "description": null, + "queryType": { "name": "Query", "kind": "OBJECT" }, + "mutationType": null, + "subscriptionType": null, + "types": [ + { + "kind": "SCALAR", + "name": "Boolean", + "description": "The `Boolean` scalar type represents `true` or `false`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Continent", + "description": null, + "fields": [ + { + "name": "code", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "countries", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Country", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ContinentFilterInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "code", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Country", + "description": null, + "fields": [ + { + "name": "awsRegion", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "capital", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "code", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "continent", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Continent", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currencies", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currency", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "emoji", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "emojiU", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "languages", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [ + { + "name": "lang", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "native", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "phone", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "phones", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "states", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "State", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subdivisions", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Subdivision", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CountryFilterInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "code", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "continent", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currency", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Float", + "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ID", + "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Int", + "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Language", + "description": null, + "fields": [ + { + "name": "code", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "countries", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Country", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "native", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rtl", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "LanguageFilterInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "code", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Query", + "description": null, + "fields": [ + { + "name": "continent", + "description": null, + "args": [ + { + "name": "code", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { "kind": "OBJECT", "name": "Continent", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "continents", + "description": null, + "args": [ + { + "name": "filter", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "ContinentFilterInput", + "ofType": null + }, + "defaultValue": "{}", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Continent", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "countries", + "description": null, + "args": [ + { + "name": "filter", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "CountryFilterInput", + "ofType": null + }, + "defaultValue": "{}", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Country", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country", + "description": null, + "args": [ + { + "name": "code", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { "kind": "OBJECT", "name": "Country", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "language", + "description": null, + "args": [ + { + "name": "code", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { "kind": "OBJECT", "name": "Language", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "languages", + "description": null, + "args": [ + { + "name": "filter", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "LanguageFilterInput", + "ofType": null + }, + "defaultValue": "{}", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "State", + "description": null, + "fields": [ + { + "name": "code", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Country", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "StringQueryOperatorInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "eq", + "description": null, + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "in", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ne", + "description": null, + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nin", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "regex", + "description": null, + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Subdivision", + "description": null, + "fields": [ + { + "name": "code", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "emoji", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isRepeatable", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__DirectiveLocation", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "VARIABLE_DEFINITION", + "description": "Location adjacent to a variable definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Directive", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__TypeKind", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "specifiedByURL", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Field", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__EnumValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isOneOf", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + } + ], + "directives": [ + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "locations": [ + "ARGUMENT_DEFINITION", + "ENUM_VALUE", + "FIELD_DEFINITION", + "INPUT_FIELD_DEFINITION" + ], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": "\"No longer supported\"", + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "oneOf", + "description": "Indicates exactly one field must be supplied and this field must not be `null`.", + "locations": ["INPUT_OBJECT"], + "args": [], + "isRepeatable": false + }, + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "specifiedBy", + "description": "Exposes a URL that specifies the behavior of this scalar.", + "locations": ["SCALAR"], + "args": [ + { + "name": "url", + "description": "The URL that specifies the behavior of this scalar.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + } + ] + } + } +} diff --git a/packages/just-bash-executor/src/index.ts b/packages/just-bash-executor/src/index.ts new file mode 100644 index 00000000..3204295d --- /dev/null +++ b/packages/just-bash-executor/src/index.ts @@ -0,0 +1,12 @@ +export { createExecutor, type ExecutorHandle } from "./create-executor.js"; +export { parseToolArgs } from "./parse-tool-args.js"; +export type { + ExecutorApprovalRequest, + ExecutorApprovalResponse, + ExecutorConfig, + ExecutorElicitationContext, + ExecutorElicitationHandler, + ExecutorElicitationResponse, + ExecutorSDKHandle, + ExecutorToolDef, +} from "./types.js"; diff --git a/packages/just-bash-executor/src/node-esm-smoke.test.ts b/packages/just-bash-executor/src/node-esm-smoke.test.ts new file mode 100644 index 00000000..d71402cd --- /dev/null +++ b/packages/just-bash-executor/src/node-esm-smoke.test.ts @@ -0,0 +1,198 @@ +/** + * Node ESM consumer smoke tests. + * + * Vitest's module resolver is more forgiving than Node ESM — it deferred + * resolution of broken upstream imports (notably `@executor-js/api` in + * plugin@0.1.0) so unit tests passed while real consumers crashed at load. + * + * These tests spawn a real `node` subprocess to exercise the consumer + * resolution path. If a future upstream `@executor-js/plugin-*` release ships + * another packaging regression, these fail fast where the unit tests wouldn't. + * + * Each test runs a tiny inline script — no temp files, no network. + */ + +import { spawnSync } from "node:child_process"; +import * as path from "node:path"; +import { describe, expect, it } from "vitest"; + +/** + * Spawn `node` from the example consumer's directory — that's where the + * @executor-js/* packages are installed alongside @just-bash/executor and + * just-bash, so Node's package resolution sees the same view a real consumer + * would. + */ +const CWD = path.join( + import.meta.dirname, + "..", + "..", + "..", + "examples", + "executor-tools", +); + +interface RunResult { + status: number | null; + stdout: string; + stderr: string; +} + +function nodeRun(script: string, timeoutMs = 20_000): RunResult { + const r = spawnSync("node", ["--input-type=module", "-e", script], { + cwd: CWD, + encoding: "utf-8", + timeout: timeoutMs, + }); + return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" }; +} + +function failureContext(r: RunResult): string { + return `exit=${r.status}\nstdout:\n${r.stdout}\nstderr:\n${r.stderr}`; +} + +// ── 1. Each upstream plugin loads + instantiates in plain Node ESM ───────── + +const PLUGIN_FACTORIES: Array<[string, string]> = [ + ["@executor-js/plugin-graphql/core", "graphqlPlugin"], + ["@executor-js/plugin-openapi/core", "openApiPlugin"], + ["@executor-js/plugin-mcp/core", "mcpPlugin"], +]; + +describe("@executor-js plugins load in plain Node ESM", () => { + for (const [pkg, factoryName] of PLUGIN_FACTORIES) { + it(`${pkg} → ${factoryName}() succeeds`, () => { + const r = nodeRun(` + const mod = await import(${JSON.stringify(pkg)}); + if (typeof mod[${JSON.stringify(factoryName)}] !== "function") { + throw new Error("missing export ${factoryName}"); + } + const plugin = mod[${JSON.stringify(factoryName)}](); + if (!plugin || typeof plugin !== "object") { + throw new Error("factory returned non-object"); + } + console.log("OK"); + `); + expect(r.status, failureContext(r)).toBe(0); + expect(r.stdout.trim()).toBe("OK"); + }); + } +}); + +// ── 2. @just-bash/executor's plugin-loader path works for each kind ───────── +// +// This exercises `loadOfficialPlugins` (the function that hit the @0.1.0 +// `@executor-js/api` packaging bug). Uses `setup` so the official plugin +// gets loaded via dynamic import inside our wrapper. + +describe("@just-bash/executor SDK setup loads plugins via Node ESM", () => { + it("setup with kind: 'graphql' (introspectionJson) registers tools", () => { + // Use the same fixture the in-process test relies on — pass its absolute + // path into the spawned script so we don't have to inline ~2k lines of + // JSON into an `-e` string. + const fixturePath = path.join( + import.meta.dirname, + "fixtures", + "countries-introspection.json", + ); + + const r = nodeRun( + ` + const fs = await import("node:fs"); + const { createExecutor } = await import("@just-bash/executor"); + + const introspection = fs.readFileSync(${JSON.stringify(fixturePath)}, "utf-8"); + + const executor = await createExecutor({ + setup: async (sdk) => { + await sdk.sources.add({ + kind: "graphql", + endpoint: "https://example.invalid/graphql", + introspectionJson: introspection, + name: "demo", + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + const tools = await executor.sdk.tools.list(); + const ids = tools.map((t) => t.id).filter((id) => id.startsWith("demo.")); + if (ids.length === 0) throw new Error("no demo.* tools registered"); + console.log("OK count=" + ids.length); + `, + 30_000, + ); + expect(r.status, failureContext(r)).toBe(0); + expect(r.stdout).toContain("OK count="); + }); + + it("setup with kind: 'openapi' (inline spec) registers tools", () => { + const r = nodeRun( + ` + const { createExecutor } = await import("@just-bash/executor"); + + const spec = JSON.stringify({ + openapi: "3.0.0", + info: { title: "T", version: "1" }, + paths: { + "/x": { get: { operationId: "getX", responses: { 200: { description: "ok" } } } }, + }, + }); + + const executor = await createExecutor({ + setup: async (sdk) => { + await sdk.sources.add({ + kind: "openapi", + spec, + endpoint: "https://example.invalid", + name: "demo", + }); + }, + onToolApproval: "allow-all", + onElicitation: "accept-all", + }); + + const tools = await executor.sdk.tools.list(); + const ids = tools.map((t) => t.id).filter((id) => id.startsWith("demo.")); + if (ids.length === 0) throw new Error("no demo.* tools registered"); + console.log("OK count=" + ids.length); + `, + 30_000, + ); + expect(r.status, failureContext(r)).toBe(0); + expect(r.stdout).toContain("OK count="); + }); +}); + +// ── 3. Inline tools path doesn't need any plugin at all ───────────────────── + +describe("@just-bash/executor inline tools work in plain Node ESM", () => { + it("createExecutor with inline tools, no plugins, no SDK setup", () => { + const r = nodeRun(` + const { createExecutor } = await import("@just-bash/executor"); + const { Bash } = await import("just-bash"); + + const executor = await createExecutor({ + tools: { + "math.add": { + description: "add", + execute: ({ a, b }) => ({ sum: a + b }), + }, + }, + }); + + const bash = new Bash({ + customCommands: executor.commands, + javascript: { invokeTool: executor.invokeTool }, + }); + + const r = await bash.exec("math add a=2 b=3"); + if (r.stdout.trim() !== '{"sum":5}') { + throw new Error("unexpected stdout: " + r.stdout); + } + console.log("OK"); + `); + expect(r.status, failureContext(r)).toBe(0); + expect(r.stdout.trim()).toBe("OK"); + }); +}); diff --git a/packages/just-bash-executor/src/parse-tool-args.ts b/packages/just-bash-executor/src/parse-tool-args.ts new file mode 100644 index 00000000..62464bdd --- /dev/null +++ b/packages/just-bash-executor/src/parse-tool-args.ts @@ -0,0 +1,8 @@ +/** + * Parse JSON tool arguments. Empty/missing string yields undefined; + * malformed JSON throws so callers get a clear error. + */ +export function parseToolArgs(argsJson: string): unknown { + if (!argsJson) return undefined; + return JSON.parse(argsJson); +} diff --git a/packages/just-bash-executor/src/tool-command.test.ts b/packages/just-bash-executor/src/tool-command.test.ts new file mode 100644 index 00000000..0aa1d2ec --- /dev/null +++ b/packages/just-bash-executor/src/tool-command.test.ts @@ -0,0 +1,358 @@ +import { Bash } from "just-bash"; +import { describe, expect, it } from "vitest"; +import { createExecutor } from "./create-executor.js"; +import { camelToKebab, parseToolCliArgs } from "./tool-command.js"; +import type { ExecutorConfig } from "./types.js"; + +function javascriptWithInvokeTool( + invokeTool: (path: string, argsJson: string) => Promise, +): NonNullable< + NonNullable[0]>["javascript"] +> { + return { invokeTool } as unknown as NonNullable< + NonNullable[0]>["javascript"] + >; +} + +// ── camelToKebab ──────────────────────────────────────────────── + +describe("camelToKebab", () => { + it("converts camelCase to kebab-case", () => { + expect(camelToKebab("listPets")).toBe("list-pets"); + expect(camelToKebab("getPetById")).toBe("get-pet-by-id"); + expect(camelToKebab("createUser")).toBe("create-user"); + }); + + it("leaves single words unchanged", () => { + expect(camelToKebab("add")).toBe("add"); + expect(camelToKebab("list")).toBe("list"); + }); + + it("handles consecutive uppercase (acronyms)", () => { + expect(camelToKebab("parseXMLDocument")).toBe("parse-xml-document"); + expect(camelToKebab("getHTTPResponse")).toBe("get-http-response"); + }); + + it("handles already-lowercase", () => { + expect(camelToKebab("already-kebab")).toBe("already-kebab"); + }); +}); + +// ── parseToolCliArgs ──────────────────────────────────────────── + +describe("parseToolCliArgs", () => { + it("parses key=value pairs", () => { + const result = parseToolCliArgs(["a=1", "b=2"], ""); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("parses --key value flags", () => { + const result = parseToolCliArgs(["--a", "1", "--b", "2"], ""); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("parses --key=value flags", () => { + const result = parseToolCliArgs(["--a=1", "--b=2"], ""); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("parses --json flag", () => { + const result = parseToolCliArgs(["--json", '{"a":1,"b":2}'], ""); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("parses --json=value flag", () => { + const result = parseToolCliArgs(['--json={"a":1}'], ""); + expect(result).toEqual({ a: 1 }); + }); + + it("errors on malformed --json", () => { + expect(() => parseToolCliArgs(["--json", '{"a":'], "")).toThrow( + "Invalid --json value", + ); + }); + + it("errors when --json is not an object", () => { + expect(() => parseToolCliArgs(["--json", "[1,2,3]"], "")).toThrow( + "--json must be a JSON object", + ); + }); + + it("returns empty object for no args", () => { + const result = parseToolCliArgs([], ""); + expect(result).toEqual({}); + }); + + it("coerces values: numbers", () => { + const result = parseToolCliArgs(["a=42", "b=3.14", "c=-5"], ""); + expect(result).toEqual({ a: 42, b: 3.14, c: -5 }); + }); + + it("coerces values: booleans", () => { + const result = parseToolCliArgs(["a=true", "b=false"], ""); + expect(result).toEqual({ a: true, b: false }); + }); + + it("coerces values: null", () => { + const result = parseToolCliArgs(["a=null"], ""); + expect(result).toEqual({ a: null }); + }); + + it("coerces values: arrays", () => { + const result = parseToolCliArgs(["a=[1,2,3]"], ""); + expect(result).toEqual({ a: [1, 2, 3] }); + }); + + it("keeps strings as strings", () => { + const result = parseToolCliArgs(["name=hello", "path=/tmp/file"], ""); + expect(result).toEqual({ name: "hello", path: "/tmp/file" }); + }); + + it("handles empty value", () => { + const result = parseToolCliArgs(["a="], ""); + expect(result).toEqual({ a: "" }); + }); + + it("parses single JSON positional arg", () => { + const result = parseToolCliArgs(['{"a":1,"b":2}'], ""); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("errors on malformed positional JSON", () => { + expect(() => parseToolCliArgs(['{"a":'], "")).toThrow( + "Invalid positional JSON", + ); + }); + + it("parses piped stdin JSON as base", () => { + const result = parseToolCliArgs([], '{"a":1,"b":2}'); + expect(result).toEqual({ a: 1, b: 2 }); + }); + + it("explicit args override stdin", () => { + const result = parseToolCliArgs(["a=99"], '{"a":1,"b":2}'); + expect(result).toEqual({ a: 99, b: 2 }); + }); + + it("--json overrides stdin", () => { + const result = parseToolCliArgs(["--json", '{"a":99}'], '{"a":1,"b":2}'); + expect(result).toEqual({ a: 99, b: 2 }); + }); + + it("flags override --json", () => { + const result = parseToolCliArgs(["--json", '{"a":1,"b":2}', "a=99"], ""); + expect(result).toEqual({ a: 99, b: 2 }); + }); + + it("boolean flags (no value)", () => { + const result = parseToolCliArgs(["--verbose", "--debug"], ""); + expect(result).toEqual({ verbose: true, debug: true }); + }); + + it("returns help sentinel for --help", () => { + const result = parseToolCliArgs(["--help"], ""); + expect(typeof result).toBe("symbol"); + }); + + it("ignores non-JSON stdin", () => { + const result = parseToolCliArgs(["a=1"], "not json at all"); + expect(result).toEqual({ a: 1 }); + }); +}); + +// ── Integration: Bash with tool commands ──────────────────────── + +async function makeBashWith( + tools: ExecutorConfig["tools"], + opts: { exposeToolsAsCommands?: boolean } = {}, +): Promise { + const executor = await createExecutor({ + tools, + exposeToolsAsCommands: opts.exposeToolsAsCommands, + }); + return new Bash({ + customCommands: executor.commands, + javascript: javascriptWithInvokeTool(executor.invokeTool), + }); +} + +async function createBashWithInlineTools(): Promise { + return makeBashWith({ + "math.add": { + description: "Add two numbers", + execute: (args: { a: number; b: number }) => ({ + sum: args.a + args.b, + }), + }, + "math.multiply": { + description: "Multiply two numbers", + execute: (args: { a: number; b: number }) => ({ + product: args.a * args.b, + }), + }, + "util.echo": { + description: "Echo arguments back", + execute: (args: unknown) => args, + }, + }); +} + +describe("tool namespace commands", () => { + it("invokes tool via key=value args", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add a=1 b=2"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe('{"sum":3}\n'); + }); + + it("invokes tool via --key value flags", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add --a 1 --b 2"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe('{"sum":3}\n'); + }); + + it("invokes tool via --key=value flags", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add --a=1 --b=2"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe('{"sum":3}\n'); + }); + + it("invokes tool via --json flag", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec(`math add --json '{"a":10,"b":20}'`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe('{"sum":30}\n'); + }); + + it("fails closed on malformed explicit JSON", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec(`math add --json '{"a":'`); + expect(r.exitCode).toBe(1); + expect(r.stderr).toContain("Invalid --json value"); + }); + + it("invokes tool via piped stdin JSON", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec(`echo '{"a":5,"b":3}' | math add`); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe('{"sum":8}\n'); + }); + + it("pipes tool output to jq", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add a=1 b=2 | jq -r .sum"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe("3\n"); + }); + + it("shows namespace help with --help", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math --help"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toContain("Executor tools: math"); + expect(r.stdout).toContain("COMMANDS"); + expect(r.stdout).toContain("add"); + expect(r.stdout).toContain("multiply"); + expect(r.stdout).toContain("Add two numbers"); + }); + + it("shows namespace help with no args", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toContain("COMMANDS"); + }); + + it("shows subcommand help", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add --help"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toContain("Add two numbers"); + expect(r.stdout).toContain("USAGE"); + expect(r.stdout).toContain("EXAMPLES"); + expect(r.stdout).toContain("--json"); + expect(r.stdout).toContain("math add"); + }); + + it("errors on unknown subcommand", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math nonexistent"); + expect(r.exitCode).toBe(1); + expect(r.stderr).toContain('unknown command "nonexistent"'); + expect(r.stderr).toContain("--help"); + }); + + it("errors on tool execution failure", async () => { + const bash = await makeBashWith({ + "fail.now": { + execute: () => { + throw new Error("something broke"); + }, + }, + }); + const r = await bash.exec("fail now"); + expect(r.exitCode).toBe(1); + expect(r.stderr).toContain("something broke"); + }); + + it("registers multiple namespaces", async () => { + const bash = await createBashWithInlineTools(); + // math namespace + const r1 = await bash.exec("math add a=1 b=2"); + expect(r1.exitCode).toBe(0); + expect(r1.stdout).toBe('{"sum":3}\n'); + + // util namespace + const r2 = await bash.exec(`util echo --json '{"hello":"world"}'`); + expect(r2.exitCode).toBe(0); + expect(r2.stdout).toBe('{"hello":"world"}\n'); + + // second subcommand in same namespace + const r3 = await bash.exec("math multiply a=3 b=4"); + expect(r3.exitCode).toBe(0); + expect(r3.stdout).toBe('{"product":12}\n'); + }); + + it("does not register commands when exposeToolsAsCommands is false", async () => { + const bash = await makeBashWith( + { + "calc.add": { + execute: (args: { a: number; b: number }) => ({ + sum: args.a + args.b, + }), + }, + }, + { exposeToolsAsCommands: false }, + ); + const r = await bash.exec("calc add a=1 b=2"); + expect(r.exitCode).toBe(127); + expect(r.stderr).toContain("not found"); + }); + + it("handles camelCase subcommand aliases", async () => { + const bash = await makeBashWith({ + "api.listUsers": { + description: "List all users", + execute: () => [{ name: "Alice" }], + }, + }); + // kebab-case works + const r1 = await bash.exec("api list-users"); + expect(r1.exitCode).toBe(0); + expect(r1.stdout).toContain("Alice"); + + // original camelCase also works + const r2 = await bash.exec("api listUsers"); + expect(r2.exitCode).toBe(0); + expect(r2.stdout).toContain("Alice"); + }); + + it("chains tool output through jq in a pipeline", async () => { + const bash = await createBashWithInlineTools(); + const r = await bash.exec("math add a=10 b=20 | jq -r .sum"); + expect(r.exitCode).toBe(0); + expect(r.stdout).toBe("30\n"); + }); +}); diff --git a/packages/just-bash-executor/src/tool-command.ts b/packages/just-bash-executor/src/tool-command.ts new file mode 100644 index 00000000..3da8622c --- /dev/null +++ b/packages/just-bash-executor/src/tool-command.ts @@ -0,0 +1,384 @@ +/** + * Auto-generated CLI commands from executor tools. + * + * Converts executor tool definitions into bash namespace commands: + * math.add → `math add --a 1 --b 2` + * petstore.listPets → `petstore list-pets --status available` + * + * Input modes (highest precedence first): + * 1. Flags: --key value, --key=value, key=value + * 2. --json: --json '{"key":"value"}' + * 3. stdin: echo '{"key":"value"}' | namespace command + */ + +import { + type Command, + type CommandContext, + decodeBytesToUtf8, + type ExecResult, +} from "just-bash"; + +// ── Naming ────────────────────────────────────────────────────── + +/** + * Convert camelCase to kebab-case. + * `listPets` → `list-pets`, `getPetById` → `get-pet-by-id` + */ +export function camelToKebab(name: string): string { + return name + .replace(/([a-z0-9])([A-Z])/g, "$1-$2") + .replace(/([A-Z])([A-Z][a-z])/g, "$1-$2") + .toLowerCase(); +} + +// ── Arg Parsing ───────────────────────────────────────────────── + +/** Sentinel returned when --help is detected. */ +const HELP_SENTINEL: unique symbol = Symbol("help"); + +/** + * Coerce a string value to its natural JSON type. + * Try JSON.parse first (handles numbers, booleans, arrays, objects). + * Fall back to string. + */ +function coerceValue(raw: string): unknown { + if (raw === "") return ""; + try { + return JSON.parse(raw); + } catch { + return raw; + } +} + +function assertJsonObject( + value: unknown, + label: string, +): Record { + if (value && typeof value === "object" && !Array.isArray(value)) { + return value as Record; + } + throw new Error(`${label} must be a JSON object`); +} + +/** + * Parse CLI arguments into a JSON object for tool invocation. + * + * Precedence (highest wins): + * 1. Flags (--key value, --key=value, key=value) + * 2. --json '{...}' + * 3. Piped stdin JSON + * + * Returns HELP_SENTINEL if --help is detected. + */ +export function parseToolCliArgs( + args: string[], + stdin: string, +): Record | typeof HELP_SENTINEL { + // Base: piped stdin JSON + let result: Record = Object.create(null) as Record< + string, + unknown + >; + const trimmedStdin = stdin.trim(); + if (trimmedStdin) { + try { + const parsed = JSON.parse(trimmedStdin); + if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) { + Object.assign(result, parsed); + } + } catch { + // Not JSON stdin — ignore + } + } + + // Layer: --json flag (overrides stdin) + let jsonFlagValue: string | undefined; + const remainingArgs: string[] = []; + for (let i = 0; i < args.length; i++) { + if (args[i] === "--help") return HELP_SENTINEL; + if (args[i] === "--json" && i + 1 < args.length) { + jsonFlagValue = args[++i]; + } else if (args[i].startsWith("--json=")) { + jsonFlagValue = args[i].slice(7); + } else { + remainingArgs.push(args[i]); + } + } + + if (jsonFlagValue !== undefined) { + try { + const parsed = JSON.parse(jsonFlagValue); + result = Object.assign( + Object.create(null) as Record, + result, + assertJsonObject(parsed, "--json"), + ); + } catch (error) { + const detail = error instanceof Error ? error.message : String(error); + throw new Error(`Invalid --json value: ${detail}`); + } + } + + // Top layer: flags and key=value pairs (highest precedence) + for (let i = 0; i < remainingArgs.length; i++) { + const arg = remainingArgs[i]; + + // --key=value + if (arg.startsWith("--") && arg.includes("=")) { + const eqIdx = arg.indexOf("="); + const key = arg.slice(2, eqIdx); + if (key) result[key] = coerceValue(arg.slice(eqIdx + 1)); + continue; + } + + // --key value + if (arg.startsWith("--") && arg.length > 2) { + const key = arg.slice(2); + if ( + i + 1 < remainingArgs.length && + !remainingArgs[i + 1].startsWith("--") + ) { + result[key] = coerceValue(remainingArgs[++i]); + } else { + // Boolean flag: --verbose → { verbose: true } + result[key] = true; + } + continue; + } + + // key=value + const eqIdx = arg.indexOf("="); + if (eqIdx > 0) { + const key = arg.slice(0, eqIdx); + result[key] = coerceValue(arg.slice(eqIdx + 1)); + continue; + } + + // Single positional arg that looks like JSON object + if (remainingArgs.length === 1 && arg.startsWith("{")) { + try { + const parsed = JSON.parse(arg); + Object.assign(result, assertJsonObject(parsed, "positional JSON")); + } catch (error) { + const detail = error instanceof Error ? error.message : String(error); + throw new Error(`Invalid positional JSON: ${detail}`); + } + } + } + + return result; +} + +// ── Help Formatting ───────────────────────────────────────────── + +export interface ToolSubcommand { + /** Kebab-case subcommand name */ + name: string; + /** Original tool path (e.g. "math.add") */ + originalPath: string; + /** Tool description */ + description?: string; + /** Additional aliases (e.g. original camelCase name) */ + aliases?: string[]; +} + +function formatNamespaceHelp( + namespace: string, + subcommands: ToolSubcommand[], +): string { + const lines: string[] = []; + lines.push(`Executor tools: ${namespace}`); + lines.push(""); + lines.push("USAGE"); + lines.push(` ${namespace} [flags]`); + lines.push(""); + lines.push("COMMANDS"); + + // Align descriptions + const maxLen = Math.max(...subcommands.map((s) => s.name.length), 0); + for (const sub of subcommands) { + const pad = " ".repeat(Math.max(2, maxLen - sub.name.length + 4)); + const desc = sub.description ?? ""; + lines.push(` ${sub.name}${pad}${desc}`); + } + + lines.push(""); + lines.push("EXAMPLES"); + if (subcommands.length > 0) { + const first = subcommands[0]; + lines.push(` ${namespace} ${first.name} key=value`); + } + if (subcommands.length > 1) { + const second = subcommands[1]; + lines.push(` ${namespace} ${second.name} --key value`); + } + + lines.push(""); + lines.push("LEARN MORE"); + lines.push(` ${namespace} --help`); + lines.push(""); + return lines.join("\n"); +} + +function formatSubcommandHelp(namespace: string, sub: ToolSubcommand): string { + const full = `${namespace} ${sub.name}`; + const lines: string[] = []; + + if (sub.description) { + lines.push(sub.description); + lines.push(""); + } + + lines.push("USAGE"); + lines.push(` ${full} [key=value ...]`); + lines.push(` ${full} [--key value ...]`); + lines.push(` ${full} --json '{...}'`); + lines.push(` | ${full}`); + lines.push(""); + lines.push("FLAGS"); + lines.push(" --json string Pass all arguments as a JSON object"); + lines.push(" --help Show this help"); + lines.push(""); + lines.push("EXAMPLES"); + lines.push(` ${full} key=value`); + lines.push(` ${full} --key value`); + lines.push(` ${full} --json '{"key":"value"}'`); + lines.push(` echo '{"key":"value"}' | ${full}`); + lines.push(` ${full} key=value | jq -r .field`); + lines.push(""); + return lines.join("\n"); +} + +// ── Command Factory ───────────────────────────────────────────── + +/** + * Create a namespace command that dispatches to tool subcommands. + * + * @param namespace - Command name (e.g. "math", "countries") + * @param subcommands - Subcommand definitions + * @param invokeTool - Tool invoker: (toolPath, argsJson) → resultJson + */ +function createNamespaceCommand( + namespace: string, + subcommands: ToolSubcommand[], + invokeTool: (path: string, argsJson: string) => Promise, +): Command { + // Build lookup: subcommand name → tool info (including aliases) + const lookup: Map = new Map(); + for (const sub of subcommands) { + lookup.set(sub.name, sub); + if (sub.aliases) { + for (const alias of sub.aliases) { + if (!lookup.has(alias)) { + lookup.set(alias, sub); + } + } + } + } + + return { + name: namespace, + trusted: true, + async execute(args: string[], ctx: CommandContext): Promise { + // No args or --help → namespace help + if (args.length === 0 || (args.length === 1 && args[0] === "--help")) { + return { + stdout: formatNamespaceHelp(namespace, subcommands), + stderr: "", + exitCode: 0, + }; + } + + // First arg is the subcommand + const subName = args[0]; + const sub = lookup.get(subName); + + if (!sub) { + return { + stdout: "", + stderr: `${namespace}: unknown command "${subName}"\nRun '${namespace} --help' for usage.\n`, + exitCode: 1, + }; + } + + const subArgs = args.slice(1); + + try { + // ctx.stdin is a ByteString; decode for the JSON parser inside + // `parseToolCliArgs`, which expects real Unicode text. + const parsed = parseToolCliArgs(subArgs, decodeBytesToUtf8(ctx.stdin)); + if (parsed === HELP_SENTINEL) { + return { + stdout: formatSubcommandHelp(namespace, sub), + stderr: "", + exitCode: 0, + }; + } + + const argsJson = + Object.keys(parsed).length > 0 ? JSON.stringify(parsed) : ""; + const resultJson = await invokeTool(sub.originalPath, argsJson); + const stdout = resultJson ? `${resultJson}\n` : ""; + return { stdout, stderr: "", exitCode: 0 }; + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + throw new Error(`${sub.name}: ${message}`); + } + }, + }; +} + +// ── Grouping Helpers ──────────────────────────────────────────── + +export interface ToolEntry { + /** Full tool path (e.g. "math.add", "petstore.listPets") */ + path: string; + /** Tool description */ + description?: string; +} + +/** + * Group tool entries by namespace (first dot-segment) and build + * namespace commands. + */ +export function buildNamespaceCommands( + tools: ToolEntry[], + invokeTool: (path: string, argsJson: string) => Promise, +): Command[] { + // Group by namespace + const groups: Map = new Map(); + + for (const tool of tools) { + const dotIdx = tool.path.indexOf("."); + if (dotIdx === -1) continue; // Skip tools without a namespace + + const namespace = tool.path.slice(0, dotIdx); + const rawName = tool.path.slice(dotIdx + 1); + const kebabName = camelToKebab(rawName); + + const sub: ToolSubcommand = { + name: kebabName, + originalPath: tool.path, + description: tool.description, + }; + + // Add camelCase alias if different from kebab + if (kebabName !== rawName) { + sub.aliases = [rawName]; + } + + let group = groups.get(namespace); + if (!group) { + group = []; + groups.set(namespace, group); + } + group.push(sub); + } + + // Build one command per namespace + const commands: Command[] = []; + for (const [namespace, subs] of groups) { + commands.push(createNamespaceCommand(namespace, subs, invokeTool)); + } + return commands; +} diff --git a/packages/just-bash-executor/src/types.ts b/packages/just-bash-executor/src/types.ts new file mode 100644 index 00000000..7aedd4ce --- /dev/null +++ b/packages/just-bash-executor/src/types.ts @@ -0,0 +1,134 @@ +/** + * Public types for `@just-bash/executor`. + * + * Mirror `@executor-js/sdk` shapes without importing the SDK at type-resolution + * time, so consumers who only use inline tools don't pay for SDK imports. + */ + +/** Tool definition for inline registration. */ +export interface ExecutorToolDef { + description?: string; + // biome-ignore lint/suspicious/noExplicitAny: matches @executor/sdk SimpleTool signature + execute: (...args: any[]) => unknown; +} + +/** + * Elicitation context passed to the handler when a tool requests user input. + * Mirrors @executor-js/sdk's ElicitationContext without importing the SDK. + */ +export interface ExecutorElicitationContext { + readonly toolId: string; + readonly args: unknown; + readonly request: + | { + readonly _tag: "FormElicitation"; + readonly message: string; + readonly requestedSchema: Record; + } + | { + readonly _tag: "UrlElicitation"; + readonly message: string; + readonly url: string; + readonly elicitationId: string; + }; +} + +/** + * Response from an elicitation handler. + */ +export interface ExecutorElicitationResponse { + readonly action: "accept" | "decline" | "cancel"; + readonly content?: Record; +} + +/** + * Handler for tool elicitation requests (form input, OAuth URLs, etc.). + * Compatible with @executor-js/sdk's ElicitationHandler. + */ +export type ExecutorElicitationHandler = ( + ctx: ExecutorElicitationContext, +) => Promise; + +/** + * Executor SDK instance type (subset of `@executor-js/sdk`'s public API). + * Kept as an opaque type to avoid requiring the SDK at import time. + */ +export interface ExecutorSDKHandle { + tools: { + list: (filter?: { + sourceId?: string; + query?: string; + }) => Promise; + invoke: (toolId: string, args: unknown) => Promise; + }; + sources: { + add: (input: Record) => Promise; + list: () => Promise; + }; + close: () => Promise; +} + +/** Approval request payload passed to the onToolApproval callback. */ +export interface ExecutorApprovalRequest { + toolPath: string; + sourceId: string; + sourceName: string; + operationKind: "read" | "write" | "delete" | "execute" | "unknown"; + args: unknown; + reason: string; + approvalLabel: string | null; +} + +/** Approval response from a custom onToolApproval callback. */ +export type ExecutorApprovalResponse = + | { approved: true } + | { approved: false; reason?: string }; + +/** Configuration for createExecutor. */ +export interface ExecutorConfig { + /** Tool map: keys are dot-separated paths (e.g. "math.add"), values are tool definitions. */ + tools?: Record; + /** + * Async setup function that receives the SDK instance. + * Use this to add sources that auto-discover tools. + * + * Supported source kinds: + * - `"custom"` — direct tool registration (inline `{ execute }` functions) + * - `"graphql"` — auto-discovers tools via schema introspection (`@executor-js/plugin-graphql`) + * - `"openapi"` — auto-discovers tools from an OpenAPI spec (`@executor-js/plugin-openapi`) + * - `"mcp"` — connects to an MCP server and discovers tools (`@executor-js/plugin-mcp`) + */ + setup?: (sdk: ExecutorSDKHandle) => Promise; + /** + * Additional @executor-js/sdk plugins to load. + * Passed directly to createExecutor({ plugins: [...] }). + */ + // biome-ignore lint/suspicious/noExplicitAny: AnyPlugin type from @executor-js/sdk; avoid requiring SDK at import time + plugins?: any[]; + /** + * Tool approval callback for the SDK pipeline. + * Called when an SDK-registered tool invocation requires approval. + * Defaults to "allow-all" when not provided. + * + * Note: inline tools (registered via `tools`) bypass approval — the user + * controls `execute()` directly. + */ + onToolApproval?: + | "allow-all" + | "deny-all" + | ((request: ExecutorApprovalRequest) => Promise); + /** + * Elicitation handler for the SDK pipeline. + * Called when a tool requests user input (form data, OAuth approval, etc.). + * Defaults to declining all elicitation requests. + * + * Pass "accept-all" to auto-approve (not recommended for untrusted tools). + */ + onElicitation?: ExecutorElicitationHandler | "accept-all"; + /** + * When true (default), executor tools are returned as bash namespace + * commands in `executor.commands`. Set to false if you only want script-level + * `tools` proxy access via `invokeTool`. + */ + exposeToolsAsCommands?: boolean; +} diff --git a/packages/just-bash-executor/tsconfig.json b/packages/just-bash-executor/tsconfig.json new file mode 100644 index 00000000..172a3fb4 --- /dev/null +++ b/packages/just-bash-executor/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "declaration": true, + "isolatedDeclarations": true, + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/just-bash-executor/vitest.config.ts b/packages/just-bash-executor/vitest.config.ts new file mode 100644 index 00000000..61ccbb17 --- /dev/null +++ b/packages/just-bash-executor/vitest.config.ts @@ -0,0 +1,33 @@ +import { fileURLToPath } from "node:url"; +import { defineConfig } from "vitest/config"; + +// @executor-js/sdk targets Node >= 22 (its Effect runtime relies on features +// missing in Node 20). Skip the entire suite on older runtimes rather than +// trying to make each test individually opt out. +const nodeMajor = Number(process.versions.node.split(".")[0]); +const skipAllTests = nodeMajor < 22; + +export default defineConfig({ + resolve: { + alias: { + "just-bash": fileURLToPath( + new URL("../just-bash/src/index.ts", import.meta.url), + ), + }, + }, + test: { + globals: true, + exclude: [ + "**/node_modules/**", + "**/dist/**", + ...(skipAllTests ? ["**/*.test.ts"] : []), + ], + passWithNoTests: skipAllTests, + pool: "threads", + isolate: false, + poolMatchGlobs: [ + // SDK tests spawn js-exec workers via just-bash, which patch globals. + ["forks", "**/executor-examples.test.ts"], + ], + }, +}); diff --git a/packages/just-bash/CHANGELOG.md b/packages/just-bash/CHANGELOG.md index a89578c5..605ca6f9 100644 --- a/packages/just-bash/CHANGELOG.md +++ b/packages/just-bash/CHANGELOG.md @@ -1,5 +1,27 @@ # just-bash +## 3.0.1 + +### Patch Changes + +- [#238](https://github.com/vercel-labs/just-bash/pull/238) [`01a4721`](https://github.com/vercel-labs/just-bash/commit/01a4721324350adea4b035b311f0b60ccdbb65ff) Thanks [@cramforce](https://github.com/cramforce)! - Fix `Dynamic require of "tty" is not supported` crash when invoking commands that transitively load `debug` / `supports-color` (notably `file`) under ESM Node consumers and via the `just-bash` CLI binary. + + The esbuild dynamic-require shim emitted into the ESM Node bundles had no `require` to delegate to at chunk-init under ESM, so any runtime `require("tty")` / `require("os")` from `file-type` → `debug` chain threw. Build banners now provide `createRequire(import.meta.url)` for `build:lib`, `build:cli`, and `build:shell`. CJS and browser bundles are unchanged. + + Fixes [#211](https://github.com/vercel-labs/just-bash/issues/211). + +## 3.0.0 + +### Major Changes + +- [#233](https://github.com/vercel-labs/just-bash/pull/233) [`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79) Thanks [@cramforce](https://github.com/cramforce)! - Breaking change for stdin byte/utf8-handling. Will break some custom commands that handle stdin + +### Minor Changes + +- [#209](https://github.com/vercel-labs/just-bash/pull/209) [`b3bd85e`](https://github.com/vercel-labs/just-bash/commit/b3bd85ed816445e6d148290163a1900f49ebea82) Thanks [@cramforce](https://github.com/cramforce)! - Introducing plumbing for integrating executor and adding a peer package for the implememtation + +- [#233](https://github.com/vercel-labs/just-bash/pull/233) [`7cca738`](https://github.com/vercel-labs/just-bash/commit/7cca73831987e3331160f426b7a66d7217b8cf79) Thanks [@cramforce](https://github.com/cramforce)! - TS-enforced correct handling of utf8 on stdin. Impacts many commands + ## 2.14.5 ### Patch Changes diff --git a/packages/just-bash/README.md b/packages/just-bash/README.md index 08dbc503..7f5669cb 100644 --- a/packages/just-bash/README.md +++ b/packages/just-bash/README.md @@ -29,7 +29,7 @@ Each `exec()` call gets its own isolated shell state — environment variables, Extend just-bash with your own TypeScript commands using `defineCommand`: ```typescript -import { Bash, defineCommand } from "just-bash"; +import { Bash, decodeBytesToUtf8, defineCommand } from "just-bash"; const hello = defineCommand("hello", async (args, ctx) => { const name = args[0] || "world"; @@ -37,7 +37,12 @@ const hello = defineCommand("hello", async (args, ctx) => { }); const upper = defineCommand("upper", async (args, ctx) => { - return { stdout: ctx.stdin.toUpperCase(), stderr: "", exitCode: 0 }; + // ctx.stdin is a ByteString — decode to text before string ops. + return { + stdout: decodeBytesToUtf8(ctx.stdin).toUpperCase(), + stderr: "", + exitCode: 0, + }; }); const bash = new Bash({ customCommands: [hello, upper] }); @@ -354,6 +359,37 @@ await env.exec('js-exec -c "console.log(API_BASE)"'); **Note:** The `js-exec` command only exists when `javascript` is configured. It is not available in browser environments. Execution runs in a QuickJS WASM sandbox with a 64 MB memory limit and configurable timeout (default: 10s, 60s with network). +#### Tool Invocation Hook + +`js-exec` scripts can call host-defined tools through a global `tools` proxy +when `javascript.invokeTool` is provided: + +```typescript +const bash = new Bash({ + javascript: { + // path: "math.add" (dot-separated) + // argsJson: '{"a":1,"b":2}' (or "" for no args) + // return: JSON-stringified result, or "" for undefined + // throw: propagates as a sandbox exception + invokeTool: async (path, argsJson) => { + const args = argsJson ? JSON.parse(argsJson) : undefined; + if (path === "math.add") { + return JSON.stringify({ sum: args.a + args.b }); + } + throw new Error(`Unknown tool: ${path}`); + }, + }, +}); + +await bash.exec(`js-exec -c 'console.log((await tools.math.add({a:3,b:4})).sum)'`); +``` + +The hook is generic — wire any tool framework through it (raw maps, MCP, +Anthropic tool-use, etc.). For full GraphQL / OpenAPI / MCP discovery via +`@executor-js/sdk`, plus auto-generated bash namespace commands, use the +companion package +[**`@just-bash/executor`**](../just-bash-executor/README.md). + ### Python Support Python (CPython compiled to WASM) is opt-in due to additional security surface. Enable with `python: true`: diff --git a/packages/just-bash/dist/Bash.d.ts b/packages/just-bash/dist/Bash.d.ts index b0764b49..1f116bda 100644 --- a/packages/just-bash/dist/Bash.d.ts +++ b/packages/just-bash/dist/Bash.d.ts @@ -30,6 +30,24 @@ export interface BashLogger { export interface JavaScriptConfig { /** Bootstrap JavaScript code to run before user scripts */ bootstrap?: string; + /** + * Tool invocation hook. When provided, code running in `js-exec` gets a + * global `tools` proxy that routes calls through this callback synchronously + * (the worker blocks via `Atomics.wait` while the host resolves the call). + * + * - `path`: dot-separated tool path (e.g. `"math.add"`). The proxy builds + * it from JS property access — `tools.math.add(...)` becomes `"math.add"`. + * - `argsJson`: JSON-stringified args object, or empty string for no args. + * - return: JSON-stringified result, or empty string for `undefined`. + * - throw: propagates as a catchable exception inside the sandbox. + * + * Setting `invokeTool` implicitly enables `js-exec` (no separate + * `javascript: true` needed). Pair with `customCommands` if you want the + * same tools available as bash commands. The companion package + * `@just-bash/executor` produces a matching `invokeTool` + `commands` pair + * from inline tools and/or `@executor-js/sdk` discovery. + */ + invokeTool?: (path: string, argsJson: string) => Promise; } export interface BashOptions { files?: InitialFiles; @@ -189,6 +207,14 @@ export interface ExecOptions { * This will be available to commands via stdin (e.g., for `bash -c 'cat'`). */ stdin?: string; + /** + * Shape of {@link stdin} — see `CommandExecOptions.stdinKind`. + * Defaults to `"text"` (UTF-8 encoded into bytes for byte consumers + * inside the script). Pass `"bytes"` when you've prepared a latin1 + * byte buffer (e.g. `Buffer.from(buf).toString("latin1")`) and want + * it forwarded verbatim. + */ + stdinKind?: "text" | "bytes"; /** * Abort signal for cooperative cancellation. * When aborted, the interpreter stops executing at the next statement boundary. @@ -214,6 +240,7 @@ export declare class Bash { private defenseInDepthConfig?; private coverageWriter?; private jsBootstrapCode?; + private invokeToolFn?; private transformPlugins; private state; constructor(options?: BashOptions); diff --git a/packages/just-bash/dist/Bash.js b/packages/just-bash/dist/Bash.js index 224e8cec..17985ff2 100644 --- a/packages/just-bash/dist/Bash.js +++ b/packages/just-bash/dist/Bash.js @@ -11,6 +11,7 @@ import "./timers.js"; import { createJavaScriptCommands, createLazyCommands, createNetworkCommands, createPythonCommands, } from "./commands/registry.js"; import { createLazyCustomCommand, isLazyCommand, } from "./custom-commands.js"; +import { encodeUtf8ToBytes, latin1FromBytes } from "./encoding.js"; import { InMemoryFs } from "./fs/in-memory-fs/in-memory-fs.js"; import { initFilesystem } from "./fs/init.js"; import { sanitizeErrorMessage } from "./fs/sanitize-error.js"; @@ -36,6 +37,7 @@ export class Bash { defenseInDepthConfig; coverageWriter; jsBootstrapCode; + invokeToolFn; // biome-ignore lint/suspicious/noExplicitAny: type-erased plugin storage for untyped API transformPlugins = []; // Interpreter state (shared with interpreter instances) @@ -192,18 +194,21 @@ export class Bash { this.registerCommand(cmd); } } - // Register javascript commands only when explicitly enabled - if (options.javascript) { + const jsConfig = typeof options.javascript === "object" + ? options.javascript + : Object.create(null); + // Register javascript commands when JS is enabled or an invokeTool hook + // is provided (the hook is meaningless without js-exec). + if (options.javascript || jsConfig.invokeTool) { for (const cmd of createJavaScriptCommands()) { this.registerCommand(cmd); } - // Store bootstrap code in private field (threaded via context chain, not env) - const jsConfig = typeof options.javascript === "object" - ? options.javascript - : Object.create(null); if (jsConfig.bootstrap) { this.jsBootstrapCode = jsConfig.bootstrap; } + if (jsConfig.invokeTool) { + this.invokeToolFn = jsConfig.invokeTool; + } } // Register custom commands (after built-ins so they can override) if (options.customCommands) { @@ -341,8 +346,14 @@ export class Bash { options: { ...this.state.options }, // Share hashTable reference - it should persist across exec calls hashTable: this.state.hashTable, - // Pass stdin through to commands (for bash -c with piped input) - groupStdin: options?.stdin, + // Pass stdin through to commands (for bash -c with piped input). + // The pipeline contract is "stdin is a latin1-shaped byte buffer"; + // text-shaped user input (the default) needs UTF-8 encoding here + // so byte consumers (`wc -c`, `base64`) inside the script see real + // UTF-8 bytes. Callers that already prepared a byte buffer (e.g. + // `Buffer.from(buf).toString("latin1")`) opt into raw passthrough + // via `stdinKind: "bytes"`. + groupStdin: encodeStdinForPipeline(options?.stdin, options?.stdinKind), // Cooperative cancellation signal (used by timeout command) signal: options?.signal, // Extra arguments injected directly into first command's arg list @@ -393,6 +404,7 @@ export class Bash { coverage: this.coverageWriter, requireDefenseContext: defenseBox?.isEnabled() === true, jsBootstrapCode: this.jsBootstrapCode, + invokeTool: this.invokeToolFn, }; const interpreter = new Interpreter(interpreterOptions, execState); const result = await interpreter.executeScript(ast); @@ -638,3 +650,15 @@ function decodeBinaryToUtf8(s) { return s; } } +/** + * Convert user-supplied stdin into the latin1 byte buffer the pipeline + * expects. `"text"` (the default) is JS Unicode and gets UTF-8 encoded; + * `"bytes"` is already byte-shaped and passes through verbatim. + */ +function encodeStdinForPipeline(stdin, kind) { + if (stdin === undefined) + return undefined; + if (kind === "bytes") + return stdin; + return latin1FromBytes(encodeUtf8ToBytes(stdin)); +} diff --git a/packages/just-bash/dist/bin/chunks/alias-3GODYSFD.js b/packages/just-bash/dist/bin/chunks/alias-3GODYSFD.js deleted file mode 100644 index 059698ce..00000000 --- a/packages/just-bash/dist/bin/chunks/alias-3GODYSFD.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b,c,d}from"./chunk-3MBAUIBB.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as aliasCommand,c as flagsForFuzzing,b as unaliasCommand,d as unaliasFlagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/alias-YRVAW27Y.js b/packages/just-bash/dist/bin/chunks/alias-YRVAW27Y.js new file mode 100644 index 00000000..fcafdf5c --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/alias-YRVAW27Y.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b,c,d}from"./chunk-DJAX3ZRG.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as aliasCommand,c as flagsForFuzzing,b as unaliasCommand,d as unaliasFlagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/awk2-RLMNTGI7.js b/packages/just-bash/dist/bin/chunks/awk2-RLMNTGI7.js new file mode 100644 index 00000000..632b34d1 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/awk2-RLMNTGI7.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b}from"./chunk-NXVG64T3.js";import"./chunk-MROECM42.js";import"./chunk-LNNWMRCB.js";import"./chunk-HL4ZS7TX.js";import"./chunk-IEXQTXU5.js";import"./chunk-VZK4FHWJ.js";import"./chunk-47WZ2U6M.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as awkCommand2,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/awk2-RSUCURL4.js b/packages/just-bash/dist/bin/chunks/awk2-RSUCURL4.js deleted file mode 100644 index 7ce0da03..00000000 --- a/packages/just-bash/dist/bin/chunks/awk2-RSUCURL4.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b}from"./chunk-EWDHVLQL.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-JDNI5HBX.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as awkCommand2,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/base64-43M2R3GA.js b/packages/just-bash/dist/bin/chunks/base64-43M2R3GA.js deleted file mode 100644 index f5493e78..00000000 --- a/packages/just-bash/dist/bin/chunks/base64-43M2R3GA.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b}from"./chunk-GOJZHH3L.js";import"./chunk-JBABAK44.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as base64Command,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/base64-RZRLGMB3.js b/packages/just-bash/dist/bin/chunks/base64-RZRLGMB3.js new file mode 100644 index 00000000..ba8252ac --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/base64-RZRLGMB3.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b}from"./chunk-6WJQNLR2.js";import"./chunk-VZK4FHWJ.js";import"./chunk-NE4R2FVV.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as base64Command,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/basename-F3AQ4KAQ.js b/packages/just-bash/dist/bin/chunks/basename-F3AQ4KAQ.js new file mode 100644 index 00000000..4afb5548 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/basename-F3AQ4KAQ.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b}from"./chunk-YJ5OCPSK.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as basenameCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/basename-KBUKWB2E.js b/packages/just-bash/dist/bin/chunks/basename-KBUKWB2E.js deleted file mode 100644 index abd69699..00000000 --- a/packages/just-bash/dist/bin/chunks/basename-KBUKWB2E.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b}from"./chunk-PQNTKMH3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as basenameCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/bash-6ZHZ6BX7.js b/packages/just-bash/dist/bin/chunks/bash-6ZHZ6BX7.js deleted file mode 100644 index 77dc94f0..00000000 --- a/packages/just-bash/dist/bin/chunks/bash-6ZHZ6BX7.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b,c,d}from"./chunk-GO6FXSC4.js";import"./chunk-4PRVMER6.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as bashCommand,c as flagsForFuzzing,b as shCommand,d as shFlagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/bash-CLP24TE2.js b/packages/just-bash/dist/bin/chunks/bash-CLP24TE2.js new file mode 100644 index 00000000..e58a5cff --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/bash-CLP24TE2.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b,c,d}from"./chunk-7UU7KPEM.js";import"./chunk-MROECM42.js";import"./chunk-VZK4FHWJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as bashCommand,c as flagsForFuzzing,b as shCommand,d as shFlagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/cat-LQH5FSAR.js b/packages/just-bash/dist/bin/chunks/cat-LQH5FSAR.js new file mode 100644 index 00000000..24e79fbc --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/cat-LQH5FSAR.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b}from"./chunk-XJ37N3S5.js";import"./chunk-H7JTIXAO.js";import"./chunk-VZK4FHWJ.js";import"./chunk-7JZKVC3F.js";import"./chunk-NE4R2FVV.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as catCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/cat-XZIJZXKP.js b/packages/just-bash/dist/bin/chunks/cat-XZIJZXKP.js deleted file mode 100644 index a41055f2..00000000 --- a/packages/just-bash/dist/bin/chunks/cat-XZIJZXKP.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import"./chunk-JBABAK44.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as catCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/chmod-N5CQATDW.js b/packages/just-bash/dist/bin/chunks/chmod-N5CQATDW.js deleted file mode 100644 index 18340a5e..00000000 --- a/packages/just-bash/dist/bin/chunks/chmod-N5CQATDW.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a,b}from"./chunk-7ADG3DNO.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as chmodCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/chmod-S564JCJW.js b/packages/just-bash/dist/bin/chunks/chmod-S564JCJW.js new file mode 100644 index 00000000..1431840f --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chmod-S564JCJW.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a,b}from"./chunk-XHCCSVP6.js";import"./chunk-MUFNRCMY.js";import"./chunk-LNVSXNT7.js";export{a as chmodCommand,b as flagsForFuzzing}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-22HCD466.js b/packages/just-bash/dist/bin/chunks/chunk-22HCD466.js new file mode 100644 index 00000000..111458bb --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-22HCD466.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as s}from"./chunk-FKVQZWJQ.js";var a=s("sha256sum","sha256","compute SHA256 message digest"),m={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0};export{a,m as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-26NO42TF.js b/packages/just-bash/dist/bin/chunks/chunk-26NO42TF.js deleted file mode 100644 index 05920654..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-26NO42TF.js +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node -import{a as f,b as c,c as u}from"./chunk-GTNBSMZR.js";var m={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function p(n){return n>=32&&n<=126||n===9}function d(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function g(n,s){let o=[],r="",i=0,l=typeof n=="string"?new TextEncoder().encode(n):n;for(let e=0;e=s.minLength){let a=d(i,s.offsetFormat);o.push(`${a}${r}`)}r=""}}if(r.length>=s.minLength){let e=d(i,s.offsetFormat);o.push(`${e}${r}`)}return o}var b={name:"strings",execute:async(n,s)=>{if(c(n))return f(m);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;i0?`${t.join(` -`)} -`:""}else for(let e of r){let t;if(e==="-")t=s.stdin??"";else{let h=s.fs.resolvePath(s.cwd,e);if(t=await s.fs.readFile(h),t===null)return{exitCode:1,stdout:l,stderr:`strings: ${e}: No such file or directory -`}}let a=g(t,o);a.length>0&&(l+=`${a.join(` -`)} -`)}return{exitCode:0,stdout:l,stderr:""}}},N={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0};export{b as a,N as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-2AIXTPH2.js b/packages/just-bash/dist/bin/chunks/chunk-2AIXTPH2.js new file mode 100644 index 00000000..354f83d9 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-2AIXTPH2.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as m}from"./chunk-NE4R2FVV.js";import{a as $}from"./chunk-I4IRHQDW.js";import{a as y,b as h}from"./chunk-MUFNRCMY.js";var D={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},E={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},A={name:"cp",async execute(f,e){if(h(f))return y(D);let t=m("cp",f,E);if(!t.ok)return t.error;let u=t.result.flags.recursive||t.result.flags.recursiveUpper,w=t.result.flags.noClobber,C=t.result.flags.preserve,P=t.result.flags.verbose,c=t.result.positional;if(c.length<2)return{stdout:"",stderr:`cp: missing destination file operand +`,exitCode:1};let g=c.pop()??"",d=c,o=e.fs.resolvePath(e.cwd,g),b="",n="",l=0,p=!1;try{p=(await e.fs.stat(o)).isDirectory}catch{}if(d.length>1&&!p)return{stdout:"",stderr:`cp: target '${g}' is not a directory +`,exitCode:1};for(let r of d)try{let a=e.fs.resolvePath(e.cwd,r),s=await e.fs.stat(a),i=o;if(p){let v=r.split("/").pop()||r;i=o==="/"?`/${v}`:`${o}/${v}`}if(s.isDirectory&&!u){n+=`cp: -r not specified; omitting directory '${r}' +`,l=1;continue}if(w)try{await e.fs.stat(i);continue}catch{}await e.fs.cp(a,i,{recursive:u}),P&&(b+=`'${r}' -> '${i}' +`)}catch(a){let s=$(a);s.includes("ENOENT")||s.includes("no such file")?n+=`cp: cannot stat '${r}': No such file or directory +`:n+=`cp: cannot copy '${r}': ${s} +`,l=1}return{stdout:b,stderr:n,exitCode:l}}},F={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{A as a,F as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-2ETT4ELS.js b/packages/just-bash/dist/bin/chunks/chunk-2ETT4ELS.js new file mode 100644 index 00000000..0c5af4dc --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-2ETT4ELS.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +async function e(t,o){return{stdout:`user +`,stderr:"",exitCode:0}}var a={name:"whoami",execute:e},n={name:"whoami",flags:[]};export{a,n as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-2GG3NVC4.js b/packages/just-bash/dist/bin/chunks/chunk-2GG3NVC4.js new file mode 100644 index 00000000..2c431805 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-2GG3NVC4.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as p}from"./chunk-PBOVSFTJ.js";import{a as m,b as g,c as h}from"./chunk-MUFNRCMY.js";var y={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},v={name:"ln",async execute(n,s){if(g(n))return m(y);let r=!1,a=!1,f=!1,t=0;for(;t '${i}' +`),{stdout:c,stderr:"",exitCode:0}}},$={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{v as a,$ as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-2HVFB2TU.js b/packages/just-bash/dist/bin/chunks/chunk-2HVFB2TU.js deleted file mode 100644 index 2dc5c342..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-2HVFB2TU.js +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/env node -import{a as Qa}from"./chunk-4CFAYBLV.js";import{a as Pe,b as Li}from"./chunk-ARI4VLCN.js";import{d as R}from"./chunk-V7ZOPVQS.js";import{a as qi,b as Ci}from"./chunk-MO4RPBN2.js";import{a as Os}from"./chunk-YU6OGPZR.js";import{k as ks}from"./chunk-6KZRLMG3.js";import{a as Is}from"./chunk-RLNOQILG.js";import{a as ki,b as Ii,c as le}from"./chunk-GTNBSMZR.js";import{a as wt,c as b,e as Ts}from"./chunk-KGOUQS5A.js";var Xi=b((up,Gi)=>{var{hasOwnProperty:_s}=Object.prototype,xs=(s,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r -`:` -`,n=e.whitespace?" = ":"=",i=[],r=e.sort?Object.keys(s).sort():Object.keys(s),o=0;e.align&&(o=X(r.filter(c=>s[c]===null||Array.isArray(s[c])||typeof s[c]!="object").map(c=>Array.isArray(s[c])?`${c}[]`:c).concat([""]).reduce((c,u)=>X(c).length>=X(u).length?c:u)).length);let a="",l=e.bracketedArray?"[]":"";for(let c of r){let u=s[c];if(u&&Array.isArray(u))for(let f of u)a+=X(`${c}${l}`).padEnd(o," ")+n+X(f)+t;else u&&typeof u=="object"?i.push(c):a+=X(c).padEnd(o," ")+n+X(u)+t}e.section&&a.length&&(a="["+X(e.section)+"]"+(e.newline?t+t:t)+a);for(let c of i){let u=Ji(c,".").join("\\."),f=(e.section?e.section+".":"")+u,d=xs(s[c],{...e,section:f});a.length&&d.length&&(a+=t),a+=d}return a};function Ji(s,e){var t=0,n=0,i=0,r=[];do if(i=s.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&s[i-1]==="\\")continue;r.push(s.slice(n,i)),n=i+e.length}while(i!==-1);return r.push(s.slice(n)),r}var Yi=(s,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,r=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=s.split(/[\r\n]+/g),a={};for(let c of o){if(!c||c.match(/^\s*[;#]/)||c.match(/^\s*$/))continue;let u=c.match(r);if(!u)continue;if(u[1]!==void 0){if(i=Et(u[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let f=Et(u[2]),d;e.bracketedArray?d=f.length>2&&f.slice(-2)==="[]":(a[f]=(a?.[f]||0)+1,d=a[f]>1);let p=d&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=u[3]?Et(u[4]):!0,h=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;d&&(_s.call(n,p)?Array.isArray(n[p])||(n[p]=[n[p]]):n[p]=[]),Array.isArray(n[p])?n[p].push(h):n[p]=h}let l=[];for(let c of Object.keys(t)){if(!_s.call(t,c)||typeof t[c]!="object"||Array.isArray(t[c]))continue;let u=Ji(c,".");n=t;let f=u.pop(),d=f.replace(/\\\./g,".");for(let p of u)p!=="__proto__"&&((!_s.call(n,p)||typeof n[p]!="object")&&(n[p]=Object.create(null)),n=n[p]);n===t&&d===f||(n[d]=t[c],l.push(c))}for(let c of l)delete t[c];return t},Wi=s=>s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"),X=s=>typeof s!="string"||s.match(/[=\r\n]/)||s.match(/^\[/)||s.length>1&&Wi(s)||s!==s.trim()?JSON.stringify(s):s.split(";").join("\\;").split("#").join("\\#"),Et=s=>{if(s=(s||"").trim(),Wi(s)){s.charAt(0)==="'"&&(s=s.slice(1,-1));try{s=JSON.parse(s)}catch{}}else{let e=!1,t="";for(let n=0,i=s.length;n{"use strict";var Ks=Symbol.for("yaml.alias"),sr=Symbol.for("yaml.document"),It=Symbol.for("yaml.map"),nr=Symbol.for("yaml.pair"),Rs=Symbol.for("yaml.scalar"),qt=Symbol.for("yaml.seq"),D=Symbol.for("yaml.node.type"),ec=s=>!!s&&typeof s=="object"&&s[D]===Ks,tc=s=>!!s&&typeof s=="object"&&s[D]===sr,sc=s=>!!s&&typeof s=="object"&&s[D]===It,nc=s=>!!s&&typeof s=="object"&&s[D]===nr,ir=s=>!!s&&typeof s=="object"&&s[D]===Rs,ic=s=>!!s&&typeof s=="object"&&s[D]===qt;function rr(s){if(s&&typeof s=="object")switch(s[D]){case It:case qt:return!0}return!1}function rc(s){if(s&&typeof s=="object")switch(s[D]){case Ks:case It:case Rs:case qt:return!0}return!1}var oc=s=>(ir(s)||rr(s))&&!!s.anchor;$.ALIAS=Ks;$.DOC=sr;$.MAP=It;$.NODE_TYPE=D;$.PAIR=nr;$.SCALAR=Rs;$.SEQ=qt;$.hasAnchor=oc;$.isAlias=ec;$.isCollection=rr;$.isDocument=tc;$.isMap=sc;$.isNode=rc;$.isPair=nc;$.isScalar=ir;$.isSeq=ic});var Ke=b(Us=>{"use strict";var M=O(),B=Symbol("break visit"),or=Symbol("skip children"),W=Symbol("remove node");function Ct(s,e){let t=ar(e);M.isDocument(s)?Ne(null,s.contents,t,Object.freeze([s]))===W&&(s.contents=null):Ne(null,s,t,Object.freeze([]))}Ct.BREAK=B;Ct.SKIP=or;Ct.REMOVE=W;function Ne(s,e,t,n){let i=lr(s,e,t,n);if(M.isNode(i)||M.isPair(i))return cr(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r{"use strict";var fr=O(),ac=Ke(),lc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},cc=s=>s.replace(/[!,[\]{}]/g,e=>lc[e]),Re=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+cc(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&fr.isNode(e.contents)){let r={};ac.visit(e.contents,(o,a)=>{fr.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(` -`)}};Re.defaultYaml={explicit:!1,version:"1.2"};Re.defaultTags={"!!":"tag:yaml.org,2002:"};ur.Directives=Re});var Pt=b(Ue=>{"use strict";var dr=O(),fc=Ke();function uc(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function hr(s){let e=new Set;return fc.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function pr(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function dc(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=hr(s));let o=pr(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(dr.isScalar(o.node)||dr.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}Ue.anchorIsValid=uc;Ue.anchorNames=hr;Ue.createNodeAnchors=dc;Ue.findNewAnchor=pr});var Js=b(mr=>{"use strict";function Ye(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i{"use strict";var hc=O();function gr(s,e,t){if(Array.isArray(s))return s.map((n,i)=>gr(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!hc.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}yr.toJS=gr});var Mt=b(wr=>{"use strict";var pc=Js(),br=O(),mc=z(),Ws=class{constructor(e){Object.defineProperty(this,br.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!br.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=mc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?pc.applyReviver(r,{"":a},"",a):a}};wr.NodeBase=Ws});var Je=b(Sr=>{"use strict";var gc=Pt(),yc=Ke(),ve=O(),bc=Mt(),wc=z(),Gs=class extends bc.NodeBase{constructor(e){super(ve.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],yc.visit(e,{Node:(r,o)=>{(ve.isAlias(o)||ve.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(wc.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=$t(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(gc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function $t(s,e,t){if(ve.isAlias(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(ve.isCollection(e)){let n=0;for(let i of e.items){let r=$t(s,i,t);r>n&&(n=r)}return n}else if(ve.isPair(e)){let n=$t(s,e.key,t),i=$t(s,e.value,t);return Math.max(n,i)}return 1}Sr.Alias=Gs});var C=b(Xs=>{"use strict";var Sc=O(),Nc=Mt(),Ec=z(),vc=s=>!s||typeof s!="function"&&typeof s!="object",Z=class extends Nc.NodeBase{constructor(e){super(Sc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Ec.toJS(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED="BLOCK_FOLDED";Z.BLOCK_LITERAL="BLOCK_LITERAL";Z.PLAIN="PLAIN";Z.QUOTE_DOUBLE="QUOTE_DOUBLE";Z.QUOTE_SINGLE="QUOTE_SINGLE";Xs.Scalar=Z;Xs.isScalarValue=vc});var We=b(Er=>{"use strict";var Ac=Je(),ue=O(),Nr=C(),Tc="tag:yaml.org,2002:";function Oc(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function kc(s,e,t){if(ue.isDocument(s)&&(s=s.contents),ue.isNode(s))return s;if(ue.isPair(s)){let f=t.schema[ue.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new Ac.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=Tc+e.slice(2));let c=Oc(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new Nr.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?o[ue.MAP]:Symbol.iterator in Object(s)?o[ue.SEQ]:o[ue.MAP]}r&&(r(c),delete t.onTagObj);let u=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new Nr.Scalar(s);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}Er.createNode=kc});var xt=b(_t=>{"use strict";var Ic=We(),G=O(),qc=Mt();function Ds(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Ic.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var vr=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Qs=class extends qc.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>G.isNode(n)||G.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(vr(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(G.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ds(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(G.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&G.isScalar(r)?r.value:r:G.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!G.isPair(t))return!1;let n=t.value;return n==null||e&&G.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return G.isCollection(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(G.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ds(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};_t.Collection=Qs;_t.collectionFromPath=Ds;_t.isEmptyPath=vr});var Ge=b(Bt=>{"use strict";var Cc=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Hs(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Lc=(s,e,t)=>s.endsWith(` -`)?Hs(t,e):t.includes(` -`)?` -`+Hs(t,e):(s.endsWith(" ")?"":" ")+t;Bt.indentComment=Hs;Bt.lineComment=Lc;Bt.stringifyComment=Cc});var Tr=b(Xe=>{"use strict";var Pc="flow",zs="block",Ft="quoted";function Mc(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;ii-Math.max(2,r)?c.push(0):f=i-n);let d,p,g=!1,h=-1,m=-1,w=-1;t===zs&&(h=Ar(s,h,e.length),h!==-1&&(f=h+l));for(let N;N=s[h+=1];){if(t===Ft&&N==="\\"){switch(m=h,s[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(N===` -`)t===zs&&(h=Ar(s,h,e.length)),f=h+e.length+l,d=void 0;else{if(N===" "&&p&&p!==" "&&p!==` -`&&p!==" "){let E=s[h+1];E&&E!==" "&&E!==` -`&&E!==" "&&(d=h)}if(h>=f)if(d)c.push(d),f=d+l,d=void 0;else if(t===Ft){for(;p===" "||p===" ";)p=N,N=s[h+=1],g=!0;let E=h>w+1?h-2:m-1;if(u[E])return s;c.push(E),u[E]=!0,f=E+l,d=void 0}else g=!0}p=N}if(g&&a&&a(),c.length===0)return s;o&&o();let y=s.slice(0,c[0]);for(let N=0;N{"use strict";var Y=C(),ee=Tr(),Vt=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Kt=s=>/^(%|---|\.\.\.)/m.test(s);function $c(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;rn)return!0;if(o=r+1,i-o<=n)return!1}return!0}function De(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Kt(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length -`;let f,d;for(d=t.length;d>0;--d){let v=t[d-1];if(v!==` -`&&v!==" "&&v!==" ")break}let p=t.substring(d),g=p.indexOf(` -`);g===-1?f="-":t===p||g!==p.length-1?(f="+",r&&r()):f="",p&&(t=t.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(en,`$&${c}`));let h=!1,m,w=-1;for(m=0;m{A=!0});let S=ee.foldFlowLines(`${y}${v}${p}`,c,ee.FOLD_BLOCK,I);if(!A)return`>${E} -${c}${S}`}return t=t.replace(/\n+/g,`$&${c}`),`|${E} -${c}${y}${t}${p}`}function _c(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&r.includes(` -`)||u&&/[[\]{},]/.test(r))return Ae(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||u||!r.includes(` -`)?Ae(r,e):jt(s,e,t,n);if(!a&&!u&&i!==Y.Scalar.PLAIN&&r.includes(` -`))return jt(s,e,t,n);if(Kt(r)){if(l==="")return e.forceBlockIndent=!0,jt(s,e,t,n);if(a&&l===c)return Ae(r,e)}let f=r.replace(/\n+/g,`$& -${l}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(d)||p?.some(d))return Ae(r,e)}return a?f:ee.foldFlowLines(f,l,ee.FOLD_FLOW,Vt(e,!1))}function xc(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==Y.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Y.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case Y.Scalar.BLOCK_FOLDED:case Y.Scalar.BLOCK_LITERAL:return i||r?Ae(o.value,e):jt(o,e,t,n);case Y.Scalar.QUOTE_DOUBLE:return De(o.value,e);case Y.Scalar.QUOTE_SINGLE:return Zs(o.value,e);case Y.Scalar.PLAIN:return _c(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Or.stringifyString=xc});var He=b(tn=>{"use strict";var Bc=Pt(),te=O(),Fc=Ge(),jc=Qe();function Vc(s,e){let t=Object.assign({blockQuote:!0,commentString:Fc.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Kc(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(te.isScalar(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function Rc(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(te.isScalar(s)||te.isCollection(s))&&s.anchor;r&&Bc.anchorIsValid(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function Uc(s,e,t,n){if(te.isPair(s))return s.toString(e,t,n);if(te.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=te.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>i=l});i??(i=Kc(e.doc.schema.tags,r));let o=Rc(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,t,n):te.isScalar(r)?jc.stringifyString(r,e,t,n):r.toString(e,t,n);return o?te.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} -${e.indent}${a}`:a}tn.createStringifyContext=Vc;tn.stringify=Uc});var Cr=b(qr=>{"use strict";var Q=O(),kr=C(),Ir=He(),ze=Ge();function Yc({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,d=Q.isNode(s)&&s.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(Q.isCollection(s)||!Q.isNode(s)&&typeof s=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let p=!f&&(!s||d&&e==null&&!t.inFlow||Q.isCollection(s)||(Q.isScalar(s)?s.type===kr.Scalar.BLOCK_FOLDED||s.type===kr.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:a+l});let g=!1,h=!1,m=Ir.stringify(s,t,()=>g=!0,()=>h=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,d&&!g?m+=ze.lineComment(m,t.indent,c(d)):h&&i&&i(),m;g&&(d=null),p?(d&&(m+=ze.lineComment(m,t.indent,c(d))),m=`? ${m} -${a}:`):(m=`${m}:`,d&&(m+=ze.lineComment(m,t.indent,c(d))));let w,y,N;Q.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,N=e.comment):(w=!1,y=null,N=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!d&&Q.isScalar(e)&&(t.indentAtStart=m.length+1),h=!1,!u&&l.length>=2&&!t.inFlow&&!p&&Q.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let E=!1,v=Ir.stringify(e,t,()=>E=!0,()=>h=!0),A=" ";if(d||w||y){if(A=w?` -`:"",y){let I=c(y);A+=` -${ze.indentComment(I,t.indent)}`}v===""&&!t.inFlow?A===` -`&&N&&(A=` - -`):A+=` -${t.indent}`}else if(!p&&Q.isCollection(e)){let I=v[0],S=v.indexOf(` -`),L=S!==-1,H=t.inFlow??e.flow??e.items.length===0;if(L||!H){let ye=!1;if(L&&(I==="&"||I==="!")){let P=v.indexOf(" ");I==="&"&&P!==-1&&P{"use strict";var Lr=wt("process");function Jc(s,...e){s==="debug"&&console.log(...e)}function Wc(s,e){(s==="debug"||s==="warn")&&(typeof Lr.emitWarning=="function"?Lr.emitWarning(e):console.warn(e))}sn.debug=Jc;sn.warn=Wc});var Jt=b(Yt=>{"use strict";var Ze=O(),Pr=C(),Rt="<<",Ut={identify:s=>s===Rt||typeof s=="symbol"&&s.description===Rt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Pr.Scalar(Symbol(Rt)),{addToJSMap:Mr}),stringify:()=>Rt},Gc=(s,e)=>(Ut.identify(e)||Ze.isScalar(e)&&(!e.type||e.type===Pr.Scalar.PLAIN)&&Ut.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===Ut.tag&&t.default);function Mr(s,e,t){if(t=s&&Ze.isAlias(t)?t.resolve(s.doc):t,Ze.isSeq(t))for(let n of t.items)rn(s,e,n);else if(Array.isArray(t))for(let n of t)rn(s,e,n);else rn(s,e,t)}function rn(s,e,t){let n=s&&Ze.isAlias(t)?t.resolve(s.doc):t;if(!Ze.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Yt.addMergeToJSMap=Mr;Yt.isMergeKey=Gc;Yt.merge=Ut});var an=b(xr=>{"use strict";var Xc=nn(),$r=Jt(),Dc=He(),_r=O(),on=z();function Qc(s,e,{key:t,value:n}){if(_r.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if($r.isMergeKey(s,t))$r.addMergeToJSMap(s,e,n);else{let i=on.toJS(t,"",s);if(e instanceof Map)e.set(i,on.toJS(n,i,s));else if(e instanceof Set)e.add(i);else{let r=Hc(t,i,s),o=on.toJS(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Hc(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(_r.isNode(s)&&t?.doc){let n=Dc.createStringifyContext(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Xc.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}xr.addPairToJSMap=Qc});var se=b(ln=>{"use strict";var Br=We(),zc=Cr(),Zc=an(),Wt=O();function ef(s,e,t){let n=Br.createNode(s,void 0,t),i=Br.createNode(e,void 0,t);return new Gt(n,i)}var Gt=class s{constructor(e,t=null){Object.defineProperty(this,Wt.NODE_TYPE,{value:Wt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return Wt.isNode(t)&&(t=t.clone(e)),Wt.isNode(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return Zc.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?zc.stringifyPair(this,e,t,n):JSON.stringify(this)}};ln.Pair=Gt;ln.createPair=ef});var cn=b(jr=>{"use strict";var de=O(),Fr=He(),Xt=Ge();function tf(s,e,t){return(e.inFlow??s.flow?nf:sf)(s,e,t)}function sf({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,d=[];for(let g=0;gm=null,()=>f=!0);m&&(w+=Xt.lineComment(w,r,c(m))),f&&m&&(f=!1),d.push(n+w)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let g=1;gm=null);c||(c=f.length>u||w.includes(` -`)),g0&&(c||(c=f.reduce((y,N)=>y+N.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=Xt.lineComment(w,n,a(m))),f.push(w),u=f.length}let{start:d,end:p}=t;if(f.length===0)return d+p;if(!c){let g=f.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=d;for(let h of f)g+=h?` -${r}${i}${h}`:` -`;return`${g} -${i}${p}`}else return`${d}${o}${f.join(" ")}${o}${p}`}function Dt({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=Xt.indentComment(e(n),s);t.push(r.trimStart())}}jr.stringifyCollection=tf});var ie=b(un=>{"use strict";var rf=cn(),of=an(),af=xt(),ne=O(),Qt=se(),lf=C();function et(s,e){let t=ne.isScalar(e)?e.value:e;for(let n of s)if(ne.isPair(n)&&(n.key===e||n.key===t||ne.isScalar(n.key)&&n.key.value===t))return n}var fn=class extends af.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ne.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:r}=n,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(Qt.createPair(l,c,n))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;ne.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Qt.Pair(e,e?.value):n=new Qt.Pair(e.key,e.value);let i=et(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);ne.isScalar(i.value)&&lf.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=et(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=et(this.items,e)?.value;return(!t&&ne.isScalar(i)?i.value:i)??void 0}has(e){return!!et(this.items,e)}set(e,t){this.add(new Qt.Pair(e,t),!0)}toJSON(e,t,n){let i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)of.addPairToJSMap(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ne.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),rf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};un.YAMLMap=fn;un.findPair=et});var Te=b(Kr=>{"use strict";var cf=O(),Vr=ie(),ff={collection:"map",default:!0,nodeClass:Vr.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return cf.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Vr.YAMLMap.from(s,e,t)};Kr.map=ff});var re=b(Rr=>{"use strict";var uf=We(),df=cn(),hf=xt(),zt=O(),pf=C(),mf=z(),dn=class extends hf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(zt.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Ht(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=Ht(e);if(typeof n!="number")return;let i=this.items[n];return!t&&zt.isScalar(i)?i.value:i}has(e){let t=Ht(e);return typeof t=="number"&&t=0?e:null}Rr.YAMLSeq=dn});var Oe=b(Yr=>{"use strict";var gf=O(),Ur=re(),yf={collection:"seq",default:!0,nodeClass:Ur.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return gf.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Ur.YAMLSeq.from(s,e,t)};Yr.seq=yf});var tt=b(Jr=>{"use strict";var bf=Qe(),wf={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),bf.stringifyString(s,e,t,n)}};Jr.string=wf});var Zt=b(Xr=>{"use strict";var Wr=C(),Gr={identify:s=>s==null,createNode:()=>new Wr.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Wr.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&Gr.test.test(s)?s:e.options.nullStr};Xr.nullTag=Gr});var hn=b(Qr=>{"use strict";var Sf=C(),Dr={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new Sf.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Dr.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};Qr.boolTag=Dr});var ke=b(Hr=>{"use strict";function Nf({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}Hr.stringifyNumber=Nf});var mn=b(es=>{"use strict";var Ef=C(),pn=ke(),vf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:pn.stringifyNumber},Af={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():pn.stringifyNumber(s)}},Tf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new Ef.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:pn.stringifyNumber};es.float=Tf;es.floatExp=Af;es.floatNaN=vf});var yn=b(ss=>{"use strict";var zr=ke(),ts=s=>typeof s=="bigint"||Number.isInteger(s),gn=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Zr(s,e,t){let{value:n}=s;return ts(n)&&n>=0?t+n.toString(e):zr.stringifyNumber(s)}var Of={identify:s=>ts(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>gn(s,2,8,t),stringify:s=>Zr(s,8,"0o")},kf={identify:ts,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>gn(s,0,10,t),stringify:zr.stringifyNumber},If={identify:s=>ts(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>gn(s,2,16,t),stringify:s=>Zr(s,16,"0x")};ss.int=kf;ss.intHex=If;ss.intOct=Of});var to=b(eo=>{"use strict";var qf=Te(),Cf=Zt(),Lf=Oe(),Pf=tt(),Mf=hn(),bn=mn(),wn=yn(),$f=[qf.map,Lf.seq,Pf.string,Cf.nullTag,Mf.boolTag,wn.intOct,wn.int,wn.intHex,bn.floatNaN,bn.floatExp,bn.float];eo.schema=$f});var io=b(no=>{"use strict";var _f=C(),xf=Te(),Bf=Oe();function so(s){return typeof s=="bigint"||Number.isInteger(s)}var ns=({value:s})=>JSON.stringify(s),Ff=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:ns},{identify:s=>s==null,createNode:()=>new _f.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ns},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:ns},{identify:so,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>so(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:ns}],jf={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Vf=[xf.map,Bf.seq].concat(Ff,jf);no.schema=Vf});var Nn=b(ro=>{"use strict";var st=wt("buffer"),Sn=C(),Kf=Qe(),Rf={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof st.Buffer=="function")return st.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i{"use strict";var is=O(),En=se(),Uf=C(),Yf=re();function oo(s,e){if(is.isSeq(s))for(let t=0;t1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new En.Pair(new Uf.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} -${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value??i.key;r.comment=r.comment?`${n.comment} -${r.comment}`:n.comment}n=i}s.items[t]=is.isPair(n)?n:new En.Pair(n)}}else e("Expected a sequence for this tag");return s}function ao(s,e,t){let{replacer:n}=t,i=new Yf.YAMLSeq(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(En.createPair(a,l,t))}return i}var Jf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:oo,createNode:ao};rs.createPairs=ao;rs.pairs=Jf;rs.resolvePairs=oo});var Tn=b(An=>{"use strict";var lo=O(),vn=z(),nt=ie(),Wf=re(),co=os(),he=class s extends Wf.YAMLSeq{constructor(){super(),this.add=nt.YAMLMap.prototype.add.bind(this),this.delete=nt.YAMLMap.prototype.delete.bind(this),this.get=nt.YAMLMap.prototype.get.bind(this),this.has=nt.YAMLMap.prototype.has.bind(this),this.set=nt.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(lo.isPair(i)?(r=vn.toJS(i.key,"",t),o=vn.toJS(i.value,r,t)):r=vn.toJS(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){let i=co.createPairs(e,t,n),r=new this;return r.items=i.items,r}};he.tag="tag:yaml.org,2002:omap";var Gf={collection:"seq",identify:s=>s instanceof Map,nodeClass:he,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=co.resolvePairs(s,e),n=[];for(let{key:i}of t.items)lo.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new he,t)},createNode:(s,e,t)=>he.from(s,e,t)};An.YAMLOMap=he;An.omap=Gf});var mo=b(On=>{"use strict";var fo=C();function uo({value:s,source:e},t){return e&&(s?ho:po).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var ho={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new fo.Scalar(!0),stringify:uo},po={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new fo.Scalar(!1),stringify:uo};On.falseTag=po;On.trueTag=ho});var go=b(as=>{"use strict";var Xf=C(),kn=ke(),Df={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:kn.stringifyNumber},Qf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():kn.stringifyNumber(s)}},Hf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new Xf.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:kn.stringifyNumber};as.float=Hf;as.floatExp=Qf;as.floatNaN=Df});var bo=b(rt=>{"use strict";var yo=ke(),it=s=>typeof s=="bigint"||Number.isInteger(s);function ls(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function In(s,e,t){let{value:n}=s;if(it(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return yo.stringifyNumber(s)}var zf={identify:it,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>ls(s,2,2,t),stringify:s=>In(s,2,"0b")},Zf={identify:it,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>ls(s,1,8,t),stringify:s=>In(s,8,"0")},eu={identify:it,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>ls(s,0,10,t),stringify:yo.stringifyNumber},tu={identify:it,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>ls(s,2,16,t),stringify:s=>In(s,16,"0x")};rt.int=eu;rt.intBin=zf;rt.intHex=tu;rt.intOct=Zf});var Cn=b(qn=>{"use strict";var us=O(),cs=se(),fs=ie(),pe=class s extends fs.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;us.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new cs.Pair(e.key,null):t=new cs.Pair(e,null),fs.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=fs.findPair(this.items,e);return!t&&us.isPair(n)?us.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=fs.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new cs.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(cs.createPair(o,null,n));return r}};pe.tag="tag:yaml.org,2002:set";var su={collection:"map",identify:s=>s instanceof Set,nodeClass:pe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>pe.from(s,e,t),resolve(s,e){if(us.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new pe,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};qn.YAMLSet=pe;qn.set=su});var Pn=b(ds=>{"use strict";var nu=ke();function Ln(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function wo(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return nu.stringifyNumber(s);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var iu={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Ln(s,t),stringify:wo},ru={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Ln(s,!1),stringify:wo},So={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(So.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=Ln(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ds.floatTime=ru;ds.intTime=iu;ds.timestamp=So});var vo=b(Eo=>{"use strict";var ou=Te(),au=Zt(),lu=Oe(),cu=tt(),fu=Nn(),No=mo(),Mn=go(),hs=bo(),uu=Jt(),du=Tn(),hu=os(),pu=Cn(),$n=Pn(),mu=[ou.map,lu.seq,cu.string,au.nullTag,No.trueTag,No.falseTag,hs.intBin,hs.intOct,hs.int,hs.intHex,Mn.floatNaN,Mn.floatExp,Mn.float,fu.binary,uu.merge,du.omap,hu.pairs,pu.set,$n.intTime,$n.floatTime,$n.timestamp];Eo.schema=mu});var Mo=b(Bn=>{"use strict";var ko=Te(),gu=Zt(),Io=Oe(),yu=tt(),bu=hn(),_n=mn(),xn=yn(),wu=to(),Su=io(),qo=Nn(),ot=Jt(),Co=Tn(),Lo=os(),Ao=vo(),Po=Cn(),ps=Pn(),To=new Map([["core",wu.schema],["failsafe",[ko.map,Io.seq,yu.string]],["json",Su.schema],["yaml11",Ao.schema],["yaml-1.1",Ao.schema]]),Oo={binary:qo.binary,bool:bu.boolTag,float:_n.float,floatExp:_n.floatExp,floatNaN:_n.floatNaN,floatTime:ps.floatTime,int:xn.int,intHex:xn.intHex,intOct:xn.intOct,intTime:ps.intTime,map:ko.map,merge:ot.merge,null:gu.nullTag,omap:Co.omap,pairs:Lo.pairs,seq:Io.seq,set:Po.set,timestamp:ps.timestamp},Nu={"tag:yaml.org,2002:binary":qo.binary,"tag:yaml.org,2002:merge":ot.merge,"tag:yaml.org,2002:omap":Co.omap,"tag:yaml.org,2002:pairs":Lo.pairs,"tag:yaml.org,2002:set":Po.set,"tag:yaml.org,2002:timestamp":ps.timestamp};function Eu(s,e,t){let n=To.get(e);if(n&&!s)return t&&!n.includes(ot.merge)?n.concat(ot.merge):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(To.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(ot.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Oo[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Oo).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Bn.coreKnownTags=Nu;Bn.getTags=Eu});var Vn=b($o=>{"use strict";var Fn=O(),vu=Te(),Au=Oe(),Tu=tt(),ms=Mo(),Ou=(s,e)=>s.keye.key?1:0,jn=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ms.getTags(e,"compat"):e?ms.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?ms.coreKnownTags:{},this.tags=ms.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Fn.MAP,{value:vu.map}),Object.defineProperty(this,Fn.SCALAR,{value:Tu.string}),Object.defineProperty(this,Fn.SEQ,{value:Au.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ou:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};$o.Schema=jn});var xo=b(_o=>{"use strict";var ku=O(),Kn=He(),at=Ge();function Iu(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let i=Kn.createStringifyContext(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=r(s.commentBefore);t.unshift(at.indentComment(l,""))}let o=!1,a=null;if(s.contents){if(ku.isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let u=r(s.contents.commentBefore);t.push(at.indentComment(u,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>o=!0,c=Kn.stringify(s.contents,i,()=>a=null,l);a&&(c+=at.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(Kn.stringify(s.contents,i));if(s.directives?.docEnd)if(s.comment){let l=r(s.comment);l.includes(` -`)?(t.push("..."),t.push(at.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(at.indentComment(r(l),"")))}return t.join(` -`)+` -`}_o.stringifyDocument=Iu});var lt=b(Bo=>{"use strict";var qu=Je(),Ie=xt(),K=O(),Cu=se(),Lu=z(),Pu=Vn(),Mu=xo(),Rn=Pt(),$u=Js(),_u=We(),Un=Ys(),Yn=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K.NODE_TYPE,{value:K.DOC});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Un.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(s.prototype,{[K.NODE_TYPE]:{value:K.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=K.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){qe(this.contents)&&this.contents.add(e)}addIn(e,t){qe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Rn.anchorNames(this);e.anchor=!t||n.has(t)?Rn.findNewAnchor(t||"a",n):t}return new qu.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=t.filter(m).map(String);w.length>0&&(t=t.concat(w)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=Rn.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=_u.createNode(e,u,g);return a&&K.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new Cu.Pair(i,r)}delete(e){return qe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ie.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):qe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return K.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ie.isEmptyPath(e)?!t&&K.isScalar(this.contents)?this.contents.value:this.contents:K.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return K.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ie.isEmptyPath(e)?this.contents!==void 0:K.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ie.collectionFromPath(this.schema,[e],t):qe(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ie.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Ie.collectionFromPath(this.schema,Array.from(e),t):qe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Un.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Un.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Pu.Schema(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Lu.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?$u.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Mu.stringifyDocument(this,e)}};function qe(s){if(K.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Bo.Document=Yn});var ut=b(ft=>{"use strict";var ct=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},Jn=class extends ct{constructor(e,t,n){super("YAMLParseError",e,t,n)}},Wn=class extends ct{constructor(e,t,n){super("YAMLWarning",e,t,n)}},xu=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 -`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===n&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`: - -${o} -${c} -`}};ft.YAMLError=ct;ft.YAMLParseError=Jn;ft.YAMLWarning=Wn;ft.prettifyError=xu});var dt=b(Fo=>{"use strict";function Bu(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",p=!1,g=!1,h=null,m=null,w=null,y=null,N=null,E=null,v=null;for(let S of s)switch(g&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(c&&S.type!=="comment"&&S.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),S.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&S.source.includes(" ")&&(h=S),u=!0;break;case"comment":{u||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=S.source.substring(1)||" ";f?f+=d+L:f=L,d="",c=!1;break}case"newline":c?f?f+=S.source:(!E||t!=="seq-item-ind")&&(l=!0):d+=S.source,c=!0,p=!0,(m||w)&&(y=S),u=!0;break;case"anchor":m&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&r(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=S,v??(v=S.offset),c=!1,u=!1,g=!0;break;case"tag":{w&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,v??(v=S.offset),c=!1,u=!1,g=!0;break}case t:(m||w)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),E&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e??"collection"}`),E=S,c=t==="seq-item-ind"||t==="explicit-key-ind",u=!1;break;case"comma":if(e){N&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),N=S,c=!1,u=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),c=!1,u=!1}let A=s[s.length-1],I=A?A.offset+A.source.length:i;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:N,found:E,spaceBefore:l,comment:f,hasNewline:p,anchor:m,tag:w,newlineAfterProp:y,end:I,start:v??I}}Fo.resolveProps=Bu});var gs=b(jo=>{"use strict";function Gn(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(` -`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Gn(e.key)||Gn(e.value))return!0}return!1;default:return!0}}jo.containsNewline=Gn});var Xn=b(Vo=>{"use strict";var Fu=gs();function ju(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Fu.containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Vo.flowIndentCheck=ju});var Dn=b(Ro=>{"use strict";var Ko=O();function Vu(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||Ko.isScalar(r)&&Ko.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}Ro.mapIncludes=Vu});var Xo=b(Go=>{"use strict";var Uo=se(),Ku=ie(),Yo=dt(),Ru=gs(),Jo=Xn(),Uu=Dn(),Wo="All mapping items must start at the same column";function Yu({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??Ku.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(let u of n.items){let{start:f,key:d,sep:p,value:g}=u,h=Yo.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!h.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&i(l,"BAD_INDENT",Wo)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Ru.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(l,"BAD_INDENT",Wo);t.atKey=!0;let w=h.end,y=d?s(t,d,h,i):e(t,w,f,null,h,i);t.schema.compat&&Jo.flowIndentCheck(n.indent,d,i),t.atKey=!1,Uu.mapIncludes(t,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let N=Yo.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=N.end,N.found){m&&(g?.type==="block-map"&&!N.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&h.start{"use strict";var Ju=re(),Wu=dt(),Gu=Xn();function Xu({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??Ju.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,c=null;for(let{start:u,value:f}of n.items){let d=Wu.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?s(t,f,d,i):e(t,d.end,u,null,d,i);t.schema.compat&&Gu.flowIndentCheck(n.indent,f,i),l=p.range[2],a.items.push(p)}return a.range=[n.offset,l,c??l],a}Do.resolveBlockSeq=Xu});var Ce=b(Ho=>{"use strict";function Du(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}Ho.resolveEnd=Du});var ta=b(ea=>{"use strict";var Qu=O(),Hu=se(),zo=ie(),zu=re(),Zu=Ce(),Zo=dt(),ed=gs(),td=Dn(),Qn="Block collections are not allowed within flow collections",Hn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function sd({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=n.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?zo.YAMLMap:zu.YAMLSeq),c=new l(t.schema);c.flow=!0;let u=t.atRoot;u&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=n.offset+n.start.source.length;for(let m=0;m0){let m=Zu.resolveEnd(g,h,t.options.strict,i);m.comment&&(c.comment?c.comment+=` -`+m.comment:c.comment=m.comment),c.range=[n.offset,h,m.offset]}else c.range=[n.offset,h,h];return c}ea.resolveFlowCollection=sd});var na=b(sa=>{"use strict";var nd=O(),id=C(),rd=ie(),od=re(),ad=Xo(),ld=Qo(),cd=ta();function zn(s,e,t,n,i,r){let o=t.type==="block-map"?ad.resolveBlockMap(s,e,t,n,r):t.type==="block-seq"?ld.resolveBlockSeq(s,e,t,n,r):cd.resolveFlowCollection(s,e,t,n,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function fd(s,e,t,n,i){let r=n.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=n,g=d&&r?d.offset>r.offset?d:r:d??r;g&&(!p||p.offsetd.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),zn(s,e,t,i,o)}let c=zn(s,e,t,i,o,l),u=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,f=nd.isNode(u)?u:new id.Scalar(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}sa.composeCollection=fd});var ei=b(ia=>{"use strict";var Zn=C();function ud(s,e,t){let n=e.offset,i=dd(e,s.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?Zn.Scalar.BLOCK_FOLDED:Zn.Scalar.BLOCK_LITERAL,o=e.source?hd(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?` -`.repeat(Math.max(1,o.length-1)):"",m=n+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[n,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,u=0;for(let h=0;hl&&(l=m.length);else{m.length=a;--h)o[h][0].length>l&&(a=h+1);let f="",d="",p=!1;for(let h=0;hl||w[0]===" "?(d===" "?d=` -`:!p&&d===` -`&&(d=` - -`),f+=d+m.slice(l)+w,d=` -`,p=!0):w===""?d===` -`?f+=` -`:d=` -`:(f+=d+w,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h{"use strict";var ti=C(),pd=Ce();function md(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(d,p,g)=>t(n+d,p,g);switch(i){case"scalar":a=ti.Scalar.PLAIN,l=gd(r,c);break;case"single-quoted-scalar":a=ti.Scalar.QUOTE_SINGLE,l=yd(r,c);break;case"double-quoted-scalar":a=ti.Scalar.QUOTE_DOUBLE,l=bd(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=pd.resolveEnd(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function gd(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),ra(s)}function yd(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),ra(s.slice(1,-1)).replace(/''/g,"'")}function ra(s){let e,t;try{e=new RegExp(`(.*?)(?r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function wd(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===` -`||n==="\r")&&!(n==="\r"&&s[e+2]!==` -`);)n===` -`&&(t+=` -`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var Sd={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Nd(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}oa.resolveFlowScalar=md});var ca=b(la=>{"use strict";var me=O(),aa=C(),Ed=ei(),vd=si();function Ad(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Ed.resolveBlockScalar(s,e,n):vd.resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[me.SCALAR]:l?c=Td(s.schema,i,l,t,n):e.type==="scalar"?c=Od(s,i,e,n):c=s.schema[me.SCALAR];let u;try{let f=c.resolve(i,d=>n(t??e,"TAG_RESOLVE_FAILED",d),s.options);u=me.isScalar(f)?f:new aa.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(t??e,"TAG_RESOLVE_FAILED",d),u=new aa.Scalar(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function Td(s,e,t,n,i){if(t==="!")return s[me.SCALAR];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[me.SCALAR])}function Od({atKey:s,directives:e,schema:t},n,i,r){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[me.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[me.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}la.composeScalar=Ad});var ua=b(fa=>{"use strict";function kd(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}fa.emptyScalarPosition=kd});var pa=b(ii=>{"use strict";var Id=Je(),qd=O(),Cd=na(),da=ca(),Ld=Ce(),Pd=ua(),Md={composeNode:ha,composeEmptyNode:ni};function ha(s,e,t,n){let i=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,u=!0;switch(e.type){case"alias":c=$d(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=da.composeScalar(s,e,l,n),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Cd.composeCollection(Md,s,e,t,n),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=ni(s,e.offset,void 0,null,t,n)),a&&c.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!qd.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&u&&(c.srcToken=e),c}function ni(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:Pd.emptyScalarPosition(e,t,n),indent:-1,source:""},f=da.composeScalar(s,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function $d({options:s},{offset:e,source:t,end:n},i){let r=new Id.Alias(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=Ld.resolveEnd(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}ii.composeEmptyNode=ni;ii.composeNode=ha});var ya=b(ga=>{"use strict";var _d=lt(),ma=pa(),xd=Ce(),Bd=dt();function Fd(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({_directives:e},s),l=new _d.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=Bd.resolveProps(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?ma.composeNode(c,i,u,o):ma.composeEmptyNode(c,u.end,n,null,u,o);let f=l.contents.range[2],d=xd.resolveEnd(r,f,!1,o);return d.comment&&(l.comment=d.comment),l.range=[t,f,d.offset],l}ga.composeDoc=Fd});var oi=b(Sa=>{"use strict";var jd=wt("process"),Vd=Ys(),Kd=lt(),ht=ut(),ba=O(),Rd=ya(),Ud=Ce();function pt(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function wa(s){let e="",t=!1,n=!1;for(let i=0;i{let o=pt(t);r?this.warnings.push(new ht.YAMLWarning(o,n,i)):this.errors.push(new ht.YAMLParseError(o,n,i))},this.directives=new Vd.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=wa(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(ba.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ba.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n} -${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n} -${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:wa(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(jd.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=pt(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Rd.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ht.YAMLParseError(pt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new ht.YAMLParseError(pt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Ud.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ht.YAMLParseError(pt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Kd.Document(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};Sa.Composer=ri});var va=b(ys=>{"use strict";var Yd=ei(),Jd=si(),Wd=ut(),Na=Qe();function Gd(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new Wd.YAMLParseError([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Jd.resolveFlowScalar(s,e,n);case"block-scalar":return Yd.resolveBlockScalar({options:{strict:e}},s,n)}}return null}function Xd(s,e){let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=Na.stringifyString({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:` -`}];switch(a[0]){case"|":case">":{let c=a.indexOf(` -`),u=a.substring(0,c),f=a.substring(c+1)+` -`,d=[{type:"block-scalar-header",offset:r,indent:n,source:u}];return Ea(d,l)||d.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:r,indent:n,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:n,source:a,end:l};default:return{type:"scalar",offset:r,indent:n,source:a,end:l}}}function Dd(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Na.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Qd(s,l);break;case'"':ai(s,l,"double-quoted-scalar");break;case"'":ai(s,l,"single-quoted-scalar");break;default:ai(s,l,"scalar")}}function Qd(s,e){let t=e.indexOf(` -`),n=e.substring(0,t),i=e.substring(t+1)+` -`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];Ea(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` -`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function Ea(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function ai(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:` -`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}ys.createScalarToken=Xd;ys.resolveAsScalar=Gd;ys.setScalarValue=Dd});var Ta=b(Aa=>{"use strict";var Hd=s=>"type"in s?ws(s):bs(s);function ws(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=ws(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=bs(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=bs(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=bs(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function bs({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=ws(e)),t)for(let r of t)i+=r.source;return n&&(i+=ws(n)),i}Aa.stringify=Hd});var qa=b(Ia=>{"use strict";var li=Symbol("break visit"),zd=Symbol("skip children"),Oa=Symbol("remove item");function ge(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),ka(Object.freeze([]),s,e)}ge.BREAK=li;ge.SKIP=zd;ge.REMOVE=Oa;ge.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t?.[n];if(r&&"items"in r)t=r.items[i];else return}return t};ge.parentCollection=(s,e)=>{let t=ge.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function ka(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o{"use strict";var ci=va(),Zd=Ta(),eh=qa(),fi="\uFEFF",ui="",di="",hi="",th=s=>!!s&&"items"in s,sh=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function nh(s){switch(s){case fi:return"";case ui:return"";case di:return"";case hi:return"";default:return JSON.stringify(s)}}function ih(s){switch(s){case fi:return"byte-order-mark";case ui:return"doc-mode";case di:return"flow-error-end";case hi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` -`:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}F.createScalarToken=ci.createScalarToken;F.resolveAsScalar=ci.resolveAsScalar;F.setScalarValue=ci.setScalarValue;F.stringify=Zd.stringify;F.visit=eh.visit;F.BOM=fi;F.DOCUMENT=ui;F.FLOW_END=di;F.SCALAR=hi;F.isCollection=th;F.isScalar=sh;F.prettyToken=nh;F.tokenType=ih});var gi=b(La=>{"use strict";var mt=Ss();function J(s){switch(s){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var Ca=new Set("0123456789ABCDEFabcdef"),rh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ns=new Set(",[]{}"),oh=new Set(` ,[]{} -\r `),pi=s=>!s||oh.has(s),mi=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` -`?!0:t==="\r"?this.buffer[e+1]===` -`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===` -`||!i&&!this.atEnd)return e+n+1}return t===` -`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&J(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!J(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&J(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(pi),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>J(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case" ":t+=1;break;case` -`:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` -`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(` -`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` -`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===` -`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield mt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(J(r)||e&&Ns.has(r))break;t=n}else if(J(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===` -`?(n+=1,i=` -`,r=this.buffer[n+1]):t=n),r==="#"||e&&Ns.has(r))break;if(i===` -`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Ns.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mt.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(pi))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(J(t)||e&&Ns.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!J(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(rh.has(t))t=this.buffer[++e];else if(t==="%"&&Ca.has(this.buffer[e+1])&&Ca.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` -`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};La.Lexer=mi});var bi=b(Pa=>{"use strict";var yi=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{"use strict";var ah=wt("process"),Ma=Ss(),lh=gi();function oe(s,e){for(let t=0;t=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function _a(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!oe(e.start,"explicit-key-ind")&&!oe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,xa(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var wi=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new lh.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,ah.env.LOG_TOKENS&&console.log("|",Ma.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Ma.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&_a(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&$a(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(oe(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(xa(t.key)&&!oe(t.sep,"newline")){let o=Le(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(oe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Le(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):oe(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!oe(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||oe(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Es(n),r=Le(i);_a(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` -`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` -`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Es(e),n=Le(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Es(e),n=Le(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Ba.Parser=wi});var Ra=b(yt=>{"use strict";var Fa=oi(),ch=lt(),gt=ut(),fh=nn(),uh=O(),dh=bi(),ja=Si();function Va(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new dh.LineCounter||null,prettyErrors:e}}function hh(s,e={}){let{lineCounter:t,prettyErrors:n}=Va(e),i=new ja.Parser(t?.addNewLine),r=new Fa.Composer(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(gt.prettifyError(s,t)),a.warnings.forEach(gt.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Ka(s,e={}){let{lineCounter:t,prettyErrors:n}=Va(e),i=new ja.Parser(t?.addNewLine),r=new Fa.Composer(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new gt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(gt.prettifyError(s,t)),o.warnings.forEach(gt.prettifyError(s,t))),o}function ph(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=Ka(s,t);if(!i)return null;if(i.warnings.forEach(r=>fh.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function mh(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return uh.isDocument(s)&&!n?s.toString(t):new ch.Document(s,n,t).toString(t)}yt.parse=ph;yt.parseAllDocuments=hh;yt.parseDocument=Ka;yt.stringify=mh});var Ya=b(k=>{"use strict";var gh=oi(),yh=lt(),bh=Vn(),Ni=ut(),wh=Je(),ae=O(),Sh=se(),Nh=C(),Eh=ie(),vh=re(),Ah=Ss(),Th=gi(),Oh=bi(),kh=Si(),vs=Ra(),Ua=Ke();k.Composer=gh.Composer;k.Document=yh.Document;k.Schema=bh.Schema;k.YAMLError=Ni.YAMLError;k.YAMLParseError=Ni.YAMLParseError;k.YAMLWarning=Ni.YAMLWarning;k.Alias=wh.Alias;k.isAlias=ae.isAlias;k.isCollection=ae.isCollection;k.isDocument=ae.isDocument;k.isMap=ae.isMap;k.isNode=ae.isNode;k.isPair=ae.isPair;k.isScalar=ae.isScalar;k.isSeq=ae.isSeq;k.Pair=Sh.Pair;k.Scalar=Nh.Scalar;k.YAMLMap=Eh.YAMLMap;k.YAMLSeq=vh.YAMLSeq;k.CST=Ah;k.Lexer=Th.Lexer;k.LineCounter=Oh.LineCounter;k.Parser=kh.Parser;k.parse=vs.parse;k.parseAllDocuments=vs.parseAllDocuments;k.parseDocument=vs.parseDocument;k.stringify=vs.stringify;k.visit=Ua.visit;k.visitAsync=Ua.visitAsync});var Pi=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Ha=Pi+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",za="["+Pi+"]["+Ha+"]*",Za=new RegExp("^"+za+"$");function St(s,e){let t=[],n=e.exec(s);for(;n;){let i=[];i.startIndex=e.lastIndex-n[0].length;let r=n.length;for(let o=0;o"u")};function Mi(s){return typeof s<"u"}var el={allowBooleanAttributes:!1,unpairedTags:[]};function Fi(s,e){e=Object.assign({},el,e);let t=[],n=!1,i=!1;s[0]==="\uFEFF"&&(s=s.substr(1));for(let r=0;r"&&s[r]!==" "&&s[r]!==" "&&s[r]!==` -`&&s[r]!=="\r";r++)l+=s[r];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),r--),!ll(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",q("InvalidTag",f,_(s,r))}let c=nl(s,r);if(c===!1)return q("InvalidAttr","Attributes for '"+l+"' have open quote.",_(s,r));let u=c.value;if(r=c.index,u[u.length-1]==="/"){let f=r-u.length;u=u.substring(0,u.length-1);let d=Bi(u,e);if(d===!0)n=!0;else return q(d.err.code,d.err.msg,_(s,f+d.err.line))}else if(a)if(c.tagClosed){if(u.trim().length>0)return q("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",_(s,o));if(t.length===0)return q("InvalidTag","Closing tag '"+l+"' has not been opened.",_(s,o));{let f=t.pop();if(l!==f.tagName){let d=_(s,f.tagStartPos);return q("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+l+"'.",_(s,o))}t.length==0&&(i=!0)}}else return q("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",_(s,r));else{let f=Bi(u,e);if(f!==!0)return q(f.err.code,f.err.msg,_(s,r-u.length+f.err.line));if(i===!0)return q("InvalidXml","Multiple possible root nodes found.",_(s,r));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),n=!0}for(r++;r0)return q("InvalidXml","Invalid '"+JSON.stringify(t.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return q("InvalidXml","Start tag expected.",1);return!0}function $i(s){return s===" "||s===" "||s===` -`||s==="\r"}function _i(s,e){let t=e;for(;e5&&n==="xml")return q("InvalidXml","XML declaration allowed only at the start of the document.",_(s,e));if(s[e]=="?"&&s[e+1]==">"){e++;break}else continue}return e}function xi(s,e){if(s.length>e+5&&s[e+1]==="-"&&s[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(s.length>e+8&&s[e+1]==="D"&&s[e+2]==="O"&&s[e+3]==="C"&&s[e+4]==="T"&&s[e+5]==="Y"&&s[e+6]==="P"&&s[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(s.length>e+9&&s[e+1]==="["&&s[e+2]==="C"&&s[e+3]==="D"&&s[e+4]==="A"&&s[e+5]==="T"&&s[e+6]==="A"&&s[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}var tl='"',sl="'";function nl(s,e){let t="",n="",i=!1;for(;e"&&n===""){i=!0;break}t+=s[e]}return n!==""?!1:{value:t,index:e,tagClosed:i}}var il=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Bi(s,e){let t=St(s,il),n={};for(let i=0;i!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(s,e,t){return s},captureMetaData:!1},ji=function(s){return Object.assign({},cl,s)};var Nt;typeof Symbol!="function"?Nt="@@xmlMetadata":Nt=Symbol("XML Node Metadata");var j=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][Nt]={startIndex:t})}static getMetaDataSymbol(){return Nt}};var _e=class{constructor(e){this.suppressValidationErr=!e}readDocType(e,t){let n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let i=1,r=!1,o=!1,a="";for(;t"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,i--):i--,i===0)break}else e[t]==="["?r=!0:a+=e[t];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}readEntityExp(e,t){t=x(e,t);let n="";for(;t{for(;e1||r.length===1&&!a))return s;{let l=Number(t),c=String(l);if(l===0)return l;if(c.search(/[eE]/)!==-1)return e.eNotation?l:s;if(t.indexOf(".")!==-1)return c==="0"||c===o||c===`${i}${o}`?l:s;let u=r?o:t;return r?u===c||i+u===c?l:s:u===c||u===i+c?l:s}}else return s}}else return yl(s,Number(t),e)}var hl=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function pl(s,e,t){if(!t.eNotation)return s;let n=e.match(hl);if(n){let i=n[1]||"",r=n[3].indexOf("e")===-1?"E":"e",o=n[2],a=i?s[o.length+1]===r:s[o.length]===r;return o.length>1&&a?s:o.length===1&&(n[3].startsWith(`.${r}`)||n[3][0]===r)?Number(e):o.length>0?t.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):s:Number(e)}else return s}function ml(s){return s&&s.indexOf(".")!==-1&&(s=s.replace(/0+$/,""),s==="."?s="0":s[0]==="."?s="0"+s:s[s.length-1]==="."&&(s=s.substring(0,s.length-1))),s}function gl(s,e){if(parseInt)return parseInt(s,e);if(Number.parseInt)return Number.parseInt(s,e);if(window&&window.parseInt)return window.parseInt(s,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function yl(s,e,t){let n=e===1/0;switch(t.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return n?"Infinity":"-Infinity";default:return s}}function xe(s){return typeof s=="function"?s:Array.isArray(s)?e=>{for(let t of s)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var Be=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,n)=>String.fromCodePoint(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,n)=>String.fromCodePoint(Number.parseInt(n,16))}},this.addExternalEntities=bl,this.parseXml=vl,this.parseTextData=wl,this.resolveNameSpace=Sl,this.buildAttributesMap=El,this.isItStopNode=kl,this.replaceEntitiesValue=Tl,this.readStopNodeData=ql,this.saveTextToParentTag=Ol,this.addChild=Al,this.ignoreAttributesFn=xe(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t0)){o||(s=this.replaceEntitiesValue(s));let a=this.options.tagValueProcessor(e,s,t,i,r);return a==null?s:typeof a!=typeof s||a!==s?a:this.options.trimValues?Ls(s,this.options.parseTagValue,this.options.numberParseOptions):s.trim()===s?Ls(s,this.options.parseTagValue,this.options.numberParseOptions):s}}function Sl(s){if(this.options.removeNSPrefix){let e=s.split(":"),t=s.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(s=t+e[1])}return s}var Nl=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function El(s,e){if(this.options.ignoreAttributes!==!0&&typeof s=="string"){let t=St(s,Nl),n=t.length,i={};for(let r=0;r",o,"Closing Tag is not closed."),c=s.substring(o+2,l).trim();if(this.options.removeNSPrefix){let d=c.indexOf(":");d!==-1&&(c=c.substr(d+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),t&&(n=this.saveTextToParentTag(n,t,i));let u=i.substring(i.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let f=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),t=this.tagsNodeStack.pop(),n="",o=l}else if(s[o+1]==="?"){let l=Cs(s,o,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,t,i),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){let c=new j(l.tagName);c.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(c[":@"]=this.buildAttributesMap(l.tagExp,i)),this.addChild(t,c,i,o)}o=l.closeIndex+1}else if(s.substr(o+1,3)==="!--"){let l=fe(s,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){let c=s.substring(o+4,l-2);n=this.saveTextToParentTag(n,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}o=l}else if(s.substr(o+1,2)==="!D"){let l=r.readDocType(s,o);this.docTypeEntities=l.entities,o=l.i}else if(s.substr(o+1,2)==="!["){let l=fe(s,"]]>",o,"CDATA is not closed.")-2,c=s.substring(o+9,l);n=this.saveTextToParentTag(n,t,i);let u=this.parseTextData(c,t.tagname,i,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):t.add(this.options.textNodeName,u),o=l+2}else{let l=Cs(s,o,this.options.removeNSPrefix),c=l.tagName,u=l.rawTagName,f=l.tagExp,d=l.attrExpPresent,p=l.closeIndex;if(this.options.transformTagName){let m=this.options.transformTagName(c);f===c&&(f=m),c=m}t&&n&&t.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,t,i,!1));let g=t;g&&this.options.unpairedTags.indexOf(g.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),c!==e.tagname&&(i+=i?"."+c:c);let h=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,i,c)){let m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),f=c):f=f.substr(0,f.length-1),o=l.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)o=l.closeIndex;else{let y=this.readStopNodeData(s,u,p+1);if(!y)throw new Error(`Unexpected end of ${u}`);o=y.i,m=y.tagContent}let w=new j(c);c!==f&&d&&(w[":@"]=this.buildAttributesMap(f,i)),m&&(m=this.parseTextData(m,c,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),w.add(this.options.textNodeName,m),this.addChild(t,w,i,h)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){if(c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName){let w=this.options.transformTagName(c);f===c&&(f=w),c=w}let m=new j(c);c!==f&&d&&(m[":@"]=this.buildAttributesMap(f,i)),this.addChild(t,m,i,h),i=i.substr(0,i.lastIndexOf("."))}else{let m=new j(c);this.tagsNodeStack.push(t),c!==f&&d&&(m[":@"]=this.buildAttributesMap(f,i)),this.addChild(t,m,i,h),t=m}n="",o=p}}else n+=s[o];return e.child};function Al(s,e,t,n){this.options.captureMetaData||(n=void 0);let i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),s.addChild(e,n))}var Tl=function(s){if(this.options.processEntities){for(let e in this.docTypeEntities){let t=this.docTypeEntities[e];s=s.replace(t.regx,t.val)}for(let e in this.lastEntities){let t=this.lastEntities[e];s=s.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let t=this.htmlEntities[e];s=s.replace(t.regex,t.val)}s=s.replace(this.ampEntity.regex,this.ampEntity.val)}return s};function Ol(s,e,t,n){return s&&(n===void 0&&(n=e.child.length===0),s=this.parseTextData(s,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),s!==void 0&&s!==""&&e.add(this.options.textNodeName,s),s=""),s}function kl(s,e,t,n){return!!(e&&e.has(n)||s&&s.has(t))}function Il(s,e,t=">"){let n,i="";for(let r=e;r",t,`${e} is not closed`);if(s.substring(t+2,r).trim()===e&&(i--,i===0))return{tagContent:s.substring(n,t),i:r};t=r}else if(s[t+1]==="?")t=fe(s,"?>",t+1,"StopNode is not closed.");else if(s.substr(t+1,3)==="!--")t=fe(s,"-->",t+3,"StopNode is not closed.");else if(s.substr(t+1,2)==="![")t=fe(s,"]]>",t,"StopNode is not closed.")-2;else{let r=Cs(s,t,">");r&&((r&&r.tagName)===e&&r.tagExp[r.tagExp.length-1]!=="/"&&i++,t=r.closeIndex)}}function Ls(s,e,t){if(e&&typeof s=="string"){let n=s.trim();return n==="true"?!0:n==="false"?!1:qs(s,t)}else return Mi(s)?s:""}var Ps=j.getMetaDataSymbol();function Ms(s,e){return Vi(s,e)}function Vi(s,e,t){let n,i={};for(let r=0;r0&&(i[e.textNodeName]=n):n!==void 0&&(i[e.textNodeName]=n),i}function Cl(s){let e=Object.keys(s);for(let t=0;t0&&(t=` -`),Ri(s,e,"",t)}function Ri(s,e,t,n){let i="",r=!1;for(let o=0;o`,r=!1;continue}else if(l===e.commentPropName){i+=n+``,r=!0;continue}else if(l[0]==="?"){let g=Ki(a[":@"],e),h=l==="?xml"?"":n,m=a[l][0][e.textNodeName];m=m.length!==0?" "+m:"",i+=h+`<${l}${m}${g}?>`,r=!0;continue}let u=n;u!==""&&(u+=e.indentBy);let f=Ki(a[":@"],e),d=n+`<${l}${f}`,p=Ri(a[l],e,c,u);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?i+=d+">":i+=d+"/>":(!p||p.length===0)&&e.suppressEmptyNode?i+=d+"/>":p&&p.endsWith(">")?i+=d+`>${p}${n}`:(i+=d+">",p&&n!==""&&(p.includes("/>")||p.includes("`),r=!0}return i}function Ml(s){let e=Object.keys(s);for(let t=0;t0&&e.processEntities)for(let t=0;t","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function U(s){this.options=Object.assign({},_l,s),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=xe(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Fl),this.processTextOrObjNode=xl,this.options.format?(this.indentate=Bl,this.tagEndChar=`> -`,this.newLine=` -`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}U.prototype.build=function(s){return this.options.preserveOrder?$s(s,this.options):(Array.isArray(s)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(s={[this.options.arrayNodeName]:s}),this.j2x(s,0,[]).val)};U.prototype.j2x=function(s,e,t){let n="",i="",r=t.join(".");for(let o in s)if(Object.prototype.hasOwnProperty.call(s,o))if(typeof s[o]>"u")this.isAttribute(o)&&(i+="");else if(s[o]===null)this.isAttribute(o)||o===this.options.cdataPropName?i+="":o[0]==="?"?i+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(s[o]instanceof Date)i+=this.buildTextValNode(s[o],o,"",e);else if(typeof s[o]!="object"){let a=this.isAttribute(o);if(a&&!this.ignoreAttributesFn(a,r))n+=this.buildAttrPairStr(a,""+s[o]);else if(!a)if(o===this.options.textNodeName){let l=this.options.tagValueProcessor(o,""+s[o]);i+=this.replaceEntitiesValue(l)}else i+=this.buildTextValNode(s[o],o,"",e)}else if(Array.isArray(s[o])){let a=s[o].length,l="",c="";for(let u=0;u"u"))if(f===null)o[0]==="?"?i+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){let d=this.j2x(f,e+1,t.concat(o));l+=d.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(c+=d.attrStr)}else l+=this.processTextOrObjNode(f,o,e,t);else if(this.options.oneListGroup){let d=this.options.tagValueProcessor(o,f);d=this.replaceEntitiesValue(d),l+=d}else l+=this.buildTextValNode(f,o,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,o,c,e)),i+=l}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let a=Object.keys(s[o]),l=a.length;for(let c=0;c"+s+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&r.length===0?this.indentate(n)+``+this.newLine:this.indentate(n)+"<"+e+t+r+this.tagEndChar+s+this.indentate(n)+i}};U.prototype.closeTag=function(s){let e="";return this.options.unpairedTags.indexOf(s)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+``+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,s);return i=this.replaceEntitiesValue(i),i===""?this.indentate(n)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+t+">"+i+"0&&this.options.processEntities)for(let e=0;e-1&&t!=="'"&&Kl(s,e));return e>-1&&(e+=n.length,n.length>1&&(s[e]===t&&e++,s[e]===t&&e++)),e}var Rl=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Fe=class s extends Date{#t=!1;#s=!1;#e=null;constructor(e){let t=!0,n=!0,i="Z";if(typeof e=="string"){let r=e.match(Rl);r?(r[1]||(t=!1,e=`0000-01-01T${e}`),n=!!r[2],n&&e[10]===" "&&(e=e.replace(" ","T")),r[2]&&+r[2]>23?e="":(i=r[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=t,this.#s=n,this.#e=i)}isDateTime(){return this.#t&&this.#s}isLocal(){return!this.#t||!this.#s||!this.#e}isDate(){return this.#t&&!this.#s}isTime(){return this.#s&&!this.#t}isValid(){return this.#t||this.#s}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,t="Z"){let n=new s(e);return n.#e=t,n}static wrapAsLocalDateTime(e){let t=new s(e);return t.#e=null,t}static wrapAsLocalDate(e){let t=new s(e);return t.#s=!1,t.#e=null,t}static wrapAsLocalTime(e){let t=new s(e);return t.#t=!1,t.#e=null,t}};var Ul=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Yl=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Jl=/^[+-]?0[0-9_]/,Wl=/^[0-9a-f]{2,8}$/i,Qi={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Tt(s,e=0,t=s.length){let n=s[e]==="'",i=s[e++]===s[e]&&s[e]===s[e+1];i&&(t-=2,s[e+=2]==="\r"&&e++,s[e]===` -`&&e++);let r=0,o,a="",l=e;for(;e-1&&(Se(s,i),n=n.slice(0,i)),[n.trimEnd(),i]}function je(s,e,t,n,i){if(n===0)throw new T("document contains excessively nested structures. aborting.",{toml:s,ptr:e});let r=s[e];if(r==="["||r==="{"){let[l,c]=r==="["?Zi(s,e,n,i):zi(s,e,n,i);if(t){if(c=V(s,c),s[c]===",")c++;else if(s[c]!==t)throw new T("expected comma or end of structure",{toml:s,ptr:c})}return[l,c]}let o;if(r==='"'||r==="'"){o=At(s,e);let l=Tt(s,e,o);if(t){if(o=V(s,o),s[o]&&s[o]!==","&&s[o]!==t&&s[o]!==` -`&&s[o]!=="\r")throw new T("unexpected character encountered",{toml:s,ptr:o});o+=+(s[o]===",")}return[l,o]}o=Di(s,e,",",t);let a=Gl(s,e,o-+(s[o-1]===","));if(!a[0])throw new T("incomplete key-value declaration: no value specified",{toml:s,ptr:e});return t&&a[1]>-1&&(o=V(s,e+a[1]),o+=+(s[o]===",")),[Hi(a[0],s,e,i),o]}var Xl=/^[a-zA-Z0-9-_]+[ \t]*$/;function Ot(s,e,t="="){let n=e-1,i=[],r=s.indexOf(t,e);if(r<0)throw new T("incomplete key-value: cannot find end of key",{toml:s,ptr:e});do{let o=s[e=++n];if(o!==" "&&o!==" ")if(o==='"'||o==="'"){if(o===s[e+1]&&o===s[e+2])throw new T("multiline strings are not allowed in keys",{toml:s,ptr:e});let a=At(s,e);if(a<0)throw new T("unfinished string encountered",{toml:s,ptr:e});n=s.indexOf(".",a);let l=s.slice(a,n<0||n>r?r:n),c=vt(l);if(c>-1)throw new T("newlines are not allowed in keys",{toml:s,ptr:e+n+c});if(l.trimStart())throw new T("found extra tokens after the string part",{toml:s,ptr:a});if(rr?r:n);if(!Xl.test(a))throw new T("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:e});i.push(a.trimEnd())}}while(n+1&&nr===""?null:r});return R(n.parse(t))}case"ini":return R(As.parse(t));case"csv":return R(Lh(t,e.csvDelimiter,e.csvHeader));case"toml":return R(kt(t));default:{let n=e.inputFormat;throw new Error(`Invalid input format: ${n}`)}}}function Ga(s){return bt.default.parseAllDocuments(s).map(t=>R(t.toJS({maxAliasCount:100})))}function Xa(s){let e=s.trimStart();if(e.startsWith("---")){let t=e.slice(3).match(/\n---(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:R(bt.default.parse(n,{maxAliasCount:100})),content:i}}}if(e.startsWith("+++")){let t=e.slice(3).match(/\n\+\+\+(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:R(kt(n)),content:i}}}if(e.startsWith("{{{")){let t=e.slice(3).match(/\n}}}(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:R(JSON.parse(n)),content:i}}}return null}function Da(s,e){if(s===void 0)return"";switch(e.outputFormat){case"yaml":return bt.default.stringify(s,{indent:e.indent}).trimEnd();case"json":return e.raw&&typeof s=="string"?s:e.compact?JSON.stringify(s):JSON.stringify(s,null,e.indent);case"xml":return new U({ignoreAttributes:!1,attributeNamePrefix:e.xmlAttributePrefix,textNodeName:e.xmlContentName,format:e.prettyPrint||!e.compact,indentBy:" ".repeat(e.indent)}).build(s);case"ini":return!s||typeof s!="object"||Array.isArray(s)?"":As.stringify(s);case"csv":return Ph(s,e.csvDelimiter);case"toml":return!s||typeof s!="object"||Array.isArray(s)?"":Vs(s);default:throw new Error(`Unknown output format: ${e.outputFormat}`)}}var Mh={name:"yq",summary:"command-line YAML/XML/INI/CSV/TOML processor",usage:"yq [OPTIONS] [FILTER] [FILE]",description:`yq uses jq-style expressions to query and transform data in various formats. -Supports YAML, JSON, XML, INI, CSV, and TOML with automatic format conversion. - -EXAMPLES: - # Extract a value from YAML - yq '.name' config.yaml - yq '.users[0].email' data.yaml - - # Filter arrays - yq '.items[] | select(.active == true)' data.yaml - yq '[.users[] | select(.age > 30)]' users.yaml - - # Transform data - yq '.users | map({name, email})' data.yaml - yq '.items | sort_by(.price) | reverse' products.yaml - - # Modify file in-place - yq -i '.version = "2.0"' config.yaml - - # Read JSON, output YAML - yq -p json '.' config.json - - # Read YAML, output JSON - yq -o json '.' config.yaml - yq -o json -c '.' config.yaml # compact JSON - - # Parse TOML config files - yq '.package.name' Cargo.toml - yq -o json '.' pyproject.toml - - # Parse XML (attributes use +@ prefix, text uses +content) - yq -p xml '.root.items.item[].name' data.xml - yq -p xml '.root.user["+@id"]' data.xml # XML attributes - - # Parse INI config files - yq -p ini '.database.host' config.ini - yq -p ini '.server' config.ini -o json - - # Parse CSV/TSV (auto-detects delimiter) - yq -p csv '.[0].name' data.csv - yq '.[0].name' data.tsv # auto-detected as CSV - yq -p csv '[.[] | select(.category == "A")]' data.csv - - # Extract front-matter from markdown/content files - yq --front-matter '.title' post.md - - # Convert between formats - yq -p json -o csv '.users' data.json # JSON to CSV - yq -p csv -o yaml '.' data.csv # CSV to YAML - yq -p ini -o json '.' config.ini # INI to JSON - yq -p xml -o json '.' data.xml # XML to JSON - yq -o toml '.' config.yaml # YAML to TOML - - # Common jq functions work in yq: - yq 'keys' data.yaml # get object keys - yq 'length' data.yaml # array/string length - yq '.items | first' data.yaml # first element - yq '.items | last' data.yaml # last element - yq '.nums | add' data.yaml # sum numbers - yq '.nums | min' data.yaml # minimum - yq '.nums | max' data.yaml # maximum - yq '.items | unique' data.yaml # unique values - yq '.items | group_by(.type)' data.yaml`,options:["-p, --input-format=FMT input format: yaml (default), xml, json, ini, csv, toml","-o, --output-format=FMT output format: yaml (default), json, xml, ini, csv, toml","-i, --inplace modify file in-place","-r, --raw-output output strings without quotes (json only)","-c, --compact compact output (json only)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-f, --front-matter extract and process front-matter only","-P, --prettyPrint pretty print output","-I, --indent=N set indent level (default: 2)"," --xml-attribute-prefix=STR XML attribute prefix (default: +@)"," --xml-content-name=STR XML text content name (default: +content)"," --csv-delimiter=CHAR CSV delimiter (default: auto-detect)"," --csv-header CSV has header row (default: true)"," --help display this help and exit"]};function $h(s){let e={...Ja,exitStatus:!1,slurp:!1,nullInput:!1,joinOutput:!1,inplace:!1,frontMatter:!1},t=!1,n=".",i=!1,r=[];for(let o=0;oCi(e.requireDefenseContext,"yq",u,f);if(Ii(s))return ki(Mh);let n=$h(s);if("exitCode"in n)return n;let{options:i,filter:r,files:o,inputFormatExplicit:a}=n;if(!a&&o.length>0&&o[0]!=="-"){let u=Wa(o[0]);u&&(i.inputFormat=u)}if(i.inplace&&(o.length===0||o[0]==="-"))return{stdout:"",stderr:`yq: -i/--inplace requires a file argument -`,exitCode:1};let l,c;if(i.nullInput)l="";else if(o.length===0||o.length===1&&o[0]==="-")l=e.stdin;else try{let u=e.fs.resolvePath(e.cwd,o[0]);c=u,l=await t("file read",()=>e.fs.readFile(u))}catch(u){if(u instanceof Os)throw u;return{stdout:"",stderr:`yq: ${o[0]}: No such file or directory -`,exitCode:2}}try{let u=Li(r),f,d={limits:e.limits?{maxIterations:e.limits.maxJqIterations}:void 0,env:e.env,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext};if(i.nullInput)f=Pe(null,u,d);else if(i.frontMatter){let y=Xa(l);if(!y)return{stdout:"",stderr:`yq: no front-matter found -`,exitCode:1};f=Pe(y.frontMatter,u,d)}else if(i.slurp){let y;i.inputFormat==="yaml"?y=Ga(l):y=[Ti(l,i)],f=Pe(y,u,d)}else{let y=Ti(l,i);f=Pe(y,u,d)}let p=f.map(y=>Da(y,i)),g=i.joinOutput?"":` -`,h=p.filter(y=>y!=="").join(g),m=h?i.joinOutput?h:`${h} -`:"";if(i.inplace&&c)return await t("in-place write",()=>e.fs.writeFile(c,m)),{stdout:"",stderr:"",exitCode:0};let w=i.exitStatus&&(f.length===0||f.every(y=>y==null||y===!1))?1:0;return{stdout:m,stderr:"",exitCode:w}}catch(u){if(u instanceof Os)throw u;if(u instanceof ks)return{stdout:"",stderr:`yq: ${Is(u.message)} -`,exitCode:ks.EXIT_CODE};let f=Is(u.message);return f.includes("Unknown function")?{stdout:"",stderr:`yq: error: ${f} -`,exitCode:3}:{stdout:"",stderr:`yq: parse error: ${f} -`,exitCode:5}}}},mg={name:"yq",flags:[{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{pg as a,mg as b}; -/*! Bundled license information: - -smol-toml/dist/error.js: -smol-toml/dist/util.js: -smol-toml/dist/date.js: -smol-toml/dist/primitive.js: -smol-toml/dist/extract.js: -smol-toml/dist/struct.js: -smol-toml/dist/parse.js: -smol-toml/dist/stringify.js: -smol-toml/dist/index.js: - (*! - * Copyright (c) Squirrel Chat et al., All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *) -*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-2NRAWO6E.js b/packages/just-bash/dist/bin/chunks/chunk-2NRAWO6E.js new file mode 100644 index 00000000..18022de0 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-2NRAWO6E.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{b as v}from"./chunk-H7JTIXAO.js";import{a as y}from"./chunk-VZK4FHWJ.js";import{a as x,b as I,c as m}from"./chunk-MUFNRCMY.js";var T={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function b(s){let c=[],l=s.split(",");for(let n of l)if(n.includes("-")){let[t,r]=n.split("-");c.push({start:t?parseInt(t,10):1,end:r?parseInt(r,10):null})}else{let t=parseInt(n,10);c.push({start:t,end:t})}return c}function w(s,c){let l=[];for(let n of c){let t=n.start-1,r=n.end===null?s.length:n.end;for(let i=t;i=0&&!l.includes(s[i])&&l.push(s[i])}return l}var E={name:"cut",async execute(s,c){if(I(s))return x(T);let l=" ",n=null,t=null,r=!1,i=[];for(let o=0;o0&&a[a.length-1]===""&&a.pop();let g=b(n||t||"1"),h="";for(let o of a)if(t){let e=Array.from(o),f=[];for(let u of g){let F=u.start-1,H=u.end===null?e.length:u.end;for(let d=F;d=0&&f.push(e[d])}h+=`${f.join("")} +`}else{if(r&&!o.includes(l))continue;let e=o.split(l),f=w(e,g);h+=`${f.join(l)} +`}return t?{stdout:h,stderr:"",exitCode:0}:{stdout:h,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},S={name:"cut",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-f",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"string"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0};export{E as a,S as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-2SVX7I5P.js b/packages/just-bash/dist/bin/chunks/chunk-2SVX7I5P.js new file mode 100644 index 00000000..eb152ecc --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-2SVX7I5P.js @@ -0,0 +1,14 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as g}from"./chunk-VZK4FHWJ.js";import{a as y,b as $,c as F}from"./chunk-MUFNRCMY.js";var b={name:"comm",summary:"compare two sorted files line by line",usage:"comm [OPTION]... FILE1 FILE2",options:["-1 suppress column 1 (lines unique to FILE1)","-2 suppress column 2 (lines unique to FILE2)","-3 suppress column 3 (lines that appear in both files)"," --help display this help and exit"]},E={name:"comm",async execute(m,a){if($(m))return y(b);let r=!1,l=!1,f=!1,i=[];for(let e of m)if(e==="-1")r=!0;else if(e==="-2")l=!0;else if(e==="-3")f=!0;else if(e==="-12"||e==="-21")r=!0,l=!0;else if(e==="-13"||e==="-31")r=!0,f=!0;else if(e==="-23"||e==="-32")l=!0,f=!0;else if(e==="-123"||e==="-132"||e==="-213"||e==="-231"||e==="-312"||e==="-321")r=!0,l=!0,f=!0;else{if(e.startsWith("-")&&e!=="-")return F("comm",e);i.push(e)}if(i.length!==2)return{stdout:"",stderr:`comm: missing operand +Try 'comm --help' for more information. +`,exitCode:1};let p=async e=>{if(e==="-")return g(a.stdin);try{let x=a.fs.resolvePath(a.cwd,e);return await a.fs.readFile(x)}catch{return null}},c=await p(i[0]);if(c===null)return{stdout:"",stderr:`comm: ${i[0]}: No such file or directory +`,exitCode:1};let d=await p(i[1]);if(d===null)return{stdout:"",stderr:`comm: ${i[1]}: No such file or directory +`,exitCode:1};let t=c.split(` +`),s=d.split(` +`);t.length>0&&t[t.length-1]===""&&t.pop(),s.length>0&&s[s.length-1]===""&&s.pop();let n=0,o=0,u="",h=r?"":" ",w=(r?"":" ")+(l?"":" ");for(;n=t.length?(l||(u+=`${h}${s[o]} +`),o++):o>=s.length?(r||(u+=`${t[n]} +`),n++):t[n]s[o]?(l||(u+=`${h}${s[o]} +`),o++):(f||(u+=`${w}${t[n]} +`),n++,o++);return{stdout:u,stderr:"",exitCode:0}}},L={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2};export{E as a,L as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-3BYTCO2H.js b/packages/just-bash/dist/bin/chunks/chunk-3BYTCO2H.js new file mode 100644 index 00000000..e5ee4d40 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-3BYTCO2H.js @@ -0,0 +1,12 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as fe}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-UR4CEP4Y.js";import{a as ne}from"./chunk-3MRB66F4.js";import{a as te}from"./chunk-IEXQTXU5.js";import{a as oe,b as pe,c as ce}from"./chunk-JXLDT4KX.js";import{a as ie,b as le}from"./chunk-MUFNRCMY.js";function k(e,t){switch(e.type){case"name":{let n=e.pattern,a=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let s=a[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,a=t.relativePath,s=n.split("/");for(let i=0;ie.days:e.comparison==="less"?s=an,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let a;return e.comparison==="more"?a=t.size>n:e.comparison==="less"?a=t.sizei.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let r=o[i];if(!r.includes("*")&&!r.includes("?")&&!r.includes("[")&&r!=="."&&r!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=r;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=a=>{a.type==="path"?t.push(a.pattern):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right))};return n(e),t}function Me(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function he(e){let t=[],n=a=>{a&&(a.type==="newer"?t.push(a.refPath):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function L(e,t,n,a,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let r=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";a.push({type:"exec",command:r,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),a.push({type:"print"});else if(i==="-print0")a.push({type:"print0"});else if(i==="-printf"&&s+1=e.length)return null;let r=e[t];if(r.type==="lparen"){t++;let p=n();return tc.type==="print"),O=l.length===0,x=[],ge=l.some(c=>c.type==="printf"),re=[],B="",q=0,we=he(r),U=new Map;for(let c of we){let f=t.fs.resolvePath(t.cwd,c);try{let u=await t.fs.stat(f);U.set(c,u.mtime?.getTime()??Date.now())}catch{}}let De=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Te=_(r)||De,Ce=j(r),K=ue(r),ae=V(r),Pe=J(r),Se=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let G=function(h){let $=s===null||h.depth>=s,P=!1;if($&&r!==null){let S=Date.now(),y;if(Pe)y=L(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let m={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:U};y=k(r,m)}$=y.matches,P=d?y.printed:$,u.evalCalls++,u.evalTime+=Date.now()-S}else $&&(P=!0);return P?{print:!0,printfData:ge?{path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=G;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{B+=`find: ${c}: No such file or directory +`,q=1;continue}let u=Ie(),M=Date.now();async function N(h){let{path:b,depth:$,typeInfo:P}=h;if(u.nodeCount++,$>(a??256))return null;let v,S,y;if(P&&!Te)v=P.isFile,S=P.isDirectory;else{try{let A=Date.now();y=await t.fs.stat(b),u.statCalls++,u.statTime+=Date.now()-A}catch{return null}if(!y)return null;v=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=de(r,{name:m,relativePath:g,isFile:v,isDirectory:S}).shouldPrune,D&&u.earlyPrunes++);let F=$>=(a??256),I=K.terminalDirName!==null&&m===K.terminalDirName,Z=!F&&!I&&!D;if(S&&((Z||Ce||I)&&!D)){let A=Date.now();if(Se&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(E=>E.name),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z)T=C.map((E,R)=>({path:b==="/"?`/${E.name}`:`${b}/${E.name}`,depth:$+1,typeInfo:{isFile:E.isFile,isDirectory:E.isDirectory},resultIndex:R}));else if(I){let E=K.requiredExtension;T=C.filter(R=>R.isFile&&(!E||R.name.endsWith(E))).map((R,ve)=>({path:b==="/"?`/${R.name}`:`${b}/${R.name}`,depth:$+1,typeInfo:{isFile:R.isFile,isDirectory:R.isDirectory},resultIndex:ve}))}}else w=await t.fs.readdir(b),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z&&(T=w.map((E,R)=>({path:b==="/"?`/${E}`:`${b}/${E}`,depth:$+1,resultIndex:R})))}let Q=v?(y?.size??0)===0:w!==null&&w.length===0,H=D;if(!o&&r!==null&&!D&&ae){let A=Date.now(),E={name:m,relativePath:g,isFile:v,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};H=k(r,E).pruned,u.evalCalls++,u.evalTime+=Date.now()-A}return{relativePath:g,name:m,isFile:v,isDirectory:S,isEmpty:Q,stat:y,depth:$,children:H?[]:T,pruned:H}}async function be(){let h={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let F=y(D);g.paths.push(...F.paths),g.printfData.push(...F.printfData)}let{print:C,printfData:w}=G(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],v=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;v.length>0;){let m=Date.now(),g=v.splice(0,ye),T=await Promise.all(g.map(C=>N(C.item)));u.batchCount++,u.batchTime+=Date.now()-m;for(let C=0;C=0){let I=S.get(D.parentIndex)||[];I.push(F),S.set(D.parentIndex,I)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let I=0;I=0&&m0){let m=y(0);h.paths.push(...m.paths),h.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(h.paths.push(T.path),T.printfData&&h.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var $=m;let P=new Map,v=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:v++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,ye),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let F=await N(w);return F?{node:F,orderIndex:D}:null}));u.batchCount++,u.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:F}=w,{print:I,printfData:Z}=G(D);if(I&&P.set(F,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let H=v++;ee.push(H),S.push({item:Q,orderIndex:H})}y.set(F,ee)}}}m(0)}return h}let X=await be();if(x.push(...X.paths),re.push(...X.printfData),t.trace){let h=Date.now()-M;xe(t.trace,u,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:X.paths.length}})}}let W="";if(l.length>0)for(let c of l)switch(c.type){case"print":W+=x.length>0?`${x.join(` +`)} +`:"";break;case"print0":W+=x.length>0?`${x.join("\0")}\0`:"";break;case"delete":{let f=[...x].sort((u,M)=>M.length-u.length);for(let u of f){let M=t.fs.resolvePath(t.cwd,u);try{await t.fs.rm(M,{recursive:!1})}catch(N){let G=N instanceof Error?N.message:String(N);B+=`find: cannot delete '${u}': ${G} +`,q=1}}break}case"printf":for(let f of re)W+=ke(c.format,f);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context +`,exitCode:1};if(c.batchMode){let f=[];for(let M of c.command)M==="{}"?f.push(...x):f.push(M);let u=await t.exec(ne([f[0]]),{cwd:t.cwd,signal:t.signal,args:f.slice(1)});W+=u.stdout,B+=u.stderr,u.exitCode!==0&&(q=u.exitCode)}else for(let f of x){let u=c.command.map(N=>N==="{}"?f:N),M=await t.exec(ne([u[0]]),{cwd:t.cwd,signal:t.signal,args:u.slice(1)});W+=M.stdout,B+=M.stderr,M.exitCode!==0&&(q=M.exitCode)}break}else O&&(W=x.length>0?`${x.join(` +`)} +`:"");return{stdout:W,stderr:B,exitCode:q}}};function ke(e,t){let n=ce(e),a="",s=0;for(;s=n.length){a+="%";break}let p=n[s],l;switch(p){case"f":l=t.name,s++;break;case"h":{let d=t.path.lastIndexOf("/");l=d>0?t.path.slice(0,d):".",s++;break}case"p":l=t.path,s++;break;case"P":{let d=t.startingPoint;t.path===d?l="":t.path.startsWith(`${d}/`)?l=t.path.slice(d.length+1):d==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,s++;break}case"s":l=String(t.size),s++;break;case"d":l=String(t.depth),s++;break;case"m":l=(t.mode&511).toString(8),s++;break;case"M":l=fe(t.mode,t.isDirectory),s++;break;case"t":{let d=new Date(t.mtime);l=Ne(d),s++;break}case"T":{if(s+11&&!a)return{stdout:"",stderr:`mv: target '${r}' is not a directory +`,exitCode:1};for(let e of g)try{let c=t.fs.resolvePath(t.cwd,e),o=n;if(a){let l=e.split("/").pop()||e;o=n==="/"?`/${l}`:`${n}/${l}`}if(d)try{await t.fs.stat(o);continue}catch{}if(await t.fs.mv(c,o),w){let l=a?`${r}/${e.split("/").pop()||e}`:r;v+=`renamed '${e}' -> '${l}' +`}}catch(c){let o=$(c);o.includes("ENOENT")||o.includes("no such file")?f+=`mv: cannot stat '${e}': No such file or directory +`:f+=`mv: cannot move '${e}': ${o} +`,b=1}return{stdout:v,stderr:f,exitCode:b}}},x={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{O as a,x as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-3Y32LPNT.js b/packages/just-bash/dist/bin/chunks/chunk-3Y32LPNT.js deleted file mode 100644 index 8b5e67a5..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-3Y32LPNT.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a as m}from"./chunk-OBI37ZY4.js";var s=m("md5sum","md5","compute MD5 message digest"),o={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0};export{s as a,o as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-47WZ2U6M.js b/packages/just-bash/dist/bin/chunks/chunk-47WZ2U6M.js new file mode 100644 index 00000000..e001ca34 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-47WZ2U6M.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +var n=class extends Error{stdout;stderr;constructor(t,s="",e=""){super(t),this.stdout=s,this.stderr=e}prependOutput(t,s){this.stdout=t+this.stdout,this.stderr=s+this.stderr}},c=class extends n{levels;name="BreakError";constructor(t=1,s="",e=""){super("break",s,e),this.levels=t}},a=class extends n{levels;name="ContinueError";constructor(t=1,s="",e=""){super("continue",s,e),this.levels=t}},i=class extends n{exitCode;name="ReturnError";constructor(t=0,s="",e=""){super("return",s,e),this.exitCode=t}},u=class extends n{exitCode;name="ErrexitError";constructor(t,s="",e=""){super(`errexit: command exited with status ${t}`,s,e),this.exitCode=t}},x=class extends n{varName;name="NounsetError";constructor(t,s=""){super(`${t}: unbound variable`,s,`bash: ${t}: unbound variable +`),this.varName=t}},d=class extends n{exitCode;name="ExitError";constructor(t,s="",e=""){super("exit",s,e),this.exitCode=t}},p=class extends n{name="ArithmeticError";fatal;constructor(t,s="",e="",o=!1){super(t,s,e),this.stderr=e||`bash: ${t} +`,this.fatal=o}},l=class extends n{name="BadSubstitutionError";constructor(t,s="",e=""){super(t,s,e),this.stderr=e||`bash: ${t}: bad substitution +`}},h=class extends n{name="GlobError";constructor(t,s="",e=""){super(`no match: ${t}`,s,e),this.stderr=e||`bash: no match: ${t} +`}},m=class extends n{name="BraceExpansionError";constructor(t,s="",e=""){super(t,s,e),this.stderr=e||`bash: ${t} +`}},b=class extends n{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,s,e="",o=""){super(t,e,o),this.limitType=s,this.stderr=o||`bash: ${t} +`}},$=class extends n{name="ExecutionAbortedError";constructor(t="",s=""){super("execution aborted",t,s)}},f=class extends n{name="SubshellExitError";constructor(t="",s=""){super("subshell exit",t,s)}};function v(r){return r instanceof c||r instanceof a||r instanceof i}var C=class extends n{exitCode;name="PosixFatalError";constructor(t,s="",e=""){super("posix fatal error",s,e),this.exitCode=t}};export{c as a,a as b,i as c,u as d,x as e,d as f,p as g,l as h,h as i,m as j,b as k,$ as l,f as m,v as n,C as o}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-4CFAYBLV.js b/packages/just-bash/dist/bin/chunks/chunk-4CFAYBLV.js deleted file mode 100644 index 0c4fc01e..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-4CFAYBLV.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node -import{a as we,c as Oe}from"./chunk-KGOUQS5A.js";var xe=Oe((de,pe)=>{(function(oe,R){typeof define=="function"&&define.amd?define([],R):typeof pe=="object"&&typeof de<"u"?pe.exports=R():oe.Papa=R()})(de,function oe(){"use strict";var R=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof R<"u"?R:{}})();function _e(){var e=R.URL||R.webkitURL||null,t=oe.toString();return l.BLOB_URL||(l.BLOB_URL=e.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",t,")();"],{type:"text/javascript"})))}var Y=!R.document&&!!R.postMessage,ue=R.IS_PAPA_WORKER||!1,ae={},ge=0,l={};if(l.parse=Ce,l.unparse=Re,l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",` -`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!Y&&!!R.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=1024*1024*10,l.RemoteChunkSize=1024*1024*5,l.DefaultDelimiter=",",l.Parser=fe,l.ParserHandle=ce,l.NetworkStreamer=G,l.FileStreamer=ee,l.StringStreamer=Z,l.ReadableStreamStreamer=te,typeof PAPA_BROWSER_CONTEXT>"u"&&(l.DuplexStreamStreamer=re),R.jQuery){var V=R.jQuery;V.fn.parse=function(e){var t=e.config||{},r=[];return this.each(function(h){var i=V(this).prop("tagName").toUpperCase()==="INPUT"&&V(this).attr("type").toLowerCase()==="file"&&R.FileReader;if(!i||!this.files||this.files.length===0)return!0;for(var y=0;y"u")return n=new re(t),n.getStream();return typeof e=="string"?(e=p(e),t.download?n=new G(t):n=new Z(t)):e.readable===!0&&g(e.read)&&g(e.on)?n=new te(t):(R.File&&e instanceof File||e instanceof Object)&&(n=new ee(t)),n.stream(e);function p(h){return h.charCodeAt(0)===65279?h.slice(1):h}}function Re(e,t){var r=!1,s=!0,n=",",p=`\r -`,h='"',i=h+h,y=!1,E=null,O=!1;L();var d=new RegExp(se(h),"g");if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,y);if(typeof e[0]=="object")return u(E||Object.keys(e[0]),e,y)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||E),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),!Array.isArray(e.data[0])&&typeof e.data[0]!="object"&&(e.data=[e.data])),u(e.fields||[],e.data||[],y);throw new Error("Unable to serialize unrecognized input");function L(){if(typeof t=="object"){if(typeof t.delimiter=="string"&&!l.BAD_DELIMITERS.filter(function(v){return t.delimiter.indexOf(v)!==-1}).length&&(n=t.delimiter),(typeof t.quotes=="boolean"||typeof t.quotes=="function"||Array.isArray(t.quotes))&&(r=t.quotes),(typeof t.skipEmptyLines=="boolean"||typeof t.skipEmptyLines=="string")&&(y=t.skipEmptyLines),typeof t.newline=="string"&&(p=t.newline),typeof t.quoteChar=="string"&&(h=t.quoteChar),typeof t.header=="boolean"&&(s=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");E=t.columns}t.escapeChar!==void 0&&(i=t.escapeChar+h),t.escapeFormulae instanceof RegExp?O=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(O=/^[=+\-@\t\r].*$/)}}function u(v,k,S){var w="";typeof v=="string"&&(v=JSON.parse(v)),typeof k=="string"&&(k=JSON.parse(k));var M=Array.isArray(v)&&v.length>0,T=!Array.isArray(k[0]);if(M&&s){for(var q=0;q0&&(w+=n),w+=c(v[q],q);k.length>0&&(w+=p)}for(var _=0;_0&&!o&&(w+=n);var C=M&&T?v[a]:a;w+=c(k[_][C],a)}_0&&!o)&&(w+=p)}}return w}function c(v,k){if(typeof v>"u"||v===null)return"";if(v.constructor===Date)return JSON.stringify(v).slice(1,25);var S=!1;O&&typeof v=="string"&&O.test(v)&&(v="'"+v,S=!0);var w=v.toString().replace(d,i);return S=S||r===!0||typeof r=="function"&&r(v,k)||Array.isArray(r)&&r[k]||Q(w,l.BAD_DELIMITERS)||w.indexOf(n)>-1||w.charAt(0)===" "||w.charAt(w.length-1)===" ",S?h+w+h:w}function Q(v,k){for(var S=0;S-1)return!0;return!1}}function z(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},t.call(this,e),this.parseChunk=function(r,s){let n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&n>0){let O=this._config.newline;if(!O){let L=this._config.quoteChar||'"';O=this._handle.guessLineEndings(r,L)}r=[...r.split(O).slice(n)].join(O)}if(this.isFirstChunk&&g(this._config.beforeFirstChunk)){var p=this._config.beforeFirstChunk(r);p!==void 0&&(r=p)}this.isFirstChunk=!1,this._halted=!1;var h=this._partialLine+r;this._partialLine="";var i=this._handle.parse(h,this._baseIndex,!this._finished);if(this._handle.paused()||this._handle.aborted()){this._halted=!0;return}var y=i.meta.cursor;this._finished||(this._partialLine=h.substring(y-this._baseIndex),this._baseIndex=y),i&&i.data&&(this._rowCount+=i.data.length);var E=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(ue)R.postMessage({results:i,workerId:l.WORKER_ID,finished:E});else if(g(this._config.chunk)&&!s){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted()){this._halted=!0;return}i=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),!this._completed&&E&&g(this._config.complete)&&(!i||!i.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!E&&(!i||!i.meta.paused)&&this._nextChunk(),i},this._sendError=function(r){g(this._config.error)?this._config.error(r):ue&&this._config.error&&R.postMessage({workerId:l.WORKER_ID,error:r,finished:!1})};function t(r){var s=he(r);s.chunkSize=parseInt(s.chunkSize),!r.step&&!r.chunk&&(s.chunkSize=null),this._handle=new ce(s),this._handle.streamer=this,this._config=s}}function G(e){e=e||{},e.chunkSize||(e.chunkSize=l.RemoteChunkSize),z.call(this,e);var t;Y?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(s){this._input=s,this._nextChunk()},this._readChunk=function(){if(this._finished){this._chunkLoaded();return}if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),Y||(t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!Y),this._config.downloadRequestHeaders){var s=this._config.downloadRequestHeaders;for(var n in s)t.setRequestHeader(n,s[n])}if(this._config.chunkSize){var p=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+p)}try{t.send(this._config.downloadRequestBody)}catch(h){this._chunkError(h.message)}Y&&t.status===0&&this._chunkError()},this._chunkLoaded=function(){if(t.readyState===4){if(t.status<200||t.status>=400){this._chunkError();return}this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=r(t),this.parseChunk(t.responseText)}},this._chunkError=function(s){var n=t.statusText||s;this._sendError(new Error(n))};function r(s){var n=s.getResponseHeader("Content-Range");return n===null?-1:parseInt(n.substring(n.lastIndexOf("/")+1))}}G.prototype=Object.create(z.prototype),G.prototype.constructor=G;function ee(e){e=e||{},e.chunkSize||(e.chunkSize=l.LocalChunkSize),z.call(this,e);var t,r,s=typeof FileReader<"u";this.stream=function(n){this._input=n,r=n.slice||n.webkitSlice||n.mozSlice,s?(t=new FileReader,t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){!this._finished&&(!this._config.preview||this._rowCount=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(t.error)}}ee.prototype=Object.create(z.prototype),ee.prototype.constructor=ee;function Z(e){e=e||{},z.call(this,e);var t;this.stream=function(r){return t=r,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var r=this._config.chunkSize,s;return r?(s=t.substring(0,r),t=t.substring(r)):(s=t,t=""),this._finished=!t,this.parseChunk(s)}}}Z.prototype=Object.create(Z.prototype),Z.prototype.constructor=Z;function te(e){e=e||{},z.call(this,e);var t=[],r=!0,s=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=F(function(n){try{t.push(typeof n=="string"?n:n.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(p){this._streamError(p)}},this),this._streamError=F(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=F(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=F(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}te.prototype=Object.create(z.prototype),te.prototype.constructor=te;function re(e){var t=we("stream").Duplex,r=he(e),s=!0,n=!1,p=[],h=null;this._onCsvData=function(i){var y=i.data;!h.push(y)&&!this._handle.paused()&&this._handle.pause()},this._onCsvComplete=function(){h.push(null)},r.step=F(this._onCsvData,this),r.complete=F(this._onCsvComplete,this),z.call(this,r),this._nextChunk=function(){n&&p.length===1&&(this._finished=!0),p.length?p.shift()():s=!0},this._addToParseQueue=function(i,y){p.push(F(function(){if(this.parseChunk(typeof i=="string"?i:i.toString(r.encoding)),g(y))return y()},this)),s&&(s=!1,this._nextChunk())},this._onRead=function(){this._handle.paused()&&this._handle.resume()},this._onWrite=function(i,y,E){this._addToParseQueue(i,E)},this._onWriteComplete=function(){n=!0,this._addToParseQueue("")},this.getStream=function(){return h},h=new t({readableObjectMode:!0,decodeStrings:!1,read:F(this._onRead,this),write:F(this._onWrite,this)}),h.once("finish",F(this._onWriteComplete,this))}typeof PAPA_BROWSER_CONTEXT>"u"&&(re.prototype=Object.create(z.prototype),re.prototype.constructor=re);function ce(e){var t=Math.pow(2,53),r=-t,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,n=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,p=this,h=0,i=0,y,E,O=!1,d=!1,L,u=[],c={data:[],errors:[],meta:{}};if(g(e.step)){var Q=e.step;e.step=function(o){if(c=o,w())S();else{if(S(),c.data.length===0)return;h+=o.data.length,e.preview&&h>e.preview?E.abort():(c.data=c.data[0],Q(c,p))}}}this.parse=function(o,f,m){var b=e.quoteChar||'"';if(e.newline||(e.newline=this.guessLineEndings(o,b)),L=!1,e.delimiter)g(e.delimiter)&&(e.delimiter=e.delimiter(o),c.meta.delimiter=e.delimiter);else{var a=j(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);a.successful?e.delimiter=a.bestDelimiter:(L=!0,e.delimiter=l.DefaultDelimiter),c.meta.delimiter=e.delimiter}var C=he(e);return e.preview&&e.header&&C.preview++,y=o,E=new fe(C),c=E.parse(y,f,m),S(),O?{meta:{paused:!0}}:c||{meta:{paused:!1}}},this.paused=function(){return O},this.pause=function(){O=!0,E.abort(),y=g(e.chunk)?"":y.substring(E.getCharIndex())},this.resume=function(){p.streamer._halted?(O=!1,p.streamer.parseChunk(y,!0)):setTimeout(p.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,E.abort(),c.meta.aborted=!0,g(e.complete)&&e.complete(c),y=""},this.guessLineEndings=function(o,f){o=o.substring(0,1024*1024);var m=new RegExp(se(f)+"([^]*?)"+se(f),"gm");o=o.replace(m,"");var b=o.split("\r"),a=o.split(` -`),C=a.length>1&&a[0].length=b.length/2?`\r -`:"\r"};function v(o){return e.skipEmptyLines==="greedy"?o.join("").trim()==="":o.length===1&&o[0].length===0}function k(o){if(s.test(o)){var f=parseFloat(o);if(f>r&&f=u.length?"__parsed_extra":u[C]),e.transform&&(x=e.transform(x,A)),x=q(A,x),A==="__parsed_extra"?(a[A]=a[A]||[],a[A].push(x)):a[A]=x}return e.header&&(C>u.length?W("FieldMismatch","TooManyFields","Too many fields: expected "+u.length+" fields but parsed "+C,i+b):C"u"){x=P;continue}else P>0&&(X+=Math.abs(P-x),x=P)}H.data.length>0&&(K/=H.data.length-I),(typeof A>"u"||X<=A)&&(typeof J>"u"||K>J)&&K>1.99&&(A=X,C=ie,J=K)}return e.delimiter=C,{successful:!!C,bestDelimiter:C}}function W(o,f,m,b){var a={type:o,code:f,message:m};b!==void 0&&(a.row=b),c.errors.push(a)}}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e){e=e||{};var t=e.delimiter,r=e.newline,s=e.comments,n=e.step,p=e.preview,h=e.fastMode,i,y=null,E=!1;e.quoteChar===void 0||e.quoteChar===null?i='"':i=e.quoteChar;var O=i;if(e.escapeChar!==void 0&&(O=e.escapeChar),(typeof t!="string"||l.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),s===t)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||l.BAD_DELIMITERS.indexOf(s)>-1)&&(s=!1),r!==` -`&&r!=="\r"&&r!==`\r -`&&(r=` -`);var d=0,L=!1;this.parse=function(u,c,Q){if(typeof u!="string")throw new Error("Input must be a string");var v=u.length,k=t.length,S=r.length,w=s.length,M=g(n);d=0;var T=[],q=[],_=[],j=0;if(!u)return I();if(h||h!==!1&&u.indexOf(i)===-1){for(var W=u.split(r),o=0;o=p)return T=T.slice(0,p),I(!0)}}return I()}for(var f=u.indexOf(t,d),m=u.indexOf(r,d),b=new RegExp(se(O)+se(i),"g"),a=u.indexOf(i,d);;){if(u[d]===i){for(a=d,d++;;){if(a=u.indexOf(i,a+1),a===-1)return Q||q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:T.length,index:d}),X();if(a===v-1){var C=u.substring(d,a).replace(b,i);return X(C)}if(i===O&&u[a+1]===O){a++;continue}if(!(i!==O&&a!==0&&u[a-1]===O)){f!==-1&&f=p)return I(!0);break}q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:T.length,index:d}),a++}}continue}if(s&&_.length===0&&u.substring(d,d+w)===s){if(m===-1)return I();d=m+S,m=u.indexOf(r,d),f=u.indexOf(t,d);continue}if(f!==-1&&(f=p)return I(!0);continue}break}return X();function N(D){T.push(D),j=d}function ie(D){var P=0;if(D!==-1){var B=u.substring(a+1,D);B&&B.trim()===""&&(P=B.length)}return P}function X(D){return Q||(typeof D>"u"&&(D=u.substring(d)),_.push(D),d=v,N(_),M&&H()),I()}function K(D){d=D,N(_),_=[],m=u.indexOf(r,d)}function I(D){if(e.header&&!c&&T.length&&!E){let P=T[0],B=Object.create(null),le=new Set(P),ve=!1;for(let $=0;$"u"&&t&&(l.WORKER_ID=t.workerId),typeof t.input=="string")R.postMessage({workerId:l.WORKER_ID,results:l.parse(t.input,t.config),finished:!0});else if(R.File&&t.input instanceof File||t.input instanceof Object){var r=l.parse(t.input,t.config);r&&R.postMessage({workerId:l.WORKER_ID,results:r,finished:!0})}}function he(e){if(typeof e!="object"||e===null)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=he(e[r]);return t}function F(e,t){return function(){e.apply(t,arguments)}}function g(e){return typeof e=="function"}return l})});export{xe as a}; -/*! Bundled license information: - -papaparse/papaparse.js: - (* @license - Papa Parse - v5.5.3 - https://github.com/mholt/PapaParse - License: MIT - *) -*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-4KSZJAQK.js b/packages/just-bash/dist/bin/chunks/chunk-4KSZJAQK.js new file mode 100644 index 00000000..285fe177 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-4KSZJAQK.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a}from"./chunk-IEXQTXU5.js";import{a as d}from"./chunk-PBOVSFTJ.js";var S={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand +`,exitCode:2};try{let c=x(s),h=c==="0"||c===""?1:0;return{stdout:`${c} +`,stderr:"",exitCode:h}}catch(c){return{stdout:"",stderr:`expr: ${d(c.message)} +`,exitCode:2}}}};function x(s){if(s.length===1)return s[0];let r=0;function c(){let e=h();for(;r","<=",">="].includes(t)){r++;let o=g(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),l;t==="="?l=f?n===i:e===o:t==="!="?l=f?n!==i:e!==o:t==="<"?l=f?n"?l=f?n>i:e>o:t==="<="?l=f?n<=i:e<=o:l=f?n>=i:e>=o,e=l?"1":"0"}else break}return e}function g(){let e=p();for(;r=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),i=a(o).match(t);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return c()}var E={name:"expr",flags:[],needsArgs:!0};export{S as a,E as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-4OALHZXB.js b/packages/just-bash/dist/bin/chunks/chunk-4OALHZXB.js deleted file mode 100644 index 02037537..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-4OALHZXB.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -function n(e){return`'${e.replace(/'/g,"'\\''")}'`}function r(e){return e.map(n).join(" ")}export{r as a}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-4PRVMER6.js b/packages/just-bash/dist/bin/chunks/chunk-4PRVMER6.js deleted file mode 100644 index 20c546df..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-4PRVMER6.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -function r(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function n(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function c(...e){return Object.assign(Object.create(null),...e)}export{r as a,n as b,c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-4VDEBYW7.js b/packages/just-bash/dist/bin/chunks/chunk-4VDEBYW7.js deleted file mode 100644 index 62cf360e..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-4VDEBYW7.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -function n(e){return e instanceof Error?e.message:String(e)}export{n as a}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-54G6AE72.js b/packages/just-bash/dist/bin/chunks/chunk-54G6AE72.js deleted file mode 100644 index 483593a9..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-54G6AE72.js +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node -import{a as $}from"./chunk-JBABAK44.js";import{a as z,b as w}from"./chunk-GTNBSMZR.js";import{constants as x,gunzipSync as F,gzipSync as S}from"node:zlib";var O={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place). - -When no FILE is given, or when FILE is -, read from standard input. - -With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},U={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place). - -When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},D={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output. - -When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},T={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function E(e){return e.best?x.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?x.Z_BEST_SPEED:x.Z_DEFAULT_COMPRESSION}function k(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],r=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,o=10;if(t&4){if(o+2>e.length)return{originalName:null,mtime:null,headerSize:0};let n=e[o]|e[o+1]<<8;o+=2+n}let s=null;if(t&8){let n=o;for(;o0?new Date(r*1e3):null,headerSize:o}}function q(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function b(e){return e.length>=2&&e[0]===31&&e[1]===139}function m(e){return Buffer.from(e).toString("latin1")}function I(e){return e.limits?.maxOutputSize??0}function v(e,t){if(t>0){if(q(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return F(e,{maxOutputLength:t})}return F(e)}async function L(e,t,r,o,s,n){let a=r.suffix,f,p,d,c=I(e);if(t==="-"||t==="")if(d=Uint8Array.from(e.stdin,i=>i.charCodeAt(0)),s){if(!b(d))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: stdin: not in gzip format -`,exitCode:1};try{let i=v(d,c);return{stdout:m(i),stderr:"",exitCode:0}}catch(i){let l=i instanceof Error?i.message:"unknown error";return{stdout:"",stderr:`${o}: stdin: ${l} -`,exitCode:1}}}else{let i=E(r),l=S(d,{level:i});return{stdout:m(l),stderr:"",exitCode:0}}f=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(f)).isDirectory)return r.recursive?await P(e,f,r,o,s,n):r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: is a directory -- ignored -`,exitCode:1}}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory -`,exitCode:1}}try{d=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory -`,exitCode:1}}if(s){if(!t.endsWith(a))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: unknown suffix -- ignored -`,exitCode:1};if(!b(d))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format -`,exitCode:1};let i;try{i=v(d,c)}catch(l){let u=l instanceof Error?l.message:"unknown error";return{stdout:"",stderr:`${o}: ${t}: ${u} -`,exitCode:1}}if(n)return{stdout:m(i),stderr:"",exitCode:0};if(r.name){let l=k(d);l.originalName?p=e.fs.resolvePath(e.cwd,l.originalName):p=f.slice(0,-a.length)}else p=f.slice(0,-a.length);if(!r.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${o}: ${p} already exists; not overwritten -`,exitCode:1}}catch{}if(await e.fs.writeFile(p,i),!r.keep&&!n&&await e.fs.rm(f),r.verbose){let l=d.length>0?((1-d.length/i.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${l}% -- replaced with ${p.split("/").pop()} -`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(a))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t} already has ${a} suffix -- unchanged -`,exitCode:1};let i=E(r),l;try{l=S(d,{level:i})}catch(u){let g=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`${o}: ${t}: ${g} -`,exitCode:1}}if(n)return{stdout:m(l),stderr:"",exitCode:0};if(p=f+a,!r.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${o}: ${p} already exists; not overwritten -`,exitCode:1}}catch{}if(await e.fs.writeFile(p,l),!r.keep&&!n&&await e.fs.rm(f),r.verbose){let u=d.length>0?((1-l.length/d.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${u}% -- replaced with ${p.split("/").pop()} -`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function P(e,t,r,o,s,n){let a=await e.fs.readdir(t),f="",p="",d=0;for(let c of a){let i=e.fs.resolvePath(t,c),l=await e.fs.stat(i);if(l.isDirectory){let u=await P(e,i,r,o,s,n);f+=u.stdout,p+=u.stderr,u.exitCode!==0&&(d=u.exitCode)}else if(l.isFile){let u=r.suffix;if(s&&!c.endsWith(u)||!s&&c.endsWith(u))continue;let g=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,y=await L(e,g,r,o,s,n);f+=y.stdout,p+=y.stderr,y.exitCode!==0&&(d=y.exitCode)}}return{stdout:f,stderr:p,exitCode:d}}async function W(e,t,r,o){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory -`,exitCode:1}}}if(!b(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format -`,exitCode:1};let n=s.length,a=q(s),f=a>0?((1-n/a)*100).toFixed(1):"0.0",d=k(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${n.toString().padStart(10)} ${a.toString().padStart(10)} ${f.padStart(5)}% ${d} -`,stderr:"",exitCode:0}}async function A(e,t,r,o){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,n=>n.charCodeAt(0));else{let n=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory -`,exitCode:1}}}if(!b(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format -`,exitCode:1};try{return v(s,I(e)),r.verbose?{stdout:"",stderr:`${t}: OK -`,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(n){let a=n instanceof Error?n.message:"invalid";return{stdout:"",stderr:`${o}: ${t}: ${a} -`,exitCode:1}}}async function C(e,t,r){let o=r==="zcat"?D:r==="gunzip"?U:O;if(w(e))return z(o);let s=$(r,e,T);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let n=s.result.flags,a=s.result.positional,f=r==="gunzip"||r==="zcat"||n.decompress||n.uncompress,p=r==="zcat"||n.stdout||n.toStdout;if(n.list){a.length===0&&(a=["-"]);let l=` compressed uncompressed ratio uncompressed_name -`,u="",g=0;for(let y of a){let h=await W(t,y,n,r);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}if(n.test){a.length===0&&(a=["-"]);let l="",u="",g=0;for(let y of a){let h=await A(t,y,n,r);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}a.length===0&&(a=["-"]);let d="",c="",i=0;for(let l of a){let u=await L(t,l,n,r,f,p);d+=u.stdout,c+=u.stderr,u.exitCode!==0&&(i=u.exitCode)}return{stdout:d,stderr:c,exitCode:i}}var G={name:"gzip",async execute(e,t){return{...await C(e,t,"gzip"),stdoutEncoding:"binary"}}},M={name:"gunzip",async execute(e,t){return{...await C(e,t,"gunzip"),stdoutEncoding:"binary"}}},Z={name:"zcat",async execute(e,t){return{...await C(e,t,"zcat"),stdoutEncoding:"binary"}}},R={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},K={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},j={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0};export{G as a,M as b,Z as c,R as d,K as e,j as f}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-5G2VOPPJ.js b/packages/just-bash/dist/bin/chunks/chunk-5G2VOPPJ.js deleted file mode 100644 index 2c6db5f9..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-5G2VOPPJ.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -import{a as f,b as a,c}from"./chunk-GTNBSMZR.js";var u={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};function d(t){return Array.from(t).reverse().join("")}var v={name:"rev",execute:async(t,s)=>{if(a(t))return f(u);let o=[];for(let e of t)if(e==="--"){let r=t.indexOf(e);o.push(...t.slice(r+1));break}else{if(e.startsWith("-")&&e!=="-")return c("rev",e);o.push(e)}let n="",l=e=>{let r=e.split(` -`),i=e.endsWith(` -`)&&r[r.length-1]==="";return i&&r.pop(),r.map(d).join(` -`)+(i?` -`:"")};if(o.length===0){let e=s.stdin??"";n=l(e)}else for(let e of o)if(e==="-"){let r=s.stdin??"";n+=l(r)}else{let r=s.fs.resolvePath(s.cwd,e),i=await s.fs.readFile(r);if(i===null)return{exitCode:1,stdout:n,stderr:`rev: ${e}: No such file or directory -`};n+=l(i)}return{exitCode:0,stdout:n,stderr:""}}},m={name:"rev",flags:[],stdinType:"text",needsFiles:!0};export{v as a,m as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-5WFYIUU2.js b/packages/just-bash/dist/bin/chunks/chunk-5WFYIUU2.js deleted file mode 100644 index 18c001a5..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-5WFYIUU2.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -async function y(t,n,s){let{cmdName:r,allowStdinMarker:f=!0,stopOnError:a=!1,batchSize:u=100}=s;if(n.length===0)return{files:[{filename:"",content:t.stdin}],stderr:"",exitCode:0};let i=[],c="",l=0;for(let o=0;o{if(f&&e==="-")return{filename:"-",content:t.stdin,error:null};try{let h=t.fs.resolvePath(t.cwd,e),p=await t.fs.readFile(h,"binary");return{filename:e,content:p,error:null}}catch{return{filename:e,content:"",error:`${r}: ${e}: No such file or directory -`}}}));for(let e of m)if(e.error){if(c+=e.error,l=1,a)return{files:i,stderr:c,exitCode:l}}else i.push({filename:e.filename,content:e.content})}return{files:i,stderr:c,exitCode:l}}async function b(t,n,s){let r=await y(t,n,{...s,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(a=>a.content).join("")}}export{y as a,b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-5XSZHUEI.js b/packages/just-bash/dist/bin/chunks/chunk-5XSZHUEI.js new file mode 100644 index 00000000..b827a55e --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-5XSZHUEI.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as p}from"./chunk-NE4R2FVV.js";import{a as g}from"./chunk-I4IRHQDW.js";var x=`Usage: rmdir [-pv] DIRECTORY... +Remove empty directories. + +Options: + -p, --parents Remove DIRECTORY and its ancestors + -v, --verbose Output a diagnostic for every directory processed`,y={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},D={name:"rmdir",async execute(t,r){let e=p("rmdir",t,y);if(!e.ok)return e.error;if(e.result.flags.help)return{stdout:`${x} +`,stderr:"",exitCode:0};let a=e.result.flags.parents,o=e.result.flags.verbose,s=e.result.positional;if(s.length===0)return{stdout:"",stderr:`rmdir: missing operand +`,exitCode:1};let c="",n="",i=0;for(let u of s){let d=await b(r,u,a,o);c+=d.stdout,n+=d.stderr,d.exitCode!==0&&(i=d.exitCode)}return{stdout:c,stderr:n,exitCode:i}}};async function b(t,r,e,a){let o="",s="",n=t.fs.resolvePath(t.cwd,r),i=await v(t,n,r,a);if(o+=i.stdout,s+=i.stderr,i.exitCode!==0)return{stdout:o,stderr:s,exitCode:i.exitCode};if(e){let u=n,d=r;for(;;){let l=C(u),f=C(d);if(l===u||l==="/"||l==="."||f==="."||f==="")break;let m=await v(t,l,f,a);if(o+=m.stdout,m.exitCode!==0)break;u=l,d=f}}return{stdout:o,stderr:s,exitCode:0}}async function v(t,r,e,a){try{if(!await t.fs.exists(r))return{stdout:"",stderr:`rmdir: failed to remove '${e}': No such file or directory +`,exitCode:1};if(!(await t.fs.stat(r)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${e}': Not a directory +`,exitCode:1};if((await t.fs.readdir(r)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${e}': Directory not empty +`,exitCode:1};await t.fs.rm(r,{recursive:!1,force:!1});let n="";return a&&(n=`rmdir: removing directory, '${e}' +`),{stdout:n,stderr:"",exitCode:0}}catch(o){let s=g(o);return{stdout:"",stderr:`rmdir: failed to remove '${e}': ${s} +`,exitCode:1}}}function C(t){let r=t.replace(/\/+$/,""),e=r.lastIndexOf("/");return e===-1?".":e===0?"/":r.substring(0,e)}var $={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{D as a,$ as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-6FSBHK6H.js b/packages/just-bash/dist/bin/chunks/chunk-6FSBHK6H.js new file mode 100644 index 00000000..7b9c08cf --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-6FSBHK6H.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as u}from"./chunk-VZK4FHWJ.js";import{a as S}from"./chunk-PBOVSFTJ.js";import{a as y}from"./chunk-NE4R2FVV.js";import{a as m,b as C}from"./chunk-MUFNRCMY.js";var b={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax: + a-z character range + [:alnum:] all letters and digits + [:alpha:] all letters + [:digit:] all digits + [:lower:] all lowercase letters + [:upper:] all uppercase letters + [:space:] all whitespace + [:blank:] horizontal whitespace + [:punct:] all punctuation + [:print:] all printable characters + [:graph:] all printable characters except space + [:cntrl:] all control characters + [:xdigit:] all hexadecimal digits + \\n, \\t, \\r escape sequences`},w=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(r,o)=>String.fromCharCode(o)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(r,o)=>String.fromCharCode(33+o)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(r,o)=>String.fromCharCode(32+o)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",` +\r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);function x(r){let o="",e=0;for(;e65536)throw new Error(`tr: character range too large: '${r[e]}-${r[e+2]}'`);for(let l=a;l<=c;l++)o+=String.fromCharCode(l);e+=3;continue}o+=r[e],e++}return o}var z={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},M={name:"tr",async execute(r,o){if(C(r))return m(b);let e=y("tr",r,z);if(!e.ok)return e.error;let a=e.result.flags.complement||e.result.flags.complementUpper,c=e.result.flags.delete,l=e.result.flags.squeeze,p=e.result.positional;if(p.length<1)return{stdout:"",stderr:`tr: missing operand +`,exitCode:1};if(!c&&!l&&p.length<2)return{stdout:"",stderr:`tr: missing operand after SET1 +`,exitCode:1};let d,s;try{d=x(p[0]),s=p.length>1?x(p[1]):""}catch(n){return{stdout:"",stderr:`${S(n.message)} +`,exitCode:1}}let g=u(o.stdin),h=n=>{let t=d.includes(n);return a?!t:t},i="";if(c)for(let n of g)h(n)||(i+=n);else if(l&&p.length===1){let n="";for(let t of g)h(t)&&t===n||(i+=t,n=t)}else{if(a){let n=s.length>0?s[s.length-1]:"";for(let t of g)d.includes(t)?i+=t:i+=n}else{let n=new Map;for(let t=0;te.charCodeAt(0))};let d=[];for(let e of o){if(e==="-"){d.push(Uint8Array.from(r.stdin,t=>t.charCodeAt(0)));continue}try{let t=r.fs.resolvePath(r.cwd,e),s=await r.fs.readFileBuffer(t);d.push(s)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${e}: No such file or directory +`,exitCode:1}}}}let f=d.reduce((e,t)=>e+t.length,0),i=new Uint8Array(f),a=0;for(let e of d)i.set(e,a),a+=e.length;return{ok:!0,data:i}}var x={name:"base64",async execute(r,o){if(c(r))return u(b);let n=l("base64",r,m);if(!n.ok)return n.error;let d=n.result.flags.decode,f=n.result.flags.wrap,i=n.result.positional;try{if(d){let t=await p(o,i,"base64");if(!t.ok)return t.error;if(typeof Buffer<"u"){let g=Buffer.from(t.data).toString("utf8").replace(/\s/g,"");return{stdout:Buffer.from(g,"base64").toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let h=String.fromCharCode(...t.data).replace(/\s/g,"");return{stdout:atob(h),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let a=await p(o,i,"base64");if(!a.ok)return a.error;let e;if(typeof Buffer<"u"?e=Buffer.from(a.data).toString("base64"):e=btoa(String.fromCharCode(...a.data)),f>0){let t=[];for(let s=0;s0?` +`:"")}return{stdout:e,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input +`,exitCode:1}}}},v={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{x as a,v as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-77MLOOQS.js b/packages/just-bash/dist/bin/chunks/chunk-77MLOOQS.js new file mode 100644 index 00000000..c65fafc1 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-77MLOOQS.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as d}from"./chunk-B2DRBHGQ.js";import{a as n,b as i}from"./chunk-KRRM5UCC.js";import{a,b as l}from"./chunk-MUFNRCMY.js";var u={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be: + s - seconds (default) + m - minutes + h - hours + d - days + +NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},m=36e5,h={name:"sleep",async execute(r,s){if(l(r))return a(u);if(r.length===0)return{stdout:"",stderr:`sleep: missing operand +`,exitCode:1};let t=0;for(let e of r){let o=d(e);if(o===null)return{stdout:"",stderr:`sleep: invalid time interval '${e}' +`,exitCode:1};t+=o}return t>m&&(t=m),s.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(s.sleep?await s.sleep(t):s.signal?await new Promise(e=>{let o=()=>{i(p),e()},p=n(()=>{s.signal?.removeEventListener("abort",o),e()},t);s.signal?.addEventListener("abort",o,{once:!0})}):await new Promise(e=>n(e,t)),{stdout:"",stderr:"",exitCode:0})}},b={name:"sleep",flags:[],needsArgs:!0};export{h as a,b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7ADG3DNO.js b/packages/just-bash/dist/bin/chunks/chunk-7ADG3DNO.js deleted file mode 100644 index 57b6eb22..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-7ADG3DNO.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node -import{a as w,b as v,c as $}from"./chunk-GTNBSMZR.js";var R={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},C={name:"chmod",async execute(s,a){if(v(s))return w(R);if(s.length<2)return{stdout:"",stderr:`chmod: missing operand -`,exitCode:1};let e=!1,c=!1,i=0;for(;i0&&t[t.length-1]===""&&t.pop(),t.length===0)return{stdout:"",stderr:"",exitCode:0};let n=[],i=t[0],s=1,O=(e,u)=>a?e.toLowerCase()===u.toLowerCase():e===u;for(let e=1;ee.count>1):C&&(c=n.filter(e=>e.count===1));let l="";for(let{line:e,count:u}of c)q?l+=`${String(u).padStart(4)} ${e} +`:l+=`${e} +`;return a?{stdout:l,stderr:"",exitCode:0}:{stdout:l,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},k={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{$ as a,k as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7BORMNPQ.js b/packages/just-bash/dist/bin/chunks/chunk-7BORMNPQ.js deleted file mode 100644 index f493fe12..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-7BORMNPQ.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a as s}from"./chunk-OBI37ZY4.js";var a=s("sha1sum","sha1","compute SHA1 message digest"),m={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0};export{a,m as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7G3MC56B.js b/packages/just-bash/dist/bin/chunks/chunk-7G3MC56B.js deleted file mode 100644 index 27e7cb18..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-7G3MC56B.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -import{a as f}from"./chunk-RLNOQILG.js";import{a as d}from"./chunk-JBABAK44.js";import{a as l}from"./chunk-4VDEBYW7.js";var p={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},b={name:"mkdir",async execute(m,t){let e=d("mkdir",m,p);if(!e.ok)return e.error;let u=e.result.flags.recursive,g=e.result.flags.verbose,n=e.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand -`,exitCode:1};let a="",o="",c=0;for(let r of n)try{let i=t.fs.resolvePath(t.cwd,r);await t.fs.mkdir(i,{recursive:u}),g&&(a+=`mkdir: created directory '${r}' -`)}catch(i){let s=l(i);s.includes("ENOENT")||s.includes("no such file")?o+=`mkdir: cannot create directory '${r}': No such file or directory -`:s.includes("EEXIST")||s.includes("already exists")?o+=`mkdir: cannot create directory '${r}': File exists -`:o+=`mkdir: cannot create directory '${r}': ${f(s)} -`,c=1}return{stdout:a,stderr:o,exitCode:c}}},h={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{b as a,h as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7JZKVC3F.js b/packages/just-bash/dist/bin/chunks/chunk-7JZKVC3F.js new file mode 100644 index 00000000..83319a70 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-7JZKVC3F.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); diff --git a/packages/just-bash/dist/bin/chunks/chunk-7NC4CPHS.js b/packages/just-bash/dist/bin/chunks/chunk-7NC4CPHS.js new file mode 100644 index 00000000..f5a27432 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-7NC4CPHS.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as D}from"./chunk-VZK4FHWJ.js";import{a as N}from"./chunk-NE4R2FVV.js";import{a as H,b as A}from"./chunk-MUFNRCMY.js";var b=class{diff(e,n,t={}){let i;typeof t=="function"?(i=t,t={}):"callback"in t&&(i=t.callback);let d=this.castInput(e,t),o=this.castInput(n,t),s=this.removeEmpty(this.tokenize(d,t)),a=this.removeEmpty(this.tokenize(o,t));return this.diffWithOptionsObj(s,a,t,i)}diffWithOptionsObj(e,n,t,i){var d;let o=l=>{if(l=this.postProcess(l,t),i){setTimeout(function(){i(l)},0);return}else return l},s=n.length,a=e.length,u=1,r=s+a;t.maxEditLength!=null&&(r=Math.min(r,t.maxEditLength));let g=(d=t.timeout)!==null&&d!==void 0?d:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],C=this.extractCommon(m[0],n,e,0,t);if(m[0].oldPos+1>=a&&C+1>=s)return o(this.buildValues(m[0].lastComponent,n,e));let P=-1/0,x=1/0,L=()=>{for(let l=Math.max(P,-u);l<=Math.min(x,u);l+=2){let c,h=m[l-1],p=m[l+1];h&&(m[l-1]=void 0);let y=!1;if(p){let S=p.oldPos-l;y=p&&0<=S&&S=a&&C+1>=s)return o(this.buildValues(c.lastComponent,n,e))||!0;m[l]=c,c.oldPos+1>=a&&(x=Math.min(x,l-1)),C+1>=s&&(P=Math.max(P,l+1))}u++};if(i)(function l(){setTimeout(function(){if(u>r||Date.now()>w)return i(void 0);L()||l()},0)})();else for(;u<=r&&Date.now()<=w;){let l=L();if(l)return l}}addToPath(e,n,t,i,d){let o=e.lastComponent;return o&&!d.oneChangePerToken&&o.added===n&&o.removed===t?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:t,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:t,previousComponent:o}}}extractCommon(e,n,t,i,d){let o=n.length,s=t.length,a=e.oldPos,u=a-i,r=0;for(;u+1w.length?C:w}),r.value=this.join(g)}else r.value=this.join(n.slice(a,a+r.count));a+=r.count,r.added||(u+=r.count)}}return i}};var I=class extends b{constructor(){super(...arguments),this.tokenize=W}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(` +`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),n.endsWith(` +`)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},O=new I;function T(f,e,n){return O.diff(f,e,n)}function W(f,e){e.stripTrailingCr&&(f=f.replace(/\r\n/g,` +`));let n=[],t=f.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let i=0;i"u"&&(s.context=4);let a=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){let{callback:r}=s;T(n,t,Object.assign(Object.assign({},s),{callback:g=>{let w=u(g);r(w)}}))}else return u(T(n,t,s));function u(r){if(!r)return;r.push({value:"",lines:[]});function g(l){return l.map(function(c){return" "+c})}let w=[],m=0,C=0,P=[],x=1,L=1;for(let l=0;l0?g(p.lines.slice(-a)):[],m-=P.length,C-=P.length)}for(let p of h)P.push((c.added?"+":"-")+p);c.added?L+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&l1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return f.map(t=>E(t,e)).join(` +`)}let n=[];e.includeIndex&&f.oldFileName==f.newFileName&&n.push("Index: "+f.oldFileName),e.includeUnderline&&n.push("==================================================================="),e.includeFileHeaders&&(n.push("--- "+f.oldFileName+(typeof f.oldHeader>"u"?"":" "+f.oldHeader)),n.push("+++ "+f.newFileName+(typeof f.newHeader>"u"?"":" "+f.newHeader)));for(let t=0;t{s(a?E(a,o.headerOptions):void 0)}}))}else{let s=F(f,e,n,t,i,d,o);return s?E(s,o?.headerOptions):void 0}}function R(f){let e=f.endsWith(` +`),n=f.split(` +`).map(t=>t+` +`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}var z={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},_={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},ee={name:"diff",async execute(f,e){if(A(f))return H(z);let n=N("diff",f,_);if(!n.ok)return n.error;let t=n.result.flags.brief,i=n.result.flags.reportSame,d=n.result.flags.ignoreCase,o=n.result.positional;if(n.result.flags.unified,o.length<2)return{stdout:"",stderr:`diff: missing operand +`,exitCode:2};let s,a,[u,r]=o;try{s=u==="-"?D(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory +`,exitCode:2}}try{a=r==="-"?D(e.stdin):await e.fs.readFile(e.fs.resolvePath(e.cwd,r))}catch{return{stdout:"",stderr:`diff: ${r}: No such file or directory +`,exitCode:2}}let g=s,w=a;return d&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?i?{stdout:`Files ${u} and ${r} are identical +`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:t?{stdout:`Files ${u} and ${r} differ +`,stderr:"",exitCode:1}:{stdout:k(u,r,s,a,"","",{context:3}),stderr:"",exitCode:1}}},ne={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{ee as a,ne as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7UU7KPEM.js b/packages/just-bash/dist/bin/chunks/chunk-7UU7KPEM.js new file mode 100644 index 00000000..48c72315 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-7UU7KPEM.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{c as u}from"./chunk-MROECM42.js";import{a as l}from"./chunk-VZK4FHWJ.js";import{a as d,b as h}from"./chunk-MUFNRCMY.js";var m={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},F={name:"bash",async execute(t,e){if(h(t))return d(m);if(t[0]==="-c"&&t.length>=2){let s=t[1],n=t[2]||"bash",c=t.slice(3);return r(s,n,c,e)}if(t.length===0){let s=l(e.stdin);return s.trim()?r(s,"bash",[],e):{stdout:"",stderr:"",exitCode:0}}let o=t[0],i=t.slice(1);try{let s=e.fs.resolvePath(e.cwd,o),n=await e.fs.readFile(s);return r(n,o,i,e)}catch{return{stdout:"",stderr:`bash: ${o}: No such file or directory +`,exitCode:127}}}},P={name:"sh",async execute(t,e){if(h(t))return d({...m,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let s=t[1],n=t[2]||"sh",c=t.slice(3);return r(s,n,c,e)}if(t.length===0){let s=l(e.stdin);return s.trim()?r(s,"sh",[],e):{stdout:"",stderr:"",exitCode:0}}let o=t[0],i=t.slice(1);try{let s=e.fs.resolvePath(e.cwd,o),n=await e.fs.readFile(s);return r(n,o,i,e)}catch{return{stdout:"",stderr:`sh: ${o}: No such file or directory +`,exitCode:127}}}};async function r(t,e,o,i){if(!i.exec)return{stdout:"",stderr:`bash: internal error: exec function not available +`,exitCode:1};let s=u(i.exportedEnv||{},{0:e,"#":String(o.length),"@":o.join(" "),"*":o.join(" ")});o.forEach((a,p)=>{s[String(p+1)]=a});let n=t;if(n.startsWith("#!")){let a=n.indexOf(` +`);a!==-1&&(n=n.slice(a+1))}return await i.exec(n,{env:s,cwd:i.cwd,stdin:i.stdin,stdinKind:"bytes",signal:i.signal})}var T={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},v={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"};export{F as a,P as b,T as c,v as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-7VCQWCSH.js b/packages/just-bash/dist/bin/chunks/chunk-7VCQWCSH.js new file mode 100644 index 00000000..529ca43f --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-7VCQWCSH.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as c,b as u,c as d}from"./chunk-MUFNRCMY.js";var p={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function x(n){return n>=32&&n<=126||n===9}function g(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function h(n,s){let o=[],r="",i=0,a=typeof n=="string"?new TextEncoder().encode(n):n;for(let l=0;l=s.minLength){let e=g(i,s.offsetFormat);o.push(`${e}${r}`)}r=""}}if(r.length>=s.minLength){let l=g(i,s.offsetFormat);o.push(`${l}${r}`)}return o}var v={name:"strings",execute:async(n,s)=>{if(u(n))return c(p);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;iUint8Array.from(s.stdin??"",t=>t.charCodeAt(0));if(r.length===0){let t=h(l(),o);a=t.length>0?`${t.join(` +`)} +`:""}else for(let t of r){let e;if(t==="-")e=l();else{let m=s.fs.resolvePath(s.cwd,t);try{e=await s.fs.readFileBuffer(m)}catch{return{exitCode:1,stdout:a,stderr:`strings: ${t}: No such file or directory +`}}}let f=h(e,o);f.length>0&&(a+=`${f.join(` +`)} +`)}return{exitCode:0,stdout:a,stderr:""}}},F={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0};export{v as a,F as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AAW7UMPO.js b/packages/just-bash/dist/bin/chunks/chunk-AAW7UMPO.js deleted file mode 100644 index 52d2df19..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-AAW7UMPO.js +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -import{a as v}from"./chunk-4PRVMER6.js";import{a as c,b as f,c as m}from"./chunk-GTNBSMZR.js";var g={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},w={name:"env",async execute(o,i){if(f(o))return c(g);let a=!1,r=[],u=new Map,t=-1;for(let n=0;n0?` -`:""),stderr:"",exitCode:0}}if(!i.exec)return{stdout:"",stderr:`env: command execution not supported in this context -`,exitCode:1};let p=o.slice(t);return i.exec("command",{cwd:i.cwd,env:v(s),replaceEnv:!0,stdin:i.stdin,signal:i.signal,args:p})}},x={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},E={name:"printenv",async execute(o,i){if(f(o))return c(x);let a=o.filter(t=>!t.startsWith("-"));if(a.length===0){let t=[];for(let[s,p]of i.env)t.push(`${s}=${p}`);return{stdout:t.join(` -`)+(t.length>0?` -`:""),stderr:"",exitCode:0}}let r=[],u=0;for(let t of a){let s=i.env.get(t);s!==void 0?r.push(s):u=1}return{stdout:r.join(` -`)+(r.length>0?` -`:""),stderr:"",exitCode:u}}},M={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},N={name:"printenv",flags:[]};export{w as a,E as b,M as c,N as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AGKL4LDL.js b/packages/just-bash/dist/bin/chunks/chunk-AGKL4LDL.js new file mode 100644 index 00000000..84c1bd2c --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-AGKL4LDL.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as d}from"./chunk-NE4R2FVV.js";import{a as p,b as l}from"./chunk-MUFNRCMY.js";var m={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},u={append:{short:"a",long:"append",type:"boolean"}},w={name:"tee",async execute(r,e){if(l(r))return p(m);let t=d("tee",r,u);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,s="",a=0;for(let i of c)try{let n=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(n,o,"binary"):await e.fs.writeFile(n,o,"binary")}catch{s+=`tee: ${i}: No such file or directory +`,a=1}return{stdout:o,stderr:s,exitCode:a,stdoutEncoding:"binary"}}},b={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0};export{w as a,b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AJF3OBTR.js b/packages/just-bash/dist/bin/chunks/chunk-AJF3OBTR.js new file mode 100644 index 00000000..f5bf54e1 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-AJF3OBTR.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +async function t(e,n){return{stdout:`localhost +`,stderr:"",exitCode:0}}var o={name:"hostname",execute:t},s={name:"hostname",flags:[]};export{o as a,s as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-ALVEEXFD.js b/packages/just-bash/dist/bin/chunks/chunk-ALVEEXFD.js new file mode 100644 index 00000000..7708a1d3 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-ALVEEXFD.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as W}from"./chunk-IEXQTXU5.js";function _(n,t){let e=n.ignoreCase?t.toLowerCase():t,i=n.needles;for(let l=0;l]+)>)/g,(e,i,l)=>{if(i==="&")return t[0];if(l!==void 0)return t.groups?.[l]??"";let o=parseInt(i,10);return t[o]??""})}function Q(n,t,e={}){let{invertMatch:i=!1,showLineNumbers:l=!1,countOnly:o=!1,countMatches:u=!1,filename:a="",onlyMatching:p=!1,beforeContext:k=0,afterContext:v=0,maxCount:A=0,contextSeparator:T="--",showColumn:O=!1,vimgrep:N=!1,showByteOffset:y=!1,replace:R=null,passthru:z=!1,multiline:U=!1,kResetGroup:P,preFilter:b}=e;if(U)return X(n,t,{invertMatch:i,showLineNumbers:l,countOnly:o,countMatches:u,filename:a,onlyMatching:p,beforeContext:k,afterContext:v,maxCount:A,contextSeparator:T,showColumn:O,showByteOffset:y,replace:R,kResetGroup:P});let M=n.split(` +`),j=M.length,L=j>0&&M[j-1]===""?j-1:j;if(o||u){let c=0,s=(u||p)&&!i;for(let h=0;h0,matchCount:c}}if(k===0&&v===0&&!z){let c=[],s=!1,d=0,h=0;for(let r=0;r0&&d>=A);r++){let m=M[r],I=null;if(b&&!_(b,m)||(t.lastIndex=0,I=t.exec(m)),I!==null!==i)if(s=!0,d++,p)for(let g=I;g!==null;g=t.exec(m)){let F=P!==void 0?g[P]??"":g[0],E=R!==null?D(R,g):F,x=a?`${a}:`:"";y&&(x+=`${h+g.index}:`),l&&(x+=`${r+1}:`),O&&(x+=`${g.index+1}:`),c.push(x+E),g[0].length===0&&t.lastIndex++}else if(N)for(let g=I;g!==null;g=t.exec(m)){let F=a?`${a}:`:"";y&&(F+=`${h+g.index}:`),l&&(F+=`${r+1}:`),O&&(F+=`${g.index+1}:`),c.push(F+m),g[0].length===0&&t.lastIndex++}else{let g=I?I.index+1:1,F=m;R!==null&&(t.lastIndex=0,F=t.replace(m,(...x)=>{if(x[0].length===0)return"";let G=x,B=x[x.length-1];return typeof B=="object"&&B!==null?(G.groups=B,G.input=x[x.length-2],G.index=x[x.length-3]):(G.input=x[x.length-1],G.index=x[x.length-2]),D(R,G)}));let E=a?`${a}:`:"";y&&(E+=`${h+(I?I.index:0)}:`),l&&(E+=`${r+1}:`),O&&(E+=`${g}:`),c.push(E+F)}h+=m.length+1}return{output:c.length>0?`${c.join(` +`)} +`:"",matched:s,matchCount:d}}if(z){let c=[],s=!1,d=0;for(let h=0;h0?`${c.join(` +`)} +`:"",matched:s,matchCount:d}}let C=[],S=0,w=new Set,f=-1,$=[];for(let c=0;c0&&S>=A);c++){let s=M[c],d;b&&!_(b,s)?d=!1:(t.lastIndex=0,d=t.test(s)),d!==i&&($.push(c),S++)}for(let c of $){let s=Math.max(0,c-k);f>=0&&s>f+1&&C.push(T);for(let h=s;h0?`${C.join(` +`)} +`:"",matched:S>0,matchCount:S}}function X(n,t,e){let{invertMatch:i,showLineNumbers:l,countOnly:o,countMatches:u,filename:a,onlyMatching:p,beforeContext:k,afterContext:v,maxCount:A,contextSeparator:T,showColumn:O,showByteOffset:N,replace:y,kResetGroup:R}=e,z=n.split(` +`),U=z.length,P=U>0&&z[U-1]===""?U-1:U,b=[0];for(let f=0;f{let $=0;for(let c=0;cf);c++)$=c;return $},j=f=>{let $=M(f);return f-b[$]+1},L=[];t.lastIndex=0;for(let f=t.exec(n);f!==null&&!(A>0&&L.length>=A);f=t.exec(n)){let $=M(f.index),c=M(f.index+Math.max(0,f[0].length-1)),s=R!==void 0?f[R]??"":f[0];L.push({startLine:$,endLine:c,byteOffset:f.index,column:j(f.index),matchText:s}),f[0].length===0&&t.lastIndex++}if(o||u){let f;if(u)f=i?0:L.length;else{let c=new Set;for(let s of L)for(let d=s.startLine;d<=s.endLine;d++)c.add(d);f=i?P-c.size:c.size}return{output:`${a?`${a}:${f}`:String(f)} +`,matched:f>0,matchCount:f}}if(i){let f=new Set;for(let c of L)for(let s=c.startLine;s<=c.endLine;s++)f.add(s);let $=[];for(let c=0;c0?`${$.join(` +`)} +`:"",matched:$.length>0,matchCount:$.length}}if(L.length===0)return{output:"",matched:!1,matchCount:0};let C=new Set,S=-1,w=[];for(let f of L){let $=Math.max(0,f.startLine-k),c=Math.min(P-1,f.endLine+v);S>=0&&$>S+1&&w.push(T);for(let s=$;s0?`${w.join(` +`)} +`:"",matched:!0,matchCount:L.length}}var q=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]]);function K(n){let t="",e=0;for(;e:]]"){t+="\\b",e+=7;continue}if(n[e]==="["){let i="[";for(e++,e]+)>/g,"(?<$1>"),t.mode==="perl"){e=ee(e),e=ne(e),e=te(e);let a=oe(e);e=a.pattern,i=a.kResetGroup}break}default:e=K(n),e=he(e);break}t.wholeWord&&(e=`\\b(?:${e})\\b`),t.lineRegexp&&(e=`^${e}$`);let l=/\\u\{[0-9A-Fa-f]+\}/.test(e),o="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(l?"u":""),u=J(e,t.ignoreCase??!1);return{regex:W(e,o),kResetGroup:i,preFilter:u??void 0}}function J(n,t){let e=n;if(e.startsWith("\\b(?:")&&e.endsWith(")\\b")?e=e.slice(5,e.length-3):e.startsWith("\\b")&&e.endsWith("\\b")&&e.length>=4&&(e=e.slice(2,e.length-2)),e.length===0)return null;let i=V(e);if(i===null)return null;let l=[];for(let o of i){let u=Y(o);if(u===null||u.length===0)return null;l.push(u)}return l.length===0?null:{needles:t?l.map(o=>o.toLowerCase()):l,ignoreCase:t}}function V(n){let t=[],e=0,i=!1,l=0;for(let o=0;o0&&e+1=0&&n[i]==="\\";)e++,i--;if(e%2===0)return t}t+=2}else t++;return-1}function ce(n){let t=0,e=0;for(;e"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function he(n){let t="",e=0,i=!0,l=0;for(;e{let y=p(h,e[0],n)[0],l=p(a,e[0],n)[0];return u(y,l)})];case"bsearch":{if(!Array.isArray(t)){let h=t===null?"null":typeof t=="object"?"object":typeof t;throw new Error(`${h} (${JSON.stringify(t)}) cannot be searched from`)}return e.length===0?[null]:p(t,e[0],n).map(h=>{let a=0,y=t.length;for(;a>>1;u(t[l],h)<0?a=l+1:y=l}return au(a.key,y.key)),[h.map(a=>a.item)]}case"group_by":{if(!Array.isArray(t)||e.length===0)return[null];let i=new Map;for(let h of t){let a=JSON.stringify(p(h,e[0],n)[0]);i.has(a)||i.set(a,[]),i.get(a)?.push(h)}return[[...i.values()]]}case"max":return Array.isArray(t)&&t.length>0?[t.reduce((i,h)=>u(i,h)>0?i:h)]:[null];case"max_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((i,h)=>{let a=p(i,e[0],n)[0],y=p(h,e[0],n)[0];return u(a,y)>0?i:h})];case"min":return Array.isArray(t)&&t.length>0?[t.reduce((i,h)=>u(i,h)<0?i:h)]:[null];case"min_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((i,h)=>{let a=p(i,e[0],n)[0],y=p(h,e[0],n)[0];return u(a,y)<0?i:h})];case"add":{let i=h=>{let a=h.filter(y=>y!==null);return a.length===0?null:a.every(y=>typeof y=="number")?a.reduce((y,l)=>y+l,0):a.every(y=>typeof y=="string")?a.join(""):a.every(y=>Array.isArray(y))?a.flat():a.every(y=>y&&typeof y=="object"&&!Array.isArray(y))?lt(...a):null};if(e.length>=1){let h=p(t,e[0],n);return[i(h)]}return Array.isArray(t)?[i(t)]:[null]}case"any":{if(e.length>=2){try{let i=o(t,e[0],n);for(let h of i)if(p(h,e[1],n).some(c))return[!0]}catch(i){if(i instanceof f)throw i}return[!1]}return e.length===1?Array.isArray(t)?[t.some(i=>c(p(i,e[0],n)[0]))]:[!1]:Array.isArray(t)?[t.some(c)]:[!1]}case"all":{if(e.length>=2){try{let i=o(t,e[0],n);for(let h of i)if(!p(h,e[1],n).some(c))return[!1]}catch(i){if(i instanceof f)throw i}return[!0]}return e.length===1?Array.isArray(t)?[t.every(i=>c(p(i,e[0],n)[0]))]:[!0]:Array.isArray(t)?[t.every(c)]:[!0]}case"select":return e.length===0?[t]:p(t,e[0],n).some(c)?[t]:[];case"map":return e.length===0||!Array.isArray(t)?[null]:[t.flatMap(h=>p(h,e[0],n))];case"map_values":{if(e.length===0)return[null];if(Array.isArray(t))return[t.flatMap(i=>p(i,e[0],n))];if(t&&typeof t=="object"){let i=Object.create(null);for(let[h,a]of Object.entries(t)){if(!g(h))continue;let y=p(a,e[0],n);y.length>0&&A(i,h,y[0])}return[i]}return[null]}case"has":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(t)&&typeof h=="number"?[h>=0&&h=0&&t0)try{let s=o(t,e[0],n);return s.length>0?[s[0]]:[]}catch(s){if(s instanceof c)throw s;return[]}return Array.isArray(t)&&t.length>0?[t[0]]:[null];case"last":if(e.length>0){let s=p(t,e[0],n);return s.length>0?[s[s.length-1]]:[]}return Array.isArray(t)&&t.length>0?[t[t.length-1]]:[null];case"nth":{if(e.length<1)return[null];let s=p(t,e[0],n);if(e.length>1){for(let i of s)if(i<0)throw new Error("nth doesn't support negative indices");let f;try{f=o(t,e[1],n)}catch(i){if(i instanceof c)throw i;f=[]}return s.flatMap(i=>{let h=i;return h{let i=f;if(i<0)throw new Error("nth doesn't support negative indices");return il.length>=s,i=p(t,e[0],n);if(e.length===1){let l=[];for(let m of i){let b=m;for(let w=0;w0){for(let C=w;Ck;C+=N)if(y.push(C),f(y))return y}}return y}case"limit":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let i=f;if(i<0)throw new Error("limit doesn't support negative count");if(i===0)return[];let h;try{h=o(t,e[1],n)}catch(a){if(a instanceof c)throw a;h=[]}return h.slice(0,i)});case"isempty":{if(e.length<1)return[!0];try{return[o(t,e[0],n).length===0]}catch(s){if(s instanceof c)throw s;return[!0]}}case"isvalid":{if(e.length<1)return[!0];try{return[p(t,e[0],n).length>0]}catch(s){if(s instanceof c)throw s;return[!1]}}case"skip":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let i=f;if(i<0)throw new Error("skip doesn't support negative count");return p(t,e[1],n).slice(i)});case"until":{if(e.length<2)return[t];let s=t,f=n.limits.maxIterations;for(let i=0;i=i)throw new c(`jq while: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations");return s}case"repeat":{if(e.length===0)return[t];let s=[],f=t,i=n.limits.maxIterations;for(let h=0;h=i)throw new c(`jq repeat: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations");return s}default:return null}}function Z(t,r,e,n,p){switch(r){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof t!="number")return[null];let o=new Date(t*1e3),u=o.getUTCFullYear(),c=o.getUTCMonth(),s=o.getUTCDate(),f=o.getUTCHours(),i=o.getUTCMinutes(),h=o.getUTCSeconds(),a=o.getUTCDay(),y=Date.UTC(u,0,1),l=Math.floor((o.getTime()-y)/(1440*60*1e3));return[[u,c,s,f,i,h,a,l]]}case"mktime":{if(!Array.isArray(t))throw new Error("mktime requires parsed datetime inputs");let[o,u,c,s=0,f=0,i=0]=t;if(typeof o!="number"||typeof u!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(o,u,c??1,s??0,f??0,i??0);return[Math.floor(h/1e3)]}case"strftime":{if(e.length===0)return[null];let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strftime/1 requires a string format");let c;if(typeof t=="number")c=new Date(t*1e3);else if(Array.isArray(t)){let[a,y,l,m=0,b=0,w=0]=t;if(typeof a!="number"||typeof y!="number")throw new Error("strftime/1 requires parsed datetime inputs");c=new Date(Date.UTC(a,y,l??1,m??0,b??0,w??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],i=(a,y=2)=>String(a).padStart(y,"0");return[u.replace(/%Y/g,String(c.getUTCFullYear())).replace(/%m/g,i(c.getUTCMonth()+1)).replace(/%d/g,i(c.getUTCDate())).replace(/%H/g,i(c.getUTCHours())).replace(/%M/g,i(c.getUTCMinutes())).replace(/%S/g,i(c.getUTCSeconds())).replace(/%A/g,s[c.getUTCDay()]).replace(/%B/g,f[c.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(e.length===0)return[null];if(typeof t!="string")throw new Error("strptime/1 requires a string input");let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strptime/1 requires a string format");if(u==="%Y-%m-%dT%H:%M:%SZ"){let s=t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(s){let[,f,i,h,a,y,l]=s.map(Number),m=new Date(Date.UTC(f,i-1,h,a,y,l)),b=m.getUTCDay(),w=Date.UTC(f,0,1),k=Math.floor((m.getTime()-w)/(1440*60*1e3));return[[f,i-1,h,a,y,l,b,k]]}}let c=new Date(t);if(!Number.isNaN(c.getTime())){let s=c.getUTCFullYear(),f=c.getUTCMonth(),i=c.getUTCDate(),h=c.getUTCHours(),a=c.getUTCMinutes(),y=c.getUTCSeconds(),l=c.getUTCDay(),m=Date.UTC(s,0,1),b=Math.floor((c.getTime()-m)/(1440*60*1e3));return[[s,f,i,h,a,y,l,b]]}throw new Error(`Cannot parse date: ${t}`)}case"fromdate":{if(typeof t!="string")throw new Error("fromdate requires a string input");let o=new Date(t);if(Number.isNaN(o.getTime()))throw new Error(`date "${t}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(o.getTime()/1e3)]}case"todate":{if(typeof t!="number")throw new Error("todate requires a number input");return[new Date(t*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}function S(t){return t!==!1&&t!==null}function I(t,r){return JSON.stringify(t)===JSON.stringify(r)}function U(t,r){return typeof t=="number"&&typeof r=="number"?t-r:typeof t=="string"&&typeof r=="string"?t.localeCompare(r):0}function v(t,r){let e=O(t);for(let n of Object.keys(r)){if(!g(n))continue;let p=T(e,n)?E(e[n]):null,o=E(r[n]);p&&o?A(e,n,v(p,o)):A(e,n,r[n])}return e}function D(t,r=3e3){let e=0,n=t;for(;ec===null?0:typeof c=="boolean"?1:typeof c=="number"?2:typeof c=="string"?3:Array.isArray(c)?4:typeof c=="object"?5:6,n=e(t),p=e(r);if(n!==p)return n-p;if(typeof t=="number"&&typeof r=="number")return t-r;if(typeof t=="string"&&typeof r=="string")return t.localeCompare(r);if(typeof t=="boolean"&&typeof r=="boolean")return(t?1:0)-(r?1:0);if(Array.isArray(t)&&Array.isArray(r)){for(let c=0;ct.some(o=>F(o,p)));let e=E(t),n=E(r);return e&&n?Object.keys(n).every(p=>T(e,p)&&F(e[p],n[p])):!1}var Ot=2e3;function tt(t,r,e){switch(r){case"@base64":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"utf-8").toString("base64")]:[btoa(t)]:[null];case"@base64d":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"base64").toString("utf-8")]:[atob(t)]:[null];case"@uri":return typeof t=="string"?[encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof t=="string"?[decodeURIComponent(t)]:[null];case"@csv":return Array.isArray(t)?[t.map(p=>{if(p===null)return"";if(typeof p=="boolean")return p?"true":"false";if(typeof p=="number")return String(p);let o=String(p);return o.includes(",")||o.includes('"')||o.includes(` -`)||o.includes("\r")?`"${o.replace(/"/g,'""')}"`:o}).join(",")]:[null];case"@tsv":return Array.isArray(t)?[t.map(n=>String(n??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let n=e??Ot;return D(t,n+1)>n?[null]:[JSON.stringify(t)]}case"@html":return typeof t=="string"?[t.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof t=="string"?[`'${t.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof t=="string"?[t]:t==null?[""]:[String(t)];default:return null}}function et(t,r,e,n,p,o){switch(r){case"index":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){if(c===""&&t==="")return null;let s=t.indexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let f=0;f<=t.length-c.length;f++){let i=!0;for(let h=0;ho(f,c));return s>=0?s:null}return null});case"rindex":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){let s=t.lastIndexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let s=t.length-c.length;s>=0;s--){let f=!0;for(let i=0;i=0;s--)if(o(t[s],c))return s;return null}return null});case"indices":return e.length===0?[[]]:p(t,e[0],n).map(c=>{let s=[];if(typeof t=="string"&&typeof c=="string"){let f=t.indexOf(c);for(;f!==-1;)s.push(f),f=t.indexOf(c,f+1)}else if(Array.isArray(t))if(Array.isArray(c)){let f=c.length;if(f===0)for(let i=0;i<=t.length;i++)s.push(i);else for(let i=0;i<=t.length-f;i++){let h=!0;for(let a=0;a{if(y.push(m),Array.isArray(m))for(let b of m)l(b);else if(m&&typeof m=="object")for(let b of Object.keys(m))l(m[b])};return l(t),y}let s=[],f=e.length>=2?e[1]:null,i=1e4,h=0,a=y=>{if(h++>i||f&&!p(y,f,n).some(o))return;s.push(y);let l=p(y,e[0],n);for(let m of l)m!=null&&a(m)};return a(t),s}case"recurse_down":return c(t,"recurse",e,n);case"walk":{if(e.length===0)return[t];let s=new WeakSet,f=i=>{if(i&&typeof i=="object"){if(s.has(i))return i;s.add(i)}let h;if(Array.isArray(i))h=i.map(f);else if(i&&typeof i=="object"){let y=Object.create(null);for(let[l,m]of Object.entries(i))g(l)&&A(y,l,f(m));h=y}else h=i;return p(h,e[0],n)[0]};return[f(t)]}case"transpose":{if(!Array.isArray(t))return[null];if(t.length===0)return[[]];let s=Math.max(...t.map(i=>Array.isArray(i)?i.length:0)),f=[];for(let i=0;iArray.isArray(h)?h[i]:null));return[f]}case"combinations":{if(e.length>0){let h=p(t,e[0],n)[0];if(!Array.isArray(t)||h<0)return[];if(h===0)return[[]];let a=[],y=(l,m)=>{if(m===h){a.push([...l]);return}for(let b of t)l.push(b),y(l,m+1),l.pop()};return y([],0),a}if(!Array.isArray(t))return[];if(t.length===0)return[[]];for(let i of t)if(!Array.isArray(i))return[];let s=[],f=(i,h)=>{if(i===t.length){s.push([...h]);return}let a=t[i];for(let y of a)h.push(y),f(i+1,h),h.pop()};return f(0,[]),s}case"parent":{if(n.root===void 0||n.currentPath===void 0)return[];let s=n.currentPath;if(s.length===0)return[];let f=e.length>0?p(t,e[0],n)[0]:1;if(f>=0){if(f>s.length)return[];let i=s.slice(0,s.length-f);return[u(n.root,i)]}else{let i=-f-1;if(i>=s.length)return[t];let h=s.slice(0,i);return[u(n.root,h)]}}case"parents":{if(n.root===void 0||n.currentPath===void 0)return[[]];let s=n.currentPath,f=[];for(let i=s.length-1;i>=0;i--)f.push(u(n.root,s.slice(0,i)));return[f]}case"root":return n.root!==void 0?[n.root]:[];default:return null}}var Nt=2e3;function st(t,r,e,n,p){switch(r){case"keys":return Array.isArray(t)?[t.map((o,u)=>u)]:t&&typeof t=="object"?[Object.keys(t).sort()]:[null];case"keys_unsorted":return Array.isArray(t)?[t.map((o,u)=>u)]:t&&typeof t=="object"?[Object.keys(t)]:[null];case"length":return typeof t=="string"?[t.length]:Array.isArray(t)?[t.length]:t&&typeof t=="object"?[Object.keys(t).length]:t===null?[0]:typeof t=="number"?[Math.abs(t)]:[null];case"utf8bytelength":{if(typeof t=="string")return[new TextEncoder().encode(t).length];let o=t===null?"null":Array.isArray(t)?"array":typeof t,u=o==="array"||o==="object"?JSON.stringify(t):String(t);throw new Error(`${o} (${u}) only strings have UTF-8 byte length`)}case"to_entries":{let o=E(t);return o?[Object.entries(o).map(([u,c])=>({key:u,value:c}))]:[null]}case"from_entries":if(Array.isArray(t)){let o=Object.create(null);for(let u of t){let c=E(u);if(c){let s=c.key??c.Key??c.name??c.Name??c.k,f=c.value??c.Value??c.v;if(s!==void 0){let i=String(s);g(i)&&A(o,i,f)}}}return[o]}return[null];case"with_entries":{if(e.length===0)return[t];let o=E(t);if(o){let c=Object.entries(o).map(([f,i])=>({key:f,value:i})).flatMap(f=>p(f,e[0],n)),s=Object.create(null);for(let f of c){let i=E(f);if(i){let h=i.key??i.name??i.k,a=i.value??i.v;if(h!==void 0){let y=String(h);g(y)&&A(s,y,a)}}}return[s]}return[null]}case"reverse":return Array.isArray(t)?[[...t].reverse()]:typeof t=="string"?[t.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(t)?(e.length>0?p(t,e[0],n):[Number.POSITIVE_INFINITY]).map(u=>{let c=u;if(c<0)throw new Error("flatten depth must not be negative");return t.flat(c)}):[null];case"unique":if(Array.isArray(t)){let o=new Set,u=[];for(let c of t){let s=JSON.stringify(c);o.has(s)||(o.add(s),u.push(c))}return[u]}return[null];case"tojson":case"tojsonstream":{let o=n.limits.maxDepth??Nt;return D(t,o+1)>o?[null]:[JSON.stringify(t)]}case"fromjson":{if(typeof t=="string"){let o=t.trim().toLowerCase();if(o==="nan")return[Number.NaN];if(o==="inf"||o==="infinity")return[Number.POSITIVE_INFINITY];if(o==="-inf"||o==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[at(JSON.parse(t))]}catch{throw new Error(`Invalid JSON: ${t}`)}}return[t]}case"tostring":return typeof t=="string"?[t]:[JSON.stringify(t)];case"tonumber":if(typeof t=="number")return[t];if(typeof t=="string"){let o=Number(t);if(Number.isNaN(o))throw new Error(`${JSON.stringify(t)} cannot be parsed as a number`);return[o]}throw new Error(`${typeof t} cannot be parsed as a number`);case"toboolean":{if(typeof t=="boolean")return[t];if(typeof t=="string"){if(t==="true")return[!0];if(t==="false")return[!1];throw new Error(`string (${JSON.stringify(t)}) cannot be parsed as a boolean`)}let o=t===null?"null":Array.isArray(t)?"array":typeof t,u=o==="array"||o==="object"?JSON.stringify(t):String(t);throw new Error(`${o} (${u}) cannot be parsed as a boolean`)}case"tostream":{let o=[],u=(c,s)=>{if(c===null||typeof c!="object")o.push([s,c]);else if(Array.isArray(c))if(c.length===0)o.push([s,[]]);else for(let f=0;fo&&u.push([f.slice(o)]);continue}if(s.length===2&&Array.isArray(s[0])){let f=s[0],i=s[1];f.length>o&&u.push([f.slice(o),i])}}return u}default:return null}}function it(t,r,e,n,p,o,u,c,s,f){switch(r){case"getpath":{if(e.length===0)return[null];let i=p(t,e[0],n),h=[];for(let a of i){let y=a,l=t;for(let m of y){if(l==null){l=null;break}if(Array.isArray(l)&&typeof m=="number")l=l[m];else if(typeof m=="string"){let b=E(l);if(!b||!Object.hasOwn(b,m)){l=null;break}l=b[m]}else{l=null;break}}h.push(l)}return h}case"setpath":{if(e.length<2)return[null];let h=p(t,e[0],n)[0],y=p(t,e[1],n)[0];return[u(t,h,y)]}case"delpaths":{if(e.length===0)return[t];let h=p(t,e[0],n)[0],a=t;for(let y of h.sort((l,m)=>m.length-l.length))a=c(a,y);return[a]}case"path":{if(e.length===0)return[[]];let i=[];return f(t,e[0],n,[],i),i}case"del":return e.length===0?[t]:[s(t,e[0],n)];case"pick":{if(e.length===0)return[null];let i=[];for(let a of e)f(t,a,n,[],i);let h=null;for(let a of i){for(let l of a)if(typeof l=="number"&&l<0)throw new Error("Out of bounds negative array index");let y=t;for(let l of a){if(y==null)break;if(Array.isArray(y)&&typeof l=="number")y=y[l];else if(typeof l=="string"){let m=E(y);if(!m||!Object.hasOwn(m,l)){y=null;break}y=m[l]}else{y=null;break}}h=u(h,a,y)}return[h]}case"paths":{let i=[],h=(a,y)=>{if(a&&typeof a=="object")if(Array.isArray(a))for(let l=0;l0?i.filter(a=>{let y=t;for(let m of a)if(Array.isArray(y)&&typeof m=="number")y=y[m];else if(typeof m=="string"){let b=E(y);if(!b||!Object.hasOwn(b,m))return!1;y=b[m]}else return!1;return p(y,e[0],n).some(o)}):i}case"leaf_paths":{let i=[],h=(a,y)=>{if(a===null||typeof a!="object")i.push(y);else if(Array.isArray(a))for(let l=0;lJSON.stringify(f)));for(let f of u)if(s.has(JSON.stringify(f)))return[!0];return[!1]}case"INDEX":{if(e.length===0)return[Object.create(null)];if(e.length===1){let s=p(t,e[0],n),f=Object.create(null);for(let i of s){let h=String(i);g(h)&&A(f,h,i)}return[f]}if(e.length===2){let s=p(t,e[0],n),f=Object.create(null);for(let i of s){let h=p(i,e[1],n);if(h.length>0){let a=String(h[0]);g(a)&&A(f,a,i)}}return[f]}let u=p(t,e[0],n),c=Object.create(null);for(let s of u){let f=p(s,e[1],n),i=p(s,e[2],n);if(f.length>0&&i.length>0){let h=String(f[0]);g(h)&&A(c,h,i[0])}}return[c]}case"JOIN":{if(e.length<2)return[null];let u=E(p(t,e[0],n)[0]);if(!u)return[null];if(!Array.isArray(t))return[null];let c=[];for(let s of t){let f=p(s,e[1],n),i=f.length>0?String(f[0]):"",h=T(u,i)?u[i]:null;c.push([s,h])}return[c]}default:return null}}function ft(t,r,e,n,p){switch(r){case"join":{if(!Array.isArray(t))return[null];let o=e.length>0?p(t,e[0],n):[""];for(let u of t)if(Array.isArray(u)||u!==null&&typeof u=="object")throw new Error("cannot join: contains arrays or objects");return o.map(u=>t.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(String(u)))}case"split":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);return[t.split(u)]}case"splits":{if(typeof t!="string"||e.length===0)return[];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"g";return R(u,c.includes("g")?c:`${c}g`).split(t)}catch{return[]}}case"scan":{if(typeof t!="string"||e.length===0)return[];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[...R(u,c.includes("g")?c:`${c}g`).matchAll(t)].map(i=>i.length>1?i.slice(1):i[0])}catch{return[]}}case"test":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[R(u,c).test(t)]}catch{return[!1]}}case"match":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=R(u,`${c}d`).exec(t);if(!f)return[];let i=f.indices;return[{offset:f.index,length:f[0].length,string:f[0],captures:f.slice(1).map((h,a)=>({offset:i?.[a+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=R(u,c).match(t);return!f||!f.groups?[Object.create(null)]:[f.groups]}catch{return[null]}}case"sub":{if(typeof t!="string"||e.length<2)return[null];let o=p(t,e[0],n),u=p(t,e[1],n),c=String(o[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"";return[R(c,f).replace(t,s)]}catch{return[t]}}case"gsub":{if(typeof t!="string"||e.length<2)return[null];let o=p(t,e[0],n),u=p(t,e[1],n),c=String(o[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"g",i=f.includes("g")?f:`${f}g`;return[R(c,i).replace(t,s)]}catch{return[t]}}case"ascii_downcase":return typeof t=="string"?[t.replace(/[A-Z]/g,o=>String.fromCharCode(o.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof t=="string"?[t.replace(/[a-z]/g,o=>String.fromCharCode(o.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);return[t.startsWith(u)?t.slice(u.length):t]}case"rtrimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);return u===""?[t]:[t.endsWith(u)?t.slice(0,-u.length):t]}case"trimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);if(u==="")return[t];let c=t;return c.startsWith(u)&&(c=c.slice(u.length)),c.endsWith(u)&&(c=c.slice(0,-u.length)),[c]}case"trim":if(typeof t=="string")return[t.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof t=="string")return[t.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof t=="string")return[t.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n);return[t.startsWith(String(o[0]))]}case"endswith":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n);return[t.endsWith(String(o[0]))]}case"ascii":return typeof t=="string"&&t.length>0?[t.charCodeAt(0)]:[null];case"explode":return typeof t=="string"?[Array.from(t).map(o=>o.codePointAt(0))]:[null];case"implode":if(!Array.isArray(t))throw new Error("implode input must be an array");return[t.map(c=>{if(typeof c=="string")throw new Error(`string (${JSON.stringify(c)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof c!="number"||Number.isNaN(c))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let s=Math.trunc(c);return s<0||s>1114111||s>=55296&&s<=57343?String.fromCodePoint(65533):String.fromCodePoint(s)}).join("")];default:return null}}function ct(t,r){switch(r){case"type":return t===null?["null"]:Array.isArray(t)?["array"]:typeof t=="boolean"?["boolean"]:typeof t=="number"?["number"]:typeof t=="string"?["string"]:typeof t=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof t=="number"&&!Number.isFinite(t)];case"isnan":return[typeof t=="number"&&Number.isNaN(t)];case"isnormal":return[typeof t=="number"&&Number.isFinite(t)&&t!==0];case"isfinite":return[typeof t=="number"&&Number.isFinite(t)];case"numbers":return typeof t=="number"?[t]:[];case"strings":return typeof t=="string"?[t]:[];case"booleans":return typeof t=="boolean"?[t]:[];case"nulls":return t===null?[t]:[];case"arrays":return Array.isArray(t)?[t]:[];case"objects":return t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"iterables":return Array.isArray(t)||t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"scalars":return!Array.isArray(t)&&!(t&&typeof t=="object")?[t]:[];case"values":return t===null?[]:[t];case"not":return t===!1||t===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function K(t,r,e){if(r.length===0)return e;let[n,...p]=r;if(typeof n=="number"){if(t&&typeof t=="object"&&!Array.isArray(t))throw new Error("Cannot index object with number");if(n>536870911)throw new Error("Array index too large");if(n<0)throw new Error("Out of bounds negative array index");let f=Array.isArray(t)?[...t]:[];for(;f.length<=n;)f.push(null);return f[n]=K(f[n],p,e),f}if(Array.isArray(t))throw new Error("Cannot index array with string");if(!g(n))return t??Object.create(null);let o=E(t),u=o?O(o):Object.create(null),c=Object.hasOwn(u,n)?u[n]:void 0;return A(u,n,K(c,p,e)),u}function V(t,r){if(r.length===0)return null;if(r.length===1){let p=r[0];if(Array.isArray(t)&&typeof p=="number"){let o=[...t];return o.splice(p,1),o}if(t&&typeof t=="object"&&!Array.isArray(t)){let o=String(p);if(!g(o))return t;let u=O(t);return delete u[o],u}return t}let[e,...n]=r;if(Array.isArray(t)&&typeof e=="number"){let p=[...t];return p[e]=V(p[e],n),p}if(t&&typeof t=="object"&&!Array.isArray(t)){let p=String(e);if(!g(p))return t;let o=O(t);return Object.hasOwn(o,p)&&A(o,p,V(o[p],n)),o}return t}var P=class t extends Error{label;partialResults;constructor(r,e=[]){super(`break ${r}`),this.label=r,this.partialResults=e,this.name="BreakError"}withPrependedResults(r){return new t(this.label,[...r,...this.partialResults])}},H=class extends Error{value;constructor(r){super(typeof r=="string"?r:JSON.stringify(r)),this.value=r,this.name="JqError"}},St=1e4,bt=2e3,Ct=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function Tt(t){return{vars:new Map,limits:{maxIterations:t?.limits?.maxIterations??St,maxDepth:t?.limits?.maxDepth??bt},env:t?.env,coverage:t?.coverage,requireDefenseContext:t?.requireDefenseContext,defenseContextChecked:!1}}function q(t,r,e){let n=new Map(t.vars);return n.set(r,e),{vars:n,limits:t.limits,env:t.env,requireDefenseContext:t.requireDefenseContext,defenseContextChecked:t.defenseContextChecked,root:t.root,currentPath:t.currentPath,funcs:t.funcs,labels:t.labels,coverage:t.coverage}}function L(t,r,e){switch(r.type){case"var":return q(t,r.name,e);case"array":{if(!Array.isArray(e))return null;let n=t;for(let p=0;p0&&r.args[0].type==="Literal"){let n=r.args[0].value;typeof n=="number"&&(e=n)}if(e>=0)return t.slice(0,Math.max(0,t.length-e));{let n=-e-1;return t.slice(0,Math.min(n,t.length))}}if(r.name==="root")return[]}if(r.type==="Field"){let e=M(r);if(e!==null)return[...t,...e]}if(r.type==="Index"&&r.index.type==="Literal"){let e=M(r);if(e!==null)return[...t,...e]}if(r.type==="Pipe"){let e=pt(t,r.left);return e===null?null:pt(e,r.right)}return r.type==="Identity"?t:null}function mt(t,r,e){if(r.type==="Comma"){let n=[];try{n.push(...d(t,r.left,e))}catch(p){if(p instanceof B)throw p;if(n.length>0)return n;throw new Error("evaluation failed")}try{n.push(...d(t,r.right,e))}catch(p){if(p instanceof B)throw p;return n}return n}return d(t,r,e)}function d(t,r,e){let n=e&&"vars"in e?e:Tt(e);switch(n.defenseContextChecked||(yt(n.requireDefenseContext,"query-engine","evaluation"),n={...n,defenseContextChecked:!0}),n.root===void 0&&(n={...n,root:t,currentPath:[]}),n.coverage?.hit(`jq:node:${r.type}`),r.type){case"Identity":return[t];case"Field":return(r.base?d(t,r.base,n):[t]).flatMap(o=>{let u=E(o);if(u){if(!Object.hasOwn(u,r.name))return[null];let s=u[r.name];return[s===void 0?null:s]}if(o===null)return[null];let c=Array.isArray(o)?"array":typeof o;throw new Error(`Cannot index ${c} with string "${r.name}"`)});case"Index":return(r.base?d(t,r.base,n):[t]).flatMap(o=>d(o,r.index,n).flatMap(c=>{if(typeof c=="number"&&Array.isArray(o)){if(Number.isNaN(c))return[null];let s=Math.trunc(c),f=s<0?o.length+s:s;return f>=0&&f{if(o===null)return[null];if(!Array.isArray(o)&&typeof o!="string")throw new Error(`Cannot slice ${typeof o} (${JSON.stringify(o)})`);let u=o.length,c=r.start?d(t,r.start,n):[0],s=r.end?d(t,r.end,n):[u];return c.flatMap(f=>s.map(i=>{let h=f,a=i,y=Number.isNaN(h)?0:Number.isInteger(h)?h:Math.floor(h),l=Number.isNaN(a)?u:Number.isInteger(a)?a:Math.ceil(a),m=dt(y,u),b=dt(l,u);return Array.isArray(o),o.slice(m,b)}))});case"Iterate":return(r.base?d(t,r.base,n):[t]).flatMap(o=>Array.isArray(o)?o:o&&typeof o=="object"?Object.values(o):[]);case"Pipe":{let p=d(t,r.left,n),o=M(r.left),u=[];for(let c of p)try{if(o!==null){let s={...n,currentPath:[...n.currentPath??[],...o]};u.push(...d(c,r.right,s))}else u.push(...d(c,r.right,n))}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Comma":{let p=d(t,r.left,n),o=d(t,r.right,n);return[...p,...o]}case"Literal":return[r.value];case"Array":return r.elements?[d(t,r.elements,n)]:[[]];case"Object":{let p=[Object.create(null)];for(let o of r.entries){let u=typeof o.key=="string"?[o.key]:d(t,o.key,n),c=d(t,o.value,n),s=[];for(let f of p)for(let i of u){if(typeof i!="string"){let h=i===null?"null":Array.isArray(i)?"array":typeof i;throw new Error(`Cannot use ${h} (${JSON.stringify(i)}) as object key`)}if(!g(i)){for(let h of c)s.push(O(f));continue}for(let h of c){let a=O(f);A(a,i,h),s.push(a)}}p.length=0,p.push(...s)}return p}case"Paren":return d(t,r.expr,n);case"BinaryOp":return xt(t,r.op,r.left,r.right,n);case"UnaryOp":return d(t,r.operand,n).map(o=>{if(r.op==="-"){if(typeof o=="number")return-o;if(typeof o=="string"){let u=c=>c.length>5?`"${c.slice(0,3)}...`:JSON.stringify(c);throw new Error(`string (${u(o)}) cannot be negated`)}return null}return r.op==="not"?!S(o):null});case"Cond":return d(t,r.cond,n).flatMap(o=>{if(S(o))return d(t,r.then,n);for(let u of r.elifs)if(d(t,u.cond,n).some(S))return d(t,u.then,n);return r.else?d(t,r.else,n):[t]});case"Try":try{return d(t,r.body,n)}catch(p){if(r.catch){let o=p instanceof H?p.value:p instanceof Error?p.message:String(p);return d(o,r.catch,n)}return[]}case"Call":return gt(t,r.name,r.args,n);case"VarBind":return d(t,r.value,n).flatMap(o=>{let u=null,c=[];r.pattern?c.push(r.pattern):r.name&&c.push({type:"var",name:r.name}),r.alternatives&&c.push(...r.alternatives);for(let s of c)if(u=L(n,s,o),u!==null)break;return u===null?[]:d(t,r.body,u)});case"VarRef":{if(r.name==="$ENV")return[n.env?X(n.env):Object.create(null)];let p=n.vars.get(r.name);return p!==void 0?[p]:[null]}case"Recurse":{let p=[],o=new WeakSet,u=c=>{if(c&&typeof c=="object"){if(o.has(c))return;o.add(c)}if(p.push(c),Array.isArray(c))for(let s of c)u(s);else if(c&&typeof c=="object")for(let s of Object.keys(c))u(c[s])};return u(t),p}case"Optional":try{return d(t,r.expr,n)}catch{return[]}case"StringInterp":return[r.parts.map(o=>typeof o=="string"?o:d(t,o,n).map(c=>typeof c=="string"?c:JSON.stringify(c)).join("")).join("")];case"UpdateOp":return[Mt(t,r.path,r.op,r.value,n)];case"Reduce":{let p=d(t,r.expr,n),o=d(t,r.init,n)[0],u=n.limits.maxDepth??bt;for(let c of p){let s;if(r.pattern){if(s=L(n,r.pattern,c),s===null)continue}else s=q(n,r.varName,c);if(o=d(o,r.update,s)[0],D(o,u+1)>u)return[null]}return[o]}case"Foreach":{let p=d(t,r.expr,n),o=d(t,r.init,n)[0],u=[];for(let c of p)try{let s;if(r.pattern){if(s=L(n,r.pattern,c),s===null)continue}else s=q(n,r.varName,c);if(o=d(o,r.update,s)[0],r.extract){let f=d(o,r.extract,s);u.push(...f)}else u.push(o)}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Label":try{return d(t,r.body,{...n,labels:new Set([...n.labels??[],r.name])})}catch(p){if(p instanceof P&&p.label===r.name)return p.partialResults;throw p}case"Break":throw new P(r.name);case"Def":{let p=new Map(n.funcs??[]),o=`${r.name}/${r.params.length}`;p.set(o,{params:r.params,body:r.funcBody,closure:new Map(n.funcs??[])});let u={...n,funcs:p};return d(t,r.body,u)}default:{let p=r;throw new Error(`Unknown AST node type: ${p.type}`)}}}function dt(t,r){return t<0?Math.max(0,r+t):Math.min(t,r)}function Mt(t,r,e,n,p){function o(s,f){switch(e){case"=":return f;case"|=":return d(s,n,p)[0]??null;case"+=":return typeof s=="number"&&typeof f=="number"||typeof s=="string"&&typeof f=="string"?s+f:Array.isArray(s)&&Array.isArray(f)?[...s,...f]:s&&f&&typeof s=="object"&&typeof f=="object"?G(s,f):f;case"-=":return typeof s=="number"&&typeof f=="number"?s-f:s;case"*=":return typeof s=="number"&&typeof f=="number"?s*f:s;case"/=":return typeof s=="number"&&typeof f=="number"?s/f:s;case"%=":return typeof s=="number"&&typeof f=="number"?s%f:s;case"//=":return s===null||s===!1?f:s;default:return f}}function u(s,f,i){switch(f.type){case"Identity":return i(s);case"Field":{if(!g(f.name))return s;if(f.base)return u(s,f.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let a=O(h),y=Object.hasOwn(a,f.name)?a[f.name]:void 0;return A(a,f.name,i(y)),a}return h});if(s&&typeof s=="object"&&!Array.isArray(s)){let h=O(s),a=Object.hasOwn(h,f.name)?h[f.name]:void 0;return A(h,f.name,i(a)),h}return s}case"Index":{let a=d(t,f.index,p)[0];if(typeof a=="number"&&Number.isNaN(a))throw new Error("Cannot set array element at NaN index");if(typeof a=="number"&&!Number.isInteger(a)&&(a=Math.trunc(a)),f.base)return u(s,f.base,y=>{if(typeof a=="number"&&Array.isArray(y)){let l=[...y],m=a<0?l.length+a:a;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=i(l[m])}return l}if(typeof a=="string"&&y&&typeof y=="object"&&!Array.isArray(y)){if(!g(a))return y;let l=O(y),m=Object.hasOwn(l,a)?l[a]:void 0;return A(l,a,i(m)),l}return y});if(typeof a=="number"){if(a>536870911)throw new Error("Array index too large");if(a<0&&(!s||!Array.isArray(s)))throw new Error("Out of bounds negative array index");if(Array.isArray(s)){let l=[...s],m=a<0?l.length+a:a;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=i(l[m])}return l}if(s==null){let l=[];for(;l.length<=a;)l.push(null);return l[a]=i(null),l}return s}if(typeof a=="string"&&s&&typeof s=="object"&&!Array.isArray(s)){if(!g(a))return s;let y=O(s),l=Object.hasOwn(y,a)?y[a]:void 0;return A(y,a,i(l)),y}return s}case"Iterate":{let h=a=>{if(Array.isArray(a))return a.map(y=>i(y));if(a&&typeof a=="object"){let y=Object.create(null);for(let[l,m]of Object.entries(a))g(l)&&A(y,l,i(m));return y}return a};return f.base?u(s,f.base,h):h(s)}case"Pipe":{let h=u(s,f.left,a=>a);return u(h,f.right,i)}default:return i(s)}}return u(t,r,s=>{if(e==="|=")return o(s,s);let f=d(t,n,p);return o(s,f[0]??null)})}function jt(t,r,e){function n(o,u,c){switch(u.type){case"Identity":return c;case"Field":{if(!g(u.name))return o;if(u.base){let s=d(o,u.base,e)[0],f=n(s,{type:"Field",name:u.name},c);return n(o,u.base,f)}if(o&&typeof o=="object"&&!Array.isArray(o)){let s=O(o);return A(s,u.name,c),s}return o}case"Index":{if(u.base){let i=d(o,u.base,e)[0],h=n(i,{type:"Index",index:u.index},c);return n(o,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(o)){let i=[...o],h=f<0?i.length+f:f;return h>=0&&h=0&&h=0&&NS(s)?d(t,n,p).map(i=>S(i)):[!1]);if(r==="or")return d(t,e,p).flatMap(s=>S(s)?[!0]:d(t,n,p).map(i=>S(i)));if(r==="//"){let s=d(t,e,p).filter(f=>f!=null&&f!==!1);return s.length>0?s:d(t,n,p)}let o=d(t,e,p),u=d(t,n,p);return o.flatMap(c=>u.map(s=>{switch(r){case"+":return c===null?s:s===null?c:typeof c=="number"&&typeof s=="number"||typeof c=="string"&&typeof s=="string"?c+s:Array.isArray(c)&&Array.isArray(s)?[...c,...s]:c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?G(c,s):null;case"-":if(typeof c=="number"&&typeof s=="number")return c-s;if(Array.isArray(c)&&Array.isArray(s)){let f=new Set(s.map(i=>JSON.stringify(i)));return c.filter(i=>!f.has(JSON.stringify(i)))}if(typeof c=="string"&&typeof s=="string"){let f=i=>i.length>10?`"${i.slice(0,10)}...`:JSON.stringify(i);throw new Error(`string (${f(c)}) and string (${f(s)}) cannot be subtracted`)}return null;case"*":if(typeof c=="number"&&typeof s=="number")return c*s;if(typeof c=="string"&&typeof s=="number")return c.repeat(s);{let f=E(c),i=E(s);if(f&&i)return v(f,i)}return null;case"/":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided because the divisor is zero`);return c/s}return typeof c=="string"&&typeof s=="string"?c.split(s):null;case"%":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(c)&&!Number.isNaN(c)?!Number.isFinite(s)&&!Number.isNaN(s)&&c<0&&s>0?-1:0:c%s}return null;case"==":return I(c,s);case"!=":return!I(c,s);case"<":return U(c,s)<0;case"<=":return U(c,s)<=0;case">":return U(c,s)>0;case">=":return U(c,s)>=0;default:return null}}))}function gt(t,r,e,n){let p=Ct.get(r);if(p)return typeof t=="number"?[p(t)]:[null];let o=rt(t,r,e,n,d);if(o!==null)return o;let u=ft(t,r,e,n,d);if(u!==null)return u;let c=Z(t,r,e,n,d);if(c!==null)return c;let s=tt(t,r,n.limits.maxDepth);if(s!==null)return s;let f=ct(t,r);if(f!==null)return f;let i=st(t,r,e,n,d);if(i!==null)return i;let h=W(t,r,e,n,d,mt,$,S,F,B);if(h!==null)return h;let a=it(t,r,e,n,d,S,K,V,jt,J);if(a!==null)return a;let y=et(t,r,e,n,d,I);if(y!==null)return y;let l=z(t,r,e,n,d,mt,S,B);if(l!==null)return l;let m=nt(t,r,e,n,d,S,Rt,gt);if(m!==null)return m;let b=ot(t,r,e,n,d,I);if(b!==null)return b;switch(r){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let w=e.length>0?d(t,e[0],n)[0]:t;throw new H(w)}case"env":return[n.env?X(n.env):Object.create(null)];case"debug":return[t];case"input_line_number":return[1];default:{let w=`${r}/${e.length}`,k=n.funcs?.get(w);if(k){let N=k.closure??n.funcs??new Map,C=new Map(N);C.set(w,k);for(let _=0;_=0;Q--)x={type:"Comma",left:{type:"Literal",value:j[Q]},right:x}}C.set(`${kt}/0`,{params:[],body:x})}}let wt={...n,funcs:C};return d(t,k.body,wt)}throw new Error(`Unknown function: ${r}`)}}}function J(t,r,e,n,p){if(r.type==="Comma"){let c=r;J(t,c.left,e,n,p),J(t,c.right,e,n,p);return}let o=M(r);if(o!==null){p.push([...n,...o]);return}if(r.type==="Iterate"){if(Array.isArray(t))for(let c=0;c{if(p.push([...n,...f]),s&&typeof s=="object")if(Array.isArray(s))for(let i=0;i0&&p.push(n)}var At=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),Y=new Set(At.values());function Et(t){let r=[],e=0,n=(f=0)=>t[e+f],p=()=>t[e++],o=()=>e>=t.length,u=f=>f>="0"&&f<="9",c=f=>f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_",s=f=>c(f)||u(f);for(;!o();){let f=e,i=p();if(!(i===" "||i===" "||i===` -`||i==="\r")){if(i==="#"){for(;!o()&&n()!==` -`;)p();continue}if(i==="."&&n()==="."){p(),r.push({type:"DOTDOT",pos:f});continue}if(i==="="&&n()==="="){p(),r.push({type:"EQ",pos:f});continue}if(i==="!"&&n()==="="){p(),r.push({type:"NE",pos:f});continue}if(i==="<"&&n()==="="){p(),r.push({type:"LE",pos:f});continue}if(i===">"&&n()==="="){p(),r.push({type:"GE",pos:f});continue}if(i==="/"&&n()==="/"){p(),n()==="="?(p(),r.push({type:"UPDATE_ALT",pos:f})):r.push({type:"ALT",pos:f});continue}if(i==="+"&&n()==="="){p(),r.push({type:"UPDATE_ADD",pos:f});continue}if(i==="-"&&n()==="="){p(),r.push({type:"UPDATE_SUB",pos:f});continue}if(i==="*"&&n()==="="){p(),r.push({type:"UPDATE_MUL",pos:f});continue}if(i==="/"&&n()==="="){p(),r.push({type:"UPDATE_DIV",pos:f});continue}if(i==="%"&&n()==="="){p(),r.push({type:"UPDATE_MOD",pos:f});continue}if(i==="="&&n()!=="="){r.push({type:"ASSIGN",pos:f});continue}if(i==="."){r.push({type:"DOT",pos:f});continue}if(i==="|"){n()==="="?(p(),r.push({type:"UPDATE_PIPE",pos:f})):r.push({type:"PIPE",pos:f});continue}if(i===","){r.push({type:"COMMA",pos:f});continue}if(i===":"){r.push({type:"COLON",pos:f});continue}if(i===";"){r.push({type:"SEMICOLON",pos:f});continue}if(i==="("){r.push({type:"LPAREN",pos:f});continue}if(i===")"){r.push({type:"RPAREN",pos:f});continue}if(i==="["){r.push({type:"LBRACKET",pos:f});continue}if(i==="]"){r.push({type:"RBRACKET",pos:f});continue}if(i==="{"){r.push({type:"LBRACE",pos:f});continue}if(i==="}"){r.push({type:"RBRACE",pos:f});continue}if(i==="?"){r.push({type:"QUESTION",pos:f});continue}if(i==="+"){r.push({type:"PLUS",pos:f});continue}if(i==="-"){r.push({type:"MINUS",pos:f});continue}if(i==="*"){r.push({type:"STAR",pos:f});continue}if(i==="/"){r.push({type:"SLASH",pos:f});continue}if(i==="%"){r.push({type:"PERCENT",pos:f});continue}if(i==="<"){r.push({type:"LT",pos:f});continue}if(i===">"){r.push({type:"GT",pos:f});continue}if(u(i)){let h=i;for(;!o()&&(u(n())||n()==="."||n()==="e"||n()==="E");)(n()==="e"||n()==="E")&&(t[e+1]==="+"||t[e+1]==="-")&&(h+=p()),h+=p();r.push({type:"NUMBER",value:Number(h),pos:f});continue}if(i==='"'){let h="";for(;!o()&&n()!=='"';)if(n()==="\\"){if(p(),o())break;let a=p();switch(a){case"n":h+=` -`;break;case"r":h+="\r";break;case"t":h+=" ";break;case"\\":h+="\\";break;case'"':h+='"';break;case"(":h+="\\(";break;default:h+=a}}else h+=p();o()||p(),r.push({type:"STRING",value:h,pos:f});continue}if(c(i)||i==="$"||i==="@"){let h=i;for(;!o()&&s(n());)h+=p();let a=At.get(h);a?r.push({type:a,value:h,pos:f}):r.push({type:"IDENT",value:h,pos:f});continue}throw new Error(`Unexpected character '${i}' at position ${f}`)}}return r.push({type:"EOF",pos:e}),r}var ut=class t{tokens;pos=0;constructor(r){this.tokens=r}peek(r=0){return this.tokens[this.pos+r]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(r){return this.peek().type===r}match(...r){for(let e of r)if(this.check(e))return this.advance();return null}expect(r,e){if(!this.check(r))throw new Error(`${e} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(r=0){let e=this.peek(r),n=this.peek(r+1);return n.type==="STRING"?!0:n.type==="IDENT"||Y.has(n.type)?n.pos===e.pos+1:!1}isIdentLike(){let r=this.peek().type;return r==="IDENT"||Y.has(r)}consumeFieldNameAfterDot(r){let e=this.peek();return e.type==="STRING"?this.advance().value:(e.type==="IDENT"||Y.has(e.type))&&e.pos===r.pos+1?this.advance().value:null}parse(){let r=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return r}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match("LBRACKET")){let n=[];if(!this.check("RBRACKET"))for(n.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)n.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:n}}if(this.match("LBRACE")){let n=[];if(!this.check("RBRACE"))for(n.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)n.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:n}}let r=this.expect("IDENT","Expected variable name in pattern"),e=r.value;if(!e.startsWith("$"))throw new Error(`Variable name must start with $ at position ${r.pos}`);return{type:"var",name:e}}parsePatternField(){if(this.match("LPAREN")){let e=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let n=this.parsePattern();return{key:e,pattern:n}}let r=this.peek();if(r.type==="IDENT"||Y.has(r.type)){let e=r.value;if(e.startsWith("$")){if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e.slice(1),pattern:n,keyVar:e}}return{key:e.slice(1),pattern:{type:"var",name:e}}}if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e,pattern:n}}return{key:e,pattern:{type:"var",name:`$${e}`}}}throw new Error(`Expected field name in object pattern at position ${r.pos}`)}parsePipe(){let r=this.parseComma();for(;this.match("PIPE");){let e=this.parseComma();r={type:"Pipe",left:r,right:e}}return r}parseComma(){let r=this.parseVarBind();for(;this.match("COMMA");){let e=this.parseVarBind();r={type:"Comma",left:r,right:e}}return r}parseVarBind(){let r=this.parseUpdate();if(this.match("AS")){let e=this.parsePattern(),n=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),n.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let p=this.parseExpr();return e.type==="var"&&n.length===0?{type:"VarBind",name:e.name,value:r,body:p}:{type:"VarBind",name:e.type==="var"?e.name:"",value:r,body:p,pattern:e.type!=="var"?e:void 0,alternatives:n.length>0?n:void 0}}return r}peekAhead(r){let e=this.pos+r;return e"],["GE",">="]]),n=this.match("EQ","NE","LT","LE","GT","GE");if(n){let p=e.get(n.type);if(p){let o=this.parseAddSub();r={type:"BinaryOp",op:p,left:r,right:o}}}return r}parseAddSub(){let r=this.parseMulDiv();for(;;)if(this.match("PLUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"+",left:r,right:e}}else if(this.match("MINUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"-",left:r,right:e}}else break;return r}parseMulDiv(){let r=this.parseUnary();for(;;)if(this.match("STAR")){let e=this.parseUnary();r={type:"BinaryOp",op:"*",left:r,right:e}}else if(this.match("SLASH")){let e=this.parseUnary();r={type:"BinaryOp",op:"/",left:r,right:e}}else if(this.match("PERCENT")){let e=this.parseUnary();r={type:"BinaryOp",op:"%",left:r,right:e}}else break;return r}parseUnary(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let r=this.parsePrimary();for(;;)if(this.match("QUESTION"))r={type:"Optional",expr:r};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),r={type:"Field",name:this.advance().value,base:r};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))r={type:"Iterate",base:r};else if(this.check("COLON")){this.advance();let e=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",end:e,base:r}}else{let e=this.parseExpr();if(this.match("COLON")){let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",start:e,end:n,base:r}}else this.expect("RBRACKET","Expected ']'"),r={type:"Index",index:e,base:r}}else break;return r}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let r=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let p=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:p}}let n=this.parseExpr();if(this.match("COLON")){let p=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:n,end:p}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:n}}let e=this.consumeFieldNameAfterDot(r);return e!==null?{type:"Field",name:e}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let e=this.advance().value;return e.includes("\\(")?this.parseStringInterpolation(e):{type:"Literal",value:e}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let r=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:r}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let r=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:r}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let r=this.parsePostfix(),e;return this.match("CATCH")&&(e=this.parsePostfix()),{type:"Try",body:r,catch:e}}if(this.match("REDUCE")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let o=e.type==="var"?e.name:"";return{type:"Reduce",expr:r,varName:o,init:n,update:p,pattern:e.type!=="var"?e:void 0}}if(this.match("FOREACH")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr(),o;this.match("SEMICOLON")&&(o=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let u=e.type==="var"?e.name:"";return{type:"Foreach",expr:r,varName:u,init:n,update:p,extract:o,pattern:e.type!=="var"?e:void 0}}if(this.match("LABEL")){let r=this.expect("IDENT","Expected label name (e.g., $out)"),e=r.value;if(!e.startsWith("$"))throw new Error(`Label name must start with $ at position ${r.pos}`);this.expect("PIPE","Expected '|' after label name");let n=this.parseExpr();return{type:"Label",name:e,body:n}}if(this.match("BREAK")){let r=this.expect("IDENT","Expected label name to break to"),e=r.value;if(!e.startsWith("$"))throw new Error(`Break label must start with $ at position ${r.pos}`);return{type:"Break",name:e}}if(this.match("DEF")){let e=this.expect("IDENT","Expected function name after def").value,n=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let u=this.expect("IDENT","Expected parameter name");for(n.push(u.value);this.match("SEMICOLON");){let c=this.expect("IDENT","Expected parameter name");n.push(c.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let p=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let o=this.parseExpr();return{type:"Def",name:e,params:n,funcBody:p,body:o}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let e=this.advance().value;if(e.startsWith("$"))return{type:"VarRef",name:e};if(this.match("LPAREN")){let n=[];if(!this.check("RPAREN"))for(n.push(this.parseExpr());this.match("SEMICOLON");)n.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:e,args:n}}return{type:"Call",name:e,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let r=[];if(!this.check("RBRACE"))do{let e,n;if(this.match("LPAREN"))e=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else if(this.isIdentLike()){let p=this.advance().value;this.match("COLON")?(e=p,n=this.parseObjectValue()):(e=p,n={type:"Field",name:p})}else if(this.check("STRING"))e=this.advance().value,this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);r.push({key:e,value:n})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:r}}parseObjectValue(){let r=this.parseVarBind();for(;this.match("PIPE");){let e=this.parseVarBind();r={type:"Pipe",left:r,right:e}}return r}parseIf(){let r=this.parseExpr();this.expect("THEN","Expected 'then'");let e=this.parseExpr(),n=[];for(;this.match("ELIF");){let o=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let u=this.parseExpr();n.push({cond:o,then:u})}let p;return this.match("ELSE")&&(p=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:r,then:e,elifs:n,else:p}}parseStringInterpolation(r){let e=[],n="",p=0;for(;p0;)r[p]==="("?o++:r[p]===")"&&o--,o>0&&(u+=r[p]),p++;let c=Et(u),s=new t(c);e.push(s.parse())}else n+=r[p],p++;return n&&e.push(n),{type:"StringInterp",parts:e}}};function Ne(t){let r=Et(t);return new ut(r).parse()}export{d as a,Ne as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AX6NCIX6.js b/packages/just-bash/dist/bin/chunks/chunk-AX6NCIX6.js deleted file mode 100644 index 840104bc..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-AX6NCIX6.js +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env node -import{a as F,b,c as M,d as qe,e as w,f as v,g as Y,h as B}from"./chunk-RBQGQWGV.js";import{a as nt}from"./chunk-4CFAYBLV.js";import{a as $}from"./chunk-ARI4VLCN.js";import{f as _e,g as X}from"./chunk-V7ZOPVQS.js";import{a as H}from"./chunk-JDNI5HBX.js";import{a as We}from"./chunk-5WFYIUU2.js";import{a as D,b as G}from"./chunk-GTNBSMZR.js";import{b as Ve,d as Qe,e as et,f as tt}from"./chunk-KGOUQS5A.js";var _,He=Ve(()=>{"use strict";_=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="b"&&this.pos+1"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.posq,parseNamedExpressions:()=>U});function U(e){let n=[],s=new _(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},a=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){a();continue}let d=[],u=0,p=r;for(;o().type!=="eof";){let i=o();if((i.type===","||i.type==="as")&&u===0)break;(i.type==="("||i.type==="["||i.type==="{")&&u++,(i.type===")"||i.type==="]"||i.type==="}")&&u--,d.push(a())}d.push({type:"eof",value:"",pos:0});let h=new J(d).parse(),l;if(o().type==="as")if(a(),o().type==="("){a();let i=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(i.push(o().value),a()),o().type===","&&a();o().type===")"&&a(),l=i}else if(o().type==="ident"||o().type==="string")l=o().value,a();else throw new Error(`Expected name after 'as', got ${o().type}`);else l=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),h.type==="identifier"&&(l=h.name);n.push({expr:h,name:l})}return n}function q(e){let t=new _(e).tokenize();return new J(t).parse()}var R,J,V=Ve(()=>{"use strict";He();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=this.pos;if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=[this.peek().value];this.advance();let o=!0;for(;this.peek().type===",";)if(this.advance(),this.peek().type==="ident")r.push(this.peek().value),this.advance();else{o=!1;break}if(o&&this.peek().type===")"&&this.peekAt(1).type==="=>"){this.advance(),this.advance();let a=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:r,body:a},r)}this.pos=t}let s=this.parseExpr(0);return this.expect(")"),s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,a=this.pos+1;a0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let a=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:a}]}}if(s.type==="|"){this.advance();let a=this.parseExpr(t);return this.handlePipe(n,a)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}peekAt(n){return this.tokens[this.pos+n]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});V();function E(e,n){return n.length===0?I(e,[]):n.length===1?{type:"Pipe",left:n[0],right:I(e,[])}:{type:"Pipe",left:n[0],right:I(e,n.slice(1))}}var z={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>I("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?I("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?I("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?I("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>I("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>I("select",e),empty:()=>I("empty",[]),count:()=>I("length",[]),sum:e=>e.length===0?I("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:I("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",I("add",[]),I("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",I("add",[]),I("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?I("tonumber",[]):I("tonumber",e),tostring:e=>e.length===0?I("tostring",[]):I("tostring",e),if:e=>ze(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return ze(s,n,t.length===1?t[0]:z.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>I("now",[]),fmt:e=>I("tostring",e),format:e=>I("tostring",e)};Object.setPrototypeOf(z,null);function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function I(e,n){return{type:"Call",name:e,args:n}}var st="then";function ze(e,n,t){let s=_e({type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}});return s[st]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>O(r.expr,n)),s=Object.hasOwn(z,e.name)?z[e.name]:void 0;return typeof s=="function"?s(t):I(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=O(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t=e.length)break;let s=t;for(;t0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let d=e.slice(a,t).trim();for(t++;t0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(Ke(r)?o=e.map(a=>a[r]).filter(a=>a!=null):o=e.map(a=>Z(a,r,t)).filter(a=>a!=null),s){case"count":return Ke(r)?o.length:o.filter(a=>!!a).length;case"sum":return o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).reduce((d,u)=>d+u,0);case"mean":case"avg":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?a.reduce((d,u)=>d+u,0)/a.length:0}case"min":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?Math.min(...a):null}case"max":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?Math.max(...a):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let a=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(a.length===0)return null;let d=Math.floor(a.length/2);return a.length%2===0?(a[d-1]+a[d])/2:a[d]}case"mode":{let a=new Map;for(let p of o){let c=String(p);a.set(c,(a.get(c)||0)+1)}let d=0,u=null;for(let[p,c]of a)c>d&&(d=c,u=p);return u}case"cardinality":return new Set(o.map(d=>String(d))).size;case"values":return o.map(a=>String(a)).join("|");case"distinct_values":return[...new Set(o.map(d=>String(d)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let a of e)if(!Z(a,r,t))return!1;return!0}case"any":{for(let a of e)if(Z(a,r,t))return!0;return!1}default:return null}}function Ge(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression -`,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let a={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},d=Q(t),u=d.map(c=>c.alias),p=Ge(r,d,a);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function ne(e,n){let t="",s="",r=[];for(let f=0;fString(f[g])).join("\0");h.has(m)||(h.set(m,[]),c.push(m)),h.get(m)?.push(f)}let l=[...u,...p.map(f=>f.alias)],i=[];for(let f of c){let m=h.get(f);if(!m)continue;let g=F();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,ee(m,y,d));i.push(g)}return{stdout:w(l,i),stderr:"",exitCode:0}}async function se(e,n){let t=[],s="",r=10,o=!1,a=[];for(let i=0;i0?t:d.filter(i=>i!==s);s&&t.length===0&&(c=d.filter(i=>i!==s));let h=[],l=s?["field",s,"value","count"]:["field","value","count"];if(s){let i=new Map;for(let f of u){let m=String(f[s]??"");i.has(m)||i.set(m,[]),i.get(m)?.push(f)}for(let f of c)for(let[m,g]of i){let y=new Map;for(let k of g){let N=k[f],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((k,N)=>N[1]!==k[1]?N[1]-k[1]:k[0].localeCompare(N[0]));o&&(x=x.filter(([k])=>k!=="")),r>0&&(x=x.slice(0,r));for(let[k,N]of x)h.push({field:f,[s]:m,value:k===""?"":k,count:N})}}else for(let i of c){let f=new Map;for(let g of u){let y=g[i],x=y===""||y===null||y===void 0?"":String(y);f.set(x,(f.get(x)||0)+1)}let m=[...f.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)h.push({field:i,value:g===""?"":g,count:y})}return{stdout:w(l,h),stderr:"",exitCode:0}}async function re(e,n){let t=[],s=[];for(let c=0;c0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let c of d){let h=o.map(f=>f[c]).filter(f=>f!=null),l=h.map(f=>typeof f=="number"?f:Number.parseFloat(String(f))).filter(f=>!Number.isNaN(f)),i=l.length===h.length&&l.length>0;p.push({field:c,type:i?"Number":"String",count:h.length,min:i?Math.min(...l):"",max:i?Math.max(...l):"",mean:i?Math.round(l.reduce((f,m)=>f+m,0)/l.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}V();function Xe(e){let n=q(e);return O(n)}function rt(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function K(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),c=K(p,n);for(let h of c)s.add(h);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=rt(o);for(let c of n)p.test(c)&&!t.includes(c)&&t.push(c);continue}let a=o.match(/^([^:]*):([^:]*)$/);if(a&&(a[1]||a[2])){let p=a[1],c=a[2],h=p?n.indexOf(p):0,l=c?n.indexOf(c):n.length-1;if(h!==-1&&l!==-1){let i=h<=l?1:-1;for(let f=h;i>0?f<=l:f>=l;f+=i)t.includes(n[f])||t.push(n[f])}continue}let d=o.match(/^(\d+)-(\d+)$/);if(d){let p=Number.parseInt(d[1],10),c=Number.parseInt(d[2],10);for(let h=p;h<=c&&h=0&&u0?t.filter(r=>!s.has(r)):t}async function oe(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified -`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let d=K(t,r),u=o.map(p=>{let c=F();for(let h of d)b(c,h,p[h]);return c});return{stdout:w(d,u),stderr:"",exitCode:0}}async function ie(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan drop: no columns specified -`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let d=new Set(K(t,r)),u=r.filter(c=>!d.has(c)),p=o.map(c=>{let h=F();for(let l of u)b(h,l,c[l]);return h});return{stdout:w(u,p),stderr:"",exitCode:0}}async function ae(e,n){let t="",s="",r=[];for(let c=0;cl.get(i)||i)}else{let c=t.split(",");u=o.map((h,l)=>l{let h=F();for(let l=0;l{let h=F();b(h,t,c);for(let l of r)b(h,l,p[l]);return h});return{stdout:w(d,u),stderr:"",exitCode:0}}async function ue(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(a=>a!=="-j"&&a!=="--just-names"),n);return r||{stdout:t?`${s.map(a=>a).join(` -`)} -`:`${s.map((a,d)=>`${d} ${a}`).join(` -`)} -`,stderr:"",exitCode:0}}async function ce(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length} -`,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],c=s.map(h=>({column:h}));return{stdout:w(p,c),stderr:"",exitCode:0}}let a=s[0],d=[a,...r.map((p,c)=>String(p[a]??`row_${c}`))],u=[];for(let p=1;p(d=d*1103515245+12345&2147483647,d/2147483647),p=[...o];for(let c=p.length-1;c>0;c--){let h=Math.floor(u()*(c+1));[p[c],p[h]]=[p[h],p[c]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function xe(e,n){let t=null,s="",r=[];for(let i=0;ii.length)),c=t??p,h=u.map(i=>i.length===c?i:i.lengthl.length>0),h=o[0]?.replace(/\.csv$/,"")||"part";try{let l=n.fs.resolvePath(n.cwd,r);for(let i=0;i`Part ${f+1}: ${i.length} rows`).join(` -`)} -`,stderr:"",exitCode:0}}}function Ye(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")||"empty"}function ot(e){let n=2166136261;for(let t=0;t>>0;return n.toString(36).padStart(6,"0").slice(0,6)}async function ve(e,n){let t="",s=".",r=[];for(let l=0;l1?`${i}_${ot(l)}`:i,g=`${m}.csv`,y=1;for(;c.has(g);)g=`${m}_${y}.csv`,y++;c.add(g),h.set(l,g)}try{let l=n.fs.resolvePath(n.cwd,s);for(let[i,f]of u){let m=h.get(i);if(!m)continue;let g=n.fs.resolvePath(l,m);await n.fs.writeFile(g,w(o,f))}return{stdout:`Partitioned into ${u.size} files by '${t}' -`,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([i,f])=>`${i}: ${f.length} rows`).join(` -`)} -`,stderr:"",exitCode:0}}}async function Ce(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to [FILE] -`,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?it(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}' -`,exitCode:1}}async function it(e,n){let t=e.filter(a=>!a.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)} -`,stderr:"",exitCode:0}}async function be(e,n){let t="",s=[];for(let r=0;r [FILE] -`,exitCode:1}}async function at(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory -`,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array -`,exitCode:1};if(r.length===0)return{stdout:` -`,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[a,...d]=r,u=d.map(p=>{let c=F();for(let h=0;h0&&h.length>=s)break;let i=$(l,c,p),f=i.length>0&&i.some(m=>!!m);(t?!f:f)&&h.push(l)}return{stdout:w(a,h),stderr:"",exitCode:0}}async function ke(e,n){let t="",s=!1,r=!1,o=[];for(let c=0;c0&&(t=a[0]);let p=[...d].sort((c,h)=>{let l=c[t],i=h[t],f;if(s){let m=typeof l=="number"?l:Number.parseFloat(String(l)),g=typeof i=="number"?i:Number.parseFloat(String(i));f=m-g}else f=String(l).localeCompare(String(i));return r?-f:f});return{stdout:w(a,p),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=[];for(let p=0;p{let c=t?String(p[t]):JSON.stringify(p);return d.has(c)?!1:(d.add(c),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ne(e,n){let t=10,s="",r=!1,o=[];for(let h=0;h0&&(s=a[0]);let c=[...d].sort((h,l)=>{let i=h[s],f=l[s],m=typeof i=="number"?i:Number.parseFloat(String(i)),g=typeof f=="number"?f:Number.parseFloat(String(f));return r?m-g:g-m}).slice(0,t);return{stdout:w(a,c),stderr:"",exitCode:0}}V();async function Ee(e,n){let t="",s=!1,r=!1,o=[];for(let f=0;f({alias:typeof m=="string"?m:m[0],ast:O(f)})),h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l;if(s){l=[...a];for(let f of c)a.includes(f.alias)||l.push(f.alias)}else l=[...a,...c.map(f=>f.alias)];let i=[];for(let f=0;f0?N[0]:null;if(r&&C==null){y=!0;break}b(g,k.alias,C)}y||i.push(g)}return{stdout:w(l,i),stderr:"",exitCode:0}}async function Ae(e,n){let t="",s="",r="",o=[];for(let m=0;mm.trim()),c=r?r.split(",").map(m=>m.trim()):[];for(let m of p)if(!a.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found -`,exitCode:1};let h=O(U(s)[0]?.expr||(V(),tt(Je)).parseMoonblade(s)),l={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},i=a.map(m=>{let g=p.indexOf(m);return g!==-1&&c[g]?c[g]:m}),f=[];for(let m of d){let g=M(m);for(let y=0;y0?N[0]:null,A=c[y]||x;A!==x&&delete g[x],b(g,A,C)}f.push(g)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="|",r=!1,o="",a=[];for(let i=0;ii===t?o:i):d,h=o||t,l=[];for(let i of u){let f=i[t],m=f==null?"":String(f);if(m===""){if(!r){let g=M(i);o&&(delete g[t],b(g,h,"")),l.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(i);o&&delete x[t],b(x,h,y),l.push(x)}}}return{stdout:w(c,l),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r="",o=[];for(let g=0;gg!==t),c=r?a.map(g=>g===t?r:g):a,h=r||t,l=[],i=null,f=[],m=null;for(let g of d){let y=p.map(N=>String(g[N]??"")).join("\0"),x=g[t],k=x==null?"":String(x);if(y!==i){if(m!==null){let N=M(m);r&&delete N[t],b(N,h,f.join(s)),l.push(N)}i=y,f=[k],m=g}else f.push(k)}if(m!==null){let g=M(m);r&&delete g[t],b(g,h,f.join(s)),l.push(g)}return{stdout:w(c,l),stderr:"",exitCode:0}}async function Le(e,n){let t="",s="",r="",o="",a="inner",d="",u=0;for(let C=0;C!g.has(C)),x=[...h,...y],k=[],N=new Set;for(let C of l){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=F();for(let W of h)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);k.push(T)}}else if(a==="left"||a==="full"){let L=F();for(let T of h)b(L,T,C[T]);for(let T of y)b(L,T,d);k.push(L)}}if(a==="right"||a==="full")for(let C of f){let A=String(C[r]??"");if(!N.has(A)){let j=F();for(let L of h)b(j,L,i.includes(L)?C[L]:d);for(let L of y)b(j,L,C[L]);k.push(j)}}return{stdout:w(x,k),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r=[],o=[];for(let y=0;yk.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE] -`,exitCode:1};let{headers:a,data:d,error:u}=await v(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found -`,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}' -`,exitCode:1};let[,c,h]=p;r.length===0&&(r=a.filter(y=>y!==t&&y!==h));let l=[];for(let y of d){let x=String(y[t]??"");l.includes(x)||l.push(x)}let i=new Map,f=[];for(let y of d){let x=r.map(A=>String(y[A]??"")).join("\0"),k=String(y[t]??""),N=y[h];i.has(x)||(i.set(x,new Map),f.push(x));let C=i.get(x);C&&(C.has(k)||C.set(k,[]),C.get(k)?.push(N))}let m=[...r,...l],g=[];for(let y of f){let x=y.split("\0"),k=i.get(y);if(!k)continue;let N=F();for(let C=0;Cs!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Re(e,n){let t="",s=[];for(let d=0;d{let p=d[t],c=u[t],h=typeof p=="number"?p:Number.parseFloat(String(p)),l=typeof c=="number"?c:Number.parseFloat(String(c));return!Number.isNaN(h)&&!Number.isNaN(l)?h-l:String(p??"").localeCompare(String(c??""))})}return{stdout:w(o,a),stderr:"",exitCode:0}}V();async function Me(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>ut(p)).join(",")).join(` -`)+` -`,stderr:"",exitCode:0})}function ut(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(` -`)?`"${n.replace(/"/g,'""')}"`:n}async function $e(e,n){let t=null,s=null,r=[];for(let l=0;l0?t=f:r.push(i)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample [FILE] -`,exitCode:1};let{headers:o,data:a,error:d}=await v(r,n);if(d)return d;if(a.length<=t)return{stdout:w(o,a),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),c=a.map((l,i)=>i);for(let l=c.length-1;l>0;l--){let i=Math.floor(p()*(l+1));[c[l],c[i]]=[c[i],c[l]]}let h=c.slice(0,t).sort((l,i)=>l-i).map(l=>a[l]);return{stdout:w(o,h),stderr:"",exitCode:0}}async function Te(e,n){let t=!1,s=[];for(let u=0;u0?s:d,h;try{h=H(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}' -`,exitCode:1}}let l=u.filter(i=>{let f=c.some(m=>{let g=i[m];return g!=null&&h.test(String(g))});return r?!f:f});return{stdout:w(d,l),stderr:"",exitCode:0}}async function De(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified -`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let u=U(t).map(({expr:l,name:i})=>({alias:typeof i=="string"?i:i[0],ast:O(l)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c=[...r,...u.map(l=>l.alias)],h=[];for(let l of o){let i=[],f=1;for(let m of u){let g=$(l,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;i.push(y),f=Math.max(f,y.length)}for(let m=0;m [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data. -It provides a simple, ergonomic interface for common data operations. - -COMMANDS: - Core: - headers Show column names - count Count rows - head Show first N rows - tail Show last N rows - slice Extract row range - reverse Reverse row order - behead Remove header row - sample Random sample of rows - - Column operations: - select Select columns (supports glob, ranges, negation) - drop Drop columns - rename Rename columns - enum Add row index column - - Row operations: - filter Filter rows by expression - search Filter rows by regex match - sort Sort rows - dedup Remove duplicates - top Get top N by column - - Transformations: - map Add computed columns - transform Modify existing columns - explode Split column into multiple rows - implode Combine rows, join column values - flatmap Map returning multiple rows - pivot Reshape rows into columns - transpose Swap rows and columns - - Aggregation: - agg Aggregate values - groupby Group and aggregate - frequency Count value occurrences - stats Show column statistics - - Multi-file: - cat Concatenate CSV files - join Join two CSV files on key - merge Merge sorted CSV files - split Split into multiple files - partition Split by column value - - Data conversion: - to Convert CSV to other formats (json) - from Convert other formats to CSV (json) - shuffle Randomly reorder rows - fixlengths Fix ragged CSV files - - Output: - view Pretty print as table - flatten Display records vertically (alias: f) - fmt Format output - -EXAMPLES: - xan headers data.csv - xan count data.csv - xan head -n 5 data.csv - xan select name,email data.csv - xan select 'vec_*' data.csv # glob pattern - xan select 'a:c' data.csv # column range - xan filter 'age > 30' data.csv - xan search -r '^foo' data.csv - xan sort -N price data.csv - xan agg 'sum(amount) as total' data.csv - xan groupby region 'count() as n' data.csv - xan explode tags data.csv - xan join id file1.csv id file2.csv - xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},pt={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},hn={name:"xan",async execute(e,n){if(e.length===0||G(e))return D(Be);let t=e[0],s=e.slice(1);if(G(s)){let r=pt[t];return r?D(r):D(Be)}if(Ze.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented -`,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return ke(s,n);case"dedup":return Ie(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return Fe(s,n);case"implode":return Oe(s,n);case"flatmap":return De(s,n);case"pivot":return Pe(s,n);case"agg":return te(s,n);case"groupby":return ne(s,n);case"frequency":case"freq":return se(s,n);case"stats":return re(s,n);case"cat":return Te(s,n);case"join":return Le(s,n);case"merge":return Re(s,n);case"split":return we(s,n);case"partition":return ve(s,n);case"to":return Ce(s,n);case"from":return be(s,n);case"transpose":return ge(s,n);case"shuffle":return ye(s,n);case"fixlengths":return xe(s,n);case"view":return B(s,n);case"flatten":case"f":return Y(s,n);case"fmt":return Ue(s,n);default:return ct.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented -`,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}' -Run 'xan --help' for usage. -`,exitCode:1}}}},mn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{hn as a,mn as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AXWFPG37.js b/packages/just-bash/dist/bin/chunks/chunk-AXWFPG37.js deleted file mode 100644 index e2b01b63..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-AXWFPG37.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -import{a as d}from"./chunk-YTIURC67.js";import{a as n,b as i}from"./chunk-OOJCYVYF.js";import{a,b as l}from"./chunk-GTNBSMZR.js";var u={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be: - s - seconds (default) - m - minutes - h - hours - d - days - -NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},m=36e5,h={name:"sleep",async execute(r,s){if(l(r))return a(u);if(r.length===0)return{stdout:"",stderr:`sleep: missing operand -`,exitCode:1};let t=0;for(let e of r){let o=d(e);if(o===null)return{stdout:"",stderr:`sleep: invalid time interval '${e}' -`,exitCode:1};t+=o}return t>m&&(t=m),s.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(s.sleep?await s.sleep(t):s.signal?await new Promise(e=>{let o=()=>{i(p),e()},p=n(()=>{s.signal?.removeEventListener("abort",o),e()},t);s.signal?.addEventListener("abort",o,{once:!0})}):await new Promise(e=>n(e,t)),{stdout:"",stderr:"",exitCode:0})}},b={name:"sleep",flags:[],needsArgs:!0};export{h as a,b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-AZ3RUDR2.js b/packages/just-bash/dist/bin/chunks/chunk-AZ3RUDR2.js deleted file mode 100644 index ef257987..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-AZ3RUDR2.js +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -import{a as p}from"./chunk-RLNOQILG.js";import{a as m,b as g,c as h}from"./chunk-GTNBSMZR.js";var y={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},v={name:"ln",async execute(n,s){if(g(n))return m(y);let r=!1,a=!1,f=!1,t=0;for(;t '${i}' -`),{stdout:c,stderr:"",exitCode:0}}},$={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{v as a,$ as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-B2DRBHGQ.js b/packages/just-bash/dist/bin/chunks/chunk-B2DRBHGQ.js new file mode 100644 index 00000000..6b8307d1 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-B2DRBHGQ.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +function n(e){let r=e.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!r)return null;let t=parseFloat(r[1]);switch(r[2]||"s"){case"s":return t*1e3;case"m":return t*60*1e3;case"h":return t*60*60*1e3;case"d":return t*24*60*60*1e3;default:return null}}export{n as a}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BE4PARL3.js b/packages/just-bash/dist/bin/chunks/chunk-BE4PARL3.js new file mode 100644 index 00000000..d752d081 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-BE4PARL3.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as y}from"./chunk-B2DRBHGQ.js";import{a as O}from"./chunk-3MRB66F4.js";import{a as c,b as p}from"./chunk-KRRM5UCC.js";import{a as h,b as A,c as u}from"./chunk-MUFNRCMY.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION. + +DURATION is a number with optional suffix: + s - seconds (default) + m - minutes + h - hours + d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},I={name:"timeout",async execute(s,r){if(A(s))return h(x);let i=0;for(let e=0;e1&&t!=="--")if(t.startsWith("-k"))i=e+1;else if(t.startsWith("-s"))i=e+1;else return u("timeout",t);else{i=e;break}}}let n=s.slice(i);if(n.length===0)return{stdout:"",stderr:`timeout: missing operand +`,exitCode:1};let m=n[0],d=y(m);if(d===null)return{stdout:"",stderr:`timeout: invalid time interval '${m}' +`,exitCode:1};let o=n.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand +`,exitCode:1};if(!r.exec)return{stdout:"",stderr:`timeout: exec not available +`,exitCode:1};let f=new AbortController,a;try{let e=new Promise(l=>{a=c(()=>{f.abort(),l({timedOut:!0})},d)}),t=r.exec(O([o[0]]),{cwd:r.cwd,signal:f.signal,stdin:r.stdin,stdinKind:"bytes",args:o.slice(1)}).then(l=>({timedOut:!1,result:l})),g=await Promise.race([e,t]);return g.timedOut?{stdout:"",stderr:"",exitCode:124}:g.result}finally{a!==void 0&&p(a)}}},T={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{I as a,T as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BGGF3ELU.js b/packages/just-bash/dist/bin/chunks/chunk-BGGF3ELU.js deleted file mode 100644 index 6d8fd935..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-BGGF3ELU.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -import{a}from"./chunk-JDNI5HBX.js";import{a as d}from"./chunk-RLNOQILG.js";var S={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand -`,exitCode:2};try{let c=x(s),h=c==="0"||c===""?1:0;return{stdout:`${c} -`,stderr:"",exitCode:h}}catch(c){return{stdout:"",stderr:`expr: ${d(c.message)} -`,exitCode:2}}}};function x(s){if(s.length===1)return s[0];let r=0;function c(){let e=h();for(;r","<=",">="].includes(t)){r++;let o=g(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),l;t==="="?l=f?n===i:e===o:t==="!="?l=f?n!==i:e!==o:t==="<"?l=f?n"?l=f?n>i:e>o:t==="<="?l=f?n<=i:e<=o:l=f?n>=i:e>=o,e=l?"1":"0"}else break}return e}function g(){let e=p();for(;r=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),i=a(o).match(t);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return c()}var E={name:"expr",flags:[],needsArgs:!0};export{S as a,E as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BGX3RW7H.js b/packages/just-bash/dist/bin/chunks/chunk-BGX3RW7H.js new file mode 100644 index 00000000..2e9e6af8 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-BGX3RW7H.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +async function c(e,t){if(e.length>0&&e[0]!=="-"){let i=t.fs.resolvePath(t.cwd,e[0]);try{let o=(await t.fs.readFile(i)).split(` +`);o[o.length-1]===""&&o.pop();let r=o.reverse();return{stdout:r.length>0?`${r.join(` +`)} +`:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory +`,exitCode:1}}}let n=t.stdin.split(` +`);n[n.length-1]===""&&n.pop();let s=n.reverse();return{stdout:s.length>0?`${s.join(` +`)} +`:"",stderr:"",exitCode:0}}var u={name:"tac",execute:c},f={name:"tac",flags:[],stdinType:"text",needsFiles:!0};export{u as a,f as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BIJXTWZ4.js b/packages/just-bash/dist/bin/chunks/chunk-BIJXTWZ4.js new file mode 100644 index 00000000..92edf5cb --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-BIJXTWZ4.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +function x(r,o){let t=o?"d":"-",n=[r&256?"r":"-",r&128?"w":"-",r&64?"x":"-",r&32?"r":"-",r&16?"w":"-",r&8?"x":"-",r&4?"r":"-",r&2?"w":"-",r&1?"x":"-"];return t+n.join("")}export{x as a}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BPZJYOUA.js b/packages/just-bash/dist/bin/chunks/chunk-BPZJYOUA.js new file mode 100644 index 00000000..768824b5 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-BPZJYOUA.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as $}from"./chunk-NE4R2FVV.js";import{a as z,b as w}from"./chunk-MUFNRCMY.js";import{constants as x,gunzipSync as F,gzipSync as S}from"node:zlib";var O={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place). + +When no FILE is given, or when FILE is -, read from standard input. + +With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},U={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place). + +When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},D={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output. + +When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},T={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function E(e){return e.best?x.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?x.Z_BEST_SPEED:x.Z_DEFAULT_COMPRESSION}function k(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],r=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,o=10;if(t&4){if(o+2>e.length)return{originalName:null,mtime:null,headerSize:0};let n=e[o]|e[o+1]<<8;o+=2+n}let s=null;if(t&8){let n=o;for(;o0?new Date(r*1e3):null,headerSize:o}}function q(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function b(e){return e.length>=2&&e[0]===31&&e[1]===139}function m(e){return Buffer.from(e).toString("latin1")}function I(e){return e.limits?.maxOutputSize??0}function v(e,t){if(t>0){if(q(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return F(e,{maxOutputLength:t})}return F(e)}async function L(e,t,r,o,s,n){let a=r.suffix,f,p,d,c=I(e);if(t==="-"||t==="")if(d=Uint8Array.from(e.stdin,i=>i.charCodeAt(0)),s){if(!b(d))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: stdin: not in gzip format +`,exitCode:1};try{let i=v(d,c);return{stdout:m(i),stderr:"",exitCode:0}}catch(i){let l=i instanceof Error?i.message:"unknown error";return{stdout:"",stderr:`${o}: stdin: ${l} +`,exitCode:1}}}else{let i=E(r),l=S(d,{level:i});return{stdout:m(l),stderr:"",exitCode:0}}f=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(f)).isDirectory)return r.recursive?await P(e,f,r,o,s,n):r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: is a directory -- ignored +`,exitCode:1}}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory +`,exitCode:1}}try{d=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory +`,exitCode:1}}if(s){if(!t.endsWith(a))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: unknown suffix -- ignored +`,exitCode:1};if(!b(d))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format +`,exitCode:1};let i;try{i=v(d,c)}catch(l){let u=l instanceof Error?l.message:"unknown error";return{stdout:"",stderr:`${o}: ${t}: ${u} +`,exitCode:1}}if(n)return{stdout:m(i),stderr:"",exitCode:0};if(r.name){let l=k(d);l.originalName?p=e.fs.resolvePath(e.cwd,l.originalName):p=f.slice(0,-a.length)}else p=f.slice(0,-a.length);if(!r.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${o}: ${p} already exists; not overwritten +`,exitCode:1}}catch{}if(await e.fs.writeFile(p,i),!r.keep&&!n&&await e.fs.rm(f),r.verbose){let l=d.length>0?((1-d.length/i.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${l}% -- replaced with ${p.split("/").pop()} +`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(a))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t} already has ${a} suffix -- unchanged +`,exitCode:1};let i=E(r),l;try{l=S(d,{level:i})}catch(u){let g=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`${o}: ${t}: ${g} +`,exitCode:1}}if(n)return{stdout:m(l),stderr:"",exitCode:0};if(p=f+a,!r.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${o}: ${p} already exists; not overwritten +`,exitCode:1}}catch{}if(await e.fs.writeFile(p,l),!r.keep&&!n&&await e.fs.rm(f),r.verbose){let u=d.length>0?((1-l.length/d.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${u}% -- replaced with ${p.split("/").pop()} +`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function P(e,t,r,o,s,n){let a=await e.fs.readdir(t),f="",p="",d=0;for(let c of a){let i=e.fs.resolvePath(t,c),l=await e.fs.stat(i);if(l.isDirectory){let u=await P(e,i,r,o,s,n);f+=u.stdout,p+=u.stderr,u.exitCode!==0&&(d=u.exitCode)}else if(l.isFile){let u=r.suffix;if(s&&!c.endsWith(u)||!s&&c.endsWith(u))continue;let g=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,y=await L(e,g,r,o,s,n);f+=y.stdout,p+=y.stderr,y.exitCode!==0&&(d=y.exitCode)}}return{stdout:f,stderr:p,exitCode:d}}async function W(e,t,r,o){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory +`,exitCode:1}}}if(!b(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format +`,exitCode:1};let n=s.length,a=q(s),f=a>0?((1-n/a)*100).toFixed(1):"0.0",d=k(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${n.toString().padStart(10)} ${a.toString().padStart(10)} ${f.padStart(5)}% ${d} +`,stderr:"",exitCode:0}}async function A(e,t,r,o){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,n=>n.charCodeAt(0));else{let n=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`${o}: ${t}: No such file or directory +`,exitCode:1}}}if(!b(s))return r.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${o}: ${t}: not in gzip format +`,exitCode:1};try{return v(s,I(e)),r.verbose?{stdout:"",stderr:`${t}: OK +`,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(n){let a=n instanceof Error?n.message:"invalid";return{stdout:"",stderr:`${o}: ${t}: ${a} +`,exitCode:1}}}async function C(e,t,r){let o=r==="zcat"?D:r==="gunzip"?U:O;if(w(e))return z(o);let s=$(r,e,T);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let n=s.result.flags,a=s.result.positional,f=r==="gunzip"||r==="zcat"||n.decompress||n.uncompress,p=r==="zcat"||n.stdout||n.toStdout;if(n.list){a.length===0&&(a=["-"]);let l=` compressed uncompressed ratio uncompressed_name +`,u="",g=0;for(let y of a){let h=await W(t,y,n,r);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}if(n.test){a.length===0&&(a=["-"]);let l="",u="",g=0;for(let y of a){let h=await A(t,y,n,r);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}a.length===0&&(a=["-"]);let d="",c="",i=0;for(let l of a){let u=await L(t,l,n,r,f,p);d+=u.stdout,c+=u.stderr,u.exitCode!==0&&(i=u.exitCode)}return{stdout:d,stderr:c,exitCode:i}}var Z={name:"gzip",async execute(e,t){return{...await C(e,t,"gzip"),stdoutEncoding:"binary"}}},R={name:"gunzip",async execute(e,t){return{...await C(e,t,"gunzip"),stdoutEncoding:"binary"}}},K={name:"zcat",async execute(e,t){return{...await C(e,t,"zcat"),stdoutEncoding:"binary"}}},j={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},J={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},Q={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0};export{Z as a,R as b,K as c,j as d,J as e,Q as f}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BYDV4VEF.js b/packages/just-bash/dist/bin/chunks/chunk-BYDV4VEF.js deleted file mode 100644 index 855eee16..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-BYDV4VEF.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -async function t(e,n){return{stdout:`localhost -`,stderr:"",exitCode:0}}var o={name:"hostname",execute:t},s={name:"hostname",flags:[]};export{o as a,s as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-BZP56QBM.js b/packages/just-bash/dist/bin/chunks/chunk-BZP56QBM.js new file mode 100644 index 00000000..5b4a0806 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-BZP56QBM.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as Ue,b as Re,c as ge}from"./chunk-MUFNRCMY.js";import{a as re,c as L,e as Le}from"./chunk-LNVSXNT7.js";var _e=L(ye=>{ye.read=function(i,e,t,r,n){var o,s,a=n*8-r-1,m=(1<>1,c=-7,p=t?n-1:0,u=t?-1:1,d=i[e+p];for(p+=u,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=o*256+i[e+p],p+=u,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+i[e+p],p+=u,c-=8);if(o===0)o=1-f;else{if(o===m)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-f}return(d?-1:1)*s*Math.pow(2,o-r)};ye.write=function(i,e,t,r,n,o){var s,a,m,f=o*8-n-1,c=(1<>1,u=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,B=r?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-s))<1&&(s--,m*=2),s+p>=1?e+=u/m:e+=u*Math.pow(2,1-p),e*m>=2&&(s++,m/=2),s+p>=c?(a=0,s=c):s+p>=1?(a=(e*m-1)*Math.pow(2,n),s=s+p):(a=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;i[t+d]=a&255,d+=B,a/=256,n-=8);for(s=s<0;i[t+d]=s&255,d+=B,s/=256,f-=8);i[t+d-B]|=k*128}});var Je=L((cn,He)=>{var H=1e3,J=H*60,X=J*60,$=X*24,qt=$*7,Ht=$*365.25;He.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Jt(i);if(t==="number"&&isFinite(i))return e.long?Qt(i):Xt(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Jt(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Ht;case"weeks":case"week":case"w":return t*qt;case"days":case"day":case"d":return t*$;case"hours":case"hour":case"hrs":case"hr":case"h":return t*X;case"minutes":case"minute":case"mins":case"min":case"m":return t*J;case"seconds":case"second":case"secs":case"sec":case"s":return t*H;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Xt(i){var e=Math.abs(i);return e>=$?Math.round(i/$)+"d":e>=X?Math.round(i/X)+"h":e>=J?Math.round(i/J)+"m":e>=H?Math.round(i/H)+"s":i+"ms"}function Qt(i){var e=Math.abs(i);return e>=$?fe(i,e,$,"day"):e>=X?fe(i,e,X,"hour"):e>=J?fe(i,e,J,"minute"):e>=H?fe(i,e,H,"second"):i+" ms"}function fe(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var Ce=L((fn,Xe)=>{function Yt(i){t.debug=t,t.default=t,t.coerce=m,t.disable=s,t.enable=n,t.enabled=a,t.humanize=Je(),t.destroy=f,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let p=0;for(let u=0;u{if(he==="%%")return"%";ie++;let Me=t.formatters[Bt];if(typeof Me=="function"){let Dt=E[ie];he=Me.call(P,Dt),E.splice(ie,1),ie--}return he}),t.formatArgs.call(P,E),(P.log||t.log).apply(P,E)}return k.namespace=c,k.useColors=t.useColors(),k.color=t.selectColor(c),k.extend=r,k.destroy=t.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(d!==t.namespaces&&(d=t.namespaces,B=t.enabled(c)),B),set:E=>{u=E}}),typeof t.init=="function"&&t.init(k),k}function r(c,p){let u=t(this.namespace+(typeof p>"u"?":":p)+c);return u.log=this.log,u}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let p=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let u of p)u[0]==="-"?t.skips.push(u.slice(1)):t.names.push(u)}function o(c,p){let u=0,d=0,B=-1,k=0;for(;u"-"+p)].join(",");return t.enable(""),c}function a(c){for(let p of t.skips)if(o(c,p))return!1;for(let p of t.names)if(o(c,p))return!0;return!1}function m(c){return c instanceof Error?c.stack||c.message:c}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Xe.exports=Yt});var Qe=L((F,pe)=>{F.formatArgs=ei;F.save=ti;F.load=ii;F.useColors=Kt;F.storage=ri();F.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();F.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Kt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ei(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+pe.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}F.log=console.debug||console.log||(()=>{});function ti(i){try{i?F.storage.setItem("debug",i):F.storage.removeItem("debug")}catch{}}function ii(){let i;try{i=F.storage.getItem("debug")||F.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function ri(){try{return localStorage}catch{}}pe.exports=Ce()(F);var{formatters:ni}=pe.exports;ni.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Ke=L((pn,Ye)=>{"use strict";Ye.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r{"use strict";var oi=re("os"),et=re("tty"),T=Ke(),{env:w}=process,U;T("no-color")||T("no-colors")||T("color=false")||T("color=never")?U=0:(T("color")||T("colors")||T("color=true")||T("color=always"))&&(U=1);"FORCE_COLOR"in w&&(w.FORCE_COLOR==="true"?U=1:w.FORCE_COLOR==="false"?U=0:U=w.FORCE_COLOR.length===0?1:Math.min(parseInt(w.FORCE_COLOR,10),3));function Se(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Fe(i,e){if(U===0)return 0;if(T("color=16m")||T("color=full")||T("color=truecolor"))return 3;if(T("color=256"))return 2;if(i&&!e&&U===void 0)return 0;let t=U||0;if(w.TERM==="dumb")return t;if(process.platform==="win32"){let r=oi.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in w)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in w)||w.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in w)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(w.TEAMCITY_VERSION)?1:0;if(w.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in w){let r=parseInt((w.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(w.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(w.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(w.TERM)||"COLORTERM"in w?1:t}function si(i){let e=Fe(i,i&&i.isTTY);return Se(e)}tt.exports={supportsColor:si,stdout:Se(Fe(!0,et.isatty(1))),stderr:Se(Fe(!0,et.isatty(2)))}});var nt=L((y,ue)=>{var ai=re("tty"),me=re("util");y.init=di;y.log=mi;y.formatArgs=fi;y.save=ui;y.load=li;y.useColors=ci;y.destroy=me.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");y.colors=[6,2,3,4,5,1];try{let i=it();i&&(i.stderr||i).level>=2&&(y.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}y.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,o)=>o.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function ci(){return"colors"in y.inspectOpts?!!y.inspectOpts.colors:ai.isatty(process.stderr.fd)}function fi(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),o=` ${n};1m${e} \x1B[0m`;i[0]=o+i[0].split(` +`).join(` +`+o),i.push(n+"m+"+ue.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=pi()+e+" "+i[0]}function pi(){return y.inspectOpts.hideDate?"":new Date().toISOString()+" "}function mi(...i){return process.stderr.write(me.formatWithOptions(y.inspectOpts,...i)+` +`)}function ui(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function li(){return process.env.DEBUG}function di(i){i.inspectOpts={};let e=Object.keys(y.inspectOpts);for(let t=0;te.trim()).join(" ")};rt.O=function(i){return this.inspectOpts.colors=this.useColors,me.inspect(i,this.inspectOpts)}});var ot=L((un,Ee)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ee.exports=Qe():Ee.exports=nt()});var Ot="End-Of-Stream",l=class extends Error{constructor(){super(Ot),this.name="EndOfStreamError"}},N=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var j=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new l;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o0){let s=new Uint8Array(r.length+o);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t?.mayBeLess&&o instanceof l)return 0;throw o}if(!r.mayBeLess&&n{if(await t.close(),n)return n()},new oe(t,r)}function Ne(i,e){return new se(i,e)}function je(i,e){return new ae(i,e)}import{open as Ut}from"node:fs/promises";var V=class i extends A{static async fromFile(e){let t=await Ut(e,"r"),r=await t.stat();return new i(t,{fileInfo:{path:e,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let r=this.normalizeOptions(e,t);if(this.position=r.position,r.length===0)return 0;let n=await this.fileHandle.read(e,0,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead"u"))return ce??(ce=new globalThis.TextDecoder("utf-8"))}var q=32*1024,I=65533;function We(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":{let t=Nt();return t?t.decode(i):_t(i)}case"utf-16le":return $t(i);case"us-ascii":case"ascii":return Wt(i);case"latin1":case"iso-8859-1":return Gt(i);case"windows-1252":return Zt(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function ke(i,e){e.length!==0&&(i.push(String.fromCharCode.apply(null,e)),e.length=0)}function g(i,e,t){e.push(t),e.length>=q&&ke(i,e)}function jt(i,e,t){if(t<=65535){g(i,e,t);return}t-=65536,g(i,e,55296+(t>>10)),g(i,e,56320+(t&1023))}function _t(i){let e=[],t=[],r=0;for(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191&&(r=3);r244){g(e,t,I),r++;continue}if(n<=223){if(r+1>=i.length){g(e,t,I),r++;continue}let c=i[r+1];if((c&192)!==128){g(e,t,I),r++;continue}let p=(n&31)<<6|c&63;g(e,t,p),r+=2;continue}if(n<=239){if(r+2>=i.length){g(e,t,I),r++;continue}let c=i[r+1],p=i[r+2];if(!((c&192)===128&&(p&192)===128&&!(n===224&&c<160)&&!(n===237&&c>=160))){g(e,t,I),r++;continue}let d=(n&15)<<12|(c&63)<<6|p&63;g(e,t,d),r+=3;continue}if(r+3>=i.length){g(e,t,I),r++;continue}let o=i[r+1],s=i[r+2],a=i[r+3];if(!((o&192)===128&&(s&192)===128&&(a&192)===128&&!(n===240&&o<144)&&!(n===244&&o>143))){g(e,t,I),r++;continue}let f=(n&7)<<18|(o&63)<<12|(s&63)<<6|a&63;jt(e,t,f),r+=4}return ke(e,t),e.join("")}function $t(i){let e=[],t=[],r=i.length,n=0;for(;n+1=55296&&o<=56319){if(n+1=56320&&s<=57343?(g(e,t,o),g(e,t,s),n+=2):g(e,t,I)}else g(e,t,I);continue}if(o>=56320&&o<=57343){g(e,t,I);continue}g(e,t,o)}return n=128&&n<=159?$e[n]:void 0;t+=o??String.fromCharCode(n),t.length>=q&&(e.push(t),t="")}return t&&e.push(t),e.join("")}function C(i){return new DataView(i.buffer,i.byteOffset)}var Ze={len:1,get(i,e){return C(i).getUint8(e)},put(i,e,t){return C(i).setUint8(e,t),e+1}},h={len:2,get(i,e){return C(i).getUint16(e,!0)},put(i,e,t){return C(i).setUint16(e,t,!0),e+2}},_={len:2,get(i,e){return C(i).getUint16(e)},put(i,e,t){return C(i).setUint16(e,t),e+2}};var x={len:4,get(i,e){return C(i).getUint32(e,!0)},put(i,e,t){return C(i).setUint32(e,t,!0),e+4}},be={len:4,get(i,e){return C(i).getUint32(e)},put(i,e,t){return C(i).setUint32(e,t),e+4}};var Ve={len:4,get(i,e){return C(i).getInt32(e)},put(i,e,t){return C(i).setInt32(e,t),e+4}};var qe={len:8,get(i,e){return C(i).getBigUint64(e,!0)},put(i,e,t){return C(i).setBigUint64(e,t,!0),e+8}};var S=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return We(r,this.encoding)}};var ft=Le(ot(),1);var W={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Te={get(i){return{signature:x.get(i,0),compressedSize:x.get(i,8),uncompressedSize:x.get(i,12)}},len:16},st={get(i){let e=h.get(i,6);return{signature:x.get(i,0),minVersion:h.get(i,4),dataDescriptor:!!(e&8),compressedMethod:h.get(i,8),compressedSize:x.get(i,18),uncompressedSize:x.get(i,22),filenameLength:h.get(i,26),extraFieldLength:h.get(i,28),filename:null}},len:30},at={get(i){return{signature:x.get(i,0),nrOfThisDisk:h.get(i,4),nrOfThisDiskWithTheStart:h.get(i,6),nrOfEntriesOnThisDisk:h.get(i,8),nrOfEntriesOfSize:h.get(i,10),sizeOfCd:x.get(i,12),offsetOfStartOfCd:x.get(i,16),zipFileCommentLength:h.get(i,20)}},len:22},ct={get(i){let e=h.get(i,8);return{signature:x.get(i,0),minVersion:h.get(i,6),dataDescriptor:!!(e&8),compressedMethod:h.get(i,10),compressedSize:x.get(i,20),uncompressedSize:x.get(i,24),filenameLength:h.get(i,28),extraFieldLength:h.get(i,30),fileCommentLength:h.get(i,32),relativeOffsetOfLocalHeader:x.get(i,42),filename:null}},len:46};function pt(i){let e=new Uint8Array(x.len);return x.put(e,0,i),e}var D=(0,ft.default)("tokenizer:inflate"),ve=256*1024,xi=pt(W.DataDescriptor),le=pt(W.EndOfCentralDirectory),G=class i{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(ve)}async isZip(){return await this.peekSignature()===W.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(x)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===le[0]&&r[n+1]===le[1]&&r[n+2]===le[2]&&r[n+3]===le[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){D("Cannot reading central-directory without random-read support");return}D("Reading central-directory...");let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){D("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(at,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o=0?f:m;if(o.handler){let p=new Uint8Array(c);await this.tokenizer.readBuffer(p),a.push(p)}else await this.tokenizer.ignore(c)}D(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,gi(a),o.handler)}else o.handler?(D(`Reading compressed-file-data: ${n.compressedSize} bytes`),s=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(n,s,o.handler)):(D(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(D(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(Te)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Te.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(let r of e){let n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);let s=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(o,s,n.handler)}}if(n.stop)break}}async inflate(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);D(`Decompress filename=${e.filename}, compressed-size=${t.length}`);let n=await i.decompressDeflateRaw(t);return r(n)}static async decompressDeflateRaw(e){let t=new ReadableStream({start(o){o.enqueue(e),o.close()}}),r=new DecompressionStream("deflate-raw"),n=t.pipeThrough(r);try{let s=await new Response(n).arrayBuffer();return new Uint8Array(s)}catch(o){let s=o instanceof Error?`Failed to deflate ZIP entry: ${o.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(x);if(e===W.LocalFileHeader){let t=await this.tokenizer.readToken(st);return t.filename=await this.tokenizer.readToken(new S(t.filenameLength,"utf-8")),t}if(e===W.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function hi(i,e){let t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let s=0;sn+o.length,0),t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}var Y=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}};var Cn={utf8:new globalThis.TextDecoder("utf8")};var Sn=new globalThis.TextEncoder;var Fn=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ae(i){let{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function mt(i,e){if(e==="utf-16le"){let t=[];for(let r=0;r>8&255)}return t}if(e==="utf-16be"){let t=[];for(let r=0;r>8&255,n&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function ut(i,e=0){let t=Number.parseInt(new S(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=256;for(let n=e;ni[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4};var dt=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],xt=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"];var K=4100,wi=K-2,z=1024*1024,ht=1024,yi=2**31-1,v=16*1024*1024,xe=z,gt=z,ki=v,bi=1,wt=100,Ie=v,yt=64,kt=xe,Ci=256,Si=512,Fi=v,Ei=512,Ti=512,bt=256,Ct=xe,St=xe,vi=xe,Ft=v,Ai=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Ii=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Bi=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),M=class extends Error{};function Di(i){let e=i?.streamReader;if(e?.constructor?.name!=="WebStreamByobReader")return i;let{reader:t}=e,r=async()=>{await t.cancel(),t.releaseLock()};return e.close=r,e.abort=async()=>{e.interrupted=!0,await r()},i}function Oe(i,e,t){if(!Number.isFinite(i)||i<0||i>e)throw new M(`${t} has invalid size ${i} (maximum ${e} bytes)`);return i}async function R(i,e,{maximumLength:t=v,reason:r="skip"}={}){let n=Oe(e,t,r);await i.ignore(n)}async function Be(i,e,t,{maximumLength:r=e.length,reason:n="read"}={}){let o=t?.length??e.length,s=Oe(o,r,n);return i.readBuffer(e,{...t,length:s})}async function Oi(i,{maximumLength:e=z}={}){let n=new ReadableStream({start(f){f.enqueue(i),f.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),o=[],s=0;try{for(;;){let{done:f,value:c}=await n.read();if(f)break;if(s+=c.length,s>e)throw await n.cancel(),new Error(`ZIP entry decompressed data exceeds ${e} bytes`);o.push(c)}}finally{n.releaseLock()}let a=new Uint8Array(s),m=0;for(let f of o)a.set(f,m),m+=f.length;return a}var At=134695760,de=16,zi=de-1;function Mi(i,e){if(i.length=0?0:a===n?Math.min(zi,a-1):0,c=m>=0?m:a-f;if(c===0)break;if(s+=c,s>t)throw new Error(`ZIP entry compressed data exceeds ${t} bytes`);if(e){let p=new Uint8Array(c);await i.tokenizer.readBuffer(p),o.push(p)}else await i.tokenizer.ignore(c);if(m>=0)break}if(b(i.tokenizer)||(i.knownSizeDescriptorScannedBytes+=s),!!e)return Ui(o,s)}function Pi(i,e){return b(i.tokenizer)?Math.max(0,v-(i.tokenizer.position-e)):Math.max(0,z-i.knownSizeDescriptorScannedBytes)}async function Ni(i,e,{shouldBuffer:t,maximumDescriptorLength:r=z}={}){if(e.dataDescriptor&&e.compressedSize===0)return Ri(i,{shouldBuffer:t,maximumLength:r});if(!t){await R(i.tokenizer,e.compressedSize,{maximumLength:b(i.tokenizer)?z:i.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=Zi(i.tokenizer);if(!Number.isFinite(e.compressedSize)||e.compressedSize<0||e.compressedSize>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);let o=new Uint8Array(e.compressedSize);return await i.tokenizer.readBuffer(o),o}G.prototype.inflate=async function(i,e,t){if(i.compressedMethod===0)return t(e);if(i.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${i.compressedMethod}`);let r=await Oi(e,{maximumLength:z});return t(r)};G.prototype.unzip=async function(i){let e=!1,t=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(t++,t>ht)throw new Error(`ZIP entry count exceeds ${ht}`);let o=i(n);e=!!o.stop,await this.tokenizer.ignore(n.extraFieldLength);let s=await Ni(this,n,{shouldBuffer:!!o.handler,maximumDescriptorLength:Math.min(z,Pi(this,r))});if(o.handler&&await this.inflate(n,s,o.handler),n.dataDescriptor){let a=new Uint8Array(de);if(await this.tokenizer.readBuffer(a),x.get(a,0)!==At)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`)}while(!e)};function ji(i,e){let t=i.getReader(),r=0,n=!1,o=!1,s=async a=>{n||o||(o=!0,await t.cancel(a))};return new ReadableStream({async pull(a){if(r>=e){a.close(),await s();return}let{done:m,value:f}=await t.read();if(m||!f){n=!0,a.close();return}let c=e-r;if(f.length>c){a.enqueue(f.subarray(0,c)),r+=c,a.close(),await s();return}a.enqueue(f),r+=f.length},async cancel(a){await s(a)}})}async function ze(i,e){return new De(e).fromBuffer(i)}function Et(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function O(i,e,t){t={offset:0,...t};for(let[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}function _i(i){return Number.isFinite(i)?Math.max(1,Math.trunc(i)):K}function $i(i,e,t){return t===void 0?i.read(e):(t.throwIfAborted(),new Promise((r,n)=>{let o=()=>{t.removeEventListener("abort",s)},s=()=>{let a=t.reason;o(),(async()=>{try{await i.cancel(a)}catch{}})(),n(a)};t.addEventListener("abort",s,{once:!0}),(async()=>{try{let a=await i.read(e);o(),r(a)}catch(a){o(),n(a)}})()}))}function Wi(i){return Number.isFinite(i)?Math.max(0,Math.min(wi,Math.trunc(i))):0}function Gi(i){return Number.isFinite(i)?Math.max(0,i):Number.MAX_SAFE_INTEGER}function b(i){let e=i.fileInfo.size;return!Number.isFinite(e)||e===Number.MAX_SAFE_INTEGER}function ee(i,e,t){return b(i)&&i.position-e>t}function Zi(i){let e=i.fileInfo.size,t=Number.isFinite(e)?Math.max(0,e-i.position):Number.MAX_SAFE_INTEGER;return Math.min(t,yi)}function Vi(i){if(i instanceof l||i instanceof M)return!0;if(!(i instanceof Error))return!1;if(Ai.has(i.message)||Bi.has(i.code))return!0;for(let e of Ii)if(i.message.startsWith(e))return!0;return!1}function Tt(i,e=z){let t=[i.compressedSize,i.uncompressedSize];for(let r of t)if(!Number.isFinite(r)||r<0||r>e)return!1;return!0}function qi(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function Hi(i,e){e.startsWith("word/")&&(i.hasWordDirectory=!0),e.startsWith("ppt/")&&(i.hasPresentationDirectory=!0),e.startsWith("xl/")&&(i.hasSpreadsheetDirectory=!0),e.startsWith("3D/")&&e.endsWith(".model")&&(i.hasThreeDimensionalModelEntry=!0)}function vt(i){if(!(!i.hasContentTypesEntry||i.hasUnparseableContentTypes||i.isParsingContentTypes||i.hasParsedContentTypesEntry)){if(i.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(i.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(i.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(i.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function Ji(i){let e=i.indexOf('.main+xml"');if(e===-1){let n="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return i.includes(`ContentType="${n}"`)?n:void 0}let t=i.slice(0,e),r=t.lastIndexOf('"');return t.slice(r+1)}var De=class i{constructor(e){let t=Wi(e?.mpegOffsetTolerance);this.options={...e,mpegOffsetTolerance:t},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(e){return Di(Pe(e,this.getTokenizerOptions()))}async parseTokenizer(e,t=0){this.detectionReentryCount=t;let r=e.position;for(let n of this.detectors){let o;try{o=await n.detect(e)}catch(s){if(s instanceof l||s instanceof M)return;throw s}if(o)return o;if(r!==e.position)return}}async fromTokenizer(e){try{return await this.parseTokenizer(e)}finally{await e.close()}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(Ne(t,this.getTokenizerOptions()))}async fromBlob(e){this.options.signal?.throwIfAborted();let t=je(e,this.getTokenizerOptions());return this.fromTokenizer(t)}async fromStream(e){this.options.signal?.throwIfAborted();let t=this.createTokenizerFromWebStream(e);return this.fromTokenizer(t)}async toDetectionStream(e,t){let r=_i(t?.sampleSize??K),n,o,s=e.getReader({mode:"byob"});try{let{value:f,done:c}=await $i(s,new Uint8Array(r),this.options.signal);if(o=f,!c&&f)try{n=await this.fromBuffer(f.subarray(0,r))}catch(p){if(!(p instanceof l))throw p;n=void 0}o=f}finally{s.releaseLock()}let a=new TransformStream({async start(f){f.enqueue(o)},transform(f,c){c.enqueue(f)}}),m=e.pipeThrough(a);return m.fileType=n,m}async detectGzip(e){if(this.gzipProbeDepth>=bi)return{ext:"gz",mime:"application/gzip"};let t=new Y(e),r=ji(t.inflate(),ki),n=b(e),o,s,a,m;if(n){let f=new AbortController;o=setTimeout(()=>{f.abort(new DOMException(`Operation timed out after ${wt} ms`,"TimeoutError"))},wt),s=this.options.signal===void 0?f.signal:AbortSignal.any([this.options.signal,f.signal]),a=new i({...this.options,signal:s}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{m=await(a??this).fromStream(r)}catch(f){if(f?.name==="AbortError"&&s?.reason?.name!=="TimeoutError")throw f}finally{clearTimeout(o),n||this.gzipProbeDepth--}return m?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(e,t){return O(this.buffer,e,t)}checkString(e,t){return this.check(mt(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(K),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,b(e)&&(await e.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(e);if(await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(e));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(e);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await R(e,6,{maximumLength:6,reason:"ID3 header prefix"});let t=await e.readToken(lt),r=b(e);if(!Number.isFinite(t)||t<0||r&&(t>Ie||e.position+t>Ie))return;if(e.position+t>e.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await R(e,t,{maximumLength:r?Ie:e.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof l)return;throw n}return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,this.parseTokenizer(e,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t,r=qi();try{await new G(e).unzip(n=>{Hi(r,n.filename);let o=n.filename==="[Content_Types].xml",s=vt(r);if(!o&&s)return t=s,{stop:!0};switch(n.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Tt(n,gt)?{async handler(a){let m=new TextDecoder("utf-8").decode(a).trim();t=Et(m)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,Tt(n,gt)?(r.isParsingContentTypes=!0,{async handler(a){let m=new TextDecoder("utf-8").decode(a),f=Ji(m);f&&(t=Et(f)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(n.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(n){if(!Vi(n))throw n;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return t??vt(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),O(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:O(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:O(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:O(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:O(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:O(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let m=await e.peekNumber(Ze),f=128,c=0;for(;(m&f)===0&&f!==0;)++c,f>>=1;let p=new Uint8Array(c+1);return await Be(e,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function r(){let m=await t(),f=await t();f[0]^=128>>f.length-1;let c=Math.min(6,f.length),p=new DataView(m.buffer),u=new DataView(f.buffer,f.length-c,c);return{id:Ae(p),len:Ae(u)}}async function n(m){let f=0;for(;m>0;){if(f++,f>Ci||ee(e,s,v))return;let c=e.position,p=await r();if(p.id===17026){if(p.len>yt)return;let u=Oe(p.len,yt,"EBML DocType");return(await e.readToken(new S(u))).replaceAll(/\00.*$/g,"")}if(b(e)&&(!Number.isFinite(p.len)||p.len<0||p.len>kt)||(await R(e,p.len,{maximumLength:b(e)?kt:e.fileInfo.size,reason:"EBML payload"}),--m,e.position<=c))return}}let o=await r(),s=e.position;switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let t=be.get(this.buffer,4),r=_.get(this.buffer,6);if(t>0&&t<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!"))return await e.ignore(8),await e.readToken(new S(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` +`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let t={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await e.ignore(8);async function n(){return{length:await e.readToken(Ve),type:await e.readToken(new S(4,"latin1"))}}let o=b(e),s=e.position,a=0,m=!1;do{if(a++,a>Si||ee(e,s,Fi))break;let f=e.position,c=await n();if(c.length<0)return;if(c.type==="IHDR"){if(c.length!==13)return;m=!0}switch(c.type){case"IDAT":return t;case"acTL":return r;default:if(!m&&c.type!=="CgBI")return;if(o&&c.length>Ct)return m&&Li(c.type)?t:void 0;try{await R(e,c.length+4,{maximumLength:o?Ct+4:e.fileInfo.size,reason:"PNG chunk payload"})}catch(p){if(!o&&(p instanceof M||p instanceof l))return t;throw p}}if(e.position<=f)break}while(e.position+8Ei||ee(e,o,v)));){let a=e.position,m=await r(),f=m.size-24;if(!Number.isFinite(f)||f<0){t=!0;break}if(O(m.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let c=new Uint8Array(16);if(f-=await Be(e,c,void 0,{maximumLength:c.length,reason:"ASF stream type GUID"}),O(c,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(O(c,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(n&&f>St){t=!0;break}if(await R(e,f,{maximumLength:n?St:e.fileInfo.size,reason:"ASF header payload"}),e.position<=a){t=!0;break}}}catch(r){if(r instanceof l||r instanceof M)b(e)&&(t=!0);else throw r}return t?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new S(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("=16){let t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&ut(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("{this.buffer=new Uint8Array(K);let t=Gi(e.fileInfo.size);if(await e.peekBuffer(this.buffer,{length:Math.min(8,t),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,t),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let n=this.scanMpeg(r);if(n)return n}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?_:h);switch(await this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?_:h);if(!(t>Ti)&&!(b(this.tokenizer)&&2+t*12>Ft))for(let r=0;r=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let a=(e?_:h).get(this.buffer,8),m=(e?_:h).get(this.buffer,10);if(a===28&&m===254||a===31&&m===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(b(this.tokenizer)&&n>vi)return t;let o=b(this.tokenizer)?Ft:this.tokenizer.fileInfo.size;try{await R(this.tokenizer,n,{maximumLength:o,reason:"TIFF IFD offset"})}catch(a){if(a instanceof l)return;throw a}let s;try{s=await this.readTiffIFD(e)}catch(a){if(a instanceof l)return;throw a}return s??t}if(r===43)return t}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},Xi=new Set(dt),Qi=new Set(xt);var Yi={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},Ki=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),er=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]);function tr(i,e){let t=er.get(i);if(t)return t;let[r,n]=e.split("/"),o=n?.split("+")[0]?.replace(/-/g," ")||i;switch(r){case"image":return`${o.toUpperCase()} image data`;case"audio":return`${o.toUpperCase()} audio`;case"video":return`${o.toUpperCase()} video`;case"font":return`${o} font`;case"model":return`${o} 3D model`;case"application":return n?.includes("zip")||n?.includes("compressed")?`${o} archive data`:n?.includes("executable")?`${o} executable`:`${i.toUpperCase()} data`;default:return`${i.toUpperCase()} data`}}function ir(i){let e=i.split("/").pop()||i;if(e.startsWith(".")&&!e.includes(".",1))return e;let t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t).toLowerCase()}function rr(i,e){if(i.startsWith("#!")){let f=i.split(` +`)[0];return f.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:f.includes("node")||f.includes("bun")||f.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:f.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:f.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let t=i.trimStart();if(t.startsWith("127){m=!0;break}return m?{description:`UTF-8 Unicode text${o}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${o}`,mime:"text/plain"}}async function nr(i,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let t=await ze(e);if(t)return{description:tr(t.ext,t.mime),mime:t.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return rr(r,i)}var _n={name:"file",async execute(i,e){if(Re(i))return Ue(Yi);let t=!1,r=!1,n=[];for(let a of i)if(a.startsWith("--")){if(a==="--brief")t=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return ge("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let m of a.slice(1))if(m==="b")t=!0;else if(m==="i")r=!0;else if(m!=="L")return ge("file",`-${m}`)}else n.push(a);if(n.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE... +`,exitCode:1};let o="",s=0;for(let a of n)try{let m=e.fs.resolvePath(e.cwd,a);if((await e.fs.stat(m)).isDirectory){let d=r?"inode/directory":"directory";o+=t?`${d} +`:`${a}: ${d} +`;continue}let c=await e.fs.readFileBuffer(m),p=await nr(a,c),u=r?p.mime:p.description;o+=t?`${u} +`:`${a}: ${u} +`}catch{o+=t?`cannot open +`:`${a}: cannot open (No such file or directory) +`,s=1}return{stdout:o,stderr:"",exitCode:s}}},$n={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{_n as a,$n as b}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) +*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-C7ISPH7Y.js b/packages/just-bash/dist/bin/chunks/chunk-C7ISPH7Y.js new file mode 100644 index 00000000..b75a86f2 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-C7ISPH7Y.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as f}from"./chunk-VZK4FHWJ.js";import{a as m,b as c,c as b}from"./chunk-MUFNRCMY.js";var p={name:"nl",summary:"number lines of files",usage:"nl [OPTION]... [FILE]...",description:"Write each FILE to standard output, with line numbers added. If no FILE is specified, standard input is read.",options:["-b STYLE Body numbering style: a (all), t (non-empty), n (none)","-n FORMAT Number format: ln (left), rn (right), rz (right zeros)","-w WIDTH Number width (default: 6)","-s SEP Separator after number (default: TAB)","-v START Starting line number (default: 1)","-i INCR Line number increment (default: 1)"],examples:["nl file.txt # Number non-empty lines","nl -ba file.txt # Number all lines","nl -n rz -w 3 file.txt # Right-justified with zeros","nl -s ': ' file.txt # Use ': ' as separator"]};function N(r,s,i){let l=String(r);switch(s){case"ln":return l.padEnd(i);case"rn":return l.padStart(i);case"rz":return l.padStart(i,"0");default:return s}}function v(r,s){switch(s){case"a":return!0;case"t":return r.trim().length>0;case"n":return!1;default:return s}}function h(r,s,i){if(r==="")return{output:"",nextNumber:i};let l=r.split(` +`),t=[],u=i,a=r.endsWith(` +`)&&l[l.length-1]==="";a&&l.pop();for(let n of l)if(v(n,s.bodyStyle)){let e=N(u,s.numberFormat,s.width);t.push(`${e}${s.separator}${n}`),u+=s.increment}else{let e=" ".repeat(s.width);t.push(`${e}${s.separator}${n}`)}return{output:t.join(` +`)+(a?` +`:""),nextNumber:u}}var w={name:"nl",execute:async(r,s)=>{if(c(r))return m(p);let i={bodyStyle:"t",numberFormat:"rn",width:6,separator:" ",startNumber:1,increment:1},l=[],t=0;for(;t0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,s)=>b?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;ee.count>1):q&&(u=t.filter(e=>e.count===1));let a="";for(let{line:e,count:s}of u)m?a+=`${String(s).padStart(4)} ${e} -`:a+=`${e} -`;return{stdout:a,stderr:"",exitCode:0,stdoutEncoding:"binary"}}},P={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{N as a,P as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-CQG2HEAL.js b/packages/just-bash/dist/bin/chunks/chunk-CQG2HEAL.js deleted file mode 100644 index ae6fb7ef..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-CQG2HEAL.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -import{a as L}from"./chunk-4OALHZXB.js";import{a as A,b as v,c as b}from"./chunk-GTNBSMZR.js";var $={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},P={name:"xargs",async execute(l,r){if(v(l))return A($);let m=null,g=null,c=null,o=null,h=!1,x=!1,y=!1,s=0;for(let e=0;e1){for(let n of t.slice(1))if(!"0tr".includes(n))return b("xargs",`-${n}`);t.includes("0")&&(h=!0),t.includes("t")&&(x=!0),t.includes("r")&&(y=!0),s=e+1}else if(!t.startsWith("-")){s=e;break}}}let a=l.slice(s);a.length===0&&a.push("echo");let i;if(h?i=r.stdin.split("\0").filter(e=>e.length>0):g!==null?i=r.stdin.replace(/\n$/,"").split(g).filter(t=>t.length>0):i=r.stdin.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0),i.length===0)return y?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",u="",f=0,w=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,"\\$1")}"`:e,C=async e=>{if(x){let n=e.map(w).join(" ");u+=`${n} -`}return r.exec?r.exec(L([e[0]]),{cwd:r.cwd,signal:r.signal,args:e.slice(1)}):{stdout:`${e.map(w).join(" ")} -`,stderr:"",exitCode:0}},I=async e=>{if(o!==null&&o>1)for(let t=0;ta.map(n=>n.replaceAll(m,t)));await I(e)}else if(c!==null){let e=[];for(let t=0;t=0&&c.length>e&&(c=c.slice(0,e));let n=Math.abs(l);return n>c.length&&(l<0?c=c.padEnd(n," "):c=c.padStart(n," ")),c}function h(t,l){let e=l,c=0,n=-1,a=!1;for(e0&&(c=-c),[c,n,e-l]}function r(t){let l="",e=0;for(;e0){try{let s=new TextDecoder("utf-8",{fatal:!0});l+=s.decode(new Uint8Array(n))}catch{for(let s of n)l+=String.fromCharCode(s)}e=a}else l+=t[e],e++;break}case"u":{let n="",a=e+2;for(;a>=","&=","|=","^="];function ge(e){if(e.includes("#")){let[r,s]=e.split("#"),n=Number.parseInt(r,10);if(n<2||n>64)return Number.NaN;if(n<=36){let i=Number.parseInt(s,n);return i>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:i}let a=0;for(let i of s){let l;if(/[0-9]/.test(i))l=i.charCodeAt(0)-48;else if(/[a-z]/.test(i))l=i.charCodeAt(0)-97+10;else if(/[A-Z]/.test(i))l=i.charCodeAt(0)-65+36;else if(i==="@")l=62;else if(i==="_")l=63;else return Number.NaN;if(l>=n)return Number.NaN;if(a=a*n+l,a>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return a}if(e.startsWith("0x")||e.startsWith("0X")){let r=Number.parseInt(e.slice(2),16);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let r=Number.parseInt(e,8);return r>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:r}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function vt(e,t,r,s){if(r.slice(s,s+3)!=="$((")return null;let n=s+3,a=1,i=n;for(;n0;)r[n]==="("&&r[n+1]==="("?(a++,n+=2):r[n]===")"&&r[n+1]===")"?(a--,a>0&&(n+=2)):n++;let l=r.slice(i,n),{expr:o}=e(t,l,0);return n+=2,{expr:{type:"ArithNested",expression:o},pos:n}}function Dt(e,t){if(e.slice(t,t+2)!=="$'")return null;let r=t+2,s="";for(;r=e.length}function Z(e,t,r){return Pr(e,t,r)}function Pr(e,t,r){let{expr:s,pos:n}=ye(e,t,r);for(n=$(t,n);t[n]===",";){if(n++,z(t,n))return F(",",n);let{expr:i,pos:l}=ye(e,t,n);s={type:"ArithBinary",operator:",",left:s,right:i},n=$(t,l)}return{expr:s,pos:n}}function ye(e,t,r){let{expr:s,pos:n}=Rr(e,t,r);if(n=$(t,n),t[n]==="?"){n++;let{expr:a,pos:i}=Z(e,t,n);if(n=$(t,i),t[n]===":"){n++;let{expr:l,pos:o}=Z(e,t,n);return{expr:{type:"ArithTernary",condition:s,consequent:a,alternate:l},pos:o}}}return{expr:s,pos:n}}function Rr(e,t,r){let{expr:s,pos:n}=_t(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="||";){if(n+=2,z(t,n))return F("||",n);let{expr:i,pos:l}=_t(e,t,n);s={type:"ArithBinary",operator:"||",left:s,right:i},n=l}return{expr:s,pos:n}}function _t(e,t,r){let{expr:s,pos:n}=$t(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="&&";){if(n+=2,z(t,n))return F("&&",n);let{expr:i,pos:l}=$t(e,t,n);s={type:"ArithBinary",operator:"&&",left:s,right:i},n=l}return{expr:s,pos:n}}function $t(e,t,r){let{expr:s,pos:n}=Ct(e,t,r);for(;n=$(t,n),t[n]==="|"&&t[n+1]!=="|";){if(n++,z(t,n))return F("|",n);let{expr:i,pos:l}=Ct(e,t,n);s={type:"ArithBinary",operator:"|",left:s,right:i},n=l}return{expr:s,pos:n}}function Ct(e,t,r){let{expr:s,pos:n}=Ot(e,t,r);for(;n=$(t,n),t[n]==="^";){if(n++,z(t,n))return F("^",n);let{expr:i,pos:l}=Ot(e,t,n);s={type:"ArithBinary",operator:"^",left:s,right:i},n=l}return{expr:s,pos:n}}function Ot(e,t,r){let{expr:s,pos:n}=Lt(e,t,r);for(;n=$(t,n),t[n]==="&"&&t[n+1]!=="&";){if(n++,z(t,n))return F("&",n);let{expr:i,pos:l}=Lt(e,t,n);s={type:"ArithBinary",operator:"&",left:s,right:i},n=l}return{expr:s,pos:n}}function Lt(e,t,r){let{expr:s,pos:n}=Wt(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="=="||t.slice(n,n+2)==="!=";){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=Wt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Wt(e,t,r){let{expr:s,pos:n}=ze(e,t,r);for(;;)if(n=$(t,n),t.slice(n,n+2)==="<="||t.slice(n,n+2)===">="){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=ze(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else if(t[n]==="<"||t[n]===">"){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=ze(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else break;return{expr:s,pos:n}}function ze(e,t,r){let{expr:s,pos:n}=Tt(e,t,r);for(;n=$(t,n),t.slice(n,n+2)==="<<"||t.slice(n,n+2)===">>";){let a=t.slice(n,n+2);if(n+=2,z(t,n))return F(a,n);let{expr:i,pos:l}=Tt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Tt(e,t,r){let{expr:s,pos:n}=Mt(e,t,r);for(;n=$(t,n),(t[n]==="+"||t[n]==="-")&&t[n+1]!==t[n];){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=Mt(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}return{expr:s,pos:n}}function Mt(e,t,r){let{expr:s,pos:n}=Ie(e,t,r);for(;;)if(n=$(t,n),t[n]==="*"&&t[n+1]!=="*"){if(n++,z(t,n))return F("*",n);let{expr:i,pos:l}=Ie(e,t,n);s={type:"ArithBinary",operator:"*",left:s,right:i},n=l}else if(t[n]==="/"||t[n]==="%"){let a=t[n];if(n++,z(t,n))return F(a,n);let{expr:i,pos:l}=Ie(e,t,n);s={type:"ArithBinary",operator:a,left:s,right:i},n=l}else break;return{expr:s,pos:n}}function Ie(e,t,r){let{expr:s,pos:n}=Ge(e,t,r),a=$(t,n);if(t.slice(a,a+2)==="**"){if(a+=2,z(t,a))return F("**",a);let{expr:l,pos:o}=Ie(e,t,a);return{expr:{type:"ArithBinary",operator:"**",left:s,right:l},pos:o}}return{expr:s,pos:n}}function Ge(e,t,r){let s=$(t,r);if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let n=t.slice(s,s+2);s+=2;let{expr:a,pos:i}=Ge(e,t,s);return{expr:{type:"ArithUnary",operator:n,operand:a,prefix:!0},pos:i}}if(t[s]==="+"||t[s]==="-"||t[s]==="!"||t[s]==="~"){let n=t[s];s++;let{expr:a,pos:i}=Ge(e,t,s);return{expr:{type:"ArithUnary",operator:n,operand:a,prefix:!0},pos:i}}return vr(e,t,s)}function Ir(e,t){let r=e[t];return r==="$"||r==="`"}function vr(e,t,r){let{expr:s,pos:n}=Vt(e,t,r,!1),a=[s];for(;Ir(t,n);){let{expr:l,pos:o}=Vt(e,t,n,!0);a.push(l),n=o}a.length>1&&(s={type:"ArithConcat",parts:a});let i;if(t[n]==="["&&s.type==="ArithConcat"){n++;let{expr:l,pos:o}=Z(e,t,n);i=l,n=o,t[n]==="]"&&n++}if(i&&s.type==="ArithConcat"&&(s={type:"ArithDynamicElement",nameExpr:s,subscript:i},i=void 0),n=$(t,n),s.type==="ArithConcat"||s.type==="ArithVariable"||s.type==="ArithDynamicElement"){for(let l of Re)if(t.slice(n,n+l.length)===l&&t.slice(n,n+l.length+1)!=="=="){n+=l.length;let{expr:o,pos:c}=ye(e,t,n);return s.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:l,target:s.nameExpr,subscript:s.subscript,value:o},pos:c}:s.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:l,target:s,value:o},pos:c}:{expr:{type:"ArithAssignment",operator:l,variable:s.name,value:o},pos:c}}}if(t.slice(n,n+2)==="++"||t.slice(n,n+2)==="--"){let l=t.slice(n,n+2);return n+=2,{expr:{type:"ArithUnary",operator:l,operand:s,prefix:!1},pos:n}}return{expr:s,pos:n}}function Vt(e,t,r,s=!1){let n=$(t,r),a=vt(Z,e,t,n);if(a)return a;let i=Dt(t,n);if(i)return i;let l=xt(t,n);if(l)return l;if(t.slice(n,n+2)==="$("&&t[n+2]!=="("){n+=2;let c=1,u=n;for(;n0;)t[n]==="("?c++:t[n]===")"&&c--,c>0&&n++;let f=t.slice(u,n);return n++,{expr:{type:"ArithCommandSubst",command:f},pos:n}}if(t[n]==="`"){n++;let c=n;for(;n0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let h=t.slice(c,f),d=f+1;if(t[d]==="#"){let m=d+1;for(;m=r.length)return!1;let a=r.slice(n+1);return a===""||a==="+"}return!1}function zt(e){let t=0;for(let r=0;r",">",p.AND_DGREAT]],xr=[["[","[",p.DBRACK_START],["]","]",p.DBRACK_END],["(","(",p.DPAREN_START],[")",")",p.DPAREN_END],["&","&",p.AND_AND],["|","|",p.OR_OR],[";",";",p.DSEMI],[";","&",p.SEMI_AND],["|","&",p.PIPE_AMP],[">",">",p.DGREAT],["<","&",p.LESSAND],[">","&",p.GREATAND],["<",">",p.LESSGREAT],[">","|",p.CLOBBER],["&",">",p.AND_GREAT]],_r=new Map([["|",p.PIPE],["&",p.AMP],[";",p.SEMICOLON],["(",p.LPAREN],[")",p.RPAREN],["<",p.LESS],[">",p.GREAT]]);function $r(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Gt(e){return e===" "||e===" "||e===` +`||e===";"||e==="&"||e==="|"||e==="("||e===")"||e==="<"||e===">"}var ve=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];dparenDepth=0;maxHeredocSize;constructor(t,r){this.input=t,this.maxHeredocSize=r?.maxHeredocSize??10485760}tokenize(){let r=this.input.length,s=this.tokens,n=this.pendingHeredocs;for(;this.pos0&&s.length>0&&s[s.length-1].type===p.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=r)break;let a=this.nextToken();a&&s.push(a)}return s.push({type:p.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),s}skipWhitespace(){let t=this.input,r=t.length,s=this.pos,n=this.column,a=this.line;for(;s0?(this.pos=r+1,this.column=n+1,this.dparenDepth++,this.makeToken(p.LPAREN,"(",r,s,n)):this.looksLikeNestedSubshells(r+2)||this.dparenClosesWithSpacedParens(r+2)?(this.pos=r+1,this.column=n+1,this.makeToken(p.LPAREN,"(",r,s,n)):(this.pos=r+2,this.column=n+2,this.dparenDepth=1,this.makeToken(p.DPAREN_START,"((",r,s,n));if(a===")"&&i===")")return this.dparenDepth===1?(this.pos=r+2,this.column=n+2,this.dparenDepth=0,this.makeToken(p.DPAREN_END,"))",r,s,n)):this.dparenDepth>1?(this.pos=r+1,this.column=n+1,this.dparenDepth--,this.makeToken(p.RPAREN,")",r,s,n)):(this.pos=r+1,this.column=n+1,this.makeToken(p.RPAREN,")",r,s,n));for(let[c,u,f]of xr)if(!(c==="("&&u==="("||c===")"&&u===")")&&!(this.dparenDepth>0&&c===";"&&(f===p.DSEMI||f===p.SEMI_AND||f===p.SEMI_SEMI_AND))&&a===c&&i===u){if(f===p.DBRACK_START||f===p.DBRACK_END){let h=t[r+2];if(h!==void 0&&h!==" "&&h!==" "&&h!==` +`&&h!==";"&&h!=="&"&&h!=="|"&&h!=="("&&h!==")"&&h!=="<"&&h!==">")break}return this.pos=r+2,this.column=n+2,this.makeToken(f,c+u,r,s,n)}if(a==="("&&this.dparenDepth>0)return this.pos=r+1,this.column=n+1,this.dparenDepth++,this.makeToken(p.LPAREN,"(",r,s,n);if(a===")"&&this.dparenDepth>1)return this.pos=r+1,this.column=n+1,this.dparenDepth--,this.makeToken(p.RPAREN,")",r,s,n);let o=_r.get(a);if(o!==void 0)return this.pos=r+1,this.column=n+1,this.makeToken(o,a,r,s,n);if(a==="{"){let c=this.scanFdVariable(r);return c!==null?(this.pos=c.end,this.column=n+(c.end-r),{type:p.FD_VARIABLE,value:c.varname,start:r,end:c.end,line:s,column:n}):i==="}"?(this.pos=r+2,this.column=n+2,{type:p.WORD,value:"{}",start:r,end:r+2,line:s,column:n,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(r)!==null?this.readWordWithBraceExpansion(r,s,n):this.scanLiteralBraceWord(r)!==null?this.readWordWithBraceExpansion(r,s,n):i!==void 0&&i!==" "&&i!==" "&&i!==` +`?this.readWord(r,s,n):(this.pos=r+1,this.column=n+1,this.makeToken(p.LBRACE,"{",r,s,n))}return a==="}"?this.isWordCharFollowing(r+1)?this.readWord(r,s,n):(this.pos=r+1,this.column=n+1,this.makeToken(p.RBRACE,"}",r,s,n)):a==="!"?i==="="?(this.pos=r+2,this.column=n+2,this.makeToken(p.WORD,"!=",r,s,n)):(this.pos=r+1,this.column=n+1,this.makeToken(p.BANG,"!",r,s,n)):this.readWord(r,s,n)}looksLikeNestedSubshells(t){let r=this.input,s=r.length,n=t;for(;n=s)return!1;let a=r[n];if(a==="(")return this.looksLikeNestedSubshells(n+1);let i=/[a-zA-Z_]/.test(a),l=a==="!"||a==="[";if(!i&&!l)return!1;let o=n;for(;o=s)return!1;let u=r[c];if(u==="="&&r[c+1]!=="="||u===` +`||o===c&&/[+\-*/%<>&|^!~?:]/.test(u)&&u!=="-"||u===")"&&r[c+1]===")")return!1;if(c>o&&(u==="-"||u==='"'||u==="'"||u==="$"||/[a-zA-Z_/.]/.test(u))){let f=c;for(;f"||y==="'"||y==='"'||y==="\\"||y==="$"||y==="`"||y==="{"||y==="}"||y==="~"||y==="*"||y==="?"||y==="[")break;i++}if(i>l){let y=n[i];if(!(y==="("&&i>l&&"@*+?!".includes(n[i-1]))){if(i>=a||y===" "||y===" "||y===` +`||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">"){let b=n.slice(l,i);this.pos=i,this.column=s+(i-l);let D=Bt.get(b);if(D!==void 0)return{type:D,value:b,start:t,end:i,line:r,column:s};let Q=zt(b);return Q>0&&Ft(b.slice(0,Q))?{type:p.ASSIGNMENT_WORD,value:b,start:t,end:i,line:r,column:s}:/^[0-9]+$/.test(b)?{type:p.NUMBER,value:b,start:t,end:i,line:r,column:s}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)?{type:p.NAME,value:b,start:t,end:i,line:r,column:s,quoted:!1,singleQuoted:!1}:{type:p.WORD,value:b,start:t,end:i,line:r,column:s,quoted:!1,singleQuoted:!1}}}}i=this.pos;let o=this.column,c=this.line,u="",f=!1,h=!1,d=!1,m=!1,g=n[i]==='"'||n[i]==="'",E=!1,A=0;for(;i0&&"@*+?!".includes(u[u.length-1])){let b=this.scanExtglobPattern(i);if(b!==null){u+=b.content,i=b.end,o+=b.content.length;continue}}if(y==="["&&A===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){let b=i+10){u.length>0&&u[u.length-1]!=="\\"&&A++,u+=y,i++,o++;continue}else if(y==="]"&&A>0){u.length>0&&u[u.length-1]!=="\\"&&A--,u+=y,i++,o++;continue}if(A>0){if(y===` +`)break;u+=y,i++,o++;continue}if(y===" "||y===" "||y===` +`||y===";"||y==="&"||y==="|"||y==="("||y===")"||y==="<"||y===">")break}if(y==="$"&&i+10&&i0&&i0?H=!0:B==="esac"&&ie>0&&(ie--,H=!1),B="",_==="("?i>0&&n[i-1]==="$"?b++:H||b++:_===")"?H?H=!1:b--:_===";"&&ie>0&&(i+10&&i0&&i="0"&&b<="9"){u+=y+b,i+=2,o+=2;continue}}if(y==="`"&&!d){for(u+=y,i++,o++;i=2){if(u[0]==="'"&&u[u.length-1]==="'"){let y=u.slice(1,-1);!y.includes("'")&&!y.includes('"')&&(u=y,f=!0,h=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let y=u.slice(1,-1),b=!1;for(let D=0;D0&&Ft(u.slice(0,y)))return{type:p.ASSIGNMENT_WORD,value:u,start:t,end:i,line:r,column:s,quoted:f,singleQuoted:h}}return/^[0-9]+$/.test(u)?{type:p.NUMBER,value:u,start:t,end:i,line:r,column:s}:$r(u)?{type:p.NAME,value:u,start:t,end:i,line:r,column:s,quoted:f,singleQuoted:h}:{type:p.WORD,value:u,start:t,end:i,line:r,column:s,quoted:f,singleQuoted:h}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let t=this.pendingHeredocs.shift();if(!t)break;let r=this.pos,s=this.line,n=this.column,a="";for(;this.posthis.maxHeredocSize)throw new pe(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,s,n);this.pos&|()]/.test(i))break;if(i==="'"||i==='"'){a=!0;let l=i;for(this.pos++,this.column++;this.pos=this.input.length)return!1;let r=this.input[t];return!(r===" "||r===" "||r===` +`||r===";"||r==="&"||r==="|"||r==="("||r===")"||r==="<"||r===">")}readWordWithBraceExpansion(t,r,s){let n=this.input,a=n.length,i=t,l=s;for(;i")break;if(c==="{"){if(this.scanBraceExpansion(i)!==null){let f=1;for(i++,l++;i0;)n[i]==="{"?f++:n[i]==="}"&&f--,i++,l++;continue}i++,l++;continue}if(c==="}"){i++,l++;continue}if(c==="$"&&i+10&&i0&&i0;){let o=r[n];if(o==="{")a++,n++;else if(o==="}")a--,n++;else if(o===","&&a===1)i=!0,n++;else if(o==="."&&n+10;){let i=r[n];if(i==="{")a++,n++;else if(i==="}"){if(a--,a===0)return r.slice(t,n+1);n++}else{if(i===" "||i===" "||i===` +`||i===";"||i==="&"||i==="|")return null;n++}}return null}scanExtglobPattern(t){let r=this.input,s=r.length,n=t+1,a=1;for(;n0;){let i=r[n];if(i==="\\"&&n+1="a"&&u<="z"||u>="A"&&u<="Z"||u==="_"))return null}else if(!(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||u==="_"))break;n++}if(n===a)return null;let i=r.slice(a,n);if(n>=s||r[n]!=="}"||(n++,n>=s))return null;let l=r[n],o=n+1"||l==="<"||l==="&"&&(o===">"||o==="<")?{varname:i,end:n}:null}dollarDparenIsSubshell(t){let r=this.input,s=r.length,n=t+1,a=2,i=!1,l=!1,o=!1;for(;n0;){let c=r[n];if(i){c==="'"&&(i=!1),c===` +`&&(o=!0),n++;continue}if(l){if(c==="\\"){n+=2;continue}c==='"'&&(l=!1),c===` +`&&(o=!0),n++;continue}if(c==="'"){i=!0,n++;continue}if(c==='"'){l=!0,n++;continue}if(c==="\\"){n+=2;continue}if(c===` +`&&(o=!0),c==="("){a++,n++;continue}if(c===")"){if(a--,a===1){let u=n+1;if(u0;){let o=r[n];if(i){o==="'"&&(i=!1),n++;continue}if(l){if(o==="\\"){n+=2;continue}o==='"'&&(l=!1),n++;continue}if(o==="'"){i=!0,n++;continue}if(o==='"'){l=!0,n++;continue}if(o==="\\"){n+=2;continue}if(o==="("){a++,n++;continue}if(o===")"){if(a--,a===1){let c=n+1;if(c=194){let n=(s&31)<<6|e[r+1]&63;t+=String.fromCharCode(n),r+=2;continue}t+=String.fromCharCode(s),r++;continue}if((s&240)===224){if(r+2=55296&&n<=57343){t+=String.fromCharCode(s),r++;continue}t+=String.fromCharCode(n),r+=3;continue}t+=String.fromCharCode(s),r++;continue}if((s&248)===240&&s<=244){if(r+31114111){t+=String.fromCharCode(s),r++;continue}t+=String.fromCodePoint(n),r+=4;continue}t+=String.fromCharCode(s),r++;continue}t+=String.fromCharCode(s),r++}return t}function Kt(e,t,r){let s=r+1;for(;s0;)t[i]===s?a++:t[i]===n&&a--,a>0&&i++;return a===0?i:-1}function fe(e,t,r){let s=r,n=1;for(;s0;){let a=t[s];if(a==="\\"&&s+10&&s++}return s}function Xt(e,t,r){let s=r,n=!1;for(;s0)l.push(u),o+=2+c.length;else break}l.length>0?(s+=Cr(l),n=o):(s+="\\x",n+=2);break}case"u":{let l=t.slice(n+2,n+6),o=parseInt(l,16);Number.isNaN(o)?(s+="\\u",n+=2):(s+=String.fromCharCode(o),n+=6);break}case"c":{if(n+2({type:"Word",word:w.word(s(e,u,!1,!1,!1))}))},endIndex:n+1}:a.includes(",")?{part:{type:"BraceExpansion",items:jt(a).map(u=>({type:"Word",word:w.word([w.literal(u)])}))},endIndex:n+1}:null}function Ke(e,t){let r="";for(let s of t.parts)switch(s.type){case"Literal":r+=s.value;break;case"SingleQuoted":r+=`'${s.value}'`;break;case"Escaped":r+=s.value;break;case"DoubleQuoted":r+='"';for(let n of s.parts)n.type==="Literal"||n.type==="Escaped"?r+=n.value:n.type==="ParameterExpansion"&&(r+=`\${${n.parameter}}`);r+='"';break;case"ParameterExpansion":r+=`\${${s.parameter}}`;break;case"Glob":r+=s.pattern;break;case"TildeExpansion":r+="~",s.user&&(r+=s.user);break;case"BraceExpansion":{r+="{";let n=[];for(let a of s.items)if(a.type==="Range"){let i=a.startStr??String(a.start),l=a.endStr??String(a.end);a.step!==void 0?n.push(`${i}..${l}..${a.step}`):n.push(`${i}..${l}`)}else n.push(Ke(e,a.word));n.length===1&&s.items[0].type==="Range"?r+=n[0]:r+=n.join(","),r+="}";break}default:r+=s.type}return r}function tn(e,t){return{[p.LESS]:"<",[p.GREAT]:">",[p.DGREAT]:">>",[p.LESSAND]:"<&",[p.GREATAND]:">&",[p.LESSGREAT]:"<>",[p.CLOBBER]:">|",[p.TLESS]:"<<<",[p.AND_GREAT]:"&>",[p.AND_DGREAT]:"&>>",[p.DLESS]:"<",[p.DLESSDASH]:"<"}[t]||">"}function De(e){let t=e.current(),r=t.type;if(r===p.NUMBER){let s=e.peek(1);return t.end!==s.start?!1:Ut.has(s.type)}if(r===p.FD_VARIABLE){let s=e.peek(1);return Ht.has(s.type)}return Zt.has(r)}function xe(e){let t=null,r;e.check(p.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(p.FD_VARIABLE)&&(r=e.advance().value);let s=e.advance(),n=tn(e,s.type);if(s.type===p.DLESS||s.type===p.DLESSDASH)return Lr(e,n,t,s.type===p.DLESSDASH);e.isWord()||e.error("Expected redirection target");let a=e.parseWord();return w.redirection(n,a,t,r)}function Lr(e,t,r,s){e.isWord()||e.error("Expected here-document delimiter");let n=e.advance(),a=n.value,i=n.quoted||!1;(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1));let l=w.redirection(s?"<<-":"<<",w.hereDoc(a,w.word([]),s,i),r);return e.addPendingHeredoc(l,a,s,i),l}function rn(e){let t=e.current().line,r=[],s=null,n=[],a=[];for(;e.check(p.ASSIGNMENT_WORD)||De(e);)e.checkIterationLimit(),e.check(p.ASSIGNMENT_WORD)?r.push(Wr(e)):a.push(xe(e));if(e.isWord())s=e.parseWord();else if(r.length>0&&(e.check(p.DBRACK_START)||e.check(p.DPAREN_START))){let l=e.advance();s=w.word([w.literal(l.value)])}for(;(!e.isStatementEnd()||e.check(p.RBRACE))&&!e.check(p.PIPE,p.PIPE_AMP);)if(e.checkIterationLimit(),De(e))a.push(xe(e));else if(e.check(p.RBRACE)){let l=e.advance();n.push(e.parseWordFromString(l.value,!1,!1))}else if(e.check(p.LBRACE)){let l=e.advance();n.push(e.parseWordFromString(l.value,!1,!1))}else if(e.check(p.DBRACK_END)){let l=e.advance();n.push(e.parseWordFromString(l.value,!1,!1))}else if(e.isWord())n.push(e.parseWord());else if(e.check(p.ASSIGNMENT_WORD)){let l=e.advance(),o=l.value,c=o.endsWith("="),u=o.endsWith("=(");if((c||u)&&(u||e.check(p.LPAREN))){let f=u?o.slice(0,-2):o.slice(0,-1);u||e.expect(p.LPAREN);let h=Xe(e);e.expect(p.RPAREN);let d=h.map(g=>Ke(e,g)),m=`${f}=(${d.join(" ")})`;n.push(e.parseWordFromString(m,!1,!1))}else n.push(e.parseWordFromString(o,l.quoted,l.singleQuoted))}else if(e.check(p.LPAREN))e.error("syntax error near unexpected token `('");else break;let i=w.simpleCommand(s,n,r,a);return i.line=t,i}function Wr(e){let t=e.expect(p.ASSIGNMENT_WORD),r=t.value,s=r.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);s||e.error(`Invalid assignment: ${r}`);let n=s[0],a,i=n.length;if(r[i]==="["){let f=0,h=i+1;for(;i2)break}else f.value==="("&&o++,f.value===")"&&o--,i[l]+=f.value}e.expect(p.DPAREN_END),i[0].trim()&&(s=M(e,i[0].trim())),i[1].trim()&&(n=M(e,i[1].trim())),i[2].trim()&&(a=M(e,i[2].trim())),e.skipNewlines(),e.check(p.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(p.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(p.RBRACE)):(e.expect(p.DO),c=e.parseCompoundList(),e.expect(p.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:s,condition:n,update:a,body:c,redirections:u,line:r}}function et(e,t){e.expect(p.WHILE);let r=e.parseCompoundList();e.expect(p.DO);let s=e.parseCompoundList();s.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(p.DONE);let n=t?.skipRedirections?[]:e.parseOptionalRedirections();return w.whileNode(r,s,n)}function tt(e,t){e.expect(p.UNTIL);let r=e.parseCompoundList();e.expect(p.DO);let s=e.parseCompoundList();s.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(p.DONE);let n=t?.skipRedirections?[]:e.parseOptionalRedirections();return w.untilNode(r,s,n)}function nt(e,t){e.expect(p.CASE),e.isWord()||e.error("Expected word after 'case'");let r=e.parseWord();e.skipNewlines(),e.expect(p.IN),e.skipNewlines();let s=[];for(;!e.check(p.ESAC,p.EOF);){e.checkIterationLimit();let a=e.getPos(),i=qr(e);if(i&&s.push(i),e.skipNewlines(),e.getPos()===a&&!i)break}e.expect(p.ESAC);let n=t?.skipRedirections?[]:e.parseOptionalRedirections();return w.caseNode(r,s,n)}function qr(e){e.check(p.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(p.PIPE));)e.advance();if(t.length===0)return null;e.expect(p.RPAREN),e.skipNewlines();let r=[];for(;!e.check(p.DSEMI,p.SEMI_AND,p.SEMI_SEMI_AND,p.ESAC,p.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===p.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(p.LPAREN)&&e.peek(1).type===p.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let n=e.getPos(),a=e.parseStatement();if(a&&r.push(a),e.skipSeparators(!1),e.getPos()===n&&!a)break}let s=";;";return e.check(p.DSEMI)?(e.advance(),s=";;"):e.check(p.SEMI_AND)?(e.advance(),s=";&"):e.check(p.SEMI_SEMI_AND)&&(e.advance(),s=";;&"),w.caseItem(t,r,s)}function rt(e,t){e.expect(p.LPAREN);let r=e.parseCompoundList();e.expect(p.RPAREN);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return w.subshell(r,s)}function st(e,t){e.expect(p.LBRACE);let r=e.parseCompoundList();e.expect(p.RBRACE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return w.group(r,s)}var Fr=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],zr=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"];function sn(e){return e.isWord()||e.check(p.LBRACE)||e.check(p.RBRACE)||e.check(p.ASSIGNMENT_WORD)}function an(e){if(e.check(p.BANG)&&e.peek(1).type===p.LPAREN){e.advance(),e.advance();let t=1,r="!(";for(;t>0&&!e.check(p.EOF);)if(e.check(p.LPAREN))t++,r+="(",e.advance();else if(e.check(p.RPAREN))t--,t>0&&(r+=")"),e.advance();else if(e.isWord())r+=e.advance().value;else if(e.check(p.PIPE))r+="|",e.advance();else break;return r+=")",e.parseWordFromString(r,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function at(e){return e.skipNewlines(),Gr(e)}function Gr(e){let t=on(e);for(e.skipNewlines();e.check(p.OR_OR);){e.advance(),e.skipNewlines();let r=on(e);t={type:"CondOr",left:t,right:r},e.skipNewlines()}return t}function on(e){let t=it(e);for(e.skipNewlines();e.check(p.AND_AND);){e.advance(),e.skipNewlines();let r=it(e);t={type:"CondAnd",left:t,right:r},e.skipNewlines()}return t}function it(e){return e.skipNewlines(),e.check(p.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:it(e)}):Qr(e)}function Qr(e){if(e.check(p.LPAREN)){e.advance();let t=at(e);return e.expect(p.RPAREN),{type:"CondGroup",expression:t}}if(sn(e)){let t=e.current(),r=t.value;if(Fr.includes(r)&&!t.quoted){if(e.advance(),e.check(p.DBRACK_END)&&e.error(`Expected operand after ${r}`),sn(e)){let a=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:r,operand:a}}let n=e.current();e.error(`unexpected argument \`${n.value}' to conditional unary operator`)}let s=e.parseWordNoBraceExpansion();if(e.isWord()&&zr.includes(e.current().value)){let n=e.advance().value,a;return n==="=~"?a=Zr(e):n==="=="||n==="!="?a=an(e):a=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:n,left:s,right:a}}if(e.check(p.LESS)){e.advance();let n=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:s,right:n}}if(e.check(p.GREAT)){e.advance();let n=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:s,right:n}}if(e.isWord()&&e.current().value==="="){e.advance();let n=an(e);return{type:"CondBinary",operator:"==",left:s,right:n}}return{type:"CondWord",word:s}}e.error("Expected conditional expression")}function Zr(e){let t=[],r=0,s=-1,n=e.getInput(),a=()=>e.check(p.DBRACK_END)||e.check(p.AND_AND)||e.check(p.OR_OR)||e.check(p.NEWLINE)||e.check(p.EOF);for(;!a();){let i=e.current(),l=s>=0&&i.start>s;if(r===0&&l)break;if(r>0&&l){let o=n.slice(s,i.start);t.push({type:"Literal",value:o})}if(e.isWord()||e.check(p.ASSIGNMENT_WORD)){let o=e.parseWordForRegex();t.push(...o.parts),s=e.peek(-1).end}else if(e.check(p.LPAREN)){let o=e.advance();t.push({type:"Literal",value:"("}),r++,s=o.end}else if(e.check(p.DPAREN_START)){let o=e.advance();t.push({type:"Literal",value:"(("}),r+=2,s=o.end}else if(e.check(p.DPAREN_END))if(r>=2){let o=e.advance();t.push({type:"Literal",value:"))"}),r-=2,s=o.end}else{if(r===1)break;break}else if(e.check(p.RPAREN))if(r>0){let o=e.advance();t.push({type:"Literal",value:")"}),r--,s=o.end}else break;else if(e.check(p.PIPE)){let o=e.advance();t.push({type:"Literal",value:"|"}),s=o.end}else if(e.check(p.SEMICOLON))if(r>0){let o=e.advance();t.push({type:"Literal",value:";"}),s=o.end}else break;else if(r>0&&e.check(p.LESS)){let o=e.advance();t.push({type:"Literal",value:"<"}),s=o.end}else if(r>0&&e.check(p.GREAT)){let o=e.advance();t.push({type:"Literal",value:">"}),s=o.end}else if(r>0&&e.check(p.DGREAT)){let o=e.advance();t.push({type:"Literal",value:">>"}),s=o.end}else if(r>0&&e.check(p.DLESS)){let o=e.advance();t.push({type:"Literal",value:"<<"}),s=o.end}else if(r>0&&e.check(p.LESSAND)){let o=e.advance();t.push({type:"Literal",value:"<&"}),s=o.end}else if(r>0&&e.check(p.GREATAND)){let o=e.advance();t.push({type:"Literal",value:">&"}),s=o.end}else if(r>0&&e.check(p.LESSGREAT)){let o=e.advance();t.push({type:"Literal",value:"<>"}),s=o.end}else if(r>0&&e.check(p.CLOBBER)){let o=e.advance();t.push({type:"Literal",value:">|"}),s=o.end}else if(r>0&&e.check(p.TLESS)){let o=e.advance();t.push({type:"Literal",value:"<<<"}),s=o.end}else if(r>0&&e.check(p.AMP)){let o=e.advance();t.push({type:"Literal",value:"&"}),s=o.end}else if(r>0&&e.check(p.LBRACE)){let o=e.advance();t.push({type:"Literal",value:"{"}),s=o.end}else if(r>0&&e.check(p.RBRACE)){let o=e.advance();t.push({type:"Literal",value:"}"}),s=o.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}function Ee(e){return e.length>0?e:[w.literal("")]}function Hr(e,t){let r=1,s=t+1;for(;s0;){let n=e[s];if(n==="\\"){s+=2;continue}if("@*+?!".includes(n)&&s+10;)t[h]==="{"?f++:t[h]==="}"&&f--,f>0&&h++;let d=t.slice(r+2,h);return{part:w.parameterExpansion("",{type:"BadSubstitution",text:d}),endIndex:h+1}}}if(l===""&&!a&&!i&&t[n]!=="}"){let u=1,f=n;for(;f0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new G("unexpected EOF while looking for matching '}'",0,0);let h=t.slice(r+2,f);return{part:w.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:f+1}}let c=null;if(a){let u=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(n=t.length)throw new G("unexpected EOF while looking for matching '}'",0,0);return{part:w.parameterExpansion(l,c),endIndex:n+1}}function ot(e,t,r,s,n=!1){let a=r,i=t[a],l=t[a+1]||"";if(i===":"){let o=l;if("-=?+".includes(o)){a+=2;let A=fe(e,t,a),S=t.slice(a,A),y=ae(e,S,!1,!1,!0,!1,n,!1,!1,!0),b=w.word(Ee(y));if(o==="-")return{operation:{type:"DefaultValue",word:b,checkEmpty:!0},endIndex:A};if(o==="=")return{operation:{type:"AssignDefault",word:b,checkEmpty:!0},endIndex:A};if(o==="?")return{operation:{type:"ErrorIfUnset",word:b,checkEmpty:!0},endIndex:A};if(o==="+")return{operation:{type:"UseAlternative",word:b,checkEmpty:!0},endIndex:A}}a++;let c=fe(e,t,a),u=t.slice(a,c),f=-1,h=0,d=0;for(let E=0;E0)d--;else{f=E;break}}let m=f>=0?u.slice(0,f):u,g=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:je(e,m),length:g!==null?je(e,g):null},endIndex:c}}if("-=?+".includes(i)){a++;let o=fe(e,t,a),c=t.slice(a,o),u=ae(e,c,!1,!1,!0,!1,n,!1,!1,!0),f=w.word(Ee(u));if(i==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:o};if(i==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:o};if(i==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:o};if(i==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:o}}if(i==="#"||i==="%"){let o=l===i,c=i==="#"?"prefix":"suffix";a+=o?2:1;let u=fe(e,t,a),f=t.slice(a,u),h=ae(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:w.word(Ee(h)),side:c,greedy:o},endIndex:u}}if(i==="/"){let o=l==="/";a+=o?2:1;let c=null;t[a]==="#"?(c="start",a++):t[a]==="%"&&(c="end",a++);let u;c!==null&&(t[a]==="/"||t[a]==="}")?u=a:u=Xt(e,t,a);let f=t.slice(a,u),h=ae(e,f,!1,!1,!1),d=w.word(Ee(h)),m=null,g=u;if(t[u]==="/"){let E=u+1,A=fe(e,t,E),S=t.slice(E,A),y=ae(e,S,!1,!1,!1);m=w.word(Ee(y)),g=A}return{operation:{type:"PatternReplacement",pattern:d,replacement:m,all:o,anchor:c},endIndex:g}}if(i==="^"||i===","){let o=l===i,c=i==="^"?"upper":"lower";a+=o?2:1;let u=fe(e,t,a),f=t.slice(a,u),h=f?w.word([w.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:o,pattern:h},endIndex:u}}return i==="@"&&/[QPaAEKkuUL]/.test(l)?{operation:{type:"Transform",operator:l},endIndex:a+2}:{operation:null,endIndex:a}}function lt(e,t,r,s=!1){let n=r+1;if(n>=t.length)return{part:w.literal("$"),endIndex:n};let a=t[n];if(a==="("&&t[n+1]==="(")return e.isDollarDparenSubshell(t,r)?e.parseCommandSubstitution(t,r):e.parseArithmeticExpansion(t,r);if(a==="["){let i=1,l=n+1;for(;l0;)t[l]==="["?i++:t[l]==="]"&&i--,i>0&&l++;if(i===0){let o=t.slice(n+1,l),c=M(e,o);return{part:w.arithmeticExpansion(c),endIndex:l+1}}}return a==="("?e.parseCommandSubstitution(t,r):a==="{"?Kr(e,t,r,s):/[a-zA-Z_0-9@*#?$!-]/.test(a)?jr(e,t,r):{part:w.literal("$"),endIndex:n}}function ln(e,t){let r=[],s=0,n="",a=()=>{n&&(r.push(w.literal(n)),n="")};for(;s{a&&(s.push(w.literal(a)),a="")};for(;n=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),g=!1;for(let E=0;E{h&&(u.push(w.literal(h)),h="")};for(;f0?t[f-1]:"";if(f===0||g==="="||n&&g===":"){let A=Kt(e,t,f),S=t[A];if(S===void 0||S==="/"||S===":"){d();let y=t.slice(f+1,A)||null;u.push({type:"TildeExpansion",user:y}),f=A;continue}}}if("@*+?!".includes(m)&&f+10;){let l=e[s];if(a){l==="'"&&(a=!1),s++;continue}if(i){if(l==="\\"){s+=2;continue}l==='"'&&(i=!1),s++;continue}if(l==="'"){a=!0,s++;continue}if(l==='"'){i=!0,s++;continue}if(l==="\\"){s+=2;continue}if(l==="("){n++,s++;continue}if(l===")"){if(n--,n===1){let o=s+1;return!(o0;){let g=e[i];l?g==="'"&&(l=!1):o?g==="\\"&&i+10?u=!0:f==="esac"&&c>0&&(c--,u=!1),f="",g==="("?i>0&&e[i-1]==="$"?a++:u||a++:g===")"?u?u=!1:a--:g===";"&&c>0&&i+10&&i++}a>0&&s("unexpected EOF while looking for matching `)'");let h=e.slice(n,i),m=r().parse(h);return{part:w.commandSubstitution(m,!1),endIndex:i+1}}function fn(e,t,r,s,n){let i=t+1,l="";for(;i=e.length&&n("unexpected EOF while looking for matching ``'");let c=s().parse(l);return{part:w.commandSubstitution(c,!0),endIndex:i+1}}var V=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>Qt)throw new G("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Ue)throw new G(`Maximum parser nesting depth exceeded (${Ue})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,r){if(t.length>Qe)throw new G(`Input too large: ${t.length} bytes exceeds limit of ${Qe}`,1,1);this._input=t;let s=new ve(t,r);if(this.tokens=s.tokenize(),this.tokens.length>Ze)throw new G(`Too many tokens: ${this.tokens.length} exceeds limit of ${Ze}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(t){return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos0?a.includes(i):!1}expect(t,r){if(this.check(t))return this.advance();let s=this.current();throw new G(r||`Expected ${t}, got ${s.type}`,s.line,s.column,s)}error(t){let r=this.current();throw new G(t,r.line,r.column,r)}skipNewlines(){for(;this.check(p.NEWLINE,p.COMMENT);)this.check(p.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(p.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(p.SEMICOLON,p.COMMENT)){this.advance();continue}if(t&&this.check(p.DSEMI,p.SEMI_AND,p.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,r,s,n){this.pendingHeredocs.push({redirect:t,delimiter:r,stripTabs:s,quoted:n})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(p.HEREDOC_CONTENT)){let r=this.advance(),s;t.quoted?s=w.word([w.literal(r.value)]):s=this.parseWordFromString(r.value,!1,!1,!1,!0),t.redirect.target=w.hereDoc(t.delimiter,s,t.stripTabs,t.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(p.EOF,p.NEWLINE,p.SEMICOLON,p.AMP,p.AND_AND,p.OR_OR,p.RPAREN,p.RBRACE,p.DSEMI,p.SEMI_AND,p.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return t===p.WORD||t===p.NAME||t===p.NUMBER||t===p.ASSIGNMENT_WORD||t===p.IF||t===p.FOR||t===p.WHILE||t===p.UNTIL||t===p.CASE||t===p.LPAREN||t===p.LBRACE||t===p.DPAREN_START||t===p.DBRACK_START||t===p.FUNCTION||t===p.BANG||t===p.TIME||t===p.IN||t===p.LESS||t===p.GREAT||t===p.DLESS||t===p.DGREAT||t===p.LESSAND||t===p.GREATAND||t===p.LESSGREAT||t===p.DLESSDASH||t===p.CLOBBER||t===p.TLESS||t===p.AND_GREAT||t===p.AND_DGREAT}parseScript(){let t=[],s=0;for(this.skipNewlines();!this.check(p.EOF);){s++,s>1e4&&this.error("Parser stuck: too many iterations (>10000)");let n=this.checkUnexpectedToken();if(n){t.push(n),this.skipSeparators(!1);continue}let a=this.pos,i=this.parseStatement();i&&t.push(i),this.skipSeparators(!1),this.check(p.DSEMI,p.SEMI_AND,p.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===a&&!this.check(p.EOF)&&this.advance()}return w.script(t)}checkUnexpectedToken(){let t=this.current().type,r=this.current().value;if((t===p.DO||t===p.DONE||t===p.THEN||t===p.ELSE||t===p.ELIF||t===p.FI||t===p.ESAC)&&this.error(`syntax error near unexpected token \`${r}'`),t===p.RBRACE||t===p.RPAREN){let s=`syntax error near unexpected token \`${r}'`;return this.advance(),w.statement([w.pipeline([w.simpleCommand(null,[],[],[])])],[],!1,{message:s,token:r})}return(t===p.DSEMI||t===p.SEMI_AND||t===p.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${r}'`),t===p.SEMICOLON&&this.error(`syntax error near unexpected token \`${r}'`),(t===p.PIPE||t===p.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${r}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,r=[],s=[],n=!1,a=this.parsePipeline();for(r.push(a);this.check(p.AND_AND,p.OR_OR);){let o=this.advance();s.push(o.type===p.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();r.push(c)}this.check(p.AMP)&&(this.advance(),n=!0);let i=this.pos>0?this.tokens[this.pos-1].end:t,l=this._input.slice(t,i);return w.statement(r,s,n,void 0,l)}parsePipeline(){let t=!1,r=!1;this.check(p.TIME)&&(this.advance(),t=!0,this.check(p.WORD,p.NAME)&&this.current().value==="-p"&&(this.advance(),r=!0));let s=0;for(;this.check(p.BANG);)this.advance(),s++;let n=s%2===1,a=[],i=[],l=this.parseCommand();for(a.push(l);this.check(p.PIPE,p.PIPE_AMP);){let o=this.advance();this.skipNewlines(),i.push(o.type===p.PIPE_AMP);let c=this.parseCommand();a.push(c)}return w.pipeline(a,n,t,r,i.length>0?i:void 0)}parseCommand(){return this.check(p.IF)?Je(this):this.check(p.FOR)?Ye(this):this.check(p.WHILE)?et(this):this.check(p.UNTIL)?tt(this):this.check(p.CASE)?nt(this):this.check(p.LPAREN)?rt(this):this.check(p.LBRACE)?st(this):this.check(p.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(p.DBRACK_START)?this.parseConditionalCommand():this.check(p.FUNCTION)?this.parseFunctionDef():this.check(p.NAME,p.WORD)&&this.peek(1).type===p.LPAREN&&this.peek(2).type===p.RPAREN?this.parseFunctionDef():rn(this)}dparenClosesWithSpacedParens(){let t=1,r=1;for(;rnew e,s=>this.error(s))}parseBacktickSubstitution(t,r,s=!1){return fn(t,r,s,()=>new e,n=>this.error(n))}isDollarDparenSubshell(t,r){return un(t,r)}parseArithmeticExpansion(t,r){let s=r+3,n=1,a=0,i=s;for(;i0;)t[i]==="$"&&t[i+1]==="("?t[i+2]==="("?(n++,i+=3):(a++,i+=2):t[i]==="("&&t[i+1]==="("?(n++,i+=2):t[i]===")"&&t[i+1]===")"?a>0?(a--,i++):(n--,n>0&&(i+=2)):t[i]==="("?(a++,i++):(t[i]===")"&&a>0&&a--,i++);let l=t.slice(s,i),o=this.parseArithmeticExpression(l);return{part:w.arithmeticExpansion(o),endIndex:i+2}}parseArithmeticCommand(){let t=this.expect(p.DPAREN_START),r="",s=1,n=0,a=!1,i=!1;for(;s>0&&!this.check(p.EOF);){if(a){if(a=!1,n>0){n--,r+=")";continue}if(this.check(p.RPAREN)){s--,i=!0,this.advance();continue}if(this.check(p.DPAREN_END)){s--,i=!0;continue}r+=")";continue}if(this.check(p.DPAREN_START))s++,r+="((",this.advance();else if(this.check(p.DPAREN_END))n>=2?(n-=2,r+="))",this.advance()):n===1?(n--,r+=")",a=!0,this.advance()):(s--,i=!0,s>0&&(r+="))"),this.advance());else if(this.check(p.LPAREN))n++,r+="(",this.advance();else if(this.check(p.RPAREN))n>0&&n--,r+=")",this.advance();else{let c=this.current().value,u=r.length>0?r[r.length-1]:"";r.length>0&&!r.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(r))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(r+=" "),r+=c,this.advance()}}i||this.expect(p.DPAREN_END);let l=this.parseArithmeticExpression(r.trim()),o=this.parseOptionalRedirections();return w.arithmeticCommand(l,o,t.line)}parseConditionalCommand(){let t=this.expect(p.DBRACK_START),r=at(this);this.expect(p.DBRACK_END);let s=this.parseOptionalRedirections();return w.conditionalCommand(r,s,t.line)}parseFunctionDef(){let t;if(this.check(p.FUNCTION)){if(this.advance(),this.check(p.NAME)||this.check(p.WORD))t=this.advance().value;else{let n=this.current();throw new G("Expected function name",n.line,n.column,n)}this.check(p.LPAREN)&&(this.advance(),this.expect(p.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(p.LPAREN),this.expect(p.RPAREN);this.skipNewlines();let r=this.parseCompoundCommandBody({forFunctionBody:!0}),s=this.parseOptionalRedirections();return w.functionDef(t,r,s)}parseCompoundCommandBody(t){let r=t?.forFunctionBody;if(this.check(p.LBRACE))return st(this,{skipRedirections:r});if(this.check(p.LPAREN))return rt(this,{skipRedirections:r});if(this.check(p.IF))return Je(this,{skipRedirections:r});if(this.check(p.FOR))return Ye(this,{skipRedirections:r});if(this.check(p.WHILE))return et(this,{skipRedirections:r});if(this.check(p.UNTIL))return tt(this,{skipRedirections:r});if(this.check(p.CASE))return nt(this,{skipRedirections:r});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth(),r=[];for(this.skipNewlines();!this.check(p.EOF,p.FI,p.ELSE,p.ELIF,p.THEN,p.DO,p.DONE,p.ESAC,p.RPAREN,p.RBRACE,p.DSEMI,p.SEMI_AND,p.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let s=this.pos,n=this.parseStatement();if(n&&r.push(n),this.skipSeparators(),this.pos===s&&!n)break}return t(),r}parseOptionalRedirections(){let t=[];for(;De(this);){this.checkIterationLimit();let r=this.pos;if(t.push(xe(this)),this.pos===r)break}return t}parseArithmeticExpression(t){return M(this,t)}};function di(e,t){return new V().parse(e,t)}var Yr=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]]);function ut(e){return Yr.get(e)??""}function hn(e){let t=[],r="",s=0;for(;s0;){let n=e[s];if(n==="\\"){s+=2;continue}if(n==="(")r++;else if(n===")"&&(r--,r===0))return s;s++}return-1}function ft(e){let t=[],r="",s=0,n=!1,a=0;for(;athis.maxOps)throw new L(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations")}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(t){return!this.hasGlobignore&&!this.globskipdots?t:t.filter(r=>{let s=r.split("/").pop()||r;if((this.hasGlobignore||this.globskipdots)&&(s==="."||s===".."))return!1;if(this.hasGlobignore){for(let n of this.globignorePatterns)if(this.matchGlobignorePattern(r,n))return!1}return!0})}matchGlobignorePattern(t,r){return pn(r).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,r){let s=t.map((i,l)=>(r?.[l]??!1)||!this.isGlobPattern(i)?null:this.expand(i)),n=await Promise.all(s.map(i=>i||Promise.resolve(null))),a=[];for(let i=0;i0?a.push(...l):a.push(t[i])}return a}async expand(t){if(this.globstar){let s=t.split("/"),n=0;for(let a of s)if(a==="**"&&(n++,n>dn))throw new L(`Glob pattern has too many ** segments (max ${dn})`,"glob_operations")}let r;if(t.includes("**")&&this.globstar&&this.isGlobstarValid(t))r=await this.expandRecursive(t);else{let s=t.replace(/\*\*+/g,"*");r=await this.expandSimple(s)}return this.filterGlobignore(r)}isGlobstarValid(t){let r=t.split("/");for(let s of r)if(s.includes("**")&&s!=="**")return!1;return!0}hasGlobChars(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandSimple(t){let r=t.startsWith("/"),s=t.split("/").filter(c=>c!==""),n=-1;for(let c=0;cm.name==="."),d=l.some(m=>m.name==="..");h||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),d||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let h of c)if(!(h.name.startsWith(".")&&!n.startsWith(".")&&!u)&&this.matchPattern(h.name,n)){let d=t==="/"?`/${h.name}`:`${t}/${h.name}`,m;r===""?m=h.name:r==="/"?m=`/${h.name}`:m=`${r}/${h.name}`,a.length===0?o.push(Promise.resolve([m])):h.isDirectory&&o.push(this.expandSegments(d,m,a))}let f=await Promise.all(o);for(let h of f)i.push(...h)}else{this.checkOpsLimit();let l=await this.fs.readdir(t),o=[],c=[...l],u=this.dotglob||this.hasGlobignore;(n.startsWith(".")||this.dotglob)&&(l.includes(".")||c.push("."),l.includes("..")||c.push(".."));for(let h of c)if(!(h.startsWith(".")&&!n.startsWith(".")&&!u)&&this.matchPattern(h,n)){let d=t==="/"?`/${h}`:`${t}/${h}`,m;r===""?m=h:r==="/"?m=`/${h}`:m=`${r}/${h}`,a.length===0?o.push(Promise.resolve([m])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(d)).isDirectory)return this.expandSegments(d,m,a)}catch(g){if(g instanceof L)throw g}return[]})())}let f=await Promise.all(o);for(let h of f)i.push(...h)}}catch(l){if(l instanceof L)throw l}return i}async expandRecursive(t){let r=[],s=t.indexOf("**"),n=t.slice(0,s).replace(/\/$/,"")||".",i=t.slice(s+2).replace(/^\//,"");return i.includes("**")&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(n,i,r),[...new Set(r)].sort()):(await this.walkDirectory(n,i,r),r.sort())}async walkDirectoryMultiGlobstar(t,r,s){this.checkOpsLimit();let n=this.fs.resolvePath(this.cwd,t);try{this.checkOpsLimit();let a=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(n):null;if(a){let i=[];for(let c of a){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&i.push(u)}let l=t==="."?r:`${t}/${r}`,o=await this.expandRecursive(l);s.push(...o);for(let c=0;cthis.walkDirectoryMultiGlobstar(f,r,s)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(n),l=[];for(let u of i){let f=t==="."?u:`${t}/${u}`,h=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory&&l.push(f)}catch(d){if(d instanceof L)throw d}}let o=t==="."?r:`${t}/${r}`,c=await this.expandRecursive(o);s.push(...c);for(let u=0;uthis.walkDirectoryMultiGlobstar(h,r,s)))}}}catch(a){if(a instanceof L)throw a}}async walkDirectory(t,r,s){this.checkOpsLimit();let n=this.fs.resolvePath(this.cwd,t);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let a=await this.fs.readdirWithFileTypes(n),i=[],l=[];for(let o of a){let c=t==="."?o.name:`${t}/${o.name}`;o.isDirectory?l.push(c):r&&this.matchPattern(o.name,r)&&i.push(c)}s.push(...i);for(let o=0;othis.walkDirectory(u,r,s)))}}else{this.checkOpsLimit();let a=await this.fs.readdir(n),i=[];for(let o=0;o{let h=t==="."?f:`${t}/${f}`,d=this.fs.resolvePath(this.cwd,h);try{this.checkOpsLimit();let m=await this.fs.stat(d);return{name:f,path:h,isDirectory:m.isDirectory}}catch(m){if(m instanceof L)throw m;return null}}));i.push(...u.filter(f=>f!==null))}for(let o of i)!o.isDirectory&&r&&this.matchPattern(o.name,r)&&s.push(o.path);let l=i.filter(o=>o.isDirectory);for(let o=0;othis.walkDirectory(u.path,r,s)))}}}catch(a){if(a instanceof L)throw a}}matchPattern(t,r){return this.patternToRegex(r).test(t)}patternToRegex(t){let r=this.patternToRegexStr(t);return O(`^${r}$`)}patternToRegexStr(t){let r="",s=!1;for(let n=0;nthis.patternToRegexStr(f)),u=c.length>0?c.join("|"):"(?:)";if(a==="@")r+=`(?:${u})`;else if(a==="*")r+=`(?:${u})*`;else if(a==="+")r+=`(?:${u})+`;else if(a==="?")r+=`(?:${u})?`;else if(a==="!")if(ithis.computePatternLength(m));if(h.every(m=>m!==null)&&h.every(m=>m===h[0])&&h[0]!==null){let m=h[0];if(m===0)r+="(?:.+)";else{let g=[];m>0&&g.push(`.{0,${m-1}}`),g.push(`.{${m+1},}`),g.push(`(?!(?:${u})).{${m}}`),r+=`(?:${g.join("|")})`}}else r+=`(?:(?!(?:${u})).)*?`}else r+=`(?!(?:${u})$).*`;n=i;continue}}if(a==="*")r+=".*";else if(a==="?")r+=".";else if(a==="["){let i=n+1,l="[";ithis.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){r+=c[0],s=i+1;continue}return null}return null}}if(a==="*")return null;if(a==="?"){r+=1,s++;continue}if(a==="["){let i=t.indexOf("]",s+1);if(i!==-1){r+=1,s=i+1;continue}r+=1,s++;continue}if(a==="\\"){r+=1,s+=2;continue}r+=1,s++}return r}};function es(e,t,r){switch(r){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new C("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new C("division by 0");return e%t;case"**":if(t<0)throw new C("exponent less than 0");return e**t;case"<<":return e<>":return e>>t;case"<":return e":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function mn(e,t,r){switch(r){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function ts(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function ns(e,t){let r=e.state.env.get(t);if(r!==void 0)return r;let s=e.state.env.get(`${t}_0`);return s!==void 0?s:await v(e,t)}function rs(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let r=e.trim();if(!r)return 0;try{let s=new V,{expr:n,pos:a}=Z(s,r,0);if(a100)throw new C("maximum variable indirection depth exceeded");if(r.has(t))return 0;r.add(t);let n=await ns(e,t);if(!n)return 0;let a=Number.parseInt(n,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(n.trim()))return a;let i=n.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return await pt(e,i,r,s+1);let l=new V,{expr:o,pos:c}=Z(l,i,0);if(c0&&(s===-1||h64)return 0;let a=`${n}#${t.value}`;return ge(a)}case"ArithDynamicNumber":{let n=await _e(e,t.prefix)+t.suffix;return ge(n)}case"ArithArrayElement":{let s=e.state.associativeArrays?.has(t.array),n=async a=>{let i=e.state.env.get(a);return i!==void 0?await ht(e,i):0};if(t.stringKey!==void 0)return await n(`${t.array}_${t.stringKey}`);if(s&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await n(`${t.array}_${t.index.name}`);if(s&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let a=await v(e,t.index.name);return await n(`${t.array}_${a}`)}if(t.index){let a=await R(e,t.index,r);if(a<0){let o=P(e,t.array),c=e.state.currentLine;if(o.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript +`,0;let f=Math.max(...o.map(([h])=>typeof h=="number"?h:0))+1+a;if(f<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript +`,0;a=f}let i=`${t.array}_${a}`,l=e.state.env.get(i);if(l!==void 0)return ht(e,l);if(a===0){let o=e.state.env.get(t.array);if(o!==void 0)return ht(e,o)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new j(`${t.array}[${a}]`);return 0}return 0}case"ArithDoubleSubscript":throw new C("double subscript","","");case"ArithNumberSubscript":throw new C(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new C(t.message,"","",!0);case"ArithSingleQuote":{if(r)throw new C(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await R(e,t.left,r)||await R(e,t.right,r)?1:0;if(t.operator==="&&")return await R(e,t.left,r)&&await R(e,t.right,r)?1:0;let s=await R(e,t.left,r),n=await R(e,t.right,r);return es(s,n,t.operator)}case"ArithUnary":{let s=await R(e,t.operand,r);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let n=t.operand.name,a=Number.parseInt(await v(e,n),10)||0,i=t.operator==="++"?a+1:a-1;return e.state.env.set(n,String(i)),t.prefix?i:a}if(t.operand.type==="ArithArrayElement"){let n=t.operand.array,a=e.state.associativeArrays?.has(n),i;if(t.operand.stringKey!==void 0)i=`${n}_${t.operand.stringKey}`;else if(a&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)i=`${n}_${t.operand.index.name}`;else if(a&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await v(e,t.operand.index.name);i=`${n}_${c}`}else if(t.operand.index){let c=await R(e,t.operand.index,r);i=`${n}_${c}`}else return s;let l=Number.parseInt(e.state.env.get(i)||"0",10)||0,o=t.operator==="++"?l+1:l-1;return e.state.env.set(i,String(o)),t.prefix?o:l}if(t.operand.type==="ArithConcat"){let n="";for(let a of t.operand.parts)n+=await de(e,a,r);if(n&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)){let a=Number.parseInt(e.state.env.get(n)||"0",10)||0,i=t.operator==="++"?a+1:a-1;return e.state.env.set(n,String(i)),t.prefix?i:a}}if(t.operand.type==="ArithDynamicElement"){let n="";if(t.operand.nameExpr.type==="ArithConcat")for(let a of t.operand.nameExpr.parts)n+=await de(e,a,r);else t.operand.nameExpr.type==="ArithVariable"&&(n=t.operand.nameExpr.hasDollarPrefix?await v(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(n&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)){let a=await R(e,t.operand.subscript,r),i=`${n}_${a}`,l=Number.parseInt(e.state.env.get(i)||"0",10)||0,o=t.operator==="++"?l+1:l-1;return e.state.env.set(i,String(o)),t.prefix?o:l}}return s}return ts(s,t.operator)}case"ArithTernary":return await R(e,t.condition,r)?await R(e,t.consequent,r):await R(e,t.alternate,r);case"ArithAssignment":{let s=t.variable,n=s;if(t.stringKey!==void 0)n=`${s}_${t.stringKey}`;else if(t.subscript){let o=e.state.associativeArrays?.has(s);if(o&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)n=`${s}_${t.subscript.name}`;else if(o&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix){let c=await v(e,t.subscript.name);n=`${s}_${c||"\\"}`}else if(o){let c=await R(e,t.subscript,r);n=`${s}_${c}`}else{let c=await R(e,t.subscript,r);if(c<0){let u=P(e,s);u.length>0&&(c=Math.max(...u.map(([h])=>typeof h=="number"?h:0))+1+c)}n=`${s}_${c}`}}let a=Number.parseInt(e.state.env.get(n)||"0",10)||0,i=await R(e,t.value,r),l=mn(a,i,t.operator);return e.state.env.set(n,String(l)),l}case"ArithGroup":return await R(e,t.expression,r);case"ArithConcat":{let s="";for(let n of t.parts)s+=await de(e,n,r);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?await pt(e,s):Number.parseInt(s,10)||0}case"ArithDynamicAssignment":{let s="";if(t.target.type==="ArithConcat")for(let o of t.target.parts)s+=await de(e,o,r);else t.target.type==="ArithVariable"&&(s=t.target.hasDollarPrefix?await v(e,t.target.name):t.target.name);if(!s||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s))return 0;let n=s;if(t.subscript){let o=await R(e,t.subscript,r);n=`${s}_${o}`}let a=Number.parseInt(e.state.env.get(n)||"0",10)||0,i=await R(e,t.value,r),l=mn(a,i,t.operator);return e.state.env.set(n,String(l)),l}case"ArithDynamicElement":{let s="";if(t.nameExpr.type==="ArithConcat")for(let l of t.nameExpr.parts)s+=await de(e,l,r);else t.nameExpr.type==="ArithVariable"&&(s=t.nameExpr.hasDollarPrefix?await v(e,t.nameExpr.name):t.nameExpr.name);if(!s||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s))return 0;let n=await R(e,t.subscript,r),a=`${s}_${n}`,i=e.state.env.get(a);return i!==void 0?rs(i):0}default:return 0}}async function de(e,t,r=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await R(e,t,r));case"ArithVariable":return t.hasDollarPrefix?await v(e,t.name):t.name;case"ArithSpecialVar":return await v(e,t.name);case"ArithBracedExpansion":return await _e(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let s="";for(let n of t.parts)s+=await de(e,n,r);return s}default:return String(await R(e,t,r))}}function dt(e){for(let t=0;tn-a)}function Ci(e,t){let r=`${t}_`;for(let s of e.state.env.keys())s.startsWith(r)&&e.state.env.delete(s)}function gt(e,t){let r=`${t}_`,s=`${t}__length`,n=[];for(let a of e.state.env.keys())if(a!==s&&a.startsWith(r)){let i=a.slice(r.length);if(i.startsWith("_length"))continue;n.push(i)}return n.sort()}function $e(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Oi(e){if(e.parts.length<2)return null;let t=e.parts[0],r=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let s,n=r,a=1;if(r.type==="Literal"&&r.value.startsWith("]")){let f=r.value.slice(1);if(f.startsWith("+=")||f.startsWith("="))s=t.pattern.slice(1);else if(f===""){if(e.parts.length<3)return null;let h=e.parts[2];if(h.type!=="Literal"||!h.value.startsWith("=")&&!h.value.startsWith("+="))return null;s=t.pattern.slice(1),n=h,a=2}else return null}else if(t.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(e.parts.length<3)return null;let f=e.parts[2];if(f.type!=="Literal"||!f.value.startsWith("]=")&&!f.value.startsWith("]+="))return null;if(r.type==="SingleQuoted")s=r.value;else{s="";for(let h of r.parts)(h.type==="Literal"||h.type==="Escaped")&&(s+=h.value)}n=f,a=2}else if(t.pattern.endsWith("]")){if(r.type!=="Literal"||!r.value.startsWith("=")&&!r.value.startsWith("+="))return null;s=t.pattern.slice(1,-1)}else return null;s=$e(s);let i;if(n.type!=="Literal")return null;n.value.startsWith("]=")||n.value.startsWith("]+=")?i=n.value.slice(1):i=n.value;let l=i.startsWith("+=");if(!l&&!i.startsWith("="))return null;let o=[],c=l?2:1,u=i.slice(c);u&&o.push({type:"Literal",value:u});for(let f=a+1;f{if(r.type==="Range"){let s=r.startStr??String(r.start),n=r.endStr??String(r.end),a=`${s}..${n}`;return r.step&&(a+=`..${r.step}`),a}return En(r.word)}).join(",")}}`}function En(e){let t="";for(let r of e.parts)switch(r.type){case"Literal":t+=r.value;break;case"Glob":t+=r.pattern;break;case"SingleQuoted":t+=r.value;break;case"DoubleQuoted":for(let s of r.parts)(s.type==="Literal"||s.type==="Escaped")&&(t+=s.value);break;case"Escaped":t+=r.value;break;case"BraceExpansion":t+="{",t+=r.items.map(s=>s.type==="Range"?`${s.startStr}..${s.endStr}${s.step?`..${s.step}`:""}`:En(s.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",r.user&&(t+=r.user);break}return t}function T(e){return e.get("IFS")??` +`}function q(e){return e.get("IFS")===""}function Ce(e){let t=T(e);if(t==="")return!0;for(let r of t)if(r!==" "&&r!==" "&&r!==` +`)return!1;return!0}function An(e){let t=!1,r=[];for(let s of e.split(""))s==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(s)?r.push(`\\${s}`):s===" "?r.push("\\t"):s===` +`?r.push("\\n"):r.push(s);return t&&r.push("\\-"),r.join("")}function N(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}var as=` +`;function os(e){return as.includes(e)}function yt(e){let t=new Set,r=new Set;for(let s of e)os(s)?t.add(s):r.add(s);return{whitespace:t,nonWhitespace:r}}function Wi(e,t,r,s){if(t==="")return e===""?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:n,nonWhitespace:a}=yt(t),i=[],l=[],o=0;for(;o=e.length)return{words:[],wordStarts:[]};if(a.has(e[o]))for(i.push(""),l.push(o),o++;o=r);){let c=o;for(l.push(c);o=e.length)break;for(;o=r);)for(i.push(""),l.push(o),o++;oo&&(i=!0),a>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(s.has(e[a]))for(n.push(""),a++;a=e.length){l=!1;break}let u=a;for(;a=e.length&&a>u&&(l=!0)}return{words:n,hadLeadingDelimiter:i,hadTrailingDelimiter:l}}function x(e,t){return Oe(e,t).words}function ls(e,t){for(let r of e)if(t.has(r))return!0;return!1}function Ti(e,t,r){if(t==="")return e;let{whitespace:s,nonWhitespace:n}=yt(t),a=e.length;for(;a>0&&s.has(e[a-1]);){if(!r&&a>=2){let l=0,o=a-2;for(;o>=0&&e[o]==="\\";)l++,o--;if(l%2===1)break}a--}let i=e.substring(0,a);if(i.length>=1&&n.has(i[i.length-1])){if(!r&&i.length>=2){let o=0,c=i.length-2;for(;c>=0&&i[c]==="\\";)o++,c--;if(o%2===1)return i}let l=i.substring(0,i.length-1);if(!ls(l,n))return l}return i}function W(e,t){return e.state.namerefs?.has(t)??!1}function Vi(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function qi(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Bi(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Sn(e,t){return e.state.invalidNamerefs?.has(t)??!1}function Fi(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function us(e,t){let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let n=r[1],a=Array.from(e.state.env.keys()).some(l=>l.startsWith(`${n}_`)&&!l.includes("__")),i=e.state.associativeArrays?.has(n)??!1;return a||i}return Array.from(e.state.env.keys()).some(n=>n.startsWith(`${t}_`)&&!n.includes("__"))?!0:e.state.env.has(t)}function he(e,t,r=100){if(!W(e,t)||Sn(e,t))return t;let s=new Set,n=t;for(;r-- >0;){if(s.has(n))return;if(s.add(n),!W(e,n))return n;let a=e.state.env.get(n);if(a===void 0||a===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(a))return n;n=a}}function Se(e,t){if(W(e,t))return e.state.env.get(t)}function zi(e,t,r,s=100){if(!W(e,t)||Sn(e,t))return t;let n=new Set,a=t;for(;s-- >0;){if(n.has(a))return;if(n.add(a),!W(e,a))return a;let i=e.state.env.get(a);if(i===void 0||i==="")return r!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&us(e,r)?a:null:a;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return a;a=i}}function cs(e,t){let r=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(s,n)=>e.state.env.get(n)??"");return r=r.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(s,n)=>e.state.env.get(n)??""),r}function P(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((a,i)=>[i,a]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((a,i)=>[i,String(a)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((a,i)=>[i,a]):e.state.associativeArrays?.has(t)?gt(e,t).map(a=>[a,e.state.env.get(`${t}_${a}`)??""]):mt(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??""])}function be(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?gt(e,t).length>0:mt(e,t).length>0}async function v(e,t,r=!0,s=!1){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let i="";return i+="h",e.state.options.errexit&&(i+="e"),e.state.options.noglob&&(i+="f"),e.state.options.nounset&&(i+="u"),e.state.options.verbose&&(i+="v"),e.state.options.xtrace&&(i+="x"),i+="B",e.state.options.noclobber&&(i+="C"),i+="s",i}case"*":{let i=Number.parseInt(e.state.env.get("#")||"0",10);if(i===0)return"";let l=[];for(let o=1;o<=i;o++)l.push(e.state.env.get(String(o))||"");return l.join(N(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return yn;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let i=e.state.funcNameStack?.[0];if(i!==void 0)return i;if(r&&e.state.options.nounset)throw new j("FUNCNAME");return""}case"BASH_LINENO":{let i=e.state.callLineStack?.[0];if(i!==void 0)return String(i);if(r&&e.state.options.nounset)throw new j("BASH_LINENO");return""}case"BASH_SOURCE":{let i=e.state.sourceStack?.[0];if(i!==void 0)return i;if(r&&e.state.options.nounset)throw new j("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new re(`\${${t}}`);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let i=n[1],l=n[2];if(W(e,i)){let f=he(e,i);if(f&&f!==i){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";i=f}}if(l==="@"||l==="*"){let f=P(e,i);if(f.length>0)return f.map(([,d])=>d).join(" ");let h=e.state.env.get(i);return h!==void 0?h:""}if(i==="FUNCNAME"){let f=Number.parseInt(l,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(i==="BASH_LINENO"){let f=Number.parseInt(l,10);if(!Number.isNaN(f)&&f>=0){let h=e.state.callLineStack?.[f];return h!==void 0?String(h):""}return""}if(i==="BASH_SOURCE"){let f=Number.parseInt(l,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(i)){let f=$e(l);f=cs(e,f);let h=e.state.env.get(`${i}_${f}`);if(h===void 0&&r&&e.state.options.nounset)throw new j(`${i}[${l}]`);return h||""}let c;if(/^-?\d+$/.test(l))c=Number.parseInt(l,10);else try{let f=new V,h=M(f,l);c=await R(e,h.expression)}catch{let f=e.state.env.get(l);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=P(e,i),h=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${h}: ${i}: bad array subscript +`,"";let m=Math.max(...f.map(([E])=>typeof E=="number"?E:0))+1+c;return m<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${h}: ${i}: bad array subscript +`,""):e.state.env.get(`${i}_${m}`)||""}let u=e.state.env.get(`${i}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(i);if(f!==void 0)return f}if(r&&e.state.options.nounset)throw new j(`${i}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let i=e.state.env.get(t);if(i===void 0&&r&&e.state.options.nounset)throw new j(t);return i||""}if(W(e,t)){let i=he(e,t);if(i===void 0)return"";if(i!==t)return await v(e,i,r,s);let l=e.state.env.get(t);if((l===void 0||l==="")&&r&&e.state.options.nounset)throw new j(t);return l||""}let a=e.state.env.get(t);if(a!==void 0)return e.state.tempEnvBindings?.some(i=>i.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),a;if(be(e,t)){let i=e.state.env.get(`${t}_0`);return i!==void 0?i:""}if(r&&e.state.options.nounset)throw new j(t);return""}async function te(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let n=s[1],a=s[2];if(W(e,n)){let o=he(e,n);if(o&&o!==n){if(o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;n=o}}if(a==="@"||a==="*")return P(e,n).length>0?!0:e.state.env.has(n);if(e.state.associativeArrays?.has(n)){let o=$e(a);return e.state.env.has(`${n}_${o}`)}let l;if(/^-?\d+$/.test(a))l=Number.parseInt(a,10);else try{let o=new V,c=M(o,a);l=await R(e,c.expression)}catch{let o=e.state.env.get(a);l=o?Number.parseInt(o,10):0,Number.isNaN(l)&&(l=0)}if(l<0){let o=P(e,n);if(o.length===0)return!1;let u=Math.max(...o.map(([f])=>typeof f=="number"?f:0))+1+l;return u<0?!1:e.state.env.has(`${n}_${u}`)}return e.state.env.has(`${n}_${l}`)}if(W(e,t)){let n=he(e,t);return n===void 0||n===t?e.state.env.has(t):te(e,n)}return!!(e.state.env.has(t)||be(e,t))}async function bn(e,t){let r="",s=0;for(;s0;)t[a]==="{"?n++:t[a]==="}"&&n--,a++;r+=t.slice(s,a),s=a;continue}if(t[s+1]==="("){let n=1,a=s+2;for(;a0;)t[a]==="("?n++:t[a]===")"&&n--,a++;r+=t.slice(s,a),s=a;continue}if(/[a-zA-Z_]/.test(t[s+1]||"")){let n=s+1;for(;n0;)r[o]==="("&&r[o-1]==="$"||r[o]==="("?l++:r[o]===")"&&l--,o++;let c=r.slice(i+2,o-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});a+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}i=o}else if(r[i+1]==="{"){let l=1,o=i+2;for(;o0;)r[o]==="{"?l++:r[o]==="}"&&l--,o++;let c=r.slice(i+2,o-1),u=await v(e,c);a+=u,i=o}else if(/[a-zA-Z_]/.test(r[i+1]||"")){let l=i+1;for(;l{if(o>0){let f=u<0,h=String(Math.abs(u)).padStart(o,"0");return f?`-${h}`:h}return String(u)};if(e<=t)for(let u=e,f=0;u<=t&&f=t&&f="A"&&e<="Z",o=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(l&&u||o&&c){let h=r!==void 0?`..${r}`:"";throw new It(`{${e}..${t}${h}}: invalid sequence`)}let f=[];if(n<=a)for(let h=n,d=0;h<=a&&d=a&&dk(f,t,r)),u=c.length>0?c.join("|"):"(?:)";a==="@"?s+=`(?:${u})`:a==="*"?s+=`(?:${u})*`:a==="+"?s+=`(?:${u})+`:a==="?"?s+=`(?:${u})?`:a==="!"&&(s+=`(?!(?:${u})$).*`),n=i+1;continue}}if(a==="\\")if(n+10;){let n=e[s];if(n==="\\"){s+=2;continue}if(n==="(")r++;else if(n===")"&&(r--,r===0))return s;s++}return-1}function ds(e){let t=[],r="",s=0,n=0;for(;n0&&r=0;a--){let i=e.slice(a);if(n.test(i))return e.slice(0,a)}return e}function me(e,t){let r=Array.from(e.state.env.keys()),s=new Set,n=e.state.associativeArrays??new Set,a=new Set;for(let l of r){let o=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);o&&a.add(o[1]);let c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&a.add(c[1])}let i=l=>{for(let o of n){let c=`${o}_`;if(l.startsWith(c)&&l!==o)return!0}return!1};for(let l of r)if(l.startsWith(t))if(l.includes("__")){let o=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);o?.[1].startsWith(t)&&s.add(o[1])}else if(/_\d+$/.test(l)){let o=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);o?.[1].startsWith(t)&&s.add(o[1])}else i(l)||s.add(l);return[...s].sort()}function As(e,t){let r=(a,i=2)=>String(a).padStart(i,"0");if(e===""){let a=r(t.getHours()),i=r(t.getMinutes()),l=r(t.getSeconds());return`${a}:${i}:${l}`}let s="",n=0;for(;n=e.length){s+="%",n++;continue}let a=e[n+1];switch(a){case"H":s+=r(t.getHours());break;case"M":s+=r(t.getMinutes());break;case"S":s+=r(t.getSeconds());break;case"d":s+=r(t.getDate());break;case"m":s+=r(t.getMonth()+1);break;case"Y":s+=t.getFullYear();break;case"y":s+=r(t.getFullYear()%100);break;case"I":{let i=t.getHours()%12;i===0&&(i=12),s+=r(i);break}case"p":s+=t.getHours()<12?"AM":"PM";break;case"P":s+=t.getHours()<12?"am":"pm";break;case"%":s+="%";break;case"a":{s+=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()];break}case"b":{s+=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()];break}default:s+=`%${a}`}n+=2}else s+=e[n],n++;return s}function we(e,t){let r="",s=0,n=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",a=e.state.env.get("HOSTNAME")||"localhost",i=a.split(".")[0],l=e.state.env.get("PWD")||"/",o=e.state.env.get("HOME")||"/",c=l.startsWith(o)?`~${l.slice(o.length)}`:l,u=l.split("/").pop()||l,f=new Date,h=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=e.state.env.get("__COMMAND_NUMBER")||"1";for(;s=t.length){r+="\\",s++;continue}let E=t[s+1];if(E>="0"&&E<="7"){let A="",S=s+1;for(;S="0"&&t[S]<="7";)A+=t[S],S++;let y=Number.parseInt(A,8)%256;r+=String.fromCharCode(y),s=S;continue}switch(E){case"\\":r+="\\",s+=2;break;case"a":r+="\x07",s+=2;break;case"e":r+="\x1B",s+=2;break;case"n":r+=` +`,s+=2;break;case"r":r+="\r",s+=2;break;case"$":r+="$",s+=2;break;case"[":case"]":s+=2;break;case"u":r+=n,s+=2;break;case"h":r+=i,s+=2;break;case"H":r+=a,s+=2;break;case"w":r+=c,s+=2;break;case"W":r+=u,s+=2;break;case"d":{let A=String(f.getDate()).padStart(2," ");r+=`${h[f.getDay()]} ${d[f.getMonth()]} ${A}`,s+=2;break}case"t":{let A=String(f.getHours()).padStart(2,"0"),S=String(f.getMinutes()).padStart(2,"0"),y=String(f.getSeconds()).padStart(2,"0");r+=`${A}:${S}:${y}`,s+=2;break}case"T":{let A=f.getHours()%12;A===0&&(A=12);let S=String(A).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),b=String(f.getSeconds()).padStart(2,"0");r+=`${S}:${y}:${b}`,s+=2;break}case"@":{let A=f.getHours()%12;A===0&&(A=12);let S=String(A).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),b=f.getHours()<12?"AM":"PM";r+=`${S}:${y} ${b}`,s+=2;break}case"A":{let A=String(f.getHours()).padStart(2,"0"),S=String(f.getMinutes()).padStart(2,"0");r+=`${A}:${S}`,s+=2;break}case"D":if(s+20&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!r){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.lengtha.startsWith(`${t}_`)&&/^[0-9]+$/.test(a.slice(t.length+1))),n=e.state.associativeArrays?.has(t)??!1;return s&&!n&&(r+="a"),n&&(r+="A"),e.state.integerVars?.has(t)&&(r+="i"),W(e,t)&&(r+="n"),wt(e,t)&&(r+="r"),e.state.exportedVars?.has(t)&&(r+="x"),r}async function Nn(e,t,r,s){return e.coverage?.hit("bash:expansion:default_value"),(r.isUnset||t.checkEmpty&&r.isEmpty)&&t.word?s(e,t.word.parts,r.inDoubleQuotes):r.effectiveValue}async function kn(e,t,r,s,n){if(e.coverage?.hit("bash:expansion:assign_default"),(s.isUnset||r.checkEmpty&&s.isEmpty)&&r.word){let i=await n(e,r.word.parts,s.inDoubleQuotes),l=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let[,o,c]=l,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let h=new V,d=M(h,c);u=await R(e,d.expression)}catch{let h=e.state.env.get(c);u=h?Number.parseInt(h,10):0}Number.isNaN(u)&&(u=0)}e.state.env.set(`${o}_${u}`,i);let f=Number.parseInt(e.state.env.get(`${o}__length`)||"0",10);u>=f&&e.state.env.set(`${o}__length`,String(u+1))}else e.state.env.set(t,i);return i}return s.effectiveValue}async function Pn(e,t,r,s,n){if(e.coverage?.hit("bash:expansion:error_if_unset"),s.isUnset||r.checkEmpty&&s.isEmpty){let i=r.word?await n(e,r.word.parts,s.inDoubleQuotes):`${t}: parameter null or not set`;throw new K(1,"",`bash: ${i} +`)}return s.effectiveValue}async function Rn(e,t,r,s){return e.coverage?.hit("bash:expansion:use_alternative"),!(r.isUnset||t.checkEmpty&&r.isEmpty)&&t.word?s(e,t.word.parts,r.inDoubleQuotes):""}async function In(e,t,r,s,n){e.coverage?.hit("bash:expansion:pattern_removal");let a="",i=e.state.shoptOptions.extglob;if(r.pattern)for(let o of r.pattern.parts)if(o.type==="Glob")a+=k(o.pattern,r.greedy,i);else if(o.type==="Literal")a+=k(o.value,r.greedy,i);else if(o.type==="SingleQuoted"||o.type==="Escaped")a+=I(o.value);else if(o.type==="DoubleQuoted"){let c=await s(e,o.parts);a+=I(c)}else if(o.type==="ParameterExpansion"){let c=await n(e,o);a+=k(c,r.greedy,i)}else{let c=await n(e,o);a+=I(c)}if(r.side==="prefix")return O(`^${a}`,"s").replace(t,"");let l=O(`${a}$`,"s");if(r.greedy)return l.replace(t,"");for(let o=t.length;o>=0;o--){let c=t.slice(o);if(l.test(c))return t.slice(0,o)}return t}async function vn(e,t,r,s,n){e.coverage?.hit("bash:expansion:pattern_replacement");let a="",i=e.state.shoptOptions.extglob;if(r.pattern)for(let c of r.pattern.parts)if(c.type==="Glob")a+=k(c.pattern,!0,i);else if(c.type==="Literal")a+=k(c.value,!0,i);else if(c.type==="SingleQuoted"||c.type==="Escaped")a+=I(c.value);else if(c.type==="DoubleQuoted"){let u=await s(e,c.parts);a+=I(u)}else if(c.type==="ParameterExpansion"){let u=await n(e,c);a+=k(u,!0,i)}else{let u=await n(e,c);a+=I(u)}let l=r.replacement?await s(e,r.replacement.parts):"";if(r.anchor==="start"?a=`^${a}`:r.anchor==="end"&&(a=`${a}$`),a==="")return t;let o=r.all?"gs":"s";try{let c=O(a,o);if(r.all){let u="",f=0,h=0,d=e.limits.maxStringLength,m=c.exec(t);for(;m!==null&&!(m[0].length===0&&m.index===t.length);){if(u+=t.slice(f,m.index)+l,f=m.index+m[0].length,m[0].length===0&&f++,h++,h%100===0&&u.length>d)throw new L(`pattern replacement: string length limit exceeded (${d} bytes)`,"string_length");m=c.exec(t)}return u+=t.slice(f),u}return c.replace(t,l)}catch(c){if(c instanceof L)throw c;return t}}function Dn(e,t,r){e.coverage?.hit("bash:expansion:length");let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(s){let n=s[1],a=P(e,n);return a.length>0?String(a.length):e.state.env.get(n)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&be(e,t)){if(t==="FUNCNAME"){let a=e.state.funcNameStack?.[0]||"";return String([...a].length)}if(t==="BASH_LINENO"){let a=e.state.callLineStack?.[0];return String(a!==void 0?[...String(a)].length:0)}let n=e.state.env.get(`${t}_0`)||"";return String([...n].length)}return String([...r].length)}async function xn(e,t,r,s){e.coverage?.hit("bash:expansion:substring");let n=await R(e,s.offset.expression),a=s.length?await R(e,s.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let m=1;m<=c;m++)u.push(e.state.env.get(String(m))||"");let f=e.state.env.get("0")||"bash",h,d;if(n<=0)if(h=[f,...u],n<0){if(d=h.length+n,d<0)return""}else d=0;else h=u,d=n-1;if(d<0||d>=h.length)return"";if(a!==void 0){let m=a<0?h.length+a:d+a;return h.slice(d,Math.max(d,m)).join(" ")}return h.slice(d).join(" ")}let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i){let c=i[1];if(e.state.associativeArrays?.has(c))throw new K(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution +`);let u=P(e,c),f=0;if(n<0){if(u.length>0){let h=u[u.length-1][0],m=(typeof h=="number"?h:0)+1+n;if(m<0||(f=u.findIndex(([g])=>typeof g=="number"&&g>=m),f<0))return""}}else if(f=u.findIndex(([h])=>typeof h=="number"&&h>=n),f<0)return"";if(a!==void 0){if(a<0)throw new C(`${i[1]}[@]: substring expression < 0`);return u.slice(f,f+a).map(([,h])=>h).join(" ")}return u.slice(f).map(([,h])=>h).join(" ")}let l=[...r],o=n;if(o<0&&(o=Math.max(0,l.length+o)),a!==void 0){if(a<0){let c=l.length+a;return l.slice(o,Math.max(o,c)).join("")}return l.slice(o,o+a).join("")}return l.slice(o).join("")}async function _n(e,t,r,s,n){if(e.coverage?.hit("bash:expansion:case_modification"),r.pattern){let a=e.state.shoptOptions.extglob,i="";for(let f of r.pattern.parts)if(f.type==="Glob")i+=k(f.pattern,!0,a);else if(f.type==="Literal")i+=k(f.value,!0,a);else if(f.type==="SingleQuoted"||f.type==="Escaped")i+=I(f.value);else if(f.type==="DoubleQuoted"){let h=await s(e,f.parts);i+=I(h)}else if(f.type==="ParameterExpansion"){let h=await n(e,f);i+=k(h,!0,a)}let l=O(`^(?:${i})$`),o=r.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!r.all&&u?c+=f:l.test(f)?(c+=o(f),u=!0):c+=f;return c}return r.direction==="upper"?r.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):r.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function $n(e,t,r,s,n){e.coverage?.hit("bash:expansion:transform");let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a&&n.operator==="Q")return P(e,a[1]).map(([,c])=>le(c)).join(" ");if(a&&n.operator==="a")return ue(e,a[1]);let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(i&&n.operator==="a")return ue(e,i[1]);switch(n.operator){case"Q":return s?"":le(r);case"P":return we(e,r);case"a":return ue(e,t);case"A":return s?"":`${t}=${le(r)}`;case"E":return r.replace(/\\([\\abefnrtv'"?])/g,(l,o)=>{switch(o){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return` +`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return o}});case"K":case"k":return s?"":le(r);case"u":return r.charAt(0).toUpperCase()+r.slice(1);case"U":return r.toUpperCase();case"L":return r.toLowerCase();default:return r}}async function Cn(e,t,r,s,n,a,i=!1){if(e.coverage?.hit("bash:expansion:indirection"),W(e,t))return Se(e,t)||"";let l=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(s){if(n.innerOp?.type==="UseAlternative")return"";throw new re(`\${!${t}}`)}let o=r;if(l&&(o===""||o.includes(" ")))throw new re(`\${!${t}}`);let c=o.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new re(`\${!${t}}`);if(n.innerOp){let u={type:"ParameterExpansion",parameter:o,operation:n.innerOp};return a(e,u,i)}return await v(e,o)}function On(e,t){e.coverage?.hit("bash:expansion:array_keys");let s=P(e,t.array).map(([n])=>String(n));return t.star?s.join(N(e.state.env)):s.join(" ")}function Ln(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let r=me(e,t.prefix);return t.star?r.join(N(e.state.env)):r.join(" ")}function Wn(e,t,r,s){let n=Number.parseInt(e.state.env.get("#")||"0",10),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:n===0,effectiveValue:r};if(t==="@")return{isEmpty:n===0||n===1&&e.state.env.get("1")==="",effectiveValue:r};if(a){let[,i,l]=a,o=P(e,i);if(o.length===0)return{isEmpty:!0,effectiveValue:""};if(l==="*"){let c=N(e.state.env),u=o.map(([,f])=>f).join(c);return{isEmpty:s?u==="":!1,effectiveValue:u}}return{isEmpty:o.length===1&&o.every(([,c])=>c===""),effectiveValue:o.map(([,c])=>c).join(" ")}}return{isEmpty:r==="",effectiveValue:r}}function Tn(e){let t=0;for(;t0;){let i=e[s];if(i==="\\"&&!n&&s+1E);if(u.length===0){let E=e.state.env.get(l);E!==void 0&&f.push(E)}if(f.length===0)return{values:[],quoted:!0};let h="";c.pattern&&(h=await ws(e,c.pattern,r,s));let d=c.replacement?await r(e,c.replacement.parts):"",m=h;c.anchor==="start"?m=`^${h}`:c.anchor==="end"&&(m=`${h}$`);let g=[];try{let E=O(m,c.all?"g":"");for(let A of f)g.push(E.replace(A,d))}catch{g.push(...f)}if(o){let E=N(e.state.env);return{values:[g.join(E)],quoted:!0}}return{values:g,quoted:!0}}async function Fn(e,t,r,s){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="PatternRemoval")return null;let a=n.parts[0],i=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let l=i[1],o=i[2]==="*",c=a.operation,u=P(e,l),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(l);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let h="",d=e.state.shoptOptions.extglob;if(c.pattern)for(let g of c.pattern.parts)if(g.type==="Glob")h+=k(g.pattern,c.greedy,d);else if(g.type==="Literal")h+=k(g.value,c.greedy,d);else if(g.type==="SingleQuoted"||g.type==="Escaped")h+=I(g.value);else if(g.type==="DoubleQuoted"){let E=await r(e,g.parts);h+=I(E)}else if(g.type==="ParameterExpansion"){let E=await s(e,g);h+=k(E,c.greedy,d)}else{let E=await s(e,g);h+=I(E)}let m=[];for(let g of f)m.push(se(g,h,c.side,c.greedy));if(o){let g=N(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function zn(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="DefaultValue"&&r.parts[0].operation?.type!=="UseAlternative"&&r.parts[0].operation?.type!=="AssignDefault")return null;let s=r.parts[0],n=s.operation,a=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),i,l=!1;if(a){let o=a[1];l=a[2]==="*";let c=P(e,o),u=c.length>0||e.state.env.has(o),f=c.length===0||c.length===1&&c.every(([,d])=>d===""),h=n.checkEmpty??!1;if(n.type==="UseAlternative"?i=u&&!(h&&f):i=!u||h&&f,!i){if(c.length>0){let m=c.map(([,g])=>g);if(l){let g=N(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}let d=e.state.env.get(o);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}}else{let o=s.parameter,c=await te(e,o),u=await v(e,o),f=u==="",h=n.checkEmpty??!1;if(n.type==="UseAlternative"?i=c&&!(h&&f):i=!c||h&&f,!i)return{values:[u],quoted:!0}}if(i&&n.word){let o=n.word.parts,c=null,u=!1;for(let f of o)if(f.type==="ParameterExpansion"&&!f.operation){let h=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(h){c=h[1],u=h[2]==="*";break}}if(c){let f=P(e,c);if(f.length>0){let d=f.map(([,m])=>m);if(u||l){let m=N(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}let h=e.state.env.get(c);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}}return null}async function Gn(e,t,r,s,n){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let a=t[0],i=-1,l="",o=!1,c=null;for(let g=0;gg);if(h.length===0){let g=e.state.env.get(l);if(g!==void 0)d=[g];else{if(o)return{values:[u+f],quoted:!0};let E=u+f;return{values:E?[E]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let g=c,E="",A=e.state.shoptOptions.extglob;if(g.pattern)for(let S of g.pattern.parts)if(S.type==="Glob")E+=k(S.pattern,g.greedy,A);else if(S.type==="Literal")E+=k(S.value,g.greedy,A);else if(S.type==="SingleQuoted"||S.type==="Escaped")E+=I(S.value);else if(S.type==="DoubleQuoted"){let y=await n(e,S.parts);E+=I(y)}else if(S.type==="ParameterExpansion"){let y=await s(e,S);E+=k(y,g.greedy,A)}else{let y=await s(e,S);E+=I(y)}d=d.map(S=>se(S,E,g.side,g.greedy))}else if(c?.type==="PatternReplacement"){let g=c,E="";if(g.pattern)for(let y of g.pattern.parts)if(y.type==="Glob")E+=k(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")E+=k(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")E+=I(y.value);else if(y.type==="DoubleQuoted"){let b=await n(e,y.parts);E+=I(b)}else if(y.type==="ParameterExpansion"){let b=await s(e,y);E+=k(b,!0,e.state.shoptOptions.extglob)}else{let b=await s(e,y);E+=I(b)}let A=g.replacement?await n(e,g.replacement.parts):"",S=E;g.anchor==="start"?S=`^${E}`:g.anchor==="end"&&(S=`${E}$`);try{let y=O(S,g.all?"g":"");d=d.map(b=>y.replace(b,A))}catch{}}if(o){let g=N(e.state.env);return{values:[u+d.join(g)+f],quoted:!0}}return d.length===1?{values:[u+d[0]+f],quoted:!0}:{values:[u+d[0],...d.slice(1,-1),d[d.length-1]+f],quoted:!0}}async function Qn(e,t,r,s){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0],a=-1,i="",l=!1;for(let d=0;dd);if(u.length===0){let d=e.state.env.get(i);if(d!==void 0)return{values:[o+d+c],quoted:!0};if(l)return{values:[o+c],quoted:!0};let m=o+c;return{values:m?[m]:[],quoted:!0}}if(l){let d=N(e.state.env);return{values:[o+f.join(d)+c],quoted:!0}}return f.length===1?{values:[o+f[0]+c],quoted:!0}:{values:[o+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}async function Zn(e,t,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="Substring")return null;let n=s.parts[0],a=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let i=a[1],l=a[2]==="*",o=n.operation;if(e.state.associativeArrays?.has(i))throw new K(1,"",`bash: \${${i}[@]: 0: 3}: bad substitution +`);let c=o.offset?await r(e,o.offset.expression):0,u=o.length?await r(e,o.length.expression):void 0,f=P(e,i),h=0;if(c<0){if(f.length>0){let m=f[f.length-1][0],E=(typeof m=="number"?m:0)+1+c;if(E<0)return{values:[],quoted:!0};h=f.findIndex(([A])=>typeof A=="number"&&A>=E),h<0&&(h=f.length)}}else h=f.findIndex(([m])=>typeof m=="number"&&m>=c),h<0&&(h=f.length);let d;if(u!==void 0){if(u<0)throw new C(`${i}[@]: substring expression < 0`);d=f.slice(h,h+u).map(([,m])=>m)}else d=f.slice(h).map(([,m])=>m);if(d.length===0)return{values:[],quoted:!0};if(l){let m=N(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}function Un(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Transform")return null;let s=r.parts[0],n=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let a=n[1],i=n[2]==="*",l=s.operation,o=P(e,a);if(o.length===0){let f=e.state.env.get(a);if(f!==void 0){let h;switch(l.operator){case"a":h="";break;case"P":h=we(e,f);break;case"Q":h=le(f);break;default:h=f}return{values:[h],quoted:!0}}return i?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=ue(e,a),u;switch(l.operator){case"a":u=o.map(()=>c);break;case"P":u=o.map(([,f])=>we(e,f));break;case"Q":u=o.map(([,f])=>le(f));break;case"u":u=o.map(([,f])=>f.charAt(0).toUpperCase()+f.slice(1));break;case"U":u=o.map(([,f])=>f.toUpperCase());break;case"L":u=o.map(([,f])=>f.toLowerCase());break;default:u=o.map(([,f])=>f)}if(i){let f=N(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}function Hn(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion")return null;let s=r.parts[0];if(s.operation)return null;let n=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!n)return null;let a=n[1];if(W(e,a)){let o=Se(e,a);if(o?.endsWith("[@]")||o?.endsWith("[*]"))return{values:[],quoted:!0}}let i=P(e,a);if(i.length>0)return{values:i.map(([,o])=>o),quoted:!0};let l=e.state.env.get(a);return l!==void 0?{values:[l],quoted:!0}:{values:[],quoted:!0}}function jn(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation)return null;let n=r.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)||!W(e,n))return null;let a=Se(e,n);if(!a)return null;let i=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let l=i[1],o=P(e,l);if(o.length>0)return{values:o.map(([,u])=>u),quoted:!0};let c=e.state.env.get(l);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}async function Kn(e,t,r,s,n){if(!r||t.length!==1||t[0].type!=="DoubleQuoted")return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let i=a.parts[0],l=i.operation,o=await v(e,i.parameter),c=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!l.innerOp&&(o==="@"||o==="*")){let m=Number.parseInt(e.state.env.get("#")||"0",10),g=[];for(let E=1;E<=m;E++)g.push(e.state.env.get(String(E))||"");return o==="*"?{values:[g.join(N(e.state.env))],quoted:!0}:{values:g,quoted:!0}}return null}let u=c[1],f=c[2]==="*",h=P(e,u);if(l.innerOp){if(l.innerOp.type==="Substring")return Ns(e,h,u,f,l.innerOp);if(l.innerOp.type==="DefaultValue"||l.innerOp.type==="UseAlternative"||l.innerOp.type==="AssignDefault"||l.innerOp.type==="ErrorIfUnset")return ks(e,h,u,f,l.innerOp,n);if(l.innerOp.type==="Transform"&&l.innerOp.operator==="a"){let g=ue(e,u),E=h.map(()=>g);return f?{values:[E.join(N(e.state.env))],quoted:!0}:{values:E,quoted:!0}}let m=[];for(let[,g]of h){let E={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:l.innerOp},A=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",g);try{let S=await s(e,E,!0);m.push(S)}finally{A!==void 0?e.state.env.set("_indirect_elem_",A):e.state.env.delete("_indirect_elem_")}}return f?{values:[m.join(N(e.state.env))],quoted:!0}:{values:m,quoted:!0}}if(h.length>0){let m=h.map(([,g])=>g);return f?{values:[m.join(N(e.state.env))],quoted:!0}:{values:m,quoted:!0}}let d=e.state.env.get(u);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}async function Ns(e,t,r,s,n){let a=n.offset?await R(e,n.offset.expression):0,i=n.length?await R(e,n.length.expression):void 0,l=0;if(a<0){if(t.length>0){let u=t[t.length-1][0],h=(typeof u=="number"?u:0)+1+a;if(h<0)return{values:[],quoted:!0};if(l=t.findIndex(([d])=>typeof d=="number"&&d>=h),l<0)return{values:[],quoted:!0}}}else if(l=t.findIndex(([u])=>typeof u=="number"&&u>=a),l<0)return{values:[],quoted:!0};let o;if(i!==void 0){if(i<0)throw new C(`${r}[@]: substring expression < 0`);o=t.slice(l,l+i)}else o=t.slice(l);let c=o.map(([,u])=>u);return s?{values:[c.join(N(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function ks(e,t,r,s,n,a){let i=n.checkEmpty??!1,l=t.map(([,u])=>u),o=t.length===0,c=t.length===0;if(n.type==="UseAlternative")return!c&&!(i&&o)&&n.word?{values:[await a(e,n.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(n.type==="DefaultValue")return(c||i&&o)&&n.word?{values:[await a(e,n.word.parts,!0)],quoted:!0}:s?{values:[l.join(N(e.state.env))],quoted:!0}:{values:l,quoted:!0};if(n.type==="AssignDefault"){if((c||i&&o)&&n.word){let f=await a(e,n.word.parts,!0);return e.state.env.set(`${r}_0`,f),e.state.env.set(`${r}__length`,"1"),{values:[f],quoted:!0}}return s?{values:[l.join(N(e.state.env))],quoted:!0}:{values:l,quoted:!0}}return s?{values:[l.join(N(e.state.env))],quoted:!0}:{values:l,quoted:!0}}async function Xn(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let r=t[0],s=r.operation,n=s?.word;if(!n||n.parts.length!==1||n.parts[0].type!=="DoubleQuoted")return null;let a=n.parts[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let i=a.parts[0],o=(await v(e,i.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let c=await te(e,r.parameter),u=await v(e,r.parameter)==="",f=s.checkEmpty??!1,h;if(s.type==="UseAlternative"?h=c&&!(f&&u):h=!c||f&&u,h){let d=o[1],m=o[2]==="*",g=P(e,d);if(g.length>0){let A=g.map(([,S])=>S);return m?{values:[A.join(N(e.state.env))],quoted:!0}:{values:A,quoted:!0}}let E=e.state.env.get(d);return E!==void 0?{values:[E],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function Jn(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let r=t[0],n=r.operation.innerOp;if(!n||n.type!=="UseAlternative"&&n.type!=="DefaultValue")return null;let a=n.word;if(!a||a.parts.length!==1||a.parts[0].type!=="DoubleQuoted")return null;let i=a.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let l=i.parts[0],c=(await v(e,l.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await v(e,r.parameter),f=await te(e,r.parameter),h=u==="",d=n.checkEmpty??!1,m;if(n.type==="UseAlternative"?m=f&&!(d&&h):m=!f||d&&h,m){let g=c[1],E=c[2]==="*",A=P(e,g);if(A.length>0){let y=A.map(([,b])=>b);return E?{values:[y.join(N(e.state.env))],quoted:!0}:{values:y,quoted:!0}}let S=e.state.env.get(g);return S!==void 0?{values:[S],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}function Yn(e){let t=Number.parseInt(e.state.env.get("#")||"0",10),r=[];for(let s=1;s<=t;s++)r.push(e.state.env.get(String(s))||"");return r}async function er(e,t,r,s){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0],a=-1,i=!1;for(let S=0;S=h.length)m=[];else if(u!==void 0){let y=u<0?h.length+u:S+u;m=h.slice(S,Math.max(S,y))}else m=h.slice(S)}let g="";for(let S=0;S0)s.push(...a);else{if(r.hasFailglob())throw new Pe(n);r.hasNullglob()||s.push(n)}}else s.push(n);return s}async function sr(e,t,r,s){let n=-1,a="",i=!1;for(let S=0;SS);if(c.length===0){let S=e.state.env.get(a);S!==void 0&&(u=[S])}if(u.length===0)return{values:[],quoted:!1};let f="";if(o.pattern)for(let S of o.pattern.parts)if(S.type==="Glob")f+=k(S.pattern,!0,e.state.shoptOptions.extglob);else if(S.type==="Literal")f+=k(S.value,!0,e.state.shoptOptions.extglob);else if(S.type==="SingleQuoted"||S.type==="Escaped")f+=I(S.value);else if(S.type==="DoubleQuoted"){let y=await r(e,S.parts);f+=I(y)}else if(S.type==="ParameterExpansion"){let y=await s(e,S);f+=k(y,!0,e.state.shoptOptions.extglob)}else{let y=await s(e,S);f+=I(y)}let h=o.replacement?await r(e,o.replacement.parts):"",d=f;o.anchor==="start"?d=`^${f}`:o.anchor==="end"&&(d=`${f}$`);let m=[];try{let S=O(d,o.all?"g":"");for(let y of u)m.push(S.replace(y,h))}catch{m.push(...u)}let g=T(e.state.env),E=q(e.state.env);if(i){let S=N(e.state.env),y=m.join(S);return E?{values:y?[y]:[],quoted:!1}:{values:x(y,g),quoted:!1}}if(E)return{values:m,quoted:!1};let A=[];for(let S of m)S===""?A.push(""):A.push(...x(S,g));return{values:A,quoted:!1}}async function ir(e,t,r,s){let n=-1,a="",i=!1;for(let A=0;AA);if(c.length===0){let A=e.state.env.get(a);A!==void 0&&(u=[A])}if(u.length===0)return{values:[],quoted:!1};let f="",h=e.state.shoptOptions.extglob;if(o.pattern)for(let A of o.pattern.parts)if(A.type==="Glob")f+=k(A.pattern,o.greedy,h);else if(A.type==="Literal")f+=k(A.value,o.greedy,h);else if(A.type==="SingleQuoted"||A.type==="Escaped")f+=I(A.value);else if(A.type==="DoubleQuoted"){let S=await r(e,A.parts);f+=I(S)}else if(A.type==="ParameterExpansion"){let S=await s(e,A);f+=k(S,o.greedy,h)}else{let S=await s(e,A);f+=I(S)}let d=[];for(let A of u)d.push(se(A,f,o.side,o.greedy));let m=T(e.state.env),g=q(e.state.env);if(i){let A=N(e.state.env),S=d.join(A);return g?{values:S?[S]:[],quoted:!1}:{values:x(S,m),quoted:!1}}if(g)return{values:d,quoted:!1};let E=[];for(let A of d)A===""?E.push(""):E.push(...x(A,m));return{values:E,quoted:!1}}async function ar(e,t,r,s){let n=-1,a=!1;for(let E=0;E=f.length)d=[];else if(c!==void 0){let b=c<0?f.length+c:y+c;d=f.slice(y,Math.max(y,b))}else d=f.slice(y)}let m="";for(let y=0;yc!=="");else{let c=N(e.state.env),u=n.join(c);o=x(u,a)}else if(i)o=n.filter(c=>c!=="");else if(l){o=[];for(let c of n){if(c==="")continue;let u=x(c,a);o.push(...u)}}else{o=[];for(let c of n)if(c==="")o.push("");else{let u=x(c,a);o.push(...u)}for(;o.length>0&&o[o.length-1]==="";)o.pop()}return{values:await Te(e,o),quoted:!1}}async function ur(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let r=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!r)return null;let s=r[1],n=r[2]==="*",a=P(e,s),i;if(a.length===0){let f=e.state.env.get(s);if(f!==void 0)i=[f];else return{values:[],quoted:!1}}else i=a.map(([,f])=>f);let l=T(e.state.env),o=q(e.state.env),c=Ce(e.state.env),u;if(n)if(o)u=i.filter(f=>f!=="");else{let f=N(e.state.env),h=i.join(f);u=x(h,l)}else if(o)u=i.filter(f=>f!=="");else if(c){u=[];for(let f of i){if(f==="")continue;let h=x(f,l);u.push(...h)}}else{u=[];for(let f of i)if(f==="")u.push("");else{let h=x(f,l);u.push(...h)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await Te(e,u),quoted:!1}}function cr(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let r=t[0].operation,s=me(e,r.prefix);if(s.length===0)return{values:[],quoted:!1};let n=T(e.state.env),a=q(e.state.env),i;if(r.star)if(a)i=s;else{let l=N(e.state.env),o=s.join(l);i=x(o,n)}else if(a)i=s;else{i=[];for(let l of s){let o=x(l,n);i.push(...o)}}return{values:i,quoted:!1}}function fr(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let r=t[0].operation,n=P(e,r.array).map(([o])=>String(o));if(n.length===0)return{values:[],quoted:!1};let a=T(e.state.env),i=q(e.state.env),l;if(r.star)if(i)l=n;else{let o=N(e.state.env),c=n.join(o);l=x(c,a)}else if(i)l=n;else{l=[];for(let o of n){let c=x(o,a);l.push(...c)}}return{values:l,quoted:!1}}async function hr(e,t,r){let s=-1;for(let h=0;hd!=="");else if(u){f=[];for(let d of h){if(d==="")continue;let m=x(d,o);f.push(...m)}}else{f=[];for(let d of h)if(d==="")f.push("");else{let m=x(d,o);f.push(...m)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await Te(e,f),quoted:!1}}async function mr(e,t,r){e.coverage?.hit("bash:expansion:word_glob");let s=t.parts,{hasQuoted:n,hasCommandSub:a,hasArrayVar:i,hasArrayAtExpansion:l,hasParamExpansion:o,hasVarNamePrefixExpansion:c,hasIndirection:u}=Ae(s),h=r.hasBraceExpansion(s)?await r.expandWordWithBracesAsync(e,t):null;if(h&&h.length>1)return Rs(e,h,n);let d=await Is(e,s,l,c,u,r);if(d!==null)return d;let m=await Ds(e,s,r);if(m!==null)return m;let g=await xs(e,s,r);if(g!==null)return g;let E=await $s(e,s,r.expandPart);if(E!==null)return dr(e,E);if((a||i||o)&&!q(e.state.env)){let S=T(e.state.env),y=r.buildIfsCharClassPattern(S),b=await r.smartWordSplit(e,s,S,y,r.expandPart);return dr(e,b)}let A=await r.expandWordAsync(e,t);return Cs(e,t,s,A,n,r.expandWordForGlobbing)}async function Rs(e,t,r){let s=[];for(let n of t)if(!(!r&&n===""))if(!r&&!e.state.options.noglob&&ne(n,e.state.shoptOptions.extglob)){let a=await Me(e,n);s.push(...a)}else s.push(n);return{values:s,quoted:!1}}async function Is(e,t,r,s,n,a){if(r){let i=Hn(e,t);if(i!==null)return i}{let i=jn(e,t);if(i!==null)return i}{let i=await zn(e,t);if(i!==null)return i}{let i=await Gn(e,t,r,a.expandPart,a.expandWordPartsAsync);if(i!==null)return i}{let i=await Qn(e,t,r,a.expandPart);if(i!==null)return i}{let i=await Zn(e,t,a.evaluateArithmetic);if(i!==null)return i}{let i=Un(e,t);if(i!==null)return i}{let i=await Bn(e,t,a.expandWordPartsAsync,a.expandPart);if(i!==null)return i}{let i=await Fn(e,t,a.expandWordPartsAsync,a.expandPart);if(i!==null)return i}if(s&&t.length===1&&t[0].type==="DoubleQuoted"){let i=vs(e,t);if(i!==null)return i}{let i=await Kn(e,t,n,a.expandParameterAsync,a.expandWordPartsAsync);if(i!==null)return i}{let i=await Xn(e,t);if(i!==null)return i}{let i=await Jn(e,t);if(i!==null)return i}return null}function vs(e,t){let r=t[0];if(r.type!=="DoubleQuoted")return null;if(r.parts.length===1&&r.parts[0].type==="ParameterExpansion"&&r.parts[0].operation?.type==="VarNamePrefix"){let s=r.parts[0].operation,n=me(e,s.prefix);return s.star?{values:[n.join(N(e.state.env))],quoted:!0}:{values:n,quoted:!0}}if(r.parts.length===1&&r.parts[0].type==="ParameterExpansion"&&r.parts[0].operation?.type==="ArrayKeys"){let s=r.parts[0].operation,a=P(e,s.array).map(([i])=>String(i));return s.star?{values:[a.join(N(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return null}async function Ds(e,t,r){{let s=await er(e,t,r.evaluateArithmetic,r.expandPart);if(s!==null)return s}{let s=await tr(e,t,r.expandPart,r.expandWordPartsAsync);if(s!==null)return s}{let s=await nr(e,t,r.expandPart,r.expandWordPartsAsync);if(s!==null)return s}{let s=await rr(e,t,r.expandPart);if(s!==null)return s}return null}async function xs(e,t,r){{let s=await sr(e,t,r.expandWordPartsAsync,r.expandPart);if(s!==null)return s}{let s=await ir(e,t,r.expandWordPartsAsync,r.expandPart);if(s!==null)return s}{let s=await ar(e,t,r.expandWordPartsAsync,r.expandPart);if(s!==null)return s}{let s=await or(e,t,r.evaluateArithmetic,r.expandPart);if(s!==null)return s}{let s=await lr(e,t);if(s!==null)return s}{let s=await ur(e,t);if(s!==null)return s}{let s=cr(e,t);if(s!==null)return s}{let s=fr(e,t);if(s!==null)return s}{let s=await hr(e,t,r.expandPart);if(s!==null)return s}return null}function pr(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;to),i.length===0){let o=e.state.env.get(r.name);o!==void 0&&(i=[o])}}else{let l=Number.parseInt(e.state.env.get("#")||"0",10);i=[];for(let o=1;o<=l;o++)i.push(e.state.env.get(String(o))||"")}if(r.isStar){let l=N(e.state.env),o=i.join(l);return[n+o+a]}if(i.length===0){let l=n+a;return l?[l]:[]}return i.length===1?[n+i[0]+a]:[n+i[0],...i.slice(1,-1),i[i.length-1]+a]}async function $s(e,t,r){if(t.length<2)return null;let s=!1;for(let o of t)if(pr(o)){s=!0;break}if(!s)return null;let n=T(e.state.env),a=q(e.state.env),i=[];for(let o of t){let c=pr(o);if(c&&o.type==="DoubleQuoted"){let u=await _s(e,o,c,r);i.push(u)}else if(o.type==="DoubleQuoted"||o.type==="SingleQuoted"){let u=await r(e,o);i.push([u])}else if(o.type==="Literal")i.push([o.value]);else if(o.type==="ParameterExpansion"){let u=await r(e,o);if(a)i.push(u?[u]:[]);else{let f=x(u,n);i.push(f)}}else{let u=await r(e,o);if(a)i.push(u?[u]:[]);else{let f=x(u,n);i.push(f)}}}let l=[];for(let o of i)if(o.length!==0)if(l.length===0)l.push(...o);else{let c=l.length-1;l[c]=l[c]+o[0];for(let u=1;u0)return s;if(r.hasFailglob())throw new Pe(t);return r.hasNullglob()?[]:[t]}async function Cs(e,t,r,s,n,a){let i=r.some(l=>l.type==="Glob");if(!e.state.options.noglob&&i){let l=await a(e,t);if(ne(l,e.state.shoptOptions.extglob)){let c=await Me(e,l);if(c.length>0&&c[0]!==l)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let o=St(s);if(!q(e.state.env)){let c=T(e.state.env);return{values:x(o,c),quoted:!1}}return{values:[o],quoted:!1}}if(!n&&!e.state.options.noglob&&ne(s,e.state.shoptOptions.extglob)){let l=await a(e,t);if(ne(l,e.state.shoptOptions.extglob)){let o=await Me(e,l);if(o.length>0&&o[0]!==l)return{values:o,quoted:!1}}}if(s===""&&!n)return{values:[],quoted:!1};if(i&&!n){let l=St(s);if(!q(e.state.env)){let o=T(e.state.env);return{values:x(l,o),quoted:!1}}return{values:[l],quoted:!1}}return{values:[s],quoted:n}}async function yr(e,t){let r=t.operation;if(!r||r.type!=="DefaultValue"&&r.type!=="AssignDefault"&&r.type!=="UseAlternative")return null;let s=r.word;if(!s||s.parts.length===0)return null;let n=await te(e,t.parameter),i=await v(e,t.parameter,!1)==="",l=r.checkEmpty??!1,o;return r.type==="UseAlternative"?o=n&&!(l&&i):o=!n||l&&i,o?s.parts:null}function Os(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(r=>r.type==="Literal"):!1}async function Ls(e,t){if(t.type!=="ParameterExpansion")return null;let r=await yr(e,t);if(!r||r.length<=1)return null;let s=r.some(a=>Os(a)),n=r.some(a=>a.type==="Literal"||a.type==="ParameterExpansion"||a.type==="CommandSubstitution"||a.type==="ArithmeticExpansion");return s&&n?r:null}function Ws(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?dt(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&gn(e))}async function Er(e,t,r,s,n){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let h=t[0],d=await yr(e,h);if(d&&d.length>0&&d.length>1&&d.some(g=>g.type==="DoubleQuoted"||g.type==="SingleQuoted")&&d.some(g=>g.type==="Literal"||g.type==="ParameterExpansion"||g.type==="CommandSubstitution"||g.type==="ArithmeticExpansion"))return gr(e,d,r,s,n)}let a=[],i=!1;for(let h of t){let d=Ws(h),m=h.type==="DoubleQuoted"||h.type==="SingleQuoted",g=d?await Ls(e,h):null,E=await n(e,h);a.push({value:E,isSplittable:d,isQuoted:m,mixedDefaultParts:g??void 0}),d&&(i=!0)}if(!i){let h=a.map(d=>d.value).join("");return h?[h]:[]}let l=[],o="",c=!1,u=!1,f=!1;for(let h of a)if(!h.isSplittable)u?h.isQuoted&&h.value===""?(o!==""&&l.push(o),l.push(""),c=!0,o="",u=!1,f=!0):h.value!==""?(o!==""&&l.push(o),o=h.value,u=!1,f=!1):(o+=h.value,f=!1):(o+=h.value,f=h.isQuoted&&h.value==="");else if(h.mixedDefaultParts){let d=await gr(e,h.mixedDefaultParts,r,s,n);if(d.length!==0)if(d.length===1)o+=d[0],c=!0;else{o+=d[0],l.push(o),c=!0;for(let m=1;m0&&t.includes(e[0])}async function gr(e,t,r,s,n){let a=[];for(let u of t){let h=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),d=await n(e,u);a.push({value:d,isSplittable:h})}let i=[],l="",o=!1,c=!1;for(let u of a)if(!u.isSplittable)c&&u.value!==""?(l!==""&&i.push(l),l=u.value,c=!1):l+=u.value;else{Ts(u.value,r)&&l!==""&&(i.push(l),l="",o=!0);let{words:h,hadTrailingDelimiter:d}=Oe(u.value,r);if(h.length===0)d&&(c=!0);else if(h.length===1)l+=h[0],o=!0,c=d;else{l+=h[0],i.push(l),o=!0;for(let m=1;mt)throw new L(`${r}: string length limit exceeded (${t} bytes)`,"string_length")}async function J(e,t,r=!1){let s=[];for(let n of t)s.push(await U(e,n,r));return s.join("")}function Ms(e){return Sr(e)}function Al(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!Ms(t))return!1;return!0}function Vs(e,t,r=!1){let s=Ar(t);if(s!==null)return s;switch(t.type){case"TildeExpansion":return r?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return Nt(e,t.pattern);default:return null}}async function Pt(e,t){return Rt(e,t)}async function Sl(e,t){let r=[];for(let s of t.parts)if(s.type==="Escaped")r.push(`\\${s.value}`);else if(s.type==="SingleQuoted")r.push(s.value);else if(s.type==="DoubleQuoted"){let n=await J(e,s.parts);r.push(n)}else if(s.type==="TildeExpansion"){let n=await U(e,s);r.push(bt(n))}else r.push(await U(e,s));return r.join("")}async function bl(e,t){let r=[];for(let s of t.parts)if(s.type==="Escaped"){let n=s.value;"()|*?[]".includes(n)?r.push(`\\${n}`):r.push(n)}else if(s.type==="SingleQuoted")r.push(X(s.value));else if(s.type==="DoubleQuoted"){let n=await J(e,s.parts);r.push(X(n))}else r.push(await U(e,s));return r.join("")}async function br(e,t){let r=[];for(let s of t.parts)if(s.type==="SingleQuoted")r.push(X(s.value));else if(s.type==="Escaped"){let n=s.value;"*?[]\\()|".includes(n)?r.push(`\\${n}`):r.push(n)}else if(s.type==="DoubleQuoted"){let n=await J(e,s.parts);r.push(X(n))}else s.type==="Glob"?Tn(s.pattern)?r.push(await Vn(e,s.pattern)):r.push(Nt(e,s.pattern)):s.type==="Literal"?r.push(s.value):r.push(await U(e,s));return r.join("")}function qe(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&qe(t.parts))return!0;return!1}var kt=1e5;async function wr(e,t,r={count:0}){if(r.count>kt)return[[]];let s=[[]];for(let n of t)if(n.type==="BraceExpansion"){let a=[],i=!1,l="";for(let u of n.items)if(u.type==="Range"){let f=At(u.start,u.end,u.step,u.startStr,u.endStr);if(f.expanded)for(let h of f.expanded)r.count++,a.push(h);else{i=!0,l=f.literal;break}}else{let f=await wr(e,u.word.parts,r);for(let h of f){r.count++;let d=[];for(let m of h)typeof m=="string"?d.push(m):d.push(await U(e,m));a.push(d.join(""))}}if(i){for(let u of s)r.count++,u.push(l);continue}if(s.length*a.length>e.limits.maxBraceExpansionResults||r.count>kt)return s;let c=[];for(let u of s)for(let f of a){if(r.count++,r.count>kt)return c.length>0?c:s;c.push([...u,f])}s=c}else for(let a of s)r.count++,a.push(n);return s}async function Nr(e,t){let r=t.parts;if(!qe(r))return[await Pt(e,t)];let s=await wr(e,r),n=[];for(let a of s){let i=[];for(let l of a)typeof l=="string"?i.push(l):i.push(await U(e,l));n.push(qn(e,i.join("")))}return n}function qs(){return{expandWordAsync:Rt,expandWordForGlobbing:br,expandWordWithBracesAsync:Nr,expandWordPartsAsync:J,expandPart:U,expandParameterAsync:Ve,hasBraceExpansion:qe,evaluateArithmetic:R,buildIfsCharClassPattern:An,smartWordSplit:Er}}async function wl(e,t){return mr(e,t,qs())}function Bs(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Fs(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function s(n){for(let a of n)if(a.type==="DoubleQuoted"){for(let i of a.parts)if(i.type==="ParameterExpansion"&&i.parameter==="@"&&!i.operation)return!0}return!1}return s(t.parts)}async function Nl(e,t){if(Fs(e,t))return{error:`bash: $@: ambiguous redirect +`};let r=t.parts,{hasQuoted:s}=Ae(r);if(qe(r)&&(await Nr(e,t)).length>1)return{error:`bash: ${r.map(d=>d.type==="Literal"?d.value:d.type==="BraceExpansion"?`{${d.items.map(g=>{if(g.type==="Range"){let E=g.step?`..${g.step}`:"";return`${g.startStr??g.start}..${g.endStr??g.end}${E}`}return g.word.parts.map(E=>E.type==="Literal"?E.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect +`};let n=await Rt(e,t),{hasParamExpansion:a,hasCommandSub:i}=Ae(r);if((a||i)&&!s&&!q(e.state.env)){let f=T(e.state.env);if(x(n,f).length>1)return{error:`bash: $${Bs(r)}: ambiguous redirect +`}}if(s||e.state.options.noglob)return{target:n};let o=await br(e,t);if(!ne(o,e.state.shoptOptions.extglob))return{target:n};let c=new oe(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),u=await c.expand(o);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${n} +`}:{target:n}:u.length===1?{target:u[0]}:{error:`bash: ${n}: ambiguous redirect +`}}async function Rt(e,t){let r=t.parts,s=r.length;if(s===1){let i=await U(e,r[0]);return ce(i,e.limits.maxStringLength,"word expansion"),i}let n=[];for(let i=0;i=i)throw new L(`Command substitution nesting limit exceeded (${i})`,"substitution_depth");let l=e.substitutionDepth;e.substitutionDepth=a+1;let o=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=e.state.cwd,f=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let h=await e.executeScript(t.body),d=h.exitCode;e.state.env=c,e.state.cwd=u,e.state.suppressVerbose=f,e.state.lastExitCode=d,e.state.env.set("?",String(d)),h.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+h.stderr),e.state.bashPid=o,e.substitutionDepth=l;let m=h.stdout.replace(/\n+$/,"");return ce(m,e.limits.maxStringLength,"command substitution"),m}catch(h){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=o,e.substitutionDepth=l,e.state.suppressVerbose=f,h instanceof L)throw h;if(h instanceof K){e.state.lastExitCode=h.exitCode,e.state.env.set("?",String(h.exitCode)),h.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+h.stderr);let d=h.stdout.replace(/\n+$/,"");return ce(d,e.limits.maxStringLength,"command substitution"),d}throw h}}case"ArithmeticExpansion":{let n=t.expression.originalText;if(n&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(n)){let i=await bn(e,n),l=new V,o=M(l,i);return String(await R(e,o.expression,!0))}return String(await R(e,t.expression.expression,!0))}case"BraceExpansion":{let n=[];for(let a of t.items)if(a.type==="Range"){let i=At(a.start,a.end,a.step,a.startStr,a.endStr);if(i.expanded)n.push(...i.expanded);else return i.literal}else n.push(await Pt(e,a.word));return n.join(" ")}default:return""}}async function Ve(e,t,r=!1){let{parameter:s}=t,{operation:n}=t,a=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,h,d]=a;if(e.state.associativeArrays?.has(h)||d.includes("$(")||d.includes("`")||d.includes("${")){let g=await Et(e,d);s=`${h}[${g}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)&&W(e,s)){let h=he(e,s);if(h&&h!==s){let d=h.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(d){let[,m,g]=d;if(e.state.associativeArrays?.has(m)||g.includes("$(")||g.includes("`")||g.includes("${")){let A=await Et(e,g);s=`${m}[${A}]`}}}}let i=n&&(n.type==="DefaultValue"||n.type==="AssignDefault"||n.type==="UseAlternative"||n.type==="ErrorIfUnset"),l=await v(e,s,!i);if(!n)return l;let o=!await te(e,s),{isEmpty:c,effectiveValue:u}=Wn(e,s,l,r),f={value:l,isUnset:o,isEmpty:c,effectiveValue:u,inDoubleQuotes:r};switch(n.type){case"DefaultValue":return Nn(e,n,f,J);case"AssignDefault":return kn(e,s,n,f,J);case"ErrorIfUnset":return Pn(e,s,n,f,J);case"UseAlternative":return Rn(e,n,f,J);case"PatternRemoval":{let h=await In(e,l,n,J,U);return ce(h,e.limits.maxStringLength,"pattern removal"),h}case"PatternReplacement":{let h=await vn(e,l,n,J,U);return ce(h,e.limits.maxStringLength,"pattern replacement"),h}case"Length":return Dn(e,s,l);case"LengthSliceError":throw new re(s);case"BadSubstitution":throw new re(n.text);case"Substring":return xn(e,s,l,n);case"CaseModification":{let h=await _n(e,l,n,J,Ve);return ce(h,e.limits.maxStringLength,"case modification"),h}case"Transform":return $n(e,s,l,o,n);case"Indirection":return Cn(e,s,l,o,n,Ve,r);case"ArrayKeys":return On(e,n);case"VarNamePrefix":return Ln(e,n);default:return l}}export{xi as a,_i as b,pe as c,G as d,M as e,V as f,di as g,mt as h,Ci as i,gt as j,Oi as k,En as l,T as m,Wi as n,Ti as o,W as p,Vi as q,qi as r,Bi as s,Fi as t,us as u,he as v,Se as w,zi as x,P as y,be as z,v as A,X as B,bt as C,pa as D,wt as E,da as F,ma as G,ga as H,Al as I,Pt as J,Sl as K,bl as L,wl as M,Fs as N,Nl as O,R as P}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-DJAX3ZRG.js b/packages/just-bash/dist/bin/chunks/chunk-DJAX3ZRG.js new file mode 100644 index 00000000..7d57a3ec --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-DJAX3ZRG.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as r,b as u}from"./chunk-MUFNRCMY.js";var d={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},o="BASH_ALIAS_",m={name:"alias",async execute(e,a){if(u(e))return r(d);if(e.length===0){let s="";for(let[i,t]of a.env)if(i.startsWith(o)){let n=i.slice(o.length);s+=`alias ${n}='${t}' +`}return{stdout:s,stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e;for(let s of l){let i=s.indexOf("=");if(i===-1){let t=o+s;return a.env.get(t)?{stdout:`alias ${s}='${a.env.get(t)}' +`,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${s}: not found +`,exitCode:1}}else{let t=s.slice(0,i),n=s.slice(i+1);(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))&&(n=n.slice(1,-1)),a.env.set(o+t,n)}}return{stdout:"",stderr:"",exitCode:0}}},c={name:"unalias",async execute(e,a){if(u(e))return r({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...] +`,exitCode:1};if(e[0]==="-a"){for(let t of a.env.keys())t.startsWith(o)&&a.env.delete(t);return{stdout:"",stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e,s=!1,i="";for(let t of l){let n=o+t;a.env.get(n)?a.env.delete(n):(i+=`unalias: ${t}: not found +`,s=!0)}return{stdout:"",stderr:i,exitCode:s?1:0}}},p={name:"alias",flags:[]},h={name:"unalias",flags:[{flag:"-a",type:"boolean"}]};export{m as a,c as b,p as c,h as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-DOXYBGNA.js b/packages/just-bash/dist/bin/chunks/chunk-DOXYBGNA.js deleted file mode 100644 index 45280111..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-DOXYBGNA.js +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env node -import{a as x}from"./chunk-YTIURC67.js";import{a as O}from"./chunk-4OALHZXB.js";import{a as c,b as p}from"./chunk-OOJCYVYF.js";import{a as h,b as A,c as u}from"./chunk-GTNBSMZR.js";var v={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION. - -DURATION is a number with optional suffix: - s - seconds (default) - m - minutes - h - hours - d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},N={name:"timeout",async execute(s,r){if(A(s))return h(v);let i=0;for(let e=0;e1&&t!=="--")if(t.startsWith("-k"))i=e+1;else if(t.startsWith("-s"))i=e+1;else return u("timeout",t);else{i=e;break}}}let n=s.slice(i);if(n.length===0)return{stdout:"",stderr:`timeout: missing operand -`,exitCode:1};let m=n[0],d=x(m);if(d===null)return{stdout:"",stderr:`timeout: invalid time interval '${m}' -`,exitCode:1};let o=n.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand -`,exitCode:1};if(!r.exec)return{stdout:"",stderr:`timeout: exec not available -`,exitCode:1};let f=new AbortController,a;try{let e=new Promise(l=>{a=c(()=>{f.abort(),l({timedOut:!0})},d)}),t=r.exec(O([o[0]]),{cwd:r.cwd,signal:f.signal,stdin:r.stdin,args:o.slice(1)}).then(l=>({timedOut:!1,result:l})),g=await Promise.race([e,t]);return g.timedOut?{stdout:"",stderr:"",exitCode:124}:g.result}finally{a!==void 0&&p(a)}}},D={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{N as a,D as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-DYIBFLS3.js b/packages/just-bash/dist/bin/chunks/chunk-DYIBFLS3.js new file mode 100644 index 00000000..ad463ee1 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-DYIBFLS3.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as r}from"./chunk-3MRB66F4.js";var c=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]);function d(n){let e=[],s=new Set(n);e.push(`Available commands: +`);let t=[];for(let[a,l]of c){let o=l.filter(i=>s.has(i));if(o.length>0){e.push(` ${a}:`),e.push(` ${o.join(", ")} +`);for(let i of o)s.delete(i)}}for(let a of s)t.push(a);return t.length>0&&(e.push(" Other:"),e.push(` ${t.sort().join(", ")} +`)),e.push("Use ' --help' for details on a specific command."),`${e.join(` +`)} +`}var h={name:"help",async execute(n,e){if(n.includes("--help")||n.includes("-h"))return{stdout:`help - display available commands + +Usage: help [command] + +Options: + -h, --help Show this help message + +If a command name is provided, shows help for that command. +Otherwise, lists all available commands. +`,stderr:"",exitCode:0};if(n.length>0&&e.exec){let t=n[0];return e.exec(r([t]),{cwd:e.cwd,signal:e.signal,args:["--help"]})}let s=e.getRegisteredCommands?.()??[];return{stdout:d(s),stderr:"",exitCode:0}}},p={name:"help",flags:[]};export{h as a,p as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-EJQKHROT.js b/packages/just-bash/dist/bin/chunks/chunk-EJQKHROT.js deleted file mode 100644 index 61b8292e..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-EJQKHROT.js +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node -import{a as p}from"./chunk-JBABAK44.js";import{a as g}from"./chunk-4VDEBYW7.js";var x=`Usage: rmdir [-pv] DIRECTORY... -Remove empty directories. - -Options: - -p, --parents Remove DIRECTORY and its ancestors - -v, --verbose Output a diagnostic for every directory processed`,y={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},D={name:"rmdir",async execute(t,r){let e=p("rmdir",t,y);if(!e.ok)return e.error;if(e.result.flags.help)return{stdout:`${x} -`,stderr:"",exitCode:0};let a=e.result.flags.parents,o=e.result.flags.verbose,s=e.result.positional;if(s.length===0)return{stdout:"",stderr:`rmdir: missing operand -`,exitCode:1};let c="",n="",i=0;for(let u of s){let d=await b(r,u,a,o);c+=d.stdout,n+=d.stderr,d.exitCode!==0&&(i=d.exitCode)}return{stdout:c,stderr:n,exitCode:i}}};async function b(t,r,e,a){let o="",s="",n=t.fs.resolvePath(t.cwd,r),i=await v(t,n,r,a);if(o+=i.stdout,s+=i.stderr,i.exitCode!==0)return{stdout:o,stderr:s,exitCode:i.exitCode};if(e){let u=n,d=r;for(;;){let l=C(u),f=C(d);if(l===u||l==="/"||l==="."||f==="."||f==="")break;let m=await v(t,l,f,a);if(o+=m.stdout,m.exitCode!==0)break;u=l,d=f}}return{stdout:o,stderr:s,exitCode:0}}async function v(t,r,e,a){try{if(!await t.fs.exists(r))return{stdout:"",stderr:`rmdir: failed to remove '${e}': No such file or directory -`,exitCode:1};if(!(await t.fs.stat(r)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${e}': Not a directory -`,exitCode:1};if((await t.fs.readdir(r)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${e}': Directory not empty -`,exitCode:1};await t.fs.rm(r,{recursive:!1,force:!1});let n="";return a&&(n=`rmdir: removing directory, '${e}' -`),{stdout:n,stderr:"",exitCode:0}}catch(o){let s=g(o);return{stdout:"",stderr:`rmdir: failed to remove '${e}': ${s} -`,exitCode:1}}}function C(t){let r=t.replace(/\/+$/,""),e=r.lastIndexOf("/");return e===-1?".":e===0?"/":r.substring(0,e)}var $={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{D as a,$ as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-EONWONZV.js b/packages/just-bash/dist/bin/chunks/chunk-EONWONZV.js deleted file mode 100644 index ce87324e..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-EONWONZV.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a as r}from"./chunk-JDNI5HBX.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;sn&&e.length>0?u&&o>=0?(l.push(e.slice(0,o+1)),e=e.slice(o+1)+a,t=t-f-1+d,o=-1,f=0):(l.push(e),e=a,t=d,o=-1,f=0):(e+=a,t+=d,(a===" "||a===" ")&&(o=e.length-1,f=t-d))}return e.length>0&&l.push(e),l.join(` -`)}function b(s,r){if(s==="")return"";let n=s.split(` -`),u=s.endsWith(` -`)&&n[n.length-1]==="";return u&&n.pop(),n.map(l=>y(l,r)).join(` -`)+(u?` -`:"")}var k={name:"fold",execute:async(s,r)=>{if(h(s))return p(m);let n={width:80,breakAtSpaces:!1,countBytes:!1},u=[],i=0;for(;i2){let t=parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e.slice(2)}' -`};n.width=t,i++}else if(e==="-s")n.breakAtSpaces=!0,i++;else if(e==="-b")n.countBytes=!0,i++;else if(e==="-bs"||e==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,i++;else if(e.match(/^-[sb]+w\d+$/)){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=e.replace(/^-[sb]+w/,""),o=parseInt(t,10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${t}' -`};n.width=o,i++}else if(e.match(/^-[sb]+w$/)&&i+1=3){let a=Math.floor(M(await n.evalExpr(e[2])));return i.substr(Math.max(0,s),a)}return i.substr(Math.max(0,s))}async function Ve(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=k(await n.evalExpr(e[1])),a=i.indexOf(s);return a===-1?0:a+1}async function Ke(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=v(u.pattern);else{let N=k(await n.evalExpr(u));o=N===" "?v("\\s+"):N}}else t.FS===" "&&(o=v("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[a]=Object.create(null);for(let u=0;u{let n="",i=0;for(;i=4?k(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",u=l?0:parseInt(a,10)||1;if(l)return v(i,"g").replace(o,(A,...C)=>Ne(s,A,C.slice(0,-2)));{let N=0;return v(i,"g").replace(o,(C,...O)=>(N++,N===u?Ne(s,C,O.slice(0,-2)):C))}}catch{return o}}function Ne(e,t,n){let i="",s=0;for(;s="1"&&a<="9"){let o=parseInt(a,10)-1;i+=n[o]||"",s+=2}else a==="n"?(i+=` -`,s+=2):a==="t"?(i+=" ",s+=2):(i+=a,s+=2)}else e[s]==="&"?(i+=t,s++):(i+=e[s],s++);return i}async function Qe(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toLowerCase()}async function Je(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toUpperCase()}async function Ze(e,t,n){if(e.length===0)return"";let i=k(await n.evalExpr(e[0])),s=[];for(let a=1;a0?M(await n.evalExpr(e[0])):0,s=e.length>1?M(await n.evalExpr(e[1])):0;return Math.atan2(i,s)}async function it(e,t,n){return e.length===0?0:Math.log(M(await n.evalExpr(e[0])))}async function st(e,t,n){return e.length===0?1:Math.exp(M(await n.evalExpr(e[0])))}function at(e,t,n){return t.random?t.random():Math.random()}async function ot(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function lt(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function se(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var U=1e4;function j(e,t){let n=0,i="",s=0;for(;sA&&e[a]==="$"?(N=parseInt(e.substring(A,a),10)-1,a++):a=A;let C=()=>{if(aU&&(l=String(U)),e[a]==="."){if(a++,e[a]==="*"){let d=t[n++];u=String(Math.min(d!==void 0?Math.floor(Number(d)):0,U)),a++}else for(;aU&&(u=String(U))}C();let O=e[a],w=t[N!==void 0?N:n];switch(O){case"s":{let d=w!==void 0?String(w):"";if(u&&(d=d.substring(0,parseInt(u,10))),l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"d":case"i":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=d<0,h=Math.abs(d).toString();if(u){let F=parseInt(u,10);h=h.padStart(F,"0")}let c="";R?c="-":o.includes("+")?c="+":o.includes(" ")&&(c=" ");let E=c+h;if(l){let F=parseInt(l,10);o.includes("-")?E=E.padEnd(F):o.includes("0")&&!u?E=c+h.padStart(F-c.length,"0"):E=E.padStart(F)}i+=E,N===void 0&&n++;break}case"f":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toFixed(R);if(l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"e":case"E":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toExponential(R);if(O==="E"&&(h=h.toUpperCase()),l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"g":case"G":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d!==0?Math.floor(Math.log10(Math.abs(d))):0,c;if(d===0?c="0":h<-4||h>=R?(c=d.toExponential(R-1),O==="G"&&(c=c.toUpperCase())):c=d.toPrecision(R),c.includes(".")&&(c=c.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),c.includes("e")&&(c=c.replace(/\.?0+e/,"e")),l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"x":case"X":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(16);if(O==="X"&&(R=R.toUpperCase()),u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"o":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(8);if(u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"c":{typeof w=="number"?i+=String.fromCharCode(w):i+=String(w??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(s,a+1)}s=a+1}else if(e[s]==="\\"&&s+10],["fflush",()=>0],["systime",se("systime")],["mktime",se("mktime")],["strftime",se("strftime")]]);function b(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function g(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function m(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function ae(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function K(e,t){try{return v(e).test(t)}catch{return!1}}function ge(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Q(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function oe(e,t,n){if(t===0)e.line=m(n),e.fields=ge(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.lengthe.NF){for(;e.fields.lengthf(e,t.condition)))?await S(e,"ternary consequent evaluation",()=>f(e,t.consequent)):await S(e,"ternary alternate evaluation",()=>f(e,t.alternate));case"call":return Et(e,t.name,t.args);case"assignment":return yt(e,t);case"pre_increment":return St(e,t.operand);case"pre_decrement":return mt(e,t.operand);case"post_increment":return wt(e,t.operand);case"post_decrement":return Rt(e,t.operand);case"in":return gt(e,t.key,t.array);case"getline":return At(e,t.variable,t.file,t.command);case"tuple":return kt(e,t.elements);default:return""}}async function ut(e,t){L(e,"field reference evaluation");let n=Math.floor(g(await S(e,"field index evaluation",()=>f(e,t.index))));return Q(e,n)}async function ct(e,t){L(e,"array access evaluation");let n=m(await S(e,"array key evaluation",()=>f(e,t.key)));return Z(e,t.array,n)}async function ht(e,t){L(e,"binary expression evaluation");let n=t.operator;if(n==="||")return b(await S(e,"logical-or left evaluation",()=>f(e,t.left)))||b(await S(e,"logical-or right evaluation",()=>f(e,t.right)))?1:0;if(n==="&&")return b(await S(e,"logical-and left evaluation",()=>f(e,t.left)))&&b(await S(e,"logical-and right evaluation",()=>f(e,t.right)))?1:0;if(n==="~"){let l=await S(e,"regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?1:0}catch{return 0}}if(n==="!~"){let l=await S(e,"negated-regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:m(await S(e,"negated-regex right evaluation",()=>f(e,t.right)));try{return v(u).test(m(l))?0:1}catch{return 1}}let i=await S(e,"binary left evaluation",()=>f(e,t.left)),s=await S(e,"binary right evaluation",()=>f(e,t.right));if(n===" "){let l=m(i)+m(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new P(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(pt(n))return ft(i,s,n);let a=g(i),o=g(s);return Ee(a,o,n)}function pt(e){return["<","<=",">",">=","==","!="].includes(e)}function ft(e,t,n){let i=ae(e),s=ae(t);if(i&&s){let l=g(e),u=g(t);switch(n){case"<":return l":return l>u?1:0;case">=":return l>=u?1:0;case"==":return l===u?1:0;case"!=":return l!==u?1:0}}let a=m(e),o=m(t);switch(n){case"<":return a":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function dt(e,t){L(e,"unary expression evaluation");let n=await S(e,"unary operand evaluation",()=>f(e,t.operand));switch(t.operator){case"!":return b(n)?0:1;case"-":return-g(n);case"+":return+g(n);default:return n}}async function Et(e,t,n){L(e,"function call evaluation");let i=Re.get(t);if(i)return i(n,e,{evalExpr:a=>f(e,a)});let s=e.functions.get(t);return s?Nt(e,s,n):""}async function Nt(e,t,n){if(L(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new P(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let l of t.params)i[l]=e.vars[l];let s=[];for(let l=0;lf(e,N));e.vars[u]=A}else e.vars[u]=""}e.hasReturn=!1,e.returnValue=void 0;let a=Ce;a&&await S(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)i[l]!==void 0?e.vars[l]=i[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function yt(e,t){L(e,"assignment evaluation");let n=await S(e,"assignment value evaluation",()=>f(e,t.value)),i=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(i.type==="field"){let N=Math.floor(g(await S(e,"assignment field index",()=>f(e,i.index))));o=Q(e,N)}else if(i.type==="variable")o=J(e,i.name);else{let N=m(await S(e,"assignment array key",()=>f(e,i.key)));o=Z(e,i.array,N)}let l=g(o),u=g(n);switch(s){case"+=":a=l+u;break;case"-=":a=l-u;break;case"*=":a=l*u;break;case"/=":a=u!==0?l/u:0;break;case"%=":a=u!==0?l%u:0;break;case"^=":a=l**u;break;default:a=n}}if(i.type==="field"){let o=Math.floor(g(await S(e,"assignment target field index",()=>f(e,i.index))));oe(e,o,a)}else if(i.type==="variable")W(e,i.name,a);else{let o=m(await S(e,"assignment target array key",()=>f(e,i.key)));le(e,i.array,o,a)}return a}async function Y(e,t,n,i){L(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(g(await S(e,"inc/dec field index",()=>f(e,t.index))));s=g(Q(e,a)),oe(e,a,s+n)}else if(t.type==="variable")s=g(J(e,t.name)),W(e,t.name,s+n);else{let a=m(await S(e,"inc/dec array key",()=>f(e,t.key)));s=g(Z(e,t.array,a)),le(e,t.array,a,s+n)}return i?s+n:s}async function St(e,t){return Y(e,t,1,!0)}async function mt(e,t){return Y(e,t,-1,!0)}async function wt(e,t){return Y(e,t,1,!1)}async function Rt(e,t){return Y(e,t,-1,!1)}async function gt(e,t,n){L(e,"in-expression evaluation");let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(m(await S(e,"tuple key element evaluation",()=>f(e,a))));i=s.join(e.SUBSEP)}else i=m(await S(e,"in-expression key evaluation",()=>f(e,t)));return ve(e,n,i)?1:0}async function At(e,t,n,i){if(L(e,"getline evaluation"),i)return vt(e,t,i);if(n)return It(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?W(e,t,a):$(e,a),e.NR++,e.lineIndex=s,1}async function vt(e,t,n){let i=e.exec;if(!i)return-1;L(e,"getline command source");let s=m(await S(e,"getline command expression",()=>f(e,n))),a=`__cmd_${s}`,o=`__cmdi_${s}`,l,u;if(e.vars[a]===void 0)try{l=(await S(e,"getline command exec",()=>i(s))).stdout.split(` -`),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[a]=JSON.stringify(l),e.vars[o]=-1,u=-1}catch(C){if(C instanceof x)throw C;return-1}else l=JSON.parse(e.vars[a]),u=e.vars[o];let N=u+1;if(N>=l.length)return 0;let A=l[N];return e.vars[o]=N,t?W(e,t,A):$(e,A),1}async function It(e,t,n){let i=e.fs;if(!i||!e.cwd)return-1;L(e,"getline file source");let s=m(await S(e,"getline filename evaluation",()=>f(e,n)));if(s==="/dev/null")return 0;let a=i.resolvePath(e.cwd,s),o=`__fc_${a}`,l=`__fi_${a}`,u,N;if(e.vars[o]===void 0)try{u=(await S(e,"getline file read",()=>i.readFile(a))).split(` -`),u.length>0&&u[u.length-1]===""&&u.pop(),e.vars[o]=JSON.stringify(u),e.vars[l]=-1,N=-1}catch(O){if(O instanceof x)throw O;return-1}else u=JSON.parse(e.vars[o]),N=e.vars[l];let A=N+1;if(A>=u.length)return 0;let C=u[A];return e.vars[l]=A,t?W(e,t,C):$(e,C),1}async function kt(e,t){if(L(e,"tuple evaluation"),t.length===0)return"";for(let n=0;nf(e,t[n]));return S(e,"tuple final element",()=>f(e,t[t.length-1]))}be(V);function ue(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new P(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function T(e,t){D(e.requireDefenseContext,"awk",t)}function y(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function V(e,t){T(e,"block execution");for(let n of t)if(await y(e,"statement execution",()=>B(e,n)),Ct(e))break}function Ct(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function B(e,t){switch(T(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await y(e,"nested block statement",()=>V(e,t.statements));break;case"expr_stmt":await y(e,"expression statement",()=>f(e,t.expression));break;case"print":await y(e,"print statement",()=>bt(e,t.args,t.output));break;case"printf":await y(e,"printf statement",()=>Ot(e,t.format,t.args,t.output));break;case"if":await y(e,"if statement",()=>Lt(e,t));break;case"while":await y(e,"while statement",()=>Mt(e,t));break;case"do_while":await y(e,"do-while statement",()=>Pt(e,t));break;case"for":await y(e,"for statement",()=>Tt(e,t));break;case"for_in":await y(e,"for-in statement",()=>Ft(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(g(await y(e,"exit code expression",()=>f(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await y(e,"return expression",()=>f(e,n)):""}break;case"delete":await y(e,"delete statement",()=>Dt(e,t.target));break}}async function bt(e,t,n){T(e,"print execution");let i=[];for(let a of t){let o=await y(e,"print argument evaluation",()=>f(e,a));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)Oe(e,n.redirect,n.file,s)):(e.output+=s,ue(e))}async function Ot(e,t,n,i){T(e,"printf execution");let s=m(await y(e,"printf format evaluation",()=>f(e,t))),a=[];for(let l of n)a.push(await y(e,"printf argument evaluation",()=>f(e,l)));let o=j(s,a);i?await y(e,"printf redirection write",()=>Oe(e,i.redirect,i.file,o)):(e.output+=o,ue(e))}async function Oe(e,t,n,i){T(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=i,ue(e);return}let a=m(await y(e,"redirection filename evaluation",()=>f(e,n))),o=s.resolvePath(e.cwd,a);t===">"?e.openedFiles.has(o)?await y(e,"redirection append write",()=>s.appendFile(o,i)):(await y(e,"redirection overwrite write",()=>s.writeFile(o,i)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await y(e,"redirection append mode write",()=>s.appendFile(o,i)))}async function Lt(e,t){if(T(e,"if execution"),b(await y(e,"if condition evaluation",()=>f(e,t.condition))))await y(e,"if consequent execution",()=>B(e,t.consequent));else if(t.alternate){let n=t.alternate;await y(e,"if alternate execution",()=>B(e,n))}}async function Mt(e,t){T(e,"while execution");let n=0;for(;b(await y(e,"while condition evaluation",()=>f(e,t.condition)));){if(n++,n>e.maxIterations)throw new P(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Pt(e,t){T(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new P(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"do-while body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(b(await y(e,"do-while condition evaluation",()=>f(e,t.condition))))}async function Tt(e,t){T(e,"for execution");let n=t.init,i=t.condition,s=t.update;n&&await y(e,"for init evaluation",()=>f(e,n));let a=0;for(;!i||b(await y(e,"for condition evaluation",()=>f(e,i)));){if(a++,a>e.maxIterations)throw new P(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await y(e,"for body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await y(e,"for update evaluation",()=>f(e,s))}}async function Ft(e,t){T(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await y(e,"for-in body execution",()=>B(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Dt(e,t){if(T(e,"delete execution"),t.type==="array_access"){let n=m(await y(e,"delete key evaluation",()=>f(e,t.key)));Ie(e,t.array,n)}else t.type==="variable"&&ke(e,t.name)}var q=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){D(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){$(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;nthis.matchesRule(i,n))&&await this.withDefenseContext("rule block execution",()=>V(this.ctx,i.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>V(this.ctx,t.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){this.assertDefenseContext("rule matching");let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return K(i.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("expression pattern evaluation",()=>f(this.ctx,i.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(i.start)),a=await this.withDefenseContext("range end pattern",()=>this.matchPattern(i.end));return this.rangeStates[n]?(a&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,a&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return K(t.pattern,this.ctx.line);case"expr_pattern":return b(await this.withDefenseContext("nested expression pattern",()=>f(this.ctx,t.expression)));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var _t=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function Gt(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var xt=new Set([r.COMMA,r.LBRACE,r.AND,r.OR,r.QUESTION,r.COLON,r.DO,r.ELSE,r.IF,r.WHILE]),ee=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===` -`?(this.advance(),this.lastTokenType!==null&&xt.has(this.lastTokenType)?this.nextToken():{type:r.NEWLINE,value:` -`,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos0?i+=String.fromCharCode(parseInt(a,16)):i+="x";break}default:if(/[0-7]/.test(s)){let a=s;for(;a.length<3&&/[0-7]/.test(this.peek());)a+=this.advance();i+=String.fromCharCode(parseInt(a,8))}else i+=s}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos":return s==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var p={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function Fe(e){e.expect(p.PRINT);let t=[];if(e.check(p.NEWLINE)||e.check(p.SEMICOLON)||e.check(p.RBRACE)||e.check(p.PIPE)||e.check(p.GT)||e.check(p.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(te(e));e.check(p.COMMA);)e.advance(),t.push(te(e));let n;return e.check(p.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function te(e){return Ut(e)?ce(e,!0):ce(e,!1)}function ce(e,t){let n=t?e.parseTernary():Bt(e);if(e.match(p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN)){let i=e.advance(),s=ce(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:s}}return n}function Ut(e){let t=0,n=e.pos;for(;n=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function $t(e){return e.match(p.NUMBER,p.STRING,p.IDENT,p.DOLLAR,p.LPAREN,p.NOT,p.MINUS,p.PLUS,p.INCREMENT,p.DECREMENT)}function Wt(e){return e.match(p.AND,p.OR,p.QUESTION,p.ASSIGN,p.PLUS_ASSIGN,p.MINUS_ASSIGN,p.STAR_ASSIGN,p.SLASH_ASSIGN,p.PERCENT_ASSIGN,p.CARET_ASSIGN,p.COMMA,p.SEMICOLON,p.NEWLINE,p.RBRACE,p.RPAREN,p.RBRACKET,p.COLON,p.PIPE,p.APPEND,p.GT,p.IN)}function De(e){e.expect(p.PRINTF);let t=e.check(p.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():te(e),i=[];for(;e.check(p.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():te(e));t&&(e.skipNewlines(),e.expect(p.RPAREN));let s;return e.check(p.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(p.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:s}}var ne=class{tokens=[];pos=0;parse(t){let n=new ee(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let s=i.reduce((a,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:a,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let s=1;s_(t.requireDefenseContext,"awk",h,c);if(fe(e))return pe(Vt);let i=new H(/\s+/),s=" ",a=Object.create(null),o=0;for(let h=0;h0){let G=E.slice(0,F),xe=he(E.slice(F+1));a[G]=xe}o=h+1}else{if(c.startsWith("--"))return re("awk",c);if(c.startsWith("-")&&c.length>1){let E=c[1];if(E!=="F"&&E!=="v")return re("awk",`-${E}`);o=h+1}else if(!c.startsWith("-")){o=h;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program -`,exitCode:1};let l=e[o],u=e.slice(o+1),N=new ne,A;try{A=N.parse(l)}catch(h){return{stdout:"",stderr:`awk: ${h instanceof Error?h.message:String(h)} -`,exitCode:1}}let C={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(h,c)=>{try{let E=await n("appendFile read",()=>t.fs.readFile(h));await n("appendFile write",()=>t.fs.writeFile(h,E+c))}catch(E){if(E instanceof x)throw E;await n("appendFile create",()=>t.fs.writeFile(h,c))}},resolvePath:t.fs.resolvePath.bind(t.fs)},O=t.exec,I=ie({fieldSep:i,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:C,cwd:t.cwd,exec:O?h=>n("command pipe exec",()=>O(h,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});I.FS=s,I.vars=Object.assign(Object.create(null),a),I.ARGC=u.length+1,I.ARGV=Object.create(null),I.ARGV[0]="awk";for(let h=0;hh.pattern?.type!=="begin"&&h.pattern?.type!=="end"),R=A.rules.some(h=>h.pattern?.type==="end");try{if(await n("BEGIN execution",()=>w.executeBegin()),I.shouldExit)return await n("END execution after BEGIN exit",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};if(!d&&!R)return{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()};let h=[];if(u.length>0)for(let c of u)try{let E=t.fs.resolvePath(t.cwd,c),G=(await n("input file read",()=>t.fs.readFile(E))).split(` -`);G.length>0&&G[G.length-1]===""&&G.pop(),h.push({filename:c,lines:G})}catch(E){if(E instanceof x)throw E;return{stdout:"",stderr:`awk: ${c}: No such file or directory -`,exitCode:1}}else{let c=t.stdin.split(` -`);c.length>0&&c[c.length-1]===""&&c.pop(),h.push({filename:"",lines:c})}for(let c of h){for(I.FILENAME=c.filename,I.FNR=0,I.lines=c.lines,I.lineIndex=-1,I.shouldNextFile=!1;I.lineIndexw.executeLine(c.lines[E])),I.shouldExit||I.shouldNextFile)break}if(I.shouldExit)break}return await n("END execution",()=>w.executeEnd()),{stdout:w.getOutput(),stderr:"",exitCode:w.getExitCode()}}catch(h){if(h instanceof x)throw h;let c=h instanceof Error?h.message:String(h),E=h instanceof P?P.EXIT_CODE:2;return{stdout:w.getOutput(),stderr:`awk: ${c} -`,exitCode:E}}}};function he(e){return e.replace(/\\t/g," ").replace(/\\n/g,` -`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function _e(e){if(e===" ")return v("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return v(e)}catch{return v(Ge(e))}return v(Ge(e))}function Ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Kn={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{Vn as a,Kn as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-F3GKANW3.js b/packages/just-bash/dist/bin/chunks/chunk-F3GKANW3.js new file mode 100644 index 00000000..280d780a --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-F3GKANW3.js @@ -0,0 +1,12 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as g}from"./chunk-VZK4FHWJ.js";import{a as b,b as m,c as v}from"./chunk-MUFNRCMY.js";var L={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};function f(s){let i=s.split(",").map(o=>o.trim()),e=[];for(let o of i){let n=parseInt(o,10);if(Number.isNaN(n)||n<1)return null;e.push(n)}for(let o=1;os)return e;if(i.length>=2){let e=i[i.length-1]-i[i.length-2],o=i[i.length-1],n=Math.floor((s-o)/e)+1;return o+n*e}return-1}function N(s,i){let{tabStops:e,allBlanks:o}=i,n="",a=0,t="",l=0,u=!0,d=()=>{if(t.length===0)return;let r=l+t.length;if(!o&&!u){n+=t,t="";return}let p=l,c="";for(;pp)c+=" ",p=h;else break}let x=r-p;x>0&&(c+=" ".repeat(x)),n+=c,t=""};for(let r of s)r===" "?(t.length===0&&(l=a),t+=r,a++):r===" "?(d(),n+=r,a=C(a,e)):(d(),n+=r,a++,u=!1);return d(),n}function k(s,i){if(s==="")return"";let e=s.split(` +`),o=s.endsWith(` +`)&&e[e.length-1]==="";return o&&e.pop(),e.map(a=>N(a,i)).join(` +`)+(o?` +`:"")}var I={name:"unexpand",execute:async(s,i)=>{if(m(s))return b(L);let e={tabStops:[8],allBlanks:!1},o=[],n=0;for(;n2){let l=f(t.slice(2));if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(2)}' +`};e.tabStops=l,n++}else if(t==="--tabs"&&n+10&&e[0]!=="-"){let i=t.fs.resolvePath(t.cwd,e[0]);try{let s=(await t.fs.readFile(i)).split(` -`);s[s.length-1]===""&&s.pop();let r=s.reverse();return{stdout:r.length>0?`${r.join(` -`)} -`:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory -`,exitCode:1}}}let n=t.stdin.split(` -`);n[n.length-1]===""&&n.pop();let o=n.reverse();return{stdout:o.length>0?`${o.join(` -`)} -`:"",stderr:"",exitCode:0}}var l={name:"tac",execute:c},a={name:"tac",flags:[],stdinType:"text",needsFiles:!0};export{l as a,a as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-F3WNDKOC.js b/packages/just-bash/dist/bin/chunks/chunk-F3WNDKOC.js new file mode 100644 index 00000000..961a06d3 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-F3WNDKOC.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as s}from"./chunk-FKVQZWJQ.js";var a=s("sha1sum","sha1","compute SHA1 message digest"),m={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0};export{a,m as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-FA2CHD73.js b/packages/just-bash/dist/bin/chunks/chunk-FA2CHD73.js deleted file mode 100644 index 48ec440e..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-FA2CHD73.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -import{b as w}from"./chunk-5WFYIUU2.js";import{a as F,b as N,c as k}from"./chunk-GTNBSMZR.js";var A=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),P=new Map([["jan",1],["feb",2],["mar",3],["apr",4],["may",5],["jun",6],["jul",7],["aug",8],["sep",9],["oct",10],["nov",11],["dec",12]]);function O(u){let r=u.trim(),e=r.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(r);return Number.isNaN(n)?0:n}let l=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=A.get(s)??1;return l*i}function x(u){let r=u.trim().toLowerCase().slice(0,3);return P.get(r)??0}function D(u,r){let e=u.split(/(\d+)/),l=r.split(/(\d+)/),s=Math.max(e.length,l.length);for(let i=0;i=s.length)return"";if(r.endField===void 0){let o=s[i]||"";return r.startChar!==void 0&&(o=o.slice(r.startChar-1)),r.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(r.endField-1,s.length-1),d="";for(let o=i;o<=n&&oi&&(d+=e||" "),d+=c}return r.ignoreLeading&&(d=d.trimStart()),d}function L(u,r,e){let l=u,s=r;if(e.dictionaryOrder&&(l=M(l),s=M(s)),e.ignoreCase&&(l=l.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=x(l),n=x(s);return i-n}if(e.humanNumeric){let i=O(l),n=O(s);return i-n}if(e.versionSort)return D(l,s);if(e.numeric){let i=parseFloat(l)||0,n=parseFloat(s)||0;return i-n}return l.localeCompare(s)}function I(u){let{keys:r,fieldDelimiter:e,numeric:l,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c,ignoreLeadingBlanks:t,stable:a}=u;return(f,C)=>{let g=f,b=C;if(t&&(g=g.trimStart(),b=b.trimStart()),r.length===0){let h=L(g,b,{numeric:l,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c});if(h!==0)return i?-h:h;if(!a){let p=f.localeCompare(C);return i?-p:p}return 0}for(let m of r){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let B={numeric:m.numeric??l,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??c},V=m.reverse??i,S=L(h,p,B);if(S!==0)return V?-S:S}if(!a){let m=f.localeCompare(C);return i?-m:m}return 0}}function E(u,r){if(r.keys.length===0){if(r.ignoreCase){let s=new Set;return u.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(u)]}let e=r.keys[0],l=new Set;return u.filter(s=>{let i=v(s,e,r.fieldDelimiter);return(e.ignoreCase??r.ignoreCase)&&(i=i.toLowerCase()),l.has(i)?!1:(l.add(i),!0)})}function y(u){let r={startField:1},e="",l=u,s=l.match(/([bdfhMnrV]+)$/);s&&(e=s[1],l=l.slice(0,-e.length)),e.includes("n")&&(r.numeric=!0),e.includes("r")&&(r.reverse=!0),e.includes("f")&&(r.ignoreCase=!0),e.includes("b")&&(r.ignoreLeading=!0),e.includes("h")&&(r.humanNumeric=!0),e.includes("V")&&(r.versionSort=!0),e.includes("d")&&(r.dictionaryOrder=!0),e.includes("M")&&(r.monthSort=!0);let i=l.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(r.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(r.startChar=o)}if(i.length>1&&i[1]){let o=i[1],c=o.match(/([bdfhMnrV]+)$/);if(c){let a=c[1];a.includes("n")&&(r.numeric=!0),a.includes("r")&&(r.reverse=!0),a.includes("f")&&(r.ignoreCase=!0),a.includes("b")&&(r.ignoreLeading=!0),a.includes("h")&&(r.humanNumeric=!0),a.includes("V")&&(r.versionSort=!0),a.includes("d")&&(r.dictionaryOrder=!0),a.includes("M")&&(r.monthSort=!0),o=o.slice(0,-a.length)}let t=o.split(".");if(t[0]){let a=parseInt(t[0],10);if(!Number.isNaN(a)&&a>=1&&(r.endField=a),t.length>1&&t[1]){let f=parseInt(t[1],10);!Number.isNaN(f)&&f>=1&&(r.endChar=f)}}}return r}var q={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]] - F is a field number (1-indexed) - C is a character position within the field (1-indexed) - OPTS can be: b d f h M n r V (per-key modifiers) - -Examples: - -k1 sort by first field - -k2,2 sort by second field only - -k1.3 sort by first field starting at 3rd character - -k1,2n sort by fields 1-2 numerically - -k2 -k1 sort by field 2, then by field 1`},j={name:"sort",async execute(u,r){if(N(u))return F(q);let e={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},l=[];for(let c=0;c0&&n[n.length-1]===""&&n.pop();let d=I(e);if(e.checkOnly){let c=l.length>0?l[0]:"-";for(let t=1;t0)return{stdout:"",stderr:`sort: ${c}:${t+1}: disorder: ${n[t]} -`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}n.sort(d),e.unique&&(n=E(n,e));let o=n.length>0?`${n.join(` -`)} -`:"";if(e.outputFile){let c=r.fs.resolvePath(r.cwd,e.outputFile);return await r.fs.writeFile(c,o,"binary"),{stdout:"",stderr:"",exitCode:0}}return{stdout:o,stderr:"",exitCode:0,stdoutEncoding:"binary"}}},U={name:"sort",flags:[{flag:"-r",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-V",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-M",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-k",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"path"}],stdinType:"text",needsFiles:!0};export{j as a,U as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-FKVQZWJQ.js b/packages/just-bash/dist/bin/chunks/chunk-FKVQZWJQ.js new file mode 100644 index 00000000..6cb7af1b --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-FKVQZWJQ.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as U}from"./chunk-VZK4FHWJ.js";import{a as $,b as F,c as k}from"./chunk-MUFNRCMY.js";var L=new Map([["sha1","SHA-1"],["sha256","SHA-256"]]);function D(n){function h(r,u){return r<>>32-u}let g=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),A=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],b=n.length*8,c=(n.length%64<56?56:120)-n.length%64,s=new Uint8Array(n.length+c+8);s.set(n),s[n.length]=128;let d=new DataView(s.buffer);d.setUint32(s.length-8,b>>>0,!0),d.setUint32(s.length-4,Math.floor(b/4294967296),!0);let w=1732584193,l=4023233417,p=2562383102,e=271733878;for(let r=0;r>>0,m=o,o=x,x=a,a=a+h(i,A[t])>>>0}w=w+m>>>0,l=l+a>>>0,p=p+x>>>0,e=e+o>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,w,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,p,!0),new DataView(f.buffer).setUint32(12,e,!0),Array.from(f).map(r=>r.toString(16).padStart(2,"0")).join("")}async function C(n,h){if(n==="md5")return D(h);let g=L.get(n);if(!g)throw new Error(`Unknown algorithm: ${n}`);let A=await globalThis.crypto.subtle.digest(g,new Uint8Array(h).buffer);return Array.from(new Uint8Array(A)).map(b=>b.toString(16).padStart(2,"0")).join("")}function I(n,h,g){let A={name:n,summary:g,usage:`${n} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:n,async execute(b,c){if(F(b))return $(A);let s=!1,d=[];for(let e of b)if(e==="-c"||e==="--check")s=!0;else if(!(e==="-b"||e==="-t"||e==="--binary"||e==="--text")){if(e.startsWith("-")&&e!=="-")return k(n,e);d.push(e)}d.length===0&&d.push("-");let w=async e=>{if(e==="-")return Uint8Array.from(c.stdin,f=>f.charCodeAt(0));try{return await c.fs.readFileBuffer(c.fs.resolvePath(c.cwd,e))}catch{return null}};if(s){let e=0,f="";for(let r of d){let u=r==="-"?U(c.stdin):await c.fs.readFile(c.fs.resolvePath(c.cwd,r)).catch(()=>null);if(u===null)return{stdout:"",stderr:`${n}: ${r}: No such file or directory +`,exitCode:1};for(let m of u.split(` +`)){let a=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!a)continue;let[,x,o]=a,t=await w(o);if(t===null){f+=`${o}: FAILED open or read +`,e++;continue}let i=await C(h,t)===x.toLowerCase();f+=`${o}: ${i?"OK":"FAILED"} +`,i||e++}}return e>0&&(f+=`${n}: WARNING: ${e} computed checksum${e>1?"s":""} did NOT match +`),{stdout:f,stderr:"",exitCode:e>0?1:0}}let l="",p=0;for(let e of d){let f=await w(e);if(f===null){l+=`${n}: ${e}: No such file or directory +`,p=1;continue}l+=`${await C(h,f)} ${e} +`}return{stdout:l,stderr:"",exitCode:p}}}}export{I as a}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-FLPVVSN5.js b/packages/just-bash/dist/bin/chunks/chunk-FLPVVSN5.js deleted file mode 100644 index 96eac107..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-FLPVVSN5.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -async function x(a,u){let o="octal",n=[],i=[];for(let t=0;t0&&i[0]!=="-"){let t=i[0].startsWith("/")?i[0]:`${u.cwd}/${i[0]}`;try{c=await u.fs.readFile(t)}catch{return{stdout:"",stderr:`od: ${i[0]}: No such file or directory -`,exitCode:1}}}let d=n.includes("char");function m(t){return t===0?" \\0":t===7?" \\a":t===8?" \\b":t===9?" \\t":t===10?" \\n":t===11?" \\v":t===12?" \\f":t===13?" \\r":t>=32&&t<127?` ${String.fromCharCode(t)}`:` ${t.toString(8).padStart(3,"0")}`}function y(t){return d?` ${t.toString(16).padStart(2,"0")}`:` ${t.toString(16).padStart(2,"0")}`}function S(t){return` ${t.toString(8).padStart(3,"0")}`}let s=[];for(let t of c)s.push(t.charCodeAt(0));let p=16,f=[];for(let t=0;t0||o==="none")&&(h=o==="none"?"":" "),f.push(h+l.join(""))}}return o!=="none"&&s.length>0&&f.push(s.length.toString(8).padStart(7,"0")),{stdout:f.length>0?`${f.join(` -`)} -`:"",stderr:"",exitCode:0}}var $={name:"od",execute:x},v={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{$ as a,v as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-FOUVACI7.js b/packages/just-bash/dist/bin/chunks/chunk-FOUVACI7.js new file mode 100644 index 00000000..d9e9df57 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-FOUVACI7.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as _,c as W}from"./chunk-JXLDT4KX.js";import{k as T}from"./chunk-47WZ2U6M.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as N,b as A}from"./chunk-MUFNRCMY.js";import{c as H,e as L}from"./chunk-LNVSXNT7.js";var z=H(C=>{(function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(c){return e(n(c),arguments)}function r(c,i){return a.apply(null,[c].concat(i||[]))}function e(c,i){var u=1,l=c.length,o,m="",p,d,f,h,y,S,k,x;for(p=0;p=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?m+=o:(t.number.test(f.type)&&(!k||f.sign)?(x=k?"+":"-",o=o.toString().replace(t.sign,"")):x="",y=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",S=f.width-(x+o).length,h=f.width&&S>0?y.repeat(S):"",m+=f.align?x+o+h:y==="0"?x+h+o:h+x+o)}return m}var s=Object.create(null);function n(c){if(s[c])return s[c];for(var i=c,u,l=[],o=0;i;){if((u=t.text.exec(i))!==null)l.push(u[0]);else if((u=t.modulo.exec(i))!==null)l.push("%");else if((u=t.placeholder.exec(i))!==null){if(u[2]){o|=1;var m=[],p=u[2],d=[];if((d=t.key.exec(p))!==null)for(m.push(d[1]);(p=p.substring(d[0].length))!=="";)if((d=t.key_access.exec(p))!==null)m.push(d[1]);else if((d=t.index_access.exec(p))!==null)m.push(d[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=m}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");l.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");i=i.substring(u[0].length)}return s[c]=l}typeof C<"u"&&(C.sprintf=a,C.vsprintf=r),typeof window<"u"&&(window.sprintf=a,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:a,vsprintf:r}}))})()});var $=L(z(),1);function P(t,a,r){let e=new Date(a*1e3),s="",n=0;for(;ns.find(l=>l.type===u)?.value??"",c=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),i=n("weekday");return{year:Number.parseInt(n("year"),10)||t.getFullYear(),month:Number.parseInt(n("month"),10)||t.getMonth()+1,day:Number.parseInt(n("day"),10)||t.getDate(),hour:Number.parseInt(n("hour"),10)||t.getHours(),minute:Number.parseInt(n("minute"),10)||t.getMinutes(),second:Number.parseInt(n("second"),10)||t.getSeconds(),weekday:c.get(i)??t.getDay()}}catch{return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),weekday:t.getDay()}}}function R(t,a,r){let e=G(t,r),s=(u,l=2)=>String(u).padStart(l,"0"),n=Z(e.year,e.month,e.day),c=j(e.year,e.month,e.day,e.weekday,0),i=j(e.year,e.month,e.day,e.weekday,1);switch(a){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][e.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1]} ${String(e.day).padStart(2," ")} ${s(e.hour)}:${s(e.minute)}:${s(e.second)} ${e.year}`;case"C":return s(Math.floor(e.year/100));case"d":return s(e.day);case"D":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"e":return String(e.day).padStart(2," ");case"F":return`${e.year}-${s(e.month)}-${s(e.day)}`;case"g":return s(O(e.year,e.month,e.day)%100);case"G":return String(O(e.year,e.month,e.day));case"H":return s(e.hour);case"I":return s(e.hour%12||12);case"j":return String(n).padStart(3,"0");case"k":return String(e.hour).padStart(2," ");case"l":return String(e.hour%12||12).padStart(2," ");case"m":return s(e.month);case"M":return s(e.minute);case"n":return` +`;case"N":return"000000000";case"p":return e.hour<12?"AM":"PM";case"P":return e.hour<12?"am":"pm";case"r":return`${s(e.hour%12||12)}:${s(e.minute)}:${s(e.second)} ${e.hour<12?"AM":"PM"}`;case"R":return`${s(e.hour)}:${s(e.minute)}`;case"s":return String(Math.floor(t.getTime()/1e3));case"S":return s(e.second);case"t":return" ";case"T":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"u":return String(e.weekday===0?7:e.weekday);case"U":return s(c);case"V":return s(Q(e.year,e.month,e.day));case"w":return String(e.weekday);case"W":return s(i);case"x":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"X":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"y":return s(e.year%100);case"Y":return String(e.year);case"z":return V(t,r);case"Z":return q(t,r);case"%":return"%";default:return null}}function V(t,a){if(!a){let c=-t.getTimezoneOffset(),i=c>=0?"+":"-",u=Math.floor(Math.abs(c)/60),l=Math.abs(c)%60;return`${i}${String(u).padStart(2,"0")}${String(l).padStart(2,"0")}`}try{let u=new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"longOffset"}).formatToParts(t).find(l=>l.type==="timeZoneName");if(u){let l=u.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(l)return`${l[1]}${l[2]}${l[3]}`;if(u.value==="GMT"||u.value==="UTC")return"+0000"}}catch{}let r=-t.getTimezoneOffset(),e=r>=0?"+":"-",s=Math.floor(Math.abs(r)/60),n=Math.abs(r)%60;return`${e}${String(s).padStart(2,"0")}${String(n).padStart(2,"0")}`}function q(t,a){try{return new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function Z(t,a,r){let e=[31,28,31,30,31,30,31,31,30,31,30,31];(t%4===0&&t%100!==0||t%400===0)&&(e[1]=29);let n=r;for(let c=0;c=194){let s=(e&31)<<6|t[r+1]&63;a+=String.fromCharCode(s),r+=2;continue}a+=String.fromCharCode(e),r++;continue}if((e&240)===224){if(r+2=55296&&s<=57343){a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(s),r+=3;continue}a+=String.fromCharCode(e),r++;continue}if((e&248)===240&&e<=244){if(r+31114111){a+=String.fromCharCode(e),r++;continue}a+=String.fromCodePoint(s),r+=4;continue}a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(e),r++}return a}var K={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},ge={name:"printf",async execute(t,a){if(A(t))return N(K);if(t.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments] +`,exitCode:2};let r=null,e=0;for(;e=t.length)return{stdout:"",stderr:`printf: -v: option requires an argument +`,exitCode:1};if(r=t[e+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(r))return{stdout:"",stderr:`printf: \`${r}': not a valid identifier +`,exitCode:2};e+=2}else{if(c.startsWith("-")&&c!=="-")break;break}}if(e>=t.length)return{stdout:"",stderr:`printf: usage: printf format [arguments] +`,exitCode:1};let s=t[e],n=t.slice(e+1);try{let c=W(s),i="",u=0,l=!1,o="",m=a.env.get("TZ"),p=a.limits?.maxStringLength;do{let{result:d,argsConsumed:f,error:h,errMsg:y,stopped:S}=ee(c,n,u,m);if(i+=d,p!==void 0&&p>0&&i.length>p)throw new T(`printf: output size limit exceeded (${p} bytes)`,"string_length");if(u+=f,h&&(l=!0,y&&(o=y)),S)break}while(u0);if(u===0&&n.length>0,r){let d=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(d){let f=d[1],h=d[3];h=h.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(y,S)=>a.env.get(S)??""),a.env.set(`${f}_${h}`,i)}else a.env.set(r,i);return{stdout:"",stderr:o,exitCode:l?1:0}}return{stdout:i,stderr:o,exitCode:l?1:0}}catch(c){if(c instanceof T)throw c;return{stdout:"",stderr:`printf: ${D(c)} +`,exitCode:1}}}};function ee(t,a,r,e){let s="",n=0,c=0,i=!1,u="";for(;n=0&&w.length>I&&(w=w.slice(0,I)),b!==0){let F=Math.abs(b);w.length>>0:n;return{value:U(t.replace("u","d"),c),parseError:e,parseErrMsg:s}}case"x":case"X":{let n=E(r);return e=g,e&&(s=`printf: ${r}: invalid number +`),{value:ne(t,n),parseError:e,parseErrMsg:s}}case"e":case"E":case"f":case"F":case"g":case"G":{let n=parseFloat(r)||0;return{value:oe(t,a,n),parseError:!1,parseErrMsg:""}}case"c":{if(r==="")return{value:"",parseError:!1,parseErrMsg:""};let i=new TextEncoder().encode(r)[0];return{value:String.fromCharCode(i),parseError:!1,parseErrMsg:""}}case"s":return{value:ae(t,r),parseError:!1,parseErrMsg:""};case"q":return{value:ie(t,r),parseError:!1,parseErrMsg:""};case"b":{let n=ce(r);return{value:n.value,parseError:!1,parseErrMsg:"",stopped:n.stopped}}default:try{return{value:(0,$.sprintf)(t,r),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder +`}}}}var g=!1;function E(t){g=!1;let a=t.trimStart(),r=a!==a.trimEnd();if(t=a.trimEnd(),t.startsWith("'")&&t.length>=2||t.startsWith('"')&&t.length>=2)return t.charCodeAt(1);if(t.startsWith("\\'")&&t.length>=3||t.startsWith('\\"')&&t.length>=3)return t.charCodeAt(2);if(t.startsWith("+")&&(t=t.slice(1)),t.startsWith("0x")||t.startsWith("0X")){let e=parseInt(t,16);return Number.isNaN(e)?(g=!0,0):(r&&(g=!0),e)}if(t.startsWith("0")&&t.length>1&&/^-?0[0-7]+$/.test(t))return r&&(g=!0),parseInt(t,8)||0;if(/^\d+#/.test(t)){g=!0;let e=t.match(/^(\d+)#/);return e?parseInt(e[1],10):0}if(t!==""&&!/^-?\d+$/.test(t)){g=!0;let e=parseInt(t,10);return Number.isNaN(e)?0:e}return r&&(g=!0),parseInt(t,10)||0}function U(t,a){let r=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!r)return(0,$.sprintf)(t.replace(/\.\d*/,""),a);let e=r[1]||"",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=a<0,i=Math.abs(a),u=String(i);n>=0&&(u=u.padStart(n,"0"));let l="";c?l="-":e.includes("+")?l="+":e.includes(" ")&&(l=" ");let o=l+u;return s>o.length&&(e.includes("-")?o=o.padEnd(s," "):e.includes("0")&&n<0?o=l+u.padStart(s-l.length,"0"):o=o.padStart(s," ")),o}function re(t,a){let r=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!r)return(0,$.sprintf)(t,a);let e=r[1]||"",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=Math.abs(a).toString(8);n>=0&&(c=c.padStart(n,"0")),e.includes("#")&&!c.startsWith("0")&&(c=`0${c}`);let i=c;return s>i.length&&(e.includes("-")?i=i.padEnd(s," "):e.includes("0")&&n<0?i=i.padStart(s,"0"):i=i.padStart(s," ")),i}function ne(t,a){let r=t.includes("X"),e=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!e)return(0,$.sprintf)(t,a);let s=e[1]||"",n=e[2]?parseInt(e[2],10):0,c=e[3]!==void 0?e[4]?parseInt(e[4],10):0:-1,i=Math.abs(a).toString(16);r&&(i=i.toUpperCase()),c>=0&&(i=i.padStart(c,"0"));let u="";s.includes("#")&&a!==0&&(u=r?"0X":"0x");let l=u+i;return n>l.length&&(s.includes("-")?l=l.padEnd(n," "):s.includes("0")&&c<0?l=u+i.padStart(n-u.length,"0"):l=l.padStart(n," ")),l}function se(t){if(t==="")return"''";if(/^[a-zA-Z0-9_./-]+$/.test(t))return t;if(/[\x00-\x1f\x7f-\xff]/.test(t)){let e="$'";for(let s of t){let n=s.charCodeAt(0);s==="'"?e+="\\'":s==="\\"?e+="\\\\":s===` +`?e+="\\n":s===" "?e+="\\t":s==="\r"?e+="\\r":s==="\x07"?e+="\\a":s==="\b"?e+="\\b":s==="\f"?e+="\\f":s==="\v"?e+="\\v":s==="\x1B"?e+="\\E":n<32||n>=127&&n<=255?e+=`\\${n.toString(8).padStart(3,"0")}`:s==='"'?e+='\\"':e+=s}return e+="'",e}let r="";for(let e of t)" |&;<>()$`\\\"'*?[#~=%!{}".includes(e)?r+=`\\${e}`:r+=e;return r}function ae(t,a){let r=t.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!r)return(0,$.sprintf)(t.replace(/0+(?=\d)/,""),a);let e=r[1]==="-",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=e?-s:s;return _(a,c,n)}function ie(t,a){let r=se(a),e=t.match(/^%(-?)(\d*)q$/);if(!e)return r;let s=e[1]==="-",n=e[2]?parseInt(e[2],10):0,c=r;return n>c.length&&(s?c=c.padEnd(n," "):c=c.padStart(n," ")),c}function oe(t,a,r){let e=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!e)return(0,$.sprintf)(t,r);let s=e[1]||"",n=e[2]?parseInt(e[2],10):0,c=e[3]!==void 0?e[4]?parseInt(e[4],10):0:6,i,u=a.toLowerCase();if(u==="e"?(i=r.toExponential(c),i=i.replace(/e([+-])(\d)$/,"e$10$2"),a==="E"&&(i=i.toUpperCase())):u==="f"?(i=r.toFixed(c),s.includes("#")&&c===0&&!i.includes(".")&&(i+=".")):u==="g"?(i=r.toPrecision(c||1),s.includes("#")||(i=i.replace(/\.?0+$/,""),i=i.replace(/\.?0+e/,"e")),i=i.replace(/e([+-])(\d)$/,"e$10$2"),a==="G"&&(i=i.toUpperCase())):i=r.toString(),r>=0&&(s.includes("+")?i=`+${i}`:s.includes(" ")&&(i=` ${i}`)),n>i.length)if(s.includes("-"))i=i.padEnd(n," ");else if(s.includes("0")){let l=i.match(/^[+ -]/)?.[0]||"",o=l?i.slice(1):i;i=l+o.padStart(n-l.length,"0")}else i=i.padStart(n," ");return i}function ce(t){let a="",r=0;for(;r0?(a+=B(s),r=n):(a+="\\x",r+=2);break}case"u":{let s="",n=r+2;for(;n1,h=0;for(let d=0;d0&&(u+=` -`),u+=`==> ${p} <== -`),u+=s(x),h++}catch{f+=`${i}: ${p}: No such file or directory -`,e=1}}return{stdout:u,stderr:f,exitCode:e}}function $(t,r,i){if(i!==null)return t.slice(0,i);if(r===0)return"";let s=0,o=0,l=t.length;for(;s0?t.slice(0,s):""}function g(t,r,i,s){if(i!==null)return t.slice(-i);let o=t.length;if(o===0)return"";if(s){let f=0,e=1;for(;f=0&&n{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="b"&&this.pos+1"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.posH,parseNamedExpressions:()=>U});function U(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},a=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){a();continue}let d=[],u=0,p=r;for(;o().type!=="eof";){let i=o();if((i.type===","||i.type==="as")&&u===0)break;(i.type==="("||i.type==="["||i.type==="{")&&u++,(i.type===")"||i.type==="]"||i.type==="}")&&u--,d.push(a())}d.push({type:"eof",value:"",pos:0});let h=new z(d).parse(),l;if(o().type==="as")if(a(),o().type==="("){a();let i=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(i.push(o().value),a()),o().type===","&&a();o().type===")"&&a(),l=i}else if(o().type==="ident"||o().type==="string")l=o().value,a();else throw new Error(`Expected name after 'as', got ${o().type}`);else l=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),h.type==="identifier"&&(l=h.name);n.push({expr:h,name:l})}return n}function H(e){let t=new q(e).tokenize();return new z(t).parse()}var R,z,V=We(()=>{"use strict";Je();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},z=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=this.pos;if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=[this.peek().value];this.advance();let o=!0;for(;this.peek().type===",";)if(this.advance(),this.peek().type==="ident")r.push(this.peek().value),this.advance();else{o=!1;break}if(o&&this.peek().type===")"&&this.peekAt(1).type==="=>"){this.advance(),this.advance();let a=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:r,body:a},r)}this.pos=t}let s=this.parseExpr(0);return this.expect(")"),s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,a=this.pos+1;a0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let a=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:a}]}}if(s.type==="|"){this.advance();let a=this.parseExpr(t);return this.handlePipe(n,a)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}peekAt(n){return this.tokens[this.pos+n]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});V();function E(e,n){return n.length===0?I(e,[]):n.length===1?{type:"Pipe",left:n[0],right:I(e,[])}:{type:"Pipe",left:n[0],right:I(e,n.slice(1))}}var K={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>I("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?I("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?I("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?I("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>I("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>I("select",e),empty:()=>I("empty",[]),count:()=>I("length",[]),sum:e=>e.length===0?I("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:I("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",I("add",[]),I("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",I("add",[]),I("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?I("tonumber",[]):I("tonumber",e),tostring:e=>e.length===0?I("tostring",[]):I("tostring",e),if:e=>Ke(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return Ke(s,n,t.length===1?t[0]:K.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>I("now",[]),fmt:e=>I("tostring",e),format:e=>I("tostring",e)};Object.setPrototypeOf(K,null);function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function I(e,n){return{type:"Call",name:e,args:n}}var rt="then";function Ke(e,n,t){let s=qe({type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}});return s[rt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>O(r.expr,n)),s=Object.hasOwn(K,e.name)?K[e.name]:void 0;return typeof s=="function"?s(t):I(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=O(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function ee(e){let n=[],t=0;for(;t=e.length)break;let s=t;for(;t0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let d=e.slice(a,t).trim();for(t++;t0?r[0]:null}function te(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(Be(r)?o=e.map(a=>a[r]).filter(a=>a!=null):o=e.map(a=>Q(a,r,t)).filter(a=>a!=null),s){case"count":return Be(r)?o.length:o.filter(a=>!!a).length;case"sum":return o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).reduce((d,u)=>d+u,0);case"mean":case"avg":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?a.reduce((d,u)=>d+u,0)/a.length:0}case"min":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?Math.min(...a):null}case"max":{let a=o.map(d=>typeof d=="number"?d:Number.parseFloat(String(d)));return a.length>0?Math.max(...a):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let a=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(a.length===0)return null;let d=Math.floor(a.length/2);return a.length%2===0?(a[d-1]+a[d])/2:a[d]}case"mode":{let a=new Map;for(let p of o){let c=String(p);a.set(c,(a.get(c)||0)+1)}let d=0,u=null;for(let[p,c]of a)c>d&&(d=c,u=p);return u}case"cardinality":return new Set(o.map(d=>String(d))).size;case"values":return o.map(a=>String(a)).join("|");case"distinct_values":return[...new Set(o.map(d=>String(d)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let a of e)if(!Q(a,r,t))return!1;return!0}case"any":{for(let a of e)if(Q(a,r,t))return!0;return!1}default:return null}}function Ge(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,te(e,r,t));return s}async function ne(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression +`,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let a={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},d=ee(t),u=d.map(c=>c.alias),p=Ge(r,d,a);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function se(e,n){let t="",s="",r=[];for(let f=0;fString(f[g])).join("\0");h.has(m)||(h.set(m,[]),c.push(m)),h.get(m)?.push(f)}let l=[...u,...p.map(f=>f.alias)],i=[];for(let f of c){let m=h.get(f);if(!m)continue;let g=F();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,te(m,y,d));i.push(g)}return{stdout:w(l,i),stderr:"",exitCode:0}}async function re(e,n){let t=[],s="",r=10,o=!1,a=[];for(let i=0;i0?t:d.filter(i=>i!==s);s&&t.length===0&&(c=d.filter(i=>i!==s));let h=[],l=s?["field",s,"value","count"]:["field","value","count"];if(s){let i=new Map;for(let f of u){let m=String(f[s]??"");i.has(m)||i.set(m,[]),i.get(m)?.push(f)}for(let f of c)for(let[m,g]of i){let y=new Map;for(let k of g){let N=k[f],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((k,N)=>N[1]!==k[1]?N[1]-k[1]:k[0].localeCompare(N[0]));o&&(x=x.filter(([k])=>k!=="")),r>0&&(x=x.slice(0,r));for(let[k,N]of x)h.push({field:f,[s]:m,value:k===""?"":k,count:N})}}else for(let i of c){let f=new Map;for(let g of u){let y=g[i],x=y===""||y===null||y===void 0?"":String(y);f.set(x,(f.get(x)||0)+1)}let m=[...f.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)h.push({field:i,value:g===""?"":g,count:y})}return{stdout:w(l,h),stderr:"",exitCode:0}}async function oe(e,n){let t=[],s=[];for(let c=0;c0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let c of d){let h=o.map(f=>f[c]).filter(f=>f!=null),l=h.map(f=>typeof f=="number"?f:Number.parseFloat(String(f))).filter(f=>!Number.isNaN(f)),i=l.length===h.length&&l.length>0;p.push({field:c,type:i?"Number":"String",count:h.length,min:i?Math.min(...l):"",max:i?Math.max(...l):"",mean:i?Math.round(l.reduce((f,m)=>f+m,0)/l.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}V();function Xe(e){let n=H(e);return O(n)}function ot(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return J(`^${t}$`)}function B(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),c=B(p,n);for(let h of c)s.add(h);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=ot(o);for(let c of n)p.test(c)&&!t.includes(c)&&t.push(c);continue}let a=o.match(/^([^:]*):([^:]*)$/);if(a&&(a[1]||a[2])){let p=a[1],c=a[2],h=p?n.indexOf(p):0,l=c?n.indexOf(c):n.length-1;if(h!==-1&&l!==-1){let i=h<=l?1:-1;for(let f=h;i>0?f<=l:f>=l;f+=i)t.includes(n[f])||t.push(n[f])}continue}let d=o.match(/^(\d+)-(\d+)$/);if(d){let p=Number.parseInt(d[1],10),c=Number.parseInt(d[2],10);for(let h=p;h<=c&&h=0&&u0?t.filter(r=>!s.has(r)):t}async function ie(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified +`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let d=B(t,r),u=o.map(p=>{let c=F();for(let h of d)b(c,h,p[h]);return c});return{stdout:w(d,u),stderr:"",exitCode:0}}async function ae(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan drop: no columns specified +`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let d=new Set(B(t,r)),u=r.filter(c=>!d.has(c)),p=o.map(c=>{let h=F();for(let l of u)b(h,l,c[l]);return h});return{stdout:w(u,p),stderr:"",exitCode:0}}async function le(e,n){let t="",s="",r=[];for(let c=0;cl.get(i)||i)}else{let c=t.split(",");u=o.map((h,l)=>l{let h=F();for(let l=0;l{let h=F();b(h,t,c);for(let l of r)b(h,l,p[l]);return h});return{stdout:w(d,u),stderr:"",exitCode:0}}async function ce(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(a=>a!=="-j"&&a!=="--just-names"),n);return r||{stdout:t?`${s.map(a=>a).join(` +`)} +`:`${s.map((a,d)=>`${d} ${a}`).join(` +`)} +`,stderr:"",exitCode:0}}async function pe(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length} +`,stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],c=s.map(h=>({column:h}));return{stdout:w(p,c),stderr:"",exitCode:0}}let a=s[0],d=[a,...r.map((p,c)=>String(p[a]??`row_${c}`))],u=[];for(let p=1;p(d=d*1103515245+12345&2147483647,d/2147483647),p=[...o];for(let c=p.length-1;c>0;c--){let h=Math.floor(u()*(c+1));[p[c],p[h]]=[p[h],p[c]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function we(e,n){let t=null,s="",r=[];for(let i=0;ii.length)),c=t??p,h=u.map(i=>i.length===c?i:i.lengthl.length>0),h=o[0]?.replace(/\.csv$/,"")||"part";try{let l=n.fs.resolvePath(n.cwd,r);for(let i=0;i`Part ${f+1}: ${i.length} rows`).join(` +`)} +`,stderr:"",exitCode:0}}}function Ye(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")||"empty"}function it(e){let n=2166136261;for(let t=0;t>>0;return n.toString(36).padStart(6,"0").slice(0,6)}async function Ce(e,n){let t="",s=".",r=[];for(let l=0;l1?`${i}_${it(l)}`:i,g=`${m}.csv`,y=1;for(;c.has(g);)g=`${m}_${y}.csv`,y++;c.add(g),h.set(l,g)}try{let l=n.fs.resolvePath(n.cwd,s);for(let[i,f]of u){let m=h.get(i);if(!m)continue;let g=n.fs.resolvePath(l,m);await n.fs.writeFile(g,w(o,f))}return{stdout:`Partitioned into ${u.size} files by '${t}' +`,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([i,f])=>`${i}: ${f.length} rows`).join(` +`)} +`,stderr:"",exitCode:0}}}async function be(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to [FILE] +`,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?at(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}' +`,exitCode:1}}async function at(e,n){let t=e.filter(a=>!a.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)} +`,stderr:"",exitCode:0}}async function Se(e,n){let t="",s=[];for(let r=0;r [FILE] +`,exitCode:1}}async function lt(e,n){let t=e[0],s;if(!t||t==="-")s=_(n.stdin);else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory +`,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array +`,exitCode:1};if(r.length===0)return{stdout:` +`,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[a,...d]=r,u=d.map(p=>{let c=F();for(let h=0;h0&&h.length>=s)break;let i=$(l,c,p),f=i.length>0&&i.some(m=>!!m);(t?!f:f)&&h.push(l)}return{stdout:w(a,h),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=!1,r=!1,o=[];for(let c=0;c0&&(t=a[0]);let p=[...d].sort((c,h)=>{let l=c[t],i=h[t],f;if(s){let m=typeof l=="number"?l:Number.parseFloat(String(l)),g=typeof i=="number"?i:Number.parseFloat(String(i));f=m-g}else f=String(l).localeCompare(String(i));return r?-f:f});return{stdout:w(a,p),stderr:"",exitCode:0}}async function Ne(e,n){let t="",s=[];for(let p=0;p{let c=t?String(p[t]):JSON.stringify(p);return d.has(c)?!1:(d.add(c),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ee(e,n){let t=10,s="",r=!1,o=[];for(let h=0;h0&&(s=a[0]);let c=[...d].sort((h,l)=>{let i=h[s],f=l[s],m=typeof i=="number"?i:Number.parseFloat(String(i)),g=typeof f=="number"?f:Number.parseFloat(String(f));return r?m-g:g-m}).slice(0,t);return{stdout:w(a,c),stderr:"",exitCode:0}}V();async function Ae(e,n){let t="",s=!1,r=!1,o=[];for(let f=0;f({alias:typeof m=="string"?m:m[0],ast:O(f)})),h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l;if(s){l=[...a];for(let f of c)a.includes(f.alias)||l.push(f.alias)}else l=[...a,...c.map(f=>f.alias)];let i=[];for(let f=0;f0?N[0]:null;if(r&&C==null){y=!0;break}b(g,k.alias,C)}y||i.push(g)}return{stdout:w(l,i),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="",r="",o=[];for(let m=0;mm.trim()),c=r?r.split(",").map(m=>m.trim()):[];for(let m of p)if(!a.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found +`,exitCode:1};let h=O(U(s)[0]?.expr||(V(),nt(ze)).parseMoonblade(s)),l={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},i=a.map(m=>{let g=p.indexOf(m);return g!==-1&&c[g]?c[g]:m}),f=[];for(let m of d){let g=M(m);for(let y=0;y0?N[0]:null,A=c[y]||x;A!==x&&delete g[x],b(g,A,C)}f.push(g)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r=!1,o="",a=[];for(let i=0;ii===t?o:i):d,h=o||t,l=[];for(let i of u){let f=i[t],m=f==null?"":String(f);if(m===""){if(!r){let g=M(i);o&&(delete g[t],b(g,h,"")),l.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(i);o&&delete x[t],b(x,h,y),l.push(x)}}}return{stdout:w(c,l),stderr:"",exitCode:0}}async function Le(e,n){let t="",s="|",r="",o=[];for(let g=0;gg!==t),c=r?a.map(g=>g===t?r:g):a,h=r||t,l=[],i=null,f=[],m=null;for(let g of d){let y=p.map(N=>String(g[N]??"")).join("\0"),x=g[t],k=x==null?"":String(x);if(y!==i){if(m!==null){let N=M(m);r&&delete N[t],b(N,h,f.join(s)),l.push(N)}i=y,f=[k],m=g}else f.push(k)}if(m!==null){let g=M(m);r&&delete g[t],b(g,h,f.join(s)),l.push(g)}return{stdout:w(c,l),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r="",o="",a="inner",d="",u=0;for(let C=0;C!g.has(C)),x=[...h,...y],k=[],N=new Set;for(let C of l){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=F();for(let W of h)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);k.push(T)}}else if(a==="left"||a==="full"){let L=F();for(let T of h)b(L,T,C[T]);for(let T of y)b(L,T,d);k.push(L)}}if(a==="right"||a==="full")for(let C of f){let A=String(C[r]??"");if(!N.has(A)){let j=F();for(let L of h)b(j,L,i.includes(L)?C[L]:d);for(let L of y)b(j,L,C[L]);k.push(j)}}return{stdout:w(x,k),stderr:"",exitCode:0}}async function Re(e,n){let t="",s="",r=[],o=[];for(let y=0;yk.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE] +`,exitCode:1};let{headers:a,data:d,error:u}=await v(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found +`,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}' +`,exitCode:1};let[,c,h]=p;r.length===0&&(r=a.filter(y=>y!==t&&y!==h));let l=[];for(let y of d){let x=String(y[t]??"");l.includes(x)||l.push(x)}let i=new Map,f=[];for(let y of d){let x=r.map(A=>String(y[A]??"")).join("\0"),k=String(y[t]??""),N=y[h];i.has(x)||(i.set(x,new Map),f.push(x));let C=i.get(x);C&&(C.has(k)||C.set(k,[]),C.get(k)?.push(N))}let m=[...r,...l],g=[];for(let y of f){let x=y.split("\0"),k=i.get(y);if(!k)continue;let N=F();for(let C=0;Cs!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Me(e,n){let t="",s=[];for(let d=0;d{let p=d[t],c=u[t],h=typeof p=="number"?p:Number.parseFloat(String(p)),l=typeof c=="number"?c:Number.parseFloat(String(c));return!Number.isNaN(h)&&!Number.isNaN(l)?h-l:String(p??"").localeCompare(String(c??""))})}return{stdout:w(o,a),stderr:"",exitCode:0}}V();async function $e(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>ct(p)).join(",")).join(` +`)+` +`,stderr:"",exitCode:0})}function ct(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(` +`)?`"${n.replace(/"/g,'""')}"`:n}async function Te(e,n){let t=null,s=null,r=[];for(let l=0;l0?t=f:r.push(i)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample [FILE] +`,exitCode:1};let{headers:o,data:a,error:d}=await v(r,n);if(d)return d;if(a.length<=t)return{stdout:w(o,a),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),c=a.map((l,i)=>i);for(let l=c.length-1;l>0;l--){let i=Math.floor(p()*(l+1));[c[l],c[i]]=[c[i],c[l]]}let h=c.slice(0,t).sort((l,i)=>l-i).map(l=>a[l]);return{stdout:w(o,h),stderr:"",exitCode:0}}async function je(e,n){let t=!1,s=[];for(let u=0;u0?s:d,h;try{h=J(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}' +`,exitCode:1}}let l=u.filter(i=>{let f=c.some(m=>{let g=i[m];return g!=null&&h.test(String(g))});return r?!f:f});return{stdout:w(d,l),stderr:"",exitCode:0}}async function Ue(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified +`,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let u=U(t).map(({expr:l,name:i})=>({alias:typeof i=="string"?i:i[0],ast:O(l)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c=[...r,...u.map(l=>l.alias)],h=[];for(let l of o){let i=[],f=1;for(let m of u){let g=$(l,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;i.push(y),f=Math.max(f,y.length)}for(let m=0;m [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data. +It provides a simple, ergonomic interface for common data operations. + +COMMANDS: + Core: + headers Show column names + count Count rows + head Show first N rows + tail Show last N rows + slice Extract row range + reverse Reverse row order + behead Remove header row + sample Random sample of rows + + Column operations: + select Select columns (supports glob, ranges, negation) + drop Drop columns + rename Rename columns + enum Add row index column + + Row operations: + filter Filter rows by expression + search Filter rows by regex match + sort Sort rows + dedup Remove duplicates + top Get top N by column + + Transformations: + map Add computed columns + transform Modify existing columns + explode Split column into multiple rows + implode Combine rows, join column values + flatmap Map returning multiple rows + pivot Reshape rows into columns + transpose Swap rows and columns + + Aggregation: + agg Aggregate values + groupby Group and aggregate + frequency Count value occurrences + stats Show column statistics + + Multi-file: + cat Concatenate CSV files + join Join two CSV files on key + merge Merge sorted CSV files + split Split into multiple files + partition Split by column value + + Data conversion: + to Convert CSV to other formats (json) + from Convert other formats to CSV (json) + shuffle Randomly reorder rows + fixlengths Fix ragged CSV files + + Output: + view Pretty print as table + flatten Display records vertically (alias: f) + fmt Format output + +EXAMPLES: + xan headers data.csv + xan count data.csv + xan head -n 5 data.csv + xan select name,email data.csv + xan select 'vec_*' data.csv # glob pattern + xan select 'a:c' data.csv # column range + xan filter 'age > 30' data.csv + xan search -r '^foo' data.csv + xan sort -N price data.csv + xan agg 'sum(amount) as total' data.csv + xan groupby region 'count() as n' data.csv + xan explode tags data.csv + xan join id file1.csv id file2.csv + xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},ft={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},yn={name:"xan",async execute(e,n){if(e.length===0||G(e))return D(Ze);let t=e[0],s=e.slice(1);if(G(s)){let r=ft[t];return r?D(r):D(Ze)}if(Qe.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented +`,exitCode:1};switch(t){case"headers":return ce(s,n);case"count":return pe(s,n);case"head":return fe(s,n);case"tail":return de(s,n);case"slice":return he(s,n);case"reverse":return me(s,n);case"behead":return $e(s,n);case"sample":return Te(s,n);case"select":return ie(s,n);case"drop":return ae(s,n);case"rename":return le(s,n);case"enum":return ue(s,n);case"filter":return ke(s,n);case"search":return De(s,n);case"sort":return Ie(s,n);case"dedup":return Ne(s,n);case"top":return Ee(s,n);case"map":return Ae(s,n);case"transform":return Fe(s,n);case"explode":return Oe(s,n);case"implode":return Le(s,n);case"flatmap":return Ue(s,n);case"pivot":return Re(s,n);case"agg":return ne(s,n);case"groupby":return se(s,n);case"frequency":case"freq":return re(s,n);case"stats":return oe(s,n);case"cat":return je(s,n);case"join":return Pe(s,n);case"merge":return Me(s,n);case"split":return ve(s,n);case"partition":return Ce(s,n);case"to":return be(s,n);case"from":return Se(s,n);case"transpose":return ye(s,n);case"shuffle":return xe(s,n);case"fixlengths":return we(s,n);case"view":return Z(s,n);case"flatten":case"f":return Y(s,n);case"fmt":return Ve(s,n);default:return pt.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented +`,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}' +Run 'xan --help' for usage. +`,exitCode:1}}}},xn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{yn as a,xn as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-G4AUMZUY.js b/packages/just-bash/dist/bin/chunks/chunk-G4AUMZUY.js new file mode 100644 index 00000000..3d73827d --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-G4AUMZUY.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +var o={name:"pwd",async execute(l,a){let t=!1;for(let e of l)if(e==="-P")t=!0;else if(e==="-L")t=!1;else{if(e==="--")break;e.startsWith("-")}let s=a.cwd;if(t)try{s=await a.fs.realpath(a.cwd)}catch{}return{stdout:`${s} +`,stderr:"",exitCode:0}}},f={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]};export{o as a,f as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-GO6FXSC4.js b/packages/just-bash/dist/bin/chunks/chunk-GO6FXSC4.js deleted file mode 100644 index 68604663..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-GO6FXSC4.js +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -import{c as u}from"./chunk-4PRVMER6.js";import{a as l,b as h}from"./chunk-GTNBSMZR.js";var d={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},y={name:"bash",async execute(t,e){if(h(t))return l(d);if(t[0]==="-c"&&t.length>=2){let i=t[1],s=t[2]||"bash",c=t.slice(3);return o(i,s,c,e)}if(t.length===0)return e.stdin?.trim()?o(e.stdin,"bash",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],r=t.slice(1);try{let i=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(i);return o(s,n,r,e)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory -`,exitCode:127}}}},C={name:"sh",async execute(t,e){if(h(t))return l({...d,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let i=t[1],s=t[2]||"sh",c=t.slice(3);return o(i,s,c,e)}if(t.length===0)return e.stdin?.trim()?o(e.stdin,"sh",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],r=t.slice(1);try{let i=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(i);return o(s,n,r,e)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory -`,exitCode:127}}}};async function o(t,e,n,r){if(!r.exec)return{stdout:"",stderr:`bash: internal error: exec function not available -`,exitCode:1};let i=u(r.exportedEnv||{},{0:e,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,m)=>{i[String(m+1)]=a});let s=t;if(s.startsWith("#!")){let a=s.indexOf(` -`);a!==-1&&(s=s.slice(a+1))}return await r.exec(s,{env:i,cwd:r.cwd,stdin:r.stdin,signal:r.signal})}var b={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},P={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"};export{y as a,C as b,b as c,P as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-GOJZHH3L.js b/packages/just-bash/dist/bin/chunks/chunk-GOJZHH3L.js deleted file mode 100644 index b29c4c64..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-GOJZHH3L.js +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -import{a as l}from"./chunk-JBABAK44.js";import{a as i,b as c}from"./chunk-GTNBSMZR.js";var b={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},m={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};async function p(r,o,n){if(o.length===0||o.length===1&&o[0]==="-")return{ok:!0,data:Uint8Array.from(r.stdin,e=>e.charCodeAt(0))};let d=[];for(let e of o){if(e==="-"){d.push(Uint8Array.from(r.stdin,t=>t.charCodeAt(0)));continue}try{let t=r.fs.resolvePath(r.cwd,e),s=await r.fs.readFileBuffer(t);d.push(s)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${e}: No such file or directory -`,exitCode:1}}}}let f=d.reduce((e,t)=>e+t.length,0),u=new Uint8Array(f),a=0;for(let e of d)u.set(e,a),a+=e.length;return{ok:!0,data:u}}var A={name:"base64",async execute(r,o){if(c(r))return i(b);let n=l("base64",r,m);if(!n.ok)return n.error;let d=n.result.flags.decode,f=n.result.flags.wrap,u=n.result.positional;try{if(d){let t=await p(o,u,"base64");if(!t.ok)return t.error;if(typeof Buffer<"u"){let g=Buffer.from(t.data).toString("utf8").replace(/\s/g,"");return{stdout:Buffer.from(g,"base64").toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let h=String.fromCharCode(...t.data).replace(/\s/g,"");return{stdout:atob(h),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let a=await p(o,u,"base64");if(!a.ok)return a.error;let e;if(typeof Buffer<"u"?e=Buffer.from(a.data).toString("base64"):e=btoa(String.fromCharCode(...a.data)),f>0){let t=[];for(let s=0;s0?` -`:"")}return{stdout:e,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input -`,exitCode:1}}}},F={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{A as a,F as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-GTNBSMZR.js b/packages/just-bash/dist/bin/chunks/chunk-GTNBSMZR.js deleted file mode 100644 index 6768256c..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-GTNBSMZR.js +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env node -function s(t){let e=`${t.name} - ${t.summary} - -`;if(e+=`Usage: ${t.usage} -`,t.description){if(e+=` -Description: -`,typeof t.description=="string")for(let n of t.description.split(` -`))e+=n?` ${n} -`:` -`;else if(t.description.length>0)for(let n of t.description)e+=n?` ${n} -`:` -`}if(t.options&&t.options.length>0){e+=` -Options: -`;for(let n of t.options)e+=` ${n} -`}if(t.examples&&t.examples.length>0){e+=` -Examples: -`;for(let n of t.examples)e+=` ${n} -`}if(t.notes&&t.notes.length>0){e+=` -Notes: -`;for(let n of t.notes)e+=` ${n} -`}return{stdout:e,stderr:"",exitCode:0}}function o(t){return t.includes("--help")}function r(t,e){return{stdout:"",stderr:e.startsWith("--")?`${t}: unrecognized option '${e}' -`:`${t}: invalid option -- '${e.replace(/^-/,"")}' -`,exitCode:1}}export{s as a,o as b,r as c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-H7JTIXAO.js b/packages/just-bash/dist/bin/chunks/chunk-H7JTIXAO.js new file mode 100644 index 00000000..4af18752 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-H7JTIXAO.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{c as u,d as m}from"./chunk-VZK4FHWJ.js";async function w(t,n,s){let{cmdName:r,allowStdinMarker:d=!0,stopOnError:i=!1,batchSize:f=100}=s;if(n.length===0)return{files:[{filename:"",content:t.stdin}],stderr:"",exitCode:0};let a=[],c="",l=0;for(let o=0;o{if(d&&e==="-")return{filename:"-",content:t.stdin,error:null};try{let C=t.fs.resolvePath(t.cwd,e),y=await m(t.fs,C);return{filename:e,content:y,error:null}}catch{return{filename:e,content:u,error:`${r}: ${e}: No such file or directory +`}}}));for(let e of p)if(e.error){if(c+=e.error,l=1,i)return{files:a,stderr:c,exitCode:l}}else a.push({filename:e.filename,content:e.content})}return{files:a,stderr:c,exitCode:l}}async function T(t,n,s){let r=await w(t,n,{...s,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(i=>i.content).join("")}}export{w as a,T as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-HL4ZS7TX.js b/packages/just-bash/dist/bin/chunks/chunk-HL4ZS7TX.js new file mode 100644 index 00000000..cc8b20fa --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-HL4ZS7TX.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as g}from"./chunk-LNVSXNT7.js";function v(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return a.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var f=typeof __BROWSER__<"u"&&__BROWSER__;function w(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var x=null;if(!f)try{let{AsyncLocalStorage:a}=g("node:async_hooks");x=a}catch{}var k=` + +This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,d=class extends Error{violation;constructor(e,t){super(e+k),this.violation=t,this.name="SecurityViolationError"}},u=!f&&x?new x:null,T=1e3;function D(a,e,...t){return u.run(a,()=>e(...t))}var m={enabled:!0,auditMode:!1};function E(a){return a===void 0?{...m,enabled:!1}:typeof a=="boolean"?{...m,enabled:a}:{...m,...a}}var _=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=E(e);if(!a.instance)a.instance=new a(t);else{let r=a.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return u?u?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(u)return u?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!u)return e;let t=a.instance,r=u.getStore(),s=r?.sandboxActive===!0?r.executionId:t?.getPreferredActiveExecutionId();if(!s)return e;let n=t?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let i=a.instance;if(!(i&&!i.isExecutionIdActive(s)&&(i.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!i.config.auditMode)))return D(n,e,...o)})}isEnabled(){return this.config.enabled===!0&&u!==null&&!f}updateConfig(e){this.config={...this.config,...e}}activate(){if(f||!this.config.enabled||!u){let r=w(),s=!1;return{run:n=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):n(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=w(),t=!1;return{run:r=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),u.run({sandboxActive:!0,executionId:e},r)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`.${t}`}static runTrusted(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},()=>{a.enterTrustedScope(r);try{let s=e();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{a.leaveTrustedScope(r)}):(a.leaveTrustedScope(r),s)}catch(s){throw a.leaveTrustedScope(r),s}})}static async runTrustedAsync(e){if(!u)return e();let t=u.getStore();if(!t)return e();let{executionId:r}=t;return u.run({...t,trusted:!0},async()=>{a.enterTrustedScope(r);try{return await e()}finally{a.leaveTrustedScope(r)}})}shouldBlock(){if(f||this.config.auditMode||!u)return!1;let e=u?.getStore();return!(e?.sandboxActive!==!0||e.trusted||a.isTrustedScopeActive(e.executionId))}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:u?.getStore()?.executionId};if(this.violations.lengthr.includes(n));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(e.shouldBlock()){let n="Error.prepareStackTrace modification is blocked during script execution",o=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",n);throw new d(n,o)}e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let n=function(...o){return u.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var t=n;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(i,c){if(!u)return Reflect.apply(s,this,[i,c]);let l=u.getStore(),p=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!p)return Reflect.apply(s,this,[i,c]);let h=e.getCachedContext(p),y=(b,P)=>typeof b!="function"?b:n.bind({box:e,executionId:p,captured:h,cb:b,kind:P});return Reflect.apply(s,this,[y(i,"fulfilled"),y(c,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(e,t,r){let s=this;try{let n=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:n});let o=n?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let i=`${t} access is blocked during script execution`,c=s.recordViolation(r,t,i);throw new d(i,c)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),o},set(i){if(s.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=s.recordViolation(r,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,n instanceof Error?n.message:n)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.mainModule modification is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",n);throw new d(n,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",s);throw new d(s,n)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.execPath modification is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",n);throw new d(n,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,r)=>{try{let s=Object.getOwnPropertyDescriptor(t,r);if(s?.configurable){if("value"in s){Object.defineProperty(t,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(t,r,{...s,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag);try{let t=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:t}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(n,o){if(e.shouldBlock()){let i="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",i);throw new d(i,c)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(n,o)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=this,t=g("node:module"),r=new Set;for(let o of t.builtinModules??[]){let i=o.startsWith("node:")?o.slice(5):o;r.add(i);let c=i.indexOf("/");c>0&&r.add(i.slice(0,c))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let i=o.startsWith("node:")?o.slice(5):o;if(!i)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(i)||r.has(i))return!0;let c=i.indexOf("/");return c>0&&r.has(i.slice(0,c))},n=()=>{let o=u?.getStore();return e.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!a.isTrustedScopeActive(o.executionId)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(o,i,c){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let l=`import(${o})`,p=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(e.shouldBlock()){let h=e.recordViolation("dynamic_import_builtin",l,p);throw new d(p,h)}n()&&e.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return c(o,i)}}),a.importHooksRegistered=!0;return}if(typeof t.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(` +`);t.register(`data:text/javascript,${encodeURIComponent(o)}`),a.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!f)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._load!="function")return;let t=e._load,r=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:r});let n=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!f)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._resolveFilename!="function")return;let t=e._resolveFilename,r=Object.getOwnPropertyDescriptor(e,"_resolveFilename");this.originalDescriptors.push({target:e,prop:"_resolveFilename",descriptor:r});let n=this.createBlockingProxy(t,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(e,"_resolveFilename",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:r,violationType:s,strategy:n}=e;try{let o=t[r];if(o===void 0)return;let i=Object.getOwnPropertyDescriptor(t,r);if(this.originalDescriptors.push({target:t,prop:r,descriptor:i}),n==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let c=this.getPathForTarget(t,r),l=typeof o=="function"?this.createBlockingProxy(o,c,s):this.createBlockingObjectProxy(o,c,s,e.allowedKeys);Object.defineProperty(t,r,{value:l,writable:!0,configurable:!0})}}catch(o){let i=this.getPathForTarget(t,r);this.patchFailures.push(i),console.debug(`[DefenseInDepthBox] Could not patch ${i}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:r,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,r,s):delete t[r]}catch(n){let o=this.getPathForTarget(t,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,n instanceof Error?n.message:n)}}this.originalDescriptors=[]}};export{d as a,_ as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-HN2DCT7T.js b/packages/just-bash/dist/bin/chunks/chunk-HN2DCT7T.js new file mode 100644 index 00000000..7545b09e --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-HN2DCT7T.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as p}from"./chunk-VZK4FHWJ.js";import{a as h,b as w,c as b}from"./chunk-MUFNRCMY.js";var g={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};function y(s,r,n){return n?new TextEncoder().encode(s).length:s===" "?8-r%8:s==="\b"?-1:1}function N(s,r){if(s.length===0)return s;let{width:n,breakAtSpaces:u,countBytes:i}=r,l=[],e="",t=0,o=-1,f=0;for(let c=0;cn&&e.length>0?u&&o>=0?(l.push(e.slice(0,o+1)),e=e.slice(o+1)+a,t=t-f-1+d,o=-1,f=0):(l.push(e),e=a,t=d,o=-1,f=0):(e+=a,t+=d,(a===" "||a===" ")&&(o=e.length-1,f=t-d))}return e.length>0&&l.push(e),l.join(` +`)}function m(s,r){if(s==="")return"";let n=s.split(` +`),u=s.endsWith(` +`)&&n[n.length-1]==="";return u&&n.pop(),n.map(l=>N(l,r)).join(` +`)+(u?` +`:"")}var I={name:"fold",execute:async(s,r)=>{if(w(s))return h(g);let n={width:80,breakAtSpaces:!1,countBytes:!1},u=[],i=0;for(;i2){let t=parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e.slice(2)}' +`};n.width=t,i++}else if(e==="-s")n.breakAtSpaces=!0,i++;else if(e==="-b")n.countBytes=!0,i++;else if(e==="-bs"||e==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,i++;else if(e.match(/^-[sb]+w\d+$/)){e.includes("s")&&(n.breakAtSpaces=!0),e.includes("b")&&(n.countBytes=!0);let t=e.replace(/^-[sb]+w/,""),o=parseInt(t,10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${t}' +`};n.width=o,i++}else if(e.match(/^-[sb]+w$/)&&i+1",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(t){let e=String.fromCodePoint(t).toUpperCase();if(e.length>1)return t;let s=String.fromCodePoint(e.codePointAt(0)).toLowerCase();return s.length>1||s.codePointAt(0)!==t?t:e.codePointAt(0)}static toLowerCase(t){let e=String.fromCodePoint(t).toLowerCase();if(e.length>1)return t;let s=String.fromCodePoint(e.codePointAt(0)).toUpperCase();return s.length>1||s.codePointAt(0)!==t?t:e.codePointAt(0)}},l=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let e=t*this.SIZE;return[this.data[e],this.data[e+1],this.data[e+2]]}get length(){return this.data.length/this.SIZE}},b=class i{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new l(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new l(new Uint32Array([0,31,1,127,159,1]));static Cf=new l(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new l(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new l(new Uint32Array([55296,57343,1]));static L=new l(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new l(new Uint32Array([837,837,1]));static Ll=new l(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new l(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new l(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new l(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new l(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new l(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new l(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new l(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new l(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new l(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new l(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new l(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new l(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new l(new Uint32Array([921,953,32,8126,8126,1]));static N=new l(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new l(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new l(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new l(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new l(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new l(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new l(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new l(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new l(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new l(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new l(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new l(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new l(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new l(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new l(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new l(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new l(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new l(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new l(new Uint32Array([8232,8232,1]));static Zp=new l(new Uint32Array([8233,8233,1]));static Zs=new l(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new l(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new l(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new l(new Uint32Array([82944,83526,1]));static Arabic=new l(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new l(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new l(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new l(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new l(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new l(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new l(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new l(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new l(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new l(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new l(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new l(new Uint32Array([10240,10495,1]));static Buginese=new l(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new l(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new l(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new l(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new l(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new l(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new l(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new l(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new l(new Uint32Array([69552,69579,1]));static Common=new l(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new l(new Uint32Array([924,956,32]));static Coptic=new l(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new l(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new l(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new l(new Uint32Array([77712,77810,1]));static Cyrillic=new l(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new l(new Uint32Array([66560,66639,1]));static Devanagari=new l(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new l(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new l(new Uint32Array([71680,71739,1]));static Duployan=new l(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new l(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new l(new Uint32Array([66816,66855,1]));static Elymaic=new l(new Uint32Array([69600,69622,1]));static Ethiopic=new l(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new l(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new l(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new l(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new l(new Uint32Array([66352,66378,1]));static Grantha=new l(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new l(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new l(new Uint32Array([181,837,656]));static Gujarati=new l(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new l(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new l(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new l(new Uint32Array([90368,90425,1]));static Han=new l(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new l(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new l(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new l(new Uint32Array([5920,5940,1]));static Hatran=new l(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new l(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new l(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new l(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new l(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new l(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new l(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new l(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new l(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new l(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new l(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new l(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new l(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new l(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new l(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new l(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new l(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new l(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new l(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new l(new Uint32Array([93504,93561,1]));static Lao=new l(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new l(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new l(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new l(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new l(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new l(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new l(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new l(new Uint32Array([66176,66204,1]));static Lydian=new l(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new l(new Uint32Array([69968,70006,1]));static Makasar=new l(new Uint32Array([73440,73464,1]));static Malayalam=new l(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new l(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new l(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new l(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new l(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new l(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new l(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new l(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new l(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new l(new Uint32Array([67968,67999,1]));static Miao=new l(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new l(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new l(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new l(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new l(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new l(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new l(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new l(new Uint32Array([124112,124153,1]));static Nandinagari=new l(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new l(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new l(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new l(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new l(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new l(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new l(new Uint32Array([5760,5788,1]));static Ol_Chiki=new l(new Uint32Array([7248,7295,1]));static Ol_Onal=new l(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new l(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new l(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new l(new Uint32Array([68224,68255,1]));static Old_Permic=new l(new Uint32Array([66384,66426,1]));static Old_Persian=new l(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new l(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new l(new Uint32Array([68192,68223,1]));static Old_Turkic=new l(new Uint32Array([68608,68680,1]));static Old_Uyghur=new l(new Uint32Array([69488,69513,1]));static Oriya=new l(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new l(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new l(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new l(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new l(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new l(new Uint32Array([72384,72440,1]));static Phags_Pa=new l(new Uint32Array([43072,43127,1]));static Phoenician=new l(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new l(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new l(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new l(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new l(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new l(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new l(new Uint32Array([70016,70111,1]));static Shavian=new l(new Uint32Array([66640,66687,1]));static Siddham=new l(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new l(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new l(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new l(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new l(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new l(new Uint32Array([72272,72354,1]));static Sundanese=new l(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new l(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new l(new Uint32Array([43008,43052,1]));static Syriac=new l(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new l(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new l(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new l(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new l(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new l(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new l(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new l(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new l(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new l(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new l(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new l(new Uint32Array([1920,1969,1]));static Thai=new l(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new l(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new l(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new l(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new l(new Uint32Array([67008,67059,1]));static Toto=new l(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new l(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new l(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new l(new Uint32Array([42240,42539,1]));static Vithkuqi=new l(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new l(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new l(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new l(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new l(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new l(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",i.C],["Cc",i.Cc],["Cf",i.Cf],["Co",i.Co],["Cs",i.Cs],["L",i.L],["Ll",i.Ll],["Lm",i.Lm],["Lo",i.Lo],["Lt",i.Lt],["Lu",i.Lu],["M",i.M],["Mc",i.Mc],["Me",i.Me],["Mn",i.Mn],["N",i.N],["Nd",i.Nd],["Nl",i.Nl],["No",i.No],["P",i.P],["Pc",i.Pc],["Pd",i.Pd],["Pe",i.Pe],["Pf",i.Pf],["Pi",i.Pi],["Po",i.Po],["Ps",i.Ps],["S",i.S],["Sc",i.Sc],["Sk",i.Sk],["Sm",i.Sm],["So",i.So],["Z",i.Z],["Zl",i.Zl],["Zp",i.Zp],["Zs",i.Zs]]);static SCRIPTS=new Map([["Adlam",i.Adlam],["Ahom",i.Ahom],["Anatolian_Hieroglyphs",i.Anatolian_Hieroglyphs],["Arabic",i.Arabic],["Armenian",i.Armenian],["Avestan",i.Avestan],["Balinese",i.Balinese],["Bamum",i.Bamum],["Bassa_Vah",i.Bassa_Vah],["Batak",i.Batak],["Bengali",i.Bengali],["Bhaiksuki",i.Bhaiksuki],["Bopomofo",i.Bopomofo],["Brahmi",i.Brahmi],["Braille",i.Braille],["Buginese",i.Buginese],["Buhid",i.Buhid],["Canadian_Aboriginal",i.Canadian_Aboriginal],["Carian",i.Carian],["Caucasian_Albanian",i.Caucasian_Albanian],["Chakma",i.Chakma],["Cham",i.Cham],["Cherokee",i.Cherokee],["Chorasmian",i.Chorasmian],["Common",i.Common],["Coptic",i.Coptic],["Cuneiform",i.Cuneiform],["Cypriot",i.Cypriot],["Cypro_Minoan",i.Cypro_Minoan],["Cyrillic",i.Cyrillic],["Deseret",i.Deseret],["Devanagari",i.Devanagari],["Dives_Akuru",i.Dives_Akuru],["Dogra",i.Dogra],["Duployan",i.Duployan],["Egyptian_Hieroglyphs",i.Egyptian_Hieroglyphs],["Elbasan",i.Elbasan],["Elymaic",i.Elymaic],["Ethiopic",i.Ethiopic],["Garay",i.Garay],["Georgian",i.Georgian],["Glagolitic",i.Glagolitic],["Gothic",i.Gothic],["Grantha",i.Grantha],["Greek",i.Greek],["Gujarati",i.Gujarati],["Gunjala_Gondi",i.Gunjala_Gondi],["Gurmukhi",i.Gurmukhi],["Gurung_Khema",i.Gurung_Khema],["Han",i.Han],["Hangul",i.Hangul],["Hanifi_Rohingya",i.Hanifi_Rohingya],["Hanunoo",i.Hanunoo],["Hatran",i.Hatran],["Hebrew",i.Hebrew],["Hiragana",i.Hiragana],["Imperial_Aramaic",i.Imperial_Aramaic],["Inherited",i.Inherited],["Inscriptional_Pahlavi",i.Inscriptional_Pahlavi],["Inscriptional_Parthian",i.Inscriptional_Parthian],["Javanese",i.Javanese],["Kaithi",i.Kaithi],["Kannada",i.Kannada],["Katakana",i.Katakana],["Kawi",i.Kawi],["Kayah_Li",i.Kayah_Li],["Kharoshthi",i.Kharoshthi],["Khitan_Small_Script",i.Khitan_Small_Script],["Khmer",i.Khmer],["Khojki",i.Khojki],["Khudawadi",i.Khudawadi],["Kirat_Rai",i.Kirat_Rai],["Lao",i.Lao],["Latin",i.Latin],["Lepcha",i.Lepcha],["Limbu",i.Limbu],["Linear_A",i.Linear_A],["Linear_B",i.Linear_B],["Lisu",i.Lisu],["Lycian",i.Lycian],["Lydian",i.Lydian],["Mahajani",i.Mahajani],["Makasar",i.Makasar],["Malayalam",i.Malayalam],["Mandaic",i.Mandaic],["Manichaean",i.Manichaean],["Marchen",i.Marchen],["Masaram_Gondi",i.Masaram_Gondi],["Medefaidrin",i.Medefaidrin],["Meetei_Mayek",i.Meetei_Mayek],["Mende_Kikakui",i.Mende_Kikakui],["Meroitic_Cursive",i.Meroitic_Cursive],["Meroitic_Hieroglyphs",i.Meroitic_Hieroglyphs],["Miao",i.Miao],["Modi",i.Modi],["Mongolian",i.Mongolian],["Mro",i.Mro],["Multani",i.Multani],["Myanmar",i.Myanmar],["Nabataean",i.Nabataean],["Nag_Mundari",i.Nag_Mundari],["Nandinagari",i.Nandinagari],["New_Tai_Lue",i.New_Tai_Lue],["Newa",i.Newa],["Nko",i.Nko],["Nushu",i.Nushu],["Nyiakeng_Puachue_Hmong",i.Nyiakeng_Puachue_Hmong],["Ogham",i.Ogham],["Ol_Chiki",i.Ol_Chiki],["Ol_Onal",i.Ol_Onal],["Old_Hungarian",i.Old_Hungarian],["Old_Italic",i.Old_Italic],["Old_North_Arabian",i.Old_North_Arabian],["Old_Permic",i.Old_Permic],["Old_Persian",i.Old_Persian],["Old_Sogdian",i.Old_Sogdian],["Old_South_Arabian",i.Old_South_Arabian],["Old_Turkic",i.Old_Turkic],["Old_Uyghur",i.Old_Uyghur],["Oriya",i.Oriya],["Osage",i.Osage],["Osmanya",i.Osmanya],["Pahawh_Hmong",i.Pahawh_Hmong],["Palmyrene",i.Palmyrene],["Pau_Cin_Hau",i.Pau_Cin_Hau],["Phags_Pa",i.Phags_Pa],["Phoenician",i.Phoenician],["Psalter_Pahlavi",i.Psalter_Pahlavi],["Rejang",i.Rejang],["Runic",i.Runic],["Samaritan",i.Samaritan],["Saurashtra",i.Saurashtra],["Sharada",i.Sharada],["Shavian",i.Shavian],["Siddham",i.Siddham],["SignWriting",i.SignWriting],["Sinhala",i.Sinhala],["Sogdian",i.Sogdian],["Sora_Sompeng",i.Sora_Sompeng],["Soyombo",i.Soyombo],["Sundanese",i.Sundanese],["Sunuwar",i.Sunuwar],["Syloti_Nagri",i.Syloti_Nagri],["Syriac",i.Syriac],["Tagalog",i.Tagalog],["Tagbanwa",i.Tagbanwa],["Tai_Le",i.Tai_Le],["Tai_Tham",i.Tai_Tham],["Tai_Viet",i.Tai_Viet],["Takri",i.Takri],["Tamil",i.Tamil],["Tangsa",i.Tangsa],["Tangut",i.Tangut],["Telugu",i.Telugu],["Thaana",i.Thaana],["Thai",i.Thai],["Tibetan",i.Tibetan],["Tifinagh",i.Tifinagh],["Tirhuta",i.Tirhuta],["Todhri",i.Todhri],["Toto",i.Toto],["Tulu_Tigalari",i.Tulu_Tigalari],["Ugaritic",i.Ugaritic],["Vai",i.Vai],["Vithkuqi",i.Vithkuqi],["Wancho",i.Wancho],["Warang_Citi",i.Warang_Citi],["Yezidi",i.Yezidi],["Yi",i.Yi],["Zanabazar_Square",i.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",i.foldL],["Ll",i.foldLl],["Lt",i.foldLt],["Lu",i.foldLu],["M",i.foldM],["Mn",i.foldMn]]);static FOLD_SCRIPT=new Map([["Common",i.foldCommon],["Greek",i.foldGreek],["Inherited",i.foldInherited]]);static Print=new l(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},w=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(t,e){let s=0,n=t.length;for(;sn)continue;let r=t.getLo(s);if(e0&&e>=t.getLo(0)&&this.is32(t,e)}static isUpper(t){if(t<=this.MAX_LATIN1){let e=String.fromCodePoint(t);return e.toUpperCase()===e&&e.toLowerCase()!==e}return this.is(b.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t=161&&t!==173:this.is(b.Print,t)}static simpleFold(t){if(b.CASE_ORBIT.has(t))return b.CASE_ORBIT.get(t);let e=u.toLowerCase(t);return e!==t?e:u.toUpperCase(t)}static equalsIgnoreCase(t,e){if(t<0||e<0||t===e)return!0;if(t<=this.MAX_ASCII&&e<=this.MAX_ASCII)return u.CODES.get("A")<=t&&t<=u.CODES.get("Z")&&(t|=32),u.CODES.get("A")<=e&&e<=u.CODES.get("Z")&&(e|=32),t===e;for(let s=this.simpleFold(t);s!==t;s=this.simpleFold(s))if(s===e)return!0;return!1}},C=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(t){return u.CODES.get("0")<=t&&t<=u.CODES.get("9")||u.CODES.get("a")<=t&&t<=u.CODES.get("z")||u.CODES.get("A")<=t&&t<=u.CODES.get("Z")}static unhex(t){return u.CODES.get("0")<=t&&t<=u.CODES.get("9")?t-u.CODES.get("0"):u.CODES.get("a")<=t&&t<=u.CODES.get("f")?t-u.CODES.get("a")+10:u.CODES.get("A")<=t&&t<=u.CODES.get("F")?t-u.CODES.get("A")+10:-1}static escapeRune(t){let e="";if(w.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(e+="\\"),e+=String.fromCodePoint(t);else switch(t){case u.CODES.get('"'):e+='\\"';break;case u.CODES.get("\\"):e+="\\\\";break;case u.CODES.get(" "):e+="\\t";break;case u.CODES.get(` +`):e+="\\n";break;case u.CODES.get("\r"):e+="\\r";break;case u.CODES.get("\b"):e+="\\b";break;case u.CODES.get("\f"):e+="\\f";break;default:{let s=t.toString(16);t<256?(e+="\\x",s.length===1&&(e+="0"),e+=s):e+=`\\x{${s}}`;break}}return e}static stringToRunes(t){return String(t).split("").map(e=>e.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return u.CODES.get("a")<=t&&t<=u.CODES.get("z")||u.CODES.get("A")<=t&&t<=u.CODES.get("Z")||u.CODES.get("0")<=t&&t<=u.CODES.get("9")||t===u.CODES.get("_")}static emptyOpContext(t,e){let s=0;return t<0&&(s|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===u.CODES.get(` +`)&&(s|=this.EMPTY_BEGIN_LINE),e<0&&(s|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),e===u.CODES.get(` +`)&&(s|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(e)?s|=this.EMPTY_WORD_BOUNDARY:s|=this.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(t){return t.split("").map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(t){return t>w.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let e=[],s=0;for(let n=0;n>6|192,e[s++]=r&63|128):(r&64512)===55296&&n+1>18|240,e[s++]=r>>12&63|128,e[s++]=r>>6&63|128,e[s++]=r&63|128):(e[s++]=r>>12|224,e[s++]=r>>6&63|128,e[s++]=r&63|128)}return e}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let e=[],s=0,n=0;for(;s191&&r<224){let a=t[s++];e[n++]=String.fromCharCode((r&31)<<6|a&63)}else if(r>239&&r<365){let a=t[s++],o=t[s++],h=t[s++],p=((r&7)<<18|(a&63)<<12|(o&63)<<6|h&63)-65536;e[n++]=String.fromCharCode(55296+(p>>10)),e[n++]=String.fromCharCode(56320+(p&1023))}else{let a=t[s++],o=t[s++];e[n++]=String.fromCharCode((r&15)<<12|(a&63)<<6|o&63)}}return e.join("")}}},N1=(i=[],t=0)=>{let e={};for(let s=0;st.codePointAt(0))}length(){return this.charSequence.length}},_=class{static utf16(t){return new v(t)}static utf8(t){return Array.isArray(t)?new F(t):new F(C.stringToUtf8ByteArray(t))}},L=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},z=class extends L{constructor(t,e=0,s=t.length){super(),this.bytes=t,this.start=e,this.end=s}step(t){if(t+=this.start,t>=this.end)return L.EOF();let e=this.bytes[t++]&255;return(e&128)===0?e<<3|1:(e&224)===192?(e=e&31,t>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e<<3|2)):(e&240)===224?(e=e&15,t+1>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e<<3|3)):(e=e&7,t+2>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e<<3|4))}index(t,e){e+=this.start;let s=this.indexOf(this.bytes,t.prefixUTF8,e);return s<0?s:s-e}context(t){t+=this.start;let e=-1;if(t>this.start&&t<=this.end){let n=t-1;if(e=this.bytes[n--],e>=128){let r=t-4;for(r=r&&(this.bytes[n]&192)===128;)n--;n>3}}let s=t>3:-1;return C.emptyOpContext(e,s)}indexOf(t,e,s=0){let n=e.length;if(n===0)return-1;let r=t.length;for(let a=s;a<=r-n;a++)for(let o=0;o0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,s=t{let n=s.codePointAt(0);return n===u.CODES.get("\\")||n===u.CODES.get("$")?`\\${s}`:s}).join(""):t.indexOf("$")<0?t:t.split("").map(s=>s.codePointAt(0)===u.CODES.get("$")?"$$":s).join("")}constructor(t,e){if(t===null)throw new Error("pattern is null");this.patternInput=t;let s=this.patternInput.re2();this.patternGroupCount=s.numberOfCapturingGroups(),this.groups=[],this.namedGroups=s.namedGroups,this.numberOfInstructions=s.numberOfInstructions(),e instanceof I?this.resetMatcherInput(e):Array.isArray(e)?this.resetMatcherInput(_.utf8(e)):this.resetMatcherInput(_.utf16(e))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let e=this.namedGroups[t];if(!Number.isFinite(e))throw new U(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let e=this.namedGroups[t];if(!Number.isFinite(e))throw new U(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new U(`group '${t}' not found`);t=n}let e=this.start(t),s=this.end(t);return e<0&&s<0?null:this.substring(e,s)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new U(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new U("perhaps no match attempted");if(t===0||this.hasGroups)return;let e=this.groups[1]+1;e>this.matcherInputLength&&(e=this.matcherInputLength);let s=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],e,this.anchorFlag,1+this.patternGroupCount);if(!s[0])throw new U("inconsistency in matching group data");this.groups=s[1],this.hasGroups=!0}matches(){return this.genMatch(0,g.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,g.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new U(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,g.UNANCHORED)}genMatch(t,e){let s=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,e,1);return s[0]?(this.groups=s[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=e,!0):!1}substring(t,e){return this.matcherInput.isUTF8Encoding()?C.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,e)):this.matcherInput.asCharSequence().substring(t,e).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,e=!1){let s="",n=this.start(),r=this.end();return this.appendPosu.CODES.get("9")||o*10+a-u.CODES.get("0")>this.patternGroupCount));r++)o=o*10+a-u.CODES.get("0");if(o>this.patternGroupCount)throw new U(`n > number of groups: ${o}`);let h=this.group(o);h!==null&&(e+=h),s=r,r--;continue}else if(a===u.CODES.get("{")){su.CODES.get("9")||o*10+a-u.CODES.get("0")>this.patternGroupCount));r++)o=o*10+a-u.CODES.get("0");if(o>this.patternGroupCount){e+=`$${o}`,s=r,r--;continue}let h=this.group(o);h!==null&&(e+=h),s=r,r--;continue}else if(a===u.CODES.get("<")){s")&&t.codePointAt(o)!==u.CODES.get(" ");)o++;if(o===t.length||t.codePointAt(o)!==u.CODES.get(">")){e+=t.substring(r-1,o+1),s=o+1;continue}let h=t.substring(r+1,o);Object.prototype.hasOwnProperty.call(this.namedGroups,h)?e+=this.group(h):e+=`$<${h}>`,s=o+1}}return s ${this.out}, ${this.arg}`;case i.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case i.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case i.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case i.MATCH:return"match";case i.FAIL:return"fail";case i.NOP:return`nop -> ${this.out}`;case i.RUNE:return this.runes===null?"rune ":["rune ",i.escapeRunes(this.runes),(this.arg&g.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case i.RUNE1:return`rune1 ${i.escapeRunes(this.runes)} -> ${this.out}`;case i.RUNE_ANY:return`any -> ${this.out}`;case i.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},q=class{constructor(){this.inst=null,this.cap=[]}},Y=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let e=this.sparse[t];return ethis.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let e=0;e0?(this.poolSize--,e=this.pool[this.poolSize]):e=new q,e.inst=t,e}freeQueue(t,e=0){let s=t.size-e,n=this.poolSize+s;this.pool.length>3,p=o&7,f=-1,A=0;o!==L.EOF()&&(o=t.step(e+p),f=o>>3,A=o&7);let N;for(e===0?N=C.emptyOpContext(-1,h):N=t.context(e);;){if(r.isEmpty()){if((n&C.EMPTY_BEGIN_TEXT)!==0&&e!==0||this.matched)break;if(this.re2.prefix.length!==0&&f!==this.re2.prefixRune&&t.canCheckPrefix()){let T=t.index(this.re2,e);if(T<0)break;e+=T,o=t.step(e),h=o>>3,p=o&7,o=t.step(e+p),f=o>>3,A=o&7}}!this.matched&&(e===0||s===g.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=e),this.add(r,this.prog.start,e,this.matchcap,N,null));let O=e+p;if(N=t.context(O),this.step(r,a,e,O,h,N,s,e===t.endPos()),p===0||this.ncap===0&&this.matched)break;e+=p,h=f,p=A,h!==-1&&(o=t.step(e+p),f=o>>3,A=o&7);let S=r;r=a,a=S}return this.freeQueue(a),this.matched}step(t,e,s,n,r,a,o,h){let p=this.re2.longest;for(let f=0;f0&&this.matchcap[0]0&&(!p||!this.matched||this.matchcap[1]0&&a.cap!==n&&(a.cap=n.slice(0,this.ncap)),t.denseThreads[o]=a,a=null;break;default:throw new Error("unhandled")}return a}},b1=i=>{let t=-2128831035;for(let e=0;e{if(i.length!==t.length)return!1;for(let e=0;e0;){let a=s.pop();if(e.has(a))continue;e.add(a);let o=this.prog.getInst(a);switch(o.op){case E.MATCH:n=!0;break;case E.ALT:case E.ALT_MATCH:s.push(o.out),s.push(o.arg);break;case E.NOP:case E.CAPTURE:s.push(o.out);break;case E.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(e).sort(),isMatch:n}}getState(t){let e=this.computeClosure(t);if(!e)return null;let s=e.pcs,n=b1(s),r=this.stateCache.get(n);if(r)for(let o=0;o=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let a=new W(s,e.isMatch);return r.push(a),this.stateCount++,a}step(t,e,s){if(s===g.UNANCHORED&&e<=w.MAX_ASCII){let a=t.nextAscii[e];if(a!==null)return a}else{let a=e+(s===g.UNANCHORED?0:w.MAX_RUNE+1);if(t.nextMap.has(a))return t.nextMap.get(a)}let n=[];for(let a=0;a>3,p=o&7;if(p===0)break;if(r=this.step(r,h,s),r===null)return null;if(r.isMatch)if(s===g.ANCHOR_BOTH){if(a+p===n)return!0}else return!0;if(r.nfaStates.length===0&&s!==g.UNANCHORED)return!1;a+=p}return!1}},c=class i{static Op=N1(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=i.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===u.CODES.get("-")?"\\":""}static fromRegexp(t){let e=new i(t.op);return e.flags=t.flags,e.subs=t.subs,e.runes=t.runes,e.cap=t.cap,e.min=t.min,e.max=t.max,e.name=t.name,e.namedGroups=t.namedGroups,e}constructor(t){this.op=t,this.flags=0,this.subs=i.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=i.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case i.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case i.Op.EMPTY_MATCH:t+="(?:)";break;case i.Op.STAR:case i.Op.PLUS:case i.Op.QUEST:case i.Op.REPEAT:{let e=this.subs[0];switch(e.op>i.Op.CAPTURE||e.op===i.Op.LITERAL&&e.runes.length>1?t+=`(?:${e.appendTo()})`:t+=e.appendTo(),this.op){case i.Op.STAR:t+="*";break;case i.Op.PLUS:t+="+";break;case i.Op.QUEST:t+="?";break;case i.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&g.NON_GREEDY)!==0&&(t+="?");break}case i.Op.CONCAT:{for(let e of this.subs)e.op===i.Op.ALTERNATE?t+=`(?:${e.appendTo()})`:t+=e.appendTo();break}case i.Op.ALTERNATE:{let e="";for(let s of this.subs)t+=e,e="|",t+=s.appendTo();break}case i.Op.LITERAL:(this.flags&g.FOLD_CASE)!==0&&(t+="(?i:");for(let e of this.runes)t+=C.escapeRune(e);(this.flags&g.FOLD_CASE)!==0&&(t+=")");break;case i.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case i.Op.ANY_CHAR:t+="(?s:.)";break;case i.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==i.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case i.Op.BEGIN_TEXT:t+="\\A";break;case i.Op.END_TEXT:(this.flags&g.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case i.Op.BEGIN_LINE:t+="^";break;case i.Op.END_LINE:t+="$";break;case i.Op.WORD_BOUNDARY:t+="\\b";break;case i.Op.NO_WORD_BOUNDARY:t+="\\B";break;case i.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===w.MAX_RUNE){t+="^";for(let e=1;e>1];return(t&1)===0?e.out:e.arg}patch(t,e){for(;t!==0;){let s=this.inst[t>>1];(t&1)===0?(t=s.out,s.out=e):(t=s.arg,s.arg=e)}}append(t,e){if(t===0)return e;if(e===0)return t;let s=t;for(;;){let r=this.next(s);if(r===0)break;s=r}let n=this.inst[s>>1];return(s&1)===0?n.out=e:n.arg=e,t}toString(){let t="";for(let e=0;e0){s=[];for(let n=0;nt.min){let n=i.simplify1(c.Op.QUEST,t.flags,e,null);for(let r=t.min+1;r0&&(s+=" ");let r=t[n],a=t[n+1];r===a?s+=`0x${r.toString(16)}`:s+=`0x${r.toString(16)}-0x${a.toString(16)}`}return s+="]",s}static cmp(t,e,s,n){let r=t[e]-s;return r!==0?r:n-t[e+1]}static qsortIntPair(t,e,s){let n=((e+s)/2|0)&-2,r=t[n],a=t[n+1],o=e,h=s;for(;o<=h;){for(;oe&&i.cmp(t,h,r,a)>0;)h-=2;if(o<=h){if(o!==h){let p=t[o];t[o]=t[h],t[h]=p,p=t[o+1],t[o+1]=t[h+1],t[h+1]=p}o+=2,h-=2}}ethis.r[t-1]&&(this.r[t-1]=n);continue}this.r[t]=s,this.r[t+1]=n,t+=2}return this.len=t,this}appendLiteral(t,e){return(e&g.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,e){if(this.len>0){for(let s=2;s<=4;s+=2)if(this.len>=s){let n=this.r[this.len-s],r=this.r[this.len-s+1];if(t<=r+1&&n<=e+1)return tr&&(this.r[this.len-s+1]=e),this}}return this.r[this.len++]=t,this.r[this.len++]=e,this}appendFoldedRange(t,e){if(t<=w.MIN_FOLD&&e>=w.MAX_FOLD)return this.appendRange(t,e);if(ew.MAX_FOLD)return this.appendRange(t,e);tw.MAX_FOLD&&(this.appendRange(w.MAX_FOLD+1,e),e=w.MAX_FOLD);for(let s=t;s<=e;s++){this.appendRange(s,s);for(let n=w.simpleFold(s);n!==s;n=w.simpleFold(n))this.appendRange(n,n)}return this}appendClass(t){for(let e=0;ew.MAX_FOLD)return t;let e=t,s=t;for(t=w.simpleFold(t);t!==s;t=w.simpleFold(t))e>t&&(e=t);return e}static leadingRegexp(t){if(t.op===c.Op.EMPTY_MATCH)return null;if(t.op===c.Op.CONCAT&&t.subs.length>0){let e=t.subs[0];return e.op===c.Op.EMPTY_MATCH?null:e}return t}static literalRegexp(t,e){let s=new c(c.Op.LITERAL);return s.flags=e,s.runes=C.stringToRunes(t),s}static parse(t,e){return new i(t,e).parseInternal()}static parseRepeat(t){let e=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let s=i.parseInt(t);if(s===-1||!t.more())return-1;let n;if(!t.lookingAt(","))n=s;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))n=-1;else if((n=i.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),s<0||s>1e3||n===-2||n>1e3||n>=0&&s>n)throw new m(i.ERR_INVALID_REPEAT_SIZE,t.from(e));return s<<16|n&w.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let e=0;e=u.CODES.get("0")&&t.peek()<=u.CODES.get("9");)t.skip(1);let s=t.from(e);return s.length===0||s.length>1&&s.codePointAt(0)===u.CODES.get("0")?-1:s.length>8?-2:parseFloat(s,10)}static isCharClass(t){return t.op===c.Op.LITERAL&&t.runes.length===1||t.op===c.Op.CHAR_CLASS||t.op===c.Op.ANY_CHAR_NOT_NL||t.op===c.Op.ANY_CHAR}static matchRune(t,e){switch(t.op){case c.Op.LITERAL:return t.runes.length===1&&t.runes[0]===e;case c.Op.CHAR_CLASS:for(let s=0;su.CODES.get("7"))break;case u.CODES.get("0"):{let n=s-u.CODES.get("0");for(let r=1;r<3&&!(!t.more()||t.peek()u.CODES.get("7"));r++)n=n*8+t.peek()-u.CODES.get("0"),t.skip(1);return n}case u.CODES.get("x"):{if(!t.more())break;if(s=t.pop(),s===u.CODES.get("{")){let a=0,o=0;for(;;){if(!t.more())break t;if(s=t.pop(),s===u.CODES.get("}"))break;let h=C.unhex(s);if(h<0||(o=o*16+h,o>w.MAX_RUNE))break t;a++}if(a===0)break t;return o}let n=C.unhex(s);if(!t.more())break;s=t.pop();let r=C.unhex(s);if(n<0||r<0)break;return n*16+r}case u.CODES.get("a"):return u.CODES.get("\x07");case u.CODES.get("f"):return u.CODES.get("\f");case u.CODES.get("n"):return u.CODES.get(` +`);case u.CODES.get("r"):return u.CODES.get("\r");case u.CODES.get("t"):return u.CODES.get(" ");case u.CODES.get("v"):return u.CODES.get("\v");default:if(s<=w.MAX_ASCII&&!C.isalnum(s))return s;break}throw new m(i.ERR_INVALID_ESCAPE,t.from(e))}static parseClassChar(t,e){if(!t.more())throw new m(i.ERR_MISSING_BRACKET,t.from(e));return t.lookingAt("\\")?i.parseEscape(t):t.pop()}static concatRunes(t,e){return[...t,...e]}constructor(t,e=0){this.wholeRegexp=t,this.flags=e,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let e=this.free;return e!==null&&e.subs!==null&&e.subs.length>0?(this.free=e.subs[0],e.reinit(),e.op=t):(e=new c(t),this.numRegexp+=1),e}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>i.MAX_RUNES)throw new m(i.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===c.Op.REPEAT){let e=t.max;e===-1&&(e=t.min),e<=0&&(e=1),e>i.MAX_SIZE/this.repeats?this.repeats=i.MAX_SIZE:this.repeats*=e}if(this.numRegexpi.MAX_SIZE)throw new m(i.ERR_LARGE)}calcSize(t,e=!1){if(!e&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let s=0;switch(t.op){case c.Op.LITERAL:{s=t.runes.length;break}case c.Op.CAPTURE:case c.Op.STAR:{s=2+this.calcSize(t.subs[0]);break}case c.Op.PLUS:case c.Op.QUEST:{s=1+this.calcSize(t.subs[0]);break}case c.Op.CONCAT:{for(let n of t.subs)s=s+this.calcSize(n);break}case c.Op.ALTERNATE:{for(let n of t.subs)s=s+this.calcSize(n);t.subs.length>1&&(s=s+t.subs.length-1);break}case c.Op.REPEAT:{let n=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?s=2+n:s=1+t.min*n;break}s=t.max*n+(t.max-t.min);break}}return s=Math.max(1,s),this.size[t]=s,s}checkHeight(t){if(!(this.numRegexpi.MAX_HEIGHT)throw new m(i.ERR_NESTING_DEPTH)}}calcHeight(t,e=!1){if(!e&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let s=1;for(let n of t.subs){let r=this.calcHeight(n);s<1+r&&(s=1+r)}return this.height[t]=s,s}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,e=t;for(;e>0&&!c.isPseudoOp(this.stack[e-1].op);)e--;let s=this.stack.slice(e,t);return this.stack=this.stack.slice(0,e),s}push(t){if(this.numRunes+=t.runes.length,t.op===c.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=c.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===c.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&w.simpleFold(t.runes[0])===t.runes[2]&&w.simpleFold(t.runes[2])===t.runes[0]||t.op===c.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&w.simpleFold(t.runes[0])===t.runes[1]&&w.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|g.FOLD_CASE))return null;t.op=c.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|g.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,e){let s=this.stack.length;if(s<2)return!1;let n=this.stack[s-1],r=this.stack[s-2];return n.op!==c.Op.LITERAL||r.op!==c.Op.LITERAL||(n.flags&g.FOLD_CASE)!==(r.flags&g.FOLD_CASE)?!1:(r.runes=i.concatRunes(r.runes,n.runes),t>=0?(n.runes=[t],n.flags=e,!0):(this.pop(),this.reuse(n),!1))}newLiteral(t,e){let s=this.newRegexp(c.Op.LITERAL);return s.flags=e,(e&g.FOLD_CASE)!==0&&(t=i.minFoldRune(t)),s.runes=[t],s}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let e=this.newRegexp(t);return e.flags=this.flags,this.push(e)}repeat(t,e,s,n,r,a){let o=this.flags;if((o&g.PERL_X)!==0&&(r.more()&&r.lookingAt("?")&&(r.skip(1),o^=g.NON_GREEDY),a!==-1))throw new m(i.ERR_INVALID_REPEAT_OP,r.from(a));let h=this.stack.length;if(h===0)throw new m(i.ERR_MISSING_REPEAT_ARGUMENT,r.from(n));let p=this.stack[h-1];if(c.isPseudoOp(p.op))throw new m(i.ERR_MISSING_REPEAT_ARGUMENT,r.from(n));let f=this.newRegexp(t);if(f.min=e,f.max=s,f.flags=o,f.subs=[p],this.stack[h-1]=f,this.checkLimits(f),t===c.Op.REPEAT&&(e>=2||s>=2)&&!this.repeatIsValid(f,1e3))throw new m(i.ERR_INVALID_REPEAT_SIZE,r.from(n))}repeatIsValid(t,e){if(t.op===c.Op.REPEAT){let s=t.max;if(s===0)return!0;if(s<0&&(s=t.min),s>e)return!1;s>0&&(e=Math.trunc(e/s))}for(let s of t.subs)if(!this.repeatIsValid(s,e))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(c.Op.EMPTY_MATCH)):this.push(this.collapse(t,c.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(c.Op.NO_MATCH)):this.push(this.collapse(t,c.Op.ALTERNATE))}cleanAlt(t){t.op===c.Op.CHAR_CLASS&&(t.runes=new x(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===w.MAX_RUNE?(t.runes=[],t.op=c.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===u.CODES.get(` +`)-1&&t.runes[2]===u.CODES.get(` +`)+1&&t.runes[3]===w.MAX_RUNE&&(t.runes=[],t.op=c.Op.ANY_CHAR_NOT_NL))}collapse(t,e){if(t.length===1)return t[0];let s=0;for(let o of t)s+=o.op===e?o.subs.length:1;let n=new Array(s).fill(null),r=0;for(let o of t)o.op===e?(n.splice(r,o.subs.length,...o.subs),r+=o.subs.length,this.reuse(o)):n[r++]=o;let a=this.newRegexp(e);if(a.subs=n,e===c.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let o=a;a=a.subs[0],this.reuse(o)}return a}factor(t){if(t.length<2)return t;let e=0,s=t.length,n=0,r=null,a=0,o=0,h=0;for(let f=0;f<=s;f++){let A=null,N=0,O=0;if(f0&&(S=S.subs[0]),S.op===c.Op.LITERAL&&(A=S.runes,N=S.runes.length,O=S.flags&g.FOLD_CASE),O===o){let T=0;for(;T0){a=T;continue}}}if(f!==h)if(f===h+1)t[n++]=t[e+h];else{let S=this.newRegexp(c.Op.LITERAL);S.flags=o,S.runes=r.slice(0,a);for(let k=h;k0){let s=this.removeLeadingString(t.subs[0],e);if(t.subs[0]=s,s.op===c.Op.EMPTY_MATCH)switch(this.reuse(s),t.subs.length){case 0:case 1:t.op=c.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let n=t;t=t.subs[1],this.reuse(n);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===c.Op.LITERAL&&(t.runes=t.runes.slice(e,t.runes.length),t.runes.length===0&&(t.op=c.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,e){if(t.op===c.Op.CONCAT&&t.subs.length>0){switch(e&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=c.Op.EMPTY_MATCH,t.subs=c.emptySubs();break}case 1:{let s=t;t=t.subs[0],this.reuse(s);break}}return t}return e&&this.reuse(t),this.newRegexp(c.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&g.LITERAL)!==0)return i.literalRegexp(this.wholeRegexp,this.flags);let t=-1,e=-1,s=-1,n=new t1(this.wholeRegexp);for(;n.more();){let a=-1;t:switch(n.peek()){case u.CODES.get("("):if((this.flags&g.PERL_X)!==0&&n.lookingAt("(?")){this.parsePerlFlags(n);break}this.op(c.Op.LEFT_PAREN).cap=++this.numCap,n.skip(1);break;case u.CODES.get("|"):this.parseVerticalBar(),n.skip(1);break;case u.CODES.get(")"):this.parseRightParen(),n.skip(1);break;case u.CODES.get("^"):(this.flags&g.ONE_LINE)!==0?this.op(c.Op.BEGIN_TEXT):this.op(c.Op.BEGIN_LINE),n.skip(1);break;case u.CODES.get("$"):(this.flags&g.ONE_LINE)!==0?this.op(c.Op.END_TEXT).flags|=g.WAS_DOLLAR:this.op(c.Op.END_LINE),n.skip(1);break;case u.CODES.get("."):(this.flags&g.DOT_NL)!==0?this.op(c.Op.ANY_CHAR):this.op(c.Op.ANY_CHAR_NOT_NL),n.skip(1);break;case u.CODES.get("["):this.parseClass(n);break;case u.CODES.get("*"):case u.CODES.get("+"):case u.CODES.get("?"):{a=n.pos();let o=null;switch(n.pop()){case u.CODES.get("*"):o=c.Op.STAR;break;case u.CODES.get("+"):o=c.Op.PLUS;break;case u.CODES.get("?"):o=c.Op.QUEST;break}this.repeat(o,e,s,a,n,t);break}case u.CODES.get("{"):{a=n.pos();let o=i.parseRepeat(n);if(o<0){n.rewindTo(a),this.literal(n.pop());break}e=o>>16,s=(o&w.MAX_BMP)<<16>>16,this.repeat(c.Op.REPEAT,e,s,a,n,t);break}case u.CODES.get("\\"):{let o=n.pos();if(n.skip(1),(this.flags&g.PERL_X)!==0&&n.more())switch(n.pop()){case u.CODES.get("A"):this.op(c.Op.BEGIN_TEXT);break t;case u.CODES.get("b"):this.op(c.Op.WORD_BOUNDARY);break t;case u.CODES.get("B"):this.op(c.Op.NO_WORD_BOUNDARY);break t;case u.CODES.get("C"):throw new m(i.ERR_INVALID_ESCAPE,"\\C");case u.CODES.get("Q"):{let A=n.rest(),N=A.indexOf("\\E");N>=0&&(A=A.substring(0,N)),n.skipString(A),n.skipString("\\E");let O=0;for(;O");if(h<0)throw new m(i.ERR_INVALID_NAMED_CAPTURE,s);let p=s.substring(o,h);if(t.skipString(p),t.skip(o+1),!i.isValidCaptureName(p))throw new m(i.ERR_INVALID_NAMED_CAPTURE,s.substring(0,h+1));let f=this.op(c.Op.LEFT_PAREN);if(f.cap=++this.numCap,this.namedGroups[p])throw new m(i.ERR_DUPLICATE_NAMED_CAPTURE,p);this.namedGroups[p]=this.numCap,f.name=p;return}t.skip(2);let n=this.flags,r=1,a=!1;t:for(;t.more();){let o=t.pop();switch(o){case u.CODES.get("i"):n|=g.FOLD_CASE,a=!0;break;case u.CODES.get("m"):n&=-17,a=!0;break;case u.CODES.get("s"):n|=g.DOT_NL,a=!0;break;case u.CODES.get("U"):n|=g.NON_GREEDY,a=!0;break;case u.CODES.get("-"):if(r<0)break t;r=-1,n=~n,a=!1;break;case u.CODES.get(":"):case u.CODES.get(")"):if(r<0){if(!a)break t;n=~n}o===u.CODES.get(":")&&this.op(c.Op.LEFT_PAREN),this.flags=n;return;default:break t}}throw new m(i.ERR_INVALID_PERL_OP,t.from(e))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(c.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===c.Op.VERTICAL_BAR&&i.isCharClass(this.stack[t-1])&&i.isCharClass(this.stack[t-3])){let e=this.stack[t-1],s=this.stack[t-3];if(e.op>s.op){let n=s;s=e,e=n,this.stack[t-3]=s}return i.mergeCharClass(s,e),this.reuse(e),this.pop(),!0}if(t>=2){let e=this.stack[t-1],s=this.stack[t-2];if(s.op===c.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=s,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new m(i.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let e=this.pop(),s=this.pop();if(s.op!==c.Op.LEFT_PAREN)throw new m(i.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=s.flags,s.cap===0?this.push(e):(s.op=c.Op.CAPTURE,s.subs=[e],this.push(s))}parsePerlClassEscape(t,e){let s=t.pos();if((this.flags&g.PERL_X)===0||!t.more()||t.pop()!==u.CODES.get("\\")||!t.more())return!1;t.pop();let n=t.from(s),r=h1.has(n)?h1.get(n):null;return r===null?!1:(e.appendGroup(r,(this.flags&g.FOLD_CASE)!==0),!0)}parseNamedClass(t,e){let s=t.rest(),n=s.indexOf(":]");if(n<0)return!1;let r=s.substring(0,n+2);t.skipString(r);let a=T1.has(r)?T1.get(r):null;if(a===null)throw new m(i.ERR_INVALID_CHAR_RANGE,r);return e.appendGroup(a,(this.flags&g.FOLD_CASE)!==0),!0}parseUnicodeClass(t,e){let s=t.pos();if((this.flags&g.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let n=1,r=t.pop();if(r===u.CODES.get("P")&&(n=-1),!t.more())throw t.rewindTo(s),new m(i.ERR_INVALID_CHAR_RANGE,t.rest());r=t.pop();let a;if(r!==u.CODES.get("{"))a=C.runeToString(r);else{let f=t.rest(),A=f.indexOf("}");if(A<0)throw t.rewindTo(s),new m(i.ERR_INVALID_CHAR_RANGE,t.rest());a=f.substring(0,A),t.skipString(a),t.skip(1)}a.length!==0&&a.codePointAt(0)===u.CODES.get("^")&&(n=0-n,a=a.substring(1));let o=i.unicodeTable(a);if(o===null)throw new m(i.ERR_INVALID_CHAR_RANGE,t.from(s));let h=o.first,p=o.second;if((this.flags&g.FOLD_CASE)===0||p===null)e.appendTableWithSign(h,n);else{let f=new x().appendTable(h).appendTable(p).cleanClass().toArray();e.appendClassWithSign(f,n)}return!0}parseClass(t){let e=t.pos();t.skip(1);let s=this.newRegexp(c.Op.CHAR_CLASS);s.flags=this.flags;let n=new x,r=1;t.more()&&t.lookingAt("^")&&(r=-1,t.skip(1),(this.flags&g.CLASS_NL)===0&&n.appendRange(u.CODES.get(` +`),u.CODES.get(` +`)));let a=!0;for(;!t.more()||t.peek()!==u.CODES.get("]")||a;){if(t.more()&&t.lookingAt("-")&&(this.flags&g.PERL_X)===0&&!a){let f=t.rest();if(f==="-"||!f.startsWith("-]"))throw t.rewindTo(e),new m(i.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;let o=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,n))continue;t.rewindTo(o)}if(this.parseUnicodeClass(t,n)||this.parsePerlClassEscape(t,n))continue;t.rewindTo(o);let h=i.parseClassChar(t,e),p=h;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(p=i.parseClassChar(t,e),p0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=n.namedGroups,o}static match(t,e){return i.compile(t).match(e)}constructor(t,e,s=0,n=0){this.expr=t,this.prog=e,this.numSubexp=s,this.longest=n,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new s1,this.dfa=new K(e)}executeEngine(t,e,s,n){if(n>0)return this.doExecuteNFA(t,e,s,n);let r=this.dfa.match(t,e,s);return r!==null?r?[]:null:this.doExecuteNFA(t,e,s,n)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,e){let s=this.pooled.get();do s=this.pooled.get(),!e&&s&&(t=M.fromMachine(t),e=!0),t.next!==s&&(t.next=s);while(!this.pooled.compareAndSet(s,t))}toString(){return this.expr}doExecuteNFA(t,e,s,n){let r=this.get(),a=!1;r?r.next!==null&&(r=M.fromMachine(r),a=!0):(r=M.fromRE2(this),a=!0),r.init(n);let o=r.match(t,e,s)?r.submatches():null;return this.put(r,a),o}match(t){return this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,0)!==null}matchWithGroup(t,e,s,n,r){return t instanceof I||(t=_.utf16(t)),this.matchMachineInput(t,e,s,n,r)}matchMachineInput(t,e,s,n,r){if(e>s)return[!1,null];let a=t.isUTF16Encoding()?R.fromUTF16(t.asCharSequence(),0,s):R.fromUTF8(t.asBytes(),0,s),o=this.executeEngine(a,e,n,2*r);return o===null?[!1,null]:[!0,o]}matchUTF8(t){return this.executeEngine(R.fromUTF8(t),0,g.UNANCHORED,0)!==null}replaceAll(t,e){return this.replaceAllFunc(t,()=>e,2*t.length+1)}replaceFirst(t,e){return this.replaceAllFunc(t,()=>e,1)}replaceAllFunc(t,e,s){let n=0,r=0,a="",o=R.fromUTF16(t),h=0;for(;r<=t.length;){let p=this.executeEngine(o,r,g.UNANCHORED,2);if(p===null||p.length===0)break;a+=t.substring(n,p[0]),(p[1]>n||p[0]===0)&&(a+=e(t.substring(p[0],p[1])),h++),n=p[1];let f=o.step(r)&7;if(r+f>p[1]?r+=f:r+1>p[1]?r++:r=p[1],h>=s)break}return a+=t.substring(n),a}pad(t){if(t===null)return null;let e=(1+this.numSubexp)*2;if(t.lengthn){let n=[],r=t.endPos();e<0&&(e=r+1);let a=0,o=0,h=-1;for(;o=0&&(s[n]=t.slice(e[2*n],e[2*n+1]));return s}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(R.fromUTF8(t),0,g.UNANCHORED,this.prog.numCap))}findSubmatch(t){let e=this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,this.prog.numCap);if(e===null)return null;let s=new Array(1+this.numSubexp).fill(null);for(let n=0;n=0&&(s[n]=t.substring(e[2*n],e[2*n+1]));return s}findSubmatchIndex(t){return this.pad(this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,this.prog.numCap))}findAllUTF8(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>t.slice(n[0],n[1]));return s.length===0?null:s}findAllUTF8Index(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>n.slice(0,2));return s.length===0?null:s}findAll(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>t.substring(n[0],n[1]));return s.length===0?null:s}findAllIndex(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>n.slice(0,2));return s.length===0?null:s}findAllUTF8Submatch(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>{let r=new Array(n.length/2|0).fill(null);for(let a=0;a=0&&(r[a]=t.slice(n[2*a],n[2*a+1]));return r});return s.length===0?null:s}findAllUTF8SubmatchIndex(t,e){let s=this.allMatches(R.fromUTF8(t),e);return s.length===0?null:s}findAllSubmatch(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>{let r=new Array(n.length/2|0).fill(null);for(let a=0;a=0&&(r[a]=t.substring(n[2*a],n[2*a+1]));return r});return s.length===0?null:s}findAllSubmatchIndex(t,e){let s=this.allMatches(R.fromUTF16(t),e);return s.length===0?null:s}},i1=class i{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let e=t.charCodeAt(0);return e<128?1:e<2048?2:e<65536?3:4}static translate(t){if(typeof t!="string")return t;let e="",s=!1,n=t.length;n===0&&(e="(?:)",s=!0);let r=0;for(;r>4).toString(16).toUpperCase(),e+=(h.charCodeAt(0)-64&15).toString(16).toUpperCase(),r+=3,s=!0;continue}}e+="\\c",r+=2;continue}case"u":{if(r+2=n||t[r+3]!=="="&&t[r+3]!=="!")){e+="(?P<",r+=3,s=!0;continue}let o=i.getUtf8CharSize(a);e+=t.substring(r,r+o),r+=o}return s?e:t}},y=class i{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return C.quoteMeta(t)}static quoteReplacement(t,e=!1){return B.quoteReplacement(t,e)}static translateRegExp(t){return i1.translate(t)}static compile(t,e=0){let s=t;if((e&i.CASE_INSENSITIVE)!==0&&(s=`(?i)${s}`),(e&i.DOTALL)!==0&&(s=`(?s)${s}`),(e&i.MULTILINE)!==0&&(s=`(?m)${s}`),(e&~(i.MULTILINE|i.DOTALL|i.CASE_INSENSITIVE|i.DISABLE_UNICODE_GROUPS|i.LONGEST_MATCH))!==0)throw new V("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let n=g.PERL;(e&i.DISABLE_UNICODE_GROUPS)!==0&&(n&=-129);let r=new i(t,e);return r.re2Input=n1.compileImpl(s,n,(e&i.LONGEST_MATCH)!==0),r}static matches(t,e){return i.compile(t).testExact(e)}static initTest(t,e,s){if(t==null)throw new Error("pattern is null");if(s==null)throw new Error("re2 is null");let n=new i(t,e);return n.re2Input=s,n}constructor(t,e){this.patternInput=t,this.flagsInput=e}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=_.utf8(t)),new B(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let e=Array.isArray(t)?R.fromUTF8(t):R.fromUTF16(t);return this.re2Input.executeEngine(e,0,g.ANCHOR_BOTH,0)!==null}split(t,e=0){let s=this.matcher(t),n=[],r=0,a=0;for(;s.find();){if(a===0&&s.end()===0){a=s.end();continue}if(e>0&&n.length===e-1)break;if(a===s.start()){if(e===0){r+=1,a=s.end();continue}}else for(;r>0;)n.push(""),r-=1;n.push(s.substring(a,s.start())),a=s.end()}if(e===0&&a!==s.inputLength()){for(;r>0;)n.push(""),r-=1;n.push(s.substring(a,s.inputLength()))}return(e!==0||n.length===0)&&n.push(s.substring(a,s.inputLength())),n}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}};function x1(i){let t=0;return i.includes("i")&&(t|=y.CASE_INSENSITIVE),i.includes("m")&&(t|=y.MULTILINE),i.includes("s")&&(t|=y.DOTALL),t}function L1(i){return y.translateRegExp(i)}var X=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}constructor(t,e=""){this._pattern=t,this._flags=e,this._global=e.includes("g"),this._ignoreCase=e.includes("i"),this._multiline=e.includes("m");try{let s=L1(t),n=x1(e);this._re2=y.compile(s,n)}catch(s){if(s instanceof m){let n=s.message||"",r="";throw n.includes("(?=")||n.includes("(?!")||n.includes("(?<")||n.includes("(?0){let h=Object.create(null);for(let[p,f]of Object.entries(o)){let A=e.group(f);A!==null&&(h[p]=A)}a.groups=h}return this._global&&(this._lastIndex=e.end(0),e.start(0)===e.end(0)&&this._lastIndex++),a}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let e=[],s=this._re2.matcher(t),n=0;for(;s.find(n);){let r=s.group(0)??"";if(e.push(r),n=s.end(0),s.start(0)===s.end(0)&&n++,n>t.length)break}return e.length>0?e:null}replace(t,e){if(this._global&&(this._lastIndex=0),typeof e=="string"){let p=this._re2.matcher(t);return this._global?p.replaceAll(e,!0):p.replaceFirst(e,!0)}let s=[],n=this._re2.matcher(t),r=0,a=0,o=this._re2.groupCount(),h=this._re2.namedGroups();for(;n.find(a);){s.push(t.slice(r,n.start(0)));let p=[],f=n.group(0)??"";for(let A=1;A<=o;A++)p.push(n.group(A));if(p.push(n.start(0)),p.push(t),h&&Object.keys(h).length>0){let A=Object.create(null);for(let[N,O]of Object.entries(h))A[N]=n.group(O)??"";p.push(A)}if(s.push(e(f,...p)),r=n.end(0),a=r,n.start(0)===n.end(0)&&a++,!this._global||a>t.length)break}return s.push(t.slice(r)),s.join("")}split(t,e){return e===void 0||e<0?this._re2.split(t,-1):e===0?[]:this._re2.split(t,-1).slice(0,e)}search(t){let e=this._re2.matcher(t);return e.find()?e.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let e=this._re2.matcher(t),s=this._re2.groupCount(),n=this._re2.namedGroups(),r=0;for(;e.find(r);){let a=[];a.push(e.group(0)??"");for(let h=1;h<=s;h++)a.push(e.group(h));let o=a;if(o.index=e.start(0),o.input=t,n&&Object.keys(n).length>0){let h=Object.create(null);for(let[p,f]of Object.entries(n)){let A=e.group(f);A!==null&&(h[p]=A)}o.groups=h}if(yield o,r=e.end(0),e.start(0)===e.end(0)&&r++,r>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(t){this._lastIndex=t}};function I1(i,t=""){return new X(i,t)}var r1=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,e){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,e)}split(t,e){return t.split(this._regex,e)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let e=this._regex.exec(t);for(;e!==null;)yield e,e[0].length===0&&this._regex.lastIndex++,e=this._regex.exec(t)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(t){this._regex.lastIndex=t}};export{I1 as a,r1 as b}; +/*! Bundled license information: + +re2js/build/index.esm.js: + (*! + * re2js + * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching + * + * @version v1.4.0 + * @author Alexey Vasiliev + * @homepage https://github.com/le0pard/re2js#readme + * @repository github:le0pard/re2js + * @license MIT + *) +*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-ITA43A73.js b/packages/just-bash/dist/bin/chunks/chunk-ITA43A73.js deleted file mode 100644 index 05148d49..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-ITA43A73.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -import{a as m}from"./chunk-4VDEBYW7.js";import{c}from"./chunk-GTNBSMZR.js";function h(s){let a=s.replace(/\//g,"-"),r=new Date(a);if(!Number.isNaN(r.getTime()))return r;let i=a.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(i){let[,o,l,f]=i;if(r=new Date(Number.parseInt(o,10),Number.parseInt(l,10)-1,Number.parseInt(f,10)),!Number.isNaN(r.getTime()))return r}let u=a.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/);if(u){let[,o,l,f,t,e,d]=u;if(r=new Date(Number.parseInt(o,10),Number.parseInt(l,10)-1,Number.parseInt(f,10),Number.parseInt(t,10),Number.parseInt(e,10),Number.parseInt(d,10)),!Number.isNaN(r.getTime()))return r}return null}var N={name:"touch",async execute(s,a){let r=[],i=null,u=!1;for(let t=0;t=s.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd' -`,exitCode:1};i=s[++t]}else if(e.startsWith("--date="))i=e.slice(7);else if(e==="-c"||e==="--no-create")u=!0;else if(e==="-a"||e==="-m"||e==="-r"||e==="-t")(e==="-r"||e==="-t")&&t++;else{if(e.startsWith("--"))return c("touch",e);if(e.startsWith("-")&&e.length>1){let d=!1;for(let n of e.slice(1))if(n==="c")u=!0;else if(!(n==="a"||n==="m"))if(n==="d"){if(t+1>=s.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd' -`,exitCode:1};i=s[++t],d=!0;break}else if(n==="r"||n==="t"){t++,d=!0;break}else return c("touch",`-${n}`);if(d)continue}else r.push(e)}}if(r.length===0)return{stdout:"",stderr:`touch: missing file operand -`,exitCode:1};let o=null;if(i!==null&&(o=h(i),o===null))return{stdout:"",stderr:`touch: invalid date format '${i}' -`,exitCode:1};let l="",f=0;for(let t of r)try{let e=a.fs.resolvePath(a.cwd,t);if(!await a.fs.exists(e)){if(u)continue;await a.fs.writeFile(e,"")}let n=o??new Date;await a.fs.utimes(e,n,n)}catch(e){l+=`touch: cannot touch '${t}': ${m(e)} -`,f=1}return{stdout:"",stderr:l,exitCode:f}}},b={name:"touch",flags:[{flag:"-c",type:"boolean"},{flag:"-a",type:"boolean"},{flag:"-m",type:"boolean"},{flag:"-d",type:"value",valueHint:"string"}],needsArgs:!0};export{N as a,b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-IZGLHVBB.js b/packages/just-bash/dist/bin/chunks/chunk-IZGLHVBB.js new file mode 100644 index 00000000..8b984aec --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-IZGLHVBB.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as f}from"./chunk-VZK4FHWJ.js";import{a,b as c,c as d}from"./chunk-MUFNRCMY.js";var u={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};function p(r){return Array.from(r).reverse().join("")}var g={name:"rev",execute:async(r,s)=>{if(c(r))return a(u);let o=[];for(let e of r)if(e==="--"){let t=r.indexOf(e);o.push(...r.slice(t+1));break}else{if(e.startsWith("-")&&e!=="-")return d("rev",e);o.push(e)}let n="",l=e=>{let t=e.split(` +`),i=e.endsWith(` +`)&&t[t.length-1]==="";return i&&t.pop(),t.map(p).join(` +`)+(i?` +`:"")};if(o.length===0){let e=f(s.stdin)??"";n=l(e)}else for(let e of o)if(e==="-"){let t=f(s.stdin)??"";n+=l(t)}else{let t=s.fs.resolvePath(s.cwd,e),i=await s.fs.readFile(t);if(i===null)return{exitCode:1,stdout:n,stderr:`rev: ${e}: No such file or directory +`};n+=l(i)}return{exitCode:0,stdout:n,stderr:""}}},y={name:"rev",flags:[],stdinType:"text",needsFiles:!0};export{g as a,y as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-J7TUF2VI.js b/packages/just-bash/dist/bin/chunks/chunk-J7TUF2VI.js new file mode 100644 index 00000000..76343322 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-J7TUF2VI.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as m}from"./chunk-VZK4FHWJ.js";import{a as x}from"./chunk-NE4R2FVV.js";import{a as g,b as y}from"./chunk-MUFNRCMY.js";var L={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},T={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},w={name:"paste",async execute(s,n){if(y(s))return g(L);let i=x("paste",s,T);if(!i.ok)return i.error;let l=i.result.flags.delimiter,d=i.result.flags.serial,p=i.result.positional;if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ... +`,exitCode:1};let c=m(n.stdin),a=c?c.split(` +`):[""];a.length>0&&a[a.length-1]===""&&a.pop();let F=p.filter(e=>e==="-").length,f=[],h=0;for(let e of p)if(e==="-"){let t=[];for(let o=h;o0&&r[r.length-1]===""&&r.pop(),f.push(r)}catch{return{stdout:"",stderr:`paste: ${e}: No such file or directory +`,exitCode:1}}}let u="";if(d)for(let e of f)e&&(u+=`${I(e,l)} +`);else{let e=Math.max(...f.map(t=>t?.length??0));for(let t=0;t=i.length)return{ok:!1,error:{stdout:"",stderr:`${a}: option '--${o}' requires an argument -`,exitCode:1}};r=i[++t]}s[f]=u==="number"?parseInt(r,10):r}}else{let n=e.slice(1);for(let o=0;o",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(t){let e=String.fromCodePoint(t).toUpperCase();if(e.length>1)return t;let s=String.fromCodePoint(e.codePointAt(0)).toLowerCase();return s.length>1||s.codePointAt(0)!==t?t:e.codePointAt(0)}static toLowerCase(t){let e=String.fromCodePoint(t).toLowerCase();if(e.length>1)return t;let s=String.fromCodePoint(e.codePointAt(0)).toUpperCase();return s.length>1||s.codePointAt(0)!==t?t:e.codePointAt(0)}},l=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let e=t*this.SIZE;return[this.data[e],this.data[e+1],this.data[e+2]]}get length(){return this.data.length/this.SIZE}},b=class i{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new l(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new l(new Uint32Array([0,31,1,127,159,1]));static Cf=new l(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new l(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new l(new Uint32Array([55296,57343,1]));static L=new l(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new l(new Uint32Array([837,837,1]));static Ll=new l(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new l(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new l(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new l(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new l(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new l(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new l(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new l(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new l(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new l(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new l(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new l(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new l(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new l(new Uint32Array([921,953,32,8126,8126,1]));static N=new l(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new l(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new l(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new l(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new l(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new l(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new l(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new l(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new l(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new l(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new l(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new l(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new l(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new l(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new l(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new l(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new l(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new l(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new l(new Uint32Array([8232,8232,1]));static Zp=new l(new Uint32Array([8233,8233,1]));static Zs=new l(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new l(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new l(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new l(new Uint32Array([82944,83526,1]));static Arabic=new l(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new l(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new l(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new l(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new l(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new l(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new l(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new l(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new l(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new l(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new l(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new l(new Uint32Array([10240,10495,1]));static Buginese=new l(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new l(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new l(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new l(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new l(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new l(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new l(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new l(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new l(new Uint32Array([69552,69579,1]));static Common=new l(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new l(new Uint32Array([924,956,32]));static Coptic=new l(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new l(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new l(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new l(new Uint32Array([77712,77810,1]));static Cyrillic=new l(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new l(new Uint32Array([66560,66639,1]));static Devanagari=new l(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new l(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new l(new Uint32Array([71680,71739,1]));static Duployan=new l(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new l(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new l(new Uint32Array([66816,66855,1]));static Elymaic=new l(new Uint32Array([69600,69622,1]));static Ethiopic=new l(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new l(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new l(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new l(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new l(new Uint32Array([66352,66378,1]));static Grantha=new l(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new l(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new l(new Uint32Array([181,837,656]));static Gujarati=new l(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new l(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new l(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new l(new Uint32Array([90368,90425,1]));static Han=new l(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new l(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new l(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new l(new Uint32Array([5920,5940,1]));static Hatran=new l(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new l(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new l(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new l(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new l(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new l(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new l(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new l(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new l(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new l(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new l(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new l(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new l(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new l(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new l(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new l(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new l(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new l(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new l(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new l(new Uint32Array([93504,93561,1]));static Lao=new l(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new l(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new l(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new l(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new l(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new l(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new l(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new l(new Uint32Array([66176,66204,1]));static Lydian=new l(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new l(new Uint32Array([69968,70006,1]));static Makasar=new l(new Uint32Array([73440,73464,1]));static Malayalam=new l(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new l(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new l(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new l(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new l(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new l(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new l(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new l(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new l(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new l(new Uint32Array([67968,67999,1]));static Miao=new l(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new l(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new l(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new l(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new l(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new l(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new l(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new l(new Uint32Array([124112,124153,1]));static Nandinagari=new l(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new l(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new l(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new l(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new l(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new l(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new l(new Uint32Array([5760,5788,1]));static Ol_Chiki=new l(new Uint32Array([7248,7295,1]));static Ol_Onal=new l(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new l(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new l(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new l(new Uint32Array([68224,68255,1]));static Old_Permic=new l(new Uint32Array([66384,66426,1]));static Old_Persian=new l(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new l(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new l(new Uint32Array([68192,68223,1]));static Old_Turkic=new l(new Uint32Array([68608,68680,1]));static Old_Uyghur=new l(new Uint32Array([69488,69513,1]));static Oriya=new l(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new l(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new l(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new l(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new l(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new l(new Uint32Array([72384,72440,1]));static Phags_Pa=new l(new Uint32Array([43072,43127,1]));static Phoenician=new l(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new l(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new l(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new l(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new l(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new l(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new l(new Uint32Array([70016,70111,1]));static Shavian=new l(new Uint32Array([66640,66687,1]));static Siddham=new l(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new l(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new l(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new l(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new l(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new l(new Uint32Array([72272,72354,1]));static Sundanese=new l(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new l(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new l(new Uint32Array([43008,43052,1]));static Syriac=new l(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new l(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new l(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new l(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new l(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new l(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new l(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new l(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new l(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new l(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new l(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new l(new Uint32Array([1920,1969,1]));static Thai=new l(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new l(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new l(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new l(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new l(new Uint32Array([67008,67059,1]));static Toto=new l(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new l(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new l(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new l(new Uint32Array([42240,42539,1]));static Vithkuqi=new l(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new l(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new l(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new l(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new l(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new l(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",i.C],["Cc",i.Cc],["Cf",i.Cf],["Co",i.Co],["Cs",i.Cs],["L",i.L],["Ll",i.Ll],["Lm",i.Lm],["Lo",i.Lo],["Lt",i.Lt],["Lu",i.Lu],["M",i.M],["Mc",i.Mc],["Me",i.Me],["Mn",i.Mn],["N",i.N],["Nd",i.Nd],["Nl",i.Nl],["No",i.No],["P",i.P],["Pc",i.Pc],["Pd",i.Pd],["Pe",i.Pe],["Pf",i.Pf],["Pi",i.Pi],["Po",i.Po],["Ps",i.Ps],["S",i.S],["Sc",i.Sc],["Sk",i.Sk],["Sm",i.Sm],["So",i.So],["Z",i.Z],["Zl",i.Zl],["Zp",i.Zp],["Zs",i.Zs]]);static SCRIPTS=new Map([["Adlam",i.Adlam],["Ahom",i.Ahom],["Anatolian_Hieroglyphs",i.Anatolian_Hieroglyphs],["Arabic",i.Arabic],["Armenian",i.Armenian],["Avestan",i.Avestan],["Balinese",i.Balinese],["Bamum",i.Bamum],["Bassa_Vah",i.Bassa_Vah],["Batak",i.Batak],["Bengali",i.Bengali],["Bhaiksuki",i.Bhaiksuki],["Bopomofo",i.Bopomofo],["Brahmi",i.Brahmi],["Braille",i.Braille],["Buginese",i.Buginese],["Buhid",i.Buhid],["Canadian_Aboriginal",i.Canadian_Aboriginal],["Carian",i.Carian],["Caucasian_Albanian",i.Caucasian_Albanian],["Chakma",i.Chakma],["Cham",i.Cham],["Cherokee",i.Cherokee],["Chorasmian",i.Chorasmian],["Common",i.Common],["Coptic",i.Coptic],["Cuneiform",i.Cuneiform],["Cypriot",i.Cypriot],["Cypro_Minoan",i.Cypro_Minoan],["Cyrillic",i.Cyrillic],["Deseret",i.Deseret],["Devanagari",i.Devanagari],["Dives_Akuru",i.Dives_Akuru],["Dogra",i.Dogra],["Duployan",i.Duployan],["Egyptian_Hieroglyphs",i.Egyptian_Hieroglyphs],["Elbasan",i.Elbasan],["Elymaic",i.Elymaic],["Ethiopic",i.Ethiopic],["Garay",i.Garay],["Georgian",i.Georgian],["Glagolitic",i.Glagolitic],["Gothic",i.Gothic],["Grantha",i.Grantha],["Greek",i.Greek],["Gujarati",i.Gujarati],["Gunjala_Gondi",i.Gunjala_Gondi],["Gurmukhi",i.Gurmukhi],["Gurung_Khema",i.Gurung_Khema],["Han",i.Han],["Hangul",i.Hangul],["Hanifi_Rohingya",i.Hanifi_Rohingya],["Hanunoo",i.Hanunoo],["Hatran",i.Hatran],["Hebrew",i.Hebrew],["Hiragana",i.Hiragana],["Imperial_Aramaic",i.Imperial_Aramaic],["Inherited",i.Inherited],["Inscriptional_Pahlavi",i.Inscriptional_Pahlavi],["Inscriptional_Parthian",i.Inscriptional_Parthian],["Javanese",i.Javanese],["Kaithi",i.Kaithi],["Kannada",i.Kannada],["Katakana",i.Katakana],["Kawi",i.Kawi],["Kayah_Li",i.Kayah_Li],["Kharoshthi",i.Kharoshthi],["Khitan_Small_Script",i.Khitan_Small_Script],["Khmer",i.Khmer],["Khojki",i.Khojki],["Khudawadi",i.Khudawadi],["Kirat_Rai",i.Kirat_Rai],["Lao",i.Lao],["Latin",i.Latin],["Lepcha",i.Lepcha],["Limbu",i.Limbu],["Linear_A",i.Linear_A],["Linear_B",i.Linear_B],["Lisu",i.Lisu],["Lycian",i.Lycian],["Lydian",i.Lydian],["Mahajani",i.Mahajani],["Makasar",i.Makasar],["Malayalam",i.Malayalam],["Mandaic",i.Mandaic],["Manichaean",i.Manichaean],["Marchen",i.Marchen],["Masaram_Gondi",i.Masaram_Gondi],["Medefaidrin",i.Medefaidrin],["Meetei_Mayek",i.Meetei_Mayek],["Mende_Kikakui",i.Mende_Kikakui],["Meroitic_Cursive",i.Meroitic_Cursive],["Meroitic_Hieroglyphs",i.Meroitic_Hieroglyphs],["Miao",i.Miao],["Modi",i.Modi],["Mongolian",i.Mongolian],["Mro",i.Mro],["Multani",i.Multani],["Myanmar",i.Myanmar],["Nabataean",i.Nabataean],["Nag_Mundari",i.Nag_Mundari],["Nandinagari",i.Nandinagari],["New_Tai_Lue",i.New_Tai_Lue],["Newa",i.Newa],["Nko",i.Nko],["Nushu",i.Nushu],["Nyiakeng_Puachue_Hmong",i.Nyiakeng_Puachue_Hmong],["Ogham",i.Ogham],["Ol_Chiki",i.Ol_Chiki],["Ol_Onal",i.Ol_Onal],["Old_Hungarian",i.Old_Hungarian],["Old_Italic",i.Old_Italic],["Old_North_Arabian",i.Old_North_Arabian],["Old_Permic",i.Old_Permic],["Old_Persian",i.Old_Persian],["Old_Sogdian",i.Old_Sogdian],["Old_South_Arabian",i.Old_South_Arabian],["Old_Turkic",i.Old_Turkic],["Old_Uyghur",i.Old_Uyghur],["Oriya",i.Oriya],["Osage",i.Osage],["Osmanya",i.Osmanya],["Pahawh_Hmong",i.Pahawh_Hmong],["Palmyrene",i.Palmyrene],["Pau_Cin_Hau",i.Pau_Cin_Hau],["Phags_Pa",i.Phags_Pa],["Phoenician",i.Phoenician],["Psalter_Pahlavi",i.Psalter_Pahlavi],["Rejang",i.Rejang],["Runic",i.Runic],["Samaritan",i.Samaritan],["Saurashtra",i.Saurashtra],["Sharada",i.Sharada],["Shavian",i.Shavian],["Siddham",i.Siddham],["SignWriting",i.SignWriting],["Sinhala",i.Sinhala],["Sogdian",i.Sogdian],["Sora_Sompeng",i.Sora_Sompeng],["Soyombo",i.Soyombo],["Sundanese",i.Sundanese],["Sunuwar",i.Sunuwar],["Syloti_Nagri",i.Syloti_Nagri],["Syriac",i.Syriac],["Tagalog",i.Tagalog],["Tagbanwa",i.Tagbanwa],["Tai_Le",i.Tai_Le],["Tai_Tham",i.Tai_Tham],["Tai_Viet",i.Tai_Viet],["Takri",i.Takri],["Tamil",i.Tamil],["Tangsa",i.Tangsa],["Tangut",i.Tangut],["Telugu",i.Telugu],["Thaana",i.Thaana],["Thai",i.Thai],["Tibetan",i.Tibetan],["Tifinagh",i.Tifinagh],["Tirhuta",i.Tirhuta],["Todhri",i.Todhri],["Toto",i.Toto],["Tulu_Tigalari",i.Tulu_Tigalari],["Ugaritic",i.Ugaritic],["Vai",i.Vai],["Vithkuqi",i.Vithkuqi],["Wancho",i.Wancho],["Warang_Citi",i.Warang_Citi],["Yezidi",i.Yezidi],["Yi",i.Yi],["Zanabazar_Square",i.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",i.foldL],["Ll",i.foldLl],["Lt",i.foldLt],["Lu",i.foldLu],["M",i.foldM],["Mn",i.foldMn]]);static FOLD_SCRIPT=new Map([["Common",i.foldCommon],["Greek",i.foldGreek],["Inherited",i.foldInherited]]);static Print=new l(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},w=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(t,e){let s=0,n=t.length;for(;sn)continue;let r=t.getLo(s);if(e0&&e>=t.getLo(0)&&this.is32(t,e)}static isUpper(t){if(t<=this.MAX_LATIN1){let e=String.fromCodePoint(t);return e.toUpperCase()===e&&e.toLowerCase()!==e}return this.is(b.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t=161&&t!==173:this.is(b.Print,t)}static simpleFold(t){if(b.CASE_ORBIT.has(t))return b.CASE_ORBIT.get(t);let e=u.toLowerCase(t);return e!==t?e:u.toUpperCase(t)}static equalsIgnoreCase(t,e){if(t<0||e<0||t===e)return!0;if(t<=this.MAX_ASCII&&e<=this.MAX_ASCII)return u.CODES.get("A")<=t&&t<=u.CODES.get("Z")&&(t|=32),u.CODES.get("A")<=e&&e<=u.CODES.get("Z")&&(e|=32),t===e;for(let s=this.simpleFold(t);s!==t;s=this.simpleFold(s))if(s===e)return!0;return!1}},C=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(t){return u.CODES.get("0")<=t&&t<=u.CODES.get("9")||u.CODES.get("a")<=t&&t<=u.CODES.get("z")||u.CODES.get("A")<=t&&t<=u.CODES.get("Z")}static unhex(t){return u.CODES.get("0")<=t&&t<=u.CODES.get("9")?t-u.CODES.get("0"):u.CODES.get("a")<=t&&t<=u.CODES.get("f")?t-u.CODES.get("a")+10:u.CODES.get("A")<=t&&t<=u.CODES.get("F")?t-u.CODES.get("A")+10:-1}static escapeRune(t){let e="";if(w.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(e+="\\"),e+=String.fromCodePoint(t);else switch(t){case u.CODES.get('"'):e+='\\"';break;case u.CODES.get("\\"):e+="\\\\";break;case u.CODES.get(" "):e+="\\t";break;case u.CODES.get(` -`):e+="\\n";break;case u.CODES.get("\r"):e+="\\r";break;case u.CODES.get("\b"):e+="\\b";break;case u.CODES.get("\f"):e+="\\f";break;default:{let s=t.toString(16);t<256?(e+="\\x",s.length===1&&(e+="0"),e+=s):e+=`\\x{${s}}`;break}}return e}static stringToRunes(t){return String(t).split("").map(e=>e.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return u.CODES.get("a")<=t&&t<=u.CODES.get("z")||u.CODES.get("A")<=t&&t<=u.CODES.get("Z")||u.CODES.get("0")<=t&&t<=u.CODES.get("9")||t===u.CODES.get("_")}static emptyOpContext(t,e){let s=0;return t<0&&(s|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===u.CODES.get(` -`)&&(s|=this.EMPTY_BEGIN_LINE),e<0&&(s|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),e===u.CODES.get(` -`)&&(s|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(e)?s|=this.EMPTY_WORD_BOUNDARY:s|=this.EMPTY_NO_WORD_BOUNDARY,s}static quoteMeta(t){return t.split("").map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join("")}static charCount(t){return t>w.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let e=[],s=0;for(let n=0;n>6|192,e[s++]=r&63|128):(r&64512)===55296&&n+1>18|240,e[s++]=r>>12&63|128,e[s++]=r>>6&63|128,e[s++]=r&63|128):(e[s++]=r>>12|224,e[s++]=r>>6&63|128,e[s++]=r&63|128)}return e}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let e=[],s=0,n=0;for(;s191&&r<224){let a=t[s++];e[n++]=String.fromCharCode((r&31)<<6|a&63)}else if(r>239&&r<365){let a=t[s++],o=t[s++],h=t[s++],p=((r&7)<<18|(a&63)<<12|(o&63)<<6|h&63)-65536;e[n++]=String.fromCharCode(55296+(p>>10)),e[n++]=String.fromCharCode(56320+(p&1023))}else{let a=t[s++],o=t[s++];e[n++]=String.fromCharCode((r&15)<<12|(a&63)<<6|o&63)}}return e.join("")}}},N1=(i=[],t=0)=>{let e={};for(let s=0;st.codePointAt(0))}length(){return this.charSequence.length}},_=class{static utf16(t){return new v(t)}static utf8(t){return Array.isArray(t)?new F(t):new F(C.stringToUtf8ByteArray(t))}},L=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},z=class extends L{constructor(t,e=0,s=t.length){super(),this.bytes=t,this.start=e,this.end=s}step(t){if(t+=this.start,t>=this.end)return L.EOF();let e=this.bytes[t++]&255;return(e&128)===0?e<<3|1:(e&224)===192?(e=e&31,t>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e<<3|2)):(e&240)===224?(e=e&15,t+1>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e<<3|3)):(e=e&7,t+2>=this.end?L.EOF():(e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e=e<<6|this.bytes[t++]&63,e<<3|4))}index(t,e){e+=this.start;let s=this.indexOf(this.bytes,t.prefixUTF8,e);return s<0?s:s-e}context(t){t+=this.start;let e=-1;if(t>this.start&&t<=this.end){let n=t-1;if(e=this.bytes[n--],e>=128){let r=t-4;for(r=r&&(this.bytes[n]&192)===128;)n--;n>3}}let s=t>3:-1;return C.emptyOpContext(e,s)}indexOf(t,e,s=0){let n=e.length;if(n===0)return-1;let r=t.length;for(let a=s;a<=r-n;a++)for(let o=0;o0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,s=t{let n=s.codePointAt(0);return n===u.CODES.get("\\")||n===u.CODES.get("$")?`\\${s}`:s}).join(""):t.indexOf("$")<0?t:t.split("").map(s=>s.codePointAt(0)===u.CODES.get("$")?"$$":s).join("")}constructor(t,e){if(t===null)throw new Error("pattern is null");this.patternInput=t;let s=this.patternInput.re2();this.patternGroupCount=s.numberOfCapturingGroups(),this.groups=[],this.namedGroups=s.namedGroups,this.numberOfInstructions=s.numberOfInstructions(),e instanceof I?this.resetMatcherInput(e):Array.isArray(e)?this.resetMatcherInput(_.utf8(e)):this.resetMatcherInput(_.utf16(e))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let e=this.namedGroups[t];if(!Number.isFinite(e))throw new U(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let e=this.namedGroups[t];if(!Number.isFinite(e))throw new U(`group '${t}' not found`);t=e}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new U(`group '${t}' not found`);t=n}let e=this.start(t),s=this.end(t);return e<0&&s<0?null:this.substring(e,s)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new U(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new U("perhaps no match attempted");if(t===0||this.hasGroups)return;let e=this.groups[1]+1;e>this.matcherInputLength&&(e=this.matcherInputLength);let s=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],e,this.anchorFlag,1+this.patternGroupCount);if(!s[0])throw new U("inconsistency in matching group data");this.groups=s[1],this.hasGroups=!0}matches(){return this.genMatch(0,g.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,g.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new U(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,g.UNANCHORED)}genMatch(t,e){let s=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,e,1);return s[0]?(this.groups=s[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=e,!0):!1}substring(t,e){return this.matcherInput.isUTF8Encoding()?C.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,e)):this.matcherInput.asCharSequence().substring(t,e).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,e=!1){let s="",n=this.start(),r=this.end();return this.appendPosu.CODES.get("9")||o*10+a-u.CODES.get("0")>this.patternGroupCount));r++)o=o*10+a-u.CODES.get("0");if(o>this.patternGroupCount)throw new U(`n > number of groups: ${o}`);let h=this.group(o);h!==null&&(e+=h),s=r,r--;continue}else if(a===u.CODES.get("{")){su.CODES.get("9")||o*10+a-u.CODES.get("0")>this.patternGroupCount));r++)o=o*10+a-u.CODES.get("0");if(o>this.patternGroupCount){e+=`$${o}`,s=r,r--;continue}let h=this.group(o);h!==null&&(e+=h),s=r,r--;continue}else if(a===u.CODES.get("<")){s")&&t.codePointAt(o)!==u.CODES.get(" ");)o++;if(o===t.length||t.codePointAt(o)!==u.CODES.get(">")){e+=t.substring(r-1,o+1),s=o+1;continue}let h=t.substring(r+1,o);Object.prototype.hasOwnProperty.call(this.namedGroups,h)?e+=this.group(h):e+=`$<${h}>`,s=o+1}}return s ${this.out}, ${this.arg}`;case i.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case i.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case i.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case i.MATCH:return"match";case i.FAIL:return"fail";case i.NOP:return`nop -> ${this.out}`;case i.RUNE:return this.runes===null?"rune ":["rune ",i.escapeRunes(this.runes),(this.arg&g.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case i.RUNE1:return`rune1 ${i.escapeRunes(this.runes)} -> ${this.out}`;case i.RUNE_ANY:return`any -> ${this.out}`;case i.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},W=class{constructor(){this.inst=null,this.cap=[]}},Y=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let e=this.sparse[t];return ethis.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let e=0;e0?(this.poolSize--,e=this.pool[this.poolSize]):e=new W,e.inst=t,e}freeQueue(t,e=0){let s=t.size-e,n=this.poolSize+s;this.pool.length>3,p=o&7,f=-1,A=0;o!==L.EOF()&&(o=t.step(e+p),f=o>>3,A=o&7);let N;for(e===0?N=C.emptyOpContext(-1,h):N=t.context(e);;){if(r.isEmpty()){if((n&C.EMPTY_BEGIN_TEXT)!==0&&e!==0||this.matched)break;if(this.re2.prefix.length!==0&&f!==this.re2.prefixRune&&t.canCheckPrefix()){let T=t.index(this.re2,e);if(T<0)break;e+=T,o=t.step(e),h=o>>3,p=o&7,o=t.step(e+p),f=o>>3,A=o&7}}!this.matched&&(e===0||s===g.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=e),this.add(r,this.prog.start,e,this.matchcap,N,null));let O=e+p;if(N=t.context(O),this.step(r,a,e,O,h,N,s,e===t.endPos()),p===0||this.ncap===0&&this.matched)break;e+=p,h=f,p=A,h!==-1&&(o=t.step(e+p),f=o>>3,A=o&7);let S=r;r=a,a=S}return this.freeQueue(a),this.matched}step(t,e,s,n,r,a,o,h){let p=this.re2.longest;for(let f=0;f0&&this.matchcap[0]0&&(!p||!this.matched||this.matchcap[1]0&&a.cap!==n&&(a.cap=n.slice(0,this.ncap)),t.denseThreads[o]=a,a=null;break;default:throw new Error("unhandled")}return a}},b1=i=>{let t=-2128831035;for(let e=0;e{if(i.length!==t.length)return!1;for(let e=0;e0;){let a=s.pop();if(e.has(a))continue;e.add(a);let o=this.prog.getInst(a);switch(o.op){case E.MATCH:n=!0;break;case E.ALT:case E.ALT_MATCH:s.push(o.out),s.push(o.arg);break;case E.NOP:case E.CAPTURE:s.push(o.out);break;case E.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(e).sort(),isMatch:n}}getState(t){let e=this.computeClosure(t);if(!e)return null;let s=e.pcs,n=b1(s),r=this.stateCache.get(n);if(r)for(let o=0;o=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let a=new q(s,e.isMatch);return r.push(a),this.stateCount++,a}step(t,e,s){if(s===g.UNANCHORED&&e<=w.MAX_ASCII){let a=t.nextAscii[e];if(a!==null)return a}else{let a=e+(s===g.UNANCHORED?0:w.MAX_RUNE+1);if(t.nextMap.has(a))return t.nextMap.get(a)}let n=[];for(let a=0;a>3,p=o&7;if(p===0)break;if(r=this.step(r,h,s),r===null)return null;if(r.isMatch)if(s===g.ANCHOR_BOTH){if(a+p===n)return!0}else return!0;if(r.nfaStates.length===0&&s!==g.UNANCHORED)return!1;a+=p}return!1}},c=class i{static Op=N1(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=i.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===u.CODES.get("-")?"\\":""}static fromRegexp(t){let e=new i(t.op);return e.flags=t.flags,e.subs=t.subs,e.runes=t.runes,e.cap=t.cap,e.min=t.min,e.max=t.max,e.name=t.name,e.namedGroups=t.namedGroups,e}constructor(t){this.op=t,this.flags=0,this.subs=i.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=i.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case i.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case i.Op.EMPTY_MATCH:t+="(?:)";break;case i.Op.STAR:case i.Op.PLUS:case i.Op.QUEST:case i.Op.REPEAT:{let e=this.subs[0];switch(e.op>i.Op.CAPTURE||e.op===i.Op.LITERAL&&e.runes.length>1?t+=`(?:${e.appendTo()})`:t+=e.appendTo(),this.op){case i.Op.STAR:t+="*";break;case i.Op.PLUS:t+="+";break;case i.Op.QUEST:t+="?";break;case i.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&g.NON_GREEDY)!==0&&(t+="?");break}case i.Op.CONCAT:{for(let e of this.subs)e.op===i.Op.ALTERNATE?t+=`(?:${e.appendTo()})`:t+=e.appendTo();break}case i.Op.ALTERNATE:{let e="";for(let s of this.subs)t+=e,e="|",t+=s.appendTo();break}case i.Op.LITERAL:(this.flags&g.FOLD_CASE)!==0&&(t+="(?i:");for(let e of this.runes)t+=C.escapeRune(e);(this.flags&g.FOLD_CASE)!==0&&(t+=")");break;case i.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case i.Op.ANY_CHAR:t+="(?s:.)";break;case i.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==i.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case i.Op.BEGIN_TEXT:t+="\\A";break;case i.Op.END_TEXT:(this.flags&g.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case i.Op.BEGIN_LINE:t+="^";break;case i.Op.END_LINE:t+="$";break;case i.Op.WORD_BOUNDARY:t+="\\b";break;case i.Op.NO_WORD_BOUNDARY:t+="\\B";break;case i.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===w.MAX_RUNE){t+="^";for(let e=1;e>1];return(t&1)===0?e.out:e.arg}patch(t,e){for(;t!==0;){let s=this.inst[t>>1];(t&1)===0?(t=s.out,s.out=e):(t=s.arg,s.arg=e)}}append(t,e){if(t===0)return e;if(e===0)return t;let s=t;for(;;){let r=this.next(s);if(r===0)break;s=r}let n=this.inst[s>>1];return(s&1)===0?n.out=e:n.arg=e,t}toString(){let t="";for(let e=0;e0){s=[];for(let n=0;nt.min){let n=i.simplify1(c.Op.QUEST,t.flags,e,null);for(let r=t.min+1;r0&&(s+=" ");let r=t[n],a=t[n+1];r===a?s+=`0x${r.toString(16)}`:s+=`0x${r.toString(16)}-0x${a.toString(16)}`}return s+="]",s}static cmp(t,e,s,n){let r=t[e]-s;return r!==0?r:n-t[e+1]}static qsortIntPair(t,e,s){let n=((e+s)/2|0)&-2,r=t[n],a=t[n+1],o=e,h=s;for(;o<=h;){for(;oe&&i.cmp(t,h,r,a)>0;)h-=2;if(o<=h){if(o!==h){let p=t[o];t[o]=t[h],t[h]=p,p=t[o+1],t[o+1]=t[h+1],t[h+1]=p}o+=2,h-=2}}ethis.r[t-1]&&(this.r[t-1]=n);continue}this.r[t]=s,this.r[t+1]=n,t+=2}return this.len=t,this}appendLiteral(t,e){return(e&g.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,e){if(this.len>0){for(let s=2;s<=4;s+=2)if(this.len>=s){let n=this.r[this.len-s],r=this.r[this.len-s+1];if(t<=r+1&&n<=e+1)return tr&&(this.r[this.len-s+1]=e),this}}return this.r[this.len++]=t,this.r[this.len++]=e,this}appendFoldedRange(t,e){if(t<=w.MIN_FOLD&&e>=w.MAX_FOLD)return this.appendRange(t,e);if(ew.MAX_FOLD)return this.appendRange(t,e);tw.MAX_FOLD&&(this.appendRange(w.MAX_FOLD+1,e),e=w.MAX_FOLD);for(let s=t;s<=e;s++){this.appendRange(s,s);for(let n=w.simpleFold(s);n!==s;n=w.simpleFold(n))this.appendRange(n,n)}return this}appendClass(t){for(let e=0;ew.MAX_FOLD)return t;let e=t,s=t;for(t=w.simpleFold(t);t!==s;t=w.simpleFold(t))e>t&&(e=t);return e}static leadingRegexp(t){if(t.op===c.Op.EMPTY_MATCH)return null;if(t.op===c.Op.CONCAT&&t.subs.length>0){let e=t.subs[0];return e.op===c.Op.EMPTY_MATCH?null:e}return t}static literalRegexp(t,e){let s=new c(c.Op.LITERAL);return s.flags=e,s.runes=C.stringToRunes(t),s}static parse(t,e){return new i(t,e).parseInternal()}static parseRepeat(t){let e=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let s=i.parseInt(t);if(s===-1||!t.more())return-1;let n;if(!t.lookingAt(","))n=s;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))n=-1;else if((n=i.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),s<0||s>1e3||n===-2||n>1e3||n>=0&&s>n)throw new m(i.ERR_INVALID_REPEAT_SIZE,t.from(e));return s<<16|n&w.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let e=0;e=u.CODES.get("0")&&t.peek()<=u.CODES.get("9");)t.skip(1);let s=t.from(e);return s.length===0||s.length>1&&s.codePointAt(0)===u.CODES.get("0")?-1:s.length>8?-2:parseFloat(s,10)}static isCharClass(t){return t.op===c.Op.LITERAL&&t.runes.length===1||t.op===c.Op.CHAR_CLASS||t.op===c.Op.ANY_CHAR_NOT_NL||t.op===c.Op.ANY_CHAR}static matchRune(t,e){switch(t.op){case c.Op.LITERAL:return t.runes.length===1&&t.runes[0]===e;case c.Op.CHAR_CLASS:for(let s=0;su.CODES.get("7"))break;case u.CODES.get("0"):{let n=s-u.CODES.get("0");for(let r=1;r<3&&!(!t.more()||t.peek()u.CODES.get("7"));r++)n=n*8+t.peek()-u.CODES.get("0"),t.skip(1);return n}case u.CODES.get("x"):{if(!t.more())break;if(s=t.pop(),s===u.CODES.get("{")){let a=0,o=0;for(;;){if(!t.more())break t;if(s=t.pop(),s===u.CODES.get("}"))break;let h=C.unhex(s);if(h<0||(o=o*16+h,o>w.MAX_RUNE))break t;a++}if(a===0)break t;return o}let n=C.unhex(s);if(!t.more())break;s=t.pop();let r=C.unhex(s);if(n<0||r<0)break;return n*16+r}case u.CODES.get("a"):return u.CODES.get("\x07");case u.CODES.get("f"):return u.CODES.get("\f");case u.CODES.get("n"):return u.CODES.get(` -`);case u.CODES.get("r"):return u.CODES.get("\r");case u.CODES.get("t"):return u.CODES.get(" ");case u.CODES.get("v"):return u.CODES.get("\v");default:if(s<=w.MAX_ASCII&&!C.isalnum(s))return s;break}throw new m(i.ERR_INVALID_ESCAPE,t.from(e))}static parseClassChar(t,e){if(!t.more())throw new m(i.ERR_MISSING_BRACKET,t.from(e));return t.lookingAt("\\")?i.parseEscape(t):t.pop()}static concatRunes(t,e){return[...t,...e]}constructor(t,e=0){this.wholeRegexp=t,this.flags=e,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let e=this.free;return e!==null&&e.subs!==null&&e.subs.length>0?(this.free=e.subs[0],e.reinit(),e.op=t):(e=new c(t),this.numRegexp+=1),e}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>i.MAX_RUNES)throw new m(i.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===c.Op.REPEAT){let e=t.max;e===-1&&(e=t.min),e<=0&&(e=1),e>i.MAX_SIZE/this.repeats?this.repeats=i.MAX_SIZE:this.repeats*=e}if(this.numRegexpi.MAX_SIZE)throw new m(i.ERR_LARGE)}calcSize(t,e=!1){if(!e&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let s=0;switch(t.op){case c.Op.LITERAL:{s=t.runes.length;break}case c.Op.CAPTURE:case c.Op.STAR:{s=2+this.calcSize(t.subs[0]);break}case c.Op.PLUS:case c.Op.QUEST:{s=1+this.calcSize(t.subs[0]);break}case c.Op.CONCAT:{for(let n of t.subs)s=s+this.calcSize(n);break}case c.Op.ALTERNATE:{for(let n of t.subs)s=s+this.calcSize(n);t.subs.length>1&&(s=s+t.subs.length-1);break}case c.Op.REPEAT:{let n=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?s=2+n:s=1+t.min*n;break}s=t.max*n+(t.max-t.min);break}}return s=Math.max(1,s),this.size[t]=s,s}checkHeight(t){if(!(this.numRegexpi.MAX_HEIGHT)throw new m(i.ERR_NESTING_DEPTH)}}calcHeight(t,e=!1){if(!e&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let s=1;for(let n of t.subs){let r=this.calcHeight(n);s<1+r&&(s=1+r)}return this.height[t]=s,s}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,e=t;for(;e>0&&!c.isPseudoOp(this.stack[e-1].op);)e--;let s=this.stack.slice(e,t);return this.stack=this.stack.slice(0,e),s}push(t){if(this.numRunes+=t.runes.length,t.op===c.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=c.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===c.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&w.simpleFold(t.runes[0])===t.runes[2]&&w.simpleFold(t.runes[2])===t.runes[0]||t.op===c.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&w.simpleFold(t.runes[0])===t.runes[1]&&w.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|g.FOLD_CASE))return null;t.op=c.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|g.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,e){let s=this.stack.length;if(s<2)return!1;let n=this.stack[s-1],r=this.stack[s-2];return n.op!==c.Op.LITERAL||r.op!==c.Op.LITERAL||(n.flags&g.FOLD_CASE)!==(r.flags&g.FOLD_CASE)?!1:(r.runes=i.concatRunes(r.runes,n.runes),t>=0?(n.runes=[t],n.flags=e,!0):(this.pop(),this.reuse(n),!1))}newLiteral(t,e){let s=this.newRegexp(c.Op.LITERAL);return s.flags=e,(e&g.FOLD_CASE)!==0&&(t=i.minFoldRune(t)),s.runes=[t],s}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let e=this.newRegexp(t);return e.flags=this.flags,this.push(e)}repeat(t,e,s,n,r,a){let o=this.flags;if((o&g.PERL_X)!==0&&(r.more()&&r.lookingAt("?")&&(r.skip(1),o^=g.NON_GREEDY),a!==-1))throw new m(i.ERR_INVALID_REPEAT_OP,r.from(a));let h=this.stack.length;if(h===0)throw new m(i.ERR_MISSING_REPEAT_ARGUMENT,r.from(n));let p=this.stack[h-1];if(c.isPseudoOp(p.op))throw new m(i.ERR_MISSING_REPEAT_ARGUMENT,r.from(n));let f=this.newRegexp(t);if(f.min=e,f.max=s,f.flags=o,f.subs=[p],this.stack[h-1]=f,this.checkLimits(f),t===c.Op.REPEAT&&(e>=2||s>=2)&&!this.repeatIsValid(f,1e3))throw new m(i.ERR_INVALID_REPEAT_SIZE,r.from(n))}repeatIsValid(t,e){if(t.op===c.Op.REPEAT){let s=t.max;if(s===0)return!0;if(s<0&&(s=t.min),s>e)return!1;s>0&&(e=Math.trunc(e/s))}for(let s of t.subs)if(!this.repeatIsValid(s,e))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(c.Op.EMPTY_MATCH)):this.push(this.collapse(t,c.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(c.Op.NO_MATCH)):this.push(this.collapse(t,c.Op.ALTERNATE))}cleanAlt(t){t.op===c.Op.CHAR_CLASS&&(t.runes=new x(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===w.MAX_RUNE?(t.runes=[],t.op=c.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===u.CODES.get(` -`)-1&&t.runes[2]===u.CODES.get(` -`)+1&&t.runes[3]===w.MAX_RUNE&&(t.runes=[],t.op=c.Op.ANY_CHAR_NOT_NL))}collapse(t,e){if(t.length===1)return t[0];let s=0;for(let o of t)s+=o.op===e?o.subs.length:1;let n=new Array(s).fill(null),r=0;for(let o of t)o.op===e?(n.splice(r,o.subs.length,...o.subs),r+=o.subs.length,this.reuse(o)):n[r++]=o;let a=this.newRegexp(e);if(a.subs=n,e===c.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let o=a;a=a.subs[0],this.reuse(o)}return a}factor(t){if(t.length<2)return t;let e=0,s=t.length,n=0,r=null,a=0,o=0,h=0;for(let f=0;f<=s;f++){let A=null,N=0,O=0;if(f0&&(S=S.subs[0]),S.op===c.Op.LITERAL&&(A=S.runes,N=S.runes.length,O=S.flags&g.FOLD_CASE),O===o){let T=0;for(;T0){a=T;continue}}}if(f!==h)if(f===h+1)t[n++]=t[e+h];else{let S=this.newRegexp(c.Op.LITERAL);S.flags=o,S.runes=r.slice(0,a);for(let k=h;k0){let s=this.removeLeadingString(t.subs[0],e);if(t.subs[0]=s,s.op===c.Op.EMPTY_MATCH)switch(this.reuse(s),t.subs.length){case 0:case 1:t.op=c.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let n=t;t=t.subs[1],this.reuse(n);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===c.Op.LITERAL&&(t.runes=t.runes.slice(e,t.runes.length),t.runes.length===0&&(t.op=c.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,e){if(t.op===c.Op.CONCAT&&t.subs.length>0){switch(e&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=c.Op.EMPTY_MATCH,t.subs=c.emptySubs();break}case 1:{let s=t;t=t.subs[0],this.reuse(s);break}}return t}return e&&this.reuse(t),this.newRegexp(c.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&g.LITERAL)!==0)return i.literalRegexp(this.wholeRegexp,this.flags);let t=-1,e=-1,s=-1,n=new t1(this.wholeRegexp);for(;n.more();){let a=-1;t:switch(n.peek()){case u.CODES.get("("):if((this.flags&g.PERL_X)!==0&&n.lookingAt("(?")){this.parsePerlFlags(n);break}this.op(c.Op.LEFT_PAREN).cap=++this.numCap,n.skip(1);break;case u.CODES.get("|"):this.parseVerticalBar(),n.skip(1);break;case u.CODES.get(")"):this.parseRightParen(),n.skip(1);break;case u.CODES.get("^"):(this.flags&g.ONE_LINE)!==0?this.op(c.Op.BEGIN_TEXT):this.op(c.Op.BEGIN_LINE),n.skip(1);break;case u.CODES.get("$"):(this.flags&g.ONE_LINE)!==0?this.op(c.Op.END_TEXT).flags|=g.WAS_DOLLAR:this.op(c.Op.END_LINE),n.skip(1);break;case u.CODES.get("."):(this.flags&g.DOT_NL)!==0?this.op(c.Op.ANY_CHAR):this.op(c.Op.ANY_CHAR_NOT_NL),n.skip(1);break;case u.CODES.get("["):this.parseClass(n);break;case u.CODES.get("*"):case u.CODES.get("+"):case u.CODES.get("?"):{a=n.pos();let o=null;switch(n.pop()){case u.CODES.get("*"):o=c.Op.STAR;break;case u.CODES.get("+"):o=c.Op.PLUS;break;case u.CODES.get("?"):o=c.Op.QUEST;break}this.repeat(o,e,s,a,n,t);break}case u.CODES.get("{"):{a=n.pos();let o=i.parseRepeat(n);if(o<0){n.rewindTo(a),this.literal(n.pop());break}e=o>>16,s=(o&w.MAX_BMP)<<16>>16,this.repeat(c.Op.REPEAT,e,s,a,n,t);break}case u.CODES.get("\\"):{let o=n.pos();if(n.skip(1),(this.flags&g.PERL_X)!==0&&n.more())switch(n.pop()){case u.CODES.get("A"):this.op(c.Op.BEGIN_TEXT);break t;case u.CODES.get("b"):this.op(c.Op.WORD_BOUNDARY);break t;case u.CODES.get("B"):this.op(c.Op.NO_WORD_BOUNDARY);break t;case u.CODES.get("C"):throw new m(i.ERR_INVALID_ESCAPE,"\\C");case u.CODES.get("Q"):{let A=n.rest(),N=A.indexOf("\\E");N>=0&&(A=A.substring(0,N)),n.skipString(A),n.skipString("\\E");let O=0;for(;O");if(h<0)throw new m(i.ERR_INVALID_NAMED_CAPTURE,s);let p=s.substring(o,h);if(t.skipString(p),t.skip(o+1),!i.isValidCaptureName(p))throw new m(i.ERR_INVALID_NAMED_CAPTURE,s.substring(0,h+1));let f=this.op(c.Op.LEFT_PAREN);if(f.cap=++this.numCap,this.namedGroups[p])throw new m(i.ERR_DUPLICATE_NAMED_CAPTURE,p);this.namedGroups[p]=this.numCap,f.name=p;return}t.skip(2);let n=this.flags,r=1,a=!1;t:for(;t.more();){let o=t.pop();switch(o){case u.CODES.get("i"):n|=g.FOLD_CASE,a=!0;break;case u.CODES.get("m"):n&=-17,a=!0;break;case u.CODES.get("s"):n|=g.DOT_NL,a=!0;break;case u.CODES.get("U"):n|=g.NON_GREEDY,a=!0;break;case u.CODES.get("-"):if(r<0)break t;r=-1,n=~n,a=!1;break;case u.CODES.get(":"):case u.CODES.get(")"):if(r<0){if(!a)break t;n=~n}o===u.CODES.get(":")&&this.op(c.Op.LEFT_PAREN),this.flags=n;return;default:break t}}throw new m(i.ERR_INVALID_PERL_OP,t.from(e))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(c.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===c.Op.VERTICAL_BAR&&i.isCharClass(this.stack[t-1])&&i.isCharClass(this.stack[t-3])){let e=this.stack[t-1],s=this.stack[t-3];if(e.op>s.op){let n=s;s=e,e=n,this.stack[t-3]=s}return i.mergeCharClass(s,e),this.reuse(e),this.pop(),!0}if(t>=2){let e=this.stack[t-1],s=this.stack[t-2];if(s.op===c.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=s,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new m(i.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let e=this.pop(),s=this.pop();if(s.op!==c.Op.LEFT_PAREN)throw new m(i.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=s.flags,s.cap===0?this.push(e):(s.op=c.Op.CAPTURE,s.subs=[e],this.push(s))}parsePerlClassEscape(t,e){let s=t.pos();if((this.flags&g.PERL_X)===0||!t.more()||t.pop()!==u.CODES.get("\\")||!t.more())return!1;t.pop();let n=t.from(s),r=h1.has(n)?h1.get(n):null;return r===null?!1:(e.appendGroup(r,(this.flags&g.FOLD_CASE)!==0),!0)}parseNamedClass(t,e){let s=t.rest(),n=s.indexOf(":]");if(n<0)return!1;let r=s.substring(0,n+2);t.skipString(r);let a=T1.has(r)?T1.get(r):null;if(a===null)throw new m(i.ERR_INVALID_CHAR_RANGE,r);return e.appendGroup(a,(this.flags&g.FOLD_CASE)!==0),!0}parseUnicodeClass(t,e){let s=t.pos();if((this.flags&g.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let n=1,r=t.pop();if(r===u.CODES.get("P")&&(n=-1),!t.more())throw t.rewindTo(s),new m(i.ERR_INVALID_CHAR_RANGE,t.rest());r=t.pop();let a;if(r!==u.CODES.get("{"))a=C.runeToString(r);else{let f=t.rest(),A=f.indexOf("}");if(A<0)throw t.rewindTo(s),new m(i.ERR_INVALID_CHAR_RANGE,t.rest());a=f.substring(0,A),t.skipString(a),t.skip(1)}a.length!==0&&a.codePointAt(0)===u.CODES.get("^")&&(n=0-n,a=a.substring(1));let o=i.unicodeTable(a);if(o===null)throw new m(i.ERR_INVALID_CHAR_RANGE,t.from(s));let h=o.first,p=o.second;if((this.flags&g.FOLD_CASE)===0||p===null)e.appendTableWithSign(h,n);else{let f=new x().appendTable(h).appendTable(p).cleanClass().toArray();e.appendClassWithSign(f,n)}return!0}parseClass(t){let e=t.pos();t.skip(1);let s=this.newRegexp(c.Op.CHAR_CLASS);s.flags=this.flags;let n=new x,r=1;t.more()&&t.lookingAt("^")&&(r=-1,t.skip(1),(this.flags&g.CLASS_NL)===0&&n.appendRange(u.CODES.get(` -`),u.CODES.get(` -`)));let a=!0;for(;!t.more()||t.peek()!==u.CODES.get("]")||a;){if(t.more()&&t.lookingAt("-")&&(this.flags&g.PERL_X)===0&&!a){let f=t.rest();if(f==="-"||!f.startsWith("-]"))throw t.rewindTo(e),new m(i.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;let o=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,n))continue;t.rewindTo(o)}if(this.parseUnicodeClass(t,n)||this.parsePerlClassEscape(t,n))continue;t.rewindTo(o);let h=i.parseClassChar(t,e),p=h;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(p=i.parseClassChar(t,e),p0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=n.namedGroups,o}static match(t,e){return i.compile(t).match(e)}constructor(t,e,s=0,n=0){this.expr=t,this.prog=e,this.numSubexp=s,this.longest=n,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new s1,this.dfa=new K(e)}executeEngine(t,e,s,n){if(n>0)return this.doExecuteNFA(t,e,s,n);let r=this.dfa.match(t,e,s);return r!==null?r?[]:null:this.doExecuteNFA(t,e,s,n)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,e){let s=this.pooled.get();do s=this.pooled.get(),!e&&s&&(t=M.fromMachine(t),e=!0),t.next!==s&&(t.next=s);while(!this.pooled.compareAndSet(s,t))}toString(){return this.expr}doExecuteNFA(t,e,s,n){let r=this.get(),a=!1;r?r.next!==null&&(r=M.fromMachine(r),a=!0):(r=M.fromRE2(this),a=!0),r.init(n);let o=r.match(t,e,s)?r.submatches():null;return this.put(r,a),o}match(t){return this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,0)!==null}matchWithGroup(t,e,s,n,r){return t instanceof I||(t=_.utf16(t)),this.matchMachineInput(t,e,s,n,r)}matchMachineInput(t,e,s,n,r){if(e>s)return[!1,null];let a=t.isUTF16Encoding()?R.fromUTF16(t.asCharSequence(),0,s):R.fromUTF8(t.asBytes(),0,s),o=this.executeEngine(a,e,n,2*r);return o===null?[!1,null]:[!0,o]}matchUTF8(t){return this.executeEngine(R.fromUTF8(t),0,g.UNANCHORED,0)!==null}replaceAll(t,e){return this.replaceAllFunc(t,()=>e,2*t.length+1)}replaceFirst(t,e){return this.replaceAllFunc(t,()=>e,1)}replaceAllFunc(t,e,s){let n=0,r=0,a="",o=R.fromUTF16(t),h=0;for(;r<=t.length;){let p=this.executeEngine(o,r,g.UNANCHORED,2);if(p===null||p.length===0)break;a+=t.substring(n,p[0]),(p[1]>n||p[0]===0)&&(a+=e(t.substring(p[0],p[1])),h++),n=p[1];let f=o.step(r)&7;if(r+f>p[1]?r+=f:r+1>p[1]?r++:r=p[1],h>=s)break}return a+=t.substring(n),a}pad(t){if(t===null)return null;let e=(1+this.numSubexp)*2;if(t.lengthn){let n=[],r=t.endPos();e<0&&(e=r+1);let a=0,o=0,h=-1;for(;o=0&&(s[n]=t.slice(e[2*n],e[2*n+1]));return s}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(R.fromUTF8(t),0,g.UNANCHORED,this.prog.numCap))}findSubmatch(t){let e=this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,this.prog.numCap);if(e===null)return null;let s=new Array(1+this.numSubexp).fill(null);for(let n=0;n=0&&(s[n]=t.substring(e[2*n],e[2*n+1]));return s}findSubmatchIndex(t){return this.pad(this.executeEngine(R.fromUTF16(t),0,g.UNANCHORED,this.prog.numCap))}findAllUTF8(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>t.slice(n[0],n[1]));return s.length===0?null:s}findAllUTF8Index(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>n.slice(0,2));return s.length===0?null:s}findAll(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>t.substring(n[0],n[1]));return s.length===0?null:s}findAllIndex(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>n.slice(0,2));return s.length===0?null:s}findAllUTF8Submatch(t,e){let s=this.allMatches(R.fromUTF8(t),e,n=>{let r=new Array(n.length/2|0).fill(null);for(let a=0;a=0&&(r[a]=t.slice(n[2*a],n[2*a+1]));return r});return s.length===0?null:s}findAllUTF8SubmatchIndex(t,e){let s=this.allMatches(R.fromUTF8(t),e);return s.length===0?null:s}findAllSubmatch(t,e){let s=this.allMatches(R.fromUTF16(t),e,n=>{let r=new Array(n.length/2|0).fill(null);for(let a=0;a=0&&(r[a]=t.substring(n[2*a],n[2*a+1]));return r});return s.length===0?null:s}findAllSubmatchIndex(t,e){let s=this.allMatches(R.fromUTF16(t),e);return s.length===0?null:s}},i1=class i{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let e=t.charCodeAt(0);return e<128?1:e<2048?2:e<65536?3:4}static translate(t){if(typeof t!="string")return t;let e="",s=!1,n=t.length;n===0&&(e="(?:)",s=!0);let r=0;for(;r>4).toString(16).toUpperCase(),e+=(h.charCodeAt(0)-64&15).toString(16).toUpperCase(),r+=3,s=!0;continue}}e+="\\c",r+=2;continue}case"u":{if(r+2=n||t[r+3]!=="="&&t[r+3]!=="!")){e+="(?P<",r+=3,s=!0;continue}let o=i.getUtf8CharSize(a);e+=t.substring(r,r+o),r+=o}return s?e:t}},y=class i{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return C.quoteMeta(t)}static quoteReplacement(t,e=!1){return B.quoteReplacement(t,e)}static translateRegExp(t){return i1.translate(t)}static compile(t,e=0){let s=t;if((e&i.CASE_INSENSITIVE)!==0&&(s=`(?i)${s}`),(e&i.DOTALL)!==0&&(s=`(?s)${s}`),(e&i.MULTILINE)!==0&&(s=`(?m)${s}`),(e&~(i.MULTILINE|i.DOTALL|i.CASE_INSENSITIVE|i.DISABLE_UNICODE_GROUPS|i.LONGEST_MATCH))!==0)throw new V("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let n=g.PERL;(e&i.DISABLE_UNICODE_GROUPS)!==0&&(n&=-129);let r=new i(t,e);return r.re2Input=n1.compileImpl(s,n,(e&i.LONGEST_MATCH)!==0),r}static matches(t,e){return i.compile(t).testExact(e)}static initTest(t,e,s){if(t==null)throw new Error("pattern is null");if(s==null)throw new Error("re2 is null");let n=new i(t,e);return n.re2Input=s,n}constructor(t,e){this.patternInput=t,this.flagsInput=e}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=_.utf8(t)),new B(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let e=Array.isArray(t)?R.fromUTF8(t):R.fromUTF16(t);return this.re2Input.executeEngine(e,0,g.ANCHOR_BOTH,0)!==null}split(t,e=0){let s=this.matcher(t),n=[],r=0,a=0;for(;s.find();){if(a===0&&s.end()===0){a=s.end();continue}if(e>0&&n.length===e-1)break;if(a===s.start()){if(e===0){r+=1,a=s.end();continue}}else for(;r>0;)n.push(""),r-=1;n.push(s.substring(a,s.start())),a=s.end()}if(e===0&&a!==s.inputLength()){for(;r>0;)n.push(""),r-=1;n.push(s.substring(a,s.inputLength()))}return(e!==0||n.length===0)&&n.push(s.substring(a,s.inputLength())),n}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}};function x1(i){let t=0;return i.includes("i")&&(t|=y.CASE_INSENSITIVE),i.includes("m")&&(t|=y.MULTILINE),i.includes("s")&&(t|=y.DOTALL),t}function L1(i){return y.translateRegExp(i)}var X=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;constructor(t,e=""){this._pattern=t,this._flags=e,this._global=e.includes("g"),this._ignoreCase=e.includes("i"),this._multiline=e.includes("m");try{let s=L1(t),n=x1(e);this._re2=y.compile(s,n)}catch(s){if(s instanceof m){let n=s.message||"",r="";throw n.includes("(?=")||n.includes("(?!")||n.includes("(?<")||n.includes("(?0){let h=Object.create(null);for(let[p,f]of Object.entries(o)){let A=e.group(f);A!==null&&(h[p]=A)}a.groups=h}return this._global&&(this._lastIndex=e.end(0),e.start(0)===e.end(0)&&this._lastIndex++),a}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let e=[],s=this._re2.matcher(t),n=0;for(;s.find(n);){let r=s.group(0)??"";if(e.push(r),n=s.end(0),s.start(0)===s.end(0)&&n++,n>t.length)break}return e.length>0?e:null}replace(t,e){if(this._global&&(this._lastIndex=0),typeof e=="string"){let p=this._re2.matcher(t);return this._global?p.replaceAll(e,!0):p.replaceFirst(e,!0)}let s=[],n=this._re2.matcher(t),r=0,a=0,o=this._re2.groupCount(),h=this._re2.namedGroups();for(;n.find(a);){s.push(t.slice(r,n.start(0)));let p=[],f=n.group(0)??"";for(let A=1;A<=o;A++)p.push(n.group(A));if(p.push(n.start(0)),p.push(t),h&&Object.keys(h).length>0){let A=Object.create(null);for(let[N,O]of Object.entries(h))A[N]=n.group(O)??"";p.push(A)}if(s.push(e(f,...p)),r=n.end(0),a=r,n.start(0)===n.end(0)&&a++,!this._global||a>t.length)break}return s.push(t.slice(r)),s.join("")}split(t,e){return e===void 0||e<0?this._re2.split(t,-1):e===0?[]:this._re2.split(t,-1).slice(0,e)}search(t){let e=this._re2.matcher(t);return e.find()?e.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let e=this._re2.matcher(t),s=this._re2.groupCount(),n=this._re2.namedGroups(),r=0;for(;e.find(r);){let a=[];a.push(e.group(0)??"");for(let h=1;h<=s;h++)a.push(e.group(h));let o=a;if(o.index=e.start(0),o.input=t,n&&Object.keys(n).length>0){let h=Object.create(null);for(let[p,f]of Object.entries(n)){let A=e.group(f);A!==null&&(h[p]=A)}o.groups=h}if(yield o,r=e.end(0),e.start(0)===e.end(0)&&r++,r>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(t){this._lastIndex=t}};function I1(i,t=""){return new X(i,t)}var r1=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,e){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,e)}split(t,e){return t.split(this._regex,e)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let e=this._regex.exec(t);for(;e!==null;)yield e,e[0].length===0&&this._regex.lastIndex++,e=this._regex.exec(t)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(t){this._regex.lastIndex=t}};export{I1 as a,r1 as b}; -/*! Bundled license information: - -re2js/build/index.esm.js: - (*! - * re2js - * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching - * - * @version v1.4.0 - * @author Alexey Vasiliev - * @homepage https://github.com/le0pard/re2js#readme - * @repository github:le0pard/re2js - * @license MIT - *) -*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-JLX6YWGA.js b/packages/just-bash/dist/bin/chunks/chunk-JLX6YWGA.js deleted file mode 100644 index 0e557459..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-JLX6YWGA.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -async function e(t,o){return{stdout:`user -`,stderr:"",exitCode:0}}var a={name:"whoami",execute:e},n={name:"whoami",flags:[]};export{a,n as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-JNUX75OX.js b/packages/just-bash/dist/bin/chunks/chunk-JNUX75OX.js new file mode 100644 index 00000000..a2025a67 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-JNUX75OX.js @@ -0,0 +1,85 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as Pi}from"./chunk-VZK4FHWJ.js";import{a as Ui,b as Vi,c as Xa}from"./chunk-MUFNRCMY.js";import{c as N,e as hl}from"./chunk-LNVSXNT7.js";var Mt=N((Tf,ji)=>{"use strict";ji.exports=_t;_t.CAPTURING_PHASE=1;_t.AT_TARGET=2;_t.BUBBLING_PHASE=3;function _t(e,t){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=_t.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,e&&(this.type=e),t)for(var r in t)this[r]=t[r]}_t.prototype=Object.create(Object.prototype,{constructor:{value:_t},stopPropagation:{value:function(){this._propagationStopped=!0}},stopImmediatePropagation:{value:function(){this._propagationStopped=!0,this._immediatePropagationStopped=!0}},preventDefault:{value:function(){this.cancelable&&(this.defaultPrevented=!0)}},initEvent:{value:function(t,r,a){this._initialized=!0,!this._dispatching&&(this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=t,this.bubbles=r,this.cancelable=a)}}})});var Ya=N((yf,zi)=>{"use strict";var Gi=Mt();zi.exports=Ka;function Ka(){Gi.call(this),this.view=null,this.detail=0}Ka.prototype=Object.create(Gi.prototype,{constructor:{value:Ka},initUIEvent:{value:function(e,t,r,a,s){this.initEvent(e,t,r),this.view=a,this.detail=s}}})});var $a=N((Nf,Xi)=>{"use strict";var Wi=Ya();Xi.exports=Qa;function Qa(){Wi.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}Qa.prototype=Object.create(Wi.prototype,{constructor:{value:Qa},initMouseEvent:{value:function(e,t,r,a,s,o,x,m,h,g,v,ne,se,u,be){switch(this.initEvent(e,t,r,a,s),this.screenX=o,this.screenY=x,this.clientX=m,this.clientY=h,this.ctrlKey=g,this.altKey=v,this.shiftKey=ne,this.metaKey=se,this.button=u,u){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=be}},getModifierState:{value:function(e){switch(e){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}}}})});var Xr=N((wf,Yi)=>{"use strict";Yi.exports=Wr;var pl=1,ml=3,gl=4,bl=5,El=7,_l=8,vl=9,Tl=11,yl=12,Nl=13,wl=14,Sl=15,Al=17,Cl=18,Dl=19,kl=20,Ll=21,Ml=22,Rl=23,Il=24,Ol=25,ql=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],Hl=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],Ki={INDEX_SIZE_ERR:pl,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:ml,WRONG_DOCUMENT_ERR:gl,INVALID_CHARACTER_ERR:bl,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:El,NOT_FOUND_ERR:_l,NOT_SUPPORTED_ERR:vl,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:Tl,SYNTAX_ERR:yl,INVALID_MODIFICATION_ERR:Nl,NAMESPACE_ERR:wl,INVALID_ACCESS_ERR:Sl,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:Al,SECURITY_ERR:Cl,NETWORK_ERR:Dl,ABORT_ERR:kl,URL_MISMATCH_ERR:Ll,QUOTA_EXCEEDED_ERR:Ml,TIMEOUT_ERR:Rl,INVALID_NODE_TYPE_ERR:Il,DATA_CLONE_ERR:Ol};function Wr(e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=e,this.message=Hl[e],this.name=ql[e]}Wr.prototype.__proto__=Error.prototype;for(zr in Ki)Za={value:Ki[zr]},Object.defineProperty(Wr,zr,Za),Object.defineProperty(Wr.prototype,zr,Za);var Za,zr});var Kr=N(Qi=>{Qi.isApiWritable=!globalThis.__domino_frozen__});var ee=N(V=>{"use strict";var J=Xr(),ae=J,Fl=Kr().isApiWritable;V.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};V.IndexSizeError=function(){throw new J(ae.INDEX_SIZE_ERR)};V.HierarchyRequestError=function(){throw new J(ae.HIERARCHY_REQUEST_ERR)};V.WrongDocumentError=function(){throw new J(ae.WRONG_DOCUMENT_ERR)};V.InvalidCharacterError=function(){throw new J(ae.INVALID_CHARACTER_ERR)};V.NoModificationAllowedError=function(){throw new J(ae.NO_MODIFICATION_ALLOWED_ERR)};V.NotFoundError=function(){throw new J(ae.NOT_FOUND_ERR)};V.NotSupportedError=function(){throw new J(ae.NOT_SUPPORTED_ERR)};V.InvalidStateError=function(){throw new J(ae.INVALID_STATE_ERR)};V.SyntaxError=function(){throw new J(ae.SYNTAX_ERR)};V.InvalidModificationError=function(){throw new J(ae.INVALID_MODIFICATION_ERR)};V.NamespaceError=function(){throw new J(ae.NAMESPACE_ERR)};V.InvalidAccessError=function(){throw new J(ae.INVALID_ACCESS_ERR)};V.TypeMismatchError=function(){throw new J(ae.TYPE_MISMATCH_ERR)};V.SecurityError=function(){throw new J(ae.SECURITY_ERR)};V.NetworkError=function(){throw new J(ae.NETWORK_ERR)};V.AbortError=function(){throw new J(ae.ABORT_ERR)};V.UrlMismatchError=function(){throw new J(ae.URL_MISMATCH_ERR)};V.QuotaExceededError=function(){throw new J(ae.QUOTA_EXCEEDED_ERR)};V.TimeoutError=function(){throw new J(ae.TIMEOUT_ERR)};V.InvalidNodeTypeError=function(){throw new J(ae.INVALID_NODE_TYPE_ERR)};V.DataCloneError=function(){throw new J(ae.DATA_CLONE_ERR)};V.nyi=function(){throw new Error("NotYetImplemented")};V.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};V.assert=function(e,t){if(!e)throw new Error("Assertion failed: "+(t||"")+` +`+new Error().stack)};V.expose=function(e,t){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],writable:Fl})};V.merge=function(e,t){for(var r in t)e[r]=t[r]};V.documentOrder=function(e,t){return 3-(e.compareDocumentPosition(t)&6)};V.toASCIILowerCase=function(e){return e.replace(/[A-Z]+/g,function(t){return t.toLowerCase()})};V.toASCIIUpperCase=function(e){return e.replace(/[a-z]+/g,function(t){return t.toUpperCase()})}});var Ja=N((Cf,Zi)=>{"use strict";var vt=Mt(),Bl=$a(),Pl=ee();Zi.exports=$i;function $i(){}$i.prototype={addEventListener:function(t,r,a){if(r){a===void 0&&(a=!1),this._listeners||(this._listeners=Object.create(null)),this._listeners[t]||(this._listeners[t]=[]);for(var s=this._listeners[t],o=0,x=s.length;o=0&&(a(s[x],t),!t._propagationStopped);x--);if(t._propagationStopped||(t.eventPhase=vt.AT_TARGET,a(this,t)),t.bubbles&&!t._propagationStopped){t.eventPhase=vt.BUBBLING_PHASE;for(var m=0,h=s.length;m{"use strict";var We=ee(),Se=Ji.exports={valid:function(e){return We.assert(e,"list falsy"),We.assert(e._previousSibling,"previous falsy"),We.assert(e._nextSibling,"next falsy"),!0},insertBefore:function(e,t){We.assert(Se.valid(e)&&Se.valid(t));var r=e,a=e._previousSibling,s=t,o=t._previousSibling;r._previousSibling=o,a._nextSibling=s,o._nextSibling=r,s._previousSibling=a,We.assert(Se.valid(e)&&Se.valid(t))},replace:function(e,t){We.assert(Se.valid(e)&&(t===null||Se.valid(t))),t!==null&&Se.insertBefore(t,e),Se.remove(e),We.assert(Se.valid(e)&&(t===null||Se.valid(t)))},remove:function(e){We.assert(Se.valid(e));var t=e._previousSibling;if(t!==e){var r=e._nextSibling;t._nextSibling=r,r._previousSibling=t,e._previousSibling=e._nextSibling=e,We.assert(Se.valid(e))}}}});var tn=N((kf,os)=>{"use strict";os.exports={serializeOne:Xl,\u0275escapeMatchingClosingTag:ns,\u0275escapeClosingCommentTag:is,\u0275escapeProcessingInstructionContent:ss};var as=ee(),Tt=as.NAMESPACE,es={STYLE:!0,SCRIPT:!0,XMP:!0,IFRAME:!0,NOEMBED:!0,NOFRAMES:!0,PLAINTEXT:!0},Ul={area:!0,base:!0,basefont:!0,bgsound:!0,br:!0,col:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Vl={},ts=/[&<>\u00A0]/g,rs=/[&"<>\u00A0]/g;function jl(e){return ts.test(e)?e.replace(ts,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case"\xA0":return" "}}):e}function Gl(e){return rs.test(e)?e.replace(rs,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"\xA0":return" "}}):e}function zl(e){var t=e.namespaceURI;return t?t===Tt.XML?"xml:"+e.localName:t===Tt.XLINK?"xlink:"+e.localName:t===Tt.XMLNS?e.localName==="xmlns"?"xmlns":"xmlns:"+e.localName:e.name:e.localName}function ns(e,t){let r="/;function is(e){return Wl.test(e)?e.replace(/(--\!?)>/g,"$1>"):e}function ss(e){return e.includes(">")?e.replaceAll(">",">"):e}function Xl(e,t){var r="";switch(e.nodeType){case 1:var a=e.namespaceURI,s=a===Tt.HTML,o=s||a===Tt.SVG||a===Tt.MATHML?e.localName:e.tagName;r+="<"+o;for(var x=0,m=e._numattrs;x"}break;case 3:case 4:var v;t.nodeType===1&&t.namespaceURI===Tt.HTML?v=t.tagName:v="",es[v]||v==="NOSCRIPT"&&t.ownerDocument._scripting_enabled?r+=e.data:r+=jl(e.data);break;case 8:r+="";break;case 7:let ne=ss(e.data);r+="";break;case 10:r+="";break;default:as.InvalidStateError()}return r}});var xe=N((Lf,ds)=>{"use strict";ds.exports=K;var fs=Ja(),Yr=en(),cs=tn(),j=ee();function K(){fs.call(this),this.parentNode=null,this._nextSibling=this._previousSibling=this,this._index=void 0}var _e=K.ELEMENT_NODE=1,rn=K.ATTRIBUTE_NODE=2,Qr=K.TEXT_NODE=3,Kl=K.CDATA_SECTION_NODE=4,Yl=K.ENTITY_REFERENCE_NODE=5,an=K.ENTITY_NODE=6,ls=K.PROCESSING_INSTRUCTION_NODE=7,us=K.COMMENT_NODE=8,nr=K.DOCUMENT_NODE=9,Ae=K.DOCUMENT_TYPE_NODE=10,lt=K.DOCUMENT_FRAGMENT_NODE=11,nn=K.NOTATION_NODE=12,sn=K.DOCUMENT_POSITION_DISCONNECTED=1,on=K.DOCUMENT_POSITION_PRECEDING=2,cn=K.DOCUMENT_POSITION_FOLLOWING=4,xs=K.DOCUMENT_POSITION_CONTAINS=8,ln=K.DOCUMENT_POSITION_CONTAINED_BY=16,un=K.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;K.prototype=Object.create(fs.prototype,{baseURI:{get:j.nyi},parentElement:{get:function(){return this.parentNode&&this.parentNode.nodeType===_e?this.parentNode:null}},hasChildNodes:{value:j.shouldOverride},firstChild:{get:j.shouldOverride},lastChild:{get:j.shouldOverride},isConnected:{get:function(){let e=this;for(;e!=null;){if(e.nodeType===K.DOCUMENT_NODE)return!0;e=e.parentNode,e!=null&&e.nodeType===K.DOCUMENT_FRAGMENT_NODE&&(e=e.host)}return!1}},previousSibling:{get:function(){var e=this.parentNode;return!e||this===e.firstChild?null:this._previousSibling}},nextSibling:{get:function(){var e=this.parentNode,t=this._nextSibling;return!e||t===e.firstChild?null:t}},textContent:{get:function(){return null},set:function(e){}},innerText:{get:function(){return null},set:function(e){}},_countChildrenOfType:{value:function(e){for(var t=0,r=this.firstChild;r!==null;r=r.nextSibling)r.nodeType===e&&t++;return t}},_ensureInsertValid:{value:function(t,r,a){var s=this,o,x;if(!t.nodeType)throw new TypeError("not a node");switch(s.nodeType){case nr:case lt:case _e:break;default:j.HierarchyRequestError()}switch(t.isAncestor(s)&&j.HierarchyRequestError(),(r!==null||!a)&&r.parentNode!==s&&j.NotFoundError(),t.nodeType){case lt:case Ae:case _e:case Qr:case ls:case us:break;default:j.HierarchyRequestError()}if(s.nodeType===nr)switch(t.nodeType){case Qr:j.HierarchyRequestError();break;case lt:switch(t._countChildrenOfType(Qr)>0&&j.HierarchyRequestError(),t._countChildrenOfType(_e)){case 0:break;case 1:if(r!==null)for(a&&r.nodeType===Ae&&j.HierarchyRequestError(),x=r.nextSibling;x!==null;x=x.nextSibling)x.nodeType===Ae&&j.HierarchyRequestError();o=s._countChildrenOfType(_e),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==_e)&&j.HierarchyRequestError();break;default:j.HierarchyRequestError()}break;case _e:if(r!==null)for(a&&r.nodeType===Ae&&j.HierarchyRequestError(),x=r.nextSibling;x!==null;x=x.nextSibling)x.nodeType===Ae&&j.HierarchyRequestError();o=s._countChildrenOfType(_e),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==_e)&&j.HierarchyRequestError();break;case Ae:if(r===null)s._countChildrenOfType(_e)&&j.HierarchyRequestError();else for(x=s.firstChild;x!==null&&x!==r;x=x.nextSibling)x.nodeType===_e&&j.HierarchyRequestError();o=s._countChildrenOfType(Ae),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==Ae)&&j.HierarchyRequestError();break}else t.nodeType===Ae&&j.HierarchyRequestError()}},insertBefore:{value:function(t,r){var a=this;a._ensureInsertValid(t,r,!0);var s=r;return s===t&&(s=t.nextSibling),a.doc.adoptNode(t),t._insertOrReplace(a,s,!1),t}},appendChild:{value:function(e){return this.insertBefore(e,null)}},_appendChild:{value:function(e){e._insertOrReplace(this,null,!1)}},removeChild:{value:function(t){var r=this;if(!t.nodeType)throw new TypeError("not a node");return t.parentNode!==r&&j.NotFoundError(),t.remove(),t}},replaceChild:{value:function(t,r){var a=this;return a._ensureInsertValid(t,r,!1),t.doc!==a.doc&&a.doc.adoptNode(t),t._insertOrReplace(a,r,!0),r}},contains:{value:function(t){return t===null?!1:this===t?!0:(this.compareDocumentPosition(t)&ln)!==0}},compareDocumentPosition:{value:function(t){if(this===t)return 0;if(this.doc!==t.doc||this.rooted!==t.rooted)return sn+un;for(var r=[],a=[],s=this;s!==null;s=s.parentNode)r.push(s);for(s=t;s!==null;s=s.parentNode)a.push(s);if(r.reverse(),a.reverse(),r[0]!==a[0])return sn+un;s=Math.min(r.length,a.length);for(var o=1;o2?v[2]:null):u>2&&h!==null&&Yr.insertBefore(v[2],h),t._childNodes)for(v[0]=r===null?t._childNodes.length:r._index,t._childNodes.splice.apply(t._childNodes,v),x=2;x2?t._firstChild=v[2]:a&&(t._firstChild=null));if(s._childNodes?s._childNodes.length=0:s._firstChild=null,t.rooted)for(t.modify(),x=2;x{"use strict";hs.exports=class extends Array{constructor(t){if(super(t&&t.length||0),t)for(var r in t)this[r]=t[r]}item(t){return this[t]||null}}});var gs=N((If,ms)=>{"use strict";function Ql(e){return this[e]||null}function $l(e){return e||(e=[]),e.item=Ql,e}ms.exports=$l});var yt=N((Of,bs)=>{"use strict";var xn;try{xn=ps()}catch{xn=gs()}bs.exports=xn});var $r=N((qf,vs)=>{"use strict";vs.exports=_s;var Es=xe(),Zl=yt();function _s(){Es.call(this),this._firstChild=this._childNodes=null}_s.prototype=Object.create(Es.prototype,{hasChildNodes:{value:function(){return this._childNodes?this._childNodes.length>0:this._firstChild!==null}},childNodes:{get:function(){return this._ensureChildNodes(),this._childNodes}},firstChild:{get:function(){return this._childNodes?this._childNodes.length===0?null:this._childNodes[0]:this._firstChild}},lastChild:{get:function(){var e=this._childNodes,t;return e?e.length===0?null:e[e.length-1]:(t=this._firstChild,t===null?null:t._previousSibling)}},_ensureChildNodes:{value:function(){if(!this._childNodes){var e=this._firstChild,t=e,r=this._childNodes=new Zl;if(e)do r.push(t),t=t._nextSibling;while(t!==e);this._firstChild=null}}},removeChildren:{value:function(){for(var t=this.rooted?this.ownerDocument:null,r=this.firstChild,a;r!==null;)a=r,r=a.nextSibling,t&&t.mutateRemove(a),a.parentNode=null;this._childNodes?this._childNodes.length=0:this._firstChild=null,this.modify()}}})});var Zr=N(hn=>{"use strict";hn.isValidName=iu;hn.isValidQName=su;var Jl=/^[_:A-Za-z][-.:\w]+$/,eu=/^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/,ir="_A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",sr="-._A-Za-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Nt="["+ir+"]["+sr+"]*",fn=ir+":",dn=sr+":",tu=new RegExp("^["+fn+"]["+dn+"]*$"),ru=new RegExp("^("+Nt+"|"+Nt+":"+Nt+")$"),Ts=/[\uD800-\uDB7F\uDC00-\uDFFF]/,ys=/[\uD800-\uDB7F\uDC00-\uDFFF]/g,Ns=/[\uD800-\uDB7F][\uDC00-\uDFFF]/g;ir+="\uD800-\u{EFC00}-\uDFFF";sr+="\uD800-\u{EFC00}-\uDFFF";Nt="["+ir+"]["+sr+"]*";fn=ir+":";dn=sr+":";var au=new RegExp("^["+fn+"]["+dn+"]*$"),nu=new RegExp("^("+Nt+"|"+Nt+":"+Nt+")$");function iu(e){if(Jl.test(e)||tu.test(e))return!0;if(!Ts.test(e)||!au.test(e))return!1;var t=e.match(ys),r=e.match(Ns);return r!==null&&2*r.length===t.length}function su(e){if(eu.test(e)||ru.test(e))return!0;if(!Ts.test(e)||!nu.test(e))return!1;var t=e.match(ys),r=e.match(Ns);return r!==null&&2*r.length===t.length}});var mn=N(pn=>{"use strict";var ws=ee();pn.property=function(e){if(Array.isArray(e.type)){var t=Object.create(null);e.type.forEach(function(s){t[s.value||s]=s.alias||s});var r=e.missing;r===void 0&&(r=null);var a=e.invalid;return a===void 0&&(a=r),{get:function(){var s=this._getattr(e.name);return s===null?r:(s=t[s.toLowerCase()],s!==void 0?s:a!==null?a:s)},set:function(s){this._setattr(e.name,s)}}}else{if(e.type===Boolean)return{get:function(){return this.hasAttribute(e.name)},set:function(s){s?this._setattr(e.name,""):this.removeAttribute(e.name)}};if(e.type===Number||e.type==="long"||e.type==="unsigned long"||e.type==="limited unsigned long with fallback")return ou(e);if(!e.type||e.type===String)return{get:function(){return this._getattr(e.name)||""},set:function(s){e.treatNullAsEmptyString&&s===null&&(s=""),this._setattr(e.name,s)}};if(typeof e.type=="function")return e.type(e.name,e)}throw new Error("Invalid attribute definition")};function ou(e){var t;typeof e.default=="function"?t=e.default:typeof e.default=="number"?t=function(){return e.default}:t=function(){ws.assert(!1,typeof e.default)};var r=e.type==="unsigned long",a=e.type==="long",s=e.type==="limited unsigned long with fallback",o=e.min,x=e.max,m=e.setmin;return o===void 0&&(r&&(o=0),a&&(o=-2147483648),s&&(o=1)),x===void 0&&(r||a||s)&&(x=2147483647),{get:function(){var h=this._getattr(e.name),g=e.float?parseFloat(h):parseInt(h,10);if(h===null||!isFinite(g)||o!==void 0&&gx)return t.call(this);if(r||a||s){if(!/^[ \t\n\f\r]*[-+]?[0-9]/.test(h))return t.call(this);g=g|0}return g},set:function(h){e.float||(h=Math.floor(h)),m!==void 0&&h2147483647?t.call(this):h|0:s?h=h<1||h>2147483647?t.call(this):h|0:a&&(h=h<-2147483648||h>2147483647?t.call(this):h|0),this._setattr(e.name,String(h))}}}pn.registerChangeHandler=function(e,t,r){var a=e.prototype;Object.prototype.hasOwnProperty.call(a,"_attributeChangeHandlers")||(a._attributeChangeHandlers=Object.create(a._attributeChangeHandlers||null)),a._attributeChangeHandlers[t]=r}});var Cs=N((Bf,As)=>{"use strict";As.exports=Ss;var cu=xe();function Ss(e,t){this.root=e,this.filter=t,this.lastModTime=e.lastModTime,this.done=!1,this.cache=[],this.traverse()}Ss.prototype=Object.create(Object.prototype,{length:{get:function(){return this.checkcache(),this.done||this.traverse(),this.cache.length}},item:{value:function(e){return this.checkcache(),!this.done&&e>=this.cache.length&&this.traverse(),this.cache[e]}},checkcache:{value:function(){if(this.lastModTime!==this.root.lastModTime){for(var e=this.cache.length-1;e>=0;e--)this[e]=void 0;this.cache.length=0,this.done=!1,this.lastModTime=this.root.lastModTime}}},traverse:{value:function(e){e!==void 0&&e++;for(var t;(t=this.next())!==null;)if(this[this.cache.length]=t,this.cache.push(t),e&&this.cache.length===e)return;this.done=!0}},next:{value:function(){var e=this.cache.length===0?this.root:this.cache[this.cache.length-1],t;for(e.nodeType===cu.DOCUMENT_NODE?t=e.documentElement:t=e.nextElement(this.root);t;){if(this.filter(t))return t;t=t.nextElement(this.root)}return null}}})});var bn=N((Pf,Ls)=>{"use strict";var gn=ee();Ls.exports=ks;function ks(e,t){this._getString=e,this._setString=t,this._length=0,this._lastStringValue="",this._update()}Object.defineProperties(ks.prototype,{length:{get:function(){return this._length}},item:{value:function(e){var t=Rt(this);return e<0||e>=t.length?null:t[e]}},contains:{value:function(e){e=String(e);var t=Rt(this);return t.indexOf(e)>-1}},add:{value:function(){for(var e=Rt(this),t=0,r=arguments.length;t-1&&e.splice(s,1)}this._update(e)}},toggle:{value:function(t,r){return t=or(t),this.contains(t)?r===void 0||r===!1?(this.remove(t),!1):!0:r===void 0||r===!0?(this.add(t),!0):!1}},replace:{value:function(t,r){String(r)===""&&gn.SyntaxError(),t=or(t),r=or(r);var a=Rt(this),s=a.indexOf(t);if(s<0)return!1;var o=a.indexOf(r);return o<0?a[s]=r:s{"use strict";var Jr=Object.create(null,{location:{get:function(){throw new Error("window.location is not supported.")}}}),uu=function(e,t){return e.compareDocumentPosition(t)},xu=function(e,t){return uu(e,t)&2?1:-1},ta=function(e){for(;(e=e.nextSibling)&&e.nodeType!==1;);return e},Ot=function(e){for(;(e=e.previousSibling)&&e.nodeType!==1;);return e},fu=function(e){if(e=e.firstChild)for(;e.nodeType!==1&&(e=e.nextSibling););return e},du=function(e){if(e=e.lastChild)for(;e.nodeType!==1&&(e=e.previousSibling););return e},It=function(e){if(!e.parentNode)return!1;var t=e.parentNode.nodeType;return t===1||t===9},Ms=function(e){if(!e)return e;var t=e[0];return t==='"'||t==="'"?(e[e.length-1]===t?e=e.slice(1,-1):e=e.slice(1),e.replace(C.str_escape,function(r){var a=/^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(r);if(!a)return r.slice(1);if(a[2])return"";var s=parseInt(a[1],16);return String.fromCodePoint?String.fromCodePoint(s):String.fromCharCode(s)})):C.ident.test(e)?ut(e):e},ut=function(e){return e.replace(C.escape,function(t){var r=/^\\([0-9A-Fa-f]+)/.exec(t);if(!r)return t[1];var a=parseInt(r[1],16);return String.fromCodePoint?String.fromCodePoint(a):String.fromCharCode(a)})},hu=(function(){return Array.prototype.indexOf?Array.prototype.indexOf:function(e,t){for(var r=this.length;r--;)if(this[r]===t)return r;return-1}})(),Is=function(e,t){var r=C.inside.source.replace(//g,t);return new RegExp(r)},ve=function(e,t,r){return e=e.source,e=e.replace(t,r.source||r),new RegExp(e)},Rs=function(e,t){return e.replace(/^(?:\w+:\/\/|\/+)/,"").replace(/(?:\/+|\/*#.*?)$/,"").split("/",t).join("/")},pu=function(e,t){var r=e.replace(/\s+/g,""),a;return r==="even"?r="2n+0":r==="odd"?r="2n+1":r.indexOf("n")===-1&&(r="0n"+r),a=/^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(r),{group:a[1]==="-"?-(a[2]||1):+(a[2]||1),offset:a[4]?a[3]==="-"?-a[4]:+a[4]:0}},En=function(e,t,r){var a=pu(e),s=a.group,o=a.offset,x=r?du:fu,m=r?Ot:ta;return function(h){if(It(h))for(var g=x(h.parentNode),v=0;g;){if(t(g,h)&&v++,g===h)return v-=o,s&&v?v%s===0&&v<0==s<0:!v;g=m(g)}}},oe={"*":(function(){return function(){return!0}})(),type:function(e){return e=e.toLowerCase(),function(t){return t.nodeName.toLowerCase()===e}},attr:function(e,t,r,a){return t=Os[t],function(s){var o;switch(e){case"for":o=s.htmlFor;break;case"class":o=s.className,o===""&&s.getAttribute("class")==null&&(o=null);break;case"href":case"src":o=s.getAttribute(e,2);break;case"title":o=s.getAttribute("title")||null;break;case"id":case"lang":case"dir":case"accessKey":case"hidden":case"tabIndex":case"style":if(s.getAttribute){o=s.getAttribute(e);break}default:if(s.hasAttribute&&!s.hasAttribute(e))break;o=s[e]!=null?s[e]:s.getAttribute&&s.getAttribute(e);break}if(o!=null)return o=o+"",a&&(o=o.toLowerCase(),r=r.toLowerCase()),t(o,r)}},":first-child":function(e){return!Ot(e)&&It(e)},":last-child":function(e){return!ta(e)&&It(e)},":only-child":function(e){return!Ot(e)&&!ta(e)&&It(e)},":nth-child":function(e,t){return En(e,function(){return!0},t)},":nth-last-child":function(e){return oe[":nth-child"](e,!0)},":root":function(e){return e.ownerDocument.documentElement===e},":empty":function(e){return!e.firstChild},":not":function(e){var t=vn(e);return function(r){return!t(r)}},":first-of-type":function(e){if(It(e)){for(var t=e.nodeName;e=Ot(e);)if(e.nodeName===t)return;return!0}},":last-of-type":function(e){if(It(e)){for(var t=e.nodeName;e=ta(e);)if(e.nodeName===t)return;return!0}},":only-of-type":function(e){return oe[":first-of-type"](e)&&oe[":last-of-type"](e)},":nth-of-type":function(e,t){return En(e,function(r,a){return r.nodeName===a.nodeName},t)},":nth-last-of-type":function(e){return oe[":nth-of-type"](e,!0)},":checked":function(e){return!!(e.checked||e.selected)},":indeterminate":function(e){return!oe[":checked"](e)},":enabled":function(e){return!e.disabled&&e.type!=="hidden"},":disabled":function(e){return!!e.disabled},":target":function(e){return e.id===Jr.location.hash.substring(1)},":focus":function(e){return e===e.ownerDocument.activeElement},":is":function(e){return vn(e)},":matches":function(e){return oe[":is"](e)},":nth-match":function(e,t){var r=e.split(/\s*,\s*/),a=r.shift(),s=vn(r.join(","));return En(a,s,t)},":nth-last-match":function(e){return oe[":nth-match"](e,!0)},":links-here":function(e){return e+""==Jr.location+""},":lang":function(e){return function(t){for(;t;){if(t.lang)return t.lang.indexOf(e)===0;t=t.parentNode}}},":dir":function(e){return function(t){for(;t;){if(t.dir)return t.dir===e;t=t.parentNode}}},":scope":function(e,t){var r=t||e.ownerDocument;return r.nodeType===9?e===r.documentElement:e===r},":any-link":function(e){return typeof e.href=="string"},":local-link":function(e){if(e.nodeName)return e.href&&e.host===Jr.location.host;var t=+e+1;return function(r){if(r.href){var a=Jr.location+"",s=r+"";return Rs(a,t)===Rs(s,t)}}},":default":function(e){return!!e.defaultSelected},":valid":function(e){return e.willValidate||e.validity&&e.validity.valid},":invalid":function(e){return!oe[":valid"](e)},":in-range":function(e){return e.value>e.min&&e.value<=e.max},":out-of-range":function(e){return!oe[":in-range"](e)},":required":function(e){return!!e.required},":optional":function(e){return!e.required},":read-only":function(e){if(e.readOnly)return!0;var t=e.getAttribute("contenteditable"),r=e.contentEditable,a=e.nodeName.toLowerCase();return a=a!=="input"&&a!=="textarea",(a||e.disabled)&&t==null&&r!=="true"},":read-write":function(e){return!oe[":read-only"](e)},":hover":function(){throw new Error(":hover is not supported.")},":active":function(){throw new Error(":active is not supported.")},":link":function(){throw new Error(":link is not supported.")},":visited":function(){throw new Error(":visited is not supported.")},":column":function(){throw new Error(":column is not supported.")},":nth-column":function(){throw new Error(":nth-column is not supported.")},":nth-last-column":function(){throw new Error(":nth-last-column is not supported.")},":current":function(){throw new Error(":current is not supported.")},":past":function(){throw new Error(":past is not supported.")},":future":function(){throw new Error(":future is not supported.")},":contains":function(e){return function(t){var r=t.innerText||t.textContent||t.value||"";return r.indexOf(e)!==-1}},":has":function(e){return function(t){return qs(e,t).length>0}}},Os={"-":function(){return!0},"=":function(e,t){return e===t},"*=":function(e,t){return e.indexOf(t)!==-1},"~=":function(e,t){var r,a,s,o;for(a=0;;a=r+1){if(r=e.indexOf(t,a),r===-1)return!1;if(s=e[r-1],o=e[r+t.length],(!s||s===" ")&&(!o||o===" "))return!0}},"|=":function(e,t){var r=e.indexOf(t),a;if(r===0)return a=e[r+t.length],a==="-"||!a},"^=":function(e,t){return e.indexOf(t)===0},"$=":function(e,t){var r=e.lastIndexOf(t);return r!==-1&&r+t.length===e.length},"!=":function(e,t){return e!==t}},cr={" ":function(e){return function(t){for(;t=t.parentNode;)if(e(t))return t}},">":function(e){return function(t){if(t=t.parentNode)return e(t)&&t}},"+":function(e){return function(t){if(t=Ot(t))return e(t)&&t}},"~":function(e){return function(t){for(;t=Ot(t);)if(e(t))return t}},noop:function(e){return function(t){return e(t)&&t}},ref:function(e,t){var r;function a(s){for(var o=s.ownerDocument,x=o.getElementsByTagName("*"),m=x.length;m--;)if(r=x[m],a.test(s))return r=null,!0;r=null}return a.combinator=function(s){if(!(!r||!r.getAttribute)){var o=r.getAttribute(t)||"";if(o[0]==="#"&&(o=o.substring(1)),o===s.id&&e(r))return r}},a}},C={escape:/\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g,str_escape:/(escape)|\\(\n|\r\n?|\f)/g,nonascii:/[\u00A0-\uFFFF]/,cssid:/(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/,qname:/^ *(cssid|\*)/,simple:/^(?:([.#]cssid)|pseudo|attr)/,ref:/^ *\/(cssid)\/ */,combinator:/^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/,attr:/^\[(cssid)(?:([^\w]?=)(inside))?\]/,pseudo:/^(:cssid)(?:\((inside)\))?/,inside:/(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/,ident:/^(cssid)$/};C.cssid=ve(C.cssid,"nonascii",C.nonascii);C.cssid=ve(C.cssid,"escape",C.escape);C.qname=ve(C.qname,"cssid",C.cssid);C.simple=ve(C.simple,"cssid",C.cssid);C.ref=ve(C.ref,"cssid",C.cssid);C.attr=ve(C.attr,"cssid",C.cssid);C.pseudo=ve(C.pseudo,"cssid",C.cssid);C.inside=ve(C.inside,`[^"'>]*`,C.inside);C.attr=ve(C.attr,"inside",Is("\\[","\\]"));C.pseudo=ve(C.pseudo,"inside",Is("\\(","\\)"));C.simple=ve(C.simple,"pseudo",C.pseudo);C.simple=ve(C.simple,"attr",C.attr);C.ident=ve(C.ident,"cssid",C.cssid);C.str_escape=ve(C.str_escape,"escape",C.escape);var lr=function(e){for(var t=e.replace(/^\s+|\s+$/g,""),r,a=[],s=[],o,x,m,h,g;t;){if(m=C.qname.exec(t))t=t.substring(m[0].length),x=ut(m[1]),s.push(ea(x,!0));else if(m=C.simple.exec(t))t=t.substring(m[0].length),x="*",s.push(ea(x,!0)),s.push(ea(m));else throw new SyntaxError("Invalid selector.");for(;m=C.simple.exec(t);)t=t.substring(m[0].length),s.push(ea(m));if(t[0]==="!"&&(t=t.substring(1),o=gu(),o.qname=x,s.push(o.simple)),m=C.ref.exec(t)){t=t.substring(m[0].length),g=cr.ref(_n(s),ut(m[1])),a.push(g.combinator),s=[];continue}if(m=C.combinator.exec(t)){if(t=t.substring(m[0].length),h=m[1]||m[2]||m[3],h===","){a.push(cr.noop(_n(s)));break}}else h="noop";if(!cr[h])throw new SyntaxError("Bad combinator.");a.push(cr[h](_n(s))),s=[]}return r=mu(a),r.qname=x,r.sel=t,o&&(o.lname=r.qname,o.test=r,o.qname=o.qname,o.sel=r.sel,r=o),g&&(g.test=r,g.qname=r.qname,g.sel=r.sel,r=g),r},ea=function(e,t){if(t)return e==="*"?oe["*"]:oe.type(e);if(e[1])return e[1][0]==="."?oe.attr("class","~=",ut(e[1].substring(1)),!1):oe.attr("id","=",ut(e[1].substring(1)),!1);if(e[2])return e[3]?oe[ut(e[2])](Ms(e[3])):oe[ut(e[2])];if(e[4]){var r=e[6],a=/["'\s]\s*I$/i.test(r);return a&&(r=r.replace(/\s*I$/i,"")),oe.attr(ut(e[4]),e[5]||"-",Ms(r),a)}throw new SyntaxError("Unknown Selector.")},_n=function(e){var t=e.length,r;return t<2?e[0]:function(a){if(a){for(r=0;r{"use strict";var bu=xe(),Eu=en(),Tn=function(e,t){for(var r=e.createDocumentFragment(),a=0;a{"use strict";var Bs=xe(),vu={nextElementSibling:{get:function(){if(this.parentNode){for(var e=this.nextSibling;e!==null;e=e.nextSibling)if(e.nodeType===Bs.ELEMENT_NODE)return e}return null}},previousElementSibling:{get:function(){if(this.parentNode){for(var e=this.previousSibling;e!==null;e=e.previousSibling)if(e.nodeType===Bs.ELEMENT_NODE)return e}return null}}};Ps.exports=vu});var Nn=N((jf,Vs)=>{"use strict";Vs.exports=Us;var Ht=ee();function Us(e){this.element=e}Object.defineProperties(Us.prototype,{length:{get:Ht.shouldOverride},item:{value:Ht.shouldOverride},getNamedItem:{value:function(t){return this.element.getAttributeNode(t)}},getNamedItemNS:{value:function(t,r){return this.element.getAttributeNodeNS(t,r)}},setNamedItem:{value:Ht.nyi},setNamedItemNS:{value:Ht.nyi},removeNamedItem:{value:function(t){var r=this.element.getAttributeNode(t);if(r)return this.element.removeAttribute(t),r;Ht.NotFoundError()}},removeNamedItemNS:{value:function(t,r){var a=this.element.getAttributeNodeNS(t,r);if(a)return this.element.removeAttributeNS(t,r),a;Ht.NotFoundError()}}})});var Bt=N((Gf,Xs)=>{"use strict";Xs.exports=xt;var wn=Zr(),Q=ee(),He=Q.NAMESPACE,ia=mn(),ke=xe(),Sn=yt(),Tu=tn(),na=Cs(),Ft=Xr(),yu=bn(),An=ra(),Gs=$r(),Nu=aa(),wu=yn(),zs=Nn(),js=Object.create(null);function xt(e,t,r,a){Gs.call(this),this.nodeType=ke.ELEMENT_NODE,this.ownerDocument=e,this.localName=t,this.namespaceURI=r,this.prefix=a,this._tagName=void 0,this._attrsByQName=Object.create(null),this._attrsByLName=Object.create(null),this._attrKeys=[]}function Cn(e,t){if(e.nodeType===ke.TEXT_NODE)t.push(e._data);else for(var r=0,a=e.childNodes.length;r0}},toggleAttribute:{value:function(t,r){t=String(t),wn.isValidName(t)||Q.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t));var a=this._attrsByQName[t];return a===void 0?r===void 0||r===!0?(this._setAttribute(t,""),!0):!1:r===void 0||r===!1?(this.removeAttribute(t),!1):!0}},_setAttribute:{value:function(t,r){var a=this._attrsByQName[t],s;a?Array.isArray(a)&&(a=a[0]):(a=this._newattr(t),s=!0),a.value=r,this._attributes&&(this._attributes[t]=a),s&&this._newattrhook&&this._newattrhook(t,r)}},setAttribute:{value:function(t,r){t=String(t),wn.isValidName(t)||Q.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t)),this._setAttribute(t,String(r))}},_setAttributeNS:{value:function(t,r,a){var s=r.indexOf(":"),o,x;s<0?(o=null,x=r):(o=r.substring(0,s),x=r.substring(s+1)),(t===""||t===void 0)&&(t=null);var m=(t===null?"":t)+"|"+x,h=this._attrsByLName[m],g;h||(h=new ur(this,x,o,t),g=!0,this._attrsByLName[m]=h,this._attributes&&(this._attributes[this._attrKeys.length]=h),this._attrKeys.push(m),this._addQName(h)),h.value=a,g&&this._newattrhook&&this._newattrhook(r,a)}},setAttributeNS:{value:function(t,r,a){t=t==null||t===""?null:String(t),r=String(r),wn.isValidQName(r)||Q.InvalidCharacterError();var s=r.indexOf(":"),o=s<0?null:r.substring(0,s);(o!==null&&t===null||o==="xml"&&t!==He.XML||(r==="xmlns"||o==="xmlns")&&t!==He.XMLNS||t===He.XMLNS&&!(r==="xmlns"||o==="xmlns"))&&Q.NamespaceError(),this._setAttributeNS(t,r,String(a))}},setAttributeNode:{value:function(t){if(t.ownerElement!==null&&t.ownerElement!==this)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);var r=null,a=this._attrsByQName[t.name];if(a){if(Array.isArray(a)||(a=[a]),a.some(function(s){return s===t}))return t;if(t.ownerElement!==null)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);a.forEach(function(s){this.removeAttributeNode(s)},this),r=a[0]}return this.setAttributeNodeNS(t),r}},setAttributeNodeNS:{value:function(t){if(t.ownerElement!==null)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);var r=t.namespaceURI,a=(r===null?"":r)+"|"+t.localName,s=this._attrsByLName[a];return s&&this.removeAttributeNode(s),t._setOwnerElement(this),this._attrsByLName[a]=t,this._attributes&&(this._attributes[this._attrKeys.length]=t),this._attrKeys.push(a),this._addQName(t),this._newattrhook&&this._newattrhook(t.name,t.value),s||null}},removeAttribute:{value:function(t){t=String(t),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t));var r=this._attrsByQName[t];if(r){Array.isArray(r)?r.length>2?r=r.shift():(this._attrsByQName[t]=r[1],r=r[0]):this._attrsByQName[t]=void 0;var a=r.namespaceURI,s=(a===null?"":a)+"|"+r.localName;this._attrsByLName[s]=void 0;var o=this._attrKeys.indexOf(s);this._attributes&&(Array.prototype.splice.call(this._attributes,o,1),this._attributes[t]=void 0),this._attrKeys.splice(o,1);var x=r.onchange;r._setOwnerElement(null),x&&x.call(r,this,r.localName,r.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(r)}}},removeAttributeNS:{value:function(t,r){t=t==null?"":String(t),r=String(r);var a=t+"|"+r,s=this._attrsByLName[a];if(s){this._attrsByLName[a]=void 0;var o=this._attrKeys.indexOf(a);this._attributes&&Array.prototype.splice.call(this._attributes,o,1),this._attrKeys.splice(o,1),this._removeQName(s);var x=s.onchange;s._setOwnerElement(null),x&&x.call(s,this,s.localName,s.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(s)}}},removeAttributeNode:{value:function(t){var r=t.namespaceURI,a=(r===null?"":r)+"|"+t.localName;return this._attrsByLName[a]!==t&&Q.NotFoundError(),this.removeAttributeNS(r,t.localName),t}},getAttributeNames:{value:function(){var t=this;return this._attrKeys.map(function(r){return t._attrsByLName[r].name})}},_getattr:{value:function(t){var r=this._attrsByQName[t];return r?r.value:null}},_setattr:{value:function(t,r){var a=this._attrsByQName[t],s;a||(a=this._newattr(t),s=!0),a.value=String(r),this._attributes&&(this._attributes[t]=a),s&&this._newattrhook&&this._newattrhook(t,r)}},_newattr:{value:function(t){var r=new ur(this,t,null,null),a="|"+t;return this._attrsByQName[t]=r,this._attrsByLName[a]=r,this._attributes&&(this._attributes[this._attrKeys.length]=r),this._attrKeys.push(a),r}},_addQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];r?Array.isArray(r)?r.push(e):this._attrsByQName[t]=[r,e]:this._attrsByQName[t]=e,this._attributes&&(this._attributes[t]=e)}},_removeQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];if(Array.isArray(r)){var a=r.indexOf(e);Q.assert(a!==-1),r.length===2?(this._attrsByQName[t]=r[1-a],this._attributes&&(this._attributes[t]=this._attrsByQName[t])):(r.splice(a,1),this._attributes&&this._attributes[t]===e&&(this._attributes[t]=r[0]))}else Q.assert(r===e),this._attrsByQName[t]=void 0,this._attributes&&(this._attributes[t]=void 0)}},_numattrs:{get:function(){return this._attrKeys.length}},_attr:{value:function(e){return this._attrsByLName[this._attrKeys[e]]}},id:ia.property({name:"id"}),className:ia.property({name:"class"}),classList:{get:function(){var e=this;if(this._classList)return this._classList;var t=new yu(function(){return e.className||""},function(r){e.className=r});return this._classList=t,t},set:function(e){this.className=e}},matches:{value:function(e){return An.matches(this,e)}},closest:{value:function(e){var t=this;do{if(t.matches&&t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===ke.ELEMENT_NODE);return null}},querySelector:{value:function(e){return An(e,this)[0]}},querySelectorAll:{value:function(e){var t=An(e,this);return t.item?t:new Sn(t)}}});Object.defineProperties(xt.prototype,Nu);Object.defineProperties(xt.prototype,wu);ia.registerChangeHandler(xt,"id",function(e,t,r,a){e.rooted&&(r&&e.ownerDocument.delId(r,e),a&&e.ownerDocument.addId(a,e))});ia.registerChangeHandler(xt,"class",function(e,t,r,a){e._classList&&e._classList._update()});function ur(e,t,r,a,s){this.localName=t,this.prefix=r===null||r===""?null:""+r,this.namespaceURI=a===null||a===""?null:""+a,this.data=s,this._setOwnerElement(e)}ur.prototype=Object.create(Object.prototype,{ownerElement:{get:function(){return this._ownerElement}},_setOwnerElement:{value:function(t){this._ownerElement=t,this.prefix===null&&this.namespaceURI===null&&t?this.onchange=t._attributeChangeHandlers[this.localName]:this.onchange=null}},name:{get:function(){return this.prefix?this.prefix+":"+this.localName:this.localName}},specified:{get:function(){return!0}},value:{get:function(){return this.data},set:function(e){var t=this.data;e=e===void 0?"":e+"",e!==t&&(this.data=e,this.ownerElement&&(this.onchange&&this.onchange(this.ownerElement,this.localName,t,e),this.ownerElement.rooted&&this.ownerElement.ownerDocument.mutateAttr(this,t)))}},cloneNode:{value:function(t){return new ur(null,this.localName,this.prefix,this.namespaceURI,this.data)}},nodeType:{get:function(){return ke.ATTRIBUTE_NODE}},nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return this.value},set:function(e){this.value=e}},textContent:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}},innerText:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}}});xt._Attr=ur;function kn(e){zs.call(this,e);for(var t in e._attrsByQName)this[t]=e._attrsByQName[t];for(var r=0;r>>0,e>=this.length?null:this.element._attrsByLName[this.element._attrKeys[e]]}}});globalThis.Symbol?.iterator&&(kn.prototype[globalThis.Symbol.iterator]=function(){var e=0,t=this.length,r=this;return{next:function(){return e{"use strict";Zs.exports=$s;var Ys=xe(),Lu=yt(),Qs=ee(),Ks=Qs.HierarchyRequestError,Mu=Qs.NotFoundError;function $s(){Ys.call(this)}$s.prototype=Object.create(Ys.prototype,{hasChildNodes:{value:function(){return!1}},firstChild:{value:null},lastChild:{value:null},insertBefore:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Ks()}},replaceChild:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Ks()}},removeChild:{value:function(e){if(!e.nodeType)throw new TypeError("not a node");Mu()}},removeChildren:{value:function(){}},childNodes:{get:function(){return this._childNodes||(this._childNodes=new Lu),this._childNodes}}})});var xr=N((Wf,t0)=>{"use strict";t0.exports=sa;var e0=Ln(),Js=ee(),Ru=aa(),Iu=yn();function sa(){e0.call(this)}sa.prototype=Object.create(e0.prototype,{substringData:{value:function(t,r){if(arguments.length<2)throw new TypeError("Not enough arguments");return t=t>>>0,r=r>>>0,(t>this.data.length||t<0||r<0)&&Js.IndexSizeError(),this.data.substring(t,t+r)}},appendData:{value:function(t){if(arguments.length<1)throw new TypeError("Not enough arguments");this.data+=String(t)}},insertData:{value:function(t,r){return this.replaceData(t,0,r)}},deleteData:{value:function(t,r){return this.replaceData(t,r,"")}},replaceData:{value:function(t,r,a){var s=this.data,o=s.length;t=t>>>0,r=r>>>0,a=String(a),(t>o||t<0)&&Js.IndexSizeError(),t+r>o&&(r=o-t);var x=s.substring(0,t),m=s.substring(t+r);this.data=x+a+m}},isEqual:{value:function(t){return this._data===t._data}},length:{get:function(){return this.data.length}}});Object.defineProperties(sa.prototype,Ru);Object.defineProperties(sa.prototype,Iu)});var Rn=N((Xf,i0)=>{"use strict";i0.exports=Mn;var r0=ee(),a0=xe(),n0=xr();function Mn(e,t){n0.call(this),this.nodeType=a0.TEXT_NODE,this.ownerDocument=e,this._data=t,this._index=void 0}var fr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),e!==this._data&&(this._data=e,this.rooted&&this.ownerDocument.mutateValue(this),this.parentNode&&this.parentNode._textchangehook&&this.parentNode._textchangehook(this))}};Mn.prototype=Object.create(n0.prototype,{nodeName:{value:"#text"},nodeValue:fr,textContent:fr,innerText:fr,data:{get:fr.get,set:function(e){fr.set.call(this,e===null?"":String(e))}},splitText:{value:function(t){(t>this._data.length||t<0)&&r0.IndexSizeError();var r=this._data.substring(t),a=this.ownerDocument.createTextNode(r);this.data=this.data.substring(0,t);var s=this.parentNode;return s!==null&&s.insertBefore(a,this.nextSibling),a}},wholeText:{get:function(){for(var t=this.textContent,r=this.nextSibling;r&&r.nodeType===a0.TEXT_NODE;r=r.nextSibling)t+=r.textContent;return t}},replaceWholeText:{value:r0.nyi},clone:{value:function(){return new Mn(this.ownerDocument,this._data)}}})});var On=N((Kf,o0)=>{"use strict";o0.exports=In;var Ou=xe(),s0=xr();function In(e,t){s0.call(this),this.nodeType=Ou.COMMENT_NODE,this.ownerDocument=e,this._data=t}var dr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};In.prototype=Object.create(s0.prototype,{nodeName:{value:"#comment"},nodeValue:dr,textContent:dr,innerText:dr,data:{get:dr.get,set:function(e){dr.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new In(this.ownerDocument,this._data)}}})});var Hn=N((Yf,u0)=>{"use strict";u0.exports=qn;var qu=xe(),Hu=yt(),l0=$r(),oa=Bt(),Fu=ra(),c0=ee();function qn(e){l0.call(this),this.nodeType=qu.DOCUMENT_FRAGMENT_NODE,this.ownerDocument=e}qn.prototype=Object.create(l0.prototype,{nodeName:{value:"#document-fragment"},nodeValue:{get:function(){return null},set:function(){}},textContent:Object.getOwnPropertyDescriptor(oa.prototype,"textContent"),innerText:Object.getOwnPropertyDescriptor(oa.prototype,"innerText"),querySelector:{value:function(e){var t=this.querySelectorAll(e);return t.length?t[0]:null}},querySelectorAll:{value:function(e){var t=Object.create(this);t.isHTML=!0,t.getElementsByTagName=oa.prototype.getElementsByTagName,t.nextElement=Object.getOwnPropertyDescriptor(oa.prototype,"firstElementChild").get;var r=Fu(e,t);return r.item?r:new Hu(r)}},clone:{value:function(){return new qn(this.ownerDocument)}},isEqual:{value:function(t){return!0}},innerHTML:{get:function(){return this.serialize()},set:c0.nyi},outerHTML:{get:function(){return this.serialize()},set:c0.nyi}})});var Bn=N((Qf,f0)=>{"use strict";f0.exports=Fn;var Bu=xe(),x0=xr();function Fn(e,t,r){x0.call(this),this.nodeType=Bu.PROCESSING_INSTRUCTION_NODE,this.ownerDocument=e,this.target=t,this._data=r}var hr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};Fn.prototype=Object.create(x0.prototype,{nodeName:{get:function(){return this.target}},nodeValue:hr,textContent:hr,innerText:hr,data:{get:hr.get,set:function(e){hr.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new Fn(this.ownerDocument,this.target,this._data)}},isEqual:{value:function(t){return this.target===t.target&&this._data===t._data}}})});var pr=N(($f,d0)=>{"use strict";var Pn={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3,SHOW_ALL:4294967295,SHOW_ELEMENT:1,SHOW_ATTRIBUTE:2,SHOW_TEXT:4,SHOW_CDATA_SECTION:8,SHOW_ENTITY_REFERENCE:16,SHOW_ENTITY:32,SHOW_PROCESSING_INSTRUCTION:64,SHOW_COMMENT:128,SHOW_DOCUMENT:256,SHOW_DOCUMENT_TYPE:512,SHOW_DOCUMENT_FRAGMENT:1024,SHOW_NOTATION:2048};d0.exports=Pn.constructor=Pn.prototype=Pn});var Vn=N((Jf,p0)=>{"use strict";var Zf=p0.exports={nextSkippingChildren:Pu,nextAncestorSibling:Un,next:Uu,previous:Vu,deepLastChild:h0};function Pu(e,t){return e===t?null:e.nextSibling!==null?e.nextSibling:Un(e,t)}function Un(e,t){for(e=e.parentNode;e!==null;e=e.parentNode){if(e===t)return null;if(e.nextSibling!==null)return e.nextSibling}return null}function Uu(e,t){var r;return r=e.firstChild,r!==null?r:e===t?null:(r=e.nextSibling,r!==null?r:Un(e,t))}function h0(e){for(;e.lastChild;)e=e.lastChild;return e}function Vu(e,t){var r;return r=e.previousSibling,r!==null?h0(r):(r=e.parentNode,r===t?null:r)}});var T0=N((ed,v0)=>{"use strict";v0.exports=_0;var ju=xe(),fe=pr(),m0=Vn(),E0=ee(),jn={first:"firstChild",last:"lastChild",next:"firstChild",previous:"lastChild"},Gn={first:"nextSibling",last:"previousSibling",next:"nextSibling",previous:"previousSibling"};function g0(e,t){var r,a,s,o,x;for(a=e._currentNode[jn[t]];a!==null;){if(o=e._internalFilter(a),o===fe.FILTER_ACCEPT)return e._currentNode=a,a;if(o===fe.FILTER_SKIP&&(r=a[jn[t]],r!==null)){a=r;continue}for(;a!==null;){if(x=a[Gn[t]],x!==null){a=x;break}if(s=a.parentNode,s===null||s===e.root||s===e._currentNode)return null;a=s}}return null}function b0(e,t){var r,a,s;if(r=e._currentNode,r===e.root)return null;for(;;){for(s=r[Gn[t]];s!==null;){if(r=s,a=e._internalFilter(r),a===fe.FILTER_ACCEPT)return e._currentNode=r,r;s=r[jn[t]],(a===fe.FILTER_REJECT||s===null)&&(s=r[Gn[t]])}if(r=r.parentNode,r===null||r===e.root||e._internalFilter(r)===fe.FILTER_ACCEPT)return null}}function _0(e,t,r){(!e||!e.nodeType)&&E0.NotSupportedError(),this._root=e,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,this._currentNode=e}Object.defineProperties(_0.prototype,{root:{get:function(){return this._root}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},currentNode:{get:function(){return this._currentNode},set:function(t){if(!(t instanceof ju))throw new TypeError("Not a Node");this._currentNode=t}},_internalFilter:{value:function(t){var r,a;if(this._active&&E0.InvalidStateError(),!(1<{"use strict";A0.exports=S0;var zn=pr(),Wn=Vn(),w0=ee();function Gu(e,t,r){return r?Wn.next(e,t):e===t?null:Wn.previous(e,null)}function y0(e,t){for(;t;t=t.parentNode)if(e===t)return!0;return!1}function N0(e,t){var r,a;for(r=e._referenceNode,a=e._pointerBeforeReferenceNode;;){if(a===t)a=!a;else if(r=Gu(r,e._root,t),r===null)return null;var s=e._internalFilter(r);if(s===zn.FILTER_ACCEPT)break}return e._referenceNode=r,e._pointerBeforeReferenceNode=a,r}function S0(e,t,r){(!e||!e.nodeType)&&w0.NotSupportedError(),this._root=e,this._referenceNode=e,this._pointerBeforeReferenceNode=!0,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,e.doc._attachNodeIterator(this)}Object.defineProperties(S0.prototype,{root:{get:function(){return this._root}},referenceNode:{get:function(){return this._referenceNode}},pointerBeforeReferenceNode:{get:function(){return this._pointerBeforeReferenceNode}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},_internalFilter:{value:function(t){var r,a;if(this._active&&w0.InvalidStateError(),!(1<{"use strict";D0.exports=de;function de(e){if(!e)return Object.create(de.prototype);this.url=e.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,"");var t=de.pattern.exec(this.url);if(t){if(t[2]&&(this.scheme=t[2]),t[4]){var r=t[4].match(de.userinfoPattern);if(r&&(this.username=r[1],this.password=r[3],t[4]=t[4].substring(r[0].length)),t[4].match(de.portPattern)){var a=t[4].lastIndexOf(":");this.host=t[4].substring(0,a),this.port=t[4].substring(a+1)}else this.host=t[4]}t[5]&&(this.path=t[5]),t[6]&&(this.query=t[7]),t[8]&&(this.fragment=t[9])}}de.pattern=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;de.userinfoPattern=/^([^@:]*)(:([^@]*))?@/;de.portPattern=/:\d+$/;de.authorityPattern=/^[^:\/?#]+:\/\//;de.hierarchyPattern=/^[^:\/?#]+:\//;de.percentEncode=function(t){var r=t.charCodeAt(0);if(r<256)return"%"+r.toString(16);throw Error("can't percent-encode codepoints > 255 yet")};de.prototype={constructor:de,isAbsolute:function(){return!!this.scheme},isAuthorityBased:function(){return de.authorityPattern.test(this.url)},isHierarchical:function(){return de.hierarchyPattern.test(this.url)},toString:function(){var e="";return this.scheme!==void 0&&(e+=this.scheme+":"),this.isAbsolute()&&(e+="//",(this.username||this.password)&&(e+=this.username||"",this.password&&(e+=":"+this.password),e+="@"),this.host&&(e+=this.host)),this.port!==void 0&&(e+=":"+this.port),this.path!==void 0&&(e+=this.path),this.query!==void 0&&(e+="?"+this.query),this.fragment!==void 0&&(e+="#"+this.fragment),e},resolve:function(e){var t=this,r=new de(e),a=new de;return r.scheme!==void 0?(a.scheme=r.scheme,a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=o(r.path),a.query=r.query):(a.scheme=t.scheme,r.host!==void 0?(a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=o(r.path),a.query=r.query):(a.username=t.username,a.password=t.password,a.host=t.host,a.port=t.port,r.path?(r.path.charAt(0)==="/"?a.path=o(r.path):(a.path=s(t.path,r.path),a.path=o(a.path)),a.query=r.query):(a.path=t.path,r.query!==void 0?a.query=r.query:a.query=t.query))),a.fragment=r.fragment,a.toString();function s(x,m){if(t.host!==void 0&&!t.path)return"/"+m;var h=x.lastIndexOf("/");return h===-1?m:x.substring(0,h+1)+m}function o(x){if(!x)return x;for(var m="";x.length>0;){if(x==="."||x===".."){x="";break}var h=x.substring(0,2),g=x.substring(0,3),v=x.substring(0,4);if(g==="../")x=x.substring(3);else if(h==="./")x=x.substring(2);else if(g==="/./")x="/"+x.substring(3);else if(h==="/."&&x.length===2)x="/";else if(v==="/../"||g==="/.."&&x.length===3)x="/"+x.substring(4),m=m.replace(/\/?[^\/]*$/,"");else{var ne=x.match(/(\/?([^\/]*))/)[0];m+=ne,x=x.substring(ne.length)}}return m}}}});var M0=N((ad,L0)=>{"use strict";L0.exports=Xn;var k0=Mt();function Xn(e,t){k0.call(this,e,t)}Xn.prototype=Object.create(k0.prototype,{constructor:{value:Xn}})});var Kn=N((nd,R0)=>{"use strict";R0.exports={Event:Mt(),UIEvent:Ya(),MouseEvent:$a(),CustomEvent:M0()}});var O0=N(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.hyphenate=Pt.parse=void 0;function zu(e){let t=[],r=0,a=0,s=0,o=0,x=0,m=null;for(;r0&&a===0&&s===0){let g=e.substring(o,r-1).trim();t.push(m,g),x=r,o=0,m=null}break}if(m&&o){let h=e.slice(o).trim();t.push(m,h)}return t}Pt.parse=zu;function I0(e){return e.replace(/[a-z][A-Z]/g,t=>t.charAt(0)+"-"+t.charAt(1)).toLowerCase()}Pt.hyphenate=I0});var la=N((sd,P0)=>{"use strict";var{parse:Wu}=O0();P0.exports=function(e){let t=new B0(e),r={get:function(a,s){return s in a?a[s]:a.getPropertyValue(q0(s))},has:function(a,s){return!0},set:function(a,s,o){return s in a?a[s]=o:a.setProperty(q0(s),o??void 0),!0}};return new Proxy(t,r)};function q0(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function B0(e){this._element=e}var H0="!important";function F0(e){let t={property:{},priority:{}};if(!e)return t;let r=Wu(e);if(r.length<2)return t;for(let a=0;a{"use strict";var ce=ca();U0.exports=mr;function mr(){}mr.prototype=Object.create(Object.prototype,{_url:{get:function(){return new ce(this.href)}},protocol:{get:function(){var e=this._url;return e&&e.scheme?e.scheme+":":":"},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e=e.replace(/:+$/,""),e=e.replace(/[^-+\.a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.scheme=e,t=r.toString())),this.href=t}},host:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host+(e.port?":"+e.port:""):""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.host=e,delete r.port,t=r.toString())),this.href=t}},hostname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/^\/+/,""),e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.host=e,t=r.toString())),this.href=t}},port:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()&&e.port!==void 0?e.port:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=""+e,e=e.replace(/[^0-9].*$/,""),e=e.replace(/^0+/,""),e.length===0&&(e="0"),parseInt(e,10)<=65535&&(r.port=e,t=r.toString())),this.href=t}},pathname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()?e.path:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)!=="/"&&(e="/"+e),e=e.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g,ce.percentEncode),r.path=e,t=r.toString()),this.href=t}},search:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()&&e.query!==void 0?"?"+e.query:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)==="?"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,ce.percentEncode),r.query=e,t=r.toString()),this.href=t}},hash:{get:function(){var e=this._url;return e==null||e.fragment==null||e.fragment===""?"":"#"+e.fragment},set:function(e){var t=this.href,r=new ce(t);e.charAt(0)==="#"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,ce.percentEncode),r.fragment=e,t=r.toString(),this.href=t}},username:{get:function(){var e=this._url;return e.username||""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g,ce.percentEncode),r.username=e,t=r.toString()),this.href=t}},password:{get:function(){var e=this._url;return e.password||""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e===""?r.password=null:(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g,ce.percentEncode),r.password=e),t=r.toString()),this.href=t}},origin:{get:function(){var e=this._url;if(e==null)return"";var t=function(r){var a=[e.scheme,e.host,+e.port||r];return a[0]+"://"+a[1]+(a[2]===r?"":":"+a[2])};switch(e.scheme){case"ftp":return t(21);case"gopher":return t(70);case"http":case"ws":return t(80);case"https":case"wss":return t(443);default:return e.scheme+"://"}}}});mr._inherit=function(e){Object.getOwnPropertyNames(mr.prototype).forEach(function(t){if(!(t==="constructor"||t==="href")){var r=Object.getOwnPropertyDescriptor(mr.prototype,t);Object.defineProperty(e,t,r)}})}});var Qn=N((cd,G0)=>{"use strict";var V0=mn(),Xu=Kr().isApiWritable;G0.exports=function(e,t,r,a){var s=e.ctor;if(s){var o=e.props||{};if(e.attributes)for(var x in e.attributes){var m=e.attributes[x];(typeof m!="object"||Array.isArray(m))&&(m={type:m}),m.name||(m.name=x.toLowerCase()),o[x]=V0.property(m)}o.constructor={value:s,writable:Xu},s.prototype=Object.create((e.superclass||t).prototype,o),e.events&&Yu(s,e.events),r[e.name]=s}else s=t;return(e.tags||e.tag&&[e.tag]||[]).forEach(function(h){a[h]=s}),s};function j0(e,t,r,a){this.body=e,this.document=t,this.form=r,this.element=a}j0.prototype.build=function(){return()=>{}};function Ku(e,t,r,a){var s=e.ownerDocument||Object.create(null),o=e.form||Object.create(null);e[t]=new j0(a,s,o,e).build()}function Yu(e,t){var r=e.prototype;t.forEach(function(a){Object.defineProperty(r,"on"+a,{get:function(){return this._getEventHandler(a)},set:function(s){this._setEventHandler(a,s)}}),V0.registerChangeHandler(e,"on"+a,Ku)})}});var fa=N(xa=>{"use strict";var $n=xe(),z0=Bt(),Qu=la(),Te=ee(),W0=Yn(),$u=Qn(),Xe=xa.elements={},gr=Object.create(null);xa.createElement=function(e,t,r){var a=gr[t]||Ju;return new a(e,t,r)};function _(e){return $u(e,T,Xe,gr)}function te(e){return{get:function(){var t=this._getattr(e);if(t===null)return"";var r=this.doc._resolve(t);return r===null?t:r},set:function(t){this._setattr(e,t)}}}function ua(e){return{get:function(){var t=this._getattr(e);return t===null?null:t.toLowerCase()==="use-credentials"?"use-credentials":"anonymous"},set:function(t){t==null?this.removeAttribute(e):this._setattr(e,t)}}}var Vt={type:["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"],missing:""},Zu={A:!0,LINK:!0,BUTTON:!0,INPUT:!0,SELECT:!0,TEXTAREA:!0,COMMAND:!0},Le=function(e,t,r){T.call(this,e,t,r),this._form=null},T=xa.HTMLElement=_({superclass:z0,name:"HTMLElement",ctor:function(t,r,a){z0.call(this,t,r,Te.NAMESPACE.HTML,a)},props:{dangerouslySetInnerHTML:{set:function(e){this._innerHTML=e}},innerHTML:{get:function(){return this.serialize()},set:function(e){var t=this.ownerDocument.implementation.mozHTMLParser(this.ownerDocument._address,this);t.parse(e===null?"":String(e),!0);for(var r=this instanceof gr.template?this.content:this;r.hasChildNodes();)r.removeChild(r.firstChild);r.appendChild(t._asDocumentFragment())}},style:{get:function(){return this._style||(this._style=new Qu(this)),this._style},set:function(e){e==null&&(e=""),this._setattr("style",String(e))}},blur:{value:function(){}},focus:{value:function(){}},forceSpellCheck:{value:function(){}},click:{value:function(){if(!this._click_in_progress){this._click_in_progress=!0;try{this._pre_click_activation_steps&&this._pre_click_activation_steps();var e=this.ownerDocument.createEvent("MouseEvent");e.initMouseEvent("click",!0,!0,this.ownerDocument.defaultView,1,0,0,0,0,!1,!1,!1,!1,0,null);var t=this.dispatchEvent(e);t?this._post_click_activation_steps&&this._post_click_activation_steps(e):this._cancelled_activation_steps&&this._cancelled_activation_steps()}finally{this._click_in_progress=!1}}}},submit:{value:Te.nyi}},attributes:{title:String,lang:String,dir:{type:["ltr","rtl","auto"],missing:""},draggable:{type:["true","false"],treatNullAsEmptyString:!0},spellcheck:{type:["true","false"],missing:""},enterKeyHint:{type:["enter","done","go","next","previous","search","send"],missing:""},autoCapitalize:{type:["off","on","none","sentences","words","characters"],missing:""},autoFocus:Boolean,accessKey:String,nonce:String,hidden:Boolean,translate:{type:["no","yes"],missing:""},tabIndex:{type:"long",default:function(){return this.tagName in Zu||this.contentEditable?0:-1}}},events:["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"]}),Ju=_({name:"HTMLUnknownElement",ctor:function(t,r,a){T.call(this,t,r,a)}}),Me={form:{get:function(){return this._form}}};_({tag:"a",name:"HTMLAnchorElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{_post_click_activation_steps:{value:function(e){this.href&&(this.ownerDocument.defaultView.location=this.href)}}},attributes:{href:te,ping:String,download:String,target:String,rel:String,media:String,hreflang:String,type:String,referrerPolicy:Vt,coords:String,charset:String,name:String,rev:String,shape:String}});W0._inherit(gr.a.prototype);_({tag:"area",name:"HTMLAreaElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{alt:String,target:String,download:String,rel:String,media:String,href:te,hreflang:String,type:String,shape:String,coords:String,ping:String,referrerPolicy:Vt,noHref:Boolean}});W0._inherit(gr.area.prototype);_({tag:"br",name:"HTMLBRElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{clear:String}});_({tag:"base",name:"HTMLBaseElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{target:String}});_({tag:"body",name:"HTMLBodyElement",ctor:function(t,r,a){T.call(this,t,r,a)},events:["afterprint","beforeprint","beforeunload","blur","error","focus","hashchange","load","message","offline","online","pagehide","pageshow","popstate","resize","scroll","storage","unload"],attributes:{text:{type:String,treatNullAsEmptyString:!0},link:{type:String,treatNullAsEmptyString:!0},vLink:{type:String,treatNullAsEmptyString:!0},aLink:{type:String,treatNullAsEmptyString:!0},bgColor:{type:String,treatNullAsEmptyString:!0},background:String}});_({tag:"button",name:"HTMLButtonElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String,value:String,disabled:Boolean,autofocus:Boolean,type:{type:["submit","reset","button","menu"],missing:"submit"},formTarget:String,formAction:te,formNoValidate:Boolean,formMethod:{type:["get","post","dialog"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""}}});_({tag:"dl",name:"HTMLDListElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{compact:Boolean}});_({tag:"data",name:"HTMLDataElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{value:String}});_({tag:"datalist",name:"HTMLDataListElement",ctor:function(t,r,a){T.call(this,t,r,a)}});_({tag:"details",name:"HTMLDetailsElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{open:Boolean}});_({tag:"div",name:"HTMLDivElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"embed",name:"HTMLEmbedElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{src:te,type:String,width:String,height:String,align:String,name:String}});_({tag:"fieldset",name:"HTMLFieldSetElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{disabled:Boolean,name:String}});_({tag:"form",name:"HTMLFormElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{action:String,autocomplete:{type:["on","off"],missing:"on"},name:String,acceptCharset:{name:"accept-charset"},target:String,noValidate:Boolean,method:{type:["get","post","dialog"],invalid:"get",missing:"get"},enctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"},encoding:{name:"enctype",type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"}}});_({tag:"hr",name:"HTMLHRElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String,color:String,noShade:Boolean,size:String,width:String}});_({tag:"head",name:"HTMLHeadElement",ctor:function(t,r,a){T.call(this,t,r,a)}});_({tags:["h1","h2","h3","h4","h5","h6"],name:"HTMLHeadingElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"html",name:"HTMLHtmlElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{xmlns:te,version:String}});_({tag:"iframe",name:"HTMLIFrameElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{src:te,srcdoc:String,name:String,width:String,height:String,seamless:Boolean,allow:Boolean,allowFullscreen:Boolean,allowUserMedia:Boolean,allowPaymentRequest:Boolean,referrerPolicy:Vt,loading:{type:["eager","lazy"],treatNullAsEmptyString:!0},align:String,scrolling:String,frameBorder:String,longDesc:te,marginHeight:{type:String,treatNullAsEmptyString:!0},marginWidth:{type:String,treatNullAsEmptyString:!0}}});_({tag:"img",name:"HTMLImageElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{alt:String,src:te,srcset:String,crossOrigin:ua,useMap:String,isMap:Boolean,sizes:String,height:{type:"unsigned long",default:0},width:{type:"unsigned long",default:0},referrerPolicy:Vt,loading:{type:["eager","lazy"],missing:""},name:String,lowsrc:te,align:String,hspace:{type:"unsigned long",default:0},vspace:{type:"unsigned long",default:0},longDesc:te,border:{type:String,treatNullAsEmptyString:!0}}});_({tag:"input",name:"HTMLInputElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:{form:Me.form,_post_click_activation_steps:{value:function(e){if(this.type==="checkbox")this.checked=!this.checked;else if(this.type==="radio")for(var t=this.form.getElementsByName(this.name),r=t.length-1;r>=0;r--){var a=t[r];a.checked=a===this}}}},attributes:{name:String,disabled:Boolean,autofocus:Boolean,accept:String,alt:String,max:String,min:String,pattern:String,placeholder:String,step:String,dirName:String,defaultValue:{name:"value"},multiple:Boolean,required:Boolean,readOnly:Boolean,checked:Boolean,value:String,src:te,defaultChecked:{name:"checked",type:Boolean},size:{type:"unsigned long",default:20,min:1,setmin:1},width:{type:"unsigned long",min:0,setmin:0,default:0},height:{type:"unsigned long",min:0,setmin:0,default:0},minLength:{type:"unsigned long",min:0,setmin:0,default:-1},maxLength:{type:"unsigned long",min:0,setmin:0,default:-1},autocomplete:String,type:{type:["text","hidden","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"],missing:"text"},formTarget:String,formNoValidate:Boolean,formMethod:{type:["get","post"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""},inputMode:{type:["verbatim","latin","latin-name","latin-prose","full-width-latin","kana","kana-name","katakana","numeric","tel","email","url"],missing:""},align:String,useMap:String}});_({tag:"keygen",name:"HTMLKeygenElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String,disabled:Boolean,autofocus:Boolean,challenge:String,keytype:{type:["rsa"],missing:""}}});_({tag:"li",name:"HTMLLIElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{value:{type:"long",default:0},type:String}});_({tag:"label",name:"HTMLLabelElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{htmlFor:{name:"for",type:String}}});_({tag:"legend",name:"HTMLLegendElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"link",name:"HTMLLinkElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{href:te,rel:String,media:String,hreflang:String,type:String,crossOrigin:ua,nonce:String,integrity:String,referrerPolicy:Vt,imageSizes:String,imageSrcset:String,charset:String,rev:String,target:String}});_({tag:"map",name:"HTMLMapElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String}});_({tag:"menu",name:"HTMLMenuElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{type:{type:["context","popup","toolbar"],missing:"toolbar"},label:String,compact:Boolean}});_({tag:"meta",name:"HTMLMetaElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String,content:String,httpEquiv:{name:"http-equiv",type:String},scheme:String}});_({tag:"meter",name:"HTMLMeterElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me});_({tags:["ins","del"],name:"HTMLModElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{cite:te,dateTime:String}});_({tag:"ol",name:"HTMLOListElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{_numitems:{get:function(){var e=0;return this.childNodes.forEach(function(t){t.nodeType===$n.ELEMENT_NODE&&t.tagName==="LI"&&e++}),e}}},attributes:{type:String,reversed:Boolean,start:{type:"long",default:function(){return this.reversed?this._numitems:1}},compact:Boolean}});_({tag:"object",name:"HTMLObjectElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{data:te,type:String,name:String,useMap:String,typeMustMatch:Boolean,width:String,height:String,align:String,archive:String,code:String,declare:Boolean,hspace:{type:"unsigned long",default:0},standby:String,vspace:{type:"unsigned long",default:0},codeBase:te,codeType:String,border:{type:String,treatNullAsEmptyString:!0}}});_({tag:"optgroup",name:"HTMLOptGroupElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{disabled:Boolean,label:String}});_({tag:"option",name:"HTMLOptionElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{form:{get:function(){for(var e=this.parentNode;e&&e.nodeType===$n.ELEMENT_NODE;){if(e.localName==="select")return e.form;e=e.parentNode}}},value:{get:function(){return this._getattr("value")||this.text},set:function(e){this._setattr("value",e)}},text:{get:function(){return this.textContent.replace(/[ \t\n\f\r]+/g," ").trim()},set:function(e){this.textContent=e}}},attributes:{disabled:Boolean,defaultSelected:{name:"selected",type:Boolean},label:String}});_({tag:"output",name:"HTMLOutputElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String}});_({tag:"p",name:"HTMLParagraphElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"param",name:"HTMLParamElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String,value:String,type:String,valueType:String}});_({tags:["pre","listing","xmp"],name:"HTMLPreElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{width:{type:"long",default:0}}});_({tag:"progress",name:"HTMLProgressElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{max:{type:Number,float:!0,default:1,min:0}}});_({tags:["q","blockquote"],name:"HTMLQuoteElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{cite:te}});_({tag:"script",name:"HTMLScriptElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{text:{get:function(){for(var e="",t=0,r=this.childNodes.length;t{"use strict";var X0=Bt(),ex=Qn(),tx=ee(),rx=la(),ax=da.elements={},K0=Object.create(null);da.createElement=function(e,t,r){var a=K0[t]||Jn;return new a(e,t,r)};function Zn(e){return ex(e,Jn,ax,K0)}var Jn=Zn({superclass:X0,name:"SVGElement",ctor:function(t,r,a){X0.call(this,t,r,tx.NAMESPACE.SVG,a)},props:{style:{get:function(){return this._style||(this._style=new rx(this)),this._style}}}});Zn({name:"SVGSVGElement",ctor:function(t,r,a){Jn.call(this,t,r,a)},tag:"svg",props:{createSVGRect:{value:function(){return da.createElement(this.ownerDocument,"rect",null)}}}});Zn({tags:["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]})});var Q0=N((xd,Y0)=>{"use strict";Y0.exports={VALUE:1,ATTR:2,REMOVE_ATTR:3,REMOVE:4,MOVE:5,INSERT:6}});var pa=N((fd,so)=>{"use strict";so.exports=Er;var he=xe(),nx=yt(),ro=$r(),ft=Bt(),ix=Rn(),sx=On(),br=Mt(),ox=Hn(),cx=Bn(),lx=_r(),ux=T0(),xx=C0(),$0=pr(),Z0=ca(),J0=ra(),fx=Kn(),ha=Zr(),ti=fa(),dx=ei(),B=ee(),jt=Q0(),zt=B.NAMESPACE,ri=Kr().isApiWritable;function Er(e,t){ro.call(this),this.nodeType=he.DOCUMENT_NODE,this.isHTML=e,this._address=t||"about:blank",this.readyState="loading",this.implementation=new lx(this),this.ownerDocument=null,this._contentType=e?"text/html":"application/xml",this.doctype=null,this.documentElement=null,this._templateDocCache=null,this._nodeIterators=null,this._nid=1,this._nextnid=2,this._nodes=[null,this],this.byId=Object.create(null),this.modclock=0}var hx={event:"Event",customevent:"CustomEvent",uievent:"UIEvent",mouseevent:"MouseEvent"},px={events:"event",htmlevents:"event",mouseevents:"mouseevent",mutationevents:"mutationevent",uievents:"uievent"},Gt=function(e,t,r){return{get:function(){var a=e.call(this);return a?a[t]:r},set:function(a){var s=e.call(this);s&&(s[t]=a)}}};function eo(e,t){var r,a,s;return e===""&&(e=null),ha.isValidQName(t)||B.InvalidCharacterError(),r=null,a=t,s=t.indexOf(":"),s>=0&&(r=t.substring(0,s),a=t.substring(s+1)),r!==null&&e===null&&B.NamespaceError(),r==="xml"&&e!==zt.XML&&B.NamespaceError(),(r==="xmlns"||t==="xmlns")&&e!==zt.XMLNS&&B.NamespaceError(),e===zt.XMLNS&&!(r==="xmlns"||t==="xmlns")&&B.NamespaceError(),{namespace:e,prefix:r,localName:a}}Er.prototype=Object.create(ro.prototype,{_setMutationHandler:{value:function(e){this.mutationHandler=e}},_dispatchRendererEvent:{value:function(e,t,r){var a=this._nodes[e];a&&a._dispatchEvent(new br(t,r),!0)}},nodeName:{value:"#document"},nodeValue:{get:function(){return null},set:function(){}},documentURI:{get:function(){return this._address},set:B.nyi},compatMode:{get:function(){return this._quirks?"BackCompat":"CSS1Compat"}},createTextNode:{value:function(e){return new ix(this,String(e))}},createComment:{value:function(e){return new sx(this,e)}},createDocumentFragment:{value:function(){return new ox(this)}},createProcessingInstruction:{value:function(e,t){return(!ha.isValidName(e)||t.indexOf("?>")!==-1)&&B.InvalidCharacterError(),new cx(this,e,t)}},createAttribute:{value:function(e){return e=String(e),ha.isValidName(e)||B.InvalidCharacterError(),this.isHTML&&(e=B.toASCIILowerCase(e)),new ft._Attr(null,e,null,null,"")}},createAttributeNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=eo(e,t);return new ft._Attr(null,r.localName,r.prefix,r.namespace,"")}},createElement:{value:function(e){return e=String(e),ha.isValidName(e)||B.InvalidCharacterError(),this.isHTML?(/[A-Z]/.test(e)&&(e=B.toASCIILowerCase(e)),ti.createElement(this,e,null)):this.contentType==="application/xhtml+xml"?ti.createElement(this,e,null):new ft(this,e,null,null)},writable:ri},createElementNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=eo(e,t);return this._createElementNS(r.localName,r.namespace,r.prefix)},writable:ri},_createElementNS:{value:function(e,t,r){return t===zt.HTML?ti.createElement(this,e,r):t===zt.SVG?dx.createElement(this,e,r):new ft(this,e,t,r)}},createEvent:{value:function(t){t=t.toLowerCase();var r=px[t]||t,a=fx[hx[r]];if(a){var s=new a;return s._initialized=!1,s}else B.NotSupportedError()}},createTreeWalker:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof he))throw new TypeError("root not a node");return t=t===void 0?$0.SHOW_ALL:+t,r=r===void 0?null:r,new ux(e,t,r)}},createNodeIterator:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof he))throw new TypeError("root not a node");return t=t===void 0?$0.SHOW_ALL:+t,r=r===void 0?null:r,new xx(e,t,r)}},_attachNodeIterator:{value:function(e){this._nodeIterators||(this._nodeIterators=[]),this._nodeIterators.push(e)}},_detachNodeIterator:{value:function(e){var t=this._nodeIterators.indexOf(e);this._nodeIterators.splice(t,1)}},_preremoveNodeIterators:{value:function(e){this._nodeIterators&&this._nodeIterators.forEach(function(t){t._preremove(e)})}},_updateDocTypeElement:{value:function(){this.doctype=this.documentElement=null;for(var t=this.firstChild;t!==null;t=t.nextSibling)t.nodeType===he.DOCUMENT_TYPE_NODE?this.doctype=t:t.nodeType===he.ELEMENT_NODE&&(this.documentElement=t)}},insertBefore:{value:function(t,r){return he.prototype.insertBefore.call(this,t,r),this._updateDocTypeElement(),t}},replaceChild:{value:function(t,r){return he.prototype.replaceChild.call(this,t,r),this._updateDocTypeElement(),r}},removeChild:{value:function(t){return he.prototype.removeChild.call(this,t),this._updateDocTypeElement(),t}},getElementById:{value:function(e){var t=this.byId[e];return t?t instanceof Ke?t.getFirst():t:null}},_hasMultipleElementsWithId:{value:function(e){return this.byId[e]instanceof Ke}},getElementsByName:{value:ft.prototype.getElementsByName},getElementsByTagName:{value:ft.prototype.getElementsByTagName},getElementsByTagNameNS:{value:ft.prototype.getElementsByTagNameNS},getElementsByClassName:{value:ft.prototype.getElementsByClassName},adoptNode:{value:function(t){return t.nodeType===he.DOCUMENT_NODE&&B.NotSupportedError(),t.nodeType===he.ATTRIBUTE_NODE||(t.parentNode&&t.parentNode.removeChild(t),t.ownerDocument!==this&&io(t,this)),t}},importNode:{value:function(t,r){return this.adoptNode(t.cloneNode(r))},writable:ri},origin:{get:function(){return null}},characterSet:{get:function(){return"UTF-8"}},contentType:{get:function(){return this._contentType}},URL:{get:function(){return this._address}},domain:{get:B.nyi,set:B.nyi},referrer:{get:B.nyi},cookie:{get:B.nyi,set:B.nyi},lastModified:{get:B.nyi},location:{get:function(){return this.defaultView?this.defaultView.location:null},set:B.nyi},_titleElement:{get:function(){return this.getElementsByTagName("title").item(0)||null}},title:{get:function(){var e=this._titleElement,t=e?e.textContent:"";return t.replace(/[ \t\n\r\f]+/g," ").replace(/(^ )|( $)/g,"")},set:function(e){var t=this._titleElement,r=this.head;!t&&!r||(t||(t=this.createElement("title"),r.appendChild(t)),t.textContent=e)}},dir:Gt(function(){var e=this.documentElement;if(e&&e.tagName==="HTML")return e},"dir",""),fgColor:Gt(function(){return this.body},"text",""),linkColor:Gt(function(){return this.body},"link",""),vlinkColor:Gt(function(){return this.body},"vLink",""),alinkColor:Gt(function(){return this.body},"aLink",""),bgColor:Gt(function(){return this.body},"bgColor",""),charset:{get:function(){return this.characterSet}},inputEncoding:{get:function(){return this.characterSet}},scrollingElement:{get:function(){return this._quirks?this.body:this.documentElement}},body:{get:function(){return to(this.documentElement,"body")},set:B.nyi},head:{get:function(){return to(this.documentElement,"head")}},images:{get:B.nyi},embeds:{get:B.nyi},plugins:{get:B.nyi},links:{get:B.nyi},forms:{get:B.nyi},scripts:{get:B.nyi},applets:{get:function(){return[]}},activeElement:{get:function(){return null}},innerHTML:{get:function(){return this.serialize()},set:B.nyi},outerHTML:{get:function(){return this.serialize()},set:B.nyi},write:{value:function(e){if(this.isHTML||B.InvalidStateError(),!!this._parser){this._parser;var t=arguments.join("");this._parser.parse(t)}}},writeln:{value:function(t){this.write(Array.prototype.join.call(arguments,"")+` +`)}},open:{value:function(){this.documentElement=null}},close:{value:function(){this.readyState="interactive",this._dispatchEvent(new br("readystatechange"),!0),this._dispatchEvent(new br("DOMContentLoaded"),!0),this.readyState="complete",this._dispatchEvent(new br("readystatechange"),!0),this.defaultView&&this.defaultView._dispatchEvent(new br("load"),!0)}},clone:{value:function(){var t=new Er(this.isHTML,this._address);return t._quirks=this._quirks,t._contentType=this._contentType,t}},cloneNode:{value:function(t){var r=he.prototype.cloneNode.call(this,!1);if(t)for(var a=this.firstChild;a!==null;a=a.nextSibling)r._appendChild(r.importNode(a,!0));return r._updateDocTypeElement(),r}},isEqual:{value:function(t){return!0}},mutateValue:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.VALUE,target:e,data:e.data})}},mutateAttr:{value:function(e,t){this.mutationHandler&&this.mutationHandler({type:jt.ATTR,target:e.ownerElement,attr:e})}},mutateRemoveAttr:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.REMOVE_ATTR,target:e.ownerElement,attr:e})}},mutateRemove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.REMOVE,target:e.parentNode,node:e}),no(e)}},mutateInsert:{value:function(e){ao(e),this.mutationHandler&&this.mutationHandler({type:jt.INSERT,target:e.parentNode,node:e})}},mutateMove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.MOVE,target:e})}},addId:{value:function(t,r){var a=this.byId[t];a?(a instanceof Ke||(a=new Ke(a),this.byId[t]=a),a.add(r)):this.byId[t]=r}},delId:{value:function(t,r){var a=this.byId[t];B.assert(a),a instanceof Ke?(a.del(r),a.length===1&&(this.byId[t]=a.downgrade())):this.byId[t]=void 0}},_resolve:{value:function(e){return new Z0(this._documentBaseURL).resolve(e)}},_documentBaseURL:{get:function(){var e=this._address;e==="about:blank"&&(e="/");var t=this.querySelector("base[href]");return t?new Z0(e).resolve(t.getAttribute("href")):e}},_templateDoc:{get:function(){if(!this._templateDocCache){var e=new Er(this.isHTML,this._address);this._templateDocCache=e._templateDocCache=e}return this._templateDocCache}},querySelector:{value:function(e){return J0(e,this)[0]}},querySelectorAll:{value:function(e){var t=J0(e,this);return t.item?t:new nx(t)}}});var mx=["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"];mx.forEach(function(e){Object.defineProperty(Er.prototype,"on"+e,{get:function(){return this._getEventHandler(e)},set:function(t){this._setEventHandler(e,t)}})});function to(e,t){if(e&&e.isHTML){for(var r=e.firstChild;r!==null;r=r.nextSibling)if(r.nodeType===he.ELEMENT_NODE&&r.localName===t&&r.namespaceURI===zt.HTML)return r}return null}function gx(e){if(e._nid=e.ownerDocument._nextnid++,e.ownerDocument._nodes[e._nid]=e,e.nodeType===he.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.addId(t,e),e._roothook&&e._roothook()}}function bx(e){if(e.nodeType===he.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.delId(t,e)}e.ownerDocument._nodes[e._nid]=void 0,e._nid=void 0}function ao(e){if(gx(e),e.nodeType===he.ELEMENT_NODE)for(var t=e.firstChild;t!==null;t=t.nextSibling)ao(t)}function no(e){bx(e);for(var t=e.firstChild;t!==null;t=t.nextSibling)no(t)}function io(e,t){e.ownerDocument=t,e._lastModTime=void 0,Object.prototype.hasOwnProperty.call(e,"_tagName")&&(e._tagName=void 0);for(var r=e.firstChild;r!==null;r=r.nextSibling)io(r,t)}function Ke(e){this.nodes=Object.create(null),this.nodes[e._nid]=e,this.length=1,this.firstNode=void 0}Ke.prototype.add=function(e){this.nodes[e._nid]||(this.nodes[e._nid]=e,this.length++,this.firstNode=void 0)};Ke.prototype.del=function(e){this.nodes[e._nid]&&(delete this.nodes[e._nid],this.length--,this.firstNode=void 0)};Ke.prototype.getFirst=function(){if(!this.firstNode){var e;for(e in this.nodes)(this.firstNode===void 0||this.firstNode.compareDocumentPosition(this.nodes[e])&he.DOCUMENT_POSITION_PRECEDING)&&(this.firstNode=this.nodes[e])}return this.firstNode};Ke.prototype.downgrade=function(){if(this.length===1){var e;for(e in this.nodes)return this.nodes[e]}return this}});var ga=N((dd,co)=>{"use strict";co.exports=ma;var Ex=xe(),oo=Ln(),_x=aa();function ma(e,t,r,a){oo.call(this),this.nodeType=Ex.DOCUMENT_TYPE_NODE,this.ownerDocument=e||null,this.name=t,this.publicId=r||"",this.systemId=a||""}ma.prototype=Object.create(oo.prototype,{nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return null},set:function(){}},clone:{value:function(){return new ma(this.ownerDocument,this.name,this.publicId,this.systemId)}},isEqual:{value:function(t){return this.name===t.name&&this.publicId===t.publicId&&this.systemId===t.systemId}}});Object.defineProperties(ma.prototype,_x)});var Na=N((hd,Mo)=>{"use strict";Mo.exports=q;var vx=pa(),Tx=ga(),ai=xe(),w=ee().NAMESPACE,No=fa(),G=No.elements,wt=Function.prototype.apply.bind(Array.prototype.push),ba=-1,Wt=1,pe=2,I=3,Fe=4,yx=5,Nx=[],wx=/^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i,Sx="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",lo=/^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i,Ax=/^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i,At=Object.create(null);At[w.HTML]={__proto__:null,address:!0,applet:!0,area:!0,article:!0,aside:!0,base:!0,basefont:!0,bgsound:!0,blockquote:!0,body:!0,br:!0,button:!0,caption:!0,center:!0,col:!0,colgroup:!0,dd:!0,details:!0,dir:!0,div:!0,dl:!0,dt:!0,embed:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,frame:!0,frameset:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,head:!0,header:!0,hgroup:!0,hr:!0,html:!0,iframe:!0,img:!0,input:!0,li:!0,link:!0,listing:!0,main:!0,marquee:!0,menu:!0,meta:!0,nav:!0,noembed:!0,noframes:!0,noscript:!0,object:!0,ol:!0,p:!0,param:!0,plaintext:!0,pre:!0,script:!0,section:!0,select:!0,source:!0,style:!0,summary:!0,table:!0,tbody:!0,td:!0,template:!0,textarea:!0,tfoot:!0,th:!0,thead:!0,title:!0,tr:!0,track:!0,ul:!0,wbr:!0,xmp:!0};At[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};At[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};var si=Object.create(null);si[w.HTML]={__proto__:null,address:!0,div:!0,p:!0};var wo=Object.create(null);wo[w.HTML]={__proto__:null,dd:!0,dt:!0};var Xt=Object.create(null);Xt[w.HTML]={__proto__:null,table:!0,thead:!0,tbody:!0,tfoot:!0,tr:!0};var So=Object.create(null);So[w.HTML]={__proto__:null,dd:!0,dt:!0,li:!0,menuitem:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0};var Ao=Object.create(null);Ao[w.HTML]={__proto__:null,caption:!0,colgroup:!0,dd:!0,dt:!0,li:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0,tbody:!0,td:!0,tfoot:!0,th:!0,thead:!0,tr:!0};var va=Object.create(null);va[w.HTML]={__proto__:null,table:!0,template:!0,html:!0};var Ta=Object.create(null);Ta[w.HTML]={__proto__:null,tbody:!0,tfoot:!0,thead:!0,template:!0,html:!0};var oi=Object.create(null);oi[w.HTML]={__proto__:null,tr:!0,template:!0,html:!0};var Co=Object.create(null);Co[w.HTML]={__proto__:null,button:!0,fieldset:!0,input:!0,keygen:!0,object:!0,output:!0,select:!0,textarea:!0,img:!0};var Be=Object.create(null);Be[w.HTML]={__proto__:null,applet:!0,caption:!0,html:!0,table:!0,td:!0,th:!0,marquee:!0,object:!0,template:!0};Be[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};Be[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var ya=Object.create(Be);ya[w.HTML]=Object.create(Be[w.HTML]);ya[w.HTML].ol=!0;ya[w.HTML].ul=!0;var ci=Object.create(Be);ci[w.HTML]=Object.create(Be[w.HTML]);ci[w.HTML].button=!0;var Do=Object.create(null);Do[w.HTML]={__proto__:null,html:!0,table:!0,template:!0};var Cx=Object.create(null);Cx[w.HTML]={__proto__:null,optgroup:!0,option:!0};var ko=Object.create(null);ko[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0};var Lo=Object.create(null);Lo[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var uo={__proto__:null,"xlink:actuate":w.XLINK,"xlink:arcrole":w.XLINK,"xlink:href":w.XLINK,"xlink:role":w.XLINK,"xlink:show":w.XLINK,"xlink:title":w.XLINK,"xlink:type":w.XLINK,"xml:base":w.XML,"xml:lang":w.XML,"xml:space":w.XML,xmlns:w.XMLNS,"xmlns:xlink":w.XMLNS},xo={__proto__:null,attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},fo={__proto__:null,altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},ho={__proto__:null,0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},Dx={__proto__:null,AElig:198,"AElig;":198,AMP:38,"AMP;":38,Aacute:193,"Aacute;":193,"Abreve;":258,Acirc:194,"Acirc;":194,"Acy;":1040,"Afr;":[55349,56580],Agrave:192,"Agrave;":192,"Alpha;":913,"Amacr;":256,"And;":10835,"Aogon;":260,"Aopf;":[55349,56632],"ApplyFunction;":8289,Aring:197,"Aring;":197,"Ascr;":[55349,56476],"Assign;":8788,Atilde:195,"Atilde;":195,Auml:196,"Auml;":196,"Backslash;":8726,"Barv;":10983,"Barwed;":8966,"Bcy;":1041,"Because;":8757,"Bernoullis;":8492,"Beta;":914,"Bfr;":[55349,56581],"Bopf;":[55349,56633],"Breve;":728,"Bscr;":8492,"Bumpeq;":8782,"CHcy;":1063,COPY:169,"COPY;":169,"Cacute;":262,"Cap;":8914,"CapitalDifferentialD;":8517,"Cayleys;":8493,"Ccaron;":268,Ccedil:199,"Ccedil;":199,"Ccirc;":264,"Cconint;":8752,"Cdot;":266,"Cedilla;":184,"CenterDot;":183,"Cfr;":8493,"Chi;":935,"CircleDot;":8857,"CircleMinus;":8854,"CirclePlus;":8853,"CircleTimes;":8855,"ClockwiseContourIntegral;":8754,"CloseCurlyDoubleQuote;":8221,"CloseCurlyQuote;":8217,"Colon;":8759,"Colone;":10868,"Congruent;":8801,"Conint;":8751,"ContourIntegral;":8750,"Copf;":8450,"Coproduct;":8720,"CounterClockwiseContourIntegral;":8755,"Cross;":10799,"Cscr;":[55349,56478],"Cup;":8915,"CupCap;":8781,"DD;":8517,"DDotrahd;":10513,"DJcy;":1026,"DScy;":1029,"DZcy;":1039,"Dagger;":8225,"Darr;":8609,"Dashv;":10980,"Dcaron;":270,"Dcy;":1044,"Del;":8711,"Delta;":916,"Dfr;":[55349,56583],"DiacriticalAcute;":180,"DiacriticalDot;":729,"DiacriticalDoubleAcute;":733,"DiacriticalGrave;":96,"DiacriticalTilde;":732,"Diamond;":8900,"DifferentialD;":8518,"Dopf;":[55349,56635],"Dot;":168,"DotDot;":8412,"DotEqual;":8784,"DoubleContourIntegral;":8751,"DoubleDot;":168,"DoubleDownArrow;":8659,"DoubleLeftArrow;":8656,"DoubleLeftRightArrow;":8660,"DoubleLeftTee;":10980,"DoubleLongLeftArrow;":10232,"DoubleLongLeftRightArrow;":10234,"DoubleLongRightArrow;":10233,"DoubleRightArrow;":8658,"DoubleRightTee;":8872,"DoubleUpArrow;":8657,"DoubleUpDownArrow;":8661,"DoubleVerticalBar;":8741,"DownArrow;":8595,"DownArrowBar;":10515,"DownArrowUpArrow;":8693,"DownBreve;":785,"DownLeftRightVector;":10576,"DownLeftTeeVector;":10590,"DownLeftVector;":8637,"DownLeftVectorBar;":10582,"DownRightTeeVector;":10591,"DownRightVector;":8641,"DownRightVectorBar;":10583,"DownTee;":8868,"DownTeeArrow;":8615,"Downarrow;":8659,"Dscr;":[55349,56479],"Dstrok;":272,"ENG;":330,ETH:208,"ETH;":208,Eacute:201,"Eacute;":201,"Ecaron;":282,Ecirc:202,"Ecirc;":202,"Ecy;":1069,"Edot;":278,"Efr;":[55349,56584],Egrave:200,"Egrave;":200,"Element;":8712,"Emacr;":274,"EmptySmallSquare;":9723,"EmptyVerySmallSquare;":9643,"Eogon;":280,"Eopf;":[55349,56636],"Epsilon;":917,"Equal;":10869,"EqualTilde;":8770,"Equilibrium;":8652,"Escr;":8496,"Esim;":10867,"Eta;":919,Euml:203,"Euml;":203,"Exists;":8707,"ExponentialE;":8519,"Fcy;":1060,"Ffr;":[55349,56585],"FilledSmallSquare;":9724,"FilledVerySmallSquare;":9642,"Fopf;":[55349,56637],"ForAll;":8704,"Fouriertrf;":8497,"Fscr;":8497,"GJcy;":1027,GT:62,"GT;":62,"Gamma;":915,"Gammad;":988,"Gbreve;":286,"Gcedil;":290,"Gcirc;":284,"Gcy;":1043,"Gdot;":288,"Gfr;":[55349,56586],"Gg;":8921,"Gopf;":[55349,56638],"GreaterEqual;":8805,"GreaterEqualLess;":8923,"GreaterFullEqual;":8807,"GreaterGreater;":10914,"GreaterLess;":8823,"GreaterSlantEqual;":10878,"GreaterTilde;":8819,"Gscr;":[55349,56482],"Gt;":8811,"HARDcy;":1066,"Hacek;":711,"Hat;":94,"Hcirc;":292,"Hfr;":8460,"HilbertSpace;":8459,"Hopf;":8461,"HorizontalLine;":9472,"Hscr;":8459,"Hstrok;":294,"HumpDownHump;":8782,"HumpEqual;":8783,"IEcy;":1045,"IJlig;":306,"IOcy;":1025,Iacute:205,"Iacute;":205,Icirc:206,"Icirc;":206,"Icy;":1048,"Idot;":304,"Ifr;":8465,Igrave:204,"Igrave;":204,"Im;":8465,"Imacr;":298,"ImaginaryI;":8520,"Implies;":8658,"Int;":8748,"Integral;":8747,"Intersection;":8898,"InvisibleComma;":8291,"InvisibleTimes;":8290,"Iogon;":302,"Iopf;":[55349,56640],"Iota;":921,"Iscr;":8464,"Itilde;":296,"Iukcy;":1030,Iuml:207,"Iuml;":207,"Jcirc;":308,"Jcy;":1049,"Jfr;":[55349,56589],"Jopf;":[55349,56641],"Jscr;":[55349,56485],"Jsercy;":1032,"Jukcy;":1028,"KHcy;":1061,"KJcy;":1036,"Kappa;":922,"Kcedil;":310,"Kcy;":1050,"Kfr;":[55349,56590],"Kopf;":[55349,56642],"Kscr;":[55349,56486],"LJcy;":1033,LT:60,"LT;":60,"Lacute;":313,"Lambda;":923,"Lang;":10218,"Laplacetrf;":8466,"Larr;":8606,"Lcaron;":317,"Lcedil;":315,"Lcy;":1051,"LeftAngleBracket;":10216,"LeftArrow;":8592,"LeftArrowBar;":8676,"LeftArrowRightArrow;":8646,"LeftCeiling;":8968,"LeftDoubleBracket;":10214,"LeftDownTeeVector;":10593,"LeftDownVector;":8643,"LeftDownVectorBar;":10585,"LeftFloor;":8970,"LeftRightArrow;":8596,"LeftRightVector;":10574,"LeftTee;":8867,"LeftTeeArrow;":8612,"LeftTeeVector;":10586,"LeftTriangle;":8882,"LeftTriangleBar;":10703,"LeftTriangleEqual;":8884,"LeftUpDownVector;":10577,"LeftUpTeeVector;":10592,"LeftUpVector;":8639,"LeftUpVectorBar;":10584,"LeftVector;":8636,"LeftVectorBar;":10578,"Leftarrow;":8656,"Leftrightarrow;":8660,"LessEqualGreater;":8922,"LessFullEqual;":8806,"LessGreater;":8822,"LessLess;":10913,"LessSlantEqual;":10877,"LessTilde;":8818,"Lfr;":[55349,56591],"Ll;":8920,"Lleftarrow;":8666,"Lmidot;":319,"LongLeftArrow;":10229,"LongLeftRightArrow;":10231,"LongRightArrow;":10230,"Longleftarrow;":10232,"Longleftrightarrow;":10234,"Longrightarrow;":10233,"Lopf;":[55349,56643],"LowerLeftArrow;":8601,"LowerRightArrow;":8600,"Lscr;":8466,"Lsh;":8624,"Lstrok;":321,"Lt;":8810,"Map;":10501,"Mcy;":1052,"MediumSpace;":8287,"Mellintrf;":8499,"Mfr;":[55349,56592],"MinusPlus;":8723,"Mopf;":[55349,56644],"Mscr;":8499,"Mu;":924,"NJcy;":1034,"Nacute;":323,"Ncaron;":327,"Ncedil;":325,"Ncy;":1053,"NegativeMediumSpace;":8203,"NegativeThickSpace;":8203,"NegativeThinSpace;":8203,"NegativeVeryThinSpace;":8203,"NestedGreaterGreater;":8811,"NestedLessLess;":8810,"NewLine;":10,"Nfr;":[55349,56593],"NoBreak;":8288,"NonBreakingSpace;":160,"Nopf;":8469,"Not;":10988,"NotCongruent;":8802,"NotCupCap;":8813,"NotDoubleVerticalBar;":8742,"NotElement;":8713,"NotEqual;":8800,"NotEqualTilde;":[8770,824],"NotExists;":8708,"NotGreater;":8815,"NotGreaterEqual;":8817,"NotGreaterFullEqual;":[8807,824],"NotGreaterGreater;":[8811,824],"NotGreaterLess;":8825,"NotGreaterSlantEqual;":[10878,824],"NotGreaterTilde;":8821,"NotHumpDownHump;":[8782,824],"NotHumpEqual;":[8783,824],"NotLeftTriangle;":8938,"NotLeftTriangleBar;":[10703,824],"NotLeftTriangleEqual;":8940,"NotLess;":8814,"NotLessEqual;":8816,"NotLessGreater;":8824,"NotLessLess;":[8810,824],"NotLessSlantEqual;":[10877,824],"NotLessTilde;":8820,"NotNestedGreaterGreater;":[10914,824],"NotNestedLessLess;":[10913,824],"NotPrecedes;":8832,"NotPrecedesEqual;":[10927,824],"NotPrecedesSlantEqual;":8928,"NotReverseElement;":8716,"NotRightTriangle;":8939,"NotRightTriangleBar;":[10704,824],"NotRightTriangleEqual;":8941,"NotSquareSubset;":[8847,824],"NotSquareSubsetEqual;":8930,"NotSquareSuperset;":[8848,824],"NotSquareSupersetEqual;":8931,"NotSubset;":[8834,8402],"NotSubsetEqual;":8840,"NotSucceeds;":8833,"NotSucceedsEqual;":[10928,824],"NotSucceedsSlantEqual;":8929,"NotSucceedsTilde;":[8831,824],"NotSuperset;":[8835,8402],"NotSupersetEqual;":8841,"NotTilde;":8769,"NotTildeEqual;":8772,"NotTildeFullEqual;":8775,"NotTildeTilde;":8777,"NotVerticalBar;":8740,"Nscr;":[55349,56489],Ntilde:209,"Ntilde;":209,"Nu;":925,"OElig;":338,Oacute:211,"Oacute;":211,Ocirc:212,"Ocirc;":212,"Ocy;":1054,"Odblac;":336,"Ofr;":[55349,56594],Ograve:210,"Ograve;":210,"Omacr;":332,"Omega;":937,"Omicron;":927,"Oopf;":[55349,56646],"OpenCurlyDoubleQuote;":8220,"OpenCurlyQuote;":8216,"Or;":10836,"Oscr;":[55349,56490],Oslash:216,"Oslash;":216,Otilde:213,"Otilde;":213,"Otimes;":10807,Ouml:214,"Ouml;":214,"OverBar;":8254,"OverBrace;":9182,"OverBracket;":9140,"OverParenthesis;":9180,"PartialD;":8706,"Pcy;":1055,"Pfr;":[55349,56595],"Phi;":934,"Pi;":928,"PlusMinus;":177,"Poincareplane;":8460,"Popf;":8473,"Pr;":10939,"Precedes;":8826,"PrecedesEqual;":10927,"PrecedesSlantEqual;":8828,"PrecedesTilde;":8830,"Prime;":8243,"Product;":8719,"Proportion;":8759,"Proportional;":8733,"Pscr;":[55349,56491],"Psi;":936,QUOT:34,"QUOT;":34,"Qfr;":[55349,56596],"Qopf;":8474,"Qscr;":[55349,56492],"RBarr;":10512,REG:174,"REG;":174,"Racute;":340,"Rang;":10219,"Rarr;":8608,"Rarrtl;":10518,"Rcaron;":344,"Rcedil;":342,"Rcy;":1056,"Re;":8476,"ReverseElement;":8715,"ReverseEquilibrium;":8651,"ReverseUpEquilibrium;":10607,"Rfr;":8476,"Rho;":929,"RightAngleBracket;":10217,"RightArrow;":8594,"RightArrowBar;":8677,"RightArrowLeftArrow;":8644,"RightCeiling;":8969,"RightDoubleBracket;":10215,"RightDownTeeVector;":10589,"RightDownVector;":8642,"RightDownVectorBar;":10581,"RightFloor;":8971,"RightTee;":8866,"RightTeeArrow;":8614,"RightTeeVector;":10587,"RightTriangle;":8883,"RightTriangleBar;":10704,"RightTriangleEqual;":8885,"RightUpDownVector;":10575,"RightUpTeeVector;":10588,"RightUpVector;":8638,"RightUpVectorBar;":10580,"RightVector;":8640,"RightVectorBar;":10579,"Rightarrow;":8658,"Ropf;":8477,"RoundImplies;":10608,"Rrightarrow;":8667,"Rscr;":8475,"Rsh;":8625,"RuleDelayed;":10740,"SHCHcy;":1065,"SHcy;":1064,"SOFTcy;":1068,"Sacute;":346,"Sc;":10940,"Scaron;":352,"Scedil;":350,"Scirc;":348,"Scy;":1057,"Sfr;":[55349,56598],"ShortDownArrow;":8595,"ShortLeftArrow;":8592,"ShortRightArrow;":8594,"ShortUpArrow;":8593,"Sigma;":931,"SmallCircle;":8728,"Sopf;":[55349,56650],"Sqrt;":8730,"Square;":9633,"SquareIntersection;":8851,"SquareSubset;":8847,"SquareSubsetEqual;":8849,"SquareSuperset;":8848,"SquareSupersetEqual;":8850,"SquareUnion;":8852,"Sscr;":[55349,56494],"Star;":8902,"Sub;":8912,"Subset;":8912,"SubsetEqual;":8838,"Succeeds;":8827,"SucceedsEqual;":10928,"SucceedsSlantEqual;":8829,"SucceedsTilde;":8831,"SuchThat;":8715,"Sum;":8721,"Sup;":8913,"Superset;":8835,"SupersetEqual;":8839,"Supset;":8913,THORN:222,"THORN;":222,"TRADE;":8482,"TSHcy;":1035,"TScy;":1062,"Tab;":9,"Tau;":932,"Tcaron;":356,"Tcedil;":354,"Tcy;":1058,"Tfr;":[55349,56599],"Therefore;":8756,"Theta;":920,"ThickSpace;":[8287,8202],"ThinSpace;":8201,"Tilde;":8764,"TildeEqual;":8771,"TildeFullEqual;":8773,"TildeTilde;":8776,"Topf;":[55349,56651],"TripleDot;":8411,"Tscr;":[55349,56495],"Tstrok;":358,Uacute:218,"Uacute;":218,"Uarr;":8607,"Uarrocir;":10569,"Ubrcy;":1038,"Ubreve;":364,Ucirc:219,"Ucirc;":219,"Ucy;":1059,"Udblac;":368,"Ufr;":[55349,56600],Ugrave:217,"Ugrave;":217,"Umacr;":362,"UnderBar;":95,"UnderBrace;":9183,"UnderBracket;":9141,"UnderParenthesis;":9181,"Union;":8899,"UnionPlus;":8846,"Uogon;":370,"Uopf;":[55349,56652],"UpArrow;":8593,"UpArrowBar;":10514,"UpArrowDownArrow;":8645,"UpDownArrow;":8597,"UpEquilibrium;":10606,"UpTee;":8869,"UpTeeArrow;":8613,"Uparrow;":8657,"Updownarrow;":8661,"UpperLeftArrow;":8598,"UpperRightArrow;":8599,"Upsi;":978,"Upsilon;":933,"Uring;":366,"Uscr;":[55349,56496],"Utilde;":360,Uuml:220,"Uuml;":220,"VDash;":8875,"Vbar;":10987,"Vcy;":1042,"Vdash;":8873,"Vdashl;":10982,"Vee;":8897,"Verbar;":8214,"Vert;":8214,"VerticalBar;":8739,"VerticalLine;":124,"VerticalSeparator;":10072,"VerticalTilde;":8768,"VeryThinSpace;":8202,"Vfr;":[55349,56601],"Vopf;":[55349,56653],"Vscr;":[55349,56497],"Vvdash;":8874,"Wcirc;":372,"Wedge;":8896,"Wfr;":[55349,56602],"Wopf;":[55349,56654],"Wscr;":[55349,56498],"Xfr;":[55349,56603],"Xi;":926,"Xopf;":[55349,56655],"Xscr;":[55349,56499],"YAcy;":1071,"YIcy;":1031,"YUcy;":1070,Yacute:221,"Yacute;":221,"Ycirc;":374,"Ycy;":1067,"Yfr;":[55349,56604],"Yopf;":[55349,56656],"Yscr;":[55349,56500],"Yuml;":376,"ZHcy;":1046,"Zacute;":377,"Zcaron;":381,"Zcy;":1047,"Zdot;":379,"ZeroWidthSpace;":8203,"Zeta;":918,"Zfr;":8488,"Zopf;":8484,"Zscr;":[55349,56501],aacute:225,"aacute;":225,"abreve;":259,"ac;":8766,"acE;":[8766,819],"acd;":8767,acirc:226,"acirc;":226,acute:180,"acute;":180,"acy;":1072,aelig:230,"aelig;":230,"af;":8289,"afr;":[55349,56606],agrave:224,"agrave;":224,"alefsym;":8501,"aleph;":8501,"alpha;":945,"amacr;":257,"amalg;":10815,amp:38,"amp;":38,"and;":8743,"andand;":10837,"andd;":10844,"andslope;":10840,"andv;":10842,"ang;":8736,"ange;":10660,"angle;":8736,"angmsd;":8737,"angmsdaa;":10664,"angmsdab;":10665,"angmsdac;":10666,"angmsdad;":10667,"angmsdae;":10668,"angmsdaf;":10669,"angmsdag;":10670,"angmsdah;":10671,"angrt;":8735,"angrtvb;":8894,"angrtvbd;":10653,"angsph;":8738,"angst;":197,"angzarr;":9084,"aogon;":261,"aopf;":[55349,56658],"ap;":8776,"apE;":10864,"apacir;":10863,"ape;":8778,"apid;":8779,"apos;":39,"approx;":8776,"approxeq;":8778,aring:229,"aring;":229,"ascr;":[55349,56502],"ast;":42,"asymp;":8776,"asympeq;":8781,atilde:227,"atilde;":227,auml:228,"auml;":228,"awconint;":8755,"awint;":10769,"bNot;":10989,"backcong;":8780,"backepsilon;":1014,"backprime;":8245,"backsim;":8765,"backsimeq;":8909,"barvee;":8893,"barwed;":8965,"barwedge;":8965,"bbrk;":9141,"bbrktbrk;":9142,"bcong;":8780,"bcy;":1073,"bdquo;":8222,"becaus;":8757,"because;":8757,"bemptyv;":10672,"bepsi;":1014,"bernou;":8492,"beta;":946,"beth;":8502,"between;":8812,"bfr;":[55349,56607],"bigcap;":8898,"bigcirc;":9711,"bigcup;":8899,"bigodot;":10752,"bigoplus;":10753,"bigotimes;":10754,"bigsqcup;":10758,"bigstar;":9733,"bigtriangledown;":9661,"bigtriangleup;":9651,"biguplus;":10756,"bigvee;":8897,"bigwedge;":8896,"bkarow;":10509,"blacklozenge;":10731,"blacksquare;":9642,"blacktriangle;":9652,"blacktriangledown;":9662,"blacktriangleleft;":9666,"blacktriangleright;":9656,"blank;":9251,"blk12;":9618,"blk14;":9617,"blk34;":9619,"block;":9608,"bne;":[61,8421],"bnequiv;":[8801,8421],"bnot;":8976,"bopf;":[55349,56659],"bot;":8869,"bottom;":8869,"bowtie;":8904,"boxDL;":9559,"boxDR;":9556,"boxDl;":9558,"boxDr;":9555,"boxH;":9552,"boxHD;":9574,"boxHU;":9577,"boxHd;":9572,"boxHu;":9575,"boxUL;":9565,"boxUR;":9562,"boxUl;":9564,"boxUr;":9561,"boxV;":9553,"boxVH;":9580,"boxVL;":9571,"boxVR;":9568,"boxVh;":9579,"boxVl;":9570,"boxVr;":9567,"boxbox;":10697,"boxdL;":9557,"boxdR;":9554,"boxdl;":9488,"boxdr;":9484,"boxh;":9472,"boxhD;":9573,"boxhU;":9576,"boxhd;":9516,"boxhu;":9524,"boxminus;":8863,"boxplus;":8862,"boxtimes;":8864,"boxuL;":9563,"boxuR;":9560,"boxul;":9496,"boxur;":9492,"boxv;":9474,"boxvH;":9578,"boxvL;":9569,"boxvR;":9566,"boxvh;":9532,"boxvl;":9508,"boxvr;":9500,"bprime;":8245,"breve;":728,brvbar:166,"brvbar;":166,"bscr;":[55349,56503],"bsemi;":8271,"bsim;":8765,"bsime;":8909,"bsol;":92,"bsolb;":10693,"bsolhsub;":10184,"bull;":8226,"bullet;":8226,"bump;":8782,"bumpE;":10926,"bumpe;":8783,"bumpeq;":8783,"cacute;":263,"cap;":8745,"capand;":10820,"capbrcup;":10825,"capcap;":10827,"capcup;":10823,"capdot;":10816,"caps;":[8745,65024],"caret;":8257,"caron;":711,"ccaps;":10829,"ccaron;":269,ccedil:231,"ccedil;":231,"ccirc;":265,"ccups;":10828,"ccupssm;":10832,"cdot;":267,cedil:184,"cedil;":184,"cemptyv;":10674,cent:162,"cent;":162,"centerdot;":183,"cfr;":[55349,56608],"chcy;":1095,"check;":10003,"checkmark;":10003,"chi;":967,"cir;":9675,"cirE;":10691,"circ;":710,"circeq;":8791,"circlearrowleft;":8634,"circlearrowright;":8635,"circledR;":174,"circledS;":9416,"circledast;":8859,"circledcirc;":8858,"circleddash;":8861,"cire;":8791,"cirfnint;":10768,"cirmid;":10991,"cirscir;":10690,"clubs;":9827,"clubsuit;":9827,"colon;":58,"colone;":8788,"coloneq;":8788,"comma;":44,"commat;":64,"comp;":8705,"compfn;":8728,"complement;":8705,"complexes;":8450,"cong;":8773,"congdot;":10861,"conint;":8750,"copf;":[55349,56660],"coprod;":8720,copy:169,"copy;":169,"copysr;":8471,"crarr;":8629,"cross;":10007,"cscr;":[55349,56504],"csub;":10959,"csube;":10961,"csup;":10960,"csupe;":10962,"ctdot;":8943,"cudarrl;":10552,"cudarrr;":10549,"cuepr;":8926,"cuesc;":8927,"cularr;":8630,"cularrp;":10557,"cup;":8746,"cupbrcap;":10824,"cupcap;":10822,"cupcup;":10826,"cupdot;":8845,"cupor;":10821,"cups;":[8746,65024],"curarr;":8631,"curarrm;":10556,"curlyeqprec;":8926,"curlyeqsucc;":8927,"curlyvee;":8910,"curlywedge;":8911,curren:164,"curren;":164,"curvearrowleft;":8630,"curvearrowright;":8631,"cuvee;":8910,"cuwed;":8911,"cwconint;":8754,"cwint;":8753,"cylcty;":9005,"dArr;":8659,"dHar;":10597,"dagger;":8224,"daleth;":8504,"darr;":8595,"dash;":8208,"dashv;":8867,"dbkarow;":10511,"dblac;":733,"dcaron;":271,"dcy;":1076,"dd;":8518,"ddagger;":8225,"ddarr;":8650,"ddotseq;":10871,deg:176,"deg;":176,"delta;":948,"demptyv;":10673,"dfisht;":10623,"dfr;":[55349,56609],"dharl;":8643,"dharr;":8642,"diam;":8900,"diamond;":8900,"diamondsuit;":9830,"diams;":9830,"die;":168,"digamma;":989,"disin;":8946,"div;":247,divide:247,"divide;":247,"divideontimes;":8903,"divonx;":8903,"djcy;":1106,"dlcorn;":8990,"dlcrop;":8973,"dollar;":36,"dopf;":[55349,56661],"dot;":729,"doteq;":8784,"doteqdot;":8785,"dotminus;":8760,"dotplus;":8724,"dotsquare;":8865,"doublebarwedge;":8966,"downarrow;":8595,"downdownarrows;":8650,"downharpoonleft;":8643,"downharpoonright;":8642,"drbkarow;":10512,"drcorn;":8991,"drcrop;":8972,"dscr;":[55349,56505],"dscy;":1109,"dsol;":10742,"dstrok;":273,"dtdot;":8945,"dtri;":9663,"dtrif;":9662,"duarr;":8693,"duhar;":10607,"dwangle;":10662,"dzcy;":1119,"dzigrarr;":10239,"eDDot;":10871,"eDot;":8785,eacute:233,"eacute;":233,"easter;":10862,"ecaron;":283,"ecir;":8790,ecirc:234,"ecirc;":234,"ecolon;":8789,"ecy;":1101,"edot;":279,"ee;":8519,"efDot;":8786,"efr;":[55349,56610],"eg;":10906,egrave:232,"egrave;":232,"egs;":10902,"egsdot;":10904,"el;":10905,"elinters;":9191,"ell;":8467,"els;":10901,"elsdot;":10903,"emacr;":275,"empty;":8709,"emptyset;":8709,"emptyv;":8709,"emsp13;":8196,"emsp14;":8197,"emsp;":8195,"eng;":331,"ensp;":8194,"eogon;":281,"eopf;":[55349,56662],"epar;":8917,"eparsl;":10723,"eplus;":10865,"epsi;":949,"epsilon;":949,"epsiv;":1013,"eqcirc;":8790,"eqcolon;":8789,"eqsim;":8770,"eqslantgtr;":10902,"eqslantless;":10901,"equals;":61,"equest;":8799,"equiv;":8801,"equivDD;":10872,"eqvparsl;":10725,"erDot;":8787,"erarr;":10609,"escr;":8495,"esdot;":8784,"esim;":8770,"eta;":951,eth:240,"eth;":240,euml:235,"euml;":235,"euro;":8364,"excl;":33,"exist;":8707,"expectation;":8496,"exponentiale;":8519,"fallingdotseq;":8786,"fcy;":1092,"female;":9792,"ffilig;":64259,"fflig;":64256,"ffllig;":64260,"ffr;":[55349,56611],"filig;":64257,"fjlig;":[102,106],"flat;":9837,"fllig;":64258,"fltns;":9649,"fnof;":402,"fopf;":[55349,56663],"forall;":8704,"fork;":8916,"forkv;":10969,"fpartint;":10765,frac12:189,"frac12;":189,"frac13;":8531,frac14:188,"frac14;":188,"frac15;":8533,"frac16;":8537,"frac18;":8539,"frac23;":8532,"frac25;":8534,frac34:190,"frac34;":190,"frac35;":8535,"frac38;":8540,"frac45;":8536,"frac56;":8538,"frac58;":8541,"frac78;":8542,"frasl;":8260,"frown;":8994,"fscr;":[55349,56507],"gE;":8807,"gEl;":10892,"gacute;":501,"gamma;":947,"gammad;":989,"gap;":10886,"gbreve;":287,"gcirc;":285,"gcy;":1075,"gdot;":289,"ge;":8805,"gel;":8923,"geq;":8805,"geqq;":8807,"geqslant;":10878,"ges;":10878,"gescc;":10921,"gesdot;":10880,"gesdoto;":10882,"gesdotol;":10884,"gesl;":[8923,65024],"gesles;":10900,"gfr;":[55349,56612],"gg;":8811,"ggg;":8921,"gimel;":8503,"gjcy;":1107,"gl;":8823,"glE;":10898,"gla;":10917,"glj;":10916,"gnE;":8809,"gnap;":10890,"gnapprox;":10890,"gne;":10888,"gneq;":10888,"gneqq;":8809,"gnsim;":8935,"gopf;":[55349,56664],"grave;":96,"gscr;":8458,"gsim;":8819,"gsime;":10894,"gsiml;":10896,gt:62,"gt;":62,"gtcc;":10919,"gtcir;":10874,"gtdot;":8919,"gtlPar;":10645,"gtquest;":10876,"gtrapprox;":10886,"gtrarr;":10616,"gtrdot;":8919,"gtreqless;":8923,"gtreqqless;":10892,"gtrless;":8823,"gtrsim;":8819,"gvertneqq;":[8809,65024],"gvnE;":[8809,65024],"hArr;":8660,"hairsp;":8202,"half;":189,"hamilt;":8459,"hardcy;":1098,"harr;":8596,"harrcir;":10568,"harrw;":8621,"hbar;":8463,"hcirc;":293,"hearts;":9829,"heartsuit;":9829,"hellip;":8230,"hercon;":8889,"hfr;":[55349,56613],"hksearow;":10533,"hkswarow;":10534,"hoarr;":8703,"homtht;":8763,"hookleftarrow;":8617,"hookrightarrow;":8618,"hopf;":[55349,56665],"horbar;":8213,"hscr;":[55349,56509],"hslash;":8463,"hstrok;":295,"hybull;":8259,"hyphen;":8208,iacute:237,"iacute;":237,"ic;":8291,icirc:238,"icirc;":238,"icy;":1080,"iecy;":1077,iexcl:161,"iexcl;":161,"iff;":8660,"ifr;":[55349,56614],igrave:236,"igrave;":236,"ii;":8520,"iiiint;":10764,"iiint;":8749,"iinfin;":10716,"iiota;":8489,"ijlig;":307,"imacr;":299,"image;":8465,"imagline;":8464,"imagpart;":8465,"imath;":305,"imof;":8887,"imped;":437,"in;":8712,"incare;":8453,"infin;":8734,"infintie;":10717,"inodot;":305,"int;":8747,"intcal;":8890,"integers;":8484,"intercal;":8890,"intlarhk;":10775,"intprod;":10812,"iocy;":1105,"iogon;":303,"iopf;":[55349,56666],"iota;":953,"iprod;":10812,iquest:191,"iquest;":191,"iscr;":[55349,56510],"isin;":8712,"isinE;":8953,"isindot;":8949,"isins;":8948,"isinsv;":8947,"isinv;":8712,"it;":8290,"itilde;":297,"iukcy;":1110,iuml:239,"iuml;":239,"jcirc;":309,"jcy;":1081,"jfr;":[55349,56615],"jmath;":567,"jopf;":[55349,56667],"jscr;":[55349,56511],"jsercy;":1112,"jukcy;":1108,"kappa;":954,"kappav;":1008,"kcedil;":311,"kcy;":1082,"kfr;":[55349,56616],"kgreen;":312,"khcy;":1093,"kjcy;":1116,"kopf;":[55349,56668],"kscr;":[55349,56512],"lAarr;":8666,"lArr;":8656,"lAtail;":10523,"lBarr;":10510,"lE;":8806,"lEg;":10891,"lHar;":10594,"lacute;":314,"laemptyv;":10676,"lagran;":8466,"lambda;":955,"lang;":10216,"langd;":10641,"langle;":10216,"lap;":10885,laquo:171,"laquo;":171,"larr;":8592,"larrb;":8676,"larrbfs;":10527,"larrfs;":10525,"larrhk;":8617,"larrlp;":8619,"larrpl;":10553,"larrsim;":10611,"larrtl;":8610,"lat;":10923,"latail;":10521,"late;":10925,"lates;":[10925,65024],"lbarr;":10508,"lbbrk;":10098,"lbrace;":123,"lbrack;":91,"lbrke;":10635,"lbrksld;":10639,"lbrkslu;":10637,"lcaron;":318,"lcedil;":316,"lceil;":8968,"lcub;":123,"lcy;":1083,"ldca;":10550,"ldquo;":8220,"ldquor;":8222,"ldrdhar;":10599,"ldrushar;":10571,"ldsh;":8626,"le;":8804,"leftarrow;":8592,"leftarrowtail;":8610,"leftharpoondown;":8637,"leftharpoonup;":8636,"leftleftarrows;":8647,"leftrightarrow;":8596,"leftrightarrows;":8646,"leftrightharpoons;":8651,"leftrightsquigarrow;":8621,"leftthreetimes;":8907,"leg;":8922,"leq;":8804,"leqq;":8806,"leqslant;":10877,"les;":10877,"lescc;":10920,"lesdot;":10879,"lesdoto;":10881,"lesdotor;":10883,"lesg;":[8922,65024],"lesges;":10899,"lessapprox;":10885,"lessdot;":8918,"lesseqgtr;":8922,"lesseqqgtr;":10891,"lessgtr;":8822,"lesssim;":8818,"lfisht;":10620,"lfloor;":8970,"lfr;":[55349,56617],"lg;":8822,"lgE;":10897,"lhard;":8637,"lharu;":8636,"lharul;":10602,"lhblk;":9604,"ljcy;":1113,"ll;":8810,"llarr;":8647,"llcorner;":8990,"llhard;":10603,"lltri;":9722,"lmidot;":320,"lmoust;":9136,"lmoustache;":9136,"lnE;":8808,"lnap;":10889,"lnapprox;":10889,"lne;":10887,"lneq;":10887,"lneqq;":8808,"lnsim;":8934,"loang;":10220,"loarr;":8701,"lobrk;":10214,"longleftarrow;":10229,"longleftrightarrow;":10231,"longmapsto;":10236,"longrightarrow;":10230,"looparrowleft;":8619,"looparrowright;":8620,"lopar;":10629,"lopf;":[55349,56669],"loplus;":10797,"lotimes;":10804,"lowast;":8727,"lowbar;":95,"loz;":9674,"lozenge;":9674,"lozf;":10731,"lpar;":40,"lparlt;":10643,"lrarr;":8646,"lrcorner;":8991,"lrhar;":8651,"lrhard;":10605,"lrm;":8206,"lrtri;":8895,"lsaquo;":8249,"lscr;":[55349,56513],"lsh;":8624,"lsim;":8818,"lsime;":10893,"lsimg;":10895,"lsqb;":91,"lsquo;":8216,"lsquor;":8218,"lstrok;":322,lt:60,"lt;":60,"ltcc;":10918,"ltcir;":10873,"ltdot;":8918,"lthree;":8907,"ltimes;":8905,"ltlarr;":10614,"ltquest;":10875,"ltrPar;":10646,"ltri;":9667,"ltrie;":8884,"ltrif;":9666,"lurdshar;":10570,"luruhar;":10598,"lvertneqq;":[8808,65024],"lvnE;":[8808,65024],"mDDot;":8762,macr:175,"macr;":175,"male;":9794,"malt;":10016,"maltese;":10016,"map;":8614,"mapsto;":8614,"mapstodown;":8615,"mapstoleft;":8612,"mapstoup;":8613,"marker;":9646,"mcomma;":10793,"mcy;":1084,"mdash;":8212,"measuredangle;":8737,"mfr;":[55349,56618],"mho;":8487,micro:181,"micro;":181,"mid;":8739,"midast;":42,"midcir;":10992,middot:183,"middot;":183,"minus;":8722,"minusb;":8863,"minusd;":8760,"minusdu;":10794,"mlcp;":10971,"mldr;":8230,"mnplus;":8723,"models;":8871,"mopf;":[55349,56670],"mp;":8723,"mscr;":[55349,56514],"mstpos;":8766,"mu;":956,"multimap;":8888,"mumap;":8888,"nGg;":[8921,824],"nGt;":[8811,8402],"nGtv;":[8811,824],"nLeftarrow;":8653,"nLeftrightarrow;":8654,"nLl;":[8920,824],"nLt;":[8810,8402],"nLtv;":[8810,824],"nRightarrow;":8655,"nVDash;":8879,"nVdash;":8878,"nabla;":8711,"nacute;":324,"nang;":[8736,8402],"nap;":8777,"napE;":[10864,824],"napid;":[8779,824],"napos;":329,"napprox;":8777,"natur;":9838,"natural;":9838,"naturals;":8469,nbsp:160,"nbsp;":160,"nbump;":[8782,824],"nbumpe;":[8783,824],"ncap;":10819,"ncaron;":328,"ncedil;":326,"ncong;":8775,"ncongdot;":[10861,824],"ncup;":10818,"ncy;":1085,"ndash;":8211,"ne;":8800,"neArr;":8663,"nearhk;":10532,"nearr;":8599,"nearrow;":8599,"nedot;":[8784,824],"nequiv;":8802,"nesear;":10536,"nesim;":[8770,824],"nexist;":8708,"nexists;":8708,"nfr;":[55349,56619],"ngE;":[8807,824],"nge;":8817,"ngeq;":8817,"ngeqq;":[8807,824],"ngeqslant;":[10878,824],"nges;":[10878,824],"ngsim;":8821,"ngt;":8815,"ngtr;":8815,"nhArr;":8654,"nharr;":8622,"nhpar;":10994,"ni;":8715,"nis;":8956,"nisd;":8954,"niv;":8715,"njcy;":1114,"nlArr;":8653,"nlE;":[8806,824],"nlarr;":8602,"nldr;":8229,"nle;":8816,"nleftarrow;":8602,"nleftrightarrow;":8622,"nleq;":8816,"nleqq;":[8806,824],"nleqslant;":[10877,824],"nles;":[10877,824],"nless;":8814,"nlsim;":8820,"nlt;":8814,"nltri;":8938,"nltrie;":8940,"nmid;":8740,"nopf;":[55349,56671],not:172,"not;":172,"notin;":8713,"notinE;":[8953,824],"notindot;":[8949,824],"notinva;":8713,"notinvb;":8951,"notinvc;":8950,"notni;":8716,"notniva;":8716,"notnivb;":8958,"notnivc;":8957,"npar;":8742,"nparallel;":8742,"nparsl;":[11005,8421],"npart;":[8706,824],"npolint;":10772,"npr;":8832,"nprcue;":8928,"npre;":[10927,824],"nprec;":8832,"npreceq;":[10927,824],"nrArr;":8655,"nrarr;":8603,"nrarrc;":[10547,824],"nrarrw;":[8605,824],"nrightarrow;":8603,"nrtri;":8939,"nrtrie;":8941,"nsc;":8833,"nsccue;":8929,"nsce;":[10928,824],"nscr;":[55349,56515],"nshortmid;":8740,"nshortparallel;":8742,"nsim;":8769,"nsime;":8772,"nsimeq;":8772,"nsmid;":8740,"nspar;":8742,"nsqsube;":8930,"nsqsupe;":8931,"nsub;":8836,"nsubE;":[10949,824],"nsube;":8840,"nsubset;":[8834,8402],"nsubseteq;":8840,"nsubseteqq;":[10949,824],"nsucc;":8833,"nsucceq;":[10928,824],"nsup;":8837,"nsupE;":[10950,824],"nsupe;":8841,"nsupset;":[8835,8402],"nsupseteq;":8841,"nsupseteqq;":[10950,824],"ntgl;":8825,ntilde:241,"ntilde;":241,"ntlg;":8824,"ntriangleleft;":8938,"ntrianglelefteq;":8940,"ntriangleright;":8939,"ntrianglerighteq;":8941,"nu;":957,"num;":35,"numero;":8470,"numsp;":8199,"nvDash;":8877,"nvHarr;":10500,"nvap;":[8781,8402],"nvdash;":8876,"nvge;":[8805,8402],"nvgt;":[62,8402],"nvinfin;":10718,"nvlArr;":10498,"nvle;":[8804,8402],"nvlt;":[60,8402],"nvltrie;":[8884,8402],"nvrArr;":10499,"nvrtrie;":[8885,8402],"nvsim;":[8764,8402],"nwArr;":8662,"nwarhk;":10531,"nwarr;":8598,"nwarrow;":8598,"nwnear;":10535,"oS;":9416,oacute:243,"oacute;":243,"oast;":8859,"ocir;":8858,ocirc:244,"ocirc;":244,"ocy;":1086,"odash;":8861,"odblac;":337,"odiv;":10808,"odot;":8857,"odsold;":10684,"oelig;":339,"ofcir;":10687,"ofr;":[55349,56620],"ogon;":731,ograve:242,"ograve;":242,"ogt;":10689,"ohbar;":10677,"ohm;":937,"oint;":8750,"olarr;":8634,"olcir;":10686,"olcross;":10683,"oline;":8254,"olt;":10688,"omacr;":333,"omega;":969,"omicron;":959,"omid;":10678,"ominus;":8854,"oopf;":[55349,56672],"opar;":10679,"operp;":10681,"oplus;":8853,"or;":8744,"orarr;":8635,"ord;":10845,"order;":8500,"orderof;":8500,ordf:170,"ordf;":170,ordm:186,"ordm;":186,"origof;":8886,"oror;":10838,"orslope;":10839,"orv;":10843,"oscr;":8500,oslash:248,"oslash;":248,"osol;":8856,otilde:245,"otilde;":245,"otimes;":8855,"otimesas;":10806,ouml:246,"ouml;":246,"ovbar;":9021,"par;":8741,para:182,"para;":182,"parallel;":8741,"parsim;":10995,"parsl;":11005,"part;":8706,"pcy;":1087,"percnt;":37,"period;":46,"permil;":8240,"perp;":8869,"pertenk;":8241,"pfr;":[55349,56621],"phi;":966,"phiv;":981,"phmmat;":8499,"phone;":9742,"pi;":960,"pitchfork;":8916,"piv;":982,"planck;":8463,"planckh;":8462,"plankv;":8463,"plus;":43,"plusacir;":10787,"plusb;":8862,"pluscir;":10786,"plusdo;":8724,"plusdu;":10789,"pluse;":10866,plusmn:177,"plusmn;":177,"plussim;":10790,"plustwo;":10791,"pm;":177,"pointint;":10773,"popf;":[55349,56673],pound:163,"pound;":163,"pr;":8826,"prE;":10931,"prap;":10935,"prcue;":8828,"pre;":10927,"prec;":8826,"precapprox;":10935,"preccurlyeq;":8828,"preceq;":10927,"precnapprox;":10937,"precneqq;":10933,"precnsim;":8936,"precsim;":8830,"prime;":8242,"primes;":8473,"prnE;":10933,"prnap;":10937,"prnsim;":8936,"prod;":8719,"profalar;":9006,"profline;":8978,"profsurf;":8979,"prop;":8733,"propto;":8733,"prsim;":8830,"prurel;":8880,"pscr;":[55349,56517],"psi;":968,"puncsp;":8200,"qfr;":[55349,56622],"qint;":10764,"qopf;":[55349,56674],"qprime;":8279,"qscr;":[55349,56518],"quaternions;":8461,"quatint;":10774,"quest;":63,"questeq;":8799,quot:34,"quot;":34,"rAarr;":8667,"rArr;":8658,"rAtail;":10524,"rBarr;":10511,"rHar;":10596,"race;":[8765,817],"racute;":341,"radic;":8730,"raemptyv;":10675,"rang;":10217,"rangd;":10642,"range;":10661,"rangle;":10217,raquo:187,"raquo;":187,"rarr;":8594,"rarrap;":10613,"rarrb;":8677,"rarrbfs;":10528,"rarrc;":10547,"rarrfs;":10526,"rarrhk;":8618,"rarrlp;":8620,"rarrpl;":10565,"rarrsim;":10612,"rarrtl;":8611,"rarrw;":8605,"ratail;":10522,"ratio;":8758,"rationals;":8474,"rbarr;":10509,"rbbrk;":10099,"rbrace;":125,"rbrack;":93,"rbrke;":10636,"rbrksld;":10638,"rbrkslu;":10640,"rcaron;":345,"rcedil;":343,"rceil;":8969,"rcub;":125,"rcy;":1088,"rdca;":10551,"rdldhar;":10601,"rdquo;":8221,"rdquor;":8221,"rdsh;":8627,"real;":8476,"realine;":8475,"realpart;":8476,"reals;":8477,"rect;":9645,reg:174,"reg;":174,"rfisht;":10621,"rfloor;":8971,"rfr;":[55349,56623],"rhard;":8641,"rharu;":8640,"rharul;":10604,"rho;":961,"rhov;":1009,"rightarrow;":8594,"rightarrowtail;":8611,"rightharpoondown;":8641,"rightharpoonup;":8640,"rightleftarrows;":8644,"rightleftharpoons;":8652,"rightrightarrows;":8649,"rightsquigarrow;":8605,"rightthreetimes;":8908,"ring;":730,"risingdotseq;":8787,"rlarr;":8644,"rlhar;":8652,"rlm;":8207,"rmoust;":9137,"rmoustache;":9137,"rnmid;":10990,"roang;":10221,"roarr;":8702,"robrk;":10215,"ropar;":10630,"ropf;":[55349,56675],"roplus;":10798,"rotimes;":10805,"rpar;":41,"rpargt;":10644,"rppolint;":10770,"rrarr;":8649,"rsaquo;":8250,"rscr;":[55349,56519],"rsh;":8625,"rsqb;":93,"rsquo;":8217,"rsquor;":8217,"rthree;":8908,"rtimes;":8906,"rtri;":9657,"rtrie;":8885,"rtrif;":9656,"rtriltri;":10702,"ruluhar;":10600,"rx;":8478,"sacute;":347,"sbquo;":8218,"sc;":8827,"scE;":10932,"scap;":10936,"scaron;":353,"sccue;":8829,"sce;":10928,"scedil;":351,"scirc;":349,"scnE;":10934,"scnap;":10938,"scnsim;":8937,"scpolint;":10771,"scsim;":8831,"scy;":1089,"sdot;":8901,"sdotb;":8865,"sdote;":10854,"seArr;":8664,"searhk;":10533,"searr;":8600,"searrow;":8600,sect:167,"sect;":167,"semi;":59,"seswar;":10537,"setminus;":8726,"setmn;":8726,"sext;":10038,"sfr;":[55349,56624],"sfrown;":8994,"sharp;":9839,"shchcy;":1097,"shcy;":1096,"shortmid;":8739,"shortparallel;":8741,shy:173,"shy;":173,"sigma;":963,"sigmaf;":962,"sigmav;":962,"sim;":8764,"simdot;":10858,"sime;":8771,"simeq;":8771,"simg;":10910,"simgE;":10912,"siml;":10909,"simlE;":10911,"simne;":8774,"simplus;":10788,"simrarr;":10610,"slarr;":8592,"smallsetminus;":8726,"smashp;":10803,"smeparsl;":10724,"smid;":8739,"smile;":8995,"smt;":10922,"smte;":10924,"smtes;":[10924,65024],"softcy;":1100,"sol;":47,"solb;":10692,"solbar;":9023,"sopf;":[55349,56676],"spades;":9824,"spadesuit;":9824,"spar;":8741,"sqcap;":8851,"sqcaps;":[8851,65024],"sqcup;":8852,"sqcups;":[8852,65024],"sqsub;":8847,"sqsube;":8849,"sqsubset;":8847,"sqsubseteq;":8849,"sqsup;":8848,"sqsupe;":8850,"sqsupset;":8848,"sqsupseteq;":8850,"squ;":9633,"square;":9633,"squarf;":9642,"squf;":9642,"srarr;":8594,"sscr;":[55349,56520],"ssetmn;":8726,"ssmile;":8995,"sstarf;":8902,"star;":9734,"starf;":9733,"straightepsilon;":1013,"straightphi;":981,"strns;":175,"sub;":8834,"subE;":10949,"subdot;":10941,"sube;":8838,"subedot;":10947,"submult;":10945,"subnE;":10955,"subne;":8842,"subplus;":10943,"subrarr;":10617,"subset;":8834,"subseteq;":8838,"subseteqq;":10949,"subsetneq;":8842,"subsetneqq;":10955,"subsim;":10951,"subsub;":10965,"subsup;":10963,"succ;":8827,"succapprox;":10936,"succcurlyeq;":8829,"succeq;":10928,"succnapprox;":10938,"succneqq;":10934,"succnsim;":8937,"succsim;":8831,"sum;":8721,"sung;":9834,sup1:185,"sup1;":185,sup2:178,"sup2;":178,sup3:179,"sup3;":179,"sup;":8835,"supE;":10950,"supdot;":10942,"supdsub;":10968,"supe;":8839,"supedot;":10948,"suphsol;":10185,"suphsub;":10967,"suplarr;":10619,"supmult;":10946,"supnE;":10956,"supne;":8843,"supplus;":10944,"supset;":8835,"supseteq;":8839,"supseteqq;":10950,"supsetneq;":8843,"supsetneqq;":10956,"supsim;":10952,"supsub;":10964,"supsup;":10966,"swArr;":8665,"swarhk;":10534,"swarr;":8601,"swarrow;":8601,"swnwar;":10538,szlig:223,"szlig;":223,"target;":8982,"tau;":964,"tbrk;":9140,"tcaron;":357,"tcedil;":355,"tcy;":1090,"tdot;":8411,"telrec;":8981,"tfr;":[55349,56625],"there4;":8756,"therefore;":8756,"theta;":952,"thetasym;":977,"thetav;":977,"thickapprox;":8776,"thicksim;":8764,"thinsp;":8201,"thkap;":8776,"thksim;":8764,thorn:254,"thorn;":254,"tilde;":732,times:215,"times;":215,"timesb;":8864,"timesbar;":10801,"timesd;":10800,"tint;":8749,"toea;":10536,"top;":8868,"topbot;":9014,"topcir;":10993,"topf;":[55349,56677],"topfork;":10970,"tosa;":10537,"tprime;":8244,"trade;":8482,"triangle;":9653,"triangledown;":9663,"triangleleft;":9667,"trianglelefteq;":8884,"triangleq;":8796,"triangleright;":9657,"trianglerighteq;":8885,"tridot;":9708,"trie;":8796,"triminus;":10810,"triplus;":10809,"trisb;":10701,"tritime;":10811,"trpezium;":9186,"tscr;":[55349,56521],"tscy;":1094,"tshcy;":1115,"tstrok;":359,"twixt;":8812,"twoheadleftarrow;":8606,"twoheadrightarrow;":8608,"uArr;":8657,"uHar;":10595,uacute:250,"uacute;":250,"uarr;":8593,"ubrcy;":1118,"ubreve;":365,ucirc:251,"ucirc;":251,"ucy;":1091,"udarr;":8645,"udblac;":369,"udhar;":10606,"ufisht;":10622,"ufr;":[55349,56626],ugrave:249,"ugrave;":249,"uharl;":8639,"uharr;":8638,"uhblk;":9600,"ulcorn;":8988,"ulcorner;":8988,"ulcrop;":8975,"ultri;":9720,"umacr;":363,uml:168,"uml;":168,"uogon;":371,"uopf;":[55349,56678],"uparrow;":8593,"updownarrow;":8597,"upharpoonleft;":8639,"upharpoonright;":8638,"uplus;":8846,"upsi;":965,"upsih;":978,"upsilon;":965,"upuparrows;":8648,"urcorn;":8989,"urcorner;":8989,"urcrop;":8974,"uring;":367,"urtri;":9721,"uscr;":[55349,56522],"utdot;":8944,"utilde;":361,"utri;":9653,"utrif;":9652,"uuarr;":8648,uuml:252,"uuml;":252,"uwangle;":10663,"vArr;":8661,"vBar;":10984,"vBarv;":10985,"vDash;":8872,"vangrt;":10652,"varepsilon;":1013,"varkappa;":1008,"varnothing;":8709,"varphi;":981,"varpi;":982,"varpropto;":8733,"varr;":8597,"varrho;":1009,"varsigma;":962,"varsubsetneq;":[8842,65024],"varsubsetneqq;":[10955,65024],"varsupsetneq;":[8843,65024],"varsupsetneqq;":[10956,65024],"vartheta;":977,"vartriangleleft;":8882,"vartriangleright;":8883,"vcy;":1074,"vdash;":8866,"vee;":8744,"veebar;":8891,"veeeq;":8794,"vellip;":8942,"verbar;":124,"vert;":124,"vfr;":[55349,56627],"vltri;":8882,"vnsub;":[8834,8402],"vnsup;":[8835,8402],"vopf;":[55349,56679],"vprop;":8733,"vrtri;":8883,"vscr;":[55349,56523],"vsubnE;":[10955,65024],"vsubne;":[8842,65024],"vsupnE;":[10956,65024],"vsupne;":[8843,65024],"vzigzag;":10650,"wcirc;":373,"wedbar;":10847,"wedge;":8743,"wedgeq;":8793,"weierp;":8472,"wfr;":[55349,56628],"wopf;":[55349,56680],"wp;":8472,"wr;":8768,"wreath;":8768,"wscr;":[55349,56524],"xcap;":8898,"xcirc;":9711,"xcup;":8899,"xdtri;":9661,"xfr;":[55349,56629],"xhArr;":10234,"xharr;":10231,"xi;":958,"xlArr;":10232,"xlarr;":10229,"xmap;":10236,"xnis;":8955,"xodot;":10752,"xopf;":[55349,56681],"xoplus;":10753,"xotime;":10754,"xrArr;":10233,"xrarr;":10230,"xscr;":[55349,56525],"xsqcup;":10758,"xuplus;":10756,"xutri;":9651,"xvee;":8897,"xwedge;":8896,yacute:253,"yacute;":253,"yacy;":1103,"ycirc;":375,"ycy;":1099,yen:165,"yen;":165,"yfr;":[55349,56630],"yicy;":1111,"yopf;":[55349,56682],"yscr;":[55349,56526],"yucy;":1102,yuml:255,"yuml;":255,"zacute;":378,"zcaron;":382,"zcy;":1079,"zdot;":380,"zeetrf;":8488,"zeta;":950,"zfr;":[55349,56631],"zhcy;":1078,"zigrarr;":8669,"zopf;":[55349,56683],"zscr;":[55349,56527],"zwj;":8205,"zwnj;":8204},po=/(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g,kx=32,Lx=/[^\r"&\u0000]+/g,Mx=/[^\r'&\u0000]+/g,Rx=/[^\r\t\n\f &>\u0000]+/g,Ix=/[^\r\t\n\f \/>A-Z\u0000]+/g,Ox=/[^\r\t\n\f \/=>A-Z\u0000]+/g,qx=/[^\]\r\u0000\uffff]*/g,Hx=/[^&<\r\u0000\uffff]*/g,mo=/[^<\r\u0000\uffff]*/g,Fx=/[^\r\u0000\uffff]*/g,go=/(?:(\/)?([a-z]+)>)|[\s\S]/g,bo=/(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g,Ea=/[^\x09\x0A\x0C\x0D\x20]/,ni=/[^\x09\x0A\x0C\x0D\x20]/g,Bx=/[^\x00\x09\x0A\x0C\x0D\x20]/,St=/^[\x09\x0A\x0C\x0D\x20]+/,_a=/\x00/g;function me(e){var t=16384;if(e.length0;t--){var r=this.elements[t];if(z(r,e))break}this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.popElementType=function(e){for(var t=this.elements.length-1;t>0&&!(this.elements[t]instanceof e);t--);this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.popElement=function(e){for(var t=this.elements.length-1;t>0&&this.elements[t]!==e;t--);this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.removeElement=function(e){if(this.top===e)this.pop();else{var t=this.elements.lastIndexOf(e);t!==-1&&this.elements.splice(t,1)}};q.ElementStack.prototype.clearToContext=function(e){for(var t=this.elements.length-1;t>0&&!z(this.elements[t],e);t--);this.elements.length=t+1,this.top=this.elements[t]};q.ElementStack.prototype.contains=function(e){return this.inSpecificScope(e,Object.create(null))};q.ElementStack.prototype.inSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(z(a,e))return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.elementInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(a===e)return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.elementTypeInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(a instanceof e)return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.inScope=function(e){return this.inSpecificScope(e,Be)};q.ElementStack.prototype.elementInScope=function(e){return this.elementInSpecificScope(e,Be)};q.ElementStack.prototype.elementTypeInScope=function(e){return this.elementTypeInSpecificScope(e,Be)};q.ElementStack.prototype.inButtonScope=function(e){return this.inSpecificScope(e,ci)};q.ElementStack.prototype.inListItemScope=function(e){return this.inSpecificScope(e,ya)};q.ElementStack.prototype.inTableScope=function(e){return this.inSpecificScope(e,Do)};q.ElementStack.prototype.inSelectScope=function(e){for(var t=this.elements.length-1;t>=0;t--){var r=this.elements[t];if(r.namespaceURI!==w.HTML)return!1;var a=r.localName;if(a===e)return!0;if(a!=="optgroup"&&a!=="option")return!1}return!1};q.ElementStack.prototype.generateImpliedEndTags=function(e,t){for(var r=t?Ao:So,a=this.elements.length-1;a>=0;a--){var s=this.elements[a];if(e&&z(s,e)||!z(this.elements[a],r))break}this.elements.length=a+1,this.top=this.elements[a]};q.ActiveFormattingElements=function(){this.list=[],this.attrs=[]};q.ActiveFormattingElements.prototype.MARKER={localName:"|"};q.ActiveFormattingElements.prototype.insertMarker=function(){this.list.push(this.MARKER),this.attrs.push(this.MARKER)};q.ActiveFormattingElements.prototype.push=function(e,t){for(var r=0,a=this.list.length-1;a>=0&&this.list[a]!==this.MARKER;a--)if(x(e,this.list[a],this.attrs[a])&&(r++,r===3)){this.list.splice(a,1),this.attrs.splice(a,1);break}this.list.push(e);for(var s=[],o=0;o=0&&this.list[e]!==this.MARKER;e--);e<0&&(e=0),this.list.length=e,this.attrs.length=e};q.ActiveFormattingElements.prototype.findElementByTag=function(e){for(var t=this.list.length-1;t>=0;t--){var r=this.list[t];if(r===this.MARKER)break;if(r.localName===e)return r}return null};q.ActiveFormattingElements.prototype.indexOf=function(e){return this.list.lastIndexOf(e)};q.ActiveFormattingElements.prototype.remove=function(e){var t=this.list.lastIndexOf(e);t!==-1&&(this.list.splice(t,1),this.attrs.splice(t,1))};q.ActiveFormattingElements.prototype.replace=function(e,t,r){var a=this.list.lastIndexOf(e);a!==-1&&(this.list[a]=t,this.attrs[a]=r)};q.ActiveFormattingElements.prototype.insertAfter=function(e,t){var r=this.list.lastIndexOf(e);r!==-1&&(this.list.splice(r,0,t),this.attrs.splice(r,0,t))};function q(e,t,r){var a=null,s=0,o=0,x=!1,m=!1,h=0,g=[],v="",ne=!0,se=0,u=M,be,X,O="",Ye="",H=[],ie="",le="",W=[],Qe=[],$e=[],Ze=[],Ce=[],yr=!1,p=cl,Pe=null,Ue=[],l=new q.ElementStack,L=new q.ActiveFormattingElements,dt=t!==void 0,Nr=null,Ve=null,wr=!0;t&&(wr=t.ownerDocument._scripting_enabled),r&&r.scripting_enabled===!1&&(wr=!1);var $=!0,Da=!1,Sr,ka,b=[],Je=!1,ht=!1,Ar={document:function(){return F},_asDocumentFragment:function(){for(var n=F.createDocumentFragment(),i=F.firstChild;i.hasChildNodes();)n.appendChild(i.firstChild);return n},pause:function(){se++},resume:function(){se--,this.parse("")},parse:function(n,i,c){var f;return se>0?(v+=n,!0):(h===0?(v&&(n=v+n,v=""),i&&(n+="\uFFFF",x=!0),a=n,s=n.length,o=0,ne&&(ne=!1,a.charCodeAt(0)===65279&&(o=1)),h++,f=Ti(c),v=a.substring(o,s),h--):(h++,g.push(a,s,o),a=n,s=n.length,o=0,Ti(),f=!1,v=a.substring(o,s),o=g.pop(),s=g.pop(),a=g.pop(),v&&(a=v+a.substring(o),s=a.length,o=0,v=""),h--),f)}},F=new vx(!0,e);if(F._parser=Ar,F._scripting_enabled=wr,t){if(t.ownerDocument._quirks&&(F._quirks=!0),t.ownerDocument._limitedQuirks&&(F._limitedQuirks=!0),t.namespaceURI===w.HTML)switch(t.localName){case"title":case"textarea":u=at;break;case"style":case"xmp":case"iframe":case"noembed":case"noframes":case"script":case"plaintext":u=Oa;break}var vi=F.createElement("html");F._appendChild(vi),l.push(vi),t instanceof G.HTMLTemplateElement&&Ue.push(za),Jt();for(var Kt=t;Kt!==null;Kt=Kt.parentElement)if(Kt instanceof G.HTMLFormElement){Ve=Kt;break}}function Ti(n){for(var i,c,f,d;o0||n&&n())return!0;switch(typeof u.lookahead){case"undefined":if(i=a.charCodeAt(o++),m&&(m=!1,i===10)){o++;continue}switch(i){case 13:o0){var n=me(b);if(b.length=0,ht&&(ht=!1,n[0]===` +`&&(n=n.substring(1)),n.length===0))return;re(Wt,n),Je=!1}ht=!1}function Qt(n){n.lastIndex=o-1;var i=n.exec(a);if(i&&i.index===o-1)return i=i[0],o+=i.length-1,x&&o===s&&(i=i.slice(0,-1),o--),i;throw new Error("should never happen")}function $t(n){n.lastIndex=o-1;var i=n.exec(a)[0];return i?(pc(i),o+=i.length-1,!0):!1}function pc(n){b.length>0&&kt(),!(ht&&(ht=!1,n[0]===` +`&&(n=n.substring(1)),n.length===0))&&re(Wt,n)}function Ge(){if(yr)re(I,O);else{var n=O;O="",Ye=n,re(pe,n,Ce)}}function mc(){if(o===s)return!1;go.lastIndex=o;var n=go.exec(a);if(!n)throw new Error("should never happen");var i=n[2];if(!i)return!1;var c=n[1];return c?(o+=i.length+2,re(I,i)):(o+=i.length+1,Ye=i,re(pe,i,Nx)),!0}function gc(){yr?re(I,O,null,!0):re(pe,O,Ce,!0)}function U(){re(yx,me(Qe),$e?me($e):void 0,Ze?me(Ze):void 0)}function k(){kt(),p(ba),F.modclock=1}var re=Ar.insertToken=function(i,c,f,d){kt();var E=l.top;!E||E.namespaceURI===w.HTML?p(i,c,f,d):i!==pe&&i!==Wt?Bi(i,c,f,d):Eo(E)&&(i===Wt||i===pe&&c!=="mglyph"&&c!=="malignmark")||i===pe&&c==="svg"&&E.namespaceURI===w.MATHML&&E.localName==="annotation-xml"||_o(E)?(ka=!0,p(i,c,f,d),ka=!1):Bi(i,c,f,d)};function Re(n){var i=l.top;rt&&z(i,Xt)?kr(function(c){return c.createComment(n)}):(i instanceof G.HTMLTemplateElement&&(i=i.content),i._appendChild(i.ownerDocument.createComment(n)))}function Ie(n){var i=l.top;if(rt&&z(i,Xt))kr(function(f){return f.createTextNode(n)});else{i instanceof G.HTMLTemplateElement&&(i=i.content);var c=i.lastChild;c&&c.nodeType===ai.TEXT_NODE?c.appendData(n):i._appendChild(i.ownerDocument.createTextNode(n))}}function Zt(n,i,c){var f=No.createElement(n,i,null);if(c)for(var d=0,E=c.length;d=0;i--)if(l.elements[i]instanceof n)return i;return-1}function kr(n){var i,c,f=-1,d=-1,E;if(f=Ni(G.HTMLTableElement),d=Ni(G.HTMLTemplateElement),d>=0&&(f<0||d>f)?i=l.elements[d]:f>=0&&(i=l.elements[f].parentNode,i?c=l.elements[f]:i=l.elements[f-1]),i||(i=l.elements[0]),i instanceof G.HTMLTemplateElement&&(i=i.content),E=n(i.ownerDocument),E.nodeType===ai.TEXT_NODE){var A;if(c?A=c.previousSibling:A=i.lastChild,A&&A.nodeType===ai.TEXT_NODE)return A.appendData(E.data),E}return c?i.insertBefore(E,c):i._appendChild(E),E}function Jt(){for(var n=!1,i=l.elements.length-1;i>=0;i--){var c=l.elements[i];if(i===0&&(n=!0,dt&&(c=t)),c.namespaceURI===w.HTML){var f=c.localName;switch(f){case"select":for(var d=i;d>0;){var E=l.elements[--d];if(E instanceof G.HTMLTemplateElement)break;if(E instanceof G.HTMLTableElement){p=Gr;return}}p=ze;return;case"tr":p=rr;return;case"tbody":case"tfoot":case"thead":p=bt;return;case"caption":p=Ga;return;case"colgroup":p=jr;return;case"table":p=Ne;return;case"template":p=Ue[Ue.length-1];return;case"body":p=S;return;case"frameset":p=Wa;return;case"html":Nr===null?p=Ur:p=ja;return;default:if(!n){if(f==="head"){p=Z;return}if(f==="td"||f==="th"){p=Lt;return}}}}if(n){p=S;return}}}function Lr(n,i){D(n,i),u=er,Pe=p,p=Vr}function bc(n,i){D(n,i),u=at,Pe=p,p=Vr}function Ia(n,i){return{elt:Zt(n,L.list[i].localName,L.attrs[i]),attrs:L.attrs[i]}}function Ee(){if(L.list.length!==0){var n=L.list[L.list.length-1];if(n!==L.MARKER&&l.elements.lastIndexOf(n)===-1){for(var i=L.list.length-2;i>=0&&(n=L.list[i],!(n===L.MARKER||l.elements.lastIndexOf(n)!==-1));i--);for(i=i+1;i3&&De!==-1&&(L.remove(Y),De=-1),De===-1){l.removeElement(Y);continue}var ct=Ia(R.ownerDocument,De);L.replace(Y,ct.elt,ct.attrs),l.elements[we]=ct.elt,Y=ct.elt,ue===d&&(L.remove(Mr),L.insertAfter(ct.elt,Mr)),Y._appendChild(ue),ue=Y}rt&&z(R,Xt)?kr(function(){return ue}):R instanceof G.HTMLTemplateElement?R.content._appendChild(ue):R._appendChild(ue);for(var ar=Ia(d.ownerDocument,L.indexOf(c));d.hasChildNodes();)ar.elt._appendChild(d.firstChild);d._appendChild(ar.elt),L.remove(c),L.replace(Mr,ar.elt,ar.attrs),l.removeElement(c);var dl=l.elements.lastIndexOf(d);l.elements.splice(dl+1,0,ar.elt)}else return l.popElement(c),L.remove(c),!0}return!0}function _c(){l.pop(),p=Pe}function pt(){delete F._parser,l.elements.length=0,F.defaultView&&F.defaultView.dispatchEvent(new G.Event("load",{}))}function y(n,i){u=i,o--}function M(n){switch(n){case 38:be=M,u=tr;break;case 60:if(mc())break;u=vc;break;case 0:b.push(n),Je=!0;break;case-1:k();break;default:$t(Hx)||b.push(n);break}}function at(n){switch(n){case 38:be=at,u=tr;break;case 60:u=yc;break;case 0:b.push(65533),Je=!0;break;case-1:k();break;default:b.push(n);break}}function er(n){switch(n){case 60:u=Sc;break;case 0:b.push(65533);break;case-1:k();break;default:$t(mo)||b.push(n);break}}function nt(n){switch(n){case 60:u=Dc;break;case 0:b.push(65533);break;case-1:k();break;default:$t(mo)||b.push(n);break}}function Oa(n){switch(n){case 0:b.push(65533);break;case-1:k();break;default:$t(Fx)||b.push(n);break}}function vc(n){switch(n){case 33:u=Ci;break;case 47:u=Tc;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:dc(),y(n,wi);break;case 63:y(n,qr);break;default:b.push(60),y(n,M);break}}function Tc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,wi);break;case 62:u=M;break;case-1:b.push(60),b.push(47),k();break;default:y(n,qr);break}}function wi(n){switch(n){case 9:case 10:case 12:case 32:u=qe;break;case 47:u=st;break;case 62:u=M,Ge();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32);break;case 0:O+="\uFFFD";break;case-1:k();break;default:O+=Qt(Ix);break}}function yc(n){n===47?(je(),u=Nc):(b.push(60),y(n,at))}function Nc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,wc);break;default:b.push(60),b.push(47),y(n,at);break}}function wc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,at)}function Sc(n){n===47?(je(),u=Ac):(b.push(60),y(n,er))}function Ac(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,Cc);break;default:b.push(60),b.push(47),y(n,er);break}}function Cc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,er)}function Dc(n){switch(n){case 47:je(),u=kc;break;case 33:u=Mc,b.push(60),b.push(33);break;default:b.push(60),y(n,nt);break}}function kc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,Lc);break;default:b.push(60),b.push(47),y(n,nt);break}}function Lc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,nt)}function Mc(n){n===45?(u=Rc,b.push(45)):y(n,nt)}function Rc(n){n===45?(u=Si,b.push(45)):y(n,nt)}function Oe(n){switch(n){case 45:u=Ic,b.push(45);break;case 60:u=qa;break;case 0:b.push(65533);break;case-1:k();break;default:b.push(n);break}}function Ic(n){switch(n){case 45:u=Si,b.push(45);break;case 60:u=qa;break;case 0:u=Oe,b.push(65533);break;case-1:k();break;default:u=Oe,b.push(n);break}}function Si(n){switch(n){case 45:b.push(45);break;case 60:u=qa;break;case 62:u=nt,b.push(62);break;case 0:u=Oe,b.push(65533);break;case-1:k();break;default:u=Oe,b.push(n);break}}function qa(n){switch(n){case 47:je(),u=Oc;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:je(),b.push(60),y(n,Hc);break;default:b.push(60),y(n,Oe);break}}function Oc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,qc);break;default:b.push(60),b.push(47),y(n,Oe);break}}function qc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,Oe)}function Hc(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:me(H)==="script"?u=it:u=Oe,b.push(n);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:H.push(n+32),b.push(n);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:H.push(n),b.push(n);break;default:y(n,Oe);break}}function it(n){switch(n){case 45:u=Fc,b.push(45);break;case 60:u=Ha,b.push(60);break;case 0:b.push(65533);break;case-1:k();break;default:b.push(n);break}}function Fc(n){switch(n){case 45:u=Bc,b.push(45);break;case 60:u=Ha,b.push(60);break;case 0:u=it,b.push(65533);break;case-1:k();break;default:u=it,b.push(n);break}}function Bc(n){switch(n){case 45:b.push(45);break;case 60:u=Ha,b.push(60);break;case 62:u=nt,b.push(62);break;case 0:u=it,b.push(65533);break;case-1:k();break;default:u=it,b.push(n);break}}function Ha(n){n===47?(je(),u=Pc,b.push(47)):y(n,it)}function Pc(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:me(H)==="script"?u=Oe:u=it,b.push(n);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:H.push(n+32),b.push(n);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:H.push(n),b.push(n);break;default:y(n,it);break}}function qe(n){switch(n){case 9:case 10:case 12:case 32:break;case 47:u=st;break;case 62:u=M,Ge();break;case-1:k();break;case 61:La(),ie+=String.fromCharCode(n),u=Fa;break;default:if(fc())break;La(),y(n,Fa);break}}function Fa(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:case-1:y(n,Uc);break;case 61:u=Ai;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:ie+=String.fromCharCode(n+32);break;case 0:ie+="\uFFFD";break;default:ie+=Qt(Ox);break}}function Uc(n){switch(n){case 9:case 10:case 12:case 32:break;case 47:et(ie),u=st;break;case 61:u=Ai;break;case 62:u=M,et(ie),Ge();break;case-1:et(ie),k();break;default:et(ie),La(),y(n,Fa);break}}function Ai(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:Ma(),u=Rr;break;case 39:Ma(),u=Ir;break;default:Ma(),y(n,Or);break}}function Rr(n){switch(n){case 34:et(ie,le),u=Ba;break;case 38:be=Rr,u=tr;break;case 0:le+="\uFFFD";break;case-1:k();break;case 10:le+=String.fromCharCode(n);break;default:le+=Qt(Lx);break}}function Ir(n){switch(n){case 39:et(ie,le),u=Ba;break;case 38:be=Ir,u=tr;break;case 0:le+="\uFFFD";break;case-1:k();break;case 10:le+=String.fromCharCode(n);break;default:le+=Qt(Mx);break}}function Or(n){switch(n){case 9:case 10:case 12:case 32:et(ie,le),u=qe;break;case 38:be=Or,u=tr;break;case 62:et(ie,le),u=M,Ge();break;case 0:le+="\uFFFD";break;case-1:o--,u=M;break;default:le+=Qt(Rx);break}}function Ba(n){switch(n){case 9:case 10:case 12:case 32:u=qe;break;case 47:u=st;break;case 62:u=M,Ge();break;case-1:k();break;default:y(n,qe);break}}function st(n){switch(n){case 62:u=M,gc(!0);break;case-1:k();break;default:y(n,qe);break}}function qr(n,i,c){var f=i.length;c?o+=f-1:o+=f;var d=i.substring(0,f-1);d=d.replace(/\u0000/g,"\uFFFD"),d=d.replace(/\u000D\u000A/g,` +`),d=d.replace(/\u000D/g,` +`),re(Fe,d),u=M}qr.lookahead=">";function Ci(n,i,c){if(i[0]==="-"&&i[1]==="-"){o+=2,yi(),u=Vc;return}i.toUpperCase()==="DOCTYPE"?(o+=7,u=Yc):i==="[CDATA["&&hc()?(o+=7,u=Va):u=qr}Ci.lookahead=7;function Vc(n){switch(yi(),n){case 45:u=jc;break;case 62:u=M,re(Fe,me(W));break;default:y(n,mt);break}}function jc(n){switch(n){case 45:u=Hr;break;case 62:u=M,re(Fe,me(W));break;case-1:re(Fe,me(W)),k();break;default:W.push(45),y(n,mt);break}}function mt(n){switch(n){case 60:W.push(n),u=Gc;break;case 45:u=Pa;break;case 0:W.push(65533);break;case-1:re(Fe,me(W)),k();break;default:W.push(n);break}}function Gc(n){switch(n){case 33:W.push(n),u=zc;break;case 60:W.push(n);break;default:y(n,mt);break}}function zc(n){n===45?u=Wc:y(n,mt)}function Wc(n){n===45?u=Xc:y(n,Pa)}function Xc(n){switch(n){case 62:case-1:y(n,Hr);break;default:y(n,Hr);break}}function Pa(n){switch(n){case 45:u=Hr;break;case-1:re(Fe,me(W)),k();break;default:W.push(45),y(n,mt);break}}function Hr(n){switch(n){case 62:u=M,re(Fe,me(W));break;case 33:u=Kc;break;case 45:W.push(45);break;case-1:re(Fe,me(W)),k();break;default:W.push(45),W.push(45),y(n,mt);break}}function Kc(n){switch(n){case 45:W.push(45),W.push(45),W.push(33),u=Pa;break;case 62:u=M,re(Fe,me(W));break;case-1:re(Fe,me(W)),k();break;default:W.push(45),W.push(45),W.push(33),y(n,mt);break}}function Yc(n){switch(n){case 9:case 10:case 12:case 32:u=Di;break;case-1:Dt(),P(),U(),k();break;default:y(n,Di);break}}function Di(n){switch(n){case 9:case 10:case 12:case 32:break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:Dt(),Qe.push(n+32),u=Ua;break;case 0:Dt(),Qe.push(65533),u=Ua;break;case 62:Dt(),P(),u=M,U();break;case-1:Dt(),P(),U(),k();break;default:Dt(),Qe.push(n),u=Ua;break}}function Ua(n){switch(n){case 9:case 10:case 12:case 32:u=ki;break;case 62:u=M,U();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:Qe.push(n+32);break;case 0:Qe.push(65533);break;case-1:P(),U(),k();break;default:Qe.push(n);break}}function ki(n,i,c){switch(n){case 9:case 10:case 12:case 32:o+=1;break;case 62:u=M,o+=1,U();break;case-1:P(),U(),k();break;default:i=i.toUpperCase(),i==="PUBLIC"?(o+=6,u=Qc):i==="SYSTEM"?(o+=6,u=Jc):(P(),u=ot);break}}ki.lookahead=6;function Qc(n){switch(n){case 9:case 10:case 12:case 32:u=$c;break;case 34:Cr(),u=Li;break;case 39:Cr(),u=Mi;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function $c(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:Cr(),u=Li;break;case 39:Cr(),u=Mi;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Li(n){switch(n){case 34:u=Ri;break;case 0:$e.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:$e.push(n);break}}function Mi(n){switch(n){case 39:u=Ri;break;case 0:$e.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:$e.push(n);break}}function Ri(n){switch(n){case 9:case 10:case 12:case 32:u=Zc;break;case 62:u=M,U();break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Zc(n){switch(n){case 9:case 10:case 12:case 32:break;case 62:u=M,U();break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Jc(n){switch(n){case 9:case 10:case 12:case 32:u=el;break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function el(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Fr(n){switch(n){case 34:u=Ii;break;case 0:Ze.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:Ze.push(n);break}}function Br(n){switch(n){case 39:u=Ii;break;case 0:Ze.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:Ze.push(n);break}}function Ii(n){switch(n){case 9:case 10:case 12:case 32:break;case 62:u=M,U();break;case-1:P(),U(),k();break;default:u=ot;break}}function ot(n){switch(n){case 62:u=M,U();break;case-1:U(),k();break;default:break}}function Va(n){switch(n){case 93:u=tl;break;case-1:k();break;case 0:Je=!0;default:$t(qx)||b.push(n);break}}function tl(n){n===93?u=rl:(b.push(93),y(n,Va))}function rl(n){switch(n){case 93:b.push(93);break;case 62:kt(),u=M;break;default:b.push(93),b.push(93),y(n,Va);break}}function tr(n){switch(je(),H.push(38),n){case 9:case 10:case 12:case 32:case 60:case 38:case-1:y(n,gt);break;case 35:H.push(n),u=al;break;default:y(n,Oi);break}}function Oi(n){po.lastIndex=o;var i=po.exec(a);if(!i)throw new Error("should never happen");var c=i[1];if(!c){u=gt;return}switch(o+=c.length,wt(H,Px(c)),be){case Rr:case Ir:case Or:if(c[c.length-1]!==";"&&/[=A-Za-z0-9]/.test(a[o])){u=gt;return}break;default:break}je();var f=Dx[c];typeof f=="number"?H.push(f):wt(H,f),u=gt}Oi.lookahead=-kx;function al(n){switch(X=0,n){case 120:case 88:H.push(n),u=nl;break;default:y(n,il);break}}function nl(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:y(n,sl);break;default:y(n,gt);break}}function il(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:y(n,ol);break;default:y(n,gt);break}}function sl(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:X*=16,X+=n-55;break;case 97:case 98:case 99:case 100:case 101:case 102:X*=16,X+=n-87;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:X*=16,X+=n-48;break;case 59:u=Pr;break;default:y(n,Pr);break}}function ol(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:X*=10,X+=n-48;break;case 59:u=Pr;break;default:y(n,Pr);break}}function Pr(n){X in ho?X=ho[X]:(X>1114111||X>=55296&&X<57344)&&(X=65533),je(),X<=65535?H.push(X):(X=X-65536,H.push(55296+(X>>10)),H.push(56320+(X&1023))),y(n,gt)}function gt(n){switch(be){case Rr:case Ir:case Or:le+=me(H);break;default:wt(b,H);break}y(n,be)}function cl(n,i,c,f){switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 4:F._appendChild(F.createComment(i));return;case 5:var d=i,E=c,A=f;F.appendChild(new Tx(F,d,E,A)),Da||d.toLowerCase()!=="html"||wx.test(E)||A&&A.toLowerCase()===Sx||A===void 0&&lo.test(E)?F._quirks=!0:(Ax.test(E)||A!==void 0&&lo.test(E))&&(F._limitedQuirks=!0),p=qi;return}F._quirks=!0,p=qi,p(n,i,c,f)}function qi(n,i,c,f){var d;switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 5:return;case 4:F._appendChild(F.createComment(i));return;case 2:if(i==="html"){d=Zt(F,i,c),l.push(d),F.appendChild(d),p=Ur;return}break;case 3:switch(i){case"html":case"head":case"body":case"br":break;default:return}}d=Zt(F,"html",null),l.push(d),F.appendChild(d),p=Ur,p(n,i,c,f)}function Ur(n,i,c,f){switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 5:return;case 4:Re(i);return;case 2:switch(i){case"html":S(n,i,c,f);return;case"head":var d=D(i,c);Nr=d,p=Z;return}break;case 3:switch(i){case"html":case"head":case"body":case"br":break;default:return}}Ur(pe,"head",null),p(n,i,c,f)}function Z(n,i,c,f){switch(n){case 1:var d=i.match(St);if(d&&(Ie(d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 4:Re(i);return;case 5:return;case 2:switch(i){case"html":S(n,i,c,f);return;case"meta":case"base":case"basefont":case"bgsound":case"link":D(i,c),l.pop();return;case"title":bc(i,c);return;case"noscript":if(!wr){D(i,c),p=Hi;return}case"noframes":case"style":Lr(i,c);return;case"script":Dr(function(E){var A=Zt(E,i,c);return A._parser_inserted=!0,A._force_async=!1,dt&&(A._already_started=!0),kt(),A}),u=nt,Pe=p,p=Vr;return;case"template":D(i,c),L.insertMarker(),$=!1,p=za,Ue.push(p);return;case"head":return}break;case 3:switch(i){case"head":l.pop(),p=ja;return;case"body":case"html":case"br":break;case"template":if(!l.contains("template"))return;l.generateImpliedEndTags(null,"thorough"),l.popTag("template"),L.clearToMarker(),Ue.pop(),Jt();return;default:return}break}Z(I,"head",null),p(n,i,c,f)}function Hi(n,i,c,f){switch(n){case 5:return;case 4:Z(n,i);return;case 1:var d=i.match(St);if(d&&(Z(n,d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 2:switch(i){case"html":S(n,i,c,f);return;case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"style":Z(n,i,c);return;case"head":case"noscript":return}break;case 3:switch(i){case"noscript":l.pop(),p=Z;return;case"br":break;default:return}break}Hi(I,"noscript",null),p(n,i,c,f)}function ja(n,i,c,f){switch(n){case 1:var d=i.match(St);if(d&&(Ie(d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 4:Re(i);return;case 5:return;case 2:switch(i){case"html":S(n,i,c,f);return;case"body":D(i,c),$=!1,p=S;return;case"frameset":D(i,c),p=Wa;return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":l.push(Nr),Z(pe,i,c),l.removeElement(Nr);return;case"head":return}break;case 3:switch(i){case"template":return Z(n,i,c,f);case"body":case"html":case"br":break;default:return}break}ja(pe,"body",null),$=!0,p(n,i,c,f)}function S(n,i,c,f){var d,E,A,R;switch(n){case 1:if(Je&&(i=i.replace(_a,""),i.length===0))return;$&&Ea.test(i)&&($=!1),Ee(),Ie(i);return;case 5:return;case 4:Re(i);return;case-1:if(Ue.length)return za(n);pt();return;case 2:switch(i){case"html":if(l.contains("template"))return;yo(c,l.elements[0]);return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":Z(pe,i,c);return;case"body":if(d=l.elements[1],!d||!(d instanceof G.HTMLBodyElement)||l.contains("template"))return;$=!1,yo(c,d);return;case"frameset":if(!$||(d=l.elements[1],!d||!(d instanceof G.HTMLBodyElement)))return;for(d.parentNode&&d.parentNode.removeChild(d);!(l.top instanceof G.HTMLHtmlElement);)l.pop();D(i,c),p=Wa;return;case"address":case"article":case"aside":case"blockquote":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"main":case"nav":case"ol":case"p":case"section":case"summary":case"ul":l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"menu":l.inButtonScope("p")&&S(I,"p"),z(l.top,"menuitem")&&l.pop(),D(i,c);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":l.inButtonScope("p")&&S(I,"p"),l.top instanceof G.HTMLHeadingElement&&l.pop(),D(i,c);return;case"pre":case"listing":l.inButtonScope("p")&&S(I,"p"),D(i,c),ht=!0,$=!1;return;case"form":if(Ve&&!l.contains("template"))return;l.inButtonScope("p")&&S(I,"p"),R=D(i,c),l.contains("template")||(Ve=R);return;case"li":for($=!1,E=l.elements.length-1;E>=0;E--){if(A=l.elements[E],A instanceof G.HTMLLIElement){S(I,"li");break}if(z(A,At)&&!z(A,si))break}l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"dd":case"dt":for($=!1,E=l.elements.length-1;E>=0;E--){if(A=l.elements[E],z(A,wo)){S(I,A.localName);break}if(z(A,At)&&!z(A,si))break}l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"plaintext":l.inButtonScope("p")&&S(I,"p"),D(i,c),u=Oa;return;case"button":l.inScope("button")?(S(I,"button"),p(n,i,c,f)):(Ee(),D(i,c),$=!1);return;case"a":var Y=L.findElementByTag("a");Y&&(S(I,i),L.remove(Y),l.removeElement(Y));case"b":case"big":case"code":case"em":case"font":case"i":case"s":case"small":case"strike":case"strong":case"tt":case"u":Ee(),L.push(D(i,c),c);return;case"nobr":Ee(),l.inScope(i)&&(S(I,i),Ee()),L.push(D(i,c),c);return;case"applet":case"marquee":case"object":Ee(),D(i,c),L.insertMarker(),$=!1;return;case"table":!F._quirks&&l.inButtonScope("p")&&S(I,"p"),D(i,c),$=!1,p=Ne;return;case"area":case"br":case"embed":case"img":case"keygen":case"wbr":Ee(),D(i,c),l.pop(),$=!1;return;case"input":Ee(),R=D(i,c),l.pop();var ue=R.getAttribute("type");(!ue||ue.toLowerCase()!=="hidden")&&($=!1);return;case"param":case"source":case"track":D(i,c),l.pop();return;case"hr":l.inButtonScope("p")&&S(I,"p"),z(l.top,"menuitem")&&l.pop(),D(i,c),l.pop(),$=!1;return;case"image":S(pe,"img",c,f);return;case"textarea":D(i,c),ht=!0,$=!1,u=at,Pe=p,p=Vr;return;case"xmp":l.inButtonScope("p")&&S(I,"p"),Ee(),$=!1,Lr(i,c);return;case"iframe":$=!1,Lr(i,c);return;case"noembed":Lr(i,c);return;case"select":Ee(),D(i,c),$=!1,p===Ne||p===Ga||p===bt||p===rr||p===Lt?p=Gr:p=ze;return;case"optgroup":case"option":l.top instanceof G.HTMLOptionElement&&S(I,"option"),Ee(),D(i,c);return;case"menuitem":z(l.top,"menuitem")&&l.pop(),Ee(),D(i,c);return;case"rb":case"rtc":l.inScope("ruby")&&l.generateImpliedEndTags(),D(i,c);return;case"rp":case"rt":l.inScope("ruby")&&l.generateImpliedEndTags("rtc"),D(i,c);return;case"math":Ee(),To(c),ii(c),Ra(i,c,w.MATHML),f&&l.pop();return;case"svg":Ee(),vo(c),ii(c),Ra(i,c,w.SVG),f&&l.pop();return;case"caption":case"col":case"colgroup":case"frame":case"head":case"tbody":case"td":case"tfoot":case"th":case"thead":case"tr":return}Ee(),D(i,c);return;case 3:switch(i){case"template":Z(I,i,c);return;case"body":if(!l.inScope("body"))return;p=Fi;return;case"html":if(!l.inScope("body"))return;p=Fi,p(n,i,c);return;case"address":case"article":case"aside":case"blockquote":case"button":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"listing":case"main":case"menu":case"nav":case"ol":case"pre":case"section":case"summary":case"ul":if(!l.inScope(i))return;l.generateImpliedEndTags(),l.popTag(i);return;case"form":if(l.contains("template")){if(!l.inScope("form"))return;l.generateImpliedEndTags(),l.popTag("form")}else{var we=Ve;if(Ve=null,!we||!l.elementInScope(we))return;l.generateImpliedEndTags(),l.removeElement(we)}return;case"p":l.inButtonScope(i)?(l.generateImpliedEndTags(i),l.popTag(i)):(S(pe,i,null),p(n,i,c,f));return;case"li":if(!l.inListItemScope(i))return;l.generateImpliedEndTags(i),l.popTag(i);return;case"dd":case"dt":if(!l.inScope(i))return;l.generateImpliedEndTags(i),l.popTag(i);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":if(!l.elementTypeInScope(G.HTMLHeadingElement))return;l.generateImpliedEndTags(),l.popElementType(G.HTMLHeadingElement);return;case"sarcasm":break;case"a":case"b":case"big":case"code":case"em":case"font":case"i":case"nobr":case"s":case"small":case"strike":case"strong":case"tt":case"u":var De=Ec(i);if(De)return;break;case"applet":case"marquee":case"object":if(!l.inScope(i))return;l.generateImpliedEndTags(),l.popTag(i),L.clearToMarker();return;case"br":S(pe,i,null);return}for(E=l.elements.length-1;E>=0;E--)if(A=l.elements[E],z(A,i)){l.generateImpliedEndTags(i),l.popElement(A);break}else if(z(A,At))return;return}}function Vr(n,i,c,f){switch(n){case 1:Ie(i);return;case-1:l.top instanceof G.HTMLScriptElement&&(l.top._already_started=!0),l.pop(),p=Pe,p(n);return;case 3:i==="script"?_c():(l.pop(),p=Pe);return;default:return}}function Ne(n,i,c,f){function d(A){for(var R=0,Y=A.length;R0&&Ie(i);return;case 4:Re(i);return;case 5:return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"frameset":D(i,c);return;case"frame":D(i,c),l.pop();return;case"noframes":Z(n,i,c,f);return}break;case 3:if(i==="frameset"){if(dt&&l.top instanceof G.HTMLHtmlElement)return;l.pop(),!dt&&!(l.top instanceof G.HTMLFrameSetElement)&&(p=ul);return}break}}function ul(n,i,c,f){switch(n){case 1:i=i.replace(ni,""),i.length>0&&Ie(i);return;case 4:Re(i);return;case 5:return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"noframes":Z(n,i,c,f);return}break;case 3:if(i==="html"){p=fl;return}break}}function xl(n,i,c,f){switch(n){case 1:if(Ea.test(i))break;S(n,i,c,f);return;case 4:F._appendChild(F.createComment(i));return;case 5:S(n,i,c,f);return;case-1:pt();return;case 2:if(i==="html"){S(n,i,c,f);return}break}p=S,p(n,i,c,f)}function fl(n,i,c,f){switch(n){case 1:i=i.replace(ni,""),i.length>0&&S(n,i,c,f);return;case 4:F._appendChild(F.createComment(i));return;case 5:S(n,i,c,f);return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"noframes":Z(n,i,c,f);return}break}}function Bi(n,i,c,f){function d(Y){for(var ue=0,we=Y.length;ue0&&d[d.length-1][0]==="Character"?d[d.length-1][1]+=R:d.push(["Character",R]);break;case 4:d.push(["Comment",R]);break;case 5:d.push(["DOCTYPE",R,Y===void 0?null:Y,ue===void 0?null:ue,!Da]);break;case 2:for(var we=Object.create(null),De=0;De{"use strict";qo.exports=Oo;var Ro=pa(),Io=ga(),Vx=Na(),wa=ee(),jx=Zr();function Oo(e){this.contextObject=e}var Gx={xml:{"":!0,"1.0":!0,"2.0":!0},core:{"":!0,"2.0":!0},html:{"":!0,"1.0":!0,"2.0":!0},xhtml:{"":!0,"1.0":!0,"2.0":!0}};Oo.prototype={hasFeature:function(t,r){var a=Gx[(t||"").toLowerCase()];return a&&a[r||""]||!1},createDocumentType:function(t,r,a){return jx.isValidQName(t)||wa.InvalidCharacterError(),new Io(this.contextObject,t,r,a)},createDocument:function(t,r,a){var s=new Ro(!1,null),o;return r?o=s.createElementNS(t,r):o=null,a&&s.appendChild(a),o&&s.appendChild(o),t===wa.NAMESPACE.HTML?s._contentType="application/xhtml+xml":t===wa.NAMESPACE.SVG?s._contentType="image/svg+xml":s._contentType="application/xml",s},createHTMLDocument:function(t){var r=new Ro(!0,null);r.appendChild(new Io(r,"html"));var a=r.createElement("html");r.appendChild(a);var s=r.createElement("head");if(a.appendChild(s),t!==void 0){var o=r.createElement("title");s.appendChild(o),o.appendChild(r.createTextNode(t))}return a.appendChild(r.createElement("body")),r.modclock=1,r},mozSetOutputMutationHandler:function(e,t){e.mutationHandler=t},mozGetInputMutationHandler:function(e){wa.nyi()},mozHTMLParser:Vx}});var Fo=N((md,Ho)=>{"use strict";var zx=ca(),Wx=Yn();Ho.exports=li;function li(e,t){this._window=e,this._href=t}li.prototype=Object.create(Wx.prototype,{constructor:{value:li},href:{get:function(){return this._href},set:function(e){this.assign(e)}},assign:{value:function(e){var t=new zx(this._href),r=t.resolve(e);this._href=r}},replace:{value:function(e){this.assign(e)}},reload:{value:function(){this.assign(this.href)}},toString:{value:function(){return this.href}}})});var Po=N((gd,Bo)=>{"use strict";var Xx=Object.create(null,{appCodeName:{value:"Mozilla"},appName:{value:"Netscape"},appVersion:{value:"4.0"},platform:{value:""},product:{value:"Gecko"},productSub:{value:"20100101"},userAgent:{value:""},vendor:{value:""},vendorSub:{value:""},taintEnabled:{value:function(){return!1}}});Bo.exports=Xx});var Vo=N((bd,Uo)=>{"use strict";var Kx={setTimeout,clearTimeout,setInterval,clearInterval};Uo.exports=Kx});var xi=N((vr,jo)=>{"use strict";var ui=ee();vr=jo.exports={CSSStyleDeclaration:la(),CharacterData:xr(),Comment:On(),DOMException:Xr(),DOMImplementation:_r(),DOMTokenList:bn(),Document:pa(),DocumentFragment:Hn(),DocumentType:ga(),Element:Bt(),HTMLParser:Na(),NamedNodeMap:Nn(),Node:xe(),NodeList:yt(),NodeFilter:pr(),ProcessingInstruction:Bn(),Text:Rn(),Window:fi()};ui.merge(vr,Kn());ui.merge(vr,fa().elements);ui.merge(vr,ei().elements)});var fi=N((Ed,Go)=>{"use strict";var Yx=_r(),Qx=Ja(),$x=Fo(),Tr=ee();Go.exports=Sa;function Sa(e){this.document=e||new Yx(null).createHTMLDocument(""),this.document._scripting_enabled=!0,this.document.defaultView=this,this.location=new $x(this,this.document._address||"about:blank")}Sa.prototype=Object.create(Qx.prototype,{console:{value:console},history:{value:{back:Tr.nyi,forward:Tr.nyi,go:Tr.nyi}},navigator:{value:Po()},window:{get:function(){return this}},self:{get:function(){return this}},frames:{get:function(){return this}},parent:{get:function(){return this}},top:{get:function(){return this}},length:{value:0},frameElement:{value:null},opener:{value:null},onload:{get:function(){return this._getEventHandler("load")},set:function(e){this._setEventHandler("load",e)}},getComputedStyle:{value:function(t){return t.style}}});Tr.expose(Vo(),Sa);Tr.expose(xi(),Sa)});var Ko=N(Ct=>{"use strict";var zo=_r(),Wo=Na(),_d=fi(),Xo=xi();Ct.createDOMImplementation=function(){return new zo(null)};Ct.createDocument=function(e,t){if(e||t){var r=new Wo;return r.parse(e||"",!0),r.document()}return new zo(null).createHTMLDocument("")};Ct.createIncrementalHTMLParser=function(){var e=new Wo;return{write:function(t){t.length>0&&e.parse(t,!1,function(){return!0})},end:function(t){e.parse(t||"",!0,function(){return!0})},process:function(t){return e.parse("",!1,t)},document:function(){return e.document()}}};Ct.createWindow=function(e,t){var r=Ct.createDocument(e);return t!==void 0&&(r._address=t),new Xo.Window(r)};Ct.impl=Xo});var uc=N((Td,lc)=>{"use strict";function Zx(e){for(var t=1;t0&&e[t-1]===` +`;)t--;return e.substring(0,t)}function Jo(e){return Zo($o(e))}var Jx=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function gi(e){return bi(e,Jx)}var ec=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function tc(e){return bi(e,ec)}function ef(e){return ac(e,ec)}var rc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function tf(e){return bi(e,rc)}function rf(e){return ac(e,rc)}function bi(e,t){return t.indexOf(e.nodeName)>=0}function ac(e,t){return e.getElementsByTagName&&t.some(function(r){return e.getElementsByTagName(r).length})}var af=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function nc(e){return af.reduce(function(t,r){return t.replace(r[0],r[1])},e)}var ge={};ge.paragraph={filter:"p",replacement:function(e){return` + +`+e+` + +`}};ge.lineBreak={filter:"br",replacement:function(e,t,r){return r.br+` +`}};ge.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var a=Number(t.nodeName.charAt(1));if(r.headingStyle==="setext"&&a<3){var s=mi(a===1?"=":"-",e.length);return` + +`+e+` +`+s+` + +`}else return` + +`+mi("#",a)+" "+e+` + +`}};ge.blockquote={filter:"blockquote",replacement:function(e){return e=Jo(e).replace(/^/gm,"> "),` + +`+e+` + +`}};ge.list={filter:["ul","ol"],replacement:function(e,t){var r=t.parentNode;return r.nodeName==="LI"&&r.lastElementChild===t?` +`+e:` + +`+e+` + +`}};ge.listItem={filter:"li",replacement:function(e,t,r){var a=r.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var o=s.getAttribute("start"),x=Array.prototype.indexOf.call(s.children,t);a=(o?Number(o)+x:x+1)+". "}var m=/\n$/.test(e);return e=Jo(e)+(m?` +`:""),e=e.replace(/\n/gm,` +`+" ".repeat(a.length)),a+e+(t.nextSibling?` +`:"")}};ge.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){return` + + `+t.firstChild.textContent.replace(/\n/g,` + `)+` + +`}};ge.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){for(var a=t.firstChild.getAttribute("class")||"",s=(a.match(/language-(\S+)/)||[null,""])[1],o=t.firstChild.textContent,x=r.fence.charAt(0),m=3,h=new RegExp("^"+x+"{3,}","gm"),g;g=h.exec(o);)g[0].length>=m&&(m=g[0].length+1);var v=mi(x,m);return` + +`+v+s+` +`+o.replace(/\n$/,"")+` +`+v+` + +`}};ge.horizontalRule={filter:"hr",replacement:function(e,t,r){return` + +`+r.hr+` + +`}};ge.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var r=Ei(t.getAttribute("href")),a=_i(Aa(t.getAttribute("title"))),s=a?' "'+a+'"':"";return"["+e+"]("+r+s+")"}};ge.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,r){var a=Ei(t.getAttribute("href")),s=Aa(t.getAttribute("title"));s&&(s=' "'+_i(s)+'"');var o,x;switch(r.linkReferenceStyle){case"collapsed":o="["+e+"][]",x="["+e+"]: "+a+s;break;case"shortcut":o="["+e+"]",x="["+e+"]: "+a+s;break;default:var m=this.references.length+1;o="["+e+"]["+m+"]",x="["+m+"]: "+a+s}return this.references.push(x),o},references:[],append:function(e){var t="";return this.references.length&&(t=` + +`+this.references.join(` +`)+` + +`,this.references=[]),t}};ge.emphasis={filter:["em","i"],replacement:function(e,t,r){return e.trim()?r.emDelimiter+e+r.emDelimiter:""}};ge.strong={filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}};ge.code={filter:function(e){var t=e.previousSibling||e.nextSibling,r=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!r},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",r="`",a=e.match(/`+/gm)||[];a.indexOf(r)!==-1;)r=r+"`";return r+t+e+t+r}};ge.image={filter:"img",replacement:function(e,t){var r=nc(Aa(t.getAttribute("alt"))),a=Ei(t.getAttribute("src")||""),s=Aa(t.getAttribute("title")),o=s?' "'+_i(s)+'"':"";return a?"!["+r+"]("+a+o+")":""}};function Aa(e){return e?e.replace(/(\n+\s*)+/g,` +`):""}function Ei(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function _i(e){return e.replace(/"/g,'\\"')}function ic(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}ic.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=di(this.array,e,this.options))||(t=di(this._keep,e,this.options))||(t=di(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t-1)return!0}else if(typeof a=="function"){if(a.call(e,t,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function sf(e){var t=e.element,r=e.isBlock,a=e.isVoid,s=e.isPre||function(ne){return ne.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var o=null,x=!1,m=null,h=Yo(m,t,s);h!==t;){if(h.nodeType===3||h.nodeType===4){var g=h.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!x&&g[0]===" "&&(g=g.substr(1)),!g){h=hi(h);continue}h.data=g,o=h}else if(h.nodeType===1)r(h)||h.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,x=!1):a(h)||s(h)?(o=null,x=!0):o&&(x=!1);else{h=hi(h);continue}var v=Yo(m,h,s);m=h,h=v}o&&(o.data=o.data.replace(/ $/,""),o.data||hi(o))}}function hi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Yo(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var sc=typeof window<"u"?window:{};function of(){var e=sc.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function cf(){var e=function(){};{var t=Ko();e.prototype.parseFromString=function(r){return t.createDocument(r)}}return e}var lf=of()?sc.DOMParser:cf();function uf(e,t){var r;if(typeof e=="string"){var a=xf().parseFromString(''+e+"","text/html");r=a.getElementById("turndown-root")}else r=e.cloneNode(!0);return sf({element:r,isBlock:gi,isVoid:tc,isPre:t.preformattedCode?ff:null}),r}var pi;function xf(){return pi=pi||new lf,pi}function ff(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function df(e,t){return e.isBlock=gi(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=hf(e),e.flankingWhitespace=pf(e,t),e}function hf(e){return!tc(e)&&!tf(e)&&/^\s*$/i.test(e.textContent)&&!ef(e)&&!rf(e)}function pf(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var r=mf(e.textContent);return r.leadingAscii&&Qo("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&Qo("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function mf(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Qo(e,t,r){var a,s,o;return e==="left"?(a=t.previousSibling,s=/ $/):(a=t.nextSibling,s=/^ /),a&&(a.nodeType===3?o=s.test(a.nodeValue):r.preformattedCode&&a.nodeName==="CODE"?o=!1:a.nodeType===1&&!gi(a)&&(o=s.test(a.textContent))),o}var gf=Array.prototype.reduce;function Ca(e){if(!(this instanceof Ca))return new Ca(e);var t={rules:ge,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(r,a){return a.isBlock?` + +`:""},keepReplacement:function(r,a){return a.isBlock?` + +`+a.outerHTML+` + +`:a.outerHTML},defaultReplacement:function(r,a){return a.isBlock?` + +`+r+` + +`:r}};this.options=Zx({},t,e),this.rules=new ic(this.options)}Ca.prototype={turndown:function(e){if(!_f(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=oc.call(this,new uf(e,this.options));return bf.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t quoted text"," - Horizontal rules (hr) \u2192 ---"],options:["-b, --bullet=CHAR bullet character for unordered lists (-, +, or *)","-c, --code=FENCE fence style for code blocks (``` or ~~~)","-r, --hr=STRING string for horizontal rules (default: ---)"," --heading-style=STYLE"," heading style: 'atx' for # headings (default),"," 'setext' for underlined headings (h1/h2 only)"," --help display this help and exit"],examples:["echo '

Hello

World

' | html-to-markdown","html-to-markdown page.html","curl -s https://example.com | html-to-markdown > page.md"]},wd={name:"html-to-markdown",async execute(e,t){if(Vi(e))return Ui(vf);let r="-",a="```",s="---",o="atx",x=[];for(let h=0;h0&&a[a.length-1]===""&&a.pop();let x=p.filter(e=>e==="-").length,f=[],h=0;for(let e of p)if(e==="-"){let t=[];for(let o=h;o0&&r[r.length-1]===""&&r.pop(),f.push(r)}catch{return{stdout:"",stderr:`paste: ${e}: No such file or directory -`,exitCode:1}}}let u="";if(d)for(let e of f)e&&(u+=`${y(e,l)} -`);else{let e=Math.max(...f.map(t=>t?.length??0));for(let t=0;t=0&&c.length>e&&(c=c.slice(0,e));let n=Math.abs(l);return n>c.length&&(l<0?c=c.padEnd(n," "):c=c.padStart(n," ")),c}function h(t,l){let e=l,c=0,n=-1,a=!1;for(e0&&(c=-c),[c,n,e-l]}function r(t){let l="",e=0;for(;e0){try{let s=new TextDecoder("utf-8",{fatal:!0});l+=s.decode(new Uint8Array(n))}catch{for(let s of n)l+=String.fromCharCode(s)}e=a}else l+=t[e],e++;break}case"u":{let n="",a=e+2;for(;a{var{hasOwnProperty:nn}=Object.prototype,rn=(s,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r +`:` +`,n=e.whitespace?" = ":"=",i=[],r=e.sort?Object.keys(s).sort():Object.keys(s),o=0;e.align&&(o=z(r.filter(c=>s[c]===null||Array.isArray(s[c])||typeof s[c]!="object").map(c=>Array.isArray(s[c])?`${c}[]`:c).concat([""]).reduce((c,u)=>z(c).length>=z(u).length?c:u)).length);let a="",l=e.bracketedArray?"[]":"";for(let c of r){let u=s[c];if(u&&Array.isArray(u))for(let f of u)a+=z(`${c}${l}`).padEnd(o," ")+n+z(f)+t;else u&&typeof u=="object"?i.push(c):a+=z(c).padEnd(o," ")+n+z(u)+t}e.section&&a.length&&(a="["+z(e.section)+"]"+(e.newline?t+t:t)+a);for(let c of i){let u=qr(c,".").join("\\."),f=(e.section?e.section+".":"")+u,h=rn(s[c],{...e,section:f});a.length&&h.length&&(a+=t),a+=h}return a};function qr(s,e){var t=0,n=0,i=0,r=[];do if(i=s.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&s[i-1]==="\\")continue;r.push(s.slice(n,i)),n=i+e.length}while(i!==-1);return r.push(s.slice(n)),r}var Lr=(s,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,r=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=s.split(/[\r\n]+/g),a={};for(let c of o){if(!c||c.match(/^\s*[;#]/)||c.match(/^\s*$/))continue;let u=c.match(r);if(!u)continue;if(u[1]!==void 0){if(i=Mt(u[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let f=Mt(u[2]),h;e.bracketedArray?h=f.length>2&&f.slice(-2)==="[]":(a[f]=(a?.[f]||0)+1,h=a[f]>1);let p=h&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=u[3]?Mt(u[4]):!0,d=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;h&&(nn.call(n,p)?Array.isArray(n[p])||(n[p]=[n[p]]):n[p]=[]),Array.isArray(n[p])?n[p].push(d):n[p]=d}let l=[];for(let c of Object.keys(t)){if(!nn.call(t,c)||typeof t[c]!="object"||Array.isArray(t[c]))continue;let u=qr(c,".");n=t;let f=u.pop(),h=f.replace(/\\\./g,".");for(let p of u)p!=="__proto__"&&((!nn.call(n,p)||typeof n[p]!="object")&&(n[p]=Object.create(null)),n=n[p]);n===t&&h===f||(n[h]=t[c],l.push(c))}for(let c of l)delete t[c];return t},Pr=s=>s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"),z=s=>typeof s!="string"||s.match(/[=\r\n]/)||s.match(/^\[/)||s.length>1&&Pr(s)||s!==s.trim()?JSON.stringify(s):s.split(";").join("\\;").split("#").join("\\#"),Mt=s=>{if(s=(s||"").trim(),Pr(s)){s.charAt(0)==="'"&&(s=s.slice(1,-1));try{s=JSON.parse(s)}catch{}}else{let e=!1,t="";for(let n=0,i=s.length;n{"use strict";var un=Symbol.for("yaml.alias"),Ur=Symbol.for("yaml.document"),jt=Symbol.for("yaml.map"),Kr=Symbol.for("yaml.pair"),fn=Symbol.for("yaml.scalar"),Ut=Symbol.for("yaml.seq"),Q=Symbol.for("yaml.node.type"),zc=s=>!!s&&typeof s=="object"&&s[Q]===un,Qc=s=>!!s&&typeof s=="object"&&s[Q]===Ur,Zc=s=>!!s&&typeof s=="object"&&s[Q]===jt,eu=s=>!!s&&typeof s=="object"&&s[Q]===Kr,Yr=s=>!!s&&typeof s=="object"&&s[Q]===fn,tu=s=>!!s&&typeof s=="object"&&s[Q]===Ut;function Dr(s){if(s&&typeof s=="object")switch(s[Q]){case jt:case Ut:return!0}return!1}function su(s){if(s&&typeof s=="object")switch(s[Q]){case un:case jt:case fn:case Ut:return!0}return!1}var nu=s=>(Yr(s)||Dr(s))&&!!s.anchor;x.ALIAS=un;x.DOC=Ur;x.MAP=jt;x.NODE_TYPE=Q;x.PAIR=Kr;x.SCALAR=fn;x.SEQ=Ut;x.hasAnchor=nu;x.isAlias=zc;x.isCollection=Dr;x.isDocument=Qc;x.isMap=Zc;x.isNode=su;x.isPair=eu;x.isScalar=Yr;x.isSeq=tu});var He=w(hn=>{"use strict";var _=C(),V=Symbol("break visit"),Jr=Symbol("skip children"),H=Symbol("remove node");function Kt(s,e){let t=Gr(e);_.isDocument(s)?ke(null,s.contents,t,Object.freeze([s]))===H&&(s.contents=null):ke(null,s,t,Object.freeze([]))}Kt.BREAK=V;Kt.SKIP=Jr;Kt.REMOVE=H;function ke(s,e,t,n){let i=Wr(s,e,t,n);if(_.isNode(i)||_.isPair(i))return Hr(s,n,i),ke(s,i,t,n);if(typeof i!="symbol"){if(_.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r{"use strict";var Xr=C(),iu=He(),ru={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ou=s=>s.replace(/[!,[\]{}]/g,e=>ru[e]),Xe=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ou(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&Xr.isNode(e.contents)){let r={};iu.visit(e.contents,(o,a)=>{Xr.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(` +`)}};Xe.defaultYaml={explicit:!1,version:"1.2"};Xe.defaultTags={"!!":"tag:yaml.org,2002:"};zr.Directives=Xe});var Dt=w(ze=>{"use strict";var Qr=C(),au=He();function lu(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Zr(s){let e=new Set;return au.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function eo(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function cu(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=Zr(s));let o=eo(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(Qr.isScalar(o.node)||Qr.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}ze.anchorIsValid=lu;ze.anchorNames=Zr;ze.createNodeAnchors=cu;ze.findNewAnchor=eo});var pn=w(to=>{"use strict";function Qe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i{"use strict";var uu=C();function so(s,e,t){if(Array.isArray(s))return s.map((n,i)=>so(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!uu.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}no.toJS=so});var Jt=w(ro=>{"use strict";var fu=pn(),io=C(),hu=se(),mn=class{constructor(e){Object.defineProperty(this,io.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!io.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=hu.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?fu.applyReviver(r,{"":a},"",a):a}};ro.NodeBase=mn});var Ze=w(oo=>{"use strict";var du=Dt(),pu=He(),Le=C(),mu=Jt(),gu=se(),gn=class extends mu.NodeBase{constructor(e){super(Le.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],pu.visit(e,{Node:(r,o)=>{(Le.isAlias(o)||Le.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(gu.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Gt(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(du.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function Gt(s,e,t){if(Le.isAlias(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(Le.isCollection(e)){let n=0;for(let i of e.items){let r=Gt(s,i,t);r>n&&(n=r)}return n}else if(Le.isPair(e)){let n=Gt(s,e.key,t),i=Gt(s,e.value,t);return Math.max(n,i)}return 1}oo.Alias=gn});var L=w(yn=>{"use strict";var yu=C(),bu=Jt(),wu=se(),Su=s=>!s||typeof s!="function"&&typeof s!="object",ne=class extends bu.NodeBase{constructor(e){super(yu.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:wu.toJS(this.value,e,t)}toString(){return String(this.value)}};ne.BLOCK_FOLDED="BLOCK_FOLDED";ne.BLOCK_LITERAL="BLOCK_LITERAL";ne.PLAIN="PLAIN";ne.QUOTE_DOUBLE="QUOTE_DOUBLE";ne.QUOTE_SINGLE="QUOTE_SINGLE";yn.Scalar=ne;yn.isScalarValue=Su});var et=w(lo=>{"use strict";var Nu=Ze(),me=C(),ao=L(),Au="tag:yaml.org,2002:";function Eu(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function vu(s,e,t){if(me.isDocument(s)&&(s=s.contents),me.isNode(s))return s;if(me.isPair(s)){let f=t.schema[me.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new Nu.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=Au+e.slice(2));let c=Eu(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new ao.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?o[me.MAP]:Symbol.iterator in Object(s)?o[me.SEQ]:o[me.MAP]}r&&(r(c),delete t.onTagObj);let u=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new ao.Scalar(s);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}lo.createNode=vu});var Ht=w(Wt=>{"use strict";var Tu=et(),X=C(),Cu=Jt();function bn(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Tu.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var co=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,wn=class extends Cu.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>X.isNode(n)||X.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(co(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(X.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,bn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(X.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&X.isScalar(r)?r.value:r:X.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!X.isPair(t))return!1;let n=t.value;return n==null||e&&X.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return X.isCollection(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(X.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,bn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Wt.Collection=wn;Wt.collectionFromPath=bn;Wt.isEmptyPath=co});var tt=w(Xt=>{"use strict";var Ou=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Sn(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var ku=(s,e,t)=>s.endsWith(` +`)?Sn(t,e):t.includes(` +`)?` +`+Sn(t,e):(s.endsWith(" ")?"":" ")+t;Xt.indentComment=Sn;Xt.lineComment=ku;Xt.stringifyComment=Ou});var fo=w(st=>{"use strict";var Iu="flow",Nn="block",zt="quoted";function Lu(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;ii-Math.max(2,r)?c.push(0):f=i-n);let h,p,g=!1,d=-1,m=-1,b=-1;t===Nn&&(d=uo(s,d,e.length),d!==-1&&(f=d+l));for(let A;A=s[d+=1];){if(t===zt&&A==="\\"){switch(m=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}b=d}if(A===` +`)t===Nn&&(d=uo(s,d,e.length)),f=d+e.length+l,h=void 0;else{if(A===" "&&p&&p!==" "&&p!==` +`&&p!==" "){let v=s[d+1];v&&v!==" "&&v!==` +`&&v!==" "&&(h=d)}if(d>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===zt){for(;p===" "||p===" ";)p=A,A=s[d+=1],g=!0;let v=d>b+1?d-2:m-1;if(u[v])return s;c.push(v),u[v]=!0,f=v+l,h=void 0}else g=!0}p=A}if(g&&a&&a(),c.length===0)return s;o&&o();let y=s.slice(0,c[0]);for(let A=0;A{"use strict";var J=L(),ie=fo(),Zt=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),es=s=>/^(%|---|\.\.\.)/m.test(s);function qu(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;rn)return!0;if(o=r+1,i-o<=n)return!1}return!0}function nt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(es(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length +`;let f,h;for(h=t.length;h>0;--h){let E=t[h-1];if(E!==` +`&&E!==" "&&E!==" ")break}let p=t.substring(h),g=p.indexOf(` +`);g===-1?f="-":t===p||g!==p.length-1?(f="+",r&&r()):f="",p&&(t=t.slice(0,-p.length),p[p.length-1]===` +`&&(p=p.slice(0,-1)),p=p.replace(En,`$&${c}`));let d=!1,m,b=-1;for(m=0;m{N=!0});let S=ie.foldFlowLines(`${y}${E}${p}`,c,ie.FOLD_BLOCK,O);if(!N)return`>${v} +${c}${S}`}return t=t.replace(/\n+/g,`$&${c}`),`|${v} +${c}${y}${t}${p}`}function Pu(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&r.includes(` +`)||u&&/[[\]{},]/.test(r))return qe(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||u||!r.includes(` +`)?qe(r,e):Qt(s,e,t,n);if(!a&&!u&&i!==J.Scalar.PLAIN&&r.includes(` +`))return Qt(s,e,t,n);if(es(r)){if(l==="")return e.forceBlockIndent=!0,Qt(s,e,t,n);if(a&&l===c)return qe(r,e)}let f=r.replace(/\n+/g,`$& +${l}`);if(o){let h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(h)||p?.some(h))return qe(r,e)}return a?f:ie.foldFlowLines(f,l,ie.FOLD_FLOW,Zt(e,!1))}function _u(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==J.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=J.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case J.Scalar.BLOCK_FOLDED:case J.Scalar.BLOCK_LITERAL:return i||r?qe(o.value,e):Qt(o,e,t,n);case J.Scalar.QUOTE_DOUBLE:return nt(o.value,e);case J.Scalar.QUOTE_SINGLE:return An(o.value,e);case J.Scalar.PLAIN:return Pu(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}ho.stringifyString=_u});var rt=w(vn=>{"use strict";var xu=Dt(),re=C(),Mu=tt(),$u=it();function Ru(s,e){let t=Object.assign({blockQuote:!0,commentString:Mu.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Fu(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(re.isScalar(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function Bu(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(re.isScalar(s)||re.isCollection(s))&&s.anchor;r&&xu.anchorIsValid(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function Vu(s,e,t,n){if(re.isPair(s))return s.toString(e,t,n);if(re.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=re.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>i=l});i??(i=Fu(e.doc.schema.tags,r));let o=Bu(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,t,n):re.isScalar(r)?$u.stringifyString(r,e,t,n):r.toString(e,t,n);return o?re.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} +${e.indent}${a}`:a}vn.createStringifyContext=Ru;vn.stringify=Vu});var yo=w(go=>{"use strict";var Z=C(),po=L(),mo=rt(),ot=tt();function ju({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,h=Z.isNode(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Z.isCollection(s)||!Z.isNode(s)&&typeof s=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!f&&(!s||h&&e==null&&!t.inFlow||Z.isCollection(s)||(Z.isScalar(s)?s.type===po.Scalar.BLOCK_FOLDED||s.type===po.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:a+l});let g=!1,d=!1,m=mo.stringify(s,t,()=>g=!0,()=>d=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,h&&!g?m+=ot.lineComment(m,t.indent,c(h)):d&&i&&i(),m;g&&(h=null),p?(h&&(m+=ot.lineComment(m,t.indent,c(h))),m=`? ${m} +${a}:`):(m=`${m}:`,h&&(m+=ot.lineComment(m,t.indent,c(h))));let b,y,A;Z.isNode(e)?(b=!!e.spaceBefore,y=e.commentBefore,A=e.comment):(b=!1,y=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&Z.isScalar(e)&&(t.indentAtStart=m.length+1),d=!1,!u&&l.length>=2&&!t.inFlow&&!p&&Z.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let v=!1,E=mo.stringify(e,t,()=>v=!0,()=>d=!0),N=" ";if(h||b||y){if(N=b?` +`:"",y){let O=c(y);N+=` +${ot.indentComment(O,t.indent)}`}E===""&&!t.inFlow?N===` +`&&A&&(N=` + +`):N+=` +${t.indent}`}else if(!p&&Z.isCollection(e)){let O=E[0],S=E.indexOf(` +`),q=S!==-1,ee=t.inFlow??e.flow??e.items.length===0;if(q||!ee){let Ne=!1;if(q&&(O==="&"||O==="!")){let P=E.indexOf(" ");O==="&"&&P!==-1&&P{"use strict";var bo=Ot("process");function Uu(s,...e){s==="debug"&&console.log(...e)}function Ku(s,e){(s==="debug"||s==="warn")&&(typeof bo.emitWarning=="function"?bo.emitWarning(e):console.warn(e))}Tn.debug=Uu;Tn.warn=Ku});var is=w(ns=>{"use strict";var at=C(),wo=L(),ts="<<",ss={identify:s=>s===ts||typeof s=="symbol"&&s.description===ts,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new wo.Scalar(Symbol(ts)),{addToJSMap:So}),stringify:()=>ts},Yu=(s,e)=>(ss.identify(e)||at.isScalar(e)&&(!e.type||e.type===wo.Scalar.PLAIN)&&ss.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===ss.tag&&t.default);function So(s,e,t){if(t=s&&at.isAlias(t)?t.resolve(s.doc):t,at.isSeq(t))for(let n of t.items)On(s,e,n);else if(Array.isArray(t))for(let n of t)On(s,e,n);else On(s,e,t)}function On(s,e,t){let n=s&&at.isAlias(t)?t.resolve(s.doc):t;if(!at.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}ns.addMergeToJSMap=So;ns.isMergeKey=Yu;ns.merge=ss});var In=w(Eo=>{"use strict";var Du=Cn(),No=is(),Ju=rt(),Ao=C(),kn=se();function Gu(s,e,{key:t,value:n}){if(Ao.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(No.isMergeKey(s,t))No.addMergeToJSMap(s,e,n);else{let i=kn.toJS(t,"",s);if(e instanceof Map)e.set(i,kn.toJS(n,i,s));else if(e instanceof Set)e.add(i);else{let r=Wu(t,i,s),o=kn.toJS(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Wu(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Ao.isNode(s)&&t?.doc){let n=Ju.createStringifyContext(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Du.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}Eo.addPairToJSMap=Gu});var oe=w(Ln=>{"use strict";var vo=et(),Hu=yo(),Xu=In(),rs=C();function zu(s,e,t){let n=vo.createNode(s,void 0,t),i=vo.createNode(e,void 0,t);return new os(n,i)}var os=class s{constructor(e,t=null){Object.defineProperty(this,rs.NODE_TYPE,{value:rs.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return rs.isNode(t)&&(t=t.clone(e)),rs.isNode(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return Xu.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?Hu.stringifyPair(this,e,t,n):JSON.stringify(this)}};Ln.Pair=os;Ln.createPair=zu});var qn=w(Co=>{"use strict";var ge=C(),To=rt(),as=tt();function Qu(s,e,t){return(e.inFlow??s.flow?ef:Zu)(s,e,t)}function Zu({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,h=[];for(let g=0;gm=null,()=>f=!0);m&&(b+=as.lineComment(b,r,c(m))),f&&m&&(f=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let g=1;gm=null);c||(c=f.length>u||b.includes(` +`)),g0&&(c||(c=f.reduce((y,A)=>y+A.length+2,2)+(b.length+2)>e.options.lineWidth)),c&&(b+=",")),m&&(b+=as.lineComment(b,n,a(m))),f.push(b),u=f.length}let{start:h,end:p}=t;if(f.length===0)return h+p;if(!c){let g=f.reduce((d,m)=>d+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=h;for(let d of f)g+=d?` +${r}${i}${d}`:` +`;return`${g} +${i}${p}`}else return`${h}${o}${f.join(" ")}${o}${p}`}function ls({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let r=as.indentComment(e(n),s);t.push(r.trimStart())}}Co.stringifyCollection=Qu});var le=w(_n=>{"use strict";var tf=qn(),sf=In(),nf=Ht(),ae=C(),cs=oe(),rf=L();function lt(s,e){let t=ae.isScalar(e)?e.value:e;for(let n of s)if(ae.isPair(n)&&(n.key===e||n.key===t||ae.isScalar(n.key)&&n.key.value===t))return n}var Pn=class extends nf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ae.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:r}=n,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(cs.createPair(l,c,n))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;ae.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new cs.Pair(e,e?.value):n=new cs.Pair(e.key,e.value);let i=lt(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);ae.isScalar(i.value)&&rf.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=lt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=lt(this.items,e)?.value;return(!t&&ae.isScalar(i)?i.value:i)??void 0}has(e){return!!lt(this.items,e)}set(e,t){this.add(new cs.Pair(e,t),!0)}toJSON(e,t,n){let i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)sf.addPairToJSMap(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ae.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),tf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};_n.YAMLMap=Pn;_n.findPair=lt});var Pe=w(ko=>{"use strict";var of=C(),Oo=le(),af={collection:"map",default:!0,nodeClass:Oo.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return of.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Oo.YAMLMap.from(s,e,t)};ko.map=af});var ce=w(Io=>{"use strict";var lf=et(),cf=qn(),uf=Ht(),fs=C(),ff=L(),hf=se(),xn=class extends uf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(fs.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=us(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=us(e);if(typeof n!="number")return;let i=this.items[n];return!t&&fs.isScalar(i)?i.value:i}has(e){let t=us(e);return typeof t=="number"&&t=0?e:null}Io.YAMLSeq=xn});var _e=w(qo=>{"use strict";var df=C(),Lo=ce(),pf={collection:"seq",default:!0,nodeClass:Lo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return df.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Lo.YAMLSeq.from(s,e,t)};qo.seq=pf});var ct=w(Po=>{"use strict";var mf=it(),gf={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),mf.stringifyString(s,e,t,n)}};Po.string=gf});var hs=w(Mo=>{"use strict";var _o=L(),xo={identify:s=>s==null,createNode:()=>new _o.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new _o.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&xo.test.test(s)?s:e.options.nullStr};Mo.nullTag=xo});var Mn=w(Ro=>{"use strict";var yf=L(),$o={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new yf.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&$o.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};Ro.boolTag=$o});var xe=w(Fo=>{"use strict";function bf({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}Fo.stringifyNumber=bf});var Rn=w(ds=>{"use strict";var wf=L(),$n=xe(),Sf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:$n.stringifyNumber},Nf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():$n.stringifyNumber(s)}},Af={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new wf.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:$n.stringifyNumber};ds.float=Af;ds.floatExp=Nf;ds.floatNaN=Sf});var Bn=w(ms=>{"use strict";var Bo=xe(),ps=s=>typeof s=="bigint"||Number.isInteger(s),Fn=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Vo(s,e,t){let{value:n}=s;return ps(n)&&n>=0?t+n.toString(e):Bo.stringifyNumber(s)}var Ef={identify:s=>ps(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Fn(s,2,8,t),stringify:s=>Vo(s,8,"0o")},vf={identify:ps,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Fn(s,0,10,t),stringify:Bo.stringifyNumber},Tf={identify:s=>ps(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Fn(s,2,16,t),stringify:s=>Vo(s,16,"0x")};ms.int=vf;ms.intHex=Tf;ms.intOct=Ef});var Uo=w(jo=>{"use strict";var Cf=Pe(),Of=hs(),kf=_e(),If=ct(),Lf=Mn(),Vn=Rn(),jn=Bn(),qf=[Cf.map,kf.seq,If.string,Of.nullTag,Lf.boolTag,jn.intOct,jn.int,jn.intHex,Vn.floatNaN,Vn.floatExp,Vn.float];jo.schema=qf});var Do=w(Yo=>{"use strict";var Pf=L(),_f=Pe(),xf=_e();function Ko(s){return typeof s=="bigint"||Number.isInteger(s)}var gs=({value:s})=>JSON.stringify(s),Mf=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:gs},{identify:s=>s==null,createNode:()=>new Pf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:gs},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:gs},{identify:Ko,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Ko(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:gs}],$f={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Rf=[_f.map,xf.seq].concat(Mf,$f);Yo.schema=Rf});var Kn=w(Jo=>{"use strict";var ut=Ot("buffer"),Un=L(),Ff=it(),Bf={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof ut.Buffer=="function")return ut.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i{"use strict";var ys=C(),Yn=oe(),Vf=L(),jf=ce();function Go(s,e){if(ys.isSeq(s))for(let t=0;t1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Yn.Pair(new Vf.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value??i.key;r.comment=r.comment?`${n.comment} +${r.comment}`:n.comment}n=i}s.items[t]=ys.isPair(n)?n:new Yn.Pair(n)}}else e("Expected a sequence for this tag");return s}function Wo(s,e,t){let{replacer:n}=t,i=new jf.YAMLSeq(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Yn.createPair(a,l,t))}return i}var Uf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Go,createNode:Wo};bs.createPairs=Wo;bs.pairs=Uf;bs.resolvePairs=Go});var Gn=w(Jn=>{"use strict";var Ho=C(),Dn=se(),ft=le(),Kf=ce(),Xo=ws(),ye=class s extends Kf.YAMLSeq{constructor(){super(),this.add=ft.YAMLMap.prototype.add.bind(this),this.delete=ft.YAMLMap.prototype.delete.bind(this),this.get=ft.YAMLMap.prototype.get.bind(this),this.has=ft.YAMLMap.prototype.has.bind(this),this.set=ft.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(Ho.isPair(i)?(r=Dn.toJS(i.key,"",t),o=Dn.toJS(i.value,r,t)):r=Dn.toJS(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){let i=Xo.createPairs(e,t,n),r=new this;return r.items=i.items,r}};ye.tag="tag:yaml.org,2002:omap";var Yf={collection:"seq",identify:s=>s instanceof Map,nodeClass:ye,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=Xo.resolvePairs(s,e),n=[];for(let{key:i}of t.items)Ho.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ye,t)},createNode:(s,e,t)=>ye.from(s,e,t)};Jn.YAMLOMap=ye;Jn.omap=Yf});var ta=w(Wn=>{"use strict";var zo=L();function Qo({value:s,source:e},t){return e&&(s?Zo:ea).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Zo={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new zo.Scalar(!0),stringify:Qo},ea={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new zo.Scalar(!1),stringify:Qo};Wn.falseTag=ea;Wn.trueTag=Zo});var sa=w(Ss=>{"use strict";var Df=L(),Hn=xe(),Jf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Hn.stringifyNumber},Gf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():Hn.stringifyNumber(s)}},Wf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new Df.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Hn.stringifyNumber};Ss.float=Wf;Ss.floatExp=Gf;Ss.floatNaN=Jf});var ia=w(dt=>{"use strict";var na=xe(),ht=s=>typeof s=="bigint"||Number.isInteger(s);function Ns(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function Xn(s,e,t){let{value:n}=s;if(ht(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return na.stringifyNumber(s)}var Hf={identify:ht,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ns(s,2,2,t),stringify:s=>Xn(s,2,"0b")},Xf={identify:ht,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ns(s,1,8,t),stringify:s=>Xn(s,8,"0")},zf={identify:ht,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ns(s,0,10,t),stringify:na.stringifyNumber},Qf={identify:ht,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ns(s,2,16,t),stringify:s=>Xn(s,16,"0x")};dt.int=zf;dt.intBin=Hf;dt.intHex=Qf;dt.intOct=Xf});var Qn=w(zn=>{"use strict";var vs=C(),As=oe(),Es=le(),be=class s extends Es.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;vs.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new As.Pair(e.key,null):t=new As.Pair(e,null),Es.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=Es.findPair(this.items,e);return!t&&vs.isPair(n)?vs.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Es.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new As.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(As.createPair(o,null,n));return r}};be.tag="tag:yaml.org,2002:set";var Zf={collection:"map",identify:s=>s instanceof Set,nodeClass:be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>be.from(s,e,t),resolve(s,e){if(vs.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new be,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};zn.YAMLSet=be;zn.set=Zf});var ei=w(Ts=>{"use strict";var eh=xe();function Zn(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function ra(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return eh.stringifyNumber(s);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var th={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Zn(s,t),stringify:ra},sh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Zn(s,!1),stringify:ra},oa={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(oa.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=Zn(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ts.floatTime=sh;Ts.intTime=th;Ts.timestamp=oa});var ca=w(la=>{"use strict";var nh=Pe(),ih=hs(),rh=_e(),oh=ct(),ah=Kn(),aa=ta(),ti=sa(),Cs=ia(),lh=is(),ch=Gn(),uh=ws(),fh=Qn(),si=ei(),hh=[nh.map,rh.seq,oh.string,ih.nullTag,aa.trueTag,aa.falseTag,Cs.intBin,Cs.intOct,Cs.int,Cs.intHex,ti.floatNaN,ti.floatExp,ti.float,ah.binary,lh.merge,ch.omap,uh.pairs,fh.set,si.intTime,si.floatTime,si.timestamp];la.schema=hh});var wa=w(ri=>{"use strict";var da=Pe(),dh=hs(),pa=_e(),ph=ct(),mh=Mn(),ni=Rn(),ii=Bn(),gh=Uo(),yh=Do(),ma=Kn(),pt=is(),ga=Gn(),ya=ws(),ua=ca(),ba=Qn(),Os=ei(),fa=new Map([["core",gh.schema],["failsafe",[da.map,pa.seq,ph.string]],["json",yh.schema],["yaml11",ua.schema],["yaml-1.1",ua.schema]]),ha={binary:ma.binary,bool:mh.boolTag,float:ni.float,floatExp:ni.floatExp,floatNaN:ni.floatNaN,floatTime:Os.floatTime,int:ii.int,intHex:ii.intHex,intOct:ii.intOct,intTime:Os.intTime,map:da.map,merge:pt.merge,null:dh.nullTag,omap:ga.omap,pairs:ya.pairs,seq:pa.seq,set:ba.set,timestamp:Os.timestamp},bh={"tag:yaml.org,2002:binary":ma.binary,"tag:yaml.org,2002:merge":pt.merge,"tag:yaml.org,2002:omap":ga.omap,"tag:yaml.org,2002:pairs":ya.pairs,"tag:yaml.org,2002:set":ba.set,"tag:yaml.org,2002:timestamp":Os.timestamp};function wh(s,e,t){let n=fa.get(e);if(n&&!s)return t&&!n.includes(pt.merge)?n.concat(pt.merge):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(fa.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(pt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?ha[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(ha).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}ri.coreKnownTags=bh;ri.getTags=wh});var li=w(Sa=>{"use strict";var oi=C(),Sh=Pe(),Nh=_e(),Ah=ct(),ks=wa(),Eh=(s,e)=>s.keye.key?1:0,ai=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ks.getTags(e,"compat"):e?ks.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?ks.coreKnownTags:{},this.tags=ks.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,oi.MAP,{value:Sh.map}),Object.defineProperty(this,oi.SCALAR,{value:Ah.string}),Object.defineProperty(this,oi.SEQ,{value:Nh.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Eh:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Sa.Schema=ai});var Aa=w(Na=>{"use strict";var vh=C(),ci=rt(),mt=tt();function Th(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let i=ci.createStringifyContext(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=r(s.commentBefore);t.unshift(mt.indentComment(l,""))}let o=!1,a=null;if(s.contents){if(vh.isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let u=r(s.contents.commentBefore);t.push(mt.indentComment(u,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>o=!0,c=ci.stringify(s.contents,i,()=>a=null,l);a&&(c+=mt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(ci.stringify(s.contents,i));if(s.directives?.docEnd)if(s.comment){let l=r(s.comment);l.includes(` +`)?(t.push("..."),t.push(mt.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(mt.indentComment(r(l),"")))}return t.join(` +`)+` +`}Na.stringifyDocument=Th});var gt=w(Ea=>{"use strict";var Ch=Ze(),Me=Ht(),Y=C(),Oh=oe(),kh=se(),Ih=li(),Lh=Aa(),ui=Dt(),qh=pn(),Ph=et(),fi=dn(),hi=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Y.NODE_TYPE,{value:Y.DOC});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new fi.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(s.prototype,{[Y.NODE_TYPE]:{value:Y.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Y.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){$e(this.contents)&&this.contents.add(e)}addIn(e,t){$e(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=ui.anchorNames(this);e.anchor=!t||n.has(t)?ui.findNewAnchor(t||"a",n):t}return new Ch.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=y=>typeof y=="number"||y instanceof String||y instanceof Number,b=t.filter(m).map(String);b.length>0&&(t=t.concat(b)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=ui.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=Ph.createNode(e,u,g);return a&&Y.isCollection(d)&&(d.flow=!0),h(),d}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new Oh.Pair(i,r)}delete(e){return $e(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Me.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):$e(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Y.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Me.isEmptyPath(e)?!t&&Y.isScalar(this.contents)?this.contents.value:this.contents:Y.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Y.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Me.isEmptyPath(e)?this.contents!==void 0:Y.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Me.collectionFromPath(this.schema,[e],t):$e(this.contents)&&this.contents.set(e,t)}setIn(e,t){Me.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Me.collectionFromPath(this.schema,Array.from(e),t):$e(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fi.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new fi.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ih.Schema(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=kh.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?qh.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Lh.stringifyDocument(this,e)}};function $e(s){if(Y.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Ea.Document=hi});var wt=w(bt=>{"use strict";var yt=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},di=class extends yt{constructor(e,t,n){super("YAMLParseError",e,t,n)}},pi=class extends yt{constructor(e,t,n){super("YAMLWarning",e,t,n)}},_h=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===n&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`: + +${o} +${c} +`}};bt.YAMLError=yt;bt.YAMLParseError=di;bt.YAMLWarning=pi;bt.prettifyError=_h});var St=w(va=>{"use strict";function xh(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",h="",p=!1,g=!1,d=null,m=null,b=null,y=null,A=null,v=null,E=null;for(let S of s)switch(g&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&r(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),d&&(c&&S.type!=="comment"&&S.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),S.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&S.source.includes(" ")&&(d=S),u=!0;break;case"comment":{u||r(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=S.source.substring(1)||" ";f?f+=h+q:f=q,h="",c=!1;break}case"newline":c?f?f+=S.source:(!v||t!=="seq-item-ind")&&(l=!0):h+=S.source,c=!0,p=!0,(m||b)&&(y=S),u=!0;break;case"anchor":m&&r(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&r(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=S,E??(E=S.offset),c=!1,u=!1,g=!0;break;case"tag":{b&&r(S,"MULTIPLE_TAGS","A node can have at most one tag"),b=S,E??(E=S.offset),c=!1,u=!1,g=!0;break}case t:(m||b)&&r(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),v&&r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e??"collection"}`),v=S,c=t==="seq-item-ind"||t==="explicit-key-ind",u=!1;break;case"comma":if(e){A&&r(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=S,c=!1,u=!1;break}default:r(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),c=!1,u=!1}let N=s[s.length-1],O=N?N.offset+N.source.length:i;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:A,found:v,spaceBefore:l,comment:f,hasNewline:p,anchor:m,tag:b,newlineAfterProp:y,end:O,start:E??O}}va.resolveProps=xh});var Is=w(Ta=>{"use strict";function mi(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(` +`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(mi(e.key)||mi(e.value))return!0}return!1;default:return!0}}Ta.containsNewline=mi});var gi=w(Ca=>{"use strict";var Mh=Is();function $h(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Mh.containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ca.flowIndentCheck=$h});var yi=w(ka=>{"use strict";var Oa=C();function Rh(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||Oa.isScalar(r)&&Oa.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}ka.mapIncludes=Rh});var xa=w(_a=>{"use strict";var Ia=oe(),Fh=le(),La=St(),Bh=Is(),qa=gi(),Vh=yi(),Pa="All mapping items must start at the same column";function jh({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??Fh.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(let u of n.items){let{start:f,key:h,sep:p,value:g}=u,d=La.resolveProps(f,{indicator:"explicit-key-ind",next:h??p?.[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!d.found;if(m){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==n.indent&&i(l,"BAD_INDENT",Pa)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=` +`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||Bh.containsNewline(h))&&i(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==n.indent&&i(l,"BAD_INDENT",Pa);t.atKey=!0;let b=d.end,y=h?s(t,h,d,i):e(t,b,f,null,d,i);t.schema.compat&&qa.flowIndentCheck(n.indent,h,i),t.atKey=!1,Vh.mapIncludes(t,a.items,y)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let A=La.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:n.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=A.end,A.found){m&&(g?.type==="block-map"&&!A.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start{"use strict";var Uh=ce(),Kh=St(),Yh=gi();function Dh({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??Uh.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,c=null;for(let{start:u,value:f}of n.items){let h=Kh.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)f?.type==="block-seq"?i(h.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}let p=f?s(t,f,h,i):e(t,h.end,u,null,h,i);t.schema.compat&&Yh.flowIndentCheck(n.indent,f,i),l=p.range[2],a.items.push(p)}return a.range=[n.offset,l,c??l],a}Ma.resolveBlockSeq=Dh});var Re=w(Ra=>{"use strict";function Jh(s,e,t,n){let i="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}Ra.resolveEnd=Jh});var ja=w(Va=>{"use strict";var Gh=C(),Wh=oe(),Fa=le(),Hh=ce(),Xh=Re(),Ba=St(),zh=Is(),Qh=yi(),bi="Block collections are not allowed within flow collections",wi=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Zh({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=n.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Fa.YAMLMap:Hh.YAMLSeq),c=new l(t.schema);c.flow=!0;let u=t.atRoot;u&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=n.offset+n.start.source.length;for(let m=0;m0){let m=Xh.resolveEnd(g,d,t.options.strict,i);m.comment&&(c.comment?c.comment+=` +`+m.comment:c.comment=m.comment),c.range=[n.offset,d,m.offset]}else c.range=[n.offset,d,d];return c}Va.resolveFlowCollection=Zh});var Ka=w(Ua=>{"use strict";var ed=C(),td=L(),sd=le(),nd=ce(),id=xa(),rd=$a(),od=ja();function Si(s,e,t,n,i,r){let o=t.type==="block-map"?id.resolveBlockMap(s,e,t,n,r):t.type==="block-seq"?rd.resolveBlockSeq(s,e,t,n,r):od.resolveFlowCollection(s,e,t,n,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function ad(s,e,t,n,i){let r=n.tag,o=r?e.directives.tagName(r.source,h=>i(r,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){let{anchor:h,newlineAfterProp:p}=n,g=h&&r?h.offset>r.offset?h:r:h??r;g&&(!p||p.offseth.tag===o&&h.collection===a);if(!l){let h=e.schema.knownTags[o];if(h?.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Si(s,e,t,i,o)}let c=Si(s,e,t,i,o,l),u=l.resolve?.(c,h=>i(r,"TAG_RESOLVE_FAILED",h),e.options)??c,f=ed.isNode(u)?u:new td.Scalar(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}Ua.composeCollection=ad});var Ai=w(Ya=>{"use strict";var Ni=L();function ld(s,e,t){let n=e.offset,i=cd(e,s.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?Ni.Scalar.BLOCK_FOLDED:Ni.Scalar.BLOCK_LITERAL,o=e.source?ud(e.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let m=o[d][1];if(m===""||m==="\r")a=d;else break}if(a===0){let d=i.chomp==="+"&&o.length>0?` +`.repeat(Math.max(1,o.length-1)):"",m=n+i.length;return e.source&&(m+=e.source.length),{value:d,type:r,comment:i.comment,range:[n,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,u=0;for(let d=0;dl&&(l=m.length);else{m.length=a;--d)o[d][0].length>l&&(a=d+1);let f="",h="",p=!1;for(let d=0;dl||b[0]===" "?(h===" "?h=` +`:!p&&h===` +`&&(h=` + +`),f+=h+m.slice(l)+b,h=` +`,p=!0):b===""?h===` +`?f+=` +`:h=` +`:(f+=h+b,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let d=a;d{"use strict";var Ei=L(),fd=Re();function hd(s,e,t){let{offset:n,type:i,source:r,end:o}=s,a,l,c=(h,p,g)=>t(n+h,p,g);switch(i){case"scalar":a=Ei.Scalar.PLAIN,l=dd(r,c);break;case"single-quoted-scalar":a=Ei.Scalar.QUOTE_SINGLE,l=pd(r,c);break;case"double-quoted-scalar":a=Ei.Scalar.QUOTE_DOUBLE,l=md(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=fd.resolveEnd(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function dd(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Da(s)}function pd(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Da(s.slice(1,-1)).replace(/''/g,"'")}function Da(s){let e,t;try{e=new RegExp(`(.*?)(?r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function gd(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===` +`||n==="\r")&&!(n==="\r"&&s[e+2]!==` +`);)n===` +`&&(t+=` +`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var yd={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` +`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function bd(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Ja.resolveFlowScalar=hd});var Ha=w(Wa=>{"use strict";var we=C(),Ga=L(),wd=Ai(),Sd=vi();function Nd(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?wd.resolveBlockScalar(s,e,n):Sd.resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[we.SCALAR]:l?c=Ad(s.schema,i,l,t,n):e.type==="scalar"?c=Ed(s,i,e,n):c=s.schema[we.SCALAR];let u;try{let f=c.resolve(i,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);u=we.isScalar(f)?f:new Ga.Scalar(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(t??e,"TAG_RESOLVE_FAILED",h),u=new Ga.Scalar(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function Ad(s,e,t,n,i){if(t==="!")return s[we.SCALAR];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[we.SCALAR])}function Ed({atKey:s,directives:e,schema:t},n,i,r){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[we.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[we.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}Wa.composeScalar=Nd});var za=w(Xa=>{"use strict";function vd(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}Xa.emptyScalarPosition=vd});var el=w(Ci=>{"use strict";var Td=Ze(),Cd=C(),Od=Ka(),Qa=Ha(),kd=Re(),Id=za(),Ld={composeNode:Za,composeEmptyNode:Ti};function Za(s,e,t,n){let i=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,u=!0;switch(e.type){case"alias":c=qd(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Qa.composeScalar(s,e,l,n),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Od.composeCollection(Ld,s,e,t,n),a&&(c.anchor=a.source.substring(1))}catch(f){let h=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",h)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=Ti(s,e.offset,void 0,null,t,n)),a&&c.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!Cd.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&u&&(c.srcToken=e),c}function Ti(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:Id.emptyScalarPosition(e,t,n),indent:-1,source:""},f=Qa.composeScalar(s,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function qd({options:s},{offset:e,source:t,end:n},i){let r=new Td.Alias(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=kd.resolveEnd(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Ci.composeEmptyNode=Ti;Ci.composeNode=Za});var nl=w(sl=>{"use strict";var Pd=gt(),tl=el(),_d=Re(),xd=St();function Md(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({_directives:e},s),l=new Pd.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=xd.resolveProps(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?tl.composeNode(c,i,u,o):tl.composeEmptyNode(c,u.end,n,null,u,o);let f=l.contents.range[2],h=_d.resolveEnd(r,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,f,h.offset],l}sl.composeDoc=Md});var ki=w(ol=>{"use strict";var $d=Ot("process"),Rd=dn(),Fd=gt(),Nt=wt(),il=C(),Bd=nl(),Vd=Re();function At(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function rl(s){let e="",t=!1,n=!1;for(let i=0;i{let o=At(t);r?this.warnings.push(new Nt.YAMLWarning(o,n,i)):this.errors.push(new Nt.YAMLParseError(o,n,i))},this.directives=new Rd.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=rl(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(il.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];il.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n} +${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n} +${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:rl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch($d.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=At(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Bd.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nt.YAMLParseError(At(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nt.YAMLParseError(At(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Vd.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Nt.YAMLParseError(At(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Fd.Document(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};ol.Composer=Oi});var cl=w(Ls=>{"use strict";var jd=Ai(),Ud=vi(),Kd=wt(),al=it();function Yd(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new Kd.YAMLParseError([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ud.resolveFlowScalar(s,e,n);case"block-scalar":return jd.resolveBlockScalar({options:{strict:e}},s,n)}}return null}function Dd(s,e){let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=al.stringifyString({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:` +`}];switch(a[0]){case"|":case">":{let c=a.indexOf(` +`),u=a.substring(0,c),f=a.substring(c+1)+` +`,h=[{type:"block-scalar-header",offset:r,indent:n,source:u}];return ll(h,l)||h.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:r,indent:n,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:n,source:a,end:l};default:return{type:"scalar",offset:r,indent:n,source:a,end:l}}}function Jd(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=al.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Gd(s,l);break;case'"':Ii(s,l,"double-quoted-scalar");break;case"'":Ii(s,l,"single-quoted-scalar");break;default:Ii(s,l,"scalar")}}function Gd(s,e){let t=e.indexOf(` +`),n=e.substring(0,t),i=e.substring(t+1)+` +`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];ll(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` +`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function ll(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Ii(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:` +`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}Ls.createScalarToken=Dd;Ls.resolveAsScalar=Yd;Ls.setScalarValue=Jd});var fl=w(ul=>{"use strict";var Wd=s=>"type"in s?Ps(s):qs(s);function Ps(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Ps(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=qs(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=qs(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=qs(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function qs({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=Ps(e)),t)for(let r of t)i+=r.source;return n&&(i+=Ps(n)),i}ul.stringify=Wd});var ml=w(pl=>{"use strict";var Li=Symbol("break visit"),Hd=Symbol("skip children"),hl=Symbol("remove item");function Se(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),dl(Object.freeze([]),s,e)}Se.BREAK=Li;Se.SKIP=Hd;Se.REMOVE=hl;Se.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t?.[n];if(r&&"items"in r)t=r.items[i];else return}return t};Se.parentCollection=(s,e)=>{let t=Se.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function dl(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o{"use strict";var qi=cl(),Xd=fl(),zd=ml(),Pi="\uFEFF",_i="",xi="",Mi="",Qd=s=>!!s&&"items"in s,Zd=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function ep(s){switch(s){case Pi:return"";case _i:return"";case xi:return"";case Mi:return"";default:return JSON.stringify(s)}}function tp(s){switch(s){case Pi:return"byte-order-mark";case _i:return"doc-mode";case xi:return"flow-error-end";case Mi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`:case`\r +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}j.createScalarToken=qi.createScalarToken;j.resolveAsScalar=qi.resolveAsScalar;j.setScalarValue=qi.setScalarValue;j.stringify=Xd.stringify;j.visit=zd.visit;j.BOM=Pi;j.DOCUMENT=_i;j.FLOW_END=xi;j.SCALAR=Mi;j.isCollection=Qd;j.isScalar=Zd;j.prettyToken=ep;j.tokenType=tp});var Fi=w(yl=>{"use strict";var Et=_s();function G(s){switch(s){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var gl=new Set("0123456789ABCDEFabcdef"),sp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xs=new Set(",[]{}"),np=new Set(` ,[]{} +\r `),$i=s=>!s||np.has(s),Ri=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` +`?!0:t==="\r"?this.buffer[e+1]===` +`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let i=this.buffer[n+e+1];if(i===` +`||!i&&!this.atEnd)return e+n+1}return t===` +`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil($i),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>G(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case" ":t+=1;break;case` +`:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` +`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(` +`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` +`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===` +`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield Et.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(G(r)||e&&xs.has(r))break;t=n}else if(G(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===` +`?(n+=1,i=` +`,r=this.buffer[n+1]):t=n),r==="#"||e&&xs.has(r))break;if(i===` +`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&xs.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Et.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil($i))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(G(t)||e&&xs.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(sp.has(t))t=this.buffer[++e];else if(t==="%"&&gl.has(this.buffer[e+1])&&gl.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` +`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};yl.Lexer=Ri});var Vi=w(bl=>{"use strict";var Bi=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{"use strict";var ip=Ot("process"),wl=_s(),rp=Fi();function ue(s,e){for(let t=0;t=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Nl(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!ue(e.start,"explicit-key-ind")&&!ue(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Al(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var ji=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new rp.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,ip.env.LOG_TOKENS&&console.log("|",wl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=wl.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Nl(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Sl(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ue(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Al(t.key)&&!ue(t.sep,"newline")){let o=Fe(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(ue(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Fe(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):ue(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ue(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ue(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Ms(n),r=Fe(i);Nl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` +`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` +`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Ms(e),n=Fe(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Ms(e),n=Fe(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};El.Parser=ji});var kl=w(Tt=>{"use strict";var vl=ki(),op=gt(),vt=wt(),ap=Cn(),lp=C(),cp=Vi(),Tl=Ui();function Cl(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new cp.LineCounter||null,prettyErrors:e}}function up(s,e={}){let{lineCounter:t,prettyErrors:n}=Cl(e),i=new Tl.Parser(t?.addNewLine),r=new vl.Composer(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(vt.prettifyError(s,t)),a.warnings.forEach(vt.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Ol(s,e={}){let{lineCounter:t,prettyErrors:n}=Cl(e),i=new Tl.Parser(t?.addNewLine),r=new vl.Composer(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new vt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(vt.prettifyError(s,t)),o.warnings.forEach(vt.prettifyError(s,t))),o}function fp(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=Ol(s,t);if(!i)return null;if(i.warnings.forEach(r=>ap.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function hp(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return lp.isDocument(s)&&!n?s.toString(t):new op.Document(s,n,t).toString(t)}Tt.parse=fp;Tt.parseAllDocuments=up;Tt.parseDocument=Ol;Tt.stringify=hp});var Ll=w(k=>{"use strict";var dp=ki(),pp=gt(),mp=li(),Ki=wt(),gp=Ze(),fe=C(),yp=oe(),bp=L(),wp=le(),Sp=ce(),Np=_s(),Ap=Fi(),Ep=Vi(),vp=Ui(),$s=kl(),Il=He();k.Composer=dp.Composer;k.Document=pp.Document;k.Schema=mp.Schema;k.YAMLError=Ki.YAMLError;k.YAMLParseError=Ki.YAMLParseError;k.YAMLWarning=Ki.YAMLWarning;k.Alias=gp.Alias;k.isAlias=fe.isAlias;k.isCollection=fe.isCollection;k.isDocument=fe.isDocument;k.isMap=fe.isMap;k.isNode=fe.isNode;k.isPair=fe.isPair;k.isScalar=fe.isScalar;k.isSeq=fe.isSeq;k.Pair=yp.Pair;k.Scalar=bp.Scalar;k.YAMLMap=wp.YAMLMap;k.YAMLSeq=Sp.YAMLSeq;k.CST=Np;k.Lexer=Ap.Lexer;k.LineCounter=Ep.LineCounter;k.Parser=vp.Parser;k.parse=$s.parse;k.parseAllDocuments=$s.parseAllDocuments;k.parseDocument=$s.parseDocument;k.stringify=$s.stringify;k.visit=Il.visit;k.visitAsync=Il.visitAsync});var tr=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Rl=tr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Fl="["+tr+"]["+Rl+"]*",Bl=new RegExp("^"+Fl+"$");function kt(s,e){let t=[],n=e.exec(s);for(;n;){let i=[];i.startIndex=e.lastIndex-n[0].length;let r=n.length;for(let o=0;o"u")};function sr(s){return typeof s<"u"}var Ve=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],It=["__proto__","constructor","prototype"];var Vl={allowBooleanAttributes:!1,unpairedTags:[]};function ar(s,e){e=Object.assign({},Vl,e);let t=[],n=!1,i=!1;s[0]==="\uFEFF"&&(s=s.substr(1));for(let r=0;r"&&s[r]!==" "&&s[r]!==" "&&s[r]!==` +`&&s[r]!=="\r";r++)l+=s[r];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),r--),!Wl(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",I("InvalidTag",f,M(s,r))}let c=Kl(s,r);if(c===!1)return I("InvalidAttr","Attributes for '"+l+"' have open quote.",M(s,r));let u=c.value;if(r=c.index,u[u.length-1]==="/"){let f=r-u.length;u=u.substring(0,u.length-1);let h=or(u,e);if(h===!0)n=!0;else return I(h.err.code,h.err.msg,M(s,f+h.err.line))}else if(a)if(c.tagClosed){if(u.trim().length>0)return I("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",M(s,o));if(t.length===0)return I("InvalidTag","Closing tag '"+l+"' has not been opened.",M(s,o));{let f=t.pop();if(l!==f.tagName){let h=M(s,f.tagStartPos);return I("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+l+"'.",M(s,o))}t.length==0&&(i=!0)}}else return I("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",M(s,r));else{let f=or(u,e);if(f!==!0)return I(f.err.code,f.err.msg,M(s,r-u.length+f.err.line));if(i===!0)return I("InvalidXml","Multiple possible root nodes found.",M(s,r));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),n=!0}for(r++;r0)return I("InvalidXml","Invalid '"+JSON.stringify(t.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return I("InvalidXml","Start tag expected.",1);return!0}function nr(s){return s===" "||s===" "||s===` +`||s==="\r"}function ir(s,e){let t=e;for(;e5&&n==="xml")return I("InvalidXml","XML declaration allowed only at the start of the document.",M(s,e));if(s[e]=="?"&&s[e+1]==">"){e++;break}else continue}return e}function rr(s,e){if(s.length>e+5&&s[e+1]==="-"&&s[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(s.length>e+8&&s[e+1]==="D"&&s[e+2]==="O"&&s[e+3]==="C"&&s[e+4]==="T"&&s[e+5]==="Y"&&s[e+6]==="P"&&s[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(s.length>e+9&&s[e+1]==="["&&s[e+2]==="C"&&s[e+3]==="D"&&s[e+4]==="A"&&s[e+5]==="T"&&s[e+6]==="A"&&s[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}var jl='"',Ul="'";function Kl(s,e){let t="",n="",i=!1;for(;e"&&n===""){i=!0;break}t+=s[e]}return n!==""?!1:{value:t,index:e,tagClosed:i}}var Yl=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function or(s,e){let t=kt(s,Yl),n={};for(let i=0;i",GT:">",quot:'"',QUOT:'"',apos:"'",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",lsquor:"\u201A",rsquor:"\u2019",ldquor:"\u201E",bdquo:"\u201E",comma:",",period:".",colon:":",semi:";",excl:"!",quest:"?",num:"#",dollar:"$",percent:"%",amp:"&",ast:"*",commat:"@",lowbar:"_",verbar:"|",vert:"|",sol:"/",bsol:"\\",lbrace:"{",rbrace:"}",lbrack:"[",rbrack:"]",lpar:"(",rpar:")",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",COPY:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",REG:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",half:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",div:"\xF7",divide:"\xF7"},cr={Agrave:"\xC0",agrave:"\xE0",Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",Aring:"\xC5",aring:"\xE5",AElig:"\xC6",aelig:"\xE6",Ccedil:"\xC7",ccedil:"\xE7",Egrave:"\xC8",egrave:"\xE8",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Euml:"\xCB",euml:"\xEB",Igrave:"\xCC",igrave:"\xEC",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",Iuml:"\xCF",iuml:"\xEF",ETH:"\xD0",eth:"\xF0",Ntilde:"\xD1",ntilde:"\xF1",Ograve:"\xD2",ograve:"\xF2",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",Oslash:"\xD8",oslash:"\xF8",Ugrave:"\xD9",ugrave:"\xF9",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",THORN:"\xDE",thorn:"\xFE",szlig:"\xDF",yuml:"\xFF",Yuml:"\u0178"},ur={Amacr:"\u0100",amacr:"\u0101",Abreve:"\u0102",abreve:"\u0103",Aogon:"\u0104",aogon:"\u0105",Cacute:"\u0106",cacute:"\u0107",Ccirc:"\u0108",ccirc:"\u0109",Cdot:"\u010A",cdot:"\u010B",Ccaron:"\u010C",ccaron:"\u010D",Dcaron:"\u010E",dcaron:"\u010F",Dstrok:"\u0110",dstrok:"\u0111",Emacr:"\u0112",emacr:"\u0113",Ecaron:"\u011A",ecaron:"\u011B",Edot:"\u0116",edot:"\u0117",Eogon:"\u0118",eogon:"\u0119",Gcirc:"\u011C",gcirc:"\u011D",Gbreve:"\u011E",gbreve:"\u011F",Gdot:"\u0120",gdot:"\u0121",Gcedil:"\u0122",Hcirc:"\u0124",hcirc:"\u0125",Hstrok:"\u0126",hstrok:"\u0127",Itilde:"\u0128",itilde:"\u0129",Imacr:"\u012A",imacr:"\u012B",Iogon:"\u012E",iogon:"\u012F",Idot:"\u0130",IJlig:"\u0132",ijlig:"\u0133",Jcirc:"\u0134",jcirc:"\u0135",Kcedil:"\u0136",kcedil:"\u0137",kgreen:"\u0138",Lacute:"\u0139",lacute:"\u013A",Lcedil:"\u013B",lcedil:"\u013C",Lcaron:"\u013D",lcaron:"\u013E",Lmidot:"\u013F",lmidot:"\u0140",Lstrok:"\u0141",lstrok:"\u0142",Nacute:"\u0143",nacute:"\u0144",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ENG:"\u014A",eng:"\u014B",Omacr:"\u014C",omacr:"\u014D",Odblac:"\u0150",odblac:"\u0151",OElig:"\u0152",oelig:"\u0153",Racute:"\u0154",racute:"\u0155",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",Sacute:"\u015A",sacute:"\u015B",Scirc:"\u015C",scirc:"\u015D",Scedil:"\u015E",scedil:"\u015F",Scaron:"\u0160",scaron:"\u0161",Tcedil:"\u0162",tcedil:"\u0163",Tcaron:"\u0164",tcaron:"\u0165",Tstrok:"\u0166",tstrok:"\u0167",Utilde:"\u0168",utilde:"\u0169",Umacr:"\u016A",umacr:"\u016B",Ubreve:"\u016C",ubreve:"\u016D",Uring:"\u016E",uring:"\u016F",Udblac:"\u0170",udblac:"\u0171",Uogon:"\u0172",uogon:"\u0173",Wcirc:"\u0174",wcirc:"\u0175",Ycirc:"\u0176",ycirc:"\u0177",Zacute:"\u0179",zacute:"\u017A",Zdot:"\u017B",zdot:"\u017C",Zcaron:"\u017D",zcaron:"\u017E"},fr={Alpha:"\u0391",alpha:"\u03B1",Beta:"\u0392",beta:"\u03B2",Gamma:"\u0393",gamma:"\u03B3",Delta:"\u0394",delta:"\u03B4",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",varepsilon:"\u03F5",Zeta:"\u0396",zeta:"\u03B6",Eta:"\u0397",eta:"\u03B7",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",vartheta:"\u03D1",Iota:"\u0399",iota:"\u03B9",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",varkappa:"\u03F0",Lambda:"\u039B",lambda:"\u03BB",Mu:"\u039C",mu:"\u03BC",Nu:"\u039D",nu:"\u03BD",Xi:"\u039E",xi:"\u03BE",Omicron:"\u039F",omicron:"\u03BF",Pi:"\u03A0",pi:"\u03C0",piv:"\u03D6",varpi:"\u03D6",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",varrho:"\u03F1",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",varsigma:"\u03C2",Tau:"\u03A4",tau:"\u03C4",Upsilon:"\u03A5",upsilon:"\u03C5",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",varphi:"\u03D5",Chi:"\u03A7",chi:"\u03C7",Psi:"\u03A8",psi:"\u03C8",Omega:"\u03A9",omega:"\u03C9",ohm:"\u03A9",Gammad:"\u03DC",gammad:"\u03DD",digamma:"\u03DD"},hr={Afr:"\u{1D504}",afr:"\u{1D51E}",Acy:"\u0410",acy:"\u0430",Bcy:"\u0411",bcy:"\u0431",Vcy:"\u0412",vcy:"\u0432",Gcy:"\u0413",gcy:"\u0433",Dcy:"\u0414",dcy:"\u0434",IEcy:"\u0415",iecy:"\u0435",IOcy:"\u0401",iocy:"\u0451",ZHcy:"\u0416",zhcy:"\u0436",Zcy:"\u0417",zcy:"\u0437",Icy:"\u0418",icy:"\u0438",Jcy:"\u0419",jcy:"\u0439",Kcy:"\u041A",kcy:"\u043A",Lcy:"\u041B",lcy:"\u043B",Mcy:"\u041C",mcy:"\u043C",Ncy:"\u041D",ncy:"\u043D",Ocy:"\u041E",ocy:"\u043E",Pcy:"\u041F",pcy:"\u043F",Rcy:"\u0420",rcy:"\u0440",Scy:"\u0421",scy:"\u0441",Tcy:"\u0422",tcy:"\u0442",Ucy:"\u0423",ucy:"\u0443",Fcy:"\u0424",fcy:"\u0444",KHcy:"\u0425",khcy:"\u0445",TScy:"\u0426",tscy:"\u0446",CHcy:"\u0427",chcy:"\u0447",SHcy:"\u0428",shcy:"\u0448",SHCHcy:"\u0429",shchcy:"\u0449",HARDcy:"\u042A",hardcy:"\u044A",Ycy:"\u042B",ycy:"\u044B",SOFTcy:"\u042C",softcy:"\u044C",Ecy:"\u042D",ecy:"\u044D",YUcy:"\u042E",yucy:"\u044E",YAcy:"\u042F",yacy:"\u044F",DJcy:"\u0402",djcy:"\u0452",GJcy:"\u0403",gjcy:"\u0453",Jukcy:"\u0404",jukcy:"\u0454",DScy:"\u0405",dscy:"\u0455",Iukcy:"\u0406",iukcy:"\u0456",YIcy:"\u0407",yicy:"\u0457",Jsercy:"\u0408",jsercy:"\u0458",LJcy:"\u0409",ljcy:"\u0459",NJcy:"\u040A",njcy:"\u045A",TSHcy:"\u040B",tshcy:"\u045B",KJcy:"\u040C",kjcy:"\u045C",Ubrcy:"\u040E",ubrcy:"\u045E",DZcy:"\u040F",dzcy:"\u045F"},dr={plus:"+",minus:"\u2212",mnplus:"\u2213",mp:"\u2213",pm:"\xB1",times:"\xD7",div:"\xF7",divide:"\xF7",sdot:"\u22C5",star:"\u2606",starf:"\u2605",bigstar:"\u2605",lowast:"\u2217",ast:"*",midast:"*",compfn:"\u2218",smallcircle:"\u2218",bullet:"\u2022",bull:"\u2022",nbsp:"\xA0",hellip:"\u2026",mldr:"\u2026",prime:"\u2032",Prime:"\u2033",tprime:"\u2034",bprime:"\u2035",backprime:"\u2035",minus:"\u2212",minusd:"\u2238",dotminus:"\u2238",plusdo:"\u2214",dotplus:"\u2214",plusmn:"\xB1",minusplus:"\u2213",mnplus:"\u2213",mp:"\u2213",setminus:"\u2216",smallsetminus:"\u2216",Backslash:"\u2216",setmn:"\u2216",ssetmn:"\u2216",lowbar:"_",verbar:"|",vert:"|",VerticalLine:"|",colon:":",Colon:"\u2237",Proportion:"\u2237",ratio:"\u2236",equals:"=",ne:"\u2260",nequiv:"\u2262",equiv:"\u2261",Congruent:"\u2261",sim:"\u223C",thicksim:"\u223C",thksim:"\u223C",sime:"\u2243",simeq:"\u2243",TildeEqual:"\u2243",asymp:"\u2248",approx:"\u2248",thickapprox:"\u2248",thkap:"\u2248",TildeTilde:"\u2248",ncong:"\u2247",cong:"\u2245",TildeFullEqual:"\u2245",asympeq:"\u224D",CupCap:"\u224D",bump:"\u224E",Bumpeq:"\u224E",HumpDownHump:"\u224E",bumpe:"\u224F",bumpeq:"\u224F",HumpEqual:"\u224F",dotminus:"\u2238",minusd:"\u2238",plusdo:"\u2214",dotplus:"\u2214",le:"\u2264",LessEqual:"\u2264",ge:"\u2265",GreaterEqual:"\u2265",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",greater:">",less:"<"},pr={alefsym:"\u2135",aleph:"\u2135",beth:"\u2136",gimel:"\u2137",daleth:"\u2138",forall:"\u2200",ForAll:"\u2200",part:"\u2202",PartialD:"\u2202",exist:"\u2203",Exists:"\u2203",nexist:"\u2204",nexists:"\u2204",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",varnothing:"\u2205",nabla:"\u2207",Del:"\u2207",isin:"\u2208",isinv:"\u2208",in:"\u2208",Element:"\u2208",notin:"\u2209",notinva:"\u2209",ni:"\u220B",niv:"\u220B",SuchThat:"\u220B",ReverseElement:"\u220B",notni:"\u220C",notniva:"\u220C",prod:"\u220F",Product:"\u220F",coprod:"\u2210",Coproduct:"\u2210",sum:"\u2211",Sum:"\u2211",minus:"\u2212",mp:"\u2213",plusdo:"\u2214",dotplus:"\u2214",setminus:"\u2216",lowast:"\u2217",radic:"\u221A",Sqrt:"\u221A",prop:"\u221D",propto:"\u221D",Proportional:"\u221D",varpropto:"\u221D",infin:"\u221E",infintie:"\u29DD",ang:"\u2220",angle:"\u2220",angmsd:"\u2221",measuredangle:"\u2221",angsph:"\u2222",mid:"\u2223",VerticalBar:"\u2223",nmid:"\u2224",nsmid:"\u2224",npar:"\u2226",parallel:"\u2225",spar:"\u2225",nparallel:"\u2226",nspar:"\u2226",and:"\u2227",wedge:"\u2227",or:"\u2228",vee:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",Integral:"\u222B",conint:"\u222E",ContourIntegral:"\u222E",Conint:"\u222F",DoubleContourIntegral:"\u222F",Cconint:"\u2230",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",becaus:"\u2235",because:"\u2235",Because:"\u2235",ratio:"\u2236",Proportion:"\u2237",minusd:"\u2238",dotminus:"\u2238",mDDot:"\u223A",homtht:"\u223B",sim:"\u223C",bsimg:"\u223D",backsim:"\u223D",ac:"\u223E",mstpos:"\u223E",acd:"\u223F",VerticalTilde:"\u2240",wr:"\u2240",wreath:"\u2240",nsime:"\u2244",nsimeq:"\u2244",nsimeq:"\u2244",ncong:"\u2247",simne:"\u2246",ncongdot:"\u2A6D\u0338",ngsim:"\u2275",nsim:"\u2241",napprox:"\u2249",nap:"\u2249",ngeq:"\u2271",nge:"\u2271",nleq:"\u2270",nle:"\u2270",ngtr:"\u226F",ngt:"\u226F",nless:"\u226E",nlt:"\u226E",nprec:"\u2280",npr:"\u2280",nsucc:"\u2281",nsc:"\u2281"},mr={larr:"\u2190",leftarrow:"\u2190",LeftArrow:"\u2190",uarr:"\u2191",uparrow:"\u2191",UpArrow:"\u2191",rarr:"\u2192",rightarrow:"\u2192",RightArrow:"\u2192",darr:"\u2193",downarrow:"\u2193",DownArrow:"\u2193",harr:"\u2194",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",varr:"\u2195",updownarrow:"\u2195",UpDownArrow:"\u2195",nwarr:"\u2196",nwarrow:"\u2196",UpperLeftArrow:"\u2196",nearr:"\u2197",nearrow:"\u2197",UpperRightArrow:"\u2197",searr:"\u2198",searrow:"\u2198",LowerRightArrow:"\u2198",swarr:"\u2199",swarrow:"\u2199",LowerLeftArrow:"\u2199",lArr:"\u21D0",Leftarrow:"\u21D0",uArr:"\u21D1",Uparrow:"\u21D1",rArr:"\u21D2",Rightarrow:"\u21D2",dArr:"\u21D3",Downarrow:"\u21D3",hArr:"\u21D4",Leftrightarrow:"\u21D4",iff:"\u21D4",vArr:"\u21D5",Updownarrow:"\u21D5",lAarr:"\u21DA",Lleftarrow:"\u21DA",rAarr:"\u21DB",Rrightarrow:"\u21DB",lrarr:"\u21C6",leftrightarrows:"\u21C6",rlarr:"\u21C4",rightleftarrows:"\u21C4",lrhar:"\u21CB",leftrightharpoons:"\u21CB",ReverseEquilibrium:"\u21CB",rlhar:"\u21CC",rightleftharpoons:"\u21CC",Equilibrium:"\u21CC",udarr:"\u21C5",UpArrowDownArrow:"\u21C5",duarr:"\u21F5",DownArrowUpArrow:"\u21F5",llarr:"\u21C7",leftleftarrows:"\u21C7",rrarr:"\u21C9",rightrightarrows:"\u21C9",ddarr:"\u21CA",downdownarrows:"\u21CA",har:"\u21BD",lhard:"\u21BD",leftharpoondown:"\u21BD",lharu:"\u21BC",leftharpoonup:"\u21BC",rhard:"\u21C1",rightharpoondown:"\u21C1",rharu:"\u21C0",rightharpoonup:"\u21C0",lsh:"\u21B0",Lsh:"\u21B0",rsh:"\u21B1",Rsh:"\u21B1",ldsh:"\u21B2",rdsh:"\u21B3",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",mapstoleft:"\u21A4",mapstoup:"\u21A5",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",crarr:"\u21B5",nwarrow:"\u2196",nearrow:"\u2197",searrow:"\u2198",swarrow:"\u2199",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nrightarrow:"\u219B",nrarr:"\u219B",larrtl:"\u21A2",rarrtl:"\u21A3",leftarrowtail:"\u21A2",rightarrowtail:"\u21A3",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Larr:"\u219E",Rarr:"\u21A0",larrhk:"\u21A9",rarrhk:"\u21AA",larrlp:"\u21AB",looparrowleft:"\u21AB",rarrlp:"\u21AC",looparrowright:"\u21AC",harrw:"\u21AD",leftrightsquigarrow:"\u21AD",nrarrw:"\u219D\u0338",rarrw:"\u219D",rightsquigarrow:"\u219D",larrbfs:"\u291F",rarrbfs:"\u2920",nvHarr:"\u2904",nvlArr:"\u2902",nvrArr:"\u2903",larrfs:"\u291D",rarrfs:"\u291E",Map:"\u2905",larrsim:"\u2973",rarrsim:"\u2974",harrcir:"\u2948",Uarrocir:"\u2949",lurdshar:"\u294A",ldrdhar:"\u2967",ldrushar:"\u294B",rdldhar:"\u2969",lrhard:"\u296D",rlhar:"\u21CC",uharr:"\u21BE",uharl:"\u21BF",dharr:"\u21C2",dharl:"\u21C3",Uarr:"\u219F",Darr:"\u21A1",zigrarr:"\u21DD",nwArr:"\u21D6",neArr:"\u21D7",seArr:"\u21D8",swArr:"\u21D9",nharr:"\u21AE",nhArr:"\u21CE",nlarr:"\u219A",nlArr:"\u21CD",nrarr:"\u219B",nrArr:"\u21CF",larrb:"\u21E4",LeftArrowBar:"\u21E4",rarrb:"\u21E5",RightArrowBar:"\u21E5"},gr={square:"\u25A1",Square:"\u25A1",squ:"\u25A1",squf:"\u25AA",squarf:"\u25AA",blacksquar:"\u25AA",blacksquare:"\u25AA",FilledVerySmallSquare:"\u25AA",blk34:"\u2593",blk12:"\u2592",blk14:"\u2591",block:"\u2588",srect:"\u25AD",rect:"\u25AD",sdot:"\u22C5",sdotb:"\u22A1",dotsquare:"\u22A1",triangle:"\u25B5",tri:"\u25B5",trine:"\u25B5",utri:"\u25B5",triangledown:"\u25BF",dtri:"\u25BF",tridown:"\u25BF",triangleleft:"\u25C3",ltri:"\u25C3",triangleright:"\u25B9",rtri:"\u25B9",blacktriangle:"\u25B4",utrif:"\u25B4",blacktriangledown:"\u25BE",dtrif:"\u25BE",blacktriangleleft:"\u25C2",ltrif:"\u25C2",blacktriangleright:"\u25B8",rtrif:"\u25B8",loz:"\u25CA",lozenge:"\u25CA",blacklozenge:"\u29EB",lozf:"\u29EB",bigcirc:"\u25EF",xcirc:"\u25EF",circ:"\u02C6",Circle:"\u25CB",cir:"\u25CB",o:"\u25CB",bullet:"\u2022",bull:"\u2022",hellip:"\u2026",mldr:"\u2026",nldr:"\u2025",boxh:"\u2500",HorizontalLine:"\u2500",boxv:"\u2502",boxdr:"\u250C",boxdl:"\u2510",boxur:"\u2514",boxul:"\u2518",boxvr:"\u251C",boxvl:"\u2524",boxhd:"\u252C",boxhu:"\u2534",boxvh:"\u253C",boxH:"\u2550",boxV:"\u2551",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxDl:"\u2555",boxdL:"\u2556",boxDL:"\u2557",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxUl:"\u255C",boxuL:"\u255B",boxUL:"\u255D",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",boxVl:"\u2562",boxvL:"\u2561",boxVL:"\u2563",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C"},yr={excl:"!",iexcl:"\xA1",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",nbsp:"\xA0",comma:",",period:".",colon:":",semi:";",vert:"|",Verbar:"\u2016",verbar:"|",dblac:"\u02DD",circ:"\u02C6",caron:"\u02C7",breve:"\u02D8",dot:"\u02D9",ring:"\u02DA",ogon:"\u02DB",tilde:"\u02DC",DiacriticalGrave:"`",DiacriticalAcute:"\xB4",DiacriticalTilde:"\u02DC",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",grave:"`",acute:"\xB4"},Lt={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},br={frac12:"\xBD",half:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044"},wr={trade:"\u2122",TRADE:"\u2122",telrec:"\u2315",target:"\u2316",ulcorn:"\u231C",ulcorner:"\u231C",urcorn:"\u231D",urcorner:"\u231D",dlcorn:"\u231E",llcorner:"\u231E",drcorn:"\u231F",lrcorner:"\u231F",intercal:"\u22BA",intcal:"\u22BA",oplus:"\u2295",CirclePlus:"\u2295",ominus:"\u2296",CircleMinus:"\u2296",otimes:"\u2297",CircleTimes:"\u2297",osol:"\u2298",odot:"\u2299",CircleDot:"\u2299",oast:"\u229B",circledast:"\u229B",odash:"\u229D",circleddash:"\u229D",ocirc:"\u229A",circledcirc:"\u229A",boxplus:"\u229E",plusb:"\u229E",boxminus:"\u229F",minusb:"\u229F",boxtimes:"\u22A0",timesb:"\u22A0",boxdot:"\u22A1",sdotb:"\u22A1",veebar:"\u22BB",vee:"\u2228",barvee:"\u22BD",and:"\u2227",wedge:"\u2227",Cap:"\u22D2",Cup:"\u22D3",Fork:"\u22D4",pitchfork:"\u22D4",epar:"\u22D5",ltlarr:"\u2976",nvap:"\u224D\u20D2",nvsim:"\u223C\u20D2",nvge:"\u2265\u20D2",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvgt:">\u20D2",nvltrie:"\u22B4\u20D2",nvrtrie:"\u22B5\u20D2",Vdash:"\u22A9",dashv:"\u22A3",vDash:"\u22A8",Vdash:"\u22A9",Vvdash:"\u22AA",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF"},Hl={...lr,...cr,...ur,...fr,...hr,...dr,...pr,...mr,...gr,...yr,...Lt,...br,...wr},Ue={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},Us={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var Xl=new Set("!?\\\\/[]$%{}^&*()<>|+");function Sr(s){if(s[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${s}"`);for(let e of s)if(Xl.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${s}"`);return s}function Ks(...s){let e=Object.create(null);for(let t of s)if(t)for(let n of Object.keys(t)){let i=t[n];if(typeof i=="string")e[n]=i;else if(i&&typeof i=="object"&&i.val!==void 0){let r=i.val;typeof r=="string"&&(e[n]=r)}}return e}var de="external",qt="base",Ys="all";function zl(s){return!s||s===de?new Set([de]):s===Ys?new Set([Ys]):s===qt?new Set([qt]):Array.isArray(s)?new Set(s):new Set([de])}var $=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ql=new Set([9,10,13]);function Zl(s){if(!s)return{xmlVersion:1,onLevel:$.allow,nullLevel:$.remove};let e=s.xmlVersion===1.1?1.1:1,t=$[s.onNCR]??$.allow,n=$[s.nullNCR]??$.remove,i=Math.max(n,$.remove);return{xmlVersion:e,onLevel:t,nullLevel:i}}var Ee=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:n=>n,this._limitTiers=zl(this._limit.applyLimitsTo??de),this._numericAllowed=e.numericAllowed??!0,this._baseMap=Ks(Ue,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let t=Zl(e.ncr);this._ncrXmlVersion=t.xmlVersion,this._ncrOnLevel=t.onLevel,this._ncrNullLevel=t.nullLevel}setExternalEntities(e){if(e)for(let t of Object.keys(e))Sr(t);this._externalMap=Ks(e)}addExternalEntity(e,t){Sr(e),typeof t=="string"&&t.indexOf("&")===-1&&(this._externalMap[e]=t)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=Ks(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!="string"||e.length===0)return e;let t=e,n=[],i=e.length,r=0,o=0,a=this._maxTotalExpansions>0,l=this._maxExpandedLength>0,c=a||l;for(;o=i||e.charCodeAt(f)!==59){o++;continue}let h=e.slice(o+1,f);if(h.length===0){o++;continue}let p,g;if(this._removeSet.has(h))p="",g===void 0&&(g=de);else if(this._leaveSet.has(h)){o++;continue}else if(h.charCodeAt(0)===35){let d=this._resolveNCR(h);if(d===void 0){o++;continue}p=d,g=qt}else{let d=this._resolveName(h);p=d?.value,g=d?.tier}if(p===void 0){o++;continue}if(o>r&&n.push(e.slice(r,o)),n.push(p),r=f+1,o=r,c&&this._tierCounts(g)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(l){let d=p.length-(h.length+2);if(d>0&&(this._expandedLength+=d,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}r=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ql.has(e)?$.remove:-1}_applyNCRAction(e,t,n){switch(e){case $.allow:return String.fromCodePoint(n);case $.remove:return"";case $.leave:return;case $.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(t===120||t===88?n=parseInt(e.slice(2),16):n=parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let i=this._classifyNCR(n);if(!this._numericAllowed&&i<$.remove)return;let r=i===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,i);return this._applyNCRAction(r,e,n)}};var Nr=s=>Ve.includes(s)?"__"+s:s,ec={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(s,e){return e},attributeValueProcessor:function(s,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(s,e,t){return s},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:Nr};function tc(s,e){if(typeof s!="string")return;let t=s.toLowerCase();if(Ve.some(n=>t===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`);if(It.some(n=>t===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Ar(s,e){return typeof s=="boolean"?{enabled:s,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof s=="object"&&s!==null?{enabled:s.enabled!==!1,maxEntitySize:Math.max(1,s.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,s.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,s.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,s.maxExpandedLength??1e5),maxEntityCount:Math.max(1,s.maxEntityCount??1e3),allowedTags:s.allowedTags??null,tagFilter:s.tagFilter??null,appliesTo:s.appliesTo??"all"}:Ar(!0)}var Er=function(s){let e=Object.assign({},ec,s),t=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:i}of t)n&&tc(n,i);return e.onDangerousProperty===null&&(e.onDangerousProperty=Nr),e.processEntities=Ar(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),e};var Pt;typeof Symbol!="function"?Pt="@@xmlMetadata":Pt=Symbol("XML Node Metadata");var R=class{constructor(e){this.tagname=e,this.child=[],this[":@"]=Object.create(null)}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e,t){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][Pt]={startIndex:t})}static getMetaDataSymbol(){return Pt}};var Ye=class{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){let n=Object.create(null),i=0;if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let r=1,o=!1,a=!1,l="";for(;t=this.options.maxEntityCount)throw new Error(`Entity count (${i+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[c]=u,i++}}else if(o&&pe(e,"!ELEMENT",t)){t+=8;let{index:c}=this.readElementExp(e,t+1);t=c}else if(o&&pe(e,"!ATTLIST",t))t+=8;else if(o&&pe(e,"!NOTATION",t)){t+=9;let{index:c}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=c}else if(pe(e,"!--",t))a=!0;else throw new Error("Invalid DOCTYPE");r++,l=""}else if(e[t]===">"){if(a?e[t-1]==="-"&&e[t-2]==="-"&&(a=!1,r--):r--,r===0)break}else e[t]==="["?o=!0:l+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}readEntityExp(e,t){t=F(e,t);let n=t;for(;tthis.options.maxEntitySize)throw new Error(`Entity "${i}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[i,r,t]}readNotationExp(e,t){t=F(e,t);let n=t;for(;t{for(;e1||r.length===1&&!a))return s;{let l=Number(t),c=String(l);if(l===0)return l;if(c.search(/[eE]/)!==-1)return e.eNotation?l:s;if(t.indexOf(".")!==-1)return c==="0"||c===o||c===`${i}${o}`?l:s;let u=r?o:t;return r?u===c||i+u===c?l:s:u===c||u===i+c?l:s}}else return s}}else return cc(s,Number(t),e)}var rc=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function oc(s,e,t){if(!t.eNotation)return s;let n=e.match(rc);if(n){let i=n[1]||"",r=n[3].indexOf("e")===-1?"E":"e",o=n[2],a=i?s[o.length+1]===r:s[o.length]===r;return o.length>1&&a?s:o.length===1&&(n[3].startsWith(`.${r}`)||n[3][0]===r)?Number(e):o.length>0?t.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):s:Number(e)}else return s}function ac(s){return s&&s.indexOf(".")!==-1&&(s=s.replace(/0+$/,""),s==="."?s="0":s[0]==="."?s="0"+s:s[s.length-1]==="."&&(s=s.substring(0,s.length-1))),s}function lc(s,e){if(parseInt)return parseInt(s,e);if(Number.parseInt)return Number.parseInt(s,e);if(window&&window.parseInt)return window.parseInt(s,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function cc(s,e,t){let n=e===1/0;switch(t.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return n?"Infinity":"-Infinity";default:return s}}function Js(s){return typeof s=="function"?s:Array.isArray(s)?e=>{for(let t of s)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var U=class{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||".",this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(i=>i.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(i=>i.attrName!==void 0),this._hasPositionSelector=this.segments.some(i=>i.position!==void 0)}_parse(e){let t=[],n=0,i="";for(;n0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return!1;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},W=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new Gs(this)}push(e,t=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);let r=this.siblingStacks[i],o=n?`${n}:${e}`:e,a=r.get(o)||0,l=0;for(let u of r.values())l+=u;r.set(o,a+1);let c={tag:e,position:l,counter:a};n!=null&&(c.namespace=n),t!=null&&(c.values=t),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){let n=e||this.separator;if(n===this.separator&&t===!0){if(this._pathStringCache!==null)return this._pathStringCache;let r=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(n);return this._pathStringCache=r,r}return this.path.map(r=>t&&r.namespace?`${r.namespace}:${r.tag}`:r.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){let t=e.segments;return t.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t=0&&t>=0;){let i=e[n];if(i.type==="deep-wildcard"){if(n--,n<0)return!0;let r=e[n],o=!1;for(let a=t;a>=0;a--)if(this._matchSegment(r,this.path[a],a===this.path.length-1)){t=a-1,n--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(i,this.path[t],t===this.path.length-1))return!1;t--,n--}}return n<0}_matchSegment(e,t,n){if(e.tag!=="*"&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let i=t.counter??0;if(e.position==="first"&&i!==0)return!1;if(e.position==="odd"&&i%2!==1)return!1;if(e.position==="even"&&i%2!==0)return!1;if(e.position==="nth"&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(t=>({...t})),this.siblingStacks=e.siblingStacks.map(t=>new Map(t))}readOnly(){return this._view}};function uc(s,e){if(!s)return{};let t=e.attributesGroupName?s[e.attributesGroupName]:s;if(!t)return{};let n={};for(let i in t)if(i.startsWith(e.attributeNamePrefix)){let r=i.substring(e.attributeNamePrefix.length);n[r]=t[i]}else n[i]=t[i];return n}function fc(s){if(!s||typeof s!="string")return;let e=s.indexOf(":");if(e!==-1&&e>0){let t=s.substring(0,e);if(t!=="xmlns")return t}}var De=class{constructor(e,t){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=gc,this.parseTextData=hc,this.resolveNameSpace=dc,this.buildAttributesMap=mc,this.isItStopNode=Sc,this.replaceEntitiesValue=bc,this.readStopNodeData=Ec,this.saveTextToParentTag=wc,this.addChild=yc,this.ignoreAttributesFn=Js(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let n={...Ue};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...Us,...Lt}),this.entityDecoder=new Ee({namedEntities:{...n,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new W,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new ve;let i=this.options.stopNodes;if(i&&i.length>0){for(let r=0;r0)){o||(s=this.replaceEntitiesValue(s,e,t));let l=a.jPath?t.toString():t,c=a.tagValueProcessor(e,s,l,i,r);return c==null?s:typeof c!=typeof s||c!==s?c:a.trimValues||s.trim()===s?Xs(s,a.parseTagValue,a.numberParseOptions):s}}function dc(s){if(this.options.removeNSPrefix){let e=s.split(":"),t=s.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(s=t+e[1])}return s}var pc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function mc(s,e,t,n=!1){let i=this.options;if(n===!0||i.ignoreAttributes!==!0&&typeof s=="string"){let r=kt(s,pc),o=r.length,a={},l=new Array(o),c=!1,u={};for(let p=0;p",a,"Closing Tag is not closed."),f=s.substring(a+2,u).trim();if(i.removeNSPrefix){let p=f.indexOf(":");p!==-1&&(f=f.substr(p+1))}f=Ws(i.transformTagName,f,"",i).tagName,t&&(n=this.saveTextToParentTag(n,t,this.readonlyMatcher));let h=this.matcher.getCurrentTag();if(f&&i.unpairedTagsSet.has(f))throw new Error(`Unpaired tag can not be used as closing tag: `);h&&i.unpairedTagsSet.has(h)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,t=this.tagsNodeStack.pop(),n="",a=u}else if(c===63){let u=Hs(s,a,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,t,this.readonlyMatcher);let f=this.buildAttributesMap(u.tagExp,this.matcher,u.tagName,!0);if(f){let h=f[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(h)||1)}if(!(i.ignoreDeclaration&&u.tagName==="?xml"||i.ignorePiTags)){let h=new R(u.tagName);h.add(i.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&i.ignoreAttributes!==!0&&(h[":@"]=f),this.addChild(t,h,this.readonlyMatcher,a)}a=u.closeIndex+1}else if(c===33&&s.charCodeAt(a+2)===45&&s.charCodeAt(a+3)===45){let u=Te(s,"-->",a+4,"Comment is not closed.");if(i.commentPropName){let f=s.substring(a+4,u-2);n=this.saveTextToParentTag(n,t,this.readonlyMatcher),t.add(i.commentPropName,[{[i.textNodeName]:f}])}a=u}else if(c===33&&s.charCodeAt(a+2)===68){let u=r.readDocType(s,a);this.entityDecoder.addInputEntities(u.entities),a=u.i}else if(c===33&&s.charCodeAt(a+2)===91){let u=Te(s,"]]>",a,"CDATA is not closed.")-2,f=s.substring(a+9,u);n=this.saveTextToParentTag(n,t,this.readonlyMatcher);let h=this.parseTextData(f,t.tagname,this.readonlyMatcher,!0,!1,!0,!0);h==null&&(h=""),i.cdataPropName?t.add(i.cdataPropName,[{[i.textNodeName]:f}]):t.add(i.textNodeName,h),a=u+2}else{let u=Hs(s,a,i.removeNSPrefix);if(!u){let N=s.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${N}"`)}let f=u.tagName,h=u.rawTagName,p=u.tagExp,g=u.attrExpPresent,d=u.closeIndex;if({tagName:f,tagExp:p}=Ws(i.transformTagName,f,p,i),i.strictReservedNames&&(f===i.commentPropName||f===i.cdataPropName||f===i.textNodeName||f===i.attributesGroupName))throw new Error(`Invalid tag name: ${f}`);t&&n&&t.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,t,this.readonlyMatcher,!1));let m=t;m&&i.unpairedTagsSet.has(m.tagname)&&(t=this.tagsNodeStack.pop(),this.matcher.pop());let b=!1;p.length>0&&p.lastIndexOf("/")===p.length-1&&(b=!0,f[f.length-1]==="/"?(f=f.substr(0,f.length-1),p=f):p=p.substr(0,p.length-1),g=f!==p);let y=null,A={},v;v=fc(h),f!==e.tagname&&this.matcher.push(f,{},v),f!==p&&g&&(y=this.buildAttributesMap(p,this.matcher,f),y&&(A=uc(y,i))),f!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let E=a;if(this.isCurrentNodeStopNode){let N="";if(b)a=u.closeIndex;else if(i.unpairedTagsSet.has(f))a=u.closeIndex;else{let S=this.readStopNodeData(s,h,d+1);if(!S)throw new Error(`Unexpected end of ${h}`);a=S.i,N=S.tagContent}let O=new R(f);y&&(O[":@"]=y),O.add(i.textNodeName,N),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(t,O,this.readonlyMatcher,E)}else{if(b){({tagName:f,tagExp:p}=Ws(i.transformTagName,f,p,i));let N=new R(f);y&&(N[":@"]=y),this.addChild(t,N,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(f)){let N=new R(f);y&&(N[":@"]=y),this.addChild(t,N,this.readonlyMatcher,E),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=u.closeIndex;continue}else{let N=new R(f);if(this.tagsNodeStack.length>i.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(t),y&&(N[":@"]=y),this.addChild(t,N,this.readonlyMatcher,E),t=N}n="",a=d}}}else n+=s[a];return e.child};function yc(s,e,t,n){this.options.captureMetaData||(n=void 0);let i=this.options.jPath?t.toString():t,r=this.options.updateTag(e.tagname,i,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),s.addChild(e,n))}function bc(s,e,t){let n=this.options.processEntities;if(!n||!n.enabled)return s;if(n.allowedTags){let i=this.options.jPath?t.toString():t;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,i)))return s}if(n.tagFilter){let i=this.options.jPath?t.toString():t;if(!n.tagFilter(e,i))return s}return this.entityDecoder.decode(s)}function wc(s,e,t,n){return s&&(n===void 0&&(n=e.child.length===0),s=this.parseTextData(s,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),s!==void 0&&s!==""&&e.add(this.options.textNodeName,s),s=""),s}function Sc(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Nc(s,e,t=">"){let n=0,i=s.length,r=t.charCodeAt(0),o=t.length>1?t.charCodeAt(1):-1,a="",l=e;for(let c=e;c",t,`${e} is not closed`);if(s.substring(t+2,a).trim()===e&&(i--,i===0))return{tagContent:s.substring(n,t),i:a};t=a}else if(o===63)t=Te(s,"?>",t+1,"StopNode is not closed.");else if(o===33&&s.charCodeAt(t+2)===45&&s.charCodeAt(t+3)===45)t=Te(s,"-->",t+3,"StopNode is not closed.");else if(o===33&&s.charCodeAt(t+2)===91)t=Te(s,"]]>",t,"StopNode is not closed.")-2;else{let a=Hs(s,t,!1);a&&((a&&a.tagName)===e&&a.tagExp[a.tagExp.length-1]!=="/"&&i++,t=a.closeIndex)}}}function Xs(s,e,t){if(e&&typeof s=="string"){let n=s.trim();return n==="true"?!0:n==="false"?!1:Ds(s,t)}else return sr(s)?s:""}function Ws(s,e,t,n){if(s){let i=s(e);t===e&&(t=i),e=i}return e=vr(e,n),{tagName:e,tagExp:t}}function vr(s,e){if(It.includes(s))throw new Error(`[SECURITY] Invalid name: "${s}" is a reserved JavaScript keyword that could cause prototype pollution`);return Ve.includes(s)?e.onDangerousProperty(s):s}var zs=R.getMetaDataSymbol();function vc(s,e){if(!s||typeof s!="object")return{};if(!e)return s;let t={};for(let n in s)if(n.startsWith(e)){let i=n.substring(e.length);t[i]=s[n]}else t[n]=s[n];return t}function Qs(s,e,t,n){return Tr(s,e,t,n)}function Tr(s,e,t,n){let i,r={};for(let o=0;o0&&(r[e.textNodeName]=i):i!==void 0&&(r[e.textNodeName]=i),r}function Tc(s){let e=Object.keys(s);for(let t=0;t/g,"]]]]>")}function te(s){return String(s).replace(/"/g,""").replace(/'/g,"'")}var kc=` +`;function en(s,e){let t="";e.format&&(t=kc);let n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let r=0;re.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(s)){if(s!=null){let a=s.toString();return a=Zs(a,e),a}return""}for(let a=0;a`,o=!1,n.pop();continue}else if(c===e.commentPropName){let m=l[c][0][e.textNodeName],b=_t(m);r+=t+``,o=!0,n.pop();continue}else if(c[0]==="?"){let m=Cr(l[":@"],e,f);r+=(c==="?xml"?"":t)+`<${c}${m}?>`,o=!0,n.pop();continue}let h=t;h!==""&&(h+=e.indentBy);let p=Cr(l[":@"],e,f),g=t+`<${c}${p}`,d;f?d=kr(l[c],e):d=Or(l[c],e,h,n,i),e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?r+=g+">":r+=g+"/>":(!d||d.length===0)&&e.suppressEmptyNode?r+=g+"/>":d&&d.endsWith(">")?r+=g+`>${d}${t}`:(r+=g+">",d&&t!==""&&(d.includes("/>")||d.includes("`),o=!0,n.pop()}return r}function Ic(s,e){if(!s||e.ignoreAttributes)return null;let t={},n=!1;for(let i in s){if(!Object.prototype.hasOwnProperty.call(s,i))continue;let r=i.startsWith(e.attributeNamePrefix)?i.substr(e.attributeNamePrefix.length):i;t[r]=te(s[i]),n=!0}return n?t:null}function kr(s,e){if(!Array.isArray(s))return s!=null?s.toString():"";let t="";for(let n=0;n`:t+=`<${r}${o}>${a}`}}}return t}function Lc(s,e){let t="";if(s&&!e.ignoreAttributes)for(let n in s){if(!Object.prototype.hasOwnProperty.call(s,n))continue;let i=s[n];i===!0&&e.suppressBooleanAttributes?t+=` ${n.substr(e.attributeNamePrefix.length)}`:t+=` ${n.substr(e.attributeNamePrefix.length)}="${te(i)}"`}return t}function Ir(s){let e=Object.keys(s);for(let t=0;t0&&e.processEntities)for(let t=0;t{for(let t of s)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var Pc={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(s,e){return e},attributeValueProcessor:function(s,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function B(s){if(this.options=Object.assign({},Pc,s),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e=="string"&&e.startsWith("*.")?".."+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e +`,this.newLine=` +`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}B.prototype.build=function(s){if(this.options.preserveOrder)return en(s,this.options);{Array.isArray(s)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(s={[this.options.arrayNodeName]:s});let e=new W;return this.j2x(s,0,e).val}};B.prototype.j2x=function(s,e,t){let n="",i="";if(this.options.maxNestedTags&&t.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");let r=this.options.jPath?t.toString():t,o=this.checkStopNode(t);for(let a in s)if(Object.prototype.hasOwnProperty.call(s,a))if(typeof s[a]>"u")this.isAttribute(a)&&(i+="");else if(s[a]===null)this.isAttribute(a)||a===this.options.cdataPropName||a===this.options.commentPropName?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(s[a]instanceof Date)i+=this.buildTextValNode(s[a],a,"",e,t);else if(typeof s[a]!="object"){let l=this.isAttribute(a);if(l&&!this.ignoreAttributesFn(l,r))n+=this.buildAttrPairStr(l,""+s[a],o);else if(!l)if(a===this.options.textNodeName){let c=this.options.tagValueProcessor(a,""+s[a]);i+=this.replaceEntitiesValue(c)}else{t.push(a);let c=this.checkStopNode(t);if(t.pop(),c){let u=""+s[a];u===""?i+=this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:i+=this.indentate(e)+"<"+a+">"+u+""u"))if(h===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){t.push(a);let p=this.j2x(h,e+1,t);t.pop(),c+=p.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else c+=this.processTextOrObjNode(h,a,e,t);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(a,h);p=this.replaceEntitiesValue(p),c+=p}else{t.push(a);let p=this.checkStopNode(t);if(t.pop(),p){let g=""+h;g===""?c+=this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:c+=this.indentate(e)+"<"+a+">"+g+"${i}`;else if(typeof i=="object"&&i!==null){let r=this.buildRawContent(i),o=this.buildAttributesForStopNode(i);r===""?e+=`<${t}${o}/>`:e+=`<${t}${o}>${r}`}}else if(typeof n=="object"&&n!==null){let i=this.buildRawContent(n),r=this.buildAttributesForStopNode(n);i===""?e+=`<${t}${r}/>`:e+=`<${t}${r}>${i}`}else e+=`<${t}>${n}`}return e};B.prototype.buildAttributesForStopNode=function(s){if(!s||typeof s!="object")return"";let e="";if(this.options.attributesGroupName&&s[this.options.attributesGroupName]){let t=s[this.options.attributesGroupName];for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let i=n.startsWith(this.options.attributeNamePrefix)?n.substring(this.options.attributeNamePrefix.length):n,r=t[n];r===!0&&this.options.suppressBooleanAttributes?e+=" "+i:e+=" "+i+'="'+r+'"'}}else for(let t in s){if(!Object.prototype.hasOwnProperty.call(s,t))continue;let n=this.isAttribute(t);if(n){let i=s[t];i===!0&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+i+'"'}}return e};B.prototype.buildObjectNode=function(s,e,t,n){if(s==="")return e[0]==="?"?this.indentate(n)+"<"+e+t+"?"+this.tagEndChar:this.indentate(n)+"<"+e+t+this.closeTag(e)+this.tagEndChar;if(e[0]==="?")return this.indentate(n)+"<"+e+t+"?"+this.tagEndChar;{let i=""+s+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&r.length===0?this.indentate(n)+``+this.newLine:this.indentate(n)+"<"+e+t+r+this.tagEndChar+s+this.indentate(n)+i}};B.prototype.closeTag=function(s){let e="";return this.options.unpairedTags.indexOf(s)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine}else if(this.options.commentPropName!==!1&&e===this.options.commentPropName){let r=_t(s);return this.indentate(n)+``+this.newLine}else{if(e[0]==="?")return this.indentate(n)+"<"+e+t+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,s);return r=this.replaceEntitiesValue(r),r===""?this.indentate(n)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+t+">"+r+"0&&this.options.processEntities)for(let e=0;e-1&&t!=="'"&&Fc(s,e));return e>-1&&(e+=n.length,n.length>1&&(s[e]===t&&e++,s[e]===t&&e++)),e}var Bc=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Je=class s extends Date{#t=!1;#s=!1;#e=null;constructor(e){let t=!0,n=!0,i="Z";if(typeof e=="string"){let r=e.match(Bc);r?(r[1]||(t=!1,e=`0000-01-01T${e}`),n=!!r[2],n&&e[10]===" "&&(e=e.replace(" ","T")),r[2]&&+r[2]>23?e="":(i=r[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=t,this.#s=n,this.#e=i)}isDateTime(){return this.#t&&this.#s}isLocal(){return!this.#t||!this.#s||!this.#e}isDate(){return this.#t&&!this.#s}isTime(){return this.#s&&!this.#t}isValid(){return this.#t||this.#s}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,t="Z"){let n=new s(e);return n.#e=t,n}static wrapAsLocalDateTime(e){let t=new s(e);return t.#e=null,t}static wrapAsLocalDate(e){let t=new s(e);return t.#s=!1,t.#e=null,t}static wrapAsLocalTime(e){let t=new s(e);return t.#t=!1,t.#e=null,t}};var Vc=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,jc=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Uc=/^[+-]?0[0-9_]/,Kc=/^[0-9a-f]{2,8}$/i,$r={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Ft(s,e=0,t=s.length){let n=s[e]==="'",i=s[e++]===s[e]&&s[e]===s[e+1];i&&(t-=2,s[e+=2]==="\r"&&e++,s[e]===` +`&&e++);let r=0,o,a="",l=e;for(;e-1&&(Oe(s,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Ge(s,e,t,n,i){if(n===0)throw new T("document contains excessively nested structures. aborting.",{toml:s,ptr:e});let r=s[e];if(r==="["||r==="{"){let[l,c]=r==="["?Br(s,e,n,i):Fr(s,e,n,i);if(t){if(c=K(s,c),s[c]===",")c++;else if(s[c]!==t)throw new T("expected comma or end of structure",{toml:s,ptr:c})}return[l,c]}let o;if(r==='"'||r==="'"){o=Rt(s,e);let l=Ft(s,e,o);if(t){if(o=K(s,o),s[o]&&s[o]!==","&&s[o]!==t&&s[o]!==` +`&&s[o]!=="\r")throw new T("unexpected character encountered",{toml:s,ptr:o});o+=+(s[o]===",")}return[l,o]}o=Mr(s,e,",",t);let a=Yc(s,e,o-+(s[o-1]===","));if(!a[0])throw new T("incomplete key-value declaration: no value specified",{toml:s,ptr:e});return t&&a[1]>-1&&(o=K(s,e+a[1]),o+=+(s[o]===",")),[Rr(a[0],s,e,i),o]}var Dc=/^[a-zA-Z0-9-_]+[ \t]*$/;function Bt(s,e,t="="){let n=e-1,i=[],r=s.indexOf(t,e);if(r<0)throw new T("incomplete key-value: cannot find end of key",{toml:s,ptr:e});do{let o=s[e=++n];if(o!==" "&&o!==" ")if(o==='"'||o==="'"){if(o===s[e+1]&&o===s[e+2])throw new T("multiline strings are not allowed in keys",{toml:s,ptr:e});let a=Rt(s,e);if(a<0)throw new T("unfinished string encountered",{toml:s,ptr:e});n=s.indexOf(".",a);let l=s.slice(a,n<0||n>r?r:n),c=$t(l);if(c>-1)throw new T("newlines are not allowed in keys",{toml:s,ptr:e+n+c});if(l.trimStart())throw new T("found extra tokens after the string part",{toml:s,ptr:a});if(rr?r:n);if(!Dc.test(a))throw new T("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:e});i.push(a.trimEnd())}}while(n+1&&nr===""?null:r});return D(n.parse(t))}case"ini":return D(Rs.parse(t));case"csv":return D(kp(t,e.csvDelimiter,e.csvHeader));case"toml":return D(Vt(t));default:{let n=e.inputFormat;throw new Error(`Invalid input format: ${n}`)}}}function _l(s){return Ct.default.parseAllDocuments(s).map(t=>D(t.toJS({maxAliasCount:100})))}function xl(s){let e=s.trimStart();if(e.startsWith("---")){let t=e.slice(3).match(/\n---(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:D(Ct.default.parse(n,{maxAliasCount:100})),content:i}}}if(e.startsWith("+++")){let t=e.slice(3).match(/\n\+\+\+(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:D(Vt(n)),content:i}}}if(e.startsWith("{{{")){let t=e.slice(3).match(/\n}}}(\n|$)/);if(t&&t.index!==void 0){let n=e.slice(3,t.index+3),i=e.slice(t.index+3+t[0].length);return{frontMatter:D(JSON.parse(n)),content:i}}}return null}function Ml(s,e){if(s===void 0)return"";switch(e.outputFormat){case"yaml":return Ct.default.stringify(s,{indent:e.indent}).trimEnd();case"json":return e.raw&&typeof s=="string"?s:e.compact?JSON.stringify(s):JSON.stringify(s,null,e.indent);case"xml":return new sn({ignoreAttributes:!1,attributeNamePrefix:e.xmlAttributePrefix,textNodeName:e.xmlContentName,format:e.prettyPrint||!e.compact,indentBy:" ".repeat(e.indent)}).build(s);case"ini":return!s||typeof s!="object"||Array.isArray(s)?"":Rs.stringify(s);case"csv":return Ip(s,e.csvDelimiter);case"toml":return!s||typeof s!="object"||Array.isArray(s)?"":cn(s);default:throw new Error(`Unknown output format: ${e.outputFormat}`)}}var Lp={name:"yq",summary:"command-line YAML/XML/INI/CSV/TOML processor",usage:"yq [OPTIONS] [FILTER] [FILE]",description:`yq uses jq-style expressions to query and transform data in various formats. +Supports YAML, JSON, XML, INI, CSV, and TOML with automatic format conversion. + +EXAMPLES: + # Extract a value from YAML + yq '.name' config.yaml + yq '.users[0].email' data.yaml + + # Filter arrays + yq '.items[] | select(.active == true)' data.yaml + yq '[.users[] | select(.age > 30)]' users.yaml + + # Transform data + yq '.users | map({name, email})' data.yaml + yq '.items | sort_by(.price) | reverse' products.yaml + + # Modify file in-place + yq -i '.version = "2.0"' config.yaml + + # Read JSON, output YAML + yq -p json '.' config.json + + # Read YAML, output JSON + yq -o json '.' config.yaml + yq -o json -c '.' config.yaml # compact JSON + + # Parse TOML config files + yq '.package.name' Cargo.toml + yq -o json '.' pyproject.toml + + # Parse XML (attributes use +@ prefix, text uses +content) + yq -p xml '.root.items.item[].name' data.xml + yq -p xml '.root.user["+@id"]' data.xml # XML attributes + + # Parse INI config files + yq -p ini '.database.host' config.ini + yq -p ini '.server' config.ini -o json + + # Parse CSV/TSV (auto-detects delimiter) + yq -p csv '.[0].name' data.csv + yq '.[0].name' data.tsv # auto-detected as CSV + yq -p csv '[.[] | select(.category == "A")]' data.csv + + # Extract front-matter from markdown/content files + yq --front-matter '.title' post.md + + # Convert between formats + yq -p json -o csv '.users' data.json # JSON to CSV + yq -p csv -o yaml '.' data.csv # CSV to YAML + yq -p ini -o json '.' config.ini # INI to JSON + yq -p xml -o json '.' data.xml # XML to JSON + yq -o toml '.' config.yaml # YAML to TOML + + # Common jq functions work in yq: + yq 'keys' data.yaml # get object keys + yq 'length' data.yaml # array/string length + yq '.items | first' data.yaml # first element + yq '.items | last' data.yaml # last element + yq '.nums | add' data.yaml # sum numbers + yq '.nums | min' data.yaml # minimum + yq '.nums | max' data.yaml # maximum + yq '.items | unique' data.yaml # unique values + yq '.items | group_by(.type)' data.yaml`,options:["-p, --input-format=FMT input format: yaml (default), xml, json, ini, csv, toml","-o, --output-format=FMT output format: yaml (default), json, xml, ini, csv, toml","-i, --inplace modify file in-place","-r, --raw-output output strings without quotes (json only)","-c, --compact compact output (json only)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-f, --front-matter extract and process front-matter only","-P, --prettyPrint pretty print output","-I, --indent=N set indent level (default: 2)"," --xml-attribute-prefix=STR XML attribute prefix (default: +@)"," --xml-content-name=STR XML text content name (default: +content)"," --csv-delimiter=CHAR CSV delimiter (default: auto-detect)"," --csv-header CSV has header row (default: true)"," --help display this help and exit"]};function qp(s){let e={...ql,exitStatus:!1,slurp:!1,nullInput:!1,joinOutput:!1,inplace:!1,frontMatter:!1},t=!1,n=".",i=!1,r=[];for(let o=0;oZi(e.requireDefenseContext,"yq",u,f);if(zi(s))return Xi(Lp);let n=qp(s);if("exitCode"in n)return n;let{options:i,filter:r,files:o,inputFormatExplicit:a}=n;if(!a&&o.length>0&&o[0]!=="-"){let u=Pl(o[0]);u&&(i.inputFormat=u)}if(i.inplace&&(o.length===0||o[0]==="-"))return{stdout:"",stderr:`yq: -i/--inplace requires a file argument +`,exitCode:1};let l,c;if(i.nullInput)l="";else if(o.length===0||o.length===1&&o[0]==="-")l=Hi(e.stdin);else try{let u=e.fs.resolvePath(e.cwd,o[0]);c=u,l=await t("file read",()=>e.fs.readFile(u))}catch(u){if(u instanceof Bs)throw u;return{stdout:"",stderr:`yq: ${o[0]}: No such file or directory +`,exitCode:2}}try{let u=er(r),f,h={limits:e.limits?{maxIterations:e.limits.maxJqIterations}:void 0,env:e.env,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext};if(i.nullInput)f=Be(null,u,h);else if(i.frontMatter){let y=xl(l);if(!y)return{stdout:"",stderr:`yq: no front-matter found +`,exitCode:1};f=Be(y.frontMatter,u,h)}else if(i.slurp){let y;i.inputFormat==="yaml"?y=_l(l):y=[Gi(l,i)],f=Be(y,u,h)}else{let y=Gi(l,i);f=Be(y,u,h)}let p=f.map(y=>Ml(y,i)),g=i.joinOutput?"":` +`,d=p.filter(y=>y!=="").join(g),m=d?i.joinOutput?d:`${d} +`:"";if(i.inplace&&c)return await t("in-place write",()=>e.fs.writeFile(c,m)),{stdout:"",stderr:"",exitCode:0};let b=i.exitStatus&&(f.length===0||f.every(y=>y==null||y===!1))?1:0;return{stdout:m,stderr:"",exitCode:b}}catch(u){if(u instanceof Bs)throw u;if(u instanceof Vs)return{stdout:"",stderr:`yq: ${js(u.message)} +`,exitCode:Vs.EXIT_CODE};let f=js(u.message);return f.includes("Unknown function")?{stdout:"",stderr:`yq: error: ${f} +`,exitCode:3}:{stdout:"",stderr:`yq: parse error: ${f} +`,exitCode:5}}}},By={name:"yq",flags:[{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{Fy as a,By as b}; +/*! Bundled license information: + +smol-toml/dist/error.js: +smol-toml/dist/util.js: +smol-toml/dist/date.js: +smol-toml/dist/primitive.js: +smol-toml/dist/extract.js: +smol-toml/dist/struct.js: +smol-toml/dist/parse.js: +smol-toml/dist/stringify.js: +smol-toml/dist/index.js: + (*! + * Copyright (c) Squirrel Chat et al., All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *) +*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-KCMUAACL.js b/packages/just-bash/dist/bin/chunks/chunk-KCMUAACL.js deleted file mode 100644 index bcacbe6f..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-KCMUAACL.js +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env node -import{a as A}from"./chunk-JBABAK44.js";import{a as S,b as H}from"./chunk-GTNBSMZR.js";var b=class{diff(e,n,t={}){let i;typeof t=="function"?(i=t,t={}):"callback"in t&&(i=t.callback);let d=this.castInput(e,t),o=this.castInput(n,t),s=this.removeEmpty(this.tokenize(d,t)),a=this.removeEmpty(this.tokenize(o,t));return this.diffWithOptionsObj(s,a,t,i)}diffWithOptionsObj(e,n,t,i){var d;let o=l=>{if(l=this.postProcess(l,t),i){setTimeout(function(){i(l)},0);return}else return l},s=n.length,a=e.length,u=1,r=s+a;t.maxEditLength!=null&&(r=Math.min(r,t.maxEditLength));let g=(d=t.timeout)!==null&&d!==void 0?d:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],C=this.extractCommon(m[0],n,e,0,t);if(m[0].oldPos+1>=a&&C+1>=s)return o(this.buildValues(m[0].lastComponent,n,e));let P=-1/0,x=1/0,L=()=>{for(let l=Math.max(P,-u);l<=Math.min(x,u);l+=2){let c,h=m[l-1],p=m[l+1];h&&(m[l-1]=void 0);let y=!1;if(p){let k=p.oldPos-l;y=p&&0<=k&&k=a&&C+1>=s)return o(this.buildValues(c.lastComponent,n,e))||!0;m[l]=c,c.oldPos+1>=a&&(x=Math.min(x,l-1)),C+1>=s&&(P=Math.max(P,l+1))}u++};if(i)(function l(){setTimeout(function(){if(u>r||Date.now()>w)return i(void 0);L()||l()},0)})();else for(;u<=r&&Date.now()<=w;){let l=L();if(l)return l}}addToPath(e,n,t,i,d){let o=e.lastComponent;return o&&!d.oneChangePerToken&&o.added===n&&o.removed===t?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:t,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:t,previousComponent:o}}}extractCommon(e,n,t,i,d){let o=n.length,s=t.length,a=e.oldPos,u=a-i,r=0;for(;u+1w.length?C:w}),r.value=this.join(g)}else r.value=this.join(n.slice(a,a+r.count));a+=r.count,r.added||(u+=r.count)}}return i}};var D=class extends b{constructor(){super(...arguments),this.tokenize=O}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(` -`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(` -`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(` -`)&&(e=e.slice(0,-1)),n.endsWith(` -`)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},j=new D;function I(f,e,n){return j.diff(f,e,n)}function O(f,e){e.stripTrailingCr&&(f=f.replace(/\r\n/g,` -`));let n=[],t=f.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let i=0;i"u"&&(s.context=4);let a=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){let{callback:r}=s;I(n,t,Object.assign(Object.assign({},s),{callback:g=>{let w=u(g);r(w)}}))}else return u(I(n,t,s));function u(r){if(!r)return;r.push({value:"",lines:[]});function g(l){return l.map(function(c){return" "+c})}let w=[],m=0,C=0,P=[],x=1,L=1;for(let l=0;l0?g(p.lines.slice(-a)):[],m-=P.length,C-=P.length)}for(let p of h)P.push((c.added?"+":"-")+p);c.added?L+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&l1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return f.map(t=>E(t,e)).join(` -`)}let n=[];e.includeIndex&&f.oldFileName==f.newFileName&&n.push("Index: "+f.oldFileName),e.includeUnderline&&n.push("==================================================================="),e.includeFileHeaders&&(n.push("--- "+f.oldFileName+(typeof f.oldHeader>"u"?"":" "+f.oldHeader)),n.push("+++ "+f.newFileName+(typeof f.newHeader>"u"?"":" "+f.newHeader)));for(let t=0;t{s(a?E(a,o.headerOptions):void 0)}}))}else{let s=F(f,e,n,t,i,d,o);return s?E(s,o?.headerOptions):void 0}}function W(f){let e=f.endsWith(` -`),n=f.split(` -`).map(t=>t+` -`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}var M={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},z={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},Q={name:"diff",async execute(f,e){if(H(f))return S(M);let n=A("diff",f,z);if(!n.ok)return n.error;let t=n.result.flags.brief,i=n.result.flags.reportSame,d=n.result.flags.ignoreCase,o=n.result.positional;if(n.result.flags.unified,o.length<2)return{stdout:"",stderr:`diff: missing operand -`,exitCode:2};let s,a,[u,r]=o;try{s=u==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory -`,exitCode:2}}try{a=r==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,r))}catch{return{stdout:"",stderr:`diff: ${r}: No such file or directory -`,exitCode:2}}let g=s,w=a;return d&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?i?{stdout:`Files ${u} and ${r} are identical -`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:t?{stdout:`Files ${u} and ${r} differ -`,stderr:"",exitCode:1}:{stdout:T(u,r,s,a,"","",{context:3}),stderr:"",exitCode:1}}},Z={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{Q as a,Z as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-KFMPGSUT.js b/packages/just-bash/dist/bin/chunks/chunk-KFMPGSUT.js new file mode 100644 index 00000000..e5b0a310 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-KFMPGSUT.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as y}from"./chunk-VZK4FHWJ.js";import{a as C}from"./chunk-NE4R2FVV.js";import{a as F,b as x}from"./chunk-MUFNRCMY.js";var H={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},I={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};function v(t,e,o){return e?o?t.split(e):t.split(e).filter(n=>n.length>0):o?t.split(/[ \t]/):t.split(/[ \t]+/).filter(n=>n.length>0)}function T(t){let e=[];for(let o of t)for(let n=0;ne[n])&&(e[n]=l)}return e}function W(t,e){if(t.length===0)return"";let o=T(t),n=[];for(let l of t){let c=[];for(let s=0;sa.length)),l=o.length,c=n+l,s=Math.max(1,Math.floor((e+l)/c)),p=Math.ceil(t.length/s),d=[];for(let a=0;a=t.length?i.push(t[m]):i.push(t[m].padEnd(n)))}d.push(i.join(o))}return d.join(` +`)}var S={name:"column",execute:async(t,e)=>{if(x(t))return F(H);let o=C("column",t,I);if(!o.ok)return o.error;let{table:n,separator:l,outputSep:c,width:s,noMerge:p}=o.result.flags,d=o.result.positional,a=c??" ",i;if(d.length===0)i=y(e.stdin)??"";else{let u=[];for(let f of d)if(f==="-")u.push(y(e.stdin)??"");else{let w=e.fs.resolvePath(e.cwd,f),b=await e.fs.readFile(w);if(b===null)return{exitCode:1,stdout:"",stderr:`column: ${f}: No such file or directory +`};u.push(b)}i=u.join("")}if(i===""||i.trim()==="")return{exitCode:0,stdout:"",stderr:""};let r=i.split(` +`);i.endsWith(` +`)&&r[r.length-1]===""&&r.pop();let g=r.filter(u=>u.trim().length>0),h;if(n){let u=g.map(f=>v(f,l,p));h=W(u,a)}else{let u=[];for(let f of g){let w=v(f,l,p);u.push(...w)}h=j(u,s,a)}return h.length>0&&(h+=` +`),{exitCode:0,stdout:h,stderr:""}}},L={name:"column",flags:[{flag:"-t",type:"boolean"},{flag:"-s",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-n",type:"boolean"}],stdinType:"text",needsFiles:!0};export{S as a,L as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-KGOUQS5A.js b/packages/just-bash/dist/bin/chunks/chunk-KGOUQS5A.js deleted file mode 100644 index 2338f9c1..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-KGOUQS5A.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -var h=Object.create;var e=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(a&&(b=a(a=0)),b);var o=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),p=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},g=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of j(b))!l.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=i(b,d))||f.enumerable});return a};var q=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a)),r=a=>g(e({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-KI54R2QB.js b/packages/just-bash/dist/bin/chunks/chunk-KI54R2QB.js new file mode 100644 index 00000000..9122906f --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-KI54R2QB.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +var e={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},t={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},s={name:"true",flags:[]},r={name:"false",flags:[]};export{e as a,t as b,s as c,r as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-KRRM5UCC.js b/packages/just-bash/dist/bin/chunks/chunk-KRRM5UCC.js new file mode 100644 index 00000000..1149ea8a --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-KRRM5UCC.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{b as e}from"./chunk-HL4ZS7TX.js";var i=globalThis.setTimeout.bind(globalThis),r=globalThis.clearTimeout.bind(globalThis),s=globalThis.setInterval.bind(globalThis),T=globalThis.clearInterval.bind(globalThis);function l(t){return typeof t!="function"?t:e.bindCurrentContext(t)}var b=((t,n,...o)=>i(l(t),n,...o)),u=r;export{b as a,u as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-KUMHQGUR.js b/packages/just-bash/dist/bin/chunks/chunk-KUMHQGUR.js new file mode 100644 index 00000000..43c9da2a --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-KUMHQGUR.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as e,b as a}from"./chunk-MUFNRCMY.js";var t={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},s={name:"clear",async execute(r,c){return a(r)?e(t):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}},o={name:"clear",flags:[]};export{s as a,o as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-L24QXM5S.js b/packages/just-bash/dist/bin/chunks/chunk-L24QXM5S.js new file mode 100644 index 00000000..4098b674 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-L24QXM5S.js @@ -0,0 +1,34 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{f as G}from"./chunk-MLUOPG3W.js";import{a as q}from"./chunk-3MRB66F4.js";import{a as z,b as E,c as U}from"./chunk-ALVEEXFD.js";import{a as $}from"./chunk-IEXQTXU5.js";import{a as L}from"./chunk-VZK4FHWJ.js";import{a as B,b as _,c as D}from"./chunk-MUFNRCMY.js";var H=G({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),M=class{types;constructor(){this.types=new Map(Object.entries(H).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let a=this.types.get(s)||{extensions:[],globs:[]};a.extensions.push(...i.extensions),a.globs.push(...i.globs),this.types.set(s,a)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let a=i.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${a}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function V(){let e=[];for(let[t,n]of Object.entries(H).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(` +`)} +`}function Z(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function se(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function ne(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e} +`,exitCode:1}}function J(e){return null}var Y=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:J},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:J},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:se,validate:ne},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",ignored:!0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],re=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),ie=new Set(["n","--line-number"]);function le(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function oe(e,t,n){let s=e[t];for(let r of Y){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=P(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function ae(e){return Y.find(t=>t.short===e)}function P(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}if(t.ignored||!t.target)return;let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function ce(e,t){let n=e[t];if(n==="--sort"&&t+1=e.length)return{success:!1,error:D("rg",`-${f}`)};let h=P(t,b,e[c+1]);if(h)return{success:!1,error:h};c++,m=!0;continue}}let x=re.get(f);if(x){x(t);continue}if(f.startsWith("--"))return{success:!1,error:D("rg",f)};if(f.length===1)return{success:!1,error:D("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=o:s.push(o)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:s,explicitLineNumbers:a}}import{gunzipSync as he}from"node:zlib";var T=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(` +`);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let a=!1;r.startsWith("/")?(a=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(a=!0);let c=this.patternToRegex(r,a);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:a})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i=2&&e[0]===31&&e[1]===139}function pe(e){let t=!1;for(let n=0;nh.length>0);l.push(...b)}catch{return{stdout:"",stderr:`rg: ${f}: No such file or directory +`,exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given +`,exitCode:2};let i=s.length===0?["."]:s,a=me(n,l),c,o;try{let f=de(l,n,a);c=f.regex,o=f.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${l.join(", ")} +`,exitCode:2}}let u=null;n.noIgnore||(u=await A(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new M;for(let f of n.typeClear)d.clearType(f);for(let f of n.typeAdd)d.addType(f);let{files:p,singleExplicitFile:g}=await Q(t,i,n,u,d);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let w=!n.noFilename&&(n.withFilename||!g||p.length>1),m=n.lineNumber;return r||(g&&p.length===1&&(m=!1),n.onlyMatching&&(m=!1)),we(t,p,c,n,w,m,o)}function me(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function de(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),E(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function Q(e,t,n,s,r){let l=[],i=0,a=0;for(let o of t){let u=e.fs.resolvePath(e.cwd,o);try{let d=await e.fs.stat(u);if(d.isFile){if(i++,n.maxFilesize>0&&d.size>n.maxFilesize)continue;te(o,n,s,u,r)&&l.push(o)}else d.isDirectory&&(a++,await ee(e,o,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&a===0}}async function ee(e,t,n,s,r,l,i,a){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(o=>({name:o,isFile:void 0}));for(let o of c){let u=o.name;if(!r.noIgnore&&k.isCommonIgnored(u))continue;let d=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,g=e.fs.resolvePath(n,u),w,m,f=!1;if(o.isFile!==void 0&&"isDirectory"in o){let h=o;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let y=await e.fs.stat(g);w=y.isFile,m=y.isDirectory}catch{continue}else w=h.isFile,m=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(g):await e.fs.stat(g);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let y=f&&r.followSymlinks?await e.fs.stat(g):h;w=y.isFile,m=y.isDirectory}catch{continue}if(!l?.matches(g,m)&&!(d&&!r.hidden&&!l?.isWhitelisted(g,m))){if(m)await ee(e,p,g,s+1,r,l,i,a);else if(w){if(r.maxFilesize>0)try{if((await e.fs.stat(g)).size>r.maxFilesize)continue}catch{continue}te(p,r,l,g,i)&&a.push(p)}}}}catch{}}}function te(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,a=t.globs.filter(o=>!o.startsWith("!")),c=t.globs.filter(o=>o.startsWith("!")).map(o=>o.slice(1));if(a.length>0){let o=!1;for(let u of a)if(v(l,u,i)||v(e,u,i)){o=!0;break}if(!o)return!1}for(let o of c)if(o.startsWith("/")){let u=o.slice(1);if(v(e,u,i))return!1}else if(v(l,o,i)||v(e,o,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),a=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let o of i)if(v(l,o,!0)||v(e,o,!0)){c=!0;break}if(!c)return!1}for(let c of a)if(c.startsWith("/")){let o=c.slice(1);if(v(e,o,!0))return!1}else if(v(l,c,!0)||v(e,c,!0))return!1}return!0}function v(e,t,n=!1){let s="^";for(let r=0;ro+a).join(""),stderr:"",exitCode:0}}function ye(e,t){if(t.length===0)return!0;for(let n of t)if(v(e,n,!1))return!0;return!1}async function be(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(ye(i,s.preprocessorGlobs)){let a=await e.exec(q([s.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(a.exitCode===0&&a.stdout){let c=L(a.stdout),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await e.fs.readFileBuffer(t);if(ge(i))try{let a=he(i),c=new TextDecoder().decode(a),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}catch{return null}}let r=await e.fs.readFile(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function we(e,t,n,s,r,l,i){let a="",c=!1,o=[],u=0,d=0,p=0,g=50;e:for(let f=0;f{let y=e.fs.resolvePath(e.cwd,h),F=await be(e,y,h,s);if(!F)return null;let{content:C,isBinary:N}=F;if(p+=C.length,N&&!s.searchBinary)return null;let W=r&&!s.heading?h:"",S=z(C,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:W,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?U(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&S.matched?{file:h,result:S,content:C,isBinary:!1}:{file:h,result:S}}));for(let h of b){if(!h)continue;let{file:y,result:F}=h;if(F.matched){if(c=!0,d++,u+=F.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let C=h.content||"";o.push(JSON.stringify({type:"begin",data:{path:{text:y}}}));let N=C.split(` +`);n.lastIndex=0;let W=0;for(let S=0;S0){let I={type:"match",data:{path:{text:y},lines:{text:`${j} +`},line_number:S+1,absolute_offset:W,submatches:O}};o.push(JSON.stringify(I))}W+=j.length+1}o.push(JSON.stringify({type:"end",data:{path:{text:y},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:C.length,bytes_printed:0,matched_lines:F.matchCount,matches:F.matchCount}}}))}else if(s.filesWithMatches){let C=s.nullSeparator?"\0":` +`;a+=`${y}${C}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(a+=`${y} +`),a+=F.output)}else if(s.filesWithoutMatch){let C=s.nullSeparator?"\0":` +`;a+=`${y}${C}`}else s.includeZero&&(s.count||s.countMatches)&&(a+=F.output)}}s.json&&(o.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:d,bytes_searched:p,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${o.join(` +`)} +`);let w=s.quiet&&!s.json?"":a;if(s.stats&&!s.json){let f=["",`${u} matches`,`${u} matched lines`,`${d} files contained matches`,`${t.length} files searched`,`${p} bytes searched`].join(` +`);w+=`${f} +`}let m;return s.filesWithoutMatch?m=a.length>0?0:1:m=c?0:1,{stdout:w,stderr:"",exitCode:m}}var ve={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern. +Unlike grep, rg is recursive by default and respects .gitignore files. + +EXAMPLES: + rg foo Search for 'foo' in current directory + rg foo src/ Search in src/ directory + rg -i foo Case-insensitive search + rg -w foo Match whole words only + rg -t js foo Search only JavaScript files + rg -g '*.ts' foo Search files matching glob + rg --hidden foo Include hidden files + rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Ge={name:"rg",async execute(e,t){if(_(e))return B(ve);if(e.includes("--type-list"))return{stdout:V(),stderr:"",exitCode:0};let n=K(e);return n.success?X({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},qe={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{Ge as a,qe as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-L6XUBS6H.js b/packages/just-bash/dist/bin/chunks/chunk-L6XUBS6H.js deleted file mode 100644 index 9070f8f3..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-L6XUBS6H.js +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env node -import{a as Pi,b as Ui,c as Xa}from"./chunk-GTNBSMZR.js";import{c as N,e as dl}from"./chunk-KGOUQS5A.js";var Mt=N((vf,Vi)=>{"use strict";Vi.exports=_t;_t.CAPTURING_PHASE=1;_t.AT_TARGET=2;_t.BUBBLING_PHASE=3;function _t(e,t){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=_t.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,e&&(this.type=e),t)for(var r in t)this[r]=t[r]}_t.prototype=Object.create(Object.prototype,{constructor:{value:_t},stopPropagation:{value:function(){this._propagationStopped=!0}},stopImmediatePropagation:{value:function(){this._propagationStopped=!0,this._immediatePropagationStopped=!0}},preventDefault:{value:function(){this.cancelable&&(this.defaultPrevented=!0)}},initEvent:{value:function(t,r,a){this._initialized=!0,!this._dispatching&&(this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=t,this.bubbles=r,this.cancelable=a)}}})});var Ya=N((Tf,Gi)=>{"use strict";var ji=Mt();Gi.exports=Ka;function Ka(){ji.call(this),this.view=null,this.detail=0}Ka.prototype=Object.create(ji.prototype,{constructor:{value:Ka},initUIEvent:{value:function(e,t,r,a,s){this.initEvent(e,t,r),this.view=a,this.detail=s}}})});var $a=N((yf,Wi)=>{"use strict";var zi=Ya();Wi.exports=Qa;function Qa(){zi.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}Qa.prototype=Object.create(zi.prototype,{constructor:{value:Qa},initMouseEvent:{value:function(e,t,r,a,s,o,x,m,h,g,v,ne,se,u,be){switch(this.initEvent(e,t,r,a,s),this.screenX=o,this.screenY=x,this.clientX=m,this.clientY=h,this.ctrlKey=g,this.altKey=v,this.shiftKey=ne,this.metaKey=se,this.button=u,u){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=be}},getModifierState:{value:function(e){switch(e){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}}}})});var Xr=N((Nf,Ki)=>{"use strict";Ki.exports=Wr;var hl=1,pl=3,ml=4,gl=5,bl=7,El=8,_l=9,vl=11,Tl=12,yl=13,Nl=14,wl=15,Sl=17,Al=18,Cl=19,Dl=20,kl=21,Ll=22,Ml=23,Rl=24,Il=25,Ol=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],ql=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],Xi={INDEX_SIZE_ERR:hl,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:pl,WRONG_DOCUMENT_ERR:ml,INVALID_CHARACTER_ERR:gl,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:bl,NOT_FOUND_ERR:El,NOT_SUPPORTED_ERR:_l,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:vl,SYNTAX_ERR:Tl,INVALID_MODIFICATION_ERR:yl,NAMESPACE_ERR:Nl,INVALID_ACCESS_ERR:wl,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:Sl,SECURITY_ERR:Al,NETWORK_ERR:Cl,ABORT_ERR:Dl,URL_MISMATCH_ERR:kl,QUOTA_EXCEEDED_ERR:Ll,TIMEOUT_ERR:Ml,INVALID_NODE_TYPE_ERR:Rl,DATA_CLONE_ERR:Il};function Wr(e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=e,this.message=ql[e],this.name=Ol[e]}Wr.prototype.__proto__=Error.prototype;for(zr in Xi)Za={value:Xi[zr]},Object.defineProperty(Wr,zr,Za),Object.defineProperty(Wr.prototype,zr,Za);var Za,zr});var Kr=N(Yi=>{Yi.isApiWritable=!globalThis.__domino_frozen__});var ee=N(V=>{"use strict";var J=Xr(),ae=J,Hl=Kr().isApiWritable;V.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};V.IndexSizeError=function(){throw new J(ae.INDEX_SIZE_ERR)};V.HierarchyRequestError=function(){throw new J(ae.HIERARCHY_REQUEST_ERR)};V.WrongDocumentError=function(){throw new J(ae.WRONG_DOCUMENT_ERR)};V.InvalidCharacterError=function(){throw new J(ae.INVALID_CHARACTER_ERR)};V.NoModificationAllowedError=function(){throw new J(ae.NO_MODIFICATION_ALLOWED_ERR)};V.NotFoundError=function(){throw new J(ae.NOT_FOUND_ERR)};V.NotSupportedError=function(){throw new J(ae.NOT_SUPPORTED_ERR)};V.InvalidStateError=function(){throw new J(ae.INVALID_STATE_ERR)};V.SyntaxError=function(){throw new J(ae.SYNTAX_ERR)};V.InvalidModificationError=function(){throw new J(ae.INVALID_MODIFICATION_ERR)};V.NamespaceError=function(){throw new J(ae.NAMESPACE_ERR)};V.InvalidAccessError=function(){throw new J(ae.INVALID_ACCESS_ERR)};V.TypeMismatchError=function(){throw new J(ae.TYPE_MISMATCH_ERR)};V.SecurityError=function(){throw new J(ae.SECURITY_ERR)};V.NetworkError=function(){throw new J(ae.NETWORK_ERR)};V.AbortError=function(){throw new J(ae.ABORT_ERR)};V.UrlMismatchError=function(){throw new J(ae.URL_MISMATCH_ERR)};V.QuotaExceededError=function(){throw new J(ae.QUOTA_EXCEEDED_ERR)};V.TimeoutError=function(){throw new J(ae.TIMEOUT_ERR)};V.InvalidNodeTypeError=function(){throw new J(ae.INVALID_NODE_TYPE_ERR)};V.DataCloneError=function(){throw new J(ae.DATA_CLONE_ERR)};V.nyi=function(){throw new Error("NotYetImplemented")};V.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};V.assert=function(e,t){if(!e)throw new Error("Assertion failed: "+(t||"")+` -`+new Error().stack)};V.expose=function(e,t){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],writable:Hl})};V.merge=function(e,t){for(var r in t)e[r]=t[r]};V.documentOrder=function(e,t){return 3-(e.compareDocumentPosition(t)&6)};V.toASCIILowerCase=function(e){return e.replace(/[A-Z]+/g,function(t){return t.toLowerCase()})};V.toASCIIUpperCase=function(e){return e.replace(/[a-z]+/g,function(t){return t.toUpperCase()})}});var Ja=N((Af,$i)=>{"use strict";var vt=Mt(),Fl=$a(),Bl=ee();$i.exports=Qi;function Qi(){}Qi.prototype={addEventListener:function(t,r,a){if(r){a===void 0&&(a=!1),this._listeners||(this._listeners=Object.create(null)),this._listeners[t]||(this._listeners[t]=[]);for(var s=this._listeners[t],o=0,x=s.length;o=0&&(a(s[x],t),!t._propagationStopped);x--);if(t._propagationStopped||(t.eventPhase=vt.AT_TARGET,a(this,t)),t.bubbles&&!t._propagationStopped){t.eventPhase=vt.BUBBLING_PHASE;for(var m=0,h=s.length;m{"use strict";var We=ee(),Se=Zi.exports={valid:function(e){return We.assert(e,"list falsy"),We.assert(e._previousSibling,"previous falsy"),We.assert(e._nextSibling,"next falsy"),!0},insertBefore:function(e,t){We.assert(Se.valid(e)&&Se.valid(t));var r=e,a=e._previousSibling,s=t,o=t._previousSibling;r._previousSibling=o,a._nextSibling=s,o._nextSibling=r,s._previousSibling=a,We.assert(Se.valid(e)&&Se.valid(t))},replace:function(e,t){We.assert(Se.valid(e)&&(t===null||Se.valid(t))),t!==null&&Se.insertBefore(t,e),Se.remove(e),We.assert(Se.valid(e)&&(t===null||Se.valid(t)))},remove:function(e){We.assert(Se.valid(e));var t=e._previousSibling;if(t!==e){var r=e._nextSibling;t._nextSibling=r,r._previousSibling=t,e._previousSibling=e._nextSibling=e,We.assert(Se.valid(e))}}}});var tn=N((Df,ss)=>{"use strict";ss.exports={serializeOne:Wl,\u0275escapeMatchingClosingTag:as,\u0275escapeClosingCommentTag:ns,\u0275escapeProcessingInstructionContent:is};var rs=ee(),Tt=rs.NAMESPACE,Ji={STYLE:!0,SCRIPT:!0,XMP:!0,IFRAME:!0,NOEMBED:!0,NOFRAMES:!0,PLAINTEXT:!0},Pl={area:!0,base:!0,basefont:!0,bgsound:!0,br:!0,col:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Ul={},es=/[&<>\u00A0]/g,ts=/[&"<>\u00A0]/g;function Vl(e){return es.test(e)?e.replace(es,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case"\xA0":return" "}}):e}function jl(e){return ts.test(e)?e.replace(ts,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"\xA0":return" "}}):e}function Gl(e){var t=e.namespaceURI;return t?t===Tt.XML?"xml:"+e.localName:t===Tt.XLINK?"xlink:"+e.localName:t===Tt.XMLNS?e.localName==="xmlns"?"xmlns":"xmlns:"+e.localName:e.name:e.localName}function as(e,t){let r="/;function ns(e){return zl.test(e)?e.replace(/(--\!?)>/g,"$1>"):e}function is(e){return e.includes(">")?e.replaceAll(">",">"):e}function Wl(e,t){var r="";switch(e.nodeType){case 1:var a=e.namespaceURI,s=a===Tt.HTML,o=s||a===Tt.SVG||a===Tt.MATHML?e.localName:e.tagName;r+="<"+o;for(var x=0,m=e._numattrs;x"}break;case 3:case 4:var v;t.nodeType===1&&t.namespaceURI===Tt.HTML?v=t.tagName:v="",Ji[v]||v==="NOSCRIPT"&&t.ownerDocument._scripting_enabled?r+=e.data:r+=Vl(e.data);break;case 8:r+="";break;case 7:let ne=is(e.data);r+="";break;case 10:r+="";break;default:rs.InvalidStateError()}return r}});var xe=N((kf,fs)=>{"use strict";fs.exports=K;var xs=Ja(),Yr=en(),os=tn(),j=ee();function K(){xs.call(this),this.parentNode=null,this._nextSibling=this._previousSibling=this,this._index=void 0}var _e=K.ELEMENT_NODE=1,rn=K.ATTRIBUTE_NODE=2,Qr=K.TEXT_NODE=3,Xl=K.CDATA_SECTION_NODE=4,Kl=K.ENTITY_REFERENCE_NODE=5,an=K.ENTITY_NODE=6,cs=K.PROCESSING_INSTRUCTION_NODE=7,ls=K.COMMENT_NODE=8,nr=K.DOCUMENT_NODE=9,Ae=K.DOCUMENT_TYPE_NODE=10,lt=K.DOCUMENT_FRAGMENT_NODE=11,nn=K.NOTATION_NODE=12,sn=K.DOCUMENT_POSITION_DISCONNECTED=1,on=K.DOCUMENT_POSITION_PRECEDING=2,cn=K.DOCUMENT_POSITION_FOLLOWING=4,us=K.DOCUMENT_POSITION_CONTAINS=8,ln=K.DOCUMENT_POSITION_CONTAINED_BY=16,un=K.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;K.prototype=Object.create(xs.prototype,{baseURI:{get:j.nyi},parentElement:{get:function(){return this.parentNode&&this.parentNode.nodeType===_e?this.parentNode:null}},hasChildNodes:{value:j.shouldOverride},firstChild:{get:j.shouldOverride},lastChild:{get:j.shouldOverride},isConnected:{get:function(){let e=this;for(;e!=null;){if(e.nodeType===K.DOCUMENT_NODE)return!0;e=e.parentNode,e!=null&&e.nodeType===K.DOCUMENT_FRAGMENT_NODE&&(e=e.host)}return!1}},previousSibling:{get:function(){var e=this.parentNode;return!e||this===e.firstChild?null:this._previousSibling}},nextSibling:{get:function(){var e=this.parentNode,t=this._nextSibling;return!e||t===e.firstChild?null:t}},textContent:{get:function(){return null},set:function(e){}},innerText:{get:function(){return null},set:function(e){}},_countChildrenOfType:{value:function(e){for(var t=0,r=this.firstChild;r!==null;r=r.nextSibling)r.nodeType===e&&t++;return t}},_ensureInsertValid:{value:function(t,r,a){var s=this,o,x;if(!t.nodeType)throw new TypeError("not a node");switch(s.nodeType){case nr:case lt:case _e:break;default:j.HierarchyRequestError()}switch(t.isAncestor(s)&&j.HierarchyRequestError(),(r!==null||!a)&&r.parentNode!==s&&j.NotFoundError(),t.nodeType){case lt:case Ae:case _e:case Qr:case cs:case ls:break;default:j.HierarchyRequestError()}if(s.nodeType===nr)switch(t.nodeType){case Qr:j.HierarchyRequestError();break;case lt:switch(t._countChildrenOfType(Qr)>0&&j.HierarchyRequestError(),t._countChildrenOfType(_e)){case 0:break;case 1:if(r!==null)for(a&&r.nodeType===Ae&&j.HierarchyRequestError(),x=r.nextSibling;x!==null;x=x.nextSibling)x.nodeType===Ae&&j.HierarchyRequestError();o=s._countChildrenOfType(_e),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==_e)&&j.HierarchyRequestError();break;default:j.HierarchyRequestError()}break;case _e:if(r!==null)for(a&&r.nodeType===Ae&&j.HierarchyRequestError(),x=r.nextSibling;x!==null;x=x.nextSibling)x.nodeType===Ae&&j.HierarchyRequestError();o=s._countChildrenOfType(_e),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==_e)&&j.HierarchyRequestError();break;case Ae:if(r===null)s._countChildrenOfType(_e)&&j.HierarchyRequestError();else for(x=s.firstChild;x!==null&&x!==r;x=x.nextSibling)x.nodeType===_e&&j.HierarchyRequestError();o=s._countChildrenOfType(Ae),a?o>0&&j.HierarchyRequestError():(o>1||o===1&&r.nodeType!==Ae)&&j.HierarchyRequestError();break}else t.nodeType===Ae&&j.HierarchyRequestError()}},insertBefore:{value:function(t,r){var a=this;a._ensureInsertValid(t,r,!0);var s=r;return s===t&&(s=t.nextSibling),a.doc.adoptNode(t),t._insertOrReplace(a,s,!1),t}},appendChild:{value:function(e){return this.insertBefore(e,null)}},_appendChild:{value:function(e){e._insertOrReplace(this,null,!1)}},removeChild:{value:function(t){var r=this;if(!t.nodeType)throw new TypeError("not a node");return t.parentNode!==r&&j.NotFoundError(),t.remove(),t}},replaceChild:{value:function(t,r){var a=this;return a._ensureInsertValid(t,r,!1),t.doc!==a.doc&&a.doc.adoptNode(t),t._insertOrReplace(a,r,!0),r}},contains:{value:function(t){return t===null?!1:this===t?!0:(this.compareDocumentPosition(t)&ln)!==0}},compareDocumentPosition:{value:function(t){if(this===t)return 0;if(this.doc!==t.doc||this.rooted!==t.rooted)return sn+un;for(var r=[],a=[],s=this;s!==null;s=s.parentNode)r.push(s);for(s=t;s!==null;s=s.parentNode)a.push(s);if(r.reverse(),a.reverse(),r[0]!==a[0])return sn+un;s=Math.min(r.length,a.length);for(var o=1;o2?v[2]:null):u>2&&h!==null&&Yr.insertBefore(v[2],h),t._childNodes)for(v[0]=r===null?t._childNodes.length:r._index,t._childNodes.splice.apply(t._childNodes,v),x=2;x2?t._firstChild=v[2]:a&&(t._firstChild=null));if(s._childNodes?s._childNodes.length=0:s._firstChild=null,t.rooted)for(t.modify(),x=2;x{"use strict";ds.exports=class extends Array{constructor(t){if(super(t&&t.length||0),t)for(var r in t)this[r]=t[r]}item(t){return this[t]||null}}});var ms=N((Rf,ps)=>{"use strict";function Yl(e){return this[e]||null}function Ql(e){return e||(e=[]),e.item=Yl,e}ps.exports=Ql});var yt=N((If,gs)=>{"use strict";var xn;try{xn=hs()}catch{xn=ms()}gs.exports=xn});var $r=N((Of,_s)=>{"use strict";_s.exports=Es;var bs=xe(),$l=yt();function Es(){bs.call(this),this._firstChild=this._childNodes=null}Es.prototype=Object.create(bs.prototype,{hasChildNodes:{value:function(){return this._childNodes?this._childNodes.length>0:this._firstChild!==null}},childNodes:{get:function(){return this._ensureChildNodes(),this._childNodes}},firstChild:{get:function(){return this._childNodes?this._childNodes.length===0?null:this._childNodes[0]:this._firstChild}},lastChild:{get:function(){var e=this._childNodes,t;return e?e.length===0?null:e[e.length-1]:(t=this._firstChild,t===null?null:t._previousSibling)}},_ensureChildNodes:{value:function(){if(!this._childNodes){var e=this._firstChild,t=e,r=this._childNodes=new $l;if(e)do r.push(t),t=t._nextSibling;while(t!==e);this._firstChild=null}}},removeChildren:{value:function(){for(var t=this.rooted?this.ownerDocument:null,r=this.firstChild,a;r!==null;)a=r,r=a.nextSibling,t&&t.mutateRemove(a),a.parentNode=null;this._childNodes?this._childNodes.length=0:this._firstChild=null,this.modify()}}})});var Zr=N(hn=>{"use strict";hn.isValidName=nu;hn.isValidQName=iu;var Zl=/^[_:A-Za-z][-.:\w]+$/,Jl=/^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/,ir="_A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",sr="-._A-Za-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Nt="["+ir+"]["+sr+"]*",fn=ir+":",dn=sr+":",eu=new RegExp("^["+fn+"]["+dn+"]*$"),tu=new RegExp("^("+Nt+"|"+Nt+":"+Nt+")$"),vs=/[\uD800-\uDB7F\uDC00-\uDFFF]/,Ts=/[\uD800-\uDB7F\uDC00-\uDFFF]/g,ys=/[\uD800-\uDB7F][\uDC00-\uDFFF]/g;ir+="\uD800-\u{EFC00}-\uDFFF";sr+="\uD800-\u{EFC00}-\uDFFF";Nt="["+ir+"]["+sr+"]*";fn=ir+":";dn=sr+":";var ru=new RegExp("^["+fn+"]["+dn+"]*$"),au=new RegExp("^("+Nt+"|"+Nt+":"+Nt+")$");function nu(e){if(Zl.test(e)||eu.test(e))return!0;if(!vs.test(e)||!ru.test(e))return!1;var t=e.match(Ts),r=e.match(ys);return r!==null&&2*r.length===t.length}function iu(e){if(Jl.test(e)||tu.test(e))return!0;if(!vs.test(e)||!au.test(e))return!1;var t=e.match(Ts),r=e.match(ys);return r!==null&&2*r.length===t.length}});var mn=N(pn=>{"use strict";var Ns=ee();pn.property=function(e){if(Array.isArray(e.type)){var t=Object.create(null);e.type.forEach(function(s){t[s.value||s]=s.alias||s});var r=e.missing;r===void 0&&(r=null);var a=e.invalid;return a===void 0&&(a=r),{get:function(){var s=this._getattr(e.name);return s===null?r:(s=t[s.toLowerCase()],s!==void 0?s:a!==null?a:s)},set:function(s){this._setattr(e.name,s)}}}else{if(e.type===Boolean)return{get:function(){return this.hasAttribute(e.name)},set:function(s){s?this._setattr(e.name,""):this.removeAttribute(e.name)}};if(e.type===Number||e.type==="long"||e.type==="unsigned long"||e.type==="limited unsigned long with fallback")return su(e);if(!e.type||e.type===String)return{get:function(){return this._getattr(e.name)||""},set:function(s){e.treatNullAsEmptyString&&s===null&&(s=""),this._setattr(e.name,s)}};if(typeof e.type=="function")return e.type(e.name,e)}throw new Error("Invalid attribute definition")};function su(e){var t;typeof e.default=="function"?t=e.default:typeof e.default=="number"?t=function(){return e.default}:t=function(){Ns.assert(!1,typeof e.default)};var r=e.type==="unsigned long",a=e.type==="long",s=e.type==="limited unsigned long with fallback",o=e.min,x=e.max,m=e.setmin;return o===void 0&&(r&&(o=0),a&&(o=-2147483648),s&&(o=1)),x===void 0&&(r||a||s)&&(x=2147483647),{get:function(){var h=this._getattr(e.name),g=e.float?parseFloat(h):parseInt(h,10);if(h===null||!isFinite(g)||o!==void 0&&gx)return t.call(this);if(r||a||s){if(!/^[ \t\n\f\r]*[-+]?[0-9]/.test(h))return t.call(this);g=g|0}return g},set:function(h){e.float||(h=Math.floor(h)),m!==void 0&&h2147483647?t.call(this):h|0:s?h=h<1||h>2147483647?t.call(this):h|0:a&&(h=h<-2147483648||h>2147483647?t.call(this):h|0),this._setattr(e.name,String(h))}}}pn.registerChangeHandler=function(e,t,r){var a=e.prototype;Object.prototype.hasOwnProperty.call(a,"_attributeChangeHandlers")||(a._attributeChangeHandlers=Object.create(a._attributeChangeHandlers||null)),a._attributeChangeHandlers[t]=r}});var As=N((Ff,Ss)=>{"use strict";Ss.exports=ws;var ou=xe();function ws(e,t){this.root=e,this.filter=t,this.lastModTime=e.lastModTime,this.done=!1,this.cache=[],this.traverse()}ws.prototype=Object.create(Object.prototype,{length:{get:function(){return this.checkcache(),this.done||this.traverse(),this.cache.length}},item:{value:function(e){return this.checkcache(),!this.done&&e>=this.cache.length&&this.traverse(),this.cache[e]}},checkcache:{value:function(){if(this.lastModTime!==this.root.lastModTime){for(var e=this.cache.length-1;e>=0;e--)this[e]=void 0;this.cache.length=0,this.done=!1,this.lastModTime=this.root.lastModTime}}},traverse:{value:function(e){e!==void 0&&e++;for(var t;(t=this.next())!==null;)if(this[this.cache.length]=t,this.cache.push(t),e&&this.cache.length===e)return;this.done=!0}},next:{value:function(){var e=this.cache.length===0?this.root:this.cache[this.cache.length-1],t;for(e.nodeType===ou.DOCUMENT_NODE?t=e.documentElement:t=e.nextElement(this.root);t;){if(this.filter(t))return t;t=t.nextElement(this.root)}return null}}})});var bn=N((Bf,ks)=>{"use strict";var gn=ee();ks.exports=Ds;function Ds(e,t){this._getString=e,this._setString=t,this._length=0,this._lastStringValue="",this._update()}Object.defineProperties(Ds.prototype,{length:{get:function(){return this._length}},item:{value:function(e){var t=Rt(this);return e<0||e>=t.length?null:t[e]}},contains:{value:function(e){e=String(e);var t=Rt(this);return t.indexOf(e)>-1}},add:{value:function(){for(var e=Rt(this),t=0,r=arguments.length;t-1&&e.splice(s,1)}this._update(e)}},toggle:{value:function(t,r){return t=or(t),this.contains(t)?r===void 0||r===!1?(this.remove(t),!1):!0:r===void 0||r===!0?(this.add(t),!0):!1}},replace:{value:function(t,r){String(r)===""&&gn.SyntaxError(),t=or(t),r=or(r);var a=Rt(this),s=a.indexOf(t);if(s<0)return!1;var o=a.indexOf(r);return o<0?a[s]=r:s{"use strict";var Jr=Object.create(null,{location:{get:function(){throw new Error("window.location is not supported.")}}}),lu=function(e,t){return e.compareDocumentPosition(t)},uu=function(e,t){return lu(e,t)&2?1:-1},ta=function(e){for(;(e=e.nextSibling)&&e.nodeType!==1;);return e},Ot=function(e){for(;(e=e.previousSibling)&&e.nodeType!==1;);return e},xu=function(e){if(e=e.firstChild)for(;e.nodeType!==1&&(e=e.nextSibling););return e},fu=function(e){if(e=e.lastChild)for(;e.nodeType!==1&&(e=e.previousSibling););return e},It=function(e){if(!e.parentNode)return!1;var t=e.parentNode.nodeType;return t===1||t===9},Ls=function(e){if(!e)return e;var t=e[0];return t==='"'||t==="'"?(e[e.length-1]===t?e=e.slice(1,-1):e=e.slice(1),e.replace(C.str_escape,function(r){var a=/^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(r);if(!a)return r.slice(1);if(a[2])return"";var s=parseInt(a[1],16);return String.fromCodePoint?String.fromCodePoint(s):String.fromCharCode(s)})):C.ident.test(e)?ut(e):e},ut=function(e){return e.replace(C.escape,function(t){var r=/^\\([0-9A-Fa-f]+)/.exec(t);if(!r)return t[1];var a=parseInt(r[1],16);return String.fromCodePoint?String.fromCodePoint(a):String.fromCharCode(a)})},du=(function(){return Array.prototype.indexOf?Array.prototype.indexOf:function(e,t){for(var r=this.length;r--;)if(this[r]===t)return r;return-1}})(),Rs=function(e,t){var r=C.inside.source.replace(//g,t);return new RegExp(r)},ve=function(e,t,r){return e=e.source,e=e.replace(t,r.source||r),new RegExp(e)},Ms=function(e,t){return e.replace(/^(?:\w+:\/\/|\/+)/,"").replace(/(?:\/+|\/*#.*?)$/,"").split("/",t).join("/")},hu=function(e,t){var r=e.replace(/\s+/g,""),a;return r==="even"?r="2n+0":r==="odd"?r="2n+1":r.indexOf("n")===-1&&(r="0n"+r),a=/^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(r),{group:a[1]==="-"?-(a[2]||1):+(a[2]||1),offset:a[4]?a[3]==="-"?-a[4]:+a[4]:0}},En=function(e,t,r){var a=hu(e),s=a.group,o=a.offset,x=r?fu:xu,m=r?Ot:ta;return function(h){if(It(h))for(var g=x(h.parentNode),v=0;g;){if(t(g,h)&&v++,g===h)return v-=o,s&&v?v%s===0&&v<0==s<0:!v;g=m(g)}}},oe={"*":(function(){return function(){return!0}})(),type:function(e){return e=e.toLowerCase(),function(t){return t.nodeName.toLowerCase()===e}},attr:function(e,t,r,a){return t=Is[t],function(s){var o;switch(e){case"for":o=s.htmlFor;break;case"class":o=s.className,o===""&&s.getAttribute("class")==null&&(o=null);break;case"href":case"src":o=s.getAttribute(e,2);break;case"title":o=s.getAttribute("title")||null;break;case"id":case"lang":case"dir":case"accessKey":case"hidden":case"tabIndex":case"style":if(s.getAttribute){o=s.getAttribute(e);break}default:if(s.hasAttribute&&!s.hasAttribute(e))break;o=s[e]!=null?s[e]:s.getAttribute&&s.getAttribute(e);break}if(o!=null)return o=o+"",a&&(o=o.toLowerCase(),r=r.toLowerCase()),t(o,r)}},":first-child":function(e){return!Ot(e)&&It(e)},":last-child":function(e){return!ta(e)&&It(e)},":only-child":function(e){return!Ot(e)&&!ta(e)&&It(e)},":nth-child":function(e,t){return En(e,function(){return!0},t)},":nth-last-child":function(e){return oe[":nth-child"](e,!0)},":root":function(e){return e.ownerDocument.documentElement===e},":empty":function(e){return!e.firstChild},":not":function(e){var t=vn(e);return function(r){return!t(r)}},":first-of-type":function(e){if(It(e)){for(var t=e.nodeName;e=Ot(e);)if(e.nodeName===t)return;return!0}},":last-of-type":function(e){if(It(e)){for(var t=e.nodeName;e=ta(e);)if(e.nodeName===t)return;return!0}},":only-of-type":function(e){return oe[":first-of-type"](e)&&oe[":last-of-type"](e)},":nth-of-type":function(e,t){return En(e,function(r,a){return r.nodeName===a.nodeName},t)},":nth-last-of-type":function(e){return oe[":nth-of-type"](e,!0)},":checked":function(e){return!!(e.checked||e.selected)},":indeterminate":function(e){return!oe[":checked"](e)},":enabled":function(e){return!e.disabled&&e.type!=="hidden"},":disabled":function(e){return!!e.disabled},":target":function(e){return e.id===Jr.location.hash.substring(1)},":focus":function(e){return e===e.ownerDocument.activeElement},":is":function(e){return vn(e)},":matches":function(e){return oe[":is"](e)},":nth-match":function(e,t){var r=e.split(/\s*,\s*/),a=r.shift(),s=vn(r.join(","));return En(a,s,t)},":nth-last-match":function(e){return oe[":nth-match"](e,!0)},":links-here":function(e){return e+""==Jr.location+""},":lang":function(e){return function(t){for(;t;){if(t.lang)return t.lang.indexOf(e)===0;t=t.parentNode}}},":dir":function(e){return function(t){for(;t;){if(t.dir)return t.dir===e;t=t.parentNode}}},":scope":function(e,t){var r=t||e.ownerDocument;return r.nodeType===9?e===r.documentElement:e===r},":any-link":function(e){return typeof e.href=="string"},":local-link":function(e){if(e.nodeName)return e.href&&e.host===Jr.location.host;var t=+e+1;return function(r){if(r.href){var a=Jr.location+"",s=r+"";return Ms(a,t)===Ms(s,t)}}},":default":function(e){return!!e.defaultSelected},":valid":function(e){return e.willValidate||e.validity&&e.validity.valid},":invalid":function(e){return!oe[":valid"](e)},":in-range":function(e){return e.value>e.min&&e.value<=e.max},":out-of-range":function(e){return!oe[":in-range"](e)},":required":function(e){return!!e.required},":optional":function(e){return!e.required},":read-only":function(e){if(e.readOnly)return!0;var t=e.getAttribute("contenteditable"),r=e.contentEditable,a=e.nodeName.toLowerCase();return a=a!=="input"&&a!=="textarea",(a||e.disabled)&&t==null&&r!=="true"},":read-write":function(e){return!oe[":read-only"](e)},":hover":function(){throw new Error(":hover is not supported.")},":active":function(){throw new Error(":active is not supported.")},":link":function(){throw new Error(":link is not supported.")},":visited":function(){throw new Error(":visited is not supported.")},":column":function(){throw new Error(":column is not supported.")},":nth-column":function(){throw new Error(":nth-column is not supported.")},":nth-last-column":function(){throw new Error(":nth-last-column is not supported.")},":current":function(){throw new Error(":current is not supported.")},":past":function(){throw new Error(":past is not supported.")},":future":function(){throw new Error(":future is not supported.")},":contains":function(e){return function(t){var r=t.innerText||t.textContent||t.value||"";return r.indexOf(e)!==-1}},":has":function(e){return function(t){return Os(e,t).length>0}}},Is={"-":function(){return!0},"=":function(e,t){return e===t},"*=":function(e,t){return e.indexOf(t)!==-1},"~=":function(e,t){var r,a,s,o;for(a=0;;a=r+1){if(r=e.indexOf(t,a),r===-1)return!1;if(s=e[r-1],o=e[r+t.length],(!s||s===" ")&&(!o||o===" "))return!0}},"|=":function(e,t){var r=e.indexOf(t),a;if(r===0)return a=e[r+t.length],a==="-"||!a},"^=":function(e,t){return e.indexOf(t)===0},"$=":function(e,t){var r=e.lastIndexOf(t);return r!==-1&&r+t.length===e.length},"!=":function(e,t){return e!==t}},cr={" ":function(e){return function(t){for(;t=t.parentNode;)if(e(t))return t}},">":function(e){return function(t){if(t=t.parentNode)return e(t)&&t}},"+":function(e){return function(t){if(t=Ot(t))return e(t)&&t}},"~":function(e){return function(t){for(;t=Ot(t);)if(e(t))return t}},noop:function(e){return function(t){return e(t)&&t}},ref:function(e,t){var r;function a(s){for(var o=s.ownerDocument,x=o.getElementsByTagName("*"),m=x.length;m--;)if(r=x[m],a.test(s))return r=null,!0;r=null}return a.combinator=function(s){if(!(!r||!r.getAttribute)){var o=r.getAttribute(t)||"";if(o[0]==="#"&&(o=o.substring(1)),o===s.id&&e(r))return r}},a}},C={escape:/\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g,str_escape:/(escape)|\\(\n|\r\n?|\f)/g,nonascii:/[\u00A0-\uFFFF]/,cssid:/(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/,qname:/^ *(cssid|\*)/,simple:/^(?:([.#]cssid)|pseudo|attr)/,ref:/^ *\/(cssid)\/ */,combinator:/^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/,attr:/^\[(cssid)(?:([^\w]?=)(inside))?\]/,pseudo:/^(:cssid)(?:\((inside)\))?/,inside:/(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/,ident:/^(cssid)$/};C.cssid=ve(C.cssid,"nonascii",C.nonascii);C.cssid=ve(C.cssid,"escape",C.escape);C.qname=ve(C.qname,"cssid",C.cssid);C.simple=ve(C.simple,"cssid",C.cssid);C.ref=ve(C.ref,"cssid",C.cssid);C.attr=ve(C.attr,"cssid",C.cssid);C.pseudo=ve(C.pseudo,"cssid",C.cssid);C.inside=ve(C.inside,`[^"'>]*`,C.inside);C.attr=ve(C.attr,"inside",Rs("\\[","\\]"));C.pseudo=ve(C.pseudo,"inside",Rs("\\(","\\)"));C.simple=ve(C.simple,"pseudo",C.pseudo);C.simple=ve(C.simple,"attr",C.attr);C.ident=ve(C.ident,"cssid",C.cssid);C.str_escape=ve(C.str_escape,"escape",C.escape);var lr=function(e){for(var t=e.replace(/^\s+|\s+$/g,""),r,a=[],s=[],o,x,m,h,g;t;){if(m=C.qname.exec(t))t=t.substring(m[0].length),x=ut(m[1]),s.push(ea(x,!0));else if(m=C.simple.exec(t))t=t.substring(m[0].length),x="*",s.push(ea(x,!0)),s.push(ea(m));else throw new SyntaxError("Invalid selector.");for(;m=C.simple.exec(t);)t=t.substring(m[0].length),s.push(ea(m));if(t[0]==="!"&&(t=t.substring(1),o=mu(),o.qname=x,s.push(o.simple)),m=C.ref.exec(t)){t=t.substring(m[0].length),g=cr.ref(_n(s),ut(m[1])),a.push(g.combinator),s=[];continue}if(m=C.combinator.exec(t)){if(t=t.substring(m[0].length),h=m[1]||m[2]||m[3],h===","){a.push(cr.noop(_n(s)));break}}else h="noop";if(!cr[h])throw new SyntaxError("Bad combinator.");a.push(cr[h](_n(s))),s=[]}return r=pu(a),r.qname=x,r.sel=t,o&&(o.lname=r.qname,o.test=r,o.qname=o.qname,o.sel=r.sel,r=o),g&&(g.test=r,g.qname=r.qname,g.sel=r.sel,r=g),r},ea=function(e,t){if(t)return e==="*"?oe["*"]:oe.type(e);if(e[1])return e[1][0]==="."?oe.attr("class","~=",ut(e[1].substring(1)),!1):oe.attr("id","=",ut(e[1].substring(1)),!1);if(e[2])return e[3]?oe[ut(e[2])](Ls(e[3])):oe[ut(e[2])];if(e[4]){var r=e[6],a=/["'\s]\s*I$/i.test(r);return a&&(r=r.replace(/\s*I$/i,"")),oe.attr(ut(e[4]),e[5]||"-",Ls(r),a)}throw new SyntaxError("Unknown Selector.")},_n=function(e){var t=e.length,r;return t<2?e[0]:function(a){if(a){for(r=0;r{"use strict";var gu=xe(),bu=en(),Tn=function(e,t){for(var r=e.createDocumentFragment(),a=0;a{"use strict";var Fs=xe(),_u={nextElementSibling:{get:function(){if(this.parentNode){for(var e=this.nextSibling;e!==null;e=e.nextSibling)if(e.nodeType===Fs.ELEMENT_NODE)return e}return null}},previousElementSibling:{get:function(){if(this.parentNode){for(var e=this.previousSibling;e!==null;e=e.previousSibling)if(e.nodeType===Fs.ELEMENT_NODE)return e}return null}}};Bs.exports=_u});var Nn=N((Vf,Us)=>{"use strict";Us.exports=Ps;var Ht=ee();function Ps(e){this.element=e}Object.defineProperties(Ps.prototype,{length:{get:Ht.shouldOverride},item:{value:Ht.shouldOverride},getNamedItem:{value:function(t){return this.element.getAttributeNode(t)}},getNamedItemNS:{value:function(t,r){return this.element.getAttributeNodeNS(t,r)}},setNamedItem:{value:Ht.nyi},setNamedItemNS:{value:Ht.nyi},removeNamedItem:{value:function(t){var r=this.element.getAttributeNode(t);if(r)return this.element.removeAttribute(t),r;Ht.NotFoundError()}},removeNamedItemNS:{value:function(t,r){var a=this.element.getAttributeNodeNS(t,r);if(a)return this.element.removeAttributeNS(t,r),a;Ht.NotFoundError()}}})});var Bt=N((jf,Ws)=>{"use strict";Ws.exports=xt;var wn=Zr(),Q=ee(),He=Q.NAMESPACE,ia=mn(),ke=xe(),Sn=yt(),vu=tn(),na=As(),Ft=Xr(),Tu=bn(),An=ra(),js=$r(),yu=aa(),Nu=yn(),Gs=Nn(),Vs=Object.create(null);function xt(e,t,r,a){js.call(this),this.nodeType=ke.ELEMENT_NODE,this.ownerDocument=e,this.localName=t,this.namespaceURI=r,this.prefix=a,this._tagName=void 0,this._attrsByQName=Object.create(null),this._attrsByLName=Object.create(null),this._attrKeys=[]}function Cn(e,t){if(e.nodeType===ke.TEXT_NODE)t.push(e._data);else for(var r=0,a=e.childNodes.length;r0}},toggleAttribute:{value:function(t,r){t=String(t),wn.isValidName(t)||Q.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t));var a=this._attrsByQName[t];return a===void 0?r===void 0||r===!0?(this._setAttribute(t,""),!0):!1:r===void 0||r===!1?(this.removeAttribute(t),!1):!0}},_setAttribute:{value:function(t,r){var a=this._attrsByQName[t],s;a?Array.isArray(a)&&(a=a[0]):(a=this._newattr(t),s=!0),a.value=r,this._attributes&&(this._attributes[t]=a),s&&this._newattrhook&&this._newattrhook(t,r)}},setAttribute:{value:function(t,r){t=String(t),wn.isValidName(t)||Q.InvalidCharacterError(),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t)),this._setAttribute(t,String(r))}},_setAttributeNS:{value:function(t,r,a){var s=r.indexOf(":"),o,x;s<0?(o=null,x=r):(o=r.substring(0,s),x=r.substring(s+1)),(t===""||t===void 0)&&(t=null);var m=(t===null?"":t)+"|"+x,h=this._attrsByLName[m],g;h||(h=new ur(this,x,o,t),g=!0,this._attrsByLName[m]=h,this._attributes&&(this._attributes[this._attrKeys.length]=h),this._attrKeys.push(m),this._addQName(h)),h.value=a,g&&this._newattrhook&&this._newattrhook(r,a)}},setAttributeNS:{value:function(t,r,a){t=t==null||t===""?null:String(t),r=String(r),wn.isValidQName(r)||Q.InvalidCharacterError();var s=r.indexOf(":"),o=s<0?null:r.substring(0,s);(o!==null&&t===null||o==="xml"&&t!==He.XML||(r==="xmlns"||o==="xmlns")&&t!==He.XMLNS||t===He.XMLNS&&!(r==="xmlns"||o==="xmlns"))&&Q.NamespaceError(),this._setAttributeNS(t,r,String(a))}},setAttributeNode:{value:function(t){if(t.ownerElement!==null&&t.ownerElement!==this)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);var r=null,a=this._attrsByQName[t.name];if(a){if(Array.isArray(a)||(a=[a]),a.some(function(s){return s===t}))return t;if(t.ownerElement!==null)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);a.forEach(function(s){this.removeAttributeNode(s)},this),r=a[0]}return this.setAttributeNodeNS(t),r}},setAttributeNodeNS:{value:function(t){if(t.ownerElement!==null)throw new Ft(Ft.INUSE_ATTRIBUTE_ERR);var r=t.namespaceURI,a=(r===null?"":r)+"|"+t.localName,s=this._attrsByLName[a];return s&&this.removeAttributeNode(s),t._setOwnerElement(this),this._attrsByLName[a]=t,this._attributes&&(this._attributes[this._attrKeys.length]=t),this._attrKeys.push(a),this._addQName(t),this._newattrhook&&this._newattrhook(t.name,t.value),s||null}},removeAttribute:{value:function(t){t=String(t),/[A-Z]/.test(t)&&this.isHTML&&(t=Q.toASCIILowerCase(t));var r=this._attrsByQName[t];if(r){Array.isArray(r)?r.length>2?r=r.shift():(this._attrsByQName[t]=r[1],r=r[0]):this._attrsByQName[t]=void 0;var a=r.namespaceURI,s=(a===null?"":a)+"|"+r.localName;this._attrsByLName[s]=void 0;var o=this._attrKeys.indexOf(s);this._attributes&&(Array.prototype.splice.call(this._attributes,o,1),this._attributes[t]=void 0),this._attrKeys.splice(o,1);var x=r.onchange;r._setOwnerElement(null),x&&x.call(r,this,r.localName,r.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(r)}}},removeAttributeNS:{value:function(t,r){t=t==null?"":String(t),r=String(r);var a=t+"|"+r,s=this._attrsByLName[a];if(s){this._attrsByLName[a]=void 0;var o=this._attrKeys.indexOf(a);this._attributes&&Array.prototype.splice.call(this._attributes,o,1),this._attrKeys.splice(o,1),this._removeQName(s);var x=s.onchange;s._setOwnerElement(null),x&&x.call(s,this,s.localName,s.value,null),this.rooted&&this.ownerDocument.mutateRemoveAttr(s)}}},removeAttributeNode:{value:function(t){var r=t.namespaceURI,a=(r===null?"":r)+"|"+t.localName;return this._attrsByLName[a]!==t&&Q.NotFoundError(),this.removeAttributeNS(r,t.localName),t}},getAttributeNames:{value:function(){var t=this;return this._attrKeys.map(function(r){return t._attrsByLName[r].name})}},_getattr:{value:function(t){var r=this._attrsByQName[t];return r?r.value:null}},_setattr:{value:function(t,r){var a=this._attrsByQName[t],s;a||(a=this._newattr(t),s=!0),a.value=String(r),this._attributes&&(this._attributes[t]=a),s&&this._newattrhook&&this._newattrhook(t,r)}},_newattr:{value:function(t){var r=new ur(this,t,null,null),a="|"+t;return this._attrsByQName[t]=r,this._attrsByLName[a]=r,this._attributes&&(this._attributes[this._attrKeys.length]=r),this._attrKeys.push(a),r}},_addQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];r?Array.isArray(r)?r.push(e):this._attrsByQName[t]=[r,e]:this._attrsByQName[t]=e,this._attributes&&(this._attributes[t]=e)}},_removeQName:{value:function(e){var t=e.name,r=this._attrsByQName[t];if(Array.isArray(r)){var a=r.indexOf(e);Q.assert(a!==-1),r.length===2?(this._attrsByQName[t]=r[1-a],this._attributes&&(this._attributes[t]=this._attrsByQName[t])):(r.splice(a,1),this._attributes&&this._attributes[t]===e&&(this._attributes[t]=r[0]))}else Q.assert(r===e),this._attrsByQName[t]=void 0,this._attributes&&(this._attributes[t]=void 0)}},_numattrs:{get:function(){return this._attrKeys.length}},_attr:{value:function(e){return this._attrsByLName[this._attrKeys[e]]}},id:ia.property({name:"id"}),className:ia.property({name:"class"}),classList:{get:function(){var e=this;if(this._classList)return this._classList;var t=new Tu(function(){return e.className||""},function(r){e.className=r});return this._classList=t,t},set:function(e){this.className=e}},matches:{value:function(e){return An.matches(this,e)}},closest:{value:function(e){var t=this;do{if(t.matches&&t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===ke.ELEMENT_NODE);return null}},querySelector:{value:function(e){return An(e,this)[0]}},querySelectorAll:{value:function(e){var t=An(e,this);return t.item?t:new Sn(t)}}});Object.defineProperties(xt.prototype,yu);Object.defineProperties(xt.prototype,Nu);ia.registerChangeHandler(xt,"id",function(e,t,r,a){e.rooted&&(r&&e.ownerDocument.delId(r,e),a&&e.ownerDocument.addId(a,e))});ia.registerChangeHandler(xt,"class",function(e,t,r,a){e._classList&&e._classList._update()});function ur(e,t,r,a,s){this.localName=t,this.prefix=r===null||r===""?null:""+r,this.namespaceURI=a===null||a===""?null:""+a,this.data=s,this._setOwnerElement(e)}ur.prototype=Object.create(Object.prototype,{ownerElement:{get:function(){return this._ownerElement}},_setOwnerElement:{value:function(t){this._ownerElement=t,this.prefix===null&&this.namespaceURI===null&&t?this.onchange=t._attributeChangeHandlers[this.localName]:this.onchange=null}},name:{get:function(){return this.prefix?this.prefix+":"+this.localName:this.localName}},specified:{get:function(){return!0}},value:{get:function(){return this.data},set:function(e){var t=this.data;e=e===void 0?"":e+"",e!==t&&(this.data=e,this.ownerElement&&(this.onchange&&this.onchange(this.ownerElement,this.localName,t,e),this.ownerElement.rooted&&this.ownerElement.ownerDocument.mutateAttr(this,t)))}},cloneNode:{value:function(t){return new ur(null,this.localName,this.prefix,this.namespaceURI,this.data)}},nodeType:{get:function(){return ke.ATTRIBUTE_NODE}},nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return this.value},set:function(e){this.value=e}},textContent:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}},innerText:{get:function(){return this.value},set:function(e){e==null&&(e=""),this.value=e}}});xt._Attr=ur;function kn(e){Gs.call(this,e);for(var t in e._attrsByQName)this[t]=e._attrsByQName[t];for(var r=0;r>>0,e>=this.length?null:this.element._attrsByLName[this.element._attrKeys[e]]}}});globalThis.Symbol?.iterator&&(kn.prototype[globalThis.Symbol.iterator]=function(){var e=0,t=this.length,r=this;return{next:function(){return e{"use strict";$s.exports=Qs;var Ks=xe(),ku=yt(),Ys=ee(),Xs=Ys.HierarchyRequestError,Lu=Ys.NotFoundError;function Qs(){Ks.call(this)}Qs.prototype=Object.create(Ks.prototype,{hasChildNodes:{value:function(){return!1}},firstChild:{value:null},lastChild:{value:null},insertBefore:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Xs()}},replaceChild:{value:function(e,t){if(!e.nodeType)throw new TypeError("not a node");Xs()}},removeChild:{value:function(e){if(!e.nodeType)throw new TypeError("not a node");Lu()}},removeChildren:{value:function(){}},childNodes:{get:function(){return this._childNodes||(this._childNodes=new ku),this._childNodes}}})});var xr=N((zf,e0)=>{"use strict";e0.exports=sa;var Js=Ln(),Zs=ee(),Mu=aa(),Ru=yn();function sa(){Js.call(this)}sa.prototype=Object.create(Js.prototype,{substringData:{value:function(t,r){if(arguments.length<2)throw new TypeError("Not enough arguments");return t=t>>>0,r=r>>>0,(t>this.data.length||t<0||r<0)&&Zs.IndexSizeError(),this.data.substring(t,t+r)}},appendData:{value:function(t){if(arguments.length<1)throw new TypeError("Not enough arguments");this.data+=String(t)}},insertData:{value:function(t,r){return this.replaceData(t,0,r)}},deleteData:{value:function(t,r){return this.replaceData(t,r,"")}},replaceData:{value:function(t,r,a){var s=this.data,o=s.length;t=t>>>0,r=r>>>0,a=String(a),(t>o||t<0)&&Zs.IndexSizeError(),t+r>o&&(r=o-t);var x=s.substring(0,t),m=s.substring(t+r);this.data=x+a+m}},isEqual:{value:function(t){return this._data===t._data}},length:{get:function(){return this.data.length}}});Object.defineProperties(sa.prototype,Mu);Object.defineProperties(sa.prototype,Ru)});var Rn=N((Wf,n0)=>{"use strict";n0.exports=Mn;var t0=ee(),r0=xe(),a0=xr();function Mn(e,t){a0.call(this),this.nodeType=r0.TEXT_NODE,this.ownerDocument=e,this._data=t,this._index=void 0}var fr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),e!==this._data&&(this._data=e,this.rooted&&this.ownerDocument.mutateValue(this),this.parentNode&&this.parentNode._textchangehook&&this.parentNode._textchangehook(this))}};Mn.prototype=Object.create(a0.prototype,{nodeName:{value:"#text"},nodeValue:fr,textContent:fr,innerText:fr,data:{get:fr.get,set:function(e){fr.set.call(this,e===null?"":String(e))}},splitText:{value:function(t){(t>this._data.length||t<0)&&t0.IndexSizeError();var r=this._data.substring(t),a=this.ownerDocument.createTextNode(r);this.data=this.data.substring(0,t);var s=this.parentNode;return s!==null&&s.insertBefore(a,this.nextSibling),a}},wholeText:{get:function(){for(var t=this.textContent,r=this.nextSibling;r&&r.nodeType===r0.TEXT_NODE;r=r.nextSibling)t+=r.textContent;return t}},replaceWholeText:{value:t0.nyi},clone:{value:function(){return new Mn(this.ownerDocument,this._data)}}})});var On=N((Xf,s0)=>{"use strict";s0.exports=In;var Iu=xe(),i0=xr();function In(e,t){i0.call(this),this.nodeType=Iu.COMMENT_NODE,this.ownerDocument=e,this._data=t}var dr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};In.prototype=Object.create(i0.prototype,{nodeName:{value:"#comment"},nodeValue:dr,textContent:dr,innerText:dr,data:{get:dr.get,set:function(e){dr.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new In(this.ownerDocument,this._data)}}})});var Hn=N((Kf,l0)=>{"use strict";l0.exports=qn;var Ou=xe(),qu=yt(),c0=$r(),oa=Bt(),Hu=ra(),o0=ee();function qn(e){c0.call(this),this.nodeType=Ou.DOCUMENT_FRAGMENT_NODE,this.ownerDocument=e}qn.prototype=Object.create(c0.prototype,{nodeName:{value:"#document-fragment"},nodeValue:{get:function(){return null},set:function(){}},textContent:Object.getOwnPropertyDescriptor(oa.prototype,"textContent"),innerText:Object.getOwnPropertyDescriptor(oa.prototype,"innerText"),querySelector:{value:function(e){var t=this.querySelectorAll(e);return t.length?t[0]:null}},querySelectorAll:{value:function(e){var t=Object.create(this);t.isHTML=!0,t.getElementsByTagName=oa.prototype.getElementsByTagName,t.nextElement=Object.getOwnPropertyDescriptor(oa.prototype,"firstElementChild").get;var r=Hu(e,t);return r.item?r:new qu(r)}},clone:{value:function(){return new qn(this.ownerDocument)}},isEqual:{value:function(t){return!0}},innerHTML:{get:function(){return this.serialize()},set:o0.nyi},outerHTML:{get:function(){return this.serialize()},set:o0.nyi}})});var Bn=N((Yf,x0)=>{"use strict";x0.exports=Fn;var Fu=xe(),u0=xr();function Fn(e,t,r){u0.call(this),this.nodeType=Fu.PROCESSING_INSTRUCTION_NODE,this.ownerDocument=e,this.target=t,this._data=r}var hr={get:function(){return this._data},set:function(e){e==null?e="":e=String(e),this._data=e,this.rooted&&this.ownerDocument.mutateValue(this)}};Fn.prototype=Object.create(u0.prototype,{nodeName:{get:function(){return this.target}},nodeValue:hr,textContent:hr,innerText:hr,data:{get:hr.get,set:function(e){hr.set.call(this,e===null?"":String(e))}},clone:{value:function(){return new Fn(this.ownerDocument,this.target,this._data)}},isEqual:{value:function(t){return this.target===t.target&&this._data===t._data}}})});var pr=N((Qf,f0)=>{"use strict";var Pn={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3,SHOW_ALL:4294967295,SHOW_ELEMENT:1,SHOW_ATTRIBUTE:2,SHOW_TEXT:4,SHOW_CDATA_SECTION:8,SHOW_ENTITY_REFERENCE:16,SHOW_ENTITY:32,SHOW_PROCESSING_INSTRUCTION:64,SHOW_COMMENT:128,SHOW_DOCUMENT:256,SHOW_DOCUMENT_TYPE:512,SHOW_DOCUMENT_FRAGMENT:1024,SHOW_NOTATION:2048};f0.exports=Pn.constructor=Pn.prototype=Pn});var Vn=N((Zf,h0)=>{"use strict";var $f=h0.exports={nextSkippingChildren:Bu,nextAncestorSibling:Un,next:Pu,previous:Uu,deepLastChild:d0};function Bu(e,t){return e===t?null:e.nextSibling!==null?e.nextSibling:Un(e,t)}function Un(e,t){for(e=e.parentNode;e!==null;e=e.parentNode){if(e===t)return null;if(e.nextSibling!==null)return e.nextSibling}return null}function Pu(e,t){var r;return r=e.firstChild,r!==null?r:e===t?null:(r=e.nextSibling,r!==null?r:Un(e,t))}function d0(e){for(;e.lastChild;)e=e.lastChild;return e}function Uu(e,t){var r;return r=e.previousSibling,r!==null?d0(r):(r=e.parentNode,r===t?null:r)}});var v0=N((Jf,_0)=>{"use strict";_0.exports=E0;var Vu=xe(),fe=pr(),p0=Vn(),b0=ee(),jn={first:"firstChild",last:"lastChild",next:"firstChild",previous:"lastChild"},Gn={first:"nextSibling",last:"previousSibling",next:"nextSibling",previous:"previousSibling"};function m0(e,t){var r,a,s,o,x;for(a=e._currentNode[jn[t]];a!==null;){if(o=e._internalFilter(a),o===fe.FILTER_ACCEPT)return e._currentNode=a,a;if(o===fe.FILTER_SKIP&&(r=a[jn[t]],r!==null)){a=r;continue}for(;a!==null;){if(x=a[Gn[t]],x!==null){a=x;break}if(s=a.parentNode,s===null||s===e.root||s===e._currentNode)return null;a=s}}return null}function g0(e,t){var r,a,s;if(r=e._currentNode,r===e.root)return null;for(;;){for(s=r[Gn[t]];s!==null;){if(r=s,a=e._internalFilter(r),a===fe.FILTER_ACCEPT)return e._currentNode=r,r;s=r[jn[t]],(a===fe.FILTER_REJECT||s===null)&&(s=r[Gn[t]])}if(r=r.parentNode,r===null||r===e.root||e._internalFilter(r)===fe.FILTER_ACCEPT)return null}}function E0(e,t,r){(!e||!e.nodeType)&&b0.NotSupportedError(),this._root=e,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,this._currentNode=e}Object.defineProperties(E0.prototype,{root:{get:function(){return this._root}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},currentNode:{get:function(){return this._currentNode},set:function(t){if(!(t instanceof Vu))throw new TypeError("Not a Node");this._currentNode=t}},_internalFilter:{value:function(t){var r,a;if(this._active&&b0.InvalidStateError(),!(1<{"use strict";S0.exports=w0;var zn=pr(),Wn=Vn(),N0=ee();function ju(e,t,r){return r?Wn.next(e,t):e===t?null:Wn.previous(e,null)}function T0(e,t){for(;t;t=t.parentNode)if(e===t)return!0;return!1}function y0(e,t){var r,a;for(r=e._referenceNode,a=e._pointerBeforeReferenceNode;;){if(a===t)a=!a;else if(r=ju(r,e._root,t),r===null)return null;var s=e._internalFilter(r);if(s===zn.FILTER_ACCEPT)break}return e._referenceNode=r,e._pointerBeforeReferenceNode=a,r}function w0(e,t,r){(!e||!e.nodeType)&&N0.NotSupportedError(),this._root=e,this._referenceNode=e,this._pointerBeforeReferenceNode=!0,this._whatToShow=Number(t)||0,this._filter=r||null,this._active=!1,e.doc._attachNodeIterator(this)}Object.defineProperties(w0.prototype,{root:{get:function(){return this._root}},referenceNode:{get:function(){return this._referenceNode}},pointerBeforeReferenceNode:{get:function(){return this._pointerBeforeReferenceNode}},whatToShow:{get:function(){return this._whatToShow}},filter:{get:function(){return this._filter}},_internalFilter:{value:function(t){var r,a;if(this._active&&N0.InvalidStateError(),!(1<{"use strict";C0.exports=de;function de(e){if(!e)return Object.create(de.prototype);this.url=e.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,"");var t=de.pattern.exec(this.url);if(t){if(t[2]&&(this.scheme=t[2]),t[4]){var r=t[4].match(de.userinfoPattern);if(r&&(this.username=r[1],this.password=r[3],t[4]=t[4].substring(r[0].length)),t[4].match(de.portPattern)){var a=t[4].lastIndexOf(":");this.host=t[4].substring(0,a),this.port=t[4].substring(a+1)}else this.host=t[4]}t[5]&&(this.path=t[5]),t[6]&&(this.query=t[7]),t[8]&&(this.fragment=t[9])}}de.pattern=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;de.userinfoPattern=/^([^@:]*)(:([^@]*))?@/;de.portPattern=/:\d+$/;de.authorityPattern=/^[^:\/?#]+:\/\//;de.hierarchyPattern=/^[^:\/?#]+:\//;de.percentEncode=function(t){var r=t.charCodeAt(0);if(r<256)return"%"+r.toString(16);throw Error("can't percent-encode codepoints > 255 yet")};de.prototype={constructor:de,isAbsolute:function(){return!!this.scheme},isAuthorityBased:function(){return de.authorityPattern.test(this.url)},isHierarchical:function(){return de.hierarchyPattern.test(this.url)},toString:function(){var e="";return this.scheme!==void 0&&(e+=this.scheme+":"),this.isAbsolute()&&(e+="//",(this.username||this.password)&&(e+=this.username||"",this.password&&(e+=":"+this.password),e+="@"),this.host&&(e+=this.host)),this.port!==void 0&&(e+=":"+this.port),this.path!==void 0&&(e+=this.path),this.query!==void 0&&(e+="?"+this.query),this.fragment!==void 0&&(e+="#"+this.fragment),e},resolve:function(e){var t=this,r=new de(e),a=new de;return r.scheme!==void 0?(a.scheme=r.scheme,a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=o(r.path),a.query=r.query):(a.scheme=t.scheme,r.host!==void 0?(a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=o(r.path),a.query=r.query):(a.username=t.username,a.password=t.password,a.host=t.host,a.port=t.port,r.path?(r.path.charAt(0)==="/"?a.path=o(r.path):(a.path=s(t.path,r.path),a.path=o(a.path)),a.query=r.query):(a.path=t.path,r.query!==void 0?a.query=r.query:a.query=t.query))),a.fragment=r.fragment,a.toString();function s(x,m){if(t.host!==void 0&&!t.path)return"/"+m;var h=x.lastIndexOf("/");return h===-1?m:x.substring(0,h+1)+m}function o(x){if(!x)return x;for(var m="";x.length>0;){if(x==="."||x===".."){x="";break}var h=x.substring(0,2),g=x.substring(0,3),v=x.substring(0,4);if(g==="../")x=x.substring(3);else if(h==="./")x=x.substring(2);else if(g==="/./")x="/"+x.substring(3);else if(h==="/."&&x.length===2)x="/";else if(v==="/../"||g==="/.."&&x.length===3)x="/"+x.substring(4),m=m.replace(/\/?[^\/]*$/,"");else{var ne=x.match(/(\/?([^\/]*))/)[0];m+=ne,x=x.substring(ne.length)}}return m}}}});var L0=N((rd,k0)=>{"use strict";k0.exports=Xn;var D0=Mt();function Xn(e,t){D0.call(this,e,t)}Xn.prototype=Object.create(D0.prototype,{constructor:{value:Xn}})});var Kn=N((ad,M0)=>{"use strict";M0.exports={Event:Mt(),UIEvent:Ya(),MouseEvent:$a(),CustomEvent:L0()}});var I0=N(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.hyphenate=Pt.parse=void 0;function Gu(e){let t=[],r=0,a=0,s=0,o=0,x=0,m=null;for(;r0&&a===0&&s===0){let g=e.substring(o,r-1).trim();t.push(m,g),x=r,o=0,m=null}break}if(m&&o){let h=e.slice(o).trim();t.push(m,h)}return t}Pt.parse=Gu;function R0(e){return e.replace(/[a-z][A-Z]/g,t=>t.charAt(0)+"-"+t.charAt(1)).toLowerCase()}Pt.hyphenate=R0});var la=N((id,B0)=>{"use strict";var{parse:zu}=I0();B0.exports=function(e){let t=new F0(e),r={get:function(a,s){return s in a?a[s]:a.getPropertyValue(O0(s))},has:function(a,s){return!0},set:function(a,s,o){return s in a?a[s]=o:a.setProperty(O0(s),o??void 0),!0}};return new Proxy(t,r)};function O0(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function F0(e){this._element=e}var q0="!important";function H0(e){let t={property:{},priority:{}};if(!e)return t;let r=zu(e);if(r.length<2)return t;for(let a=0;a{"use strict";var ce=ca();P0.exports=mr;function mr(){}mr.prototype=Object.create(Object.prototype,{_url:{get:function(){return new ce(this.href)}},protocol:{get:function(){var e=this._url;return e&&e.scheme?e.scheme+":":":"},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e=e.replace(/:+$/,""),e=e.replace(/[^-+\.a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.scheme=e,t=r.toString())),this.href=t}},host:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host+(e.port?":"+e.port:""):""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.host=e,delete r.port,t=r.toString())),this.href=t}},hostname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()?e.host:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=e.replace(/^\/+/,""),e=e.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g,ce.percentEncode),e.length>0&&(r.host=e,t=r.toString())),this.href=t}},port:{get:function(){var e=this._url;return e.isAbsolute()&&e.isAuthorityBased()&&e.port!==void 0?e.port:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isAuthorityBased()&&(e=""+e,e=e.replace(/[^0-9].*$/,""),e=e.replace(/^0+/,""),e.length===0&&(e="0"),parseInt(e,10)<=65535&&(r.port=e,t=r.toString())),this.href=t}},pathname:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()?e.path:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)!=="/"&&(e="/"+e),e=e.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g,ce.percentEncode),r.path=e,t=r.toString()),this.href=t}},search:{get:function(){var e=this._url;return e.isAbsolute()&&e.isHierarchical()&&e.query!==void 0?"?"+e.query:""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&r.isHierarchical()&&(e.charAt(0)==="?"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,ce.percentEncode),r.query=e,t=r.toString()),this.href=t}},hash:{get:function(){var e=this._url;return e==null||e.fragment==null||e.fragment===""?"":"#"+e.fragment},set:function(e){var t=this.href,r=new ce(t);e.charAt(0)==="#"&&(e=e.substring(1)),e=e.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g,ce.percentEncode),r.fragment=e,t=r.toString(),this.href=t}},username:{get:function(){var e=this._url;return e.username||""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g,ce.percentEncode),r.username=e,t=r.toString()),this.href=t}},password:{get:function(){var e=this._url;return e.password||""},set:function(e){var t=this.href,r=new ce(t);r.isAbsolute()&&(e===""?r.password=null:(e=e.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g,ce.percentEncode),r.password=e),t=r.toString()),this.href=t}},origin:{get:function(){var e=this._url;if(e==null)return"";var t=function(r){var a=[e.scheme,e.host,+e.port||r];return a[0]+"://"+a[1]+(a[2]===r?"":":"+a[2])};switch(e.scheme){case"ftp":return t(21);case"gopher":return t(70);case"http":case"ws":return t(80);case"https":case"wss":return t(443);default:return e.scheme+"://"}}}});mr._inherit=function(e){Object.getOwnPropertyNames(mr.prototype).forEach(function(t){if(!(t==="constructor"||t==="href")){var r=Object.getOwnPropertyDescriptor(mr.prototype,t);Object.defineProperty(e,t,r)}})}});var Qn=N((od,j0)=>{"use strict";var U0=mn(),Wu=Kr().isApiWritable;j0.exports=function(e,t,r,a){var s=e.ctor;if(s){var o=e.props||{};if(e.attributes)for(var x in e.attributes){var m=e.attributes[x];(typeof m!="object"||Array.isArray(m))&&(m={type:m}),m.name||(m.name=x.toLowerCase()),o[x]=U0.property(m)}o.constructor={value:s,writable:Wu},s.prototype=Object.create((e.superclass||t).prototype,o),e.events&&Ku(s,e.events),r[e.name]=s}else s=t;return(e.tags||e.tag&&[e.tag]||[]).forEach(function(h){a[h]=s}),s};function V0(e,t,r,a){this.body=e,this.document=t,this.form=r,this.element=a}V0.prototype.build=function(){return()=>{}};function Xu(e,t,r,a){var s=e.ownerDocument||Object.create(null),o=e.form||Object.create(null);e[t]=new V0(a,s,o,e).build()}function Ku(e,t){var r=e.prototype;t.forEach(function(a){Object.defineProperty(r,"on"+a,{get:function(){return this._getEventHandler(a)},set:function(s){this._setEventHandler(a,s)}}),U0.registerChangeHandler(e,"on"+a,Xu)})}});var fa=N(xa=>{"use strict";var $n=xe(),G0=Bt(),Yu=la(),Te=ee(),z0=Yn(),Qu=Qn(),Xe=xa.elements={},gr=Object.create(null);xa.createElement=function(e,t,r){var a=gr[t]||Zu;return new a(e,t,r)};function _(e){return Qu(e,T,Xe,gr)}function te(e){return{get:function(){var t=this._getattr(e);if(t===null)return"";var r=this.doc._resolve(t);return r===null?t:r},set:function(t){this._setattr(e,t)}}}function ua(e){return{get:function(){var t=this._getattr(e);return t===null?null:t.toLowerCase()==="use-credentials"?"use-credentials":"anonymous"},set:function(t){t==null?this.removeAttribute(e):this._setattr(e,t)}}}var Vt={type:["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"],missing:""},$u={A:!0,LINK:!0,BUTTON:!0,INPUT:!0,SELECT:!0,TEXTAREA:!0,COMMAND:!0},Le=function(e,t,r){T.call(this,e,t,r),this._form=null},T=xa.HTMLElement=_({superclass:G0,name:"HTMLElement",ctor:function(t,r,a){G0.call(this,t,r,Te.NAMESPACE.HTML,a)},props:{dangerouslySetInnerHTML:{set:function(e){this._innerHTML=e}},innerHTML:{get:function(){return this.serialize()},set:function(e){var t=this.ownerDocument.implementation.mozHTMLParser(this.ownerDocument._address,this);t.parse(e===null?"":String(e),!0);for(var r=this instanceof gr.template?this.content:this;r.hasChildNodes();)r.removeChild(r.firstChild);r.appendChild(t._asDocumentFragment())}},style:{get:function(){return this._style||(this._style=new Yu(this)),this._style},set:function(e){e==null&&(e=""),this._setattr("style",String(e))}},blur:{value:function(){}},focus:{value:function(){}},forceSpellCheck:{value:function(){}},click:{value:function(){if(!this._click_in_progress){this._click_in_progress=!0;try{this._pre_click_activation_steps&&this._pre_click_activation_steps();var e=this.ownerDocument.createEvent("MouseEvent");e.initMouseEvent("click",!0,!0,this.ownerDocument.defaultView,1,0,0,0,0,!1,!1,!1,!1,0,null);var t=this.dispatchEvent(e);t?this._post_click_activation_steps&&this._post_click_activation_steps(e):this._cancelled_activation_steps&&this._cancelled_activation_steps()}finally{this._click_in_progress=!1}}}},submit:{value:Te.nyi}},attributes:{title:String,lang:String,dir:{type:["ltr","rtl","auto"],missing:""},draggable:{type:["true","false"],treatNullAsEmptyString:!0},spellcheck:{type:["true","false"],missing:""},enterKeyHint:{type:["enter","done","go","next","previous","search","send"],missing:""},autoCapitalize:{type:["off","on","none","sentences","words","characters"],missing:""},autoFocus:Boolean,accessKey:String,nonce:String,hidden:Boolean,translate:{type:["no","yes"],missing:""},tabIndex:{type:"long",default:function(){return this.tagName in $u||this.contentEditable?0:-1}}},events:["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"]}),Zu=_({name:"HTMLUnknownElement",ctor:function(t,r,a){T.call(this,t,r,a)}}),Me={form:{get:function(){return this._form}}};_({tag:"a",name:"HTMLAnchorElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{_post_click_activation_steps:{value:function(e){this.href&&(this.ownerDocument.defaultView.location=this.href)}}},attributes:{href:te,ping:String,download:String,target:String,rel:String,media:String,hreflang:String,type:String,referrerPolicy:Vt,coords:String,charset:String,name:String,rev:String,shape:String}});z0._inherit(gr.a.prototype);_({tag:"area",name:"HTMLAreaElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{alt:String,target:String,download:String,rel:String,media:String,href:te,hreflang:String,type:String,shape:String,coords:String,ping:String,referrerPolicy:Vt,noHref:Boolean}});z0._inherit(gr.area.prototype);_({tag:"br",name:"HTMLBRElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{clear:String}});_({tag:"base",name:"HTMLBaseElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{target:String}});_({tag:"body",name:"HTMLBodyElement",ctor:function(t,r,a){T.call(this,t,r,a)},events:["afterprint","beforeprint","beforeunload","blur","error","focus","hashchange","load","message","offline","online","pagehide","pageshow","popstate","resize","scroll","storage","unload"],attributes:{text:{type:String,treatNullAsEmptyString:!0},link:{type:String,treatNullAsEmptyString:!0},vLink:{type:String,treatNullAsEmptyString:!0},aLink:{type:String,treatNullAsEmptyString:!0},bgColor:{type:String,treatNullAsEmptyString:!0},background:String}});_({tag:"button",name:"HTMLButtonElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String,value:String,disabled:Boolean,autofocus:Boolean,type:{type:["submit","reset","button","menu"],missing:"submit"},formTarget:String,formAction:te,formNoValidate:Boolean,formMethod:{type:["get","post","dialog"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""}}});_({tag:"dl",name:"HTMLDListElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{compact:Boolean}});_({tag:"data",name:"HTMLDataElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{value:String}});_({tag:"datalist",name:"HTMLDataListElement",ctor:function(t,r,a){T.call(this,t,r,a)}});_({tag:"details",name:"HTMLDetailsElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{open:Boolean}});_({tag:"div",name:"HTMLDivElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"embed",name:"HTMLEmbedElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{src:te,type:String,width:String,height:String,align:String,name:String}});_({tag:"fieldset",name:"HTMLFieldSetElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{disabled:Boolean,name:String}});_({tag:"form",name:"HTMLFormElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{action:String,autocomplete:{type:["on","off"],missing:"on"},name:String,acceptCharset:{name:"accept-charset"},target:String,noValidate:Boolean,method:{type:["get","post","dialog"],invalid:"get",missing:"get"},enctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"},encoding:{name:"enctype",type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:"application/x-www-form-urlencoded"}}});_({tag:"hr",name:"HTMLHRElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String,color:String,noShade:Boolean,size:String,width:String}});_({tag:"head",name:"HTMLHeadElement",ctor:function(t,r,a){T.call(this,t,r,a)}});_({tags:["h1","h2","h3","h4","h5","h6"],name:"HTMLHeadingElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"html",name:"HTMLHtmlElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{xmlns:te,version:String}});_({tag:"iframe",name:"HTMLIFrameElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{src:te,srcdoc:String,name:String,width:String,height:String,seamless:Boolean,allow:Boolean,allowFullscreen:Boolean,allowUserMedia:Boolean,allowPaymentRequest:Boolean,referrerPolicy:Vt,loading:{type:["eager","lazy"],treatNullAsEmptyString:!0},align:String,scrolling:String,frameBorder:String,longDesc:te,marginHeight:{type:String,treatNullAsEmptyString:!0},marginWidth:{type:String,treatNullAsEmptyString:!0}}});_({tag:"img",name:"HTMLImageElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{alt:String,src:te,srcset:String,crossOrigin:ua,useMap:String,isMap:Boolean,sizes:String,height:{type:"unsigned long",default:0},width:{type:"unsigned long",default:0},referrerPolicy:Vt,loading:{type:["eager","lazy"],missing:""},name:String,lowsrc:te,align:String,hspace:{type:"unsigned long",default:0},vspace:{type:"unsigned long",default:0},longDesc:te,border:{type:String,treatNullAsEmptyString:!0}}});_({tag:"input",name:"HTMLInputElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:{form:Me.form,_post_click_activation_steps:{value:function(e){if(this.type==="checkbox")this.checked=!this.checked;else if(this.type==="radio")for(var t=this.form.getElementsByName(this.name),r=t.length-1;r>=0;r--){var a=t[r];a.checked=a===this}}}},attributes:{name:String,disabled:Boolean,autofocus:Boolean,accept:String,alt:String,max:String,min:String,pattern:String,placeholder:String,step:String,dirName:String,defaultValue:{name:"value"},multiple:Boolean,required:Boolean,readOnly:Boolean,checked:Boolean,value:String,src:te,defaultChecked:{name:"checked",type:Boolean},size:{type:"unsigned long",default:20,min:1,setmin:1},width:{type:"unsigned long",min:0,setmin:0,default:0},height:{type:"unsigned long",min:0,setmin:0,default:0},minLength:{type:"unsigned long",min:0,setmin:0,default:-1},maxLength:{type:"unsigned long",min:0,setmin:0,default:-1},autocomplete:String,type:{type:["text","hidden","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"],missing:"text"},formTarget:String,formNoValidate:Boolean,formMethod:{type:["get","post"],invalid:"get",missing:""},formEnctype:{type:["application/x-www-form-urlencoded","multipart/form-data","text/plain"],invalid:"application/x-www-form-urlencoded",missing:""},inputMode:{type:["verbatim","latin","latin-name","latin-prose","full-width-latin","kana","kana-name","katakana","numeric","tel","email","url"],missing:""},align:String,useMap:String}});_({tag:"keygen",name:"HTMLKeygenElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String,disabled:Boolean,autofocus:Boolean,challenge:String,keytype:{type:["rsa"],missing:""}}});_({tag:"li",name:"HTMLLIElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{value:{type:"long",default:0},type:String}});_({tag:"label",name:"HTMLLabelElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{htmlFor:{name:"for",type:String}}});_({tag:"legend",name:"HTMLLegendElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"link",name:"HTMLLinkElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{href:te,rel:String,media:String,hreflang:String,type:String,crossOrigin:ua,nonce:String,integrity:String,referrerPolicy:Vt,imageSizes:String,imageSrcset:String,charset:String,rev:String,target:String}});_({tag:"map",name:"HTMLMapElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String}});_({tag:"menu",name:"HTMLMenuElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{type:{type:["context","popup","toolbar"],missing:"toolbar"},label:String,compact:Boolean}});_({tag:"meta",name:"HTMLMetaElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String,content:String,httpEquiv:{name:"http-equiv",type:String},scheme:String}});_({tag:"meter",name:"HTMLMeterElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me});_({tags:["ins","del"],name:"HTMLModElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{cite:te,dateTime:String}});_({tag:"ol",name:"HTMLOListElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{_numitems:{get:function(){var e=0;return this.childNodes.forEach(function(t){t.nodeType===$n.ELEMENT_NODE&&t.tagName==="LI"&&e++}),e}}},attributes:{type:String,reversed:Boolean,start:{type:"long",default:function(){return this.reversed?this._numitems:1}},compact:Boolean}});_({tag:"object",name:"HTMLObjectElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{data:te,type:String,name:String,useMap:String,typeMustMatch:Boolean,width:String,height:String,align:String,archive:String,code:String,declare:Boolean,hspace:{type:"unsigned long",default:0},standby:String,vspace:{type:"unsigned long",default:0},codeBase:te,codeType:String,border:{type:String,treatNullAsEmptyString:!0}}});_({tag:"optgroup",name:"HTMLOptGroupElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{disabled:Boolean,label:String}});_({tag:"option",name:"HTMLOptionElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{form:{get:function(){for(var e=this.parentNode;e&&e.nodeType===$n.ELEMENT_NODE;){if(e.localName==="select")return e.form;e=e.parentNode}}},value:{get:function(){return this._getattr("value")||this.text},set:function(e){this._setattr("value",e)}},text:{get:function(){return this.textContent.replace(/[ \t\n\f\r]+/g," ").trim()},set:function(e){this.textContent=e}}},attributes:{disabled:Boolean,defaultSelected:{name:"selected",type:Boolean},label:String}});_({tag:"output",name:"HTMLOutputElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{name:String}});_({tag:"p",name:"HTMLParagraphElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{align:String}});_({tag:"param",name:"HTMLParamElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{name:String,value:String,type:String,valueType:String}});_({tags:["pre","listing","xmp"],name:"HTMLPreElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{width:{type:"long",default:0}}});_({tag:"progress",name:"HTMLProgressElement",ctor:function(t,r,a){Le.call(this,t,r,a)},props:Me,attributes:{max:{type:Number,float:!0,default:1,min:0}}});_({tags:["q","blockquote"],name:"HTMLQuoteElement",ctor:function(t,r,a){T.call(this,t,r,a)},attributes:{cite:te}});_({tag:"script",name:"HTMLScriptElement",ctor:function(t,r,a){T.call(this,t,r,a)},props:{text:{get:function(){for(var e="",t=0,r=this.childNodes.length;t{"use strict";var W0=Bt(),Ju=Qn(),ex=ee(),tx=la(),rx=da.elements={},X0=Object.create(null);da.createElement=function(e,t,r){var a=X0[t]||Jn;return new a(e,t,r)};function Zn(e){return Ju(e,Jn,rx,X0)}var Jn=Zn({superclass:W0,name:"SVGElement",ctor:function(t,r,a){W0.call(this,t,r,ex.NAMESPACE.SVG,a)},props:{style:{get:function(){return this._style||(this._style=new tx(this)),this._style}}}});Zn({name:"SVGSVGElement",ctor:function(t,r,a){Jn.call(this,t,r,a)},tag:"svg",props:{createSVGRect:{value:function(){return da.createElement(this.ownerDocument,"rect",null)}}}});Zn({tags:["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]})});var Y0=N((ud,K0)=>{"use strict";K0.exports={VALUE:1,ATTR:2,REMOVE_ATTR:3,REMOVE:4,MOVE:5,INSERT:6}});var pa=N((xd,io)=>{"use strict";io.exports=Er;var he=xe(),ax=yt(),to=$r(),ft=Bt(),nx=Rn(),ix=On(),br=Mt(),sx=Hn(),ox=Bn(),cx=_r(),lx=v0(),ux=A0(),Q0=pr(),$0=ca(),Z0=ra(),xx=Kn(),ha=Zr(),ti=fa(),fx=ei(),B=ee(),jt=Y0(),zt=B.NAMESPACE,ri=Kr().isApiWritable;function Er(e,t){to.call(this),this.nodeType=he.DOCUMENT_NODE,this.isHTML=e,this._address=t||"about:blank",this.readyState="loading",this.implementation=new cx(this),this.ownerDocument=null,this._contentType=e?"text/html":"application/xml",this.doctype=null,this.documentElement=null,this._templateDocCache=null,this._nodeIterators=null,this._nid=1,this._nextnid=2,this._nodes=[null,this],this.byId=Object.create(null),this.modclock=0}var dx={event:"Event",customevent:"CustomEvent",uievent:"UIEvent",mouseevent:"MouseEvent"},hx={events:"event",htmlevents:"event",mouseevents:"mouseevent",mutationevents:"mutationevent",uievents:"uievent"},Gt=function(e,t,r){return{get:function(){var a=e.call(this);return a?a[t]:r},set:function(a){var s=e.call(this);s&&(s[t]=a)}}};function J0(e,t){var r,a,s;return e===""&&(e=null),ha.isValidQName(t)||B.InvalidCharacterError(),r=null,a=t,s=t.indexOf(":"),s>=0&&(r=t.substring(0,s),a=t.substring(s+1)),r!==null&&e===null&&B.NamespaceError(),r==="xml"&&e!==zt.XML&&B.NamespaceError(),(r==="xmlns"||t==="xmlns")&&e!==zt.XMLNS&&B.NamespaceError(),e===zt.XMLNS&&!(r==="xmlns"||t==="xmlns")&&B.NamespaceError(),{namespace:e,prefix:r,localName:a}}Er.prototype=Object.create(to.prototype,{_setMutationHandler:{value:function(e){this.mutationHandler=e}},_dispatchRendererEvent:{value:function(e,t,r){var a=this._nodes[e];a&&a._dispatchEvent(new br(t,r),!0)}},nodeName:{value:"#document"},nodeValue:{get:function(){return null},set:function(){}},documentURI:{get:function(){return this._address},set:B.nyi},compatMode:{get:function(){return this._quirks?"BackCompat":"CSS1Compat"}},createTextNode:{value:function(e){return new nx(this,String(e))}},createComment:{value:function(e){return new ix(this,e)}},createDocumentFragment:{value:function(){return new sx(this)}},createProcessingInstruction:{value:function(e,t){return(!ha.isValidName(e)||t.indexOf("?>")!==-1)&&B.InvalidCharacterError(),new ox(this,e,t)}},createAttribute:{value:function(e){return e=String(e),ha.isValidName(e)||B.InvalidCharacterError(),this.isHTML&&(e=B.toASCIILowerCase(e)),new ft._Attr(null,e,null,null,"")}},createAttributeNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=J0(e,t);return new ft._Attr(null,r.localName,r.prefix,r.namespace,"")}},createElement:{value:function(e){return e=String(e),ha.isValidName(e)||B.InvalidCharacterError(),this.isHTML?(/[A-Z]/.test(e)&&(e=B.toASCIILowerCase(e)),ti.createElement(this,e,null)):this.contentType==="application/xhtml+xml"?ti.createElement(this,e,null):new ft(this,e,null,null)},writable:ri},createElementNS:{value:function(e,t){e=e==null||e===""?null:String(e),t=String(t);var r=J0(e,t);return this._createElementNS(r.localName,r.namespace,r.prefix)},writable:ri},_createElementNS:{value:function(e,t,r){return t===zt.HTML?ti.createElement(this,e,r):t===zt.SVG?fx.createElement(this,e,r):new ft(this,e,t,r)}},createEvent:{value:function(t){t=t.toLowerCase();var r=hx[t]||t,a=xx[dx[r]];if(a){var s=new a;return s._initialized=!1,s}else B.NotSupportedError()}},createTreeWalker:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof he))throw new TypeError("root not a node");return t=t===void 0?Q0.SHOW_ALL:+t,r=r===void 0?null:r,new lx(e,t,r)}},createNodeIterator:{value:function(e,t,r){if(!e)throw new TypeError("root argument is required");if(!(e instanceof he))throw new TypeError("root not a node");return t=t===void 0?Q0.SHOW_ALL:+t,r=r===void 0?null:r,new ux(e,t,r)}},_attachNodeIterator:{value:function(e){this._nodeIterators||(this._nodeIterators=[]),this._nodeIterators.push(e)}},_detachNodeIterator:{value:function(e){var t=this._nodeIterators.indexOf(e);this._nodeIterators.splice(t,1)}},_preremoveNodeIterators:{value:function(e){this._nodeIterators&&this._nodeIterators.forEach(function(t){t._preremove(e)})}},_updateDocTypeElement:{value:function(){this.doctype=this.documentElement=null;for(var t=this.firstChild;t!==null;t=t.nextSibling)t.nodeType===he.DOCUMENT_TYPE_NODE?this.doctype=t:t.nodeType===he.ELEMENT_NODE&&(this.documentElement=t)}},insertBefore:{value:function(t,r){return he.prototype.insertBefore.call(this,t,r),this._updateDocTypeElement(),t}},replaceChild:{value:function(t,r){return he.prototype.replaceChild.call(this,t,r),this._updateDocTypeElement(),r}},removeChild:{value:function(t){return he.prototype.removeChild.call(this,t),this._updateDocTypeElement(),t}},getElementById:{value:function(e){var t=this.byId[e];return t?t instanceof Ke?t.getFirst():t:null}},_hasMultipleElementsWithId:{value:function(e){return this.byId[e]instanceof Ke}},getElementsByName:{value:ft.prototype.getElementsByName},getElementsByTagName:{value:ft.prototype.getElementsByTagName},getElementsByTagNameNS:{value:ft.prototype.getElementsByTagNameNS},getElementsByClassName:{value:ft.prototype.getElementsByClassName},adoptNode:{value:function(t){return t.nodeType===he.DOCUMENT_NODE&&B.NotSupportedError(),t.nodeType===he.ATTRIBUTE_NODE||(t.parentNode&&t.parentNode.removeChild(t),t.ownerDocument!==this&&no(t,this)),t}},importNode:{value:function(t,r){return this.adoptNode(t.cloneNode(r))},writable:ri},origin:{get:function(){return null}},characterSet:{get:function(){return"UTF-8"}},contentType:{get:function(){return this._contentType}},URL:{get:function(){return this._address}},domain:{get:B.nyi,set:B.nyi},referrer:{get:B.nyi},cookie:{get:B.nyi,set:B.nyi},lastModified:{get:B.nyi},location:{get:function(){return this.defaultView?this.defaultView.location:null},set:B.nyi},_titleElement:{get:function(){return this.getElementsByTagName("title").item(0)||null}},title:{get:function(){var e=this._titleElement,t=e?e.textContent:"";return t.replace(/[ \t\n\r\f]+/g," ").replace(/(^ )|( $)/g,"")},set:function(e){var t=this._titleElement,r=this.head;!t&&!r||(t||(t=this.createElement("title"),r.appendChild(t)),t.textContent=e)}},dir:Gt(function(){var e=this.documentElement;if(e&&e.tagName==="HTML")return e},"dir",""),fgColor:Gt(function(){return this.body},"text",""),linkColor:Gt(function(){return this.body},"link",""),vlinkColor:Gt(function(){return this.body},"vLink",""),alinkColor:Gt(function(){return this.body},"aLink",""),bgColor:Gt(function(){return this.body},"bgColor",""),charset:{get:function(){return this.characterSet}},inputEncoding:{get:function(){return this.characterSet}},scrollingElement:{get:function(){return this._quirks?this.body:this.documentElement}},body:{get:function(){return eo(this.documentElement,"body")},set:B.nyi},head:{get:function(){return eo(this.documentElement,"head")}},images:{get:B.nyi},embeds:{get:B.nyi},plugins:{get:B.nyi},links:{get:B.nyi},forms:{get:B.nyi},scripts:{get:B.nyi},applets:{get:function(){return[]}},activeElement:{get:function(){return null}},innerHTML:{get:function(){return this.serialize()},set:B.nyi},outerHTML:{get:function(){return this.serialize()},set:B.nyi},write:{value:function(e){if(this.isHTML||B.InvalidStateError(),!!this._parser){this._parser;var t=arguments.join("");this._parser.parse(t)}}},writeln:{value:function(t){this.write(Array.prototype.join.call(arguments,"")+` -`)}},open:{value:function(){this.documentElement=null}},close:{value:function(){this.readyState="interactive",this._dispatchEvent(new br("readystatechange"),!0),this._dispatchEvent(new br("DOMContentLoaded"),!0),this.readyState="complete",this._dispatchEvent(new br("readystatechange"),!0),this.defaultView&&this.defaultView._dispatchEvent(new br("load"),!0)}},clone:{value:function(){var t=new Er(this.isHTML,this._address);return t._quirks=this._quirks,t._contentType=this._contentType,t}},cloneNode:{value:function(t){var r=he.prototype.cloneNode.call(this,!1);if(t)for(var a=this.firstChild;a!==null;a=a.nextSibling)r._appendChild(r.importNode(a,!0));return r._updateDocTypeElement(),r}},isEqual:{value:function(t){return!0}},mutateValue:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.VALUE,target:e,data:e.data})}},mutateAttr:{value:function(e,t){this.mutationHandler&&this.mutationHandler({type:jt.ATTR,target:e.ownerElement,attr:e})}},mutateRemoveAttr:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.REMOVE_ATTR,target:e.ownerElement,attr:e})}},mutateRemove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.REMOVE,target:e.parentNode,node:e}),ao(e)}},mutateInsert:{value:function(e){ro(e),this.mutationHandler&&this.mutationHandler({type:jt.INSERT,target:e.parentNode,node:e})}},mutateMove:{value:function(e){this.mutationHandler&&this.mutationHandler({type:jt.MOVE,target:e})}},addId:{value:function(t,r){var a=this.byId[t];a?(a instanceof Ke||(a=new Ke(a),this.byId[t]=a),a.add(r)):this.byId[t]=r}},delId:{value:function(t,r){var a=this.byId[t];B.assert(a),a instanceof Ke?(a.del(r),a.length===1&&(this.byId[t]=a.downgrade())):this.byId[t]=void 0}},_resolve:{value:function(e){return new $0(this._documentBaseURL).resolve(e)}},_documentBaseURL:{get:function(){var e=this._address;e==="about:blank"&&(e="/");var t=this.querySelector("base[href]");return t?new $0(e).resolve(t.getAttribute("href")):e}},_templateDoc:{get:function(){if(!this._templateDocCache){var e=new Er(this.isHTML,this._address);this._templateDocCache=e._templateDocCache=e}return this._templateDocCache}},querySelector:{value:function(e){return Z0(e,this)[0]}},querySelectorAll:{value:function(e){var t=Z0(e,this);return t.item?t:new ax(t)}}});var px=["abort","canplay","canplaythrough","change","click","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","input","invalid","keydown","keypress","keyup","loadeddata","loadedmetadata","loadstart","mousedown","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","readystatechange","reset","seeked","seeking","select","show","stalled","submit","suspend","timeupdate","volumechange","waiting","blur","error","focus","load","scroll"];px.forEach(function(e){Object.defineProperty(Er.prototype,"on"+e,{get:function(){return this._getEventHandler(e)},set:function(t){this._setEventHandler(e,t)}})});function eo(e,t){if(e&&e.isHTML){for(var r=e.firstChild;r!==null;r=r.nextSibling)if(r.nodeType===he.ELEMENT_NODE&&r.localName===t&&r.namespaceURI===zt.HTML)return r}return null}function mx(e){if(e._nid=e.ownerDocument._nextnid++,e.ownerDocument._nodes[e._nid]=e,e.nodeType===he.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.addId(t,e),e._roothook&&e._roothook()}}function gx(e){if(e.nodeType===he.ELEMENT_NODE){var t=e.getAttribute("id");t&&e.ownerDocument.delId(t,e)}e.ownerDocument._nodes[e._nid]=void 0,e._nid=void 0}function ro(e){if(mx(e),e.nodeType===he.ELEMENT_NODE)for(var t=e.firstChild;t!==null;t=t.nextSibling)ro(t)}function ao(e){gx(e);for(var t=e.firstChild;t!==null;t=t.nextSibling)ao(t)}function no(e,t){e.ownerDocument=t,e._lastModTime=void 0,Object.prototype.hasOwnProperty.call(e,"_tagName")&&(e._tagName=void 0);for(var r=e.firstChild;r!==null;r=r.nextSibling)no(r,t)}function Ke(e){this.nodes=Object.create(null),this.nodes[e._nid]=e,this.length=1,this.firstNode=void 0}Ke.prototype.add=function(e){this.nodes[e._nid]||(this.nodes[e._nid]=e,this.length++,this.firstNode=void 0)};Ke.prototype.del=function(e){this.nodes[e._nid]&&(delete this.nodes[e._nid],this.length--,this.firstNode=void 0)};Ke.prototype.getFirst=function(){if(!this.firstNode){var e;for(e in this.nodes)(this.firstNode===void 0||this.firstNode.compareDocumentPosition(this.nodes[e])&he.DOCUMENT_POSITION_PRECEDING)&&(this.firstNode=this.nodes[e])}return this.firstNode};Ke.prototype.downgrade=function(){if(this.length===1){var e;for(e in this.nodes)return this.nodes[e]}return this}});var ga=N((fd,oo)=>{"use strict";oo.exports=ma;var bx=xe(),so=Ln(),Ex=aa();function ma(e,t,r,a){so.call(this),this.nodeType=bx.DOCUMENT_TYPE_NODE,this.ownerDocument=e||null,this.name=t,this.publicId=r||"",this.systemId=a||""}ma.prototype=Object.create(so.prototype,{nodeName:{get:function(){return this.name}},nodeValue:{get:function(){return null},set:function(){}},clone:{value:function(){return new ma(this.ownerDocument,this.name,this.publicId,this.systemId)}},isEqual:{value:function(t){return this.name===t.name&&this.publicId===t.publicId&&this.systemId===t.systemId}}});Object.defineProperties(ma.prototype,Ex)});var Na=N((dd,Lo)=>{"use strict";Lo.exports=q;var _x=pa(),vx=ga(),ai=xe(),w=ee().NAMESPACE,yo=fa(),G=yo.elements,wt=Function.prototype.apply.bind(Array.prototype.push),ba=-1,Wt=1,pe=2,I=3,Fe=4,Tx=5,yx=[],Nx=/^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i,wx="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",co=/^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i,Sx=/^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i,At=Object.create(null);At[w.HTML]={__proto__:null,address:!0,applet:!0,area:!0,article:!0,aside:!0,base:!0,basefont:!0,bgsound:!0,blockquote:!0,body:!0,br:!0,button:!0,caption:!0,center:!0,col:!0,colgroup:!0,dd:!0,details:!0,dir:!0,div:!0,dl:!0,dt:!0,embed:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,frame:!0,frameset:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,head:!0,header:!0,hgroup:!0,hr:!0,html:!0,iframe:!0,img:!0,input:!0,li:!0,link:!0,listing:!0,main:!0,marquee:!0,menu:!0,meta:!0,nav:!0,noembed:!0,noframes:!0,noscript:!0,object:!0,ol:!0,p:!0,param:!0,plaintext:!0,pre:!0,script:!0,section:!0,select:!0,source:!0,style:!0,summary:!0,table:!0,tbody:!0,td:!0,template:!0,textarea:!0,tfoot:!0,th:!0,thead:!0,title:!0,tr:!0,track:!0,ul:!0,wbr:!0,xmp:!0};At[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};At[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};var si=Object.create(null);si[w.HTML]={__proto__:null,address:!0,div:!0,p:!0};var No=Object.create(null);No[w.HTML]={__proto__:null,dd:!0,dt:!0};var Xt=Object.create(null);Xt[w.HTML]={__proto__:null,table:!0,thead:!0,tbody:!0,tfoot:!0,tr:!0};var wo=Object.create(null);wo[w.HTML]={__proto__:null,dd:!0,dt:!0,li:!0,menuitem:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0};var So=Object.create(null);So[w.HTML]={__proto__:null,caption:!0,colgroup:!0,dd:!0,dt:!0,li:!0,optgroup:!0,option:!0,p:!0,rb:!0,rp:!0,rt:!0,rtc:!0,tbody:!0,td:!0,tfoot:!0,th:!0,thead:!0,tr:!0};var va=Object.create(null);va[w.HTML]={__proto__:null,table:!0,template:!0,html:!0};var Ta=Object.create(null);Ta[w.HTML]={__proto__:null,tbody:!0,tfoot:!0,thead:!0,template:!0,html:!0};var oi=Object.create(null);oi[w.HTML]={__proto__:null,tr:!0,template:!0,html:!0};var Ao=Object.create(null);Ao[w.HTML]={__proto__:null,button:!0,fieldset:!0,input:!0,keygen:!0,object:!0,output:!0,select:!0,textarea:!0,img:!0};var Be=Object.create(null);Be[w.HTML]={__proto__:null,applet:!0,caption:!0,html:!0,table:!0,td:!0,th:!0,marquee:!0,object:!0,template:!0};Be[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0,"annotation-xml":!0};Be[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var ya=Object.create(Be);ya[w.HTML]=Object.create(Be[w.HTML]);ya[w.HTML].ol=!0;ya[w.HTML].ul=!0;var ci=Object.create(Be);ci[w.HTML]=Object.create(Be[w.HTML]);ci[w.HTML].button=!0;var Co=Object.create(null);Co[w.HTML]={__proto__:null,html:!0,table:!0,template:!0};var Ax=Object.create(null);Ax[w.HTML]={__proto__:null,optgroup:!0,option:!0};var Do=Object.create(null);Do[w.MATHML]={__proto__:null,mi:!0,mo:!0,mn:!0,ms:!0,mtext:!0};var ko=Object.create(null);ko[w.SVG]={__proto__:null,foreignObject:!0,desc:!0,title:!0};var lo={__proto__:null,"xlink:actuate":w.XLINK,"xlink:arcrole":w.XLINK,"xlink:href":w.XLINK,"xlink:role":w.XLINK,"xlink:show":w.XLINK,"xlink:title":w.XLINK,"xlink:type":w.XLINK,"xml:base":w.XML,"xml:lang":w.XML,"xml:space":w.XML,xmlns:w.XMLNS,"xmlns:xlink":w.XMLNS},uo={__proto__:null,attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},xo={__proto__:null,altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},fo={__proto__:null,0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},Cx={__proto__:null,AElig:198,"AElig;":198,AMP:38,"AMP;":38,Aacute:193,"Aacute;":193,"Abreve;":258,Acirc:194,"Acirc;":194,"Acy;":1040,"Afr;":[55349,56580],Agrave:192,"Agrave;":192,"Alpha;":913,"Amacr;":256,"And;":10835,"Aogon;":260,"Aopf;":[55349,56632],"ApplyFunction;":8289,Aring:197,"Aring;":197,"Ascr;":[55349,56476],"Assign;":8788,Atilde:195,"Atilde;":195,Auml:196,"Auml;":196,"Backslash;":8726,"Barv;":10983,"Barwed;":8966,"Bcy;":1041,"Because;":8757,"Bernoullis;":8492,"Beta;":914,"Bfr;":[55349,56581],"Bopf;":[55349,56633],"Breve;":728,"Bscr;":8492,"Bumpeq;":8782,"CHcy;":1063,COPY:169,"COPY;":169,"Cacute;":262,"Cap;":8914,"CapitalDifferentialD;":8517,"Cayleys;":8493,"Ccaron;":268,Ccedil:199,"Ccedil;":199,"Ccirc;":264,"Cconint;":8752,"Cdot;":266,"Cedilla;":184,"CenterDot;":183,"Cfr;":8493,"Chi;":935,"CircleDot;":8857,"CircleMinus;":8854,"CirclePlus;":8853,"CircleTimes;":8855,"ClockwiseContourIntegral;":8754,"CloseCurlyDoubleQuote;":8221,"CloseCurlyQuote;":8217,"Colon;":8759,"Colone;":10868,"Congruent;":8801,"Conint;":8751,"ContourIntegral;":8750,"Copf;":8450,"Coproduct;":8720,"CounterClockwiseContourIntegral;":8755,"Cross;":10799,"Cscr;":[55349,56478],"Cup;":8915,"CupCap;":8781,"DD;":8517,"DDotrahd;":10513,"DJcy;":1026,"DScy;":1029,"DZcy;":1039,"Dagger;":8225,"Darr;":8609,"Dashv;":10980,"Dcaron;":270,"Dcy;":1044,"Del;":8711,"Delta;":916,"Dfr;":[55349,56583],"DiacriticalAcute;":180,"DiacriticalDot;":729,"DiacriticalDoubleAcute;":733,"DiacriticalGrave;":96,"DiacriticalTilde;":732,"Diamond;":8900,"DifferentialD;":8518,"Dopf;":[55349,56635],"Dot;":168,"DotDot;":8412,"DotEqual;":8784,"DoubleContourIntegral;":8751,"DoubleDot;":168,"DoubleDownArrow;":8659,"DoubleLeftArrow;":8656,"DoubleLeftRightArrow;":8660,"DoubleLeftTee;":10980,"DoubleLongLeftArrow;":10232,"DoubleLongLeftRightArrow;":10234,"DoubleLongRightArrow;":10233,"DoubleRightArrow;":8658,"DoubleRightTee;":8872,"DoubleUpArrow;":8657,"DoubleUpDownArrow;":8661,"DoubleVerticalBar;":8741,"DownArrow;":8595,"DownArrowBar;":10515,"DownArrowUpArrow;":8693,"DownBreve;":785,"DownLeftRightVector;":10576,"DownLeftTeeVector;":10590,"DownLeftVector;":8637,"DownLeftVectorBar;":10582,"DownRightTeeVector;":10591,"DownRightVector;":8641,"DownRightVectorBar;":10583,"DownTee;":8868,"DownTeeArrow;":8615,"Downarrow;":8659,"Dscr;":[55349,56479],"Dstrok;":272,"ENG;":330,ETH:208,"ETH;":208,Eacute:201,"Eacute;":201,"Ecaron;":282,Ecirc:202,"Ecirc;":202,"Ecy;":1069,"Edot;":278,"Efr;":[55349,56584],Egrave:200,"Egrave;":200,"Element;":8712,"Emacr;":274,"EmptySmallSquare;":9723,"EmptyVerySmallSquare;":9643,"Eogon;":280,"Eopf;":[55349,56636],"Epsilon;":917,"Equal;":10869,"EqualTilde;":8770,"Equilibrium;":8652,"Escr;":8496,"Esim;":10867,"Eta;":919,Euml:203,"Euml;":203,"Exists;":8707,"ExponentialE;":8519,"Fcy;":1060,"Ffr;":[55349,56585],"FilledSmallSquare;":9724,"FilledVerySmallSquare;":9642,"Fopf;":[55349,56637],"ForAll;":8704,"Fouriertrf;":8497,"Fscr;":8497,"GJcy;":1027,GT:62,"GT;":62,"Gamma;":915,"Gammad;":988,"Gbreve;":286,"Gcedil;":290,"Gcirc;":284,"Gcy;":1043,"Gdot;":288,"Gfr;":[55349,56586],"Gg;":8921,"Gopf;":[55349,56638],"GreaterEqual;":8805,"GreaterEqualLess;":8923,"GreaterFullEqual;":8807,"GreaterGreater;":10914,"GreaterLess;":8823,"GreaterSlantEqual;":10878,"GreaterTilde;":8819,"Gscr;":[55349,56482],"Gt;":8811,"HARDcy;":1066,"Hacek;":711,"Hat;":94,"Hcirc;":292,"Hfr;":8460,"HilbertSpace;":8459,"Hopf;":8461,"HorizontalLine;":9472,"Hscr;":8459,"Hstrok;":294,"HumpDownHump;":8782,"HumpEqual;":8783,"IEcy;":1045,"IJlig;":306,"IOcy;":1025,Iacute:205,"Iacute;":205,Icirc:206,"Icirc;":206,"Icy;":1048,"Idot;":304,"Ifr;":8465,Igrave:204,"Igrave;":204,"Im;":8465,"Imacr;":298,"ImaginaryI;":8520,"Implies;":8658,"Int;":8748,"Integral;":8747,"Intersection;":8898,"InvisibleComma;":8291,"InvisibleTimes;":8290,"Iogon;":302,"Iopf;":[55349,56640],"Iota;":921,"Iscr;":8464,"Itilde;":296,"Iukcy;":1030,Iuml:207,"Iuml;":207,"Jcirc;":308,"Jcy;":1049,"Jfr;":[55349,56589],"Jopf;":[55349,56641],"Jscr;":[55349,56485],"Jsercy;":1032,"Jukcy;":1028,"KHcy;":1061,"KJcy;":1036,"Kappa;":922,"Kcedil;":310,"Kcy;":1050,"Kfr;":[55349,56590],"Kopf;":[55349,56642],"Kscr;":[55349,56486],"LJcy;":1033,LT:60,"LT;":60,"Lacute;":313,"Lambda;":923,"Lang;":10218,"Laplacetrf;":8466,"Larr;":8606,"Lcaron;":317,"Lcedil;":315,"Lcy;":1051,"LeftAngleBracket;":10216,"LeftArrow;":8592,"LeftArrowBar;":8676,"LeftArrowRightArrow;":8646,"LeftCeiling;":8968,"LeftDoubleBracket;":10214,"LeftDownTeeVector;":10593,"LeftDownVector;":8643,"LeftDownVectorBar;":10585,"LeftFloor;":8970,"LeftRightArrow;":8596,"LeftRightVector;":10574,"LeftTee;":8867,"LeftTeeArrow;":8612,"LeftTeeVector;":10586,"LeftTriangle;":8882,"LeftTriangleBar;":10703,"LeftTriangleEqual;":8884,"LeftUpDownVector;":10577,"LeftUpTeeVector;":10592,"LeftUpVector;":8639,"LeftUpVectorBar;":10584,"LeftVector;":8636,"LeftVectorBar;":10578,"Leftarrow;":8656,"Leftrightarrow;":8660,"LessEqualGreater;":8922,"LessFullEqual;":8806,"LessGreater;":8822,"LessLess;":10913,"LessSlantEqual;":10877,"LessTilde;":8818,"Lfr;":[55349,56591],"Ll;":8920,"Lleftarrow;":8666,"Lmidot;":319,"LongLeftArrow;":10229,"LongLeftRightArrow;":10231,"LongRightArrow;":10230,"Longleftarrow;":10232,"Longleftrightarrow;":10234,"Longrightarrow;":10233,"Lopf;":[55349,56643],"LowerLeftArrow;":8601,"LowerRightArrow;":8600,"Lscr;":8466,"Lsh;":8624,"Lstrok;":321,"Lt;":8810,"Map;":10501,"Mcy;":1052,"MediumSpace;":8287,"Mellintrf;":8499,"Mfr;":[55349,56592],"MinusPlus;":8723,"Mopf;":[55349,56644],"Mscr;":8499,"Mu;":924,"NJcy;":1034,"Nacute;":323,"Ncaron;":327,"Ncedil;":325,"Ncy;":1053,"NegativeMediumSpace;":8203,"NegativeThickSpace;":8203,"NegativeThinSpace;":8203,"NegativeVeryThinSpace;":8203,"NestedGreaterGreater;":8811,"NestedLessLess;":8810,"NewLine;":10,"Nfr;":[55349,56593],"NoBreak;":8288,"NonBreakingSpace;":160,"Nopf;":8469,"Not;":10988,"NotCongruent;":8802,"NotCupCap;":8813,"NotDoubleVerticalBar;":8742,"NotElement;":8713,"NotEqual;":8800,"NotEqualTilde;":[8770,824],"NotExists;":8708,"NotGreater;":8815,"NotGreaterEqual;":8817,"NotGreaterFullEqual;":[8807,824],"NotGreaterGreater;":[8811,824],"NotGreaterLess;":8825,"NotGreaterSlantEqual;":[10878,824],"NotGreaterTilde;":8821,"NotHumpDownHump;":[8782,824],"NotHumpEqual;":[8783,824],"NotLeftTriangle;":8938,"NotLeftTriangleBar;":[10703,824],"NotLeftTriangleEqual;":8940,"NotLess;":8814,"NotLessEqual;":8816,"NotLessGreater;":8824,"NotLessLess;":[8810,824],"NotLessSlantEqual;":[10877,824],"NotLessTilde;":8820,"NotNestedGreaterGreater;":[10914,824],"NotNestedLessLess;":[10913,824],"NotPrecedes;":8832,"NotPrecedesEqual;":[10927,824],"NotPrecedesSlantEqual;":8928,"NotReverseElement;":8716,"NotRightTriangle;":8939,"NotRightTriangleBar;":[10704,824],"NotRightTriangleEqual;":8941,"NotSquareSubset;":[8847,824],"NotSquareSubsetEqual;":8930,"NotSquareSuperset;":[8848,824],"NotSquareSupersetEqual;":8931,"NotSubset;":[8834,8402],"NotSubsetEqual;":8840,"NotSucceeds;":8833,"NotSucceedsEqual;":[10928,824],"NotSucceedsSlantEqual;":8929,"NotSucceedsTilde;":[8831,824],"NotSuperset;":[8835,8402],"NotSupersetEqual;":8841,"NotTilde;":8769,"NotTildeEqual;":8772,"NotTildeFullEqual;":8775,"NotTildeTilde;":8777,"NotVerticalBar;":8740,"Nscr;":[55349,56489],Ntilde:209,"Ntilde;":209,"Nu;":925,"OElig;":338,Oacute:211,"Oacute;":211,Ocirc:212,"Ocirc;":212,"Ocy;":1054,"Odblac;":336,"Ofr;":[55349,56594],Ograve:210,"Ograve;":210,"Omacr;":332,"Omega;":937,"Omicron;":927,"Oopf;":[55349,56646],"OpenCurlyDoubleQuote;":8220,"OpenCurlyQuote;":8216,"Or;":10836,"Oscr;":[55349,56490],Oslash:216,"Oslash;":216,Otilde:213,"Otilde;":213,"Otimes;":10807,Ouml:214,"Ouml;":214,"OverBar;":8254,"OverBrace;":9182,"OverBracket;":9140,"OverParenthesis;":9180,"PartialD;":8706,"Pcy;":1055,"Pfr;":[55349,56595],"Phi;":934,"Pi;":928,"PlusMinus;":177,"Poincareplane;":8460,"Popf;":8473,"Pr;":10939,"Precedes;":8826,"PrecedesEqual;":10927,"PrecedesSlantEqual;":8828,"PrecedesTilde;":8830,"Prime;":8243,"Product;":8719,"Proportion;":8759,"Proportional;":8733,"Pscr;":[55349,56491],"Psi;":936,QUOT:34,"QUOT;":34,"Qfr;":[55349,56596],"Qopf;":8474,"Qscr;":[55349,56492],"RBarr;":10512,REG:174,"REG;":174,"Racute;":340,"Rang;":10219,"Rarr;":8608,"Rarrtl;":10518,"Rcaron;":344,"Rcedil;":342,"Rcy;":1056,"Re;":8476,"ReverseElement;":8715,"ReverseEquilibrium;":8651,"ReverseUpEquilibrium;":10607,"Rfr;":8476,"Rho;":929,"RightAngleBracket;":10217,"RightArrow;":8594,"RightArrowBar;":8677,"RightArrowLeftArrow;":8644,"RightCeiling;":8969,"RightDoubleBracket;":10215,"RightDownTeeVector;":10589,"RightDownVector;":8642,"RightDownVectorBar;":10581,"RightFloor;":8971,"RightTee;":8866,"RightTeeArrow;":8614,"RightTeeVector;":10587,"RightTriangle;":8883,"RightTriangleBar;":10704,"RightTriangleEqual;":8885,"RightUpDownVector;":10575,"RightUpTeeVector;":10588,"RightUpVector;":8638,"RightUpVectorBar;":10580,"RightVector;":8640,"RightVectorBar;":10579,"Rightarrow;":8658,"Ropf;":8477,"RoundImplies;":10608,"Rrightarrow;":8667,"Rscr;":8475,"Rsh;":8625,"RuleDelayed;":10740,"SHCHcy;":1065,"SHcy;":1064,"SOFTcy;":1068,"Sacute;":346,"Sc;":10940,"Scaron;":352,"Scedil;":350,"Scirc;":348,"Scy;":1057,"Sfr;":[55349,56598],"ShortDownArrow;":8595,"ShortLeftArrow;":8592,"ShortRightArrow;":8594,"ShortUpArrow;":8593,"Sigma;":931,"SmallCircle;":8728,"Sopf;":[55349,56650],"Sqrt;":8730,"Square;":9633,"SquareIntersection;":8851,"SquareSubset;":8847,"SquareSubsetEqual;":8849,"SquareSuperset;":8848,"SquareSupersetEqual;":8850,"SquareUnion;":8852,"Sscr;":[55349,56494],"Star;":8902,"Sub;":8912,"Subset;":8912,"SubsetEqual;":8838,"Succeeds;":8827,"SucceedsEqual;":10928,"SucceedsSlantEqual;":8829,"SucceedsTilde;":8831,"SuchThat;":8715,"Sum;":8721,"Sup;":8913,"Superset;":8835,"SupersetEqual;":8839,"Supset;":8913,THORN:222,"THORN;":222,"TRADE;":8482,"TSHcy;":1035,"TScy;":1062,"Tab;":9,"Tau;":932,"Tcaron;":356,"Tcedil;":354,"Tcy;":1058,"Tfr;":[55349,56599],"Therefore;":8756,"Theta;":920,"ThickSpace;":[8287,8202],"ThinSpace;":8201,"Tilde;":8764,"TildeEqual;":8771,"TildeFullEqual;":8773,"TildeTilde;":8776,"Topf;":[55349,56651],"TripleDot;":8411,"Tscr;":[55349,56495],"Tstrok;":358,Uacute:218,"Uacute;":218,"Uarr;":8607,"Uarrocir;":10569,"Ubrcy;":1038,"Ubreve;":364,Ucirc:219,"Ucirc;":219,"Ucy;":1059,"Udblac;":368,"Ufr;":[55349,56600],Ugrave:217,"Ugrave;":217,"Umacr;":362,"UnderBar;":95,"UnderBrace;":9183,"UnderBracket;":9141,"UnderParenthesis;":9181,"Union;":8899,"UnionPlus;":8846,"Uogon;":370,"Uopf;":[55349,56652],"UpArrow;":8593,"UpArrowBar;":10514,"UpArrowDownArrow;":8645,"UpDownArrow;":8597,"UpEquilibrium;":10606,"UpTee;":8869,"UpTeeArrow;":8613,"Uparrow;":8657,"Updownarrow;":8661,"UpperLeftArrow;":8598,"UpperRightArrow;":8599,"Upsi;":978,"Upsilon;":933,"Uring;":366,"Uscr;":[55349,56496],"Utilde;":360,Uuml:220,"Uuml;":220,"VDash;":8875,"Vbar;":10987,"Vcy;":1042,"Vdash;":8873,"Vdashl;":10982,"Vee;":8897,"Verbar;":8214,"Vert;":8214,"VerticalBar;":8739,"VerticalLine;":124,"VerticalSeparator;":10072,"VerticalTilde;":8768,"VeryThinSpace;":8202,"Vfr;":[55349,56601],"Vopf;":[55349,56653],"Vscr;":[55349,56497],"Vvdash;":8874,"Wcirc;":372,"Wedge;":8896,"Wfr;":[55349,56602],"Wopf;":[55349,56654],"Wscr;":[55349,56498],"Xfr;":[55349,56603],"Xi;":926,"Xopf;":[55349,56655],"Xscr;":[55349,56499],"YAcy;":1071,"YIcy;":1031,"YUcy;":1070,Yacute:221,"Yacute;":221,"Ycirc;":374,"Ycy;":1067,"Yfr;":[55349,56604],"Yopf;":[55349,56656],"Yscr;":[55349,56500],"Yuml;":376,"ZHcy;":1046,"Zacute;":377,"Zcaron;":381,"Zcy;":1047,"Zdot;":379,"ZeroWidthSpace;":8203,"Zeta;":918,"Zfr;":8488,"Zopf;":8484,"Zscr;":[55349,56501],aacute:225,"aacute;":225,"abreve;":259,"ac;":8766,"acE;":[8766,819],"acd;":8767,acirc:226,"acirc;":226,acute:180,"acute;":180,"acy;":1072,aelig:230,"aelig;":230,"af;":8289,"afr;":[55349,56606],agrave:224,"agrave;":224,"alefsym;":8501,"aleph;":8501,"alpha;":945,"amacr;":257,"amalg;":10815,amp:38,"amp;":38,"and;":8743,"andand;":10837,"andd;":10844,"andslope;":10840,"andv;":10842,"ang;":8736,"ange;":10660,"angle;":8736,"angmsd;":8737,"angmsdaa;":10664,"angmsdab;":10665,"angmsdac;":10666,"angmsdad;":10667,"angmsdae;":10668,"angmsdaf;":10669,"angmsdag;":10670,"angmsdah;":10671,"angrt;":8735,"angrtvb;":8894,"angrtvbd;":10653,"angsph;":8738,"angst;":197,"angzarr;":9084,"aogon;":261,"aopf;":[55349,56658],"ap;":8776,"apE;":10864,"apacir;":10863,"ape;":8778,"apid;":8779,"apos;":39,"approx;":8776,"approxeq;":8778,aring:229,"aring;":229,"ascr;":[55349,56502],"ast;":42,"asymp;":8776,"asympeq;":8781,atilde:227,"atilde;":227,auml:228,"auml;":228,"awconint;":8755,"awint;":10769,"bNot;":10989,"backcong;":8780,"backepsilon;":1014,"backprime;":8245,"backsim;":8765,"backsimeq;":8909,"barvee;":8893,"barwed;":8965,"barwedge;":8965,"bbrk;":9141,"bbrktbrk;":9142,"bcong;":8780,"bcy;":1073,"bdquo;":8222,"becaus;":8757,"because;":8757,"bemptyv;":10672,"bepsi;":1014,"bernou;":8492,"beta;":946,"beth;":8502,"between;":8812,"bfr;":[55349,56607],"bigcap;":8898,"bigcirc;":9711,"bigcup;":8899,"bigodot;":10752,"bigoplus;":10753,"bigotimes;":10754,"bigsqcup;":10758,"bigstar;":9733,"bigtriangledown;":9661,"bigtriangleup;":9651,"biguplus;":10756,"bigvee;":8897,"bigwedge;":8896,"bkarow;":10509,"blacklozenge;":10731,"blacksquare;":9642,"blacktriangle;":9652,"blacktriangledown;":9662,"blacktriangleleft;":9666,"blacktriangleright;":9656,"blank;":9251,"blk12;":9618,"blk14;":9617,"blk34;":9619,"block;":9608,"bne;":[61,8421],"bnequiv;":[8801,8421],"bnot;":8976,"bopf;":[55349,56659],"bot;":8869,"bottom;":8869,"bowtie;":8904,"boxDL;":9559,"boxDR;":9556,"boxDl;":9558,"boxDr;":9555,"boxH;":9552,"boxHD;":9574,"boxHU;":9577,"boxHd;":9572,"boxHu;":9575,"boxUL;":9565,"boxUR;":9562,"boxUl;":9564,"boxUr;":9561,"boxV;":9553,"boxVH;":9580,"boxVL;":9571,"boxVR;":9568,"boxVh;":9579,"boxVl;":9570,"boxVr;":9567,"boxbox;":10697,"boxdL;":9557,"boxdR;":9554,"boxdl;":9488,"boxdr;":9484,"boxh;":9472,"boxhD;":9573,"boxhU;":9576,"boxhd;":9516,"boxhu;":9524,"boxminus;":8863,"boxplus;":8862,"boxtimes;":8864,"boxuL;":9563,"boxuR;":9560,"boxul;":9496,"boxur;":9492,"boxv;":9474,"boxvH;":9578,"boxvL;":9569,"boxvR;":9566,"boxvh;":9532,"boxvl;":9508,"boxvr;":9500,"bprime;":8245,"breve;":728,brvbar:166,"brvbar;":166,"bscr;":[55349,56503],"bsemi;":8271,"bsim;":8765,"bsime;":8909,"bsol;":92,"bsolb;":10693,"bsolhsub;":10184,"bull;":8226,"bullet;":8226,"bump;":8782,"bumpE;":10926,"bumpe;":8783,"bumpeq;":8783,"cacute;":263,"cap;":8745,"capand;":10820,"capbrcup;":10825,"capcap;":10827,"capcup;":10823,"capdot;":10816,"caps;":[8745,65024],"caret;":8257,"caron;":711,"ccaps;":10829,"ccaron;":269,ccedil:231,"ccedil;":231,"ccirc;":265,"ccups;":10828,"ccupssm;":10832,"cdot;":267,cedil:184,"cedil;":184,"cemptyv;":10674,cent:162,"cent;":162,"centerdot;":183,"cfr;":[55349,56608],"chcy;":1095,"check;":10003,"checkmark;":10003,"chi;":967,"cir;":9675,"cirE;":10691,"circ;":710,"circeq;":8791,"circlearrowleft;":8634,"circlearrowright;":8635,"circledR;":174,"circledS;":9416,"circledast;":8859,"circledcirc;":8858,"circleddash;":8861,"cire;":8791,"cirfnint;":10768,"cirmid;":10991,"cirscir;":10690,"clubs;":9827,"clubsuit;":9827,"colon;":58,"colone;":8788,"coloneq;":8788,"comma;":44,"commat;":64,"comp;":8705,"compfn;":8728,"complement;":8705,"complexes;":8450,"cong;":8773,"congdot;":10861,"conint;":8750,"copf;":[55349,56660],"coprod;":8720,copy:169,"copy;":169,"copysr;":8471,"crarr;":8629,"cross;":10007,"cscr;":[55349,56504],"csub;":10959,"csube;":10961,"csup;":10960,"csupe;":10962,"ctdot;":8943,"cudarrl;":10552,"cudarrr;":10549,"cuepr;":8926,"cuesc;":8927,"cularr;":8630,"cularrp;":10557,"cup;":8746,"cupbrcap;":10824,"cupcap;":10822,"cupcup;":10826,"cupdot;":8845,"cupor;":10821,"cups;":[8746,65024],"curarr;":8631,"curarrm;":10556,"curlyeqprec;":8926,"curlyeqsucc;":8927,"curlyvee;":8910,"curlywedge;":8911,curren:164,"curren;":164,"curvearrowleft;":8630,"curvearrowright;":8631,"cuvee;":8910,"cuwed;":8911,"cwconint;":8754,"cwint;":8753,"cylcty;":9005,"dArr;":8659,"dHar;":10597,"dagger;":8224,"daleth;":8504,"darr;":8595,"dash;":8208,"dashv;":8867,"dbkarow;":10511,"dblac;":733,"dcaron;":271,"dcy;":1076,"dd;":8518,"ddagger;":8225,"ddarr;":8650,"ddotseq;":10871,deg:176,"deg;":176,"delta;":948,"demptyv;":10673,"dfisht;":10623,"dfr;":[55349,56609],"dharl;":8643,"dharr;":8642,"diam;":8900,"diamond;":8900,"diamondsuit;":9830,"diams;":9830,"die;":168,"digamma;":989,"disin;":8946,"div;":247,divide:247,"divide;":247,"divideontimes;":8903,"divonx;":8903,"djcy;":1106,"dlcorn;":8990,"dlcrop;":8973,"dollar;":36,"dopf;":[55349,56661],"dot;":729,"doteq;":8784,"doteqdot;":8785,"dotminus;":8760,"dotplus;":8724,"dotsquare;":8865,"doublebarwedge;":8966,"downarrow;":8595,"downdownarrows;":8650,"downharpoonleft;":8643,"downharpoonright;":8642,"drbkarow;":10512,"drcorn;":8991,"drcrop;":8972,"dscr;":[55349,56505],"dscy;":1109,"dsol;":10742,"dstrok;":273,"dtdot;":8945,"dtri;":9663,"dtrif;":9662,"duarr;":8693,"duhar;":10607,"dwangle;":10662,"dzcy;":1119,"dzigrarr;":10239,"eDDot;":10871,"eDot;":8785,eacute:233,"eacute;":233,"easter;":10862,"ecaron;":283,"ecir;":8790,ecirc:234,"ecirc;":234,"ecolon;":8789,"ecy;":1101,"edot;":279,"ee;":8519,"efDot;":8786,"efr;":[55349,56610],"eg;":10906,egrave:232,"egrave;":232,"egs;":10902,"egsdot;":10904,"el;":10905,"elinters;":9191,"ell;":8467,"els;":10901,"elsdot;":10903,"emacr;":275,"empty;":8709,"emptyset;":8709,"emptyv;":8709,"emsp13;":8196,"emsp14;":8197,"emsp;":8195,"eng;":331,"ensp;":8194,"eogon;":281,"eopf;":[55349,56662],"epar;":8917,"eparsl;":10723,"eplus;":10865,"epsi;":949,"epsilon;":949,"epsiv;":1013,"eqcirc;":8790,"eqcolon;":8789,"eqsim;":8770,"eqslantgtr;":10902,"eqslantless;":10901,"equals;":61,"equest;":8799,"equiv;":8801,"equivDD;":10872,"eqvparsl;":10725,"erDot;":8787,"erarr;":10609,"escr;":8495,"esdot;":8784,"esim;":8770,"eta;":951,eth:240,"eth;":240,euml:235,"euml;":235,"euro;":8364,"excl;":33,"exist;":8707,"expectation;":8496,"exponentiale;":8519,"fallingdotseq;":8786,"fcy;":1092,"female;":9792,"ffilig;":64259,"fflig;":64256,"ffllig;":64260,"ffr;":[55349,56611],"filig;":64257,"fjlig;":[102,106],"flat;":9837,"fllig;":64258,"fltns;":9649,"fnof;":402,"fopf;":[55349,56663],"forall;":8704,"fork;":8916,"forkv;":10969,"fpartint;":10765,frac12:189,"frac12;":189,"frac13;":8531,frac14:188,"frac14;":188,"frac15;":8533,"frac16;":8537,"frac18;":8539,"frac23;":8532,"frac25;":8534,frac34:190,"frac34;":190,"frac35;":8535,"frac38;":8540,"frac45;":8536,"frac56;":8538,"frac58;":8541,"frac78;":8542,"frasl;":8260,"frown;":8994,"fscr;":[55349,56507],"gE;":8807,"gEl;":10892,"gacute;":501,"gamma;":947,"gammad;":989,"gap;":10886,"gbreve;":287,"gcirc;":285,"gcy;":1075,"gdot;":289,"ge;":8805,"gel;":8923,"geq;":8805,"geqq;":8807,"geqslant;":10878,"ges;":10878,"gescc;":10921,"gesdot;":10880,"gesdoto;":10882,"gesdotol;":10884,"gesl;":[8923,65024],"gesles;":10900,"gfr;":[55349,56612],"gg;":8811,"ggg;":8921,"gimel;":8503,"gjcy;":1107,"gl;":8823,"glE;":10898,"gla;":10917,"glj;":10916,"gnE;":8809,"gnap;":10890,"gnapprox;":10890,"gne;":10888,"gneq;":10888,"gneqq;":8809,"gnsim;":8935,"gopf;":[55349,56664],"grave;":96,"gscr;":8458,"gsim;":8819,"gsime;":10894,"gsiml;":10896,gt:62,"gt;":62,"gtcc;":10919,"gtcir;":10874,"gtdot;":8919,"gtlPar;":10645,"gtquest;":10876,"gtrapprox;":10886,"gtrarr;":10616,"gtrdot;":8919,"gtreqless;":8923,"gtreqqless;":10892,"gtrless;":8823,"gtrsim;":8819,"gvertneqq;":[8809,65024],"gvnE;":[8809,65024],"hArr;":8660,"hairsp;":8202,"half;":189,"hamilt;":8459,"hardcy;":1098,"harr;":8596,"harrcir;":10568,"harrw;":8621,"hbar;":8463,"hcirc;":293,"hearts;":9829,"heartsuit;":9829,"hellip;":8230,"hercon;":8889,"hfr;":[55349,56613],"hksearow;":10533,"hkswarow;":10534,"hoarr;":8703,"homtht;":8763,"hookleftarrow;":8617,"hookrightarrow;":8618,"hopf;":[55349,56665],"horbar;":8213,"hscr;":[55349,56509],"hslash;":8463,"hstrok;":295,"hybull;":8259,"hyphen;":8208,iacute:237,"iacute;":237,"ic;":8291,icirc:238,"icirc;":238,"icy;":1080,"iecy;":1077,iexcl:161,"iexcl;":161,"iff;":8660,"ifr;":[55349,56614],igrave:236,"igrave;":236,"ii;":8520,"iiiint;":10764,"iiint;":8749,"iinfin;":10716,"iiota;":8489,"ijlig;":307,"imacr;":299,"image;":8465,"imagline;":8464,"imagpart;":8465,"imath;":305,"imof;":8887,"imped;":437,"in;":8712,"incare;":8453,"infin;":8734,"infintie;":10717,"inodot;":305,"int;":8747,"intcal;":8890,"integers;":8484,"intercal;":8890,"intlarhk;":10775,"intprod;":10812,"iocy;":1105,"iogon;":303,"iopf;":[55349,56666],"iota;":953,"iprod;":10812,iquest:191,"iquest;":191,"iscr;":[55349,56510],"isin;":8712,"isinE;":8953,"isindot;":8949,"isins;":8948,"isinsv;":8947,"isinv;":8712,"it;":8290,"itilde;":297,"iukcy;":1110,iuml:239,"iuml;":239,"jcirc;":309,"jcy;":1081,"jfr;":[55349,56615],"jmath;":567,"jopf;":[55349,56667],"jscr;":[55349,56511],"jsercy;":1112,"jukcy;":1108,"kappa;":954,"kappav;":1008,"kcedil;":311,"kcy;":1082,"kfr;":[55349,56616],"kgreen;":312,"khcy;":1093,"kjcy;":1116,"kopf;":[55349,56668],"kscr;":[55349,56512],"lAarr;":8666,"lArr;":8656,"lAtail;":10523,"lBarr;":10510,"lE;":8806,"lEg;":10891,"lHar;":10594,"lacute;":314,"laemptyv;":10676,"lagran;":8466,"lambda;":955,"lang;":10216,"langd;":10641,"langle;":10216,"lap;":10885,laquo:171,"laquo;":171,"larr;":8592,"larrb;":8676,"larrbfs;":10527,"larrfs;":10525,"larrhk;":8617,"larrlp;":8619,"larrpl;":10553,"larrsim;":10611,"larrtl;":8610,"lat;":10923,"latail;":10521,"late;":10925,"lates;":[10925,65024],"lbarr;":10508,"lbbrk;":10098,"lbrace;":123,"lbrack;":91,"lbrke;":10635,"lbrksld;":10639,"lbrkslu;":10637,"lcaron;":318,"lcedil;":316,"lceil;":8968,"lcub;":123,"lcy;":1083,"ldca;":10550,"ldquo;":8220,"ldquor;":8222,"ldrdhar;":10599,"ldrushar;":10571,"ldsh;":8626,"le;":8804,"leftarrow;":8592,"leftarrowtail;":8610,"leftharpoondown;":8637,"leftharpoonup;":8636,"leftleftarrows;":8647,"leftrightarrow;":8596,"leftrightarrows;":8646,"leftrightharpoons;":8651,"leftrightsquigarrow;":8621,"leftthreetimes;":8907,"leg;":8922,"leq;":8804,"leqq;":8806,"leqslant;":10877,"les;":10877,"lescc;":10920,"lesdot;":10879,"lesdoto;":10881,"lesdotor;":10883,"lesg;":[8922,65024],"lesges;":10899,"lessapprox;":10885,"lessdot;":8918,"lesseqgtr;":8922,"lesseqqgtr;":10891,"lessgtr;":8822,"lesssim;":8818,"lfisht;":10620,"lfloor;":8970,"lfr;":[55349,56617],"lg;":8822,"lgE;":10897,"lhard;":8637,"lharu;":8636,"lharul;":10602,"lhblk;":9604,"ljcy;":1113,"ll;":8810,"llarr;":8647,"llcorner;":8990,"llhard;":10603,"lltri;":9722,"lmidot;":320,"lmoust;":9136,"lmoustache;":9136,"lnE;":8808,"lnap;":10889,"lnapprox;":10889,"lne;":10887,"lneq;":10887,"lneqq;":8808,"lnsim;":8934,"loang;":10220,"loarr;":8701,"lobrk;":10214,"longleftarrow;":10229,"longleftrightarrow;":10231,"longmapsto;":10236,"longrightarrow;":10230,"looparrowleft;":8619,"looparrowright;":8620,"lopar;":10629,"lopf;":[55349,56669],"loplus;":10797,"lotimes;":10804,"lowast;":8727,"lowbar;":95,"loz;":9674,"lozenge;":9674,"lozf;":10731,"lpar;":40,"lparlt;":10643,"lrarr;":8646,"lrcorner;":8991,"lrhar;":8651,"lrhard;":10605,"lrm;":8206,"lrtri;":8895,"lsaquo;":8249,"lscr;":[55349,56513],"lsh;":8624,"lsim;":8818,"lsime;":10893,"lsimg;":10895,"lsqb;":91,"lsquo;":8216,"lsquor;":8218,"lstrok;":322,lt:60,"lt;":60,"ltcc;":10918,"ltcir;":10873,"ltdot;":8918,"lthree;":8907,"ltimes;":8905,"ltlarr;":10614,"ltquest;":10875,"ltrPar;":10646,"ltri;":9667,"ltrie;":8884,"ltrif;":9666,"lurdshar;":10570,"luruhar;":10598,"lvertneqq;":[8808,65024],"lvnE;":[8808,65024],"mDDot;":8762,macr:175,"macr;":175,"male;":9794,"malt;":10016,"maltese;":10016,"map;":8614,"mapsto;":8614,"mapstodown;":8615,"mapstoleft;":8612,"mapstoup;":8613,"marker;":9646,"mcomma;":10793,"mcy;":1084,"mdash;":8212,"measuredangle;":8737,"mfr;":[55349,56618],"mho;":8487,micro:181,"micro;":181,"mid;":8739,"midast;":42,"midcir;":10992,middot:183,"middot;":183,"minus;":8722,"minusb;":8863,"minusd;":8760,"minusdu;":10794,"mlcp;":10971,"mldr;":8230,"mnplus;":8723,"models;":8871,"mopf;":[55349,56670],"mp;":8723,"mscr;":[55349,56514],"mstpos;":8766,"mu;":956,"multimap;":8888,"mumap;":8888,"nGg;":[8921,824],"nGt;":[8811,8402],"nGtv;":[8811,824],"nLeftarrow;":8653,"nLeftrightarrow;":8654,"nLl;":[8920,824],"nLt;":[8810,8402],"nLtv;":[8810,824],"nRightarrow;":8655,"nVDash;":8879,"nVdash;":8878,"nabla;":8711,"nacute;":324,"nang;":[8736,8402],"nap;":8777,"napE;":[10864,824],"napid;":[8779,824],"napos;":329,"napprox;":8777,"natur;":9838,"natural;":9838,"naturals;":8469,nbsp:160,"nbsp;":160,"nbump;":[8782,824],"nbumpe;":[8783,824],"ncap;":10819,"ncaron;":328,"ncedil;":326,"ncong;":8775,"ncongdot;":[10861,824],"ncup;":10818,"ncy;":1085,"ndash;":8211,"ne;":8800,"neArr;":8663,"nearhk;":10532,"nearr;":8599,"nearrow;":8599,"nedot;":[8784,824],"nequiv;":8802,"nesear;":10536,"nesim;":[8770,824],"nexist;":8708,"nexists;":8708,"nfr;":[55349,56619],"ngE;":[8807,824],"nge;":8817,"ngeq;":8817,"ngeqq;":[8807,824],"ngeqslant;":[10878,824],"nges;":[10878,824],"ngsim;":8821,"ngt;":8815,"ngtr;":8815,"nhArr;":8654,"nharr;":8622,"nhpar;":10994,"ni;":8715,"nis;":8956,"nisd;":8954,"niv;":8715,"njcy;":1114,"nlArr;":8653,"nlE;":[8806,824],"nlarr;":8602,"nldr;":8229,"nle;":8816,"nleftarrow;":8602,"nleftrightarrow;":8622,"nleq;":8816,"nleqq;":[8806,824],"nleqslant;":[10877,824],"nles;":[10877,824],"nless;":8814,"nlsim;":8820,"nlt;":8814,"nltri;":8938,"nltrie;":8940,"nmid;":8740,"nopf;":[55349,56671],not:172,"not;":172,"notin;":8713,"notinE;":[8953,824],"notindot;":[8949,824],"notinva;":8713,"notinvb;":8951,"notinvc;":8950,"notni;":8716,"notniva;":8716,"notnivb;":8958,"notnivc;":8957,"npar;":8742,"nparallel;":8742,"nparsl;":[11005,8421],"npart;":[8706,824],"npolint;":10772,"npr;":8832,"nprcue;":8928,"npre;":[10927,824],"nprec;":8832,"npreceq;":[10927,824],"nrArr;":8655,"nrarr;":8603,"nrarrc;":[10547,824],"nrarrw;":[8605,824],"nrightarrow;":8603,"nrtri;":8939,"nrtrie;":8941,"nsc;":8833,"nsccue;":8929,"nsce;":[10928,824],"nscr;":[55349,56515],"nshortmid;":8740,"nshortparallel;":8742,"nsim;":8769,"nsime;":8772,"nsimeq;":8772,"nsmid;":8740,"nspar;":8742,"nsqsube;":8930,"nsqsupe;":8931,"nsub;":8836,"nsubE;":[10949,824],"nsube;":8840,"nsubset;":[8834,8402],"nsubseteq;":8840,"nsubseteqq;":[10949,824],"nsucc;":8833,"nsucceq;":[10928,824],"nsup;":8837,"nsupE;":[10950,824],"nsupe;":8841,"nsupset;":[8835,8402],"nsupseteq;":8841,"nsupseteqq;":[10950,824],"ntgl;":8825,ntilde:241,"ntilde;":241,"ntlg;":8824,"ntriangleleft;":8938,"ntrianglelefteq;":8940,"ntriangleright;":8939,"ntrianglerighteq;":8941,"nu;":957,"num;":35,"numero;":8470,"numsp;":8199,"nvDash;":8877,"nvHarr;":10500,"nvap;":[8781,8402],"nvdash;":8876,"nvge;":[8805,8402],"nvgt;":[62,8402],"nvinfin;":10718,"nvlArr;":10498,"nvle;":[8804,8402],"nvlt;":[60,8402],"nvltrie;":[8884,8402],"nvrArr;":10499,"nvrtrie;":[8885,8402],"nvsim;":[8764,8402],"nwArr;":8662,"nwarhk;":10531,"nwarr;":8598,"nwarrow;":8598,"nwnear;":10535,"oS;":9416,oacute:243,"oacute;":243,"oast;":8859,"ocir;":8858,ocirc:244,"ocirc;":244,"ocy;":1086,"odash;":8861,"odblac;":337,"odiv;":10808,"odot;":8857,"odsold;":10684,"oelig;":339,"ofcir;":10687,"ofr;":[55349,56620],"ogon;":731,ograve:242,"ograve;":242,"ogt;":10689,"ohbar;":10677,"ohm;":937,"oint;":8750,"olarr;":8634,"olcir;":10686,"olcross;":10683,"oline;":8254,"olt;":10688,"omacr;":333,"omega;":969,"omicron;":959,"omid;":10678,"ominus;":8854,"oopf;":[55349,56672],"opar;":10679,"operp;":10681,"oplus;":8853,"or;":8744,"orarr;":8635,"ord;":10845,"order;":8500,"orderof;":8500,ordf:170,"ordf;":170,ordm:186,"ordm;":186,"origof;":8886,"oror;":10838,"orslope;":10839,"orv;":10843,"oscr;":8500,oslash:248,"oslash;":248,"osol;":8856,otilde:245,"otilde;":245,"otimes;":8855,"otimesas;":10806,ouml:246,"ouml;":246,"ovbar;":9021,"par;":8741,para:182,"para;":182,"parallel;":8741,"parsim;":10995,"parsl;":11005,"part;":8706,"pcy;":1087,"percnt;":37,"period;":46,"permil;":8240,"perp;":8869,"pertenk;":8241,"pfr;":[55349,56621],"phi;":966,"phiv;":981,"phmmat;":8499,"phone;":9742,"pi;":960,"pitchfork;":8916,"piv;":982,"planck;":8463,"planckh;":8462,"plankv;":8463,"plus;":43,"plusacir;":10787,"plusb;":8862,"pluscir;":10786,"plusdo;":8724,"plusdu;":10789,"pluse;":10866,plusmn:177,"plusmn;":177,"plussim;":10790,"plustwo;":10791,"pm;":177,"pointint;":10773,"popf;":[55349,56673],pound:163,"pound;":163,"pr;":8826,"prE;":10931,"prap;":10935,"prcue;":8828,"pre;":10927,"prec;":8826,"precapprox;":10935,"preccurlyeq;":8828,"preceq;":10927,"precnapprox;":10937,"precneqq;":10933,"precnsim;":8936,"precsim;":8830,"prime;":8242,"primes;":8473,"prnE;":10933,"prnap;":10937,"prnsim;":8936,"prod;":8719,"profalar;":9006,"profline;":8978,"profsurf;":8979,"prop;":8733,"propto;":8733,"prsim;":8830,"prurel;":8880,"pscr;":[55349,56517],"psi;":968,"puncsp;":8200,"qfr;":[55349,56622],"qint;":10764,"qopf;":[55349,56674],"qprime;":8279,"qscr;":[55349,56518],"quaternions;":8461,"quatint;":10774,"quest;":63,"questeq;":8799,quot:34,"quot;":34,"rAarr;":8667,"rArr;":8658,"rAtail;":10524,"rBarr;":10511,"rHar;":10596,"race;":[8765,817],"racute;":341,"radic;":8730,"raemptyv;":10675,"rang;":10217,"rangd;":10642,"range;":10661,"rangle;":10217,raquo:187,"raquo;":187,"rarr;":8594,"rarrap;":10613,"rarrb;":8677,"rarrbfs;":10528,"rarrc;":10547,"rarrfs;":10526,"rarrhk;":8618,"rarrlp;":8620,"rarrpl;":10565,"rarrsim;":10612,"rarrtl;":8611,"rarrw;":8605,"ratail;":10522,"ratio;":8758,"rationals;":8474,"rbarr;":10509,"rbbrk;":10099,"rbrace;":125,"rbrack;":93,"rbrke;":10636,"rbrksld;":10638,"rbrkslu;":10640,"rcaron;":345,"rcedil;":343,"rceil;":8969,"rcub;":125,"rcy;":1088,"rdca;":10551,"rdldhar;":10601,"rdquo;":8221,"rdquor;":8221,"rdsh;":8627,"real;":8476,"realine;":8475,"realpart;":8476,"reals;":8477,"rect;":9645,reg:174,"reg;":174,"rfisht;":10621,"rfloor;":8971,"rfr;":[55349,56623],"rhard;":8641,"rharu;":8640,"rharul;":10604,"rho;":961,"rhov;":1009,"rightarrow;":8594,"rightarrowtail;":8611,"rightharpoondown;":8641,"rightharpoonup;":8640,"rightleftarrows;":8644,"rightleftharpoons;":8652,"rightrightarrows;":8649,"rightsquigarrow;":8605,"rightthreetimes;":8908,"ring;":730,"risingdotseq;":8787,"rlarr;":8644,"rlhar;":8652,"rlm;":8207,"rmoust;":9137,"rmoustache;":9137,"rnmid;":10990,"roang;":10221,"roarr;":8702,"robrk;":10215,"ropar;":10630,"ropf;":[55349,56675],"roplus;":10798,"rotimes;":10805,"rpar;":41,"rpargt;":10644,"rppolint;":10770,"rrarr;":8649,"rsaquo;":8250,"rscr;":[55349,56519],"rsh;":8625,"rsqb;":93,"rsquo;":8217,"rsquor;":8217,"rthree;":8908,"rtimes;":8906,"rtri;":9657,"rtrie;":8885,"rtrif;":9656,"rtriltri;":10702,"ruluhar;":10600,"rx;":8478,"sacute;":347,"sbquo;":8218,"sc;":8827,"scE;":10932,"scap;":10936,"scaron;":353,"sccue;":8829,"sce;":10928,"scedil;":351,"scirc;":349,"scnE;":10934,"scnap;":10938,"scnsim;":8937,"scpolint;":10771,"scsim;":8831,"scy;":1089,"sdot;":8901,"sdotb;":8865,"sdote;":10854,"seArr;":8664,"searhk;":10533,"searr;":8600,"searrow;":8600,sect:167,"sect;":167,"semi;":59,"seswar;":10537,"setminus;":8726,"setmn;":8726,"sext;":10038,"sfr;":[55349,56624],"sfrown;":8994,"sharp;":9839,"shchcy;":1097,"shcy;":1096,"shortmid;":8739,"shortparallel;":8741,shy:173,"shy;":173,"sigma;":963,"sigmaf;":962,"sigmav;":962,"sim;":8764,"simdot;":10858,"sime;":8771,"simeq;":8771,"simg;":10910,"simgE;":10912,"siml;":10909,"simlE;":10911,"simne;":8774,"simplus;":10788,"simrarr;":10610,"slarr;":8592,"smallsetminus;":8726,"smashp;":10803,"smeparsl;":10724,"smid;":8739,"smile;":8995,"smt;":10922,"smte;":10924,"smtes;":[10924,65024],"softcy;":1100,"sol;":47,"solb;":10692,"solbar;":9023,"sopf;":[55349,56676],"spades;":9824,"spadesuit;":9824,"spar;":8741,"sqcap;":8851,"sqcaps;":[8851,65024],"sqcup;":8852,"sqcups;":[8852,65024],"sqsub;":8847,"sqsube;":8849,"sqsubset;":8847,"sqsubseteq;":8849,"sqsup;":8848,"sqsupe;":8850,"sqsupset;":8848,"sqsupseteq;":8850,"squ;":9633,"square;":9633,"squarf;":9642,"squf;":9642,"srarr;":8594,"sscr;":[55349,56520],"ssetmn;":8726,"ssmile;":8995,"sstarf;":8902,"star;":9734,"starf;":9733,"straightepsilon;":1013,"straightphi;":981,"strns;":175,"sub;":8834,"subE;":10949,"subdot;":10941,"sube;":8838,"subedot;":10947,"submult;":10945,"subnE;":10955,"subne;":8842,"subplus;":10943,"subrarr;":10617,"subset;":8834,"subseteq;":8838,"subseteqq;":10949,"subsetneq;":8842,"subsetneqq;":10955,"subsim;":10951,"subsub;":10965,"subsup;":10963,"succ;":8827,"succapprox;":10936,"succcurlyeq;":8829,"succeq;":10928,"succnapprox;":10938,"succneqq;":10934,"succnsim;":8937,"succsim;":8831,"sum;":8721,"sung;":9834,sup1:185,"sup1;":185,sup2:178,"sup2;":178,sup3:179,"sup3;":179,"sup;":8835,"supE;":10950,"supdot;":10942,"supdsub;":10968,"supe;":8839,"supedot;":10948,"suphsol;":10185,"suphsub;":10967,"suplarr;":10619,"supmult;":10946,"supnE;":10956,"supne;":8843,"supplus;":10944,"supset;":8835,"supseteq;":8839,"supseteqq;":10950,"supsetneq;":8843,"supsetneqq;":10956,"supsim;":10952,"supsub;":10964,"supsup;":10966,"swArr;":8665,"swarhk;":10534,"swarr;":8601,"swarrow;":8601,"swnwar;":10538,szlig:223,"szlig;":223,"target;":8982,"tau;":964,"tbrk;":9140,"tcaron;":357,"tcedil;":355,"tcy;":1090,"tdot;":8411,"telrec;":8981,"tfr;":[55349,56625],"there4;":8756,"therefore;":8756,"theta;":952,"thetasym;":977,"thetav;":977,"thickapprox;":8776,"thicksim;":8764,"thinsp;":8201,"thkap;":8776,"thksim;":8764,thorn:254,"thorn;":254,"tilde;":732,times:215,"times;":215,"timesb;":8864,"timesbar;":10801,"timesd;":10800,"tint;":8749,"toea;":10536,"top;":8868,"topbot;":9014,"topcir;":10993,"topf;":[55349,56677],"topfork;":10970,"tosa;":10537,"tprime;":8244,"trade;":8482,"triangle;":9653,"triangledown;":9663,"triangleleft;":9667,"trianglelefteq;":8884,"triangleq;":8796,"triangleright;":9657,"trianglerighteq;":8885,"tridot;":9708,"trie;":8796,"triminus;":10810,"triplus;":10809,"trisb;":10701,"tritime;":10811,"trpezium;":9186,"tscr;":[55349,56521],"tscy;":1094,"tshcy;":1115,"tstrok;":359,"twixt;":8812,"twoheadleftarrow;":8606,"twoheadrightarrow;":8608,"uArr;":8657,"uHar;":10595,uacute:250,"uacute;":250,"uarr;":8593,"ubrcy;":1118,"ubreve;":365,ucirc:251,"ucirc;":251,"ucy;":1091,"udarr;":8645,"udblac;":369,"udhar;":10606,"ufisht;":10622,"ufr;":[55349,56626],ugrave:249,"ugrave;":249,"uharl;":8639,"uharr;":8638,"uhblk;":9600,"ulcorn;":8988,"ulcorner;":8988,"ulcrop;":8975,"ultri;":9720,"umacr;":363,uml:168,"uml;":168,"uogon;":371,"uopf;":[55349,56678],"uparrow;":8593,"updownarrow;":8597,"upharpoonleft;":8639,"upharpoonright;":8638,"uplus;":8846,"upsi;":965,"upsih;":978,"upsilon;":965,"upuparrows;":8648,"urcorn;":8989,"urcorner;":8989,"urcrop;":8974,"uring;":367,"urtri;":9721,"uscr;":[55349,56522],"utdot;":8944,"utilde;":361,"utri;":9653,"utrif;":9652,"uuarr;":8648,uuml:252,"uuml;":252,"uwangle;":10663,"vArr;":8661,"vBar;":10984,"vBarv;":10985,"vDash;":8872,"vangrt;":10652,"varepsilon;":1013,"varkappa;":1008,"varnothing;":8709,"varphi;":981,"varpi;":982,"varpropto;":8733,"varr;":8597,"varrho;":1009,"varsigma;":962,"varsubsetneq;":[8842,65024],"varsubsetneqq;":[10955,65024],"varsupsetneq;":[8843,65024],"varsupsetneqq;":[10956,65024],"vartheta;":977,"vartriangleleft;":8882,"vartriangleright;":8883,"vcy;":1074,"vdash;":8866,"vee;":8744,"veebar;":8891,"veeeq;":8794,"vellip;":8942,"verbar;":124,"vert;":124,"vfr;":[55349,56627],"vltri;":8882,"vnsub;":[8834,8402],"vnsup;":[8835,8402],"vopf;":[55349,56679],"vprop;":8733,"vrtri;":8883,"vscr;":[55349,56523],"vsubnE;":[10955,65024],"vsubne;":[8842,65024],"vsupnE;":[10956,65024],"vsupne;":[8843,65024],"vzigzag;":10650,"wcirc;":373,"wedbar;":10847,"wedge;":8743,"wedgeq;":8793,"weierp;":8472,"wfr;":[55349,56628],"wopf;":[55349,56680],"wp;":8472,"wr;":8768,"wreath;":8768,"wscr;":[55349,56524],"xcap;":8898,"xcirc;":9711,"xcup;":8899,"xdtri;":9661,"xfr;":[55349,56629],"xhArr;":10234,"xharr;":10231,"xi;":958,"xlArr;":10232,"xlarr;":10229,"xmap;":10236,"xnis;":8955,"xodot;":10752,"xopf;":[55349,56681],"xoplus;":10753,"xotime;":10754,"xrArr;":10233,"xrarr;":10230,"xscr;":[55349,56525],"xsqcup;":10758,"xuplus;":10756,"xutri;":9651,"xvee;":8897,"xwedge;":8896,yacute:253,"yacute;":253,"yacy;":1103,"ycirc;":375,"ycy;":1099,yen:165,"yen;":165,"yfr;":[55349,56630],"yicy;":1111,"yopf;":[55349,56682],"yscr;":[55349,56526],"yucy;":1102,yuml:255,"yuml;":255,"zacute;":378,"zcaron;":382,"zcy;":1079,"zdot;":380,"zeetrf;":8488,"zeta;":950,"zfr;":[55349,56631],"zhcy;":1078,"zigrarr;":8669,"zopf;":[55349,56683],"zscr;":[55349,56527],"zwj;":8205,"zwnj;":8204},ho=/(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g,Dx=32,kx=/[^\r"&\u0000]+/g,Lx=/[^\r'&\u0000]+/g,Mx=/[^\r\t\n\f &>\u0000]+/g,Rx=/[^\r\t\n\f \/>A-Z\u0000]+/g,Ix=/[^\r\t\n\f \/=>A-Z\u0000]+/g,Ox=/[^\]\r\u0000\uffff]*/g,qx=/[^&<\r\u0000\uffff]*/g,po=/[^<\r\u0000\uffff]*/g,Hx=/[^\r\u0000\uffff]*/g,mo=/(?:(\/)?([a-z]+)>)|[\s\S]/g,go=/(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g,Ea=/[^\x09\x0A\x0C\x0D\x20]/,ni=/[^\x09\x0A\x0C\x0D\x20]/g,Fx=/[^\x00\x09\x0A\x0C\x0D\x20]/,St=/^[\x09\x0A\x0C\x0D\x20]+/,_a=/\x00/g;function me(e){var t=16384;if(e.length0;t--){var r=this.elements[t];if(z(r,e))break}this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.popElementType=function(e){for(var t=this.elements.length-1;t>0&&!(this.elements[t]instanceof e);t--);this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.popElement=function(e){for(var t=this.elements.length-1;t>0&&this.elements[t]!==e;t--);this.elements.length=t,this.top=this.elements[t-1]};q.ElementStack.prototype.removeElement=function(e){if(this.top===e)this.pop();else{var t=this.elements.lastIndexOf(e);t!==-1&&this.elements.splice(t,1)}};q.ElementStack.prototype.clearToContext=function(e){for(var t=this.elements.length-1;t>0&&!z(this.elements[t],e);t--);this.elements.length=t+1,this.top=this.elements[t]};q.ElementStack.prototype.contains=function(e){return this.inSpecificScope(e,Object.create(null))};q.ElementStack.prototype.inSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(z(a,e))return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.elementInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(a===e)return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.elementTypeInSpecificScope=function(e,t){for(var r=this.elements.length-1;r>=0;r--){var a=this.elements[r];if(a instanceof e)return!0;if(z(a,t))return!1}return!1};q.ElementStack.prototype.inScope=function(e){return this.inSpecificScope(e,Be)};q.ElementStack.prototype.elementInScope=function(e){return this.elementInSpecificScope(e,Be)};q.ElementStack.prototype.elementTypeInScope=function(e){return this.elementTypeInSpecificScope(e,Be)};q.ElementStack.prototype.inButtonScope=function(e){return this.inSpecificScope(e,ci)};q.ElementStack.prototype.inListItemScope=function(e){return this.inSpecificScope(e,ya)};q.ElementStack.prototype.inTableScope=function(e){return this.inSpecificScope(e,Co)};q.ElementStack.prototype.inSelectScope=function(e){for(var t=this.elements.length-1;t>=0;t--){var r=this.elements[t];if(r.namespaceURI!==w.HTML)return!1;var a=r.localName;if(a===e)return!0;if(a!=="optgroup"&&a!=="option")return!1}return!1};q.ElementStack.prototype.generateImpliedEndTags=function(e,t){for(var r=t?So:wo,a=this.elements.length-1;a>=0;a--){var s=this.elements[a];if(e&&z(s,e)||!z(this.elements[a],r))break}this.elements.length=a+1,this.top=this.elements[a]};q.ActiveFormattingElements=function(){this.list=[],this.attrs=[]};q.ActiveFormattingElements.prototype.MARKER={localName:"|"};q.ActiveFormattingElements.prototype.insertMarker=function(){this.list.push(this.MARKER),this.attrs.push(this.MARKER)};q.ActiveFormattingElements.prototype.push=function(e,t){for(var r=0,a=this.list.length-1;a>=0&&this.list[a]!==this.MARKER;a--)if(x(e,this.list[a],this.attrs[a])&&(r++,r===3)){this.list.splice(a,1),this.attrs.splice(a,1);break}this.list.push(e);for(var s=[],o=0;o=0&&this.list[e]!==this.MARKER;e--);e<0&&(e=0),this.list.length=e,this.attrs.length=e};q.ActiveFormattingElements.prototype.findElementByTag=function(e){for(var t=this.list.length-1;t>=0;t--){var r=this.list[t];if(r===this.MARKER)break;if(r.localName===e)return r}return null};q.ActiveFormattingElements.prototype.indexOf=function(e){return this.list.lastIndexOf(e)};q.ActiveFormattingElements.prototype.remove=function(e){var t=this.list.lastIndexOf(e);t!==-1&&(this.list.splice(t,1),this.attrs.splice(t,1))};q.ActiveFormattingElements.prototype.replace=function(e,t,r){var a=this.list.lastIndexOf(e);a!==-1&&(this.list[a]=t,this.attrs[a]=r)};q.ActiveFormattingElements.prototype.insertAfter=function(e,t){var r=this.list.lastIndexOf(e);r!==-1&&(this.list.splice(r,0,t),this.attrs.splice(r,0,t))};function q(e,t,r){var a=null,s=0,o=0,x=!1,m=!1,h=0,g=[],v="",ne=!0,se=0,u=M,be,X,O="",Ye="",H=[],ie="",le="",W=[],Qe=[],$e=[],Ze=[],Ce=[],yr=!1,p=ol,Pe=null,Ue=[],l=new q.ElementStack,L=new q.ActiveFormattingElements,dt=t!==void 0,Nr=null,Ve=null,wr=!0;t&&(wr=t.ownerDocument._scripting_enabled),r&&r.scripting_enabled===!1&&(wr=!1);var $=!0,Da=!1,Sr,ka,b=[],Je=!1,ht=!1,Ar={document:function(){return F},_asDocumentFragment:function(){for(var n=F.createDocumentFragment(),i=F.firstChild;i.hasChildNodes();)n.appendChild(i.firstChild);return n},pause:function(){se++},resume:function(){se--,this.parse("")},parse:function(n,i,c){var f;return se>0?(v+=n,!0):(h===0?(v&&(n=v+n,v=""),i&&(n+="\uFFFF",x=!0),a=n,s=n.length,o=0,ne&&(ne=!1,a.charCodeAt(0)===65279&&(o=1)),h++,f=Ti(c),v=a.substring(o,s),h--):(h++,g.push(a,s,o),a=n,s=n.length,o=0,Ti(),f=!1,v=a.substring(o,s),o=g.pop(),s=g.pop(),a=g.pop(),v&&(a=v+a.substring(o),s=a.length,o=0,v=""),h--),f)}},F=new _x(!0,e);if(F._parser=Ar,F._scripting_enabled=wr,t){if(t.ownerDocument._quirks&&(F._quirks=!0),t.ownerDocument._limitedQuirks&&(F._limitedQuirks=!0),t.namespaceURI===w.HTML)switch(t.localName){case"title":case"textarea":u=at;break;case"style":case"xmp":case"iframe":case"noembed":case"noframes":case"script":case"plaintext":u=Oa;break}var vi=F.createElement("html");F._appendChild(vi),l.push(vi),t instanceof G.HTMLTemplateElement&&Ue.push(za),Jt();for(var Kt=t;Kt!==null;Kt=Kt.parentElement)if(Kt instanceof G.HTMLFormElement){Ve=Kt;break}}function Ti(n){for(var i,c,f,d;o0||n&&n())return!0;switch(typeof u.lookahead){case"undefined":if(i=a.charCodeAt(o++),m&&(m=!1,i===10)){o++;continue}switch(i){case 13:o0){var n=me(b);if(b.length=0,ht&&(ht=!1,n[0]===` -`&&(n=n.substring(1)),n.length===0))return;re(Wt,n),Je=!1}ht=!1}function Qt(n){n.lastIndex=o-1;var i=n.exec(a);if(i&&i.index===o-1)return i=i[0],o+=i.length-1,x&&o===s&&(i=i.slice(0,-1),o--),i;throw new Error("should never happen")}function $t(n){n.lastIndex=o-1;var i=n.exec(a)[0];return i?(hc(i),o+=i.length-1,!0):!1}function hc(n){b.length>0&&kt(),!(ht&&(ht=!1,n[0]===` -`&&(n=n.substring(1)),n.length===0))&&re(Wt,n)}function Ge(){if(yr)re(I,O);else{var n=O;O="",Ye=n,re(pe,n,Ce)}}function pc(){if(o===s)return!1;mo.lastIndex=o;var n=mo.exec(a);if(!n)throw new Error("should never happen");var i=n[2];if(!i)return!1;var c=n[1];return c?(o+=i.length+2,re(I,i)):(o+=i.length+1,Ye=i,re(pe,i,yx)),!0}function mc(){yr?re(I,O,null,!0):re(pe,O,Ce,!0)}function U(){re(Tx,me(Qe),$e?me($e):void 0,Ze?me(Ze):void 0)}function k(){kt(),p(ba),F.modclock=1}var re=Ar.insertToken=function(i,c,f,d){kt();var E=l.top;!E||E.namespaceURI===w.HTML?p(i,c,f,d):i!==pe&&i!==Wt?Bi(i,c,f,d):bo(E)&&(i===Wt||i===pe&&c!=="mglyph"&&c!=="malignmark")||i===pe&&c==="svg"&&E.namespaceURI===w.MATHML&&E.localName==="annotation-xml"||Eo(E)?(ka=!0,p(i,c,f,d),ka=!1):Bi(i,c,f,d)};function Re(n){var i=l.top;rt&&z(i,Xt)?kr(function(c){return c.createComment(n)}):(i instanceof G.HTMLTemplateElement&&(i=i.content),i._appendChild(i.ownerDocument.createComment(n)))}function Ie(n){var i=l.top;if(rt&&z(i,Xt))kr(function(f){return f.createTextNode(n)});else{i instanceof G.HTMLTemplateElement&&(i=i.content);var c=i.lastChild;c&&c.nodeType===ai.TEXT_NODE?c.appendData(n):i._appendChild(i.ownerDocument.createTextNode(n))}}function Zt(n,i,c){var f=yo.createElement(n,i,null);if(c)for(var d=0,E=c.length;d=0;i--)if(l.elements[i]instanceof n)return i;return-1}function kr(n){var i,c,f=-1,d=-1,E;if(f=Ni(G.HTMLTableElement),d=Ni(G.HTMLTemplateElement),d>=0&&(f<0||d>f)?i=l.elements[d]:f>=0&&(i=l.elements[f].parentNode,i?c=l.elements[f]:i=l.elements[f-1]),i||(i=l.elements[0]),i instanceof G.HTMLTemplateElement&&(i=i.content),E=n(i.ownerDocument),E.nodeType===ai.TEXT_NODE){var A;if(c?A=c.previousSibling:A=i.lastChild,A&&A.nodeType===ai.TEXT_NODE)return A.appendData(E.data),E}return c?i.insertBefore(E,c):i._appendChild(E),E}function Jt(){for(var n=!1,i=l.elements.length-1;i>=0;i--){var c=l.elements[i];if(i===0&&(n=!0,dt&&(c=t)),c.namespaceURI===w.HTML){var f=c.localName;switch(f){case"select":for(var d=i;d>0;){var E=l.elements[--d];if(E instanceof G.HTMLTemplateElement)break;if(E instanceof G.HTMLTableElement){p=Gr;return}}p=ze;return;case"tr":p=rr;return;case"tbody":case"tfoot":case"thead":p=bt;return;case"caption":p=Ga;return;case"colgroup":p=jr;return;case"table":p=Ne;return;case"template":p=Ue[Ue.length-1];return;case"body":p=S;return;case"frameset":p=Wa;return;case"html":Nr===null?p=Ur:p=ja;return;default:if(!n){if(f==="head"){p=Z;return}if(f==="td"||f==="th"){p=Lt;return}}}}if(n){p=S;return}}}function Lr(n,i){D(n,i),u=er,Pe=p,p=Vr}function gc(n,i){D(n,i),u=at,Pe=p,p=Vr}function Ia(n,i){return{elt:Zt(n,L.list[i].localName,L.attrs[i]),attrs:L.attrs[i]}}function Ee(){if(L.list.length!==0){var n=L.list[L.list.length-1];if(n!==L.MARKER&&l.elements.lastIndexOf(n)===-1){for(var i=L.list.length-2;i>=0&&(n=L.list[i],!(n===L.MARKER||l.elements.lastIndexOf(n)!==-1));i--);for(i=i+1;i3&&De!==-1&&(L.remove(Y),De=-1),De===-1){l.removeElement(Y);continue}var ct=Ia(R.ownerDocument,De);L.replace(Y,ct.elt,ct.attrs),l.elements[we]=ct.elt,Y=ct.elt,ue===d&&(L.remove(Mr),L.insertAfter(ct.elt,Mr)),Y._appendChild(ue),ue=Y}rt&&z(R,Xt)?kr(function(){return ue}):R instanceof G.HTMLTemplateElement?R.content._appendChild(ue):R._appendChild(ue);for(var ar=Ia(d.ownerDocument,L.indexOf(c));d.hasChildNodes();)ar.elt._appendChild(d.firstChild);d._appendChild(ar.elt),L.remove(c),L.replace(Mr,ar.elt,ar.attrs),l.removeElement(c);var fl=l.elements.lastIndexOf(d);l.elements.splice(fl+1,0,ar.elt)}else return l.popElement(c),L.remove(c),!0}return!0}function Ec(){l.pop(),p=Pe}function pt(){delete F._parser,l.elements.length=0,F.defaultView&&F.defaultView.dispatchEvent(new G.Event("load",{}))}function y(n,i){u=i,o--}function M(n){switch(n){case 38:be=M,u=tr;break;case 60:if(pc())break;u=_c;break;case 0:b.push(n),Je=!0;break;case-1:k();break;default:$t(qx)||b.push(n);break}}function at(n){switch(n){case 38:be=at,u=tr;break;case 60:u=Tc;break;case 0:b.push(65533),Je=!0;break;case-1:k();break;default:b.push(n);break}}function er(n){switch(n){case 60:u=wc;break;case 0:b.push(65533);break;case-1:k();break;default:$t(po)||b.push(n);break}}function nt(n){switch(n){case 60:u=Cc;break;case 0:b.push(65533);break;case-1:k();break;default:$t(po)||b.push(n);break}}function Oa(n){switch(n){case 0:b.push(65533);break;case-1:k();break;default:$t(Hx)||b.push(n);break}}function _c(n){switch(n){case 33:u=Ci;break;case 47:u=vc;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:fc(),y(n,wi);break;case 63:y(n,qr);break;default:b.push(60),y(n,M);break}}function vc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,wi);break;case 62:u=M;break;case-1:b.push(60),b.push(47),k();break;default:y(n,qr);break}}function wi(n){switch(n){case 9:case 10:case 12:case 32:u=qe;break;case 47:u=st;break;case 62:u=M,Ge();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32);break;case 0:O+="\uFFFD";break;case-1:k();break;default:O+=Qt(Rx);break}}function Tc(n){n===47?(je(),u=yc):(b.push(60),y(n,at))}function yc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,Nc);break;default:b.push(60),b.push(47),y(n,at);break}}function Nc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,at)}function wc(n){n===47?(je(),u=Sc):(b.push(60),y(n,er))}function Sc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,Ac);break;default:b.push(60),b.push(47),y(n,er);break}}function Ac(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,er)}function Cc(n){switch(n){case 47:je(),u=Dc;break;case 33:u=Lc,b.push(60),b.push(33);break;default:b.push(60),y(n,nt);break}}function Dc(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,kc);break;default:b.push(60),b.push(47),y(n,nt);break}}function kc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,nt)}function Lc(n){n===45?(u=Mc,b.push(45)):y(n,nt)}function Mc(n){n===45?(u=Si,b.push(45)):y(n,nt)}function Oe(n){switch(n){case 45:u=Rc,b.push(45);break;case 60:u=qa;break;case 0:b.push(65533);break;case-1:k();break;default:b.push(n);break}}function Rc(n){switch(n){case 45:u=Si,b.push(45);break;case 60:u=qa;break;case 0:u=Oe,b.push(65533);break;case-1:k();break;default:u=Oe,b.push(n);break}}function Si(n){switch(n){case 45:b.push(45);break;case 60:u=qa;break;case 62:u=nt,b.push(62);break;case 0:u=Oe,b.push(65533);break;case-1:k();break;default:u=Oe,b.push(n);break}}function qa(n){switch(n){case 47:je(),u=Ic;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:je(),b.push(60),y(n,qc);break;default:b.push(60),y(n,Oe);break}}function Ic(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:Yt(),y(n,Oc);break;default:b.push(60),b.push(47),y(n,Oe);break}}function Oc(n){switch(n){case 9:case 10:case 12:case 32:if(ye(O)){u=qe;return}break;case 47:if(ye(O)){u=st;return}break;case 62:if(ye(O)){u=M,Ge();return}break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:O+=String.fromCharCode(n+32),H.push(n);return;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:O+=String.fromCharCode(n),H.push(n);return;default:break}b.push(60),b.push(47),wt(b,H),y(n,Oe)}function qc(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:me(H)==="script"?u=it:u=Oe,b.push(n);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:H.push(n+32),b.push(n);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:H.push(n),b.push(n);break;default:y(n,Oe);break}}function it(n){switch(n){case 45:u=Hc,b.push(45);break;case 60:u=Ha,b.push(60);break;case 0:b.push(65533);break;case-1:k();break;default:b.push(n);break}}function Hc(n){switch(n){case 45:u=Fc,b.push(45);break;case 60:u=Ha,b.push(60);break;case 0:u=it,b.push(65533);break;case-1:k();break;default:u=it,b.push(n);break}}function Fc(n){switch(n){case 45:b.push(45);break;case 60:u=Ha,b.push(60);break;case 62:u=nt,b.push(62);break;case 0:u=it,b.push(65533);break;case-1:k();break;default:u=it,b.push(n);break}}function Ha(n){n===47?(je(),u=Bc,b.push(47)):y(n,it)}function Bc(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:me(H)==="script"?u=Oe:u=it,b.push(n);break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:H.push(n+32),b.push(n);break;case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:H.push(n),b.push(n);break;default:y(n,it);break}}function qe(n){switch(n){case 9:case 10:case 12:case 32:break;case 47:u=st;break;case 62:u=M,Ge();break;case-1:k();break;case 61:La(),ie+=String.fromCharCode(n),u=Fa;break;default:if(xc())break;La(),y(n,Fa);break}}function Fa(n){switch(n){case 9:case 10:case 12:case 32:case 47:case 62:case-1:y(n,Pc);break;case 61:u=Ai;break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:ie+=String.fromCharCode(n+32);break;case 0:ie+="\uFFFD";break;default:ie+=Qt(Ix);break}}function Pc(n){switch(n){case 9:case 10:case 12:case 32:break;case 47:et(ie),u=st;break;case 61:u=Ai;break;case 62:u=M,et(ie),Ge();break;case-1:et(ie),k();break;default:et(ie),La(),y(n,Fa);break}}function Ai(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:Ma(),u=Rr;break;case 39:Ma(),u=Ir;break;default:Ma(),y(n,Or);break}}function Rr(n){switch(n){case 34:et(ie,le),u=Ba;break;case 38:be=Rr,u=tr;break;case 0:le+="\uFFFD";break;case-1:k();break;case 10:le+=String.fromCharCode(n);break;default:le+=Qt(kx);break}}function Ir(n){switch(n){case 39:et(ie,le),u=Ba;break;case 38:be=Ir,u=tr;break;case 0:le+="\uFFFD";break;case-1:k();break;case 10:le+=String.fromCharCode(n);break;default:le+=Qt(Lx);break}}function Or(n){switch(n){case 9:case 10:case 12:case 32:et(ie,le),u=qe;break;case 38:be=Or,u=tr;break;case 62:et(ie,le),u=M,Ge();break;case 0:le+="\uFFFD";break;case-1:o--,u=M;break;default:le+=Qt(Mx);break}}function Ba(n){switch(n){case 9:case 10:case 12:case 32:u=qe;break;case 47:u=st;break;case 62:u=M,Ge();break;case-1:k();break;default:y(n,qe);break}}function st(n){switch(n){case 62:u=M,mc(!0);break;case-1:k();break;default:y(n,qe);break}}function qr(n,i,c){var f=i.length;c?o+=f-1:o+=f;var d=i.substring(0,f-1);d=d.replace(/\u0000/g,"\uFFFD"),d=d.replace(/\u000D\u000A/g,` -`),d=d.replace(/\u000D/g,` -`),re(Fe,d),u=M}qr.lookahead=">";function Ci(n,i,c){if(i[0]==="-"&&i[1]==="-"){o+=2,yi(),u=Uc;return}i.toUpperCase()==="DOCTYPE"?(o+=7,u=Kc):i==="[CDATA["&&dc()?(o+=7,u=Va):u=qr}Ci.lookahead=7;function Uc(n){switch(yi(),n){case 45:u=Vc;break;case 62:u=M,re(Fe,me(W));break;default:y(n,mt);break}}function Vc(n){switch(n){case 45:u=Hr;break;case 62:u=M,re(Fe,me(W));break;case-1:re(Fe,me(W)),k();break;default:W.push(45),y(n,mt);break}}function mt(n){switch(n){case 60:W.push(n),u=jc;break;case 45:u=Pa;break;case 0:W.push(65533);break;case-1:re(Fe,me(W)),k();break;default:W.push(n);break}}function jc(n){switch(n){case 33:W.push(n),u=Gc;break;case 60:W.push(n);break;default:y(n,mt);break}}function Gc(n){n===45?u=zc:y(n,mt)}function zc(n){n===45?u=Wc:y(n,Pa)}function Wc(n){switch(n){case 62:case-1:y(n,Hr);break;default:y(n,Hr);break}}function Pa(n){switch(n){case 45:u=Hr;break;case-1:re(Fe,me(W)),k();break;default:W.push(45),y(n,mt);break}}function Hr(n){switch(n){case 62:u=M,re(Fe,me(W));break;case 33:u=Xc;break;case 45:W.push(45);break;case-1:re(Fe,me(W)),k();break;default:W.push(45),W.push(45),y(n,mt);break}}function Xc(n){switch(n){case 45:W.push(45),W.push(45),W.push(33),u=Pa;break;case 62:u=M,re(Fe,me(W));break;case-1:re(Fe,me(W)),k();break;default:W.push(45),W.push(45),W.push(33),y(n,mt);break}}function Kc(n){switch(n){case 9:case 10:case 12:case 32:u=Di;break;case-1:Dt(),P(),U(),k();break;default:y(n,Di);break}}function Di(n){switch(n){case 9:case 10:case 12:case 32:break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:Dt(),Qe.push(n+32),u=Ua;break;case 0:Dt(),Qe.push(65533),u=Ua;break;case 62:Dt(),P(),u=M,U();break;case-1:Dt(),P(),U(),k();break;default:Dt(),Qe.push(n),u=Ua;break}}function Ua(n){switch(n){case 9:case 10:case 12:case 32:u=ki;break;case 62:u=M,U();break;case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:Qe.push(n+32);break;case 0:Qe.push(65533);break;case-1:P(),U(),k();break;default:Qe.push(n);break}}function ki(n,i,c){switch(n){case 9:case 10:case 12:case 32:o+=1;break;case 62:u=M,o+=1,U();break;case-1:P(),U(),k();break;default:i=i.toUpperCase(),i==="PUBLIC"?(o+=6,u=Yc):i==="SYSTEM"?(o+=6,u=Zc):(P(),u=ot);break}}ki.lookahead=6;function Yc(n){switch(n){case 9:case 10:case 12:case 32:u=Qc;break;case 34:Cr(),u=Li;break;case 39:Cr(),u=Mi;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Qc(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:Cr(),u=Li;break;case 39:Cr(),u=Mi;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Li(n){switch(n){case 34:u=Ri;break;case 0:$e.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:$e.push(n);break}}function Mi(n){switch(n){case 39:u=Ri;break;case 0:$e.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:$e.push(n);break}}function Ri(n){switch(n){case 9:case 10:case 12:case 32:u=$c;break;case 62:u=M,U();break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function $c(n){switch(n){case 9:case 10:case 12:case 32:break;case 62:u=M,U();break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Zc(n){switch(n){case 9:case 10:case 12:case 32:u=Jc;break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Jc(n){switch(n){case 9:case 10:case 12:case 32:break;case 34:tt(),u=Fr;break;case 39:tt(),u=Br;break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:P(),u=ot;break}}function Fr(n){switch(n){case 34:u=Ii;break;case 0:Ze.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:Ze.push(n);break}}function Br(n){switch(n){case 39:u=Ii;break;case 0:Ze.push(65533);break;case 62:P(),u=M,U();break;case-1:P(),U(),k();break;default:Ze.push(n);break}}function Ii(n){switch(n){case 9:case 10:case 12:case 32:break;case 62:u=M,U();break;case-1:P(),U(),k();break;default:u=ot;break}}function ot(n){switch(n){case 62:u=M,U();break;case-1:U(),k();break;default:break}}function Va(n){switch(n){case 93:u=el;break;case-1:k();break;case 0:Je=!0;default:$t(Ox)||b.push(n);break}}function el(n){n===93?u=tl:(b.push(93),y(n,Va))}function tl(n){switch(n){case 93:b.push(93);break;case 62:kt(),u=M;break;default:b.push(93),b.push(93),y(n,Va);break}}function tr(n){switch(je(),H.push(38),n){case 9:case 10:case 12:case 32:case 60:case 38:case-1:y(n,gt);break;case 35:H.push(n),u=rl;break;default:y(n,Oi);break}}function Oi(n){ho.lastIndex=o;var i=ho.exec(a);if(!i)throw new Error("should never happen");var c=i[1];if(!c){u=gt;return}switch(o+=c.length,wt(H,Bx(c)),be){case Rr:case Ir:case Or:if(c[c.length-1]!==";"&&/[=A-Za-z0-9]/.test(a[o])){u=gt;return}break;default:break}je();var f=Cx[c];typeof f=="number"?H.push(f):wt(H,f),u=gt}Oi.lookahead=-Dx;function rl(n){switch(X=0,n){case 120:case 88:H.push(n),u=al;break;default:y(n,nl);break}}function al(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:y(n,il);break;default:y(n,gt);break}}function nl(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:y(n,sl);break;default:y(n,gt);break}}function il(n){switch(n){case 65:case 66:case 67:case 68:case 69:case 70:X*=16,X+=n-55;break;case 97:case 98:case 99:case 100:case 101:case 102:X*=16,X+=n-87;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:X*=16,X+=n-48;break;case 59:u=Pr;break;default:y(n,Pr);break}}function sl(n){switch(n){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:X*=10,X+=n-48;break;case 59:u=Pr;break;default:y(n,Pr);break}}function Pr(n){X in fo?X=fo[X]:(X>1114111||X>=55296&&X<57344)&&(X=65533),je(),X<=65535?H.push(X):(X=X-65536,H.push(55296+(X>>10)),H.push(56320+(X&1023))),y(n,gt)}function gt(n){switch(be){case Rr:case Ir:case Or:le+=me(H);break;default:wt(b,H);break}y(n,be)}function ol(n,i,c,f){switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 4:F._appendChild(F.createComment(i));return;case 5:var d=i,E=c,A=f;F.appendChild(new vx(F,d,E,A)),Da||d.toLowerCase()!=="html"||Nx.test(E)||A&&A.toLowerCase()===wx||A===void 0&&co.test(E)?F._quirks=!0:(Sx.test(E)||A!==void 0&&co.test(E))&&(F._limitedQuirks=!0),p=qi;return}F._quirks=!0,p=qi,p(n,i,c,f)}function qi(n,i,c,f){var d;switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 5:return;case 4:F._appendChild(F.createComment(i));return;case 2:if(i==="html"){d=Zt(F,i,c),l.push(d),F.appendChild(d),p=Ur;return}break;case 3:switch(i){case"html":case"head":case"body":case"br":break;default:return}}d=Zt(F,"html",null),l.push(d),F.appendChild(d),p=Ur,p(n,i,c,f)}function Ur(n,i,c,f){switch(n){case 1:if(i=i.replace(St,""),i.length===0)return;break;case 5:return;case 4:Re(i);return;case 2:switch(i){case"html":S(n,i,c,f);return;case"head":var d=D(i,c);Nr=d,p=Z;return}break;case 3:switch(i){case"html":case"head":case"body":case"br":break;default:return}}Ur(pe,"head",null),p(n,i,c,f)}function Z(n,i,c,f){switch(n){case 1:var d=i.match(St);if(d&&(Ie(d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 4:Re(i);return;case 5:return;case 2:switch(i){case"html":S(n,i,c,f);return;case"meta":case"base":case"basefont":case"bgsound":case"link":D(i,c),l.pop();return;case"title":gc(i,c);return;case"noscript":if(!wr){D(i,c),p=Hi;return}case"noframes":case"style":Lr(i,c);return;case"script":Dr(function(E){var A=Zt(E,i,c);return A._parser_inserted=!0,A._force_async=!1,dt&&(A._already_started=!0),kt(),A}),u=nt,Pe=p,p=Vr;return;case"template":D(i,c),L.insertMarker(),$=!1,p=za,Ue.push(p);return;case"head":return}break;case 3:switch(i){case"head":l.pop(),p=ja;return;case"body":case"html":case"br":break;case"template":if(!l.contains("template"))return;l.generateImpliedEndTags(null,"thorough"),l.popTag("template"),L.clearToMarker(),Ue.pop(),Jt();return;default:return}break}Z(I,"head",null),p(n,i,c,f)}function Hi(n,i,c,f){switch(n){case 5:return;case 4:Z(n,i);return;case 1:var d=i.match(St);if(d&&(Z(n,d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 2:switch(i){case"html":S(n,i,c,f);return;case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"style":Z(n,i,c);return;case"head":case"noscript":return}break;case 3:switch(i){case"noscript":l.pop(),p=Z;return;case"br":break;default:return}break}Hi(I,"noscript",null),p(n,i,c,f)}function ja(n,i,c,f){switch(n){case 1:var d=i.match(St);if(d&&(Ie(d[0]),i=i.substring(d[0].length)),i.length===0)return;break;case 4:Re(i);return;case 5:return;case 2:switch(i){case"html":S(n,i,c,f);return;case"body":D(i,c),$=!1,p=S;return;case"frameset":D(i,c),p=Wa;return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":l.push(Nr),Z(pe,i,c),l.removeElement(Nr);return;case"head":return}break;case 3:switch(i){case"template":return Z(n,i,c,f);case"body":case"html":case"br":break;default:return}break}ja(pe,"body",null),$=!0,p(n,i,c,f)}function S(n,i,c,f){var d,E,A,R;switch(n){case 1:if(Je&&(i=i.replace(_a,""),i.length===0))return;$&&Ea.test(i)&&($=!1),Ee(),Ie(i);return;case 5:return;case 4:Re(i);return;case-1:if(Ue.length)return za(n);pt();return;case 2:switch(i){case"html":if(l.contains("template"))return;To(c,l.elements[0]);return;case"base":case"basefont":case"bgsound":case"link":case"meta":case"noframes":case"script":case"style":case"template":case"title":Z(pe,i,c);return;case"body":if(d=l.elements[1],!d||!(d instanceof G.HTMLBodyElement)||l.contains("template"))return;$=!1,To(c,d);return;case"frameset":if(!$||(d=l.elements[1],!d||!(d instanceof G.HTMLBodyElement)))return;for(d.parentNode&&d.parentNode.removeChild(d);!(l.top instanceof G.HTMLHtmlElement);)l.pop();D(i,c),p=Wa;return;case"address":case"article":case"aside":case"blockquote":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"main":case"nav":case"ol":case"p":case"section":case"summary":case"ul":l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"menu":l.inButtonScope("p")&&S(I,"p"),z(l.top,"menuitem")&&l.pop(),D(i,c);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":l.inButtonScope("p")&&S(I,"p"),l.top instanceof G.HTMLHeadingElement&&l.pop(),D(i,c);return;case"pre":case"listing":l.inButtonScope("p")&&S(I,"p"),D(i,c),ht=!0,$=!1;return;case"form":if(Ve&&!l.contains("template"))return;l.inButtonScope("p")&&S(I,"p"),R=D(i,c),l.contains("template")||(Ve=R);return;case"li":for($=!1,E=l.elements.length-1;E>=0;E--){if(A=l.elements[E],A instanceof G.HTMLLIElement){S(I,"li");break}if(z(A,At)&&!z(A,si))break}l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"dd":case"dt":for($=!1,E=l.elements.length-1;E>=0;E--){if(A=l.elements[E],z(A,No)){S(I,A.localName);break}if(z(A,At)&&!z(A,si))break}l.inButtonScope("p")&&S(I,"p"),D(i,c);return;case"plaintext":l.inButtonScope("p")&&S(I,"p"),D(i,c),u=Oa;return;case"button":l.inScope("button")?(S(I,"button"),p(n,i,c,f)):(Ee(),D(i,c),$=!1);return;case"a":var Y=L.findElementByTag("a");Y&&(S(I,i),L.remove(Y),l.removeElement(Y));case"b":case"big":case"code":case"em":case"font":case"i":case"s":case"small":case"strike":case"strong":case"tt":case"u":Ee(),L.push(D(i,c),c);return;case"nobr":Ee(),l.inScope(i)&&(S(I,i),Ee()),L.push(D(i,c),c);return;case"applet":case"marquee":case"object":Ee(),D(i,c),L.insertMarker(),$=!1;return;case"table":!F._quirks&&l.inButtonScope("p")&&S(I,"p"),D(i,c),$=!1,p=Ne;return;case"area":case"br":case"embed":case"img":case"keygen":case"wbr":Ee(),D(i,c),l.pop(),$=!1;return;case"input":Ee(),R=D(i,c),l.pop();var ue=R.getAttribute("type");(!ue||ue.toLowerCase()!=="hidden")&&($=!1);return;case"param":case"source":case"track":D(i,c),l.pop();return;case"hr":l.inButtonScope("p")&&S(I,"p"),z(l.top,"menuitem")&&l.pop(),D(i,c),l.pop(),$=!1;return;case"image":S(pe,"img",c,f);return;case"textarea":D(i,c),ht=!0,$=!1,u=at,Pe=p,p=Vr;return;case"xmp":l.inButtonScope("p")&&S(I,"p"),Ee(),$=!1,Lr(i,c);return;case"iframe":$=!1,Lr(i,c);return;case"noembed":Lr(i,c);return;case"select":Ee(),D(i,c),$=!1,p===Ne||p===Ga||p===bt||p===rr||p===Lt?p=Gr:p=ze;return;case"optgroup":case"option":l.top instanceof G.HTMLOptionElement&&S(I,"option"),Ee(),D(i,c);return;case"menuitem":z(l.top,"menuitem")&&l.pop(),Ee(),D(i,c);return;case"rb":case"rtc":l.inScope("ruby")&&l.generateImpliedEndTags(),D(i,c);return;case"rp":case"rt":l.inScope("ruby")&&l.generateImpliedEndTags("rtc"),D(i,c);return;case"math":Ee(),vo(c),ii(c),Ra(i,c,w.MATHML),f&&l.pop();return;case"svg":Ee(),_o(c),ii(c),Ra(i,c,w.SVG),f&&l.pop();return;case"caption":case"col":case"colgroup":case"frame":case"head":case"tbody":case"td":case"tfoot":case"th":case"thead":case"tr":return}Ee(),D(i,c);return;case 3:switch(i){case"template":Z(I,i,c);return;case"body":if(!l.inScope("body"))return;p=Fi;return;case"html":if(!l.inScope("body"))return;p=Fi,p(n,i,c);return;case"address":case"article":case"aside":case"blockquote":case"button":case"center":case"details":case"dialog":case"dir":case"div":case"dl":case"fieldset":case"figcaption":case"figure":case"footer":case"header":case"hgroup":case"listing":case"main":case"menu":case"nav":case"ol":case"pre":case"section":case"summary":case"ul":if(!l.inScope(i))return;l.generateImpliedEndTags(),l.popTag(i);return;case"form":if(l.contains("template")){if(!l.inScope("form"))return;l.generateImpliedEndTags(),l.popTag("form")}else{var we=Ve;if(Ve=null,!we||!l.elementInScope(we))return;l.generateImpliedEndTags(),l.removeElement(we)}return;case"p":l.inButtonScope(i)?(l.generateImpliedEndTags(i),l.popTag(i)):(S(pe,i,null),p(n,i,c,f));return;case"li":if(!l.inListItemScope(i))return;l.generateImpliedEndTags(i),l.popTag(i);return;case"dd":case"dt":if(!l.inScope(i))return;l.generateImpliedEndTags(i),l.popTag(i);return;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":if(!l.elementTypeInScope(G.HTMLHeadingElement))return;l.generateImpliedEndTags(),l.popElementType(G.HTMLHeadingElement);return;case"sarcasm":break;case"a":case"b":case"big":case"code":case"em":case"font":case"i":case"nobr":case"s":case"small":case"strike":case"strong":case"tt":case"u":var De=bc(i);if(De)return;break;case"applet":case"marquee":case"object":if(!l.inScope(i))return;l.generateImpliedEndTags(),l.popTag(i),L.clearToMarker();return;case"br":S(pe,i,null);return}for(E=l.elements.length-1;E>=0;E--)if(A=l.elements[E],z(A,i)){l.generateImpliedEndTags(i),l.popElement(A);break}else if(z(A,At))return;return}}function Vr(n,i,c,f){switch(n){case 1:Ie(i);return;case-1:l.top instanceof G.HTMLScriptElement&&(l.top._already_started=!0),l.pop(),p=Pe,p(n);return;case 3:i==="script"?Ec():(l.pop(),p=Pe);return;default:return}}function Ne(n,i,c,f){function d(A){for(var R=0,Y=A.length;R0&&Ie(i);return;case 4:Re(i);return;case 5:return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"frameset":D(i,c);return;case"frame":D(i,c),l.pop();return;case"noframes":Z(n,i,c,f);return}break;case 3:if(i==="frameset"){if(dt&&l.top instanceof G.HTMLHtmlElement)return;l.pop(),!dt&&!(l.top instanceof G.HTMLFrameSetElement)&&(p=ll);return}break}}function ll(n,i,c,f){switch(n){case 1:i=i.replace(ni,""),i.length>0&&Ie(i);return;case 4:Re(i);return;case 5:return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"noframes":Z(n,i,c,f);return}break;case 3:if(i==="html"){p=xl;return}break}}function ul(n,i,c,f){switch(n){case 1:if(Ea.test(i))break;S(n,i,c,f);return;case 4:F._appendChild(F.createComment(i));return;case 5:S(n,i,c,f);return;case-1:pt();return;case 2:if(i==="html"){S(n,i,c,f);return}break}p=S,p(n,i,c,f)}function xl(n,i,c,f){switch(n){case 1:i=i.replace(ni,""),i.length>0&&S(n,i,c,f);return;case 4:F._appendChild(F.createComment(i));return;case 5:S(n,i,c,f);return;case-1:pt();return;case 2:switch(i){case"html":S(n,i,c,f);return;case"noframes":Z(n,i,c,f);return}break}}function Bi(n,i,c,f){function d(Y){for(var ue=0,we=Y.length;ue0&&d[d.length-1][0]==="Character"?d[d.length-1][1]+=R:d.push(["Character",R]);break;case 4:d.push(["Comment",R]);break;case 5:d.push(["DOCTYPE",R,Y===void 0?null:Y,ue===void 0?null:ue,!Da]);break;case 2:for(var we=Object.create(null),De=0;De{"use strict";Oo.exports=Io;var Mo=pa(),Ro=ga(),Ux=Na(),wa=ee(),Vx=Zr();function Io(e){this.contextObject=e}var jx={xml:{"":!0,"1.0":!0,"2.0":!0},core:{"":!0,"2.0":!0},html:{"":!0,"1.0":!0,"2.0":!0},xhtml:{"":!0,"1.0":!0,"2.0":!0}};Io.prototype={hasFeature:function(t,r){var a=jx[(t||"").toLowerCase()];return a&&a[r||""]||!1},createDocumentType:function(t,r,a){return Vx.isValidQName(t)||wa.InvalidCharacterError(),new Ro(this.contextObject,t,r,a)},createDocument:function(t,r,a){var s=new Mo(!1,null),o;return r?o=s.createElementNS(t,r):o=null,a&&s.appendChild(a),o&&s.appendChild(o),t===wa.NAMESPACE.HTML?s._contentType="application/xhtml+xml":t===wa.NAMESPACE.SVG?s._contentType="image/svg+xml":s._contentType="application/xml",s},createHTMLDocument:function(t){var r=new Mo(!0,null);r.appendChild(new Ro(r,"html"));var a=r.createElement("html");r.appendChild(a);var s=r.createElement("head");if(a.appendChild(s),t!==void 0){var o=r.createElement("title");s.appendChild(o),o.appendChild(r.createTextNode(t))}return a.appendChild(r.createElement("body")),r.modclock=1,r},mozSetOutputMutationHandler:function(e,t){e.mutationHandler=t},mozGetInputMutationHandler:function(e){wa.nyi()},mozHTMLParser:Ux}});var Ho=N((pd,qo)=>{"use strict";var Gx=ca(),zx=Yn();qo.exports=li;function li(e,t){this._window=e,this._href=t}li.prototype=Object.create(zx.prototype,{constructor:{value:li},href:{get:function(){return this._href},set:function(e){this.assign(e)}},assign:{value:function(e){var t=new Gx(this._href),r=t.resolve(e);this._href=r}},replace:{value:function(e){this.assign(e)}},reload:{value:function(){this.assign(this.href)}},toString:{value:function(){return this.href}}})});var Bo=N((md,Fo)=>{"use strict";var Wx=Object.create(null,{appCodeName:{value:"Mozilla"},appName:{value:"Netscape"},appVersion:{value:"4.0"},platform:{value:""},product:{value:"Gecko"},productSub:{value:"20100101"},userAgent:{value:""},vendor:{value:""},vendorSub:{value:""},taintEnabled:{value:function(){return!1}}});Fo.exports=Wx});var Uo=N((gd,Po)=>{"use strict";var Xx={setTimeout,clearTimeout,setInterval,clearInterval};Po.exports=Xx});var xi=N((vr,Vo)=>{"use strict";var ui=ee();vr=Vo.exports={CSSStyleDeclaration:la(),CharacterData:xr(),Comment:On(),DOMException:Xr(),DOMImplementation:_r(),DOMTokenList:bn(),Document:pa(),DocumentFragment:Hn(),DocumentType:ga(),Element:Bt(),HTMLParser:Na(),NamedNodeMap:Nn(),Node:xe(),NodeList:yt(),NodeFilter:pr(),ProcessingInstruction:Bn(),Text:Rn(),Window:fi()};ui.merge(vr,Kn());ui.merge(vr,fa().elements);ui.merge(vr,ei().elements)});var fi=N((bd,jo)=>{"use strict";var Kx=_r(),Yx=Ja(),Qx=Ho(),Tr=ee();jo.exports=Sa;function Sa(e){this.document=e||new Kx(null).createHTMLDocument(""),this.document._scripting_enabled=!0,this.document.defaultView=this,this.location=new Qx(this,this.document._address||"about:blank")}Sa.prototype=Object.create(Yx.prototype,{console:{value:console},history:{value:{back:Tr.nyi,forward:Tr.nyi,go:Tr.nyi}},navigator:{value:Bo()},window:{get:function(){return this}},self:{get:function(){return this}},frames:{get:function(){return this}},parent:{get:function(){return this}},top:{get:function(){return this}},length:{value:0},frameElement:{value:null},opener:{value:null},onload:{get:function(){return this._getEventHandler("load")},set:function(e){this._setEventHandler("load",e)}},getComputedStyle:{value:function(t){return t.style}}});Tr.expose(Uo(),Sa);Tr.expose(xi(),Sa)});var Xo=N(Ct=>{"use strict";var Go=_r(),zo=Na(),Ed=fi(),Wo=xi();Ct.createDOMImplementation=function(){return new Go(null)};Ct.createDocument=function(e,t){if(e||t){var r=new zo;return r.parse(e||"",!0),r.document()}return new Go(null).createHTMLDocument("")};Ct.createIncrementalHTMLParser=function(){var e=new zo;return{write:function(t){t.length>0&&e.parse(t,!1,function(){return!0})},end:function(t){e.parse(t||"",!0,function(){return!0})},process:function(t){return e.parse("",!1,t)},document:function(){return e.document()}}};Ct.createWindow=function(e,t){var r=Ct.createDocument(e);return t!==void 0&&(r._address=t),new Wo.Window(r)};Ct.impl=Wo});var lc=N((vd,cc)=>{"use strict";function $x(e){for(var t=1;t0&&e[t-1]===` -`;)t--;return e.substring(0,t)}function Zo(e){return $o(Qo(e))}var Zx=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function gi(e){return bi(e,Zx)}var Jo=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function ec(e){return bi(e,Jo)}function Jx(e){return rc(e,Jo)}var tc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function ef(e){return bi(e,tc)}function tf(e){return rc(e,tc)}function bi(e,t){return t.indexOf(e.nodeName)>=0}function rc(e,t){return e.getElementsByTagName&&t.some(function(r){return e.getElementsByTagName(r).length})}var rf=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ac(e){return rf.reduce(function(t,r){return t.replace(r[0],r[1])},e)}var ge={};ge.paragraph={filter:"p",replacement:function(e){return` - -`+e+` - -`}};ge.lineBreak={filter:"br",replacement:function(e,t,r){return r.br+` -`}};ge.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var a=Number(t.nodeName.charAt(1));if(r.headingStyle==="setext"&&a<3){var s=mi(a===1?"=":"-",e.length);return` - -`+e+` -`+s+` - -`}else return` - -`+mi("#",a)+" "+e+` - -`}};ge.blockquote={filter:"blockquote",replacement:function(e){return e=Zo(e).replace(/^/gm,"> "),` - -`+e+` - -`}};ge.list={filter:["ul","ol"],replacement:function(e,t){var r=t.parentNode;return r.nodeName==="LI"&&r.lastElementChild===t?` -`+e:` - -`+e+` - -`}};ge.listItem={filter:"li",replacement:function(e,t,r){var a=r.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var o=s.getAttribute("start"),x=Array.prototype.indexOf.call(s.children,t);a=(o?Number(o)+x:x+1)+". "}var m=/\n$/.test(e);return e=Zo(e)+(m?` -`:""),e=e.replace(/\n/gm,` -`+" ".repeat(a.length)),a+e+(t.nextSibling?` -`:"")}};ge.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){return` - - `+t.firstChild.textContent.replace(/\n/g,` - `)+` - -`}};ge.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,r){for(var a=t.firstChild.getAttribute("class")||"",s=(a.match(/language-(\S+)/)||[null,""])[1],o=t.firstChild.textContent,x=r.fence.charAt(0),m=3,h=new RegExp("^"+x+"{3,}","gm"),g;g=h.exec(o);)g[0].length>=m&&(m=g[0].length+1);var v=mi(x,m);return` - -`+v+s+` -`+o.replace(/\n$/,"")+` -`+v+` - -`}};ge.horizontalRule={filter:"hr",replacement:function(e,t,r){return` - -`+r.hr+` - -`}};ge.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var r=Ei(t.getAttribute("href")),a=_i(Aa(t.getAttribute("title"))),s=a?' "'+a+'"':"";return"["+e+"]("+r+s+")"}};ge.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,r){var a=Ei(t.getAttribute("href")),s=Aa(t.getAttribute("title"));s&&(s=' "'+_i(s)+'"');var o,x;switch(r.linkReferenceStyle){case"collapsed":o="["+e+"][]",x="["+e+"]: "+a+s;break;case"shortcut":o="["+e+"]",x="["+e+"]: "+a+s;break;default:var m=this.references.length+1;o="["+e+"]["+m+"]",x="["+m+"]: "+a+s}return this.references.push(x),o},references:[],append:function(e){var t="";return this.references.length&&(t=` - -`+this.references.join(` -`)+` - -`,this.references=[]),t}};ge.emphasis={filter:["em","i"],replacement:function(e,t,r){return e.trim()?r.emDelimiter+e+r.emDelimiter:""}};ge.strong={filter:["strong","b"],replacement:function(e,t,r){return e.trim()?r.strongDelimiter+e+r.strongDelimiter:""}};ge.code={filter:function(e){var t=e.previousSibling||e.nextSibling,r=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!r},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",r="`",a=e.match(/`+/gm)||[];a.indexOf(r)!==-1;)r=r+"`";return r+t+e+t+r}};ge.image={filter:"img",replacement:function(e,t){var r=ac(Aa(t.getAttribute("alt"))),a=Ei(t.getAttribute("src")||""),s=Aa(t.getAttribute("title")),o=s?' "'+_i(s)+'"':"";return a?"!["+r+"]("+a+o+")":""}};function Aa(e){return e?e.replace(/(\n+\s*)+/g,` -`):""}function Ei(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function _i(e){return e.replace(/"/g,'\\"')}function nc(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}nc.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=di(this.array,e,this.options))||(t=di(this._keep,e,this.options))||(t=di(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t-1)return!0}else if(typeof a=="function"){if(a.call(e,t,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function nf(e){var t=e.element,r=e.isBlock,a=e.isVoid,s=e.isPre||function(ne){return ne.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var o=null,x=!1,m=null,h=Ko(m,t,s);h!==t;){if(h.nodeType===3||h.nodeType===4){var g=h.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!x&&g[0]===" "&&(g=g.substr(1)),!g){h=hi(h);continue}h.data=g,o=h}else if(h.nodeType===1)r(h)||h.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,x=!1):a(h)||s(h)?(o=null,x=!0):o&&(x=!1);else{h=hi(h);continue}var v=Ko(m,h,s);m=h,h=v}o&&(o.data=o.data.replace(/ $/,""),o.data||hi(o))}}function hi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Ko(e,t,r){return e&&e.parentNode===t||r(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ic=typeof window<"u"?window:{};function sf(){var e=ic.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function of(){var e=function(){};{var t=Xo();e.prototype.parseFromString=function(r){return t.createDocument(r)}}return e}var cf=sf()?ic.DOMParser:of();function lf(e,t){var r;if(typeof e=="string"){var a=uf().parseFromString(''+e+"","text/html");r=a.getElementById("turndown-root")}else r=e.cloneNode(!0);return nf({element:r,isBlock:gi,isVoid:ec,isPre:t.preformattedCode?xf:null}),r}var pi;function uf(){return pi=pi||new cf,pi}function xf(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function ff(e,t){return e.isBlock=gi(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=df(e),e.flankingWhitespace=hf(e,t),e}function df(e){return!ec(e)&&!ef(e)&&/^\s*$/i.test(e.textContent)&&!Jx(e)&&!tf(e)}function hf(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var r=pf(e.textContent);return r.leadingAscii&&Yo("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&Yo("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function pf(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Yo(e,t,r){var a,s,o;return e==="left"?(a=t.previousSibling,s=/ $/):(a=t.nextSibling,s=/^ /),a&&(a.nodeType===3?o=s.test(a.nodeValue):r.preformattedCode&&a.nodeName==="CODE"?o=!1:a.nodeType===1&&!gi(a)&&(o=s.test(a.textContent))),o}var mf=Array.prototype.reduce;function Ca(e){if(!(this instanceof Ca))return new Ca(e);var t={rules:ge,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(r,a){return a.isBlock?` - -`:""},keepReplacement:function(r,a){return a.isBlock?` - -`+a.outerHTML+` - -`:a.outerHTML},defaultReplacement:function(r,a){return a.isBlock?` - -`+r+` - -`:r}};this.options=$x({},t,e),this.rules=new nc(this.options)}Ca.prototype={turndown:function(e){if(!Ef(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=sc.call(this,new lf(e,this.options));return gf.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t quoted text"," - Horizontal rules (hr) \u2192 ---"],options:["-b, --bullet=CHAR bullet character for unordered lists (-, +, or *)","-c, --code=FENCE fence style for code blocks (``` or ~~~)","-r, --hr=STRING string for horizontal rules (default: ---)"," --heading-style=STYLE"," heading style: 'atx' for # headings (default),"," 'setext' for underlined headings (h1/h2 only)"," --help display this help and exit"],examples:["echo '

Hello

World

' | html-to-markdown","html-to-markdown page.html","curl -s https://example.com | html-to-markdown > page.md"]},yd={name:"html-to-markdown",async execute(e,t){if(Ui(e))return Pi(_f);let r="-",a="```",s="---",o="atx",x=[];for(let h=0;hb(s));return{headers:r.meta.fields||[],data:o}}function I(e,r){return r.length===0?`${e.join(",")} +`:`${w.default.unparse(r,{columns:e}).replace(/\r\n/g,` +`)} +`}async function g(e,r){let o=e.find(p=>!p.startsWith("-")),s;if(!o||o==="-")s=y(r.stdin);else try{let p=r.fs.resolvePath(r.cwd,o);s=await r.fs.readFile(p)}catch{return{headers:[],data:[],error:{stdout:"",stderr:`xan: ${o}: No such file or directory +`,exitCode:1}}}let{headers:i,data:f}=S(s);return{headers:i,data:f}}async function N(e,r){let o=0,s=[],i=[];for(let t=0;t0?s.filter(t=>f.includes(t)):f,l=o>0?p.slice(0,o):p,h=Math.max(...c.map(t=>t.length)),a=[],$="\u2500".repeat(80);for(let t=0;t0?f.slice(0,o):f,c=i.map(t=>t.length);for(let t of d)for(let n=0;nh.repeat(t+2)).join("\u252C")}\u2510`);let $=i.map((t,n)=>` ${t.padEnd(c[n])} `).join(a);l.push(`${a}${$}${a}`),l.push(`\u251C${c.map(t=>h.repeat(t+2)).join("\u253C")}\u2524`);for(let t of d){let n=i.map((u,m)=>` ${String(t[u]??"").padEnd(c[m])} `).join(a);l.push(`${a}${n}${a}`)}return l.push(`\u2514${c.map(t=>h.repeat(t+2)).join("\u2534")}\u2518`),{stdout:`${l.join(` +`)} +`,stderr:"",exitCode:0}}export{C as a,E as b,b as c,S as d,I as e,g as f,N as g,A as h}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-LC6D27QJ.js b/packages/just-bash/dist/bin/chunks/chunk-LC6D27QJ.js new file mode 100644 index 00000000..529a0689 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-LC6D27QJ.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as l,b as n,d as s}from"./chunk-UGJM7CKP.js";import{a,b as i}from"./chunk-MUFNRCMY.js";var m={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},d={name:"tail",async execute(t,r){if(i(t))return a(m);let e=l(t,"tail");if(!e.ok)return e.error;let{lines:o,bytes:p,fromLine:f}=e.options;return n(r,e.options,"tail",u=>s(u,o,p,f??!1))}},c={name:"tail",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0};export{d as a,c as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-LCDPWJBA.js b/packages/just-bash/dist/bin/chunks/chunk-LCDPWJBA.js deleted file mode 100644 index 26dde2de..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-LCDPWJBA.js +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node -import{a as _,c as W}from"./chunk-D5WP4CKS.js";import{k as T}from"./chunk-6KZRLMG3.js";import{a as D}from"./chunk-4VDEBYW7.js";import{a as N,b as A}from"./chunk-GTNBSMZR.js";import{c as H,e as L}from"./chunk-KGOUQS5A.js";var z=H(C=>{(function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(c){return e(n(c),arguments)}function r(c,i){return a.apply(null,[c].concat(i||[]))}function e(c,i){var u=1,l=c.length,o,m="",p,d,f,h,y,S,k,x;for(p=0;p=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?m+=o:(t.number.test(f.type)&&(!k||f.sign)?(x=k?"+":"-",o=o.toString().replace(t.sign,"")):x="",y=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",S=f.width-(x+o).length,h=f.width&&S>0?y.repeat(S):"",m+=f.align?x+o+h:y==="0"?x+h+o:h+x+o)}return m}var s=Object.create(null);function n(c){if(s[c])return s[c];for(var i=c,u,l=[],o=0;i;){if((u=t.text.exec(i))!==null)l.push(u[0]);else if((u=t.modulo.exec(i))!==null)l.push("%");else if((u=t.placeholder.exec(i))!==null){if(u[2]){o|=1;var m=[],p=u[2],d=[];if((d=t.key.exec(p))!==null)for(m.push(d[1]);(p=p.substring(d[0].length))!=="";)if((d=t.key_access.exec(p))!==null)m.push(d[1]);else if((d=t.index_access.exec(p))!==null)m.push(d[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=m}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");l.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");i=i.substring(u[0].length)}return s[c]=l}typeof C<"u"&&(C.sprintf=a,C.vsprintf=r),typeof window<"u"&&(window.sprintf=a,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:a,vsprintf:r}}))})()});var $=L(z(),1);function P(t,a,r){let e=new Date(a*1e3),s="",n=0;for(;ns.find(l=>l.type===u)?.value??"",c=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),i=n("weekday");return{year:Number.parseInt(n("year"),10)||t.getFullYear(),month:Number.parseInt(n("month"),10)||t.getMonth()+1,day:Number.parseInt(n("day"),10)||t.getDate(),hour:Number.parseInt(n("hour"),10)||t.getHours(),minute:Number.parseInt(n("minute"),10)||t.getMinutes(),second:Number.parseInt(n("second"),10)||t.getSeconds(),weekday:c.get(i)??t.getDay()}}catch{return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),weekday:t.getDay()}}}function R(t,a,r){let e=G(t,r),s=(u,l=2)=>String(u).padStart(l,"0"),n=Z(e.year,e.month,e.day),c=j(e.year,e.month,e.day,e.weekday,0),i=j(e.year,e.month,e.day,e.weekday,1);switch(a){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][e.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1]} ${String(e.day).padStart(2," ")} ${s(e.hour)}:${s(e.minute)}:${s(e.second)} ${e.year}`;case"C":return s(Math.floor(e.year/100));case"d":return s(e.day);case"D":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"e":return String(e.day).padStart(2," ");case"F":return`${e.year}-${s(e.month)}-${s(e.day)}`;case"g":return s(O(e.year,e.month,e.day)%100);case"G":return String(O(e.year,e.month,e.day));case"H":return s(e.hour);case"I":return s(e.hour%12||12);case"j":return String(n).padStart(3,"0");case"k":return String(e.hour).padStart(2," ");case"l":return String(e.hour%12||12).padStart(2," ");case"m":return s(e.month);case"M":return s(e.minute);case"n":return` -`;case"N":return"000000000";case"p":return e.hour<12?"AM":"PM";case"P":return e.hour<12?"am":"pm";case"r":return`${s(e.hour%12||12)}:${s(e.minute)}:${s(e.second)} ${e.hour<12?"AM":"PM"}`;case"R":return`${s(e.hour)}:${s(e.minute)}`;case"s":return String(Math.floor(t.getTime()/1e3));case"S":return s(e.second);case"t":return" ";case"T":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"u":return String(e.weekday===0?7:e.weekday);case"U":return s(c);case"V":return s(Q(e.year,e.month,e.day));case"w":return String(e.weekday);case"W":return s(i);case"x":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"X":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"y":return s(e.year%100);case"Y":return String(e.year);case"z":return V(t,r);case"Z":return q(t,r);case"%":return"%";default:return null}}function V(t,a){if(!a){let c=-t.getTimezoneOffset(),i=c>=0?"+":"-",u=Math.floor(Math.abs(c)/60),l=Math.abs(c)%60;return`${i}${String(u).padStart(2,"0")}${String(l).padStart(2,"0")}`}try{let u=new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"longOffset"}).formatToParts(t).find(l=>l.type==="timeZoneName");if(u){let l=u.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(l)return`${l[1]}${l[2]}${l[3]}`;if(u.value==="GMT"||u.value==="UTC")return"+0000"}}catch{}let r=-t.getTimezoneOffset(),e=r>=0?"+":"-",s=Math.floor(Math.abs(r)/60),n=Math.abs(r)%60;return`${e}${String(s).padStart(2,"0")}${String(n).padStart(2,"0")}`}function q(t,a){try{return new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function Z(t,a,r){let e=[31,28,31,30,31,30,31,31,30,31,30,31];(t%4===0&&t%100!==0||t%400===0)&&(e[1]=29);let n=r;for(let c=0;c=194){let s=(e&31)<<6|t[r+1]&63;a+=String.fromCharCode(s),r+=2;continue}a+=String.fromCharCode(e),r++;continue}if((e&240)===224){if(r+2=55296&&s<=57343){a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(s),r+=3;continue}a+=String.fromCharCode(e),r++;continue}if((e&248)===240&&e<=244){if(r+31114111){a+=String.fromCharCode(e),r++;continue}a+=String.fromCodePoint(s),r+=4;continue}a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(e),r++}return a}var K={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},ge={name:"printf",async execute(t,a){if(A(t))return N(K);if(t.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments] -`,exitCode:2};let r=null,e=0;for(;e=t.length)return{stdout:"",stderr:`printf: -v: option requires an argument -`,exitCode:1};if(r=t[e+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(r))return{stdout:"",stderr:`printf: \`${r}': not a valid identifier -`,exitCode:2};e+=2}else{if(c.startsWith("-")&&c!=="-")break;break}}if(e>=t.length)return{stdout:"",stderr:`printf: usage: printf format [arguments] -`,exitCode:1};let s=t[e],n=t.slice(e+1);try{let c=W(s),i="",u=0,l=!1,o="",m=a.env.get("TZ"),p=a.limits?.maxStringLength;do{let{result:d,argsConsumed:f,error:h,errMsg:y,stopped:S}=ee(c,n,u,m);if(i+=d,p!==void 0&&p>0&&i.length>p)throw new T(`printf: output size limit exceeded (${p} bytes)`,"string_length");if(u+=f,h&&(l=!0,y&&(o=y)),S)break}while(u0);if(u===0&&n.length>0,r){let d=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(d){let f=d[1],h=d[3];h=h.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(y,S)=>a.env.get(S)??""),a.env.set(`${f}_${h}`,i)}else a.env.set(r,i);return{stdout:"",stderr:o,exitCode:l?1:0}}return{stdout:i,stderr:o,exitCode:l?1:0}}catch(c){if(c instanceof T)throw c;return{stdout:"",stderr:`printf: ${D(c)} -`,exitCode:1}}}};function ee(t,a,r,e){let s="",n=0,c=0,i=!1,u="";for(;n=0&&w.length>I&&(w=w.slice(0,I)),b!==0){let F=Math.abs(b);w.length>>0:n;return{value:U(t.replace("u","d"),c),parseError:e,parseErrMsg:s}}case"x":case"X":{let n=E(r);return e=g,e&&(s=`printf: ${r}: invalid number -`),{value:ne(t,n),parseError:e,parseErrMsg:s}}case"e":case"E":case"f":case"F":case"g":case"G":{let n=parseFloat(r)||0;return{value:oe(t,a,n),parseError:!1,parseErrMsg:""}}case"c":{if(r==="")return{value:"",parseError:!1,parseErrMsg:""};let i=new TextEncoder().encode(r)[0];return{value:String.fromCharCode(i),parseError:!1,parseErrMsg:""}}case"s":return{value:ae(t,r),parseError:!1,parseErrMsg:""};case"q":return{value:ie(t,r),parseError:!1,parseErrMsg:""};case"b":{let n=ce(r);return{value:n.value,parseError:!1,parseErrMsg:"",stopped:n.stopped}}default:try{return{value:(0,$.sprintf)(t,r),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder -`}}}}var g=!1;function E(t){g=!1;let a=t.trimStart(),r=a!==a.trimEnd();if(t=a.trimEnd(),t.startsWith("'")&&t.length>=2||t.startsWith('"')&&t.length>=2)return t.charCodeAt(1);if(t.startsWith("\\'")&&t.length>=3||t.startsWith('\\"')&&t.length>=3)return t.charCodeAt(2);if(t.startsWith("+")&&(t=t.slice(1)),t.startsWith("0x")||t.startsWith("0X")){let e=parseInt(t,16);return Number.isNaN(e)?(g=!0,0):(r&&(g=!0),e)}if(t.startsWith("0")&&t.length>1&&/^-?0[0-7]+$/.test(t))return r&&(g=!0),parseInt(t,8)||0;if(/^\d+#/.test(t)){g=!0;let e=t.match(/^(\d+)#/);return e?parseInt(e[1],10):0}if(t!==""&&!/^-?\d+$/.test(t)){g=!0;let e=parseInt(t,10);return Number.isNaN(e)?0:e}return r&&(g=!0),parseInt(t,10)||0}function U(t,a){let r=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!r)return(0,$.sprintf)(t.replace(/\.\d*/,""),a);let e=r[1]||"",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=a<0,i=Math.abs(a),u=String(i);n>=0&&(u=u.padStart(n,"0"));let l="";c?l="-":e.includes("+")?l="+":e.includes(" ")&&(l=" ");let o=l+u;return s>o.length&&(e.includes("-")?o=o.padEnd(s," "):e.includes("0")&&n<0?o=l+u.padStart(s-l.length,"0"):o=o.padStart(s," ")),o}function re(t,a){let r=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!r)return(0,$.sprintf)(t,a);let e=r[1]||"",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=Math.abs(a).toString(8);n>=0&&(c=c.padStart(n,"0")),e.includes("#")&&!c.startsWith("0")&&(c=`0${c}`);let i=c;return s>i.length&&(e.includes("-")?i=i.padEnd(s," "):e.includes("0")&&n<0?i=i.padStart(s,"0"):i=i.padStart(s," ")),i}function ne(t,a){let r=t.includes("X"),e=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!e)return(0,$.sprintf)(t,a);let s=e[1]||"",n=e[2]?parseInt(e[2],10):0,c=e[3]!==void 0?e[4]?parseInt(e[4],10):0:-1,i=Math.abs(a).toString(16);r&&(i=i.toUpperCase()),c>=0&&(i=i.padStart(c,"0"));let u="";s.includes("#")&&a!==0&&(u=r?"0X":"0x");let l=u+i;return n>l.length&&(s.includes("-")?l=l.padEnd(n," "):s.includes("0")&&c<0?l=u+i.padStart(n-u.length,"0"):l=l.padStart(n," ")),l}function se(t){if(t==="")return"''";if(/^[a-zA-Z0-9_./-]+$/.test(t))return t;if(/[\x00-\x1f\x7f-\xff]/.test(t)){let e="$'";for(let s of t){let n=s.charCodeAt(0);s==="'"?e+="\\'":s==="\\"?e+="\\\\":s===` -`?e+="\\n":s===" "?e+="\\t":s==="\r"?e+="\\r":s==="\x07"?e+="\\a":s==="\b"?e+="\\b":s==="\f"?e+="\\f":s==="\v"?e+="\\v":s==="\x1B"?e+="\\E":n<32||n>=127&&n<=255?e+=`\\${n.toString(8).padStart(3,"0")}`:s==='"'?e+='\\"':e+=s}return e+="'",e}let r="";for(let e of t)" |&;<>()$`\\\"'*?[#~=%!{}".includes(e)?r+=`\\${e}`:r+=e;return r}function ae(t,a){let r=t.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!r)return(0,$.sprintf)(t.replace(/0+(?=\d)/,""),a);let e=r[1]==="-",s=r[2]?parseInt(r[2],10):0,n=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,c=e?-s:s;return _(a,c,n)}function ie(t,a){let r=se(a),e=t.match(/^%(-?)(\d*)q$/);if(!e)return r;let s=e[1]==="-",n=e[2]?parseInt(e[2],10):0,c=r;return n>c.length&&(s?c=c.padEnd(n," "):c=c.padStart(n," ")),c}function oe(t,a,r){let e=t.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!e)return(0,$.sprintf)(t,r);let s=e[1]||"",n=e[2]?parseInt(e[2],10):0,c=e[3]!==void 0?e[4]?parseInt(e[4],10):0:6,i,u=a.toLowerCase();if(u==="e"?(i=r.toExponential(c),i=i.replace(/e([+-])(\d)$/,"e$10$2"),a==="E"&&(i=i.toUpperCase())):u==="f"?(i=r.toFixed(c),s.includes("#")&&c===0&&!i.includes(".")&&(i+=".")):u==="g"?(i=r.toPrecision(c||1),s.includes("#")||(i=i.replace(/\.?0+$/,""),i=i.replace(/\.?0+e/,"e")),i=i.replace(/e([+-])(\d)$/,"e$10$2"),a==="G"&&(i=i.toUpperCase())):i=r.toString(),r>=0&&(s.includes("+")?i=`+${i}`:s.includes(" ")&&(i=` ${i}`)),n>i.length)if(s.includes("-"))i=i.padEnd(n," ");else if(s.includes("0")){let l=i.match(/^[+ -]/)?.[0]||"",o=l?i.slice(1):i;i=l+o.padStart(n-l.length,"0")}else i=i.padStart(n," ");return i}function ce(t){let a="",r=0;for(;r0?(a+=B(s),r=n):(a+="\\x",r+=2);break}case"u":{let s="",n=r+2;for(;n=e.length&&!o?r.join(` -`):`${r.join(` -`)} -`;t.push({content:c,hasContent:!0})}return t}function C(s,l){let o=new TextEncoder().encode(s),t=new TextDecoder,u=[];for(let r=0;r0})}return u}function S(s,l){let o=new TextEncoder().encode(s),t=new TextDecoder,u=[],r=Math.ceil(o.length/l);for(let f=0;f0})}return u}var I={name:"split",execute:async(s,l)=>{if(d(s))return a(k);let e={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},o=[],t=0;for(;t=1&&(u=o[0]),o.length>=2&&(r=o[1]);let f;if(u==="-")f=l.stdin??"";else{let i=l.fs.resolvePath(l.cwd,u),n=await l.fs.readFile(i);if(n===null)return{exitCode:1,stdout:"",stderr:`split: ${u}: No such file or directory -`};f=n}if(f==="")return{exitCode:0,stdout:"",stderr:""};let c;switch(e.mode){case"lines":c=g(f,e.lines);break;case"bytes":c=C(f,e.bytes);break;case"chunks":c=S(f,e.chunks);break;default:return e.mode}if(c.length>p)return{exitCode:1,stdout:"",stderr:`split: too many output files (${c.length}), limit is ${p} -`};for(let i=0;i=r.length){s+="\\";break}let o=r[e+1];switch(o){case"\\":s+="\\",e+=2;break;case"n":s+=` -`,e+=2;break;case"t":s+=" ",e+=2;break;case"r":s+="\r",e+=2;break;case"a":s+="\x07",e+=2;break;case"b":s+="\b",e+=2;break;case"f":s+="\f",e+=2;break;case"v":s+="\v",e+=2;break;case"e":case"E":s+="\x1B",e+=2;break;case"c":return{output:s,stop:!0};case"0":{let a="",t=e+2;for(;tn.length>0):l?t.split(/[ \t]/):t.split(/[ \t]+/).filter(n=>n.length>0)}function I(t){let e=[];for(let l of t)for(let n=0;ne[n])&&(e[n]=o)}return e}function W(t,e){if(t.length===0)return"";let l=I(t),n=[];for(let o of t){let c=[];for(let s=0;sa.length)),o=l.length,c=n+o,s=Math.max(1,Math.floor((e+o)/c)),p=Math.ceil(t.length/s),d=[];for(let a=0;a=t.length?i.push(t[m]):i.push(t[m].padEnd(n)))}d.push(i.join(l))}return d.join(` -`)}var M={name:"column",execute:async(t,e)=>{if(F(t))return b(v);let l=x("column",t,H);if(!l.ok)return l.error;let{table:n,separator:o,outputSep:c,width:s,noMerge:p}=l.result.flags,d=l.result.positional,a=c??" ",i;if(d.length===0)i=e.stdin??"";else{let u=[];for(let f of d)if(f==="-")u.push(e.stdin??"");else{let w=e.fs.resolvePath(e.cwd,f),y=await e.fs.readFile(w);if(y===null)return{exitCode:1,stdout:"",stderr:`column: ${f}: No such file or directory -`};u.push(y)}i=u.join("")}if(i===""||i.trim()==="")return{exitCode:0,stdout:"",stderr:""};let r=i.split(` -`);i.endsWith(` -`)&&r[r.length-1]===""&&r.pop();let g=r.filter(u=>u.trim().length>0),h;if(n){let u=g.map(f=>C(f,o,p));h=W(u,a)}else{let u=[];for(let f of g){let w=C(f,o,p);u.push(...w)}h=j(u,s,a)}return h.length>0&&(h+=` -`),{exitCode:0,stdout:h,stderr:""}}},P={name:"column",flags:[{flag:"-t",type:"boolean"},{flag:"-s",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-n",type:"boolean"}],stdinType:"text",needsFiles:!0};export{M as a,P as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-LNNWMRCB.js b/packages/just-bash/dist/bin/chunks/chunk-LNNWMRCB.js new file mode 100644 index 00000000..7b2a2e41 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-LNNWMRCB.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as s,b as i}from"./chunk-HL4ZS7TX.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-LNVSXNT7.js b/packages/just-bash/dist/bin/chunks/chunk-LNVSXNT7.js new file mode 100644 index 00000000..48128b30 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-LNVSXNT7.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +var h=Object.create;var e=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(a&&(b=a(a=0)),b);var o=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),p=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},g=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of j(b))!l.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=i(b,d))||f.enumerable});return a};var q=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a)),r=a=>g(e({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-LOJMXC4F.js b/packages/just-bash/dist/bin/chunks/chunk-LOJMXC4F.js deleted file mode 100644 index 66a854d4..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-LOJMXC4F.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -import{a as m,b as k,c as p}from"./chunk-GTNBSMZR.js";var g={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},T=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function s(a,i=2){return String(a).padStart(i,"0")}function b(a,i,n){let t={Y:a.getUTCFullYear(),m:a.getUTCMonth(),D:a.getUTCDate(),H:a.getUTCHours(),M:a.getUTCMinutes(),S:a.getUTCSeconds(),w:a.getUTCDay()},e="",l=0;for(;l{let y=p(h,e[0],n)[0],l=p(a,e[0],n)[0];return u(y,l)})];case"bsearch":{if(!Array.isArray(t)){let h=t===null?"null":typeof t=="object"?"object":typeof t;throw new Error(`${h} (${JSON.stringify(t)}) cannot be searched from`)}return e.length===0?[null]:p(t,e[0],n).map(h=>{let a=0,y=t.length;for(;a>>1;u(t[l],h)<0?a=l+1:y=l}return au(a.key,y.key)),[h.map(a=>a.item)]}case"group_by":{if(!Array.isArray(t)||e.length===0)return[null];let i=new Map;for(let h of t){let a=JSON.stringify(p(h,e[0],n)[0]);i.has(a)||i.set(a,[]),i.get(a)?.push(h)}return[[...i.values()]]}case"max":return Array.isArray(t)&&t.length>0?[t.reduce((i,h)=>u(i,h)>0?i:h)]:[null];case"max_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((i,h)=>{let a=p(i,e[0],n)[0],y=p(h,e[0],n)[0];return u(a,y)>0?i:h})];case"min":return Array.isArray(t)&&t.length>0?[t.reduce((i,h)=>u(i,h)<0?i:h)]:[null];case"min_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((i,h)=>{let a=p(i,e[0],n)[0],y=p(h,e[0],n)[0];return u(a,y)<0?i:h})];case"add":{let i=h=>{let a=h.filter(y=>y!==null);return a.length===0?null:a.every(y=>typeof y=="number")?a.reduce((y,l)=>y+l,0):a.every(y=>typeof y=="string")?a.join(""):a.every(y=>Array.isArray(y))?a.flat():a.every(y=>y&&typeof y=="object"&&!Array.isArray(y))?lt(...a):null};if(e.length>=1){let h=p(t,e[0],n);return[i(h)]}return Array.isArray(t)?[i(t)]:[null]}case"any":{if(e.length>=2){try{let i=o(t,e[0],n);for(let h of i)if(p(h,e[1],n).some(c))return[!0]}catch(i){if(i instanceof f)throw i}return[!1]}return e.length===1?Array.isArray(t)?[t.some(i=>c(p(i,e[0],n)[0]))]:[!1]:Array.isArray(t)?[t.some(c)]:[!1]}case"all":{if(e.length>=2){try{let i=o(t,e[0],n);for(let h of i)if(!p(h,e[1],n).some(c))return[!1]}catch(i){if(i instanceof f)throw i}return[!0]}return e.length===1?Array.isArray(t)?[t.every(i=>c(p(i,e[0],n)[0]))]:[!0]:Array.isArray(t)?[t.every(c)]:[!0]}case"select":return e.length===0?[t]:p(t,e[0],n).some(c)?[t]:[];case"map":return e.length===0||!Array.isArray(t)?[null]:[t.flatMap(h=>p(h,e[0],n))];case"map_values":{if(e.length===0)return[null];if(Array.isArray(t))return[t.flatMap(i=>p(i,e[0],n))];if(t&&typeof t=="object"){let i=Object.create(null);for(let[h,a]of Object.entries(t)){if(!g(h))continue;let y=p(a,e[0],n);y.length>0&&A(i,h,y[0])}return[i]}return[null]}case"has":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(t)&&typeof h=="number"?[h>=0&&h=0&&t0)try{let s=o(t,e[0],n);return s.length>0?[s[0]]:[]}catch(s){if(s instanceof c)throw s;return[]}return Array.isArray(t)&&t.length>0?[t[0]]:[null];case"last":if(e.length>0){let s=p(t,e[0],n);return s.length>0?[s[s.length-1]]:[]}return Array.isArray(t)&&t.length>0?[t[t.length-1]]:[null];case"nth":{if(e.length<1)return[null];let s=p(t,e[0],n);if(e.length>1){for(let i of s)if(i<0)throw new Error("nth doesn't support negative indices");let f;try{f=o(t,e[1],n)}catch(i){if(i instanceof c)throw i;f=[]}return s.flatMap(i=>{let h=i;return h{let i=f;if(i<0)throw new Error("nth doesn't support negative indices");return il.length>=s,i=p(t,e[0],n);if(e.length===1){let l=[];for(let m of i){let b=m;for(let w=0;w0){for(let C=w;Ck;C+=N)if(y.push(C),f(y))return y}}return y}case"limit":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let i=f;if(i<0)throw new Error("limit doesn't support negative count");if(i===0)return[];let h;try{h=o(t,e[1],n)}catch(a){if(a instanceof c)throw a;h=[]}return h.slice(0,i)});case"isempty":{if(e.length<1)return[!0];try{return[o(t,e[0],n).length===0]}catch(s){if(s instanceof c)throw s;return[!0]}}case"isvalid":{if(e.length<1)return[!0];try{return[p(t,e[0],n).length>0]}catch(s){if(s instanceof c)throw s;return[!1]}}case"skip":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let i=f;if(i<0)throw new Error("skip doesn't support negative count");return p(t,e[1],n).slice(i)});case"until":{if(e.length<2)return[t];let s=t,f=n.limits.maxIterations;for(let i=0;i=i)throw new c(`jq while: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations");return s}case"repeat":{if(e.length===0)return[t];let s=[],f=t,i=n.limits.maxIterations;for(let h=0;h=i)throw new c(`jq repeat: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations");return s}default:return null}}function Z(t,r,e,n,p){switch(r){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof t!="number")return[null];let o=new Date(t*1e3),u=o.getUTCFullYear(),c=o.getUTCMonth(),s=o.getUTCDate(),f=o.getUTCHours(),i=o.getUTCMinutes(),h=o.getUTCSeconds(),a=o.getUTCDay(),y=Date.UTC(u,0,1),l=Math.floor((o.getTime()-y)/(1440*60*1e3));return[[u,c,s,f,i,h,a,l]]}case"mktime":{if(!Array.isArray(t))throw new Error("mktime requires parsed datetime inputs");let[o,u,c,s=0,f=0,i=0]=t;if(typeof o!="number"||typeof u!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(o,u,c??1,s??0,f??0,i??0);return[Math.floor(h/1e3)]}case"strftime":{if(e.length===0)return[null];let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strftime/1 requires a string format");let c;if(typeof t=="number")c=new Date(t*1e3);else if(Array.isArray(t)){let[a,y,l,m=0,b=0,w=0]=t;if(typeof a!="number"||typeof y!="number")throw new Error("strftime/1 requires parsed datetime inputs");c=new Date(Date.UTC(a,y,l??1,m??0,b??0,w??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],i=(a,y=2)=>String(a).padStart(y,"0");return[u.replace(/%Y/g,String(c.getUTCFullYear())).replace(/%m/g,i(c.getUTCMonth()+1)).replace(/%d/g,i(c.getUTCDate())).replace(/%H/g,i(c.getUTCHours())).replace(/%M/g,i(c.getUTCMinutes())).replace(/%S/g,i(c.getUTCSeconds())).replace(/%A/g,s[c.getUTCDay()]).replace(/%B/g,f[c.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(e.length===0)return[null];if(typeof t!="string")throw new Error("strptime/1 requires a string input");let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strptime/1 requires a string format");if(u==="%Y-%m-%dT%H:%M:%SZ"){let s=t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(s){let[,f,i,h,a,y,l]=s.map(Number),m=new Date(Date.UTC(f,i-1,h,a,y,l)),b=m.getUTCDay(),w=Date.UTC(f,0,1),k=Math.floor((m.getTime()-w)/(1440*60*1e3));return[[f,i-1,h,a,y,l,b,k]]}}let c=new Date(t);if(!Number.isNaN(c.getTime())){let s=c.getUTCFullYear(),f=c.getUTCMonth(),i=c.getUTCDate(),h=c.getUTCHours(),a=c.getUTCMinutes(),y=c.getUTCSeconds(),l=c.getUTCDay(),m=Date.UTC(s,0,1),b=Math.floor((c.getTime()-m)/(1440*60*1e3));return[[s,f,i,h,a,y,l,b]]}throw new Error(`Cannot parse date: ${t}`)}case"fromdate":{if(typeof t!="string")throw new Error("fromdate requires a string input");let o=new Date(t);if(Number.isNaN(o.getTime()))throw new Error(`date "${t}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(o.getTime()/1e3)]}case"todate":{if(typeof t!="number")throw new Error("todate requires a number input");return[new Date(t*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}function S(t){return t!==!1&&t!==null}function I(t,r){return JSON.stringify(t)===JSON.stringify(r)}function U(t,r){return typeof t=="number"&&typeof r=="number"?t-r:typeof t=="string"&&typeof r=="string"?t.localeCompare(r):0}function v(t,r){let e=O(t);for(let n of Object.keys(r)){if(!g(n))continue;let p=T(e,n)?E(e[n]):null,o=E(r[n]);p&&o?A(e,n,v(p,o)):A(e,n,r[n])}return e}function D(t,r=3e3){let e=0,n=t;for(;ec===null?0:typeof c=="boolean"?1:typeof c=="number"?2:typeof c=="string"?3:Array.isArray(c)?4:typeof c=="object"?5:6,n=e(t),p=e(r);if(n!==p)return n-p;if(typeof t=="number"&&typeof r=="number")return t-r;if(typeof t=="string"&&typeof r=="string")return t.localeCompare(r);if(typeof t=="boolean"&&typeof r=="boolean")return(t?1:0)-(r?1:0);if(Array.isArray(t)&&Array.isArray(r)){for(let c=0;ct.some(o=>F(o,p)));let e=E(t),n=E(r);return e&&n?Object.keys(n).every(p=>T(e,p)&&F(e[p],n[p])):!1}var Ot=2e3;function tt(t,r,e){switch(r){case"@base64":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"utf-8").toString("base64")]:[btoa(t)]:[null];case"@base64d":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"base64").toString("utf-8")]:[atob(t)]:[null];case"@uri":return typeof t=="string"?[encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof t=="string"?[decodeURIComponent(t)]:[null];case"@csv":return Array.isArray(t)?[t.map(p=>{if(p===null)return"";if(typeof p=="boolean")return p?"true":"false";if(typeof p=="number")return String(p);let o=String(p);return o.includes(",")||o.includes('"')||o.includes(` +`)||o.includes("\r")?`"${o.replace(/"/g,'""')}"`:o}).join(",")]:[null];case"@tsv":return Array.isArray(t)?[t.map(n=>String(n??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let n=e??Ot;return D(t,n+1)>n?[null]:[JSON.stringify(t)]}case"@html":return typeof t=="string"?[t.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof t=="string"?[`'${t.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof t=="string"?[t]:t==null?[""]:[String(t)];default:return null}}function et(t,r,e,n,p,o){switch(r){case"index":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){if(c===""&&t==="")return null;let s=t.indexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let f=0;f<=t.length-c.length;f++){let i=!0;for(let h=0;ho(f,c));return s>=0?s:null}return null});case"rindex":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){let s=t.lastIndexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let s=t.length-c.length;s>=0;s--){let f=!0;for(let i=0;i=0;s--)if(o(t[s],c))return s;return null}return null});case"indices":return e.length===0?[[]]:p(t,e[0],n).map(c=>{let s=[];if(typeof t=="string"&&typeof c=="string"){let f=t.indexOf(c);for(;f!==-1;)s.push(f),f=t.indexOf(c,f+1)}else if(Array.isArray(t))if(Array.isArray(c)){let f=c.length;if(f===0)for(let i=0;i<=t.length;i++)s.push(i);else for(let i=0;i<=t.length-f;i++){let h=!0;for(let a=0;a{if(y.push(m),Array.isArray(m))for(let b of m)l(b);else if(m&&typeof m=="object")for(let b of Object.keys(m))l(m[b])};return l(t),y}let s=[],f=e.length>=2?e[1]:null,i=1e4,h=0,a=y=>{if(h++>i||f&&!p(y,f,n).some(o))return;s.push(y);let l=p(y,e[0],n);for(let m of l)m!=null&&a(m)};return a(t),s}case"recurse_down":return c(t,"recurse",e,n);case"walk":{if(e.length===0)return[t];let s=new WeakSet,f=i=>{if(i&&typeof i=="object"){if(s.has(i))return i;s.add(i)}let h;if(Array.isArray(i))h=i.map(f);else if(i&&typeof i=="object"){let y=Object.create(null);for(let[l,m]of Object.entries(i))g(l)&&A(y,l,f(m));h=y}else h=i;return p(h,e[0],n)[0]};return[f(t)]}case"transpose":{if(!Array.isArray(t))return[null];if(t.length===0)return[[]];let s=Math.max(...t.map(i=>Array.isArray(i)?i.length:0)),f=[];for(let i=0;iArray.isArray(h)?h[i]:null));return[f]}case"combinations":{if(e.length>0){let h=p(t,e[0],n)[0];if(!Array.isArray(t)||h<0)return[];if(h===0)return[[]];let a=[],y=(l,m)=>{if(m===h){a.push([...l]);return}for(let b of t)l.push(b),y(l,m+1),l.pop()};return y([],0),a}if(!Array.isArray(t))return[];if(t.length===0)return[[]];for(let i of t)if(!Array.isArray(i))return[];let s=[],f=(i,h)=>{if(i===t.length){s.push([...h]);return}let a=t[i];for(let y of a)h.push(y),f(i+1,h),h.pop()};return f(0,[]),s}case"parent":{if(n.root===void 0||n.currentPath===void 0)return[];let s=n.currentPath;if(s.length===0)return[];let f=e.length>0?p(t,e[0],n)[0]:1;if(f>=0){if(f>s.length)return[];let i=s.slice(0,s.length-f);return[u(n.root,i)]}else{let i=-f-1;if(i>=s.length)return[t];let h=s.slice(0,i);return[u(n.root,h)]}}case"parents":{if(n.root===void 0||n.currentPath===void 0)return[[]];let s=n.currentPath,f=[];for(let i=s.length-1;i>=0;i--)f.push(u(n.root,s.slice(0,i)));return[f]}case"root":return n.root!==void 0?[n.root]:[];default:return null}}var Nt=2e3;function st(t,r,e,n,p){switch(r){case"keys":return Array.isArray(t)?[t.map((o,u)=>u)]:t&&typeof t=="object"?[Object.keys(t).sort()]:[null];case"keys_unsorted":return Array.isArray(t)?[t.map((o,u)=>u)]:t&&typeof t=="object"?[Object.keys(t)]:[null];case"length":return typeof t=="string"?[t.length]:Array.isArray(t)?[t.length]:t&&typeof t=="object"?[Object.keys(t).length]:t===null?[0]:typeof t=="number"?[Math.abs(t)]:[null];case"utf8bytelength":{if(typeof t=="string")return[new TextEncoder().encode(t).length];let o=t===null?"null":Array.isArray(t)?"array":typeof t,u=o==="array"||o==="object"?JSON.stringify(t):String(t);throw new Error(`${o} (${u}) only strings have UTF-8 byte length`)}case"to_entries":{let o=E(t);return o?[Object.entries(o).map(([u,c])=>({key:u,value:c}))]:[null]}case"from_entries":if(Array.isArray(t)){let o=Object.create(null);for(let u of t){let c=E(u);if(c){let s=c.key??c.Key??c.name??c.Name??c.k,f=c.value??c.Value??c.v;if(s!==void 0){let i=String(s);g(i)&&A(o,i,f)}}}return[o]}return[null];case"with_entries":{if(e.length===0)return[t];let o=E(t);if(o){let c=Object.entries(o).map(([f,i])=>({key:f,value:i})).flatMap(f=>p(f,e[0],n)),s=Object.create(null);for(let f of c){let i=E(f);if(i){let h=i.key??i.name??i.k,a=i.value??i.v;if(h!==void 0){let y=String(h);g(y)&&A(s,y,a)}}}return[s]}return[null]}case"reverse":return Array.isArray(t)?[[...t].reverse()]:typeof t=="string"?[t.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(t)?(e.length>0?p(t,e[0],n):[Number.POSITIVE_INFINITY]).map(u=>{let c=u;if(c<0)throw new Error("flatten depth must not be negative");return t.flat(c)}):[null];case"unique":if(Array.isArray(t)){let o=new Set,u=[];for(let c of t){let s=JSON.stringify(c);o.has(s)||(o.add(s),u.push(c))}return[u]}return[null];case"tojson":case"tojsonstream":{let o=n.limits.maxDepth??Nt;return D(t,o+1)>o?[null]:[JSON.stringify(t)]}case"fromjson":{if(typeof t=="string"){let o=t.trim().toLowerCase();if(o==="nan")return[Number.NaN];if(o==="inf"||o==="infinity")return[Number.POSITIVE_INFINITY];if(o==="-inf"||o==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[at(JSON.parse(t))]}catch{throw new Error(`Invalid JSON: ${t}`)}}return[t]}case"tostring":return typeof t=="string"?[t]:[JSON.stringify(t)];case"tonumber":if(typeof t=="number")return[t];if(typeof t=="string"){let o=Number(t);if(Number.isNaN(o))throw new Error(`${JSON.stringify(t)} cannot be parsed as a number`);return[o]}throw new Error(`${typeof t} cannot be parsed as a number`);case"toboolean":{if(typeof t=="boolean")return[t];if(typeof t=="string"){if(t==="true")return[!0];if(t==="false")return[!1];throw new Error(`string (${JSON.stringify(t)}) cannot be parsed as a boolean`)}let o=t===null?"null":Array.isArray(t)?"array":typeof t,u=o==="array"||o==="object"?JSON.stringify(t):String(t);throw new Error(`${o} (${u}) cannot be parsed as a boolean`)}case"tostream":{let o=[],u=(c,s)=>{if(c===null||typeof c!="object")o.push([s,c]);else if(Array.isArray(c))if(c.length===0)o.push([s,[]]);else for(let f=0;fo&&u.push([f.slice(o)]);continue}if(s.length===2&&Array.isArray(s[0])){let f=s[0],i=s[1];f.length>o&&u.push([f.slice(o),i])}}return u}default:return null}}function it(t,r,e,n,p,o,u,c,s,f){switch(r){case"getpath":{if(e.length===0)return[null];let i=p(t,e[0],n),h=[];for(let a of i){let y=a,l=t;for(let m of y){if(l==null){l=null;break}if(Array.isArray(l)&&typeof m=="number")l=l[m];else if(typeof m=="string"){let b=E(l);if(!b||!Object.hasOwn(b,m)){l=null;break}l=b[m]}else{l=null;break}}h.push(l)}return h}case"setpath":{if(e.length<2)return[null];let h=p(t,e[0],n)[0],y=p(t,e[1],n)[0];return[u(t,h,y)]}case"delpaths":{if(e.length===0)return[t];let h=p(t,e[0],n)[0],a=t;for(let y of h.sort((l,m)=>m.length-l.length))a=c(a,y);return[a]}case"path":{if(e.length===0)return[[]];let i=[];return f(t,e[0],n,[],i),i}case"del":return e.length===0?[t]:[s(t,e[0],n)];case"pick":{if(e.length===0)return[null];let i=[];for(let a of e)f(t,a,n,[],i);let h=null;for(let a of i){for(let l of a)if(typeof l=="number"&&l<0)throw new Error("Out of bounds negative array index");let y=t;for(let l of a){if(y==null)break;if(Array.isArray(y)&&typeof l=="number")y=y[l];else if(typeof l=="string"){let m=E(y);if(!m||!Object.hasOwn(m,l)){y=null;break}y=m[l]}else{y=null;break}}h=u(h,a,y)}return[h]}case"paths":{let i=[],h=(a,y)=>{if(a&&typeof a=="object")if(Array.isArray(a))for(let l=0;l0?i.filter(a=>{let y=t;for(let m of a)if(Array.isArray(y)&&typeof m=="number")y=y[m];else if(typeof m=="string"){let b=E(y);if(!b||!Object.hasOwn(b,m))return!1;y=b[m]}else return!1;return p(y,e[0],n).some(o)}):i}case"leaf_paths":{let i=[],h=(a,y)=>{if(a===null||typeof a!="object")i.push(y);else if(Array.isArray(a))for(let l=0;lJSON.stringify(f)));for(let f of u)if(s.has(JSON.stringify(f)))return[!0];return[!1]}case"INDEX":{if(e.length===0)return[Object.create(null)];if(e.length===1){let s=p(t,e[0],n),f=Object.create(null);for(let i of s){let h=String(i);g(h)&&A(f,h,i)}return[f]}if(e.length===2){let s=p(t,e[0],n),f=Object.create(null);for(let i of s){let h=p(i,e[1],n);if(h.length>0){let a=String(h[0]);g(a)&&A(f,a,i)}}return[f]}let u=p(t,e[0],n),c=Object.create(null);for(let s of u){let f=p(s,e[1],n),i=p(s,e[2],n);if(f.length>0&&i.length>0){let h=String(f[0]);g(h)&&A(c,h,i[0])}}return[c]}case"JOIN":{if(e.length<2)return[null];let u=E(p(t,e[0],n)[0]);if(!u)return[null];if(!Array.isArray(t))return[null];let c=[];for(let s of t){let f=p(s,e[1],n),i=f.length>0?String(f[0]):"",h=T(u,i)?u[i]:null;c.push([s,h])}return[c]}default:return null}}function ft(t,r,e,n,p){switch(r){case"join":{if(!Array.isArray(t))return[null];let o=e.length>0?p(t,e[0],n):[""];for(let u of t)if(Array.isArray(u)||u!==null&&typeof u=="object")throw new Error("cannot join: contains arrays or objects");return o.map(u=>t.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(String(u)))}case"split":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);return[t.split(u)]}case"splits":{if(typeof t!="string"||e.length===0)return[];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"g";return R(u,c.includes("g")?c:`${c}g`).split(t)}catch{return[]}}case"scan":{if(typeof t!="string"||e.length===0)return[];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[...R(u,c.includes("g")?c:`${c}g`).matchAll(t)].map(i=>i.length>1?i.slice(1):i[0])}catch{return[]}}case"test":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[R(u,c).test(t)]}catch{return[!1]}}case"match":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=R(u,`${c}d`).exec(t);if(!f)return[];let i=f.indices;return[{offset:f.index,length:f[0].length,string:f[0],captures:f.slice(1).map((h,a)=>({offset:i?.[a+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof t!="string"||e.length===0)return[null];let o=p(t,e[0],n),u=String(o[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=R(u,c).match(t);return!f||!f.groups?[Object.create(null)]:[f.groups]}catch{return[null]}}case"sub":{if(typeof t!="string"||e.length<2)return[null];let o=p(t,e[0],n),u=p(t,e[1],n),c=String(o[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"";return[R(c,f).replace(t,s)]}catch{return[t]}}case"gsub":{if(typeof t!="string"||e.length<2)return[null];let o=p(t,e[0],n),u=p(t,e[1],n),c=String(o[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"g",i=f.includes("g")?f:`${f}g`;return[R(c,i).replace(t,s)]}catch{return[t]}}case"ascii_downcase":return typeof t=="string"?[t.replace(/[A-Z]/g,o=>String.fromCharCode(o.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof t=="string"?[t.replace(/[a-z]/g,o=>String.fromCharCode(o.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);return[t.startsWith(u)?t.slice(u.length):t]}case"rtrimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);return u===""?[t]:[t.endsWith(u)?t.slice(0,-u.length):t]}case"trimstr":{if(typeof t!="string"||e.length===0)return[t];let o=p(t,e[0],n),u=String(o[0]);if(u==="")return[t];let c=t;return c.startsWith(u)&&(c=c.slice(u.length)),c.endsWith(u)&&(c=c.slice(0,-u.length)),[c]}case"trim":if(typeof t=="string")return[t.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof t=="string")return[t.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof t=="string")return[t.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n);return[t.startsWith(String(o[0]))]}case"endswith":{if(typeof t!="string"||e.length===0)return[!1];let o=p(t,e[0],n);return[t.endsWith(String(o[0]))]}case"ascii":return typeof t=="string"&&t.length>0?[t.charCodeAt(0)]:[null];case"explode":return typeof t=="string"?[Array.from(t).map(o=>o.codePointAt(0))]:[null];case"implode":if(!Array.isArray(t))throw new Error("implode input must be an array");return[t.map(c=>{if(typeof c=="string")throw new Error(`string (${JSON.stringify(c)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof c!="number"||Number.isNaN(c))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let s=Math.trunc(c);return s<0||s>1114111||s>=55296&&s<=57343?String.fromCodePoint(65533):String.fromCodePoint(s)}).join("")];default:return null}}function ct(t,r){switch(r){case"type":return t===null?["null"]:Array.isArray(t)?["array"]:typeof t=="boolean"?["boolean"]:typeof t=="number"?["number"]:typeof t=="string"?["string"]:typeof t=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof t=="number"&&!Number.isFinite(t)];case"isnan":return[typeof t=="number"&&Number.isNaN(t)];case"isnormal":return[typeof t=="number"&&Number.isFinite(t)&&t!==0];case"isfinite":return[typeof t=="number"&&Number.isFinite(t)];case"numbers":return typeof t=="number"?[t]:[];case"strings":return typeof t=="string"?[t]:[];case"booleans":return typeof t=="boolean"?[t]:[];case"nulls":return t===null?[t]:[];case"arrays":return Array.isArray(t)?[t]:[];case"objects":return t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"iterables":return Array.isArray(t)||t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"scalars":return!Array.isArray(t)&&!(t&&typeof t=="object")?[t]:[];case"values":return t===null?[]:[t];case"not":return t===!1||t===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function K(t,r,e){if(r.length===0)return e;let[n,...p]=r;if(typeof n=="number"){if(t&&typeof t=="object"&&!Array.isArray(t))throw new Error("Cannot index object with number");if(n>536870911)throw new Error("Array index too large");if(n<0)throw new Error("Out of bounds negative array index");let f=Array.isArray(t)?[...t]:[];for(;f.length<=n;)f.push(null);return f[n]=K(f[n],p,e),f}if(Array.isArray(t))throw new Error("Cannot index array with string");if(!g(n))return t??Object.create(null);let o=E(t),u=o?O(o):Object.create(null),c=Object.hasOwn(u,n)?u[n]:void 0;return A(u,n,K(c,p,e)),u}function V(t,r){if(r.length===0)return null;if(r.length===1){let p=r[0];if(Array.isArray(t)&&typeof p=="number"){let o=[...t];return o.splice(p,1),o}if(t&&typeof t=="object"&&!Array.isArray(t)){let o=String(p);if(!g(o))return t;let u=O(t);return delete u[o],u}return t}let[e,...n]=r;if(Array.isArray(t)&&typeof e=="number"){let p=[...t];return p[e]=V(p[e],n),p}if(t&&typeof t=="object"&&!Array.isArray(t)){let p=String(e);if(!g(p))return t;let o=O(t);return Object.hasOwn(o,p)&&A(o,p,V(o[p],n)),o}return t}var P=class t extends Error{label;partialResults;constructor(r,e=[]){super(`break ${r}`),this.label=r,this.partialResults=e,this.name="BreakError"}withPrependedResults(r){return new t(this.label,[...r,...this.partialResults])}},H=class extends Error{value;constructor(r){super(typeof r=="string"?r:JSON.stringify(r)),this.value=r,this.name="JqError"}},St=1e4,bt=2e3,Ct=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function Tt(t){return{vars:new Map,limits:{maxIterations:t?.limits?.maxIterations??St,maxDepth:t?.limits?.maxDepth??bt},env:t?.env,coverage:t?.coverage,requireDefenseContext:t?.requireDefenseContext,defenseContextChecked:!1}}function q(t,r,e){let n=new Map(t.vars);return n.set(r,e),{vars:n,limits:t.limits,env:t.env,requireDefenseContext:t.requireDefenseContext,defenseContextChecked:t.defenseContextChecked,root:t.root,currentPath:t.currentPath,funcs:t.funcs,labels:t.labels,coverage:t.coverage}}function L(t,r,e){switch(r.type){case"var":return q(t,r.name,e);case"array":{if(!Array.isArray(e))return null;let n=t;for(let p=0;p0&&r.args[0].type==="Literal"){let n=r.args[0].value;typeof n=="number"&&(e=n)}if(e>=0)return t.slice(0,Math.max(0,t.length-e));{let n=-e-1;return t.slice(0,Math.min(n,t.length))}}if(r.name==="root")return[]}if(r.type==="Field"){let e=M(r);if(e!==null)return[...t,...e]}if(r.type==="Index"&&r.index.type==="Literal"){let e=M(r);if(e!==null)return[...t,...e]}if(r.type==="Pipe"){let e=pt(t,r.left);return e===null?null:pt(e,r.right)}return r.type==="Identity"?t:null}function mt(t,r,e){if(r.type==="Comma"){let n=[];try{n.push(...d(t,r.left,e))}catch(p){if(p instanceof B)throw p;if(n.length>0)return n;throw new Error("evaluation failed")}try{n.push(...d(t,r.right,e))}catch(p){if(p instanceof B)throw p;return n}return n}return d(t,r,e)}function d(t,r,e){let n=e&&"vars"in e?e:Tt(e);switch(n.defenseContextChecked||(yt(n.requireDefenseContext,"query-engine","evaluation"),n={...n,defenseContextChecked:!0}),n.root===void 0&&(n={...n,root:t,currentPath:[]}),n.coverage?.hit(`jq:node:${r.type}`),r.type){case"Identity":return[t];case"Field":return(r.base?d(t,r.base,n):[t]).flatMap(o=>{let u=E(o);if(u){if(!Object.hasOwn(u,r.name))return[null];let s=u[r.name];return[s===void 0?null:s]}if(o===null)return[null];let c=Array.isArray(o)?"array":typeof o;throw new Error(`Cannot index ${c} with string "${r.name}"`)});case"Index":return(r.base?d(t,r.base,n):[t]).flatMap(o=>d(o,r.index,n).flatMap(c=>{if(typeof c=="number"&&Array.isArray(o)){if(Number.isNaN(c))return[null];let s=Math.trunc(c),f=s<0?o.length+s:s;return f>=0&&f{if(o===null)return[null];if(!Array.isArray(o)&&typeof o!="string")throw new Error(`Cannot slice ${typeof o} (${JSON.stringify(o)})`);let u=o.length,c=r.start?d(t,r.start,n):[0],s=r.end?d(t,r.end,n):[u];return c.flatMap(f=>s.map(i=>{let h=f,a=i,y=Number.isNaN(h)?0:Number.isInteger(h)?h:Math.floor(h),l=Number.isNaN(a)?u:Number.isInteger(a)?a:Math.ceil(a),m=dt(y,u),b=dt(l,u);return Array.isArray(o),o.slice(m,b)}))});case"Iterate":return(r.base?d(t,r.base,n):[t]).flatMap(o=>Array.isArray(o)?o:o&&typeof o=="object"?Object.values(o):[]);case"Pipe":{let p=d(t,r.left,n),o=M(r.left),u=[];for(let c of p)try{if(o!==null){let s={...n,currentPath:[...n.currentPath??[],...o]};u.push(...d(c,r.right,s))}else u.push(...d(c,r.right,n))}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Comma":{let p=d(t,r.left,n),o=d(t,r.right,n);return[...p,...o]}case"Literal":return[r.value];case"Array":return r.elements?[d(t,r.elements,n)]:[[]];case"Object":{let p=[Object.create(null)];for(let o of r.entries){let u=typeof o.key=="string"?[o.key]:d(t,o.key,n),c=d(t,o.value,n),s=[];for(let f of p)for(let i of u){if(typeof i!="string"){let h=i===null?"null":Array.isArray(i)?"array":typeof i;throw new Error(`Cannot use ${h} (${JSON.stringify(i)}) as object key`)}if(!g(i)){for(let h of c)s.push(O(f));continue}for(let h of c){let a=O(f);A(a,i,h),s.push(a)}}p.length=0,p.push(...s)}return p}case"Paren":return d(t,r.expr,n);case"BinaryOp":return xt(t,r.op,r.left,r.right,n);case"UnaryOp":return d(t,r.operand,n).map(o=>{if(r.op==="-"){if(typeof o=="number")return-o;if(typeof o=="string"){let u=c=>c.length>5?`"${c.slice(0,3)}...`:JSON.stringify(c);throw new Error(`string (${u(o)}) cannot be negated`)}return null}return r.op==="not"?!S(o):null});case"Cond":return d(t,r.cond,n).flatMap(o=>{if(S(o))return d(t,r.then,n);for(let u of r.elifs)if(d(t,u.cond,n).some(S))return d(t,u.then,n);return r.else?d(t,r.else,n):[t]});case"Try":try{return d(t,r.body,n)}catch(p){if(r.catch){let o=p instanceof H?p.value:p instanceof Error?p.message:String(p);return d(o,r.catch,n)}return[]}case"Call":return gt(t,r.name,r.args,n);case"VarBind":return d(t,r.value,n).flatMap(o=>{let u=null,c=[];r.pattern?c.push(r.pattern):r.name&&c.push({type:"var",name:r.name}),r.alternatives&&c.push(...r.alternatives);for(let s of c)if(u=L(n,s,o),u!==null)break;return u===null?[]:d(t,r.body,u)});case"VarRef":{if(r.name==="$ENV")return[n.env?X(n.env):Object.create(null)];let p=n.vars.get(r.name);return p!==void 0?[p]:[null]}case"Recurse":{let p=[],o=new WeakSet,u=c=>{if(c&&typeof c=="object"){if(o.has(c))return;o.add(c)}if(p.push(c),Array.isArray(c))for(let s of c)u(s);else if(c&&typeof c=="object")for(let s of Object.keys(c))u(c[s])};return u(t),p}case"Optional":try{return d(t,r.expr,n)}catch{return[]}case"StringInterp":return[r.parts.map(o=>typeof o=="string"?o:d(t,o,n).map(c=>typeof c=="string"?c:JSON.stringify(c)).join("")).join("")];case"UpdateOp":return[Mt(t,r.path,r.op,r.value,n)];case"Reduce":{let p=d(t,r.expr,n),o=d(t,r.init,n)[0],u=n.limits.maxDepth??bt;for(let c of p){let s;if(r.pattern){if(s=L(n,r.pattern,c),s===null)continue}else s=q(n,r.varName,c);if(o=d(o,r.update,s)[0],D(o,u+1)>u)return[null]}return[o]}case"Foreach":{let p=d(t,r.expr,n),o=d(t,r.init,n)[0],u=[];for(let c of p)try{let s;if(r.pattern){if(s=L(n,r.pattern,c),s===null)continue}else s=q(n,r.varName,c);if(o=d(o,r.update,s)[0],r.extract){let f=d(o,r.extract,s);u.push(...f)}else u.push(o)}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Label":try{return d(t,r.body,{...n,labels:new Set([...n.labels??[],r.name])})}catch(p){if(p instanceof P&&p.label===r.name)return p.partialResults;throw p}case"Break":throw new P(r.name);case"Def":{let p=new Map(n.funcs??[]),o=`${r.name}/${r.params.length}`;p.set(o,{params:r.params,body:r.funcBody,closure:new Map(n.funcs??[])});let u={...n,funcs:p};return d(t,r.body,u)}default:{let p=r;throw new Error(`Unknown AST node type: ${p.type}`)}}}function dt(t,r){return t<0?Math.max(0,r+t):Math.min(t,r)}function Mt(t,r,e,n,p){function o(s,f){switch(e){case"=":return f;case"|=":return d(s,n,p)[0]??null;case"+=":return typeof s=="number"&&typeof f=="number"||typeof s=="string"&&typeof f=="string"?s+f:Array.isArray(s)&&Array.isArray(f)?[...s,...f]:s&&f&&typeof s=="object"&&typeof f=="object"?G(s,f):f;case"-=":return typeof s=="number"&&typeof f=="number"?s-f:s;case"*=":return typeof s=="number"&&typeof f=="number"?s*f:s;case"/=":return typeof s=="number"&&typeof f=="number"?s/f:s;case"%=":return typeof s=="number"&&typeof f=="number"?s%f:s;case"//=":return s===null||s===!1?f:s;default:return f}}function u(s,f,i){switch(f.type){case"Identity":return i(s);case"Field":{if(!g(f.name))return s;if(f.base)return u(s,f.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let a=O(h),y=Object.hasOwn(a,f.name)?a[f.name]:void 0;return A(a,f.name,i(y)),a}return h});if(s&&typeof s=="object"&&!Array.isArray(s)){let h=O(s),a=Object.hasOwn(h,f.name)?h[f.name]:void 0;return A(h,f.name,i(a)),h}return s}case"Index":{let a=d(t,f.index,p)[0];if(typeof a=="number"&&Number.isNaN(a))throw new Error("Cannot set array element at NaN index");if(typeof a=="number"&&!Number.isInteger(a)&&(a=Math.trunc(a)),f.base)return u(s,f.base,y=>{if(typeof a=="number"&&Array.isArray(y)){let l=[...y],m=a<0?l.length+a:a;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=i(l[m])}return l}if(typeof a=="string"&&y&&typeof y=="object"&&!Array.isArray(y)){if(!g(a))return y;let l=O(y),m=Object.hasOwn(l,a)?l[a]:void 0;return A(l,a,i(m)),l}return y});if(typeof a=="number"){if(a>536870911)throw new Error("Array index too large");if(a<0&&(!s||!Array.isArray(s)))throw new Error("Out of bounds negative array index");if(Array.isArray(s)){let l=[...s],m=a<0?l.length+a:a;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=i(l[m])}return l}if(s==null){let l=[];for(;l.length<=a;)l.push(null);return l[a]=i(null),l}return s}if(typeof a=="string"&&s&&typeof s=="object"&&!Array.isArray(s)){if(!g(a))return s;let y=O(s),l=Object.hasOwn(y,a)?y[a]:void 0;return A(y,a,i(l)),y}return s}case"Iterate":{let h=a=>{if(Array.isArray(a))return a.map(y=>i(y));if(a&&typeof a=="object"){let y=Object.create(null);for(let[l,m]of Object.entries(a))g(l)&&A(y,l,i(m));return y}return a};return f.base?u(s,f.base,h):h(s)}case"Pipe":{let h=u(s,f.left,a=>a);return u(h,f.right,i)}default:return i(s)}}return u(t,r,s=>{if(e==="|=")return o(s,s);let f=d(t,n,p);return o(s,f[0]??null)})}function jt(t,r,e){function n(o,u,c){switch(u.type){case"Identity":return c;case"Field":{if(!g(u.name))return o;if(u.base){let s=d(o,u.base,e)[0],f=n(s,{type:"Field",name:u.name},c);return n(o,u.base,f)}if(o&&typeof o=="object"&&!Array.isArray(o)){let s=O(o);return A(s,u.name,c),s}return o}case"Index":{if(u.base){let i=d(o,u.base,e)[0],h=n(i,{type:"Index",index:u.index},c);return n(o,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(o)){let i=[...o],h=f<0?i.length+f:f;return h>=0&&h=0&&h=0&&NS(s)?d(t,n,p).map(i=>S(i)):[!1]);if(r==="or")return d(t,e,p).flatMap(s=>S(s)?[!0]:d(t,n,p).map(i=>S(i)));if(r==="//"){let s=d(t,e,p).filter(f=>f!=null&&f!==!1);return s.length>0?s:d(t,n,p)}let o=d(t,e,p),u=d(t,n,p);return o.flatMap(c=>u.map(s=>{switch(r){case"+":return c===null?s:s===null?c:typeof c=="number"&&typeof s=="number"||typeof c=="string"&&typeof s=="string"?c+s:Array.isArray(c)&&Array.isArray(s)?[...c,...s]:c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?G(c,s):null;case"-":if(typeof c=="number"&&typeof s=="number")return c-s;if(Array.isArray(c)&&Array.isArray(s)){let f=new Set(s.map(i=>JSON.stringify(i)));return c.filter(i=>!f.has(JSON.stringify(i)))}if(typeof c=="string"&&typeof s=="string"){let f=i=>i.length>10?`"${i.slice(0,10)}...`:JSON.stringify(i);throw new Error(`string (${f(c)}) and string (${f(s)}) cannot be subtracted`)}return null;case"*":if(typeof c=="number"&&typeof s=="number")return c*s;if(typeof c=="string"&&typeof s=="number")return c.repeat(s);{let f=E(c),i=E(s);if(f&&i)return v(f,i)}return null;case"/":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided because the divisor is zero`);return c/s}return typeof c=="string"&&typeof s=="string"?c.split(s):null;case"%":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(c)&&!Number.isNaN(c)?!Number.isFinite(s)&&!Number.isNaN(s)&&c<0&&s>0?-1:0:c%s}return null;case"==":return I(c,s);case"!=":return!I(c,s);case"<":return U(c,s)<0;case"<=":return U(c,s)<=0;case">":return U(c,s)>0;case">=":return U(c,s)>=0;default:return null}}))}function gt(t,r,e,n){let p=Ct.get(r);if(p)return typeof t=="number"?[p(t)]:[null];let o=rt(t,r,e,n,d);if(o!==null)return o;let u=ft(t,r,e,n,d);if(u!==null)return u;let c=Z(t,r,e,n,d);if(c!==null)return c;let s=tt(t,r,n.limits.maxDepth);if(s!==null)return s;let f=ct(t,r);if(f!==null)return f;let i=st(t,r,e,n,d);if(i!==null)return i;let h=W(t,r,e,n,d,mt,$,S,F,B);if(h!==null)return h;let a=it(t,r,e,n,d,S,K,V,jt,J);if(a!==null)return a;let y=et(t,r,e,n,d,I);if(y!==null)return y;let l=z(t,r,e,n,d,mt,S,B);if(l!==null)return l;let m=nt(t,r,e,n,d,S,Rt,gt);if(m!==null)return m;let b=ot(t,r,e,n,d,I);if(b!==null)return b;switch(r){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let w=e.length>0?d(t,e[0],n)[0]:t;throw new H(w)}case"env":return[n.env?X(n.env):Object.create(null)];case"debug":return[t];case"input_line_number":return[1];default:{let w=`${r}/${e.length}`,k=n.funcs?.get(w);if(k){let N=k.closure??n.funcs??new Map,C=new Map(N);C.set(w,k);for(let _=0;_=0;Q--)x={type:"Comma",left:{type:"Literal",value:j[Q]},right:x}}C.set(`${kt}/0`,{params:[],body:x})}}let wt={...n,funcs:C};return d(t,k.body,wt)}throw new Error(`Unknown function: ${r}`)}}}function J(t,r,e,n,p){if(r.type==="Comma"){let c=r;J(t,c.left,e,n,p),J(t,c.right,e,n,p);return}let o=M(r);if(o!==null){p.push([...n,...o]);return}if(r.type==="Iterate"){if(Array.isArray(t))for(let c=0;c{if(p.push([...n,...f]),s&&typeof s=="object")if(Array.isArray(s))for(let i=0;i0&&p.push(n)}var At=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),Y=new Set(At.values());function Et(t){let r=[],e=0,n=(f=0)=>t[e+f],p=()=>t[e++],o=()=>e>=t.length,u=f=>f>="0"&&f<="9",c=f=>f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_",s=f=>c(f)||u(f);for(;!o();){let f=e,i=p();if(!(i===" "||i===" "||i===` +`||i==="\r")){if(i==="#"){for(;!o()&&n()!==` +`;)p();continue}if(i==="."&&n()==="."){p(),r.push({type:"DOTDOT",pos:f});continue}if(i==="="&&n()==="="){p(),r.push({type:"EQ",pos:f});continue}if(i==="!"&&n()==="="){p(),r.push({type:"NE",pos:f});continue}if(i==="<"&&n()==="="){p(),r.push({type:"LE",pos:f});continue}if(i===">"&&n()==="="){p(),r.push({type:"GE",pos:f});continue}if(i==="/"&&n()==="/"){p(),n()==="="?(p(),r.push({type:"UPDATE_ALT",pos:f})):r.push({type:"ALT",pos:f});continue}if(i==="+"&&n()==="="){p(),r.push({type:"UPDATE_ADD",pos:f});continue}if(i==="-"&&n()==="="){p(),r.push({type:"UPDATE_SUB",pos:f});continue}if(i==="*"&&n()==="="){p(),r.push({type:"UPDATE_MUL",pos:f});continue}if(i==="/"&&n()==="="){p(),r.push({type:"UPDATE_DIV",pos:f});continue}if(i==="%"&&n()==="="){p(),r.push({type:"UPDATE_MOD",pos:f});continue}if(i==="="&&n()!=="="){r.push({type:"ASSIGN",pos:f});continue}if(i==="."){r.push({type:"DOT",pos:f});continue}if(i==="|"){n()==="="?(p(),r.push({type:"UPDATE_PIPE",pos:f})):r.push({type:"PIPE",pos:f});continue}if(i===","){r.push({type:"COMMA",pos:f});continue}if(i===":"){r.push({type:"COLON",pos:f});continue}if(i===";"){r.push({type:"SEMICOLON",pos:f});continue}if(i==="("){r.push({type:"LPAREN",pos:f});continue}if(i===")"){r.push({type:"RPAREN",pos:f});continue}if(i==="["){r.push({type:"LBRACKET",pos:f});continue}if(i==="]"){r.push({type:"RBRACKET",pos:f});continue}if(i==="{"){r.push({type:"LBRACE",pos:f});continue}if(i==="}"){r.push({type:"RBRACE",pos:f});continue}if(i==="?"){r.push({type:"QUESTION",pos:f});continue}if(i==="+"){r.push({type:"PLUS",pos:f});continue}if(i==="-"){r.push({type:"MINUS",pos:f});continue}if(i==="*"){r.push({type:"STAR",pos:f});continue}if(i==="/"){r.push({type:"SLASH",pos:f});continue}if(i==="%"){r.push({type:"PERCENT",pos:f});continue}if(i==="<"){r.push({type:"LT",pos:f});continue}if(i===">"){r.push({type:"GT",pos:f});continue}if(u(i)){let h=i;for(;!o()&&(u(n())||n()==="."||n()==="e"||n()==="E");)(n()==="e"||n()==="E")&&(t[e+1]==="+"||t[e+1]==="-")&&(h+=p()),h+=p();r.push({type:"NUMBER",value:Number(h),pos:f});continue}if(i==='"'){let h="";for(;!o()&&n()!=='"';)if(n()==="\\"){if(p(),o())break;let a=p();switch(a){case"n":h+=` +`;break;case"r":h+="\r";break;case"t":h+=" ";break;case"\\":h+="\\";break;case'"':h+='"';break;case"(":h+="\\(";break;default:h+=a}}else h+=p();o()||p(),r.push({type:"STRING",value:h,pos:f});continue}if(c(i)||i==="$"||i==="@"){let h=i;for(;!o()&&s(n());)h+=p();let a=At.get(h);a?r.push({type:a,value:h,pos:f}):r.push({type:"IDENT",value:h,pos:f});continue}throw new Error(`Unexpected character '${i}' at position ${f}`)}}return r.push({type:"EOF",pos:e}),r}var ut=class t{tokens;pos=0;constructor(r){this.tokens=r}peek(r=0){return this.tokens[this.pos+r]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(r){return this.peek().type===r}match(...r){for(let e of r)if(this.check(e))return this.advance();return null}expect(r,e){if(!this.check(r))throw new Error(`${e} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(r=0){let e=this.peek(r),n=this.peek(r+1);return n.type==="STRING"?!0:n.type==="IDENT"||Y.has(n.type)?n.pos===e.pos+1:!1}isIdentLike(){let r=this.peek().type;return r==="IDENT"||Y.has(r)}consumeFieldNameAfterDot(r){let e=this.peek();return e.type==="STRING"?this.advance().value:(e.type==="IDENT"||Y.has(e.type))&&e.pos===r.pos+1?this.advance().value:null}parse(){let r=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return r}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match("LBRACKET")){let n=[];if(!this.check("RBRACKET"))for(n.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)n.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:n}}if(this.match("LBRACE")){let n=[];if(!this.check("RBRACE"))for(n.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)n.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:n}}let r=this.expect("IDENT","Expected variable name in pattern"),e=r.value;if(!e.startsWith("$"))throw new Error(`Variable name must start with $ at position ${r.pos}`);return{type:"var",name:e}}parsePatternField(){if(this.match("LPAREN")){let e=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let n=this.parsePattern();return{key:e,pattern:n}}let r=this.peek();if(r.type==="IDENT"||Y.has(r.type)){let e=r.value;if(e.startsWith("$")){if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e.slice(1),pattern:n,keyVar:e}}return{key:e.slice(1),pattern:{type:"var",name:e}}}if(this.advance(),this.match("COLON")){let n=this.parsePattern();return{key:e,pattern:n}}return{key:e,pattern:{type:"var",name:`$${e}`}}}throw new Error(`Expected field name in object pattern at position ${r.pos}`)}parsePipe(){let r=this.parseComma();for(;this.match("PIPE");){let e=this.parseComma();r={type:"Pipe",left:r,right:e}}return r}parseComma(){let r=this.parseVarBind();for(;this.match("COMMA");){let e=this.parseVarBind();r={type:"Comma",left:r,right:e}}return r}parseVarBind(){let r=this.parseUpdate();if(this.match("AS")){let e=this.parsePattern(),n=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),n.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let p=this.parseExpr();return e.type==="var"&&n.length===0?{type:"VarBind",name:e.name,value:r,body:p}:{type:"VarBind",name:e.type==="var"?e.name:"",value:r,body:p,pattern:e.type!=="var"?e:void 0,alternatives:n.length>0?n:void 0}}return r}peekAhead(r){let e=this.pos+r;return e"],["GE",">="]]),n=this.match("EQ","NE","LT","LE","GT","GE");if(n){let p=e.get(n.type);if(p){let o=this.parseAddSub();r={type:"BinaryOp",op:p,left:r,right:o}}}return r}parseAddSub(){let r=this.parseMulDiv();for(;;)if(this.match("PLUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"+",left:r,right:e}}else if(this.match("MINUS")){let e=this.parseMulDiv();r={type:"BinaryOp",op:"-",left:r,right:e}}else break;return r}parseMulDiv(){let r=this.parseUnary();for(;;)if(this.match("STAR")){let e=this.parseUnary();r={type:"BinaryOp",op:"*",left:r,right:e}}else if(this.match("SLASH")){let e=this.parseUnary();r={type:"BinaryOp",op:"/",left:r,right:e}}else if(this.match("PERCENT")){let e=this.parseUnary();r={type:"BinaryOp",op:"%",left:r,right:e}}else break;return r}parseUnary(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let r=this.parsePrimary();for(;;)if(this.match("QUESTION"))r={type:"Optional",expr:r};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),r={type:"Field",name:this.advance().value,base:r};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))r={type:"Iterate",base:r};else if(this.check("COLON")){this.advance();let e=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",end:e,base:r}}else{let e=this.parseExpr();if(this.match("COLON")){let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),r={type:"Slice",start:e,end:n,base:r}}else this.expect("RBRACKET","Expected ']'"),r={type:"Index",index:e,base:r}}else break;return r}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let r=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let p=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:p}}let n=this.parseExpr();if(this.match("COLON")){let p=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:n,end:p}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:n}}let e=this.consumeFieldNameAfterDot(r);return e!==null?{type:"Field",name:e}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let e=this.advance().value;return e.includes("\\(")?this.parseStringInterpolation(e):{type:"Literal",value:e}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let r=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:r}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let r=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:r}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let r=this.parsePostfix(),e;return this.match("CATCH")&&(e=this.parsePostfix()),{type:"Try",body:r,catch:e}}if(this.match("REDUCE")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let o=e.type==="var"?e.name:"";return{type:"Reduce",expr:r,varName:o,init:n,update:p,pattern:e.type!=="var"?e:void 0}}if(this.match("FOREACH")){let r=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let e=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let n=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let p=this.parseExpr(),o;this.match("SEMICOLON")&&(o=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let u=e.type==="var"?e.name:"";return{type:"Foreach",expr:r,varName:u,init:n,update:p,extract:o,pattern:e.type!=="var"?e:void 0}}if(this.match("LABEL")){let r=this.expect("IDENT","Expected label name (e.g., $out)"),e=r.value;if(!e.startsWith("$"))throw new Error(`Label name must start with $ at position ${r.pos}`);this.expect("PIPE","Expected '|' after label name");let n=this.parseExpr();return{type:"Label",name:e,body:n}}if(this.match("BREAK")){let r=this.expect("IDENT","Expected label name to break to"),e=r.value;if(!e.startsWith("$"))throw new Error(`Break label must start with $ at position ${r.pos}`);return{type:"Break",name:e}}if(this.match("DEF")){let e=this.expect("IDENT","Expected function name after def").value,n=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let u=this.expect("IDENT","Expected parameter name");for(n.push(u.value);this.match("SEMICOLON");){let c=this.expect("IDENT","Expected parameter name");n.push(c.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let p=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let o=this.parseExpr();return{type:"Def",name:e,params:n,funcBody:p,body:o}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let e=this.advance().value;if(e.startsWith("$"))return{type:"VarRef",name:e};if(this.match("LPAREN")){let n=[];if(!this.check("RPAREN"))for(n.push(this.parseExpr());this.match("SEMICOLON");)n.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:e,args:n}}return{type:"Call",name:e,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let r=[];if(!this.check("RBRACE"))do{let e,n;if(this.match("LPAREN"))e=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else if(this.isIdentLike()){let p=this.advance().value;this.match("COLON")?(e=p,n=this.parseObjectValue()):(e=p,n={type:"Field",name:p})}else if(this.check("STRING"))e=this.advance().value,this.expect("COLON","Expected ':'"),n=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);r.push({key:e,value:n})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:r}}parseObjectValue(){let r=this.parseVarBind();for(;this.match("PIPE");){let e=this.parseVarBind();r={type:"Pipe",left:r,right:e}}return r}parseIf(){let r=this.parseExpr();this.expect("THEN","Expected 'then'");let e=this.parseExpr(),n=[];for(;this.match("ELIF");){let o=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let u=this.parseExpr();n.push({cond:o,then:u})}let p;return this.match("ELSE")&&(p=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:r,then:e,elifs:n,else:p}}parseStringInterpolation(r){let e=[],n="",p=0;for(;p0;)r[p]==="("?o++:r[p]===")"&&o--,o>0&&(u+=r[p]),p++;let c=Et(u),s=new t(c);e.push(s.parse())}else n+=r[p],p++;return n&&e.push(n),{type:"StringInterp",parts:e}}};function Ne(t){let r=Et(t);return new ut(r).parse()}export{d as a,Ne as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-M65CQLJE.js b/packages/just-bash/dist/bin/chunks/chunk-M65CQLJE.js new file mode 100644 index 00000000..148c1b8b --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-M65CQLJE.js @@ -0,0 +1,101 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as U,b as z}from"./chunk-LNNWMRCB.js";import{a as I}from"./chunk-HL4ZS7TX.js";import{a as A}from"./chunk-IEXQTXU5.js";import{a as P}from"./chunk-VZK4FHWJ.js";import{k}from"./chunk-47WZ2U6M.js";import{a as L}from"./chunk-PBOVSFTJ.js";import{a as te,b as ne,c as W}from"./chunk-MUFNRCMY.js";var H=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function V(i){let e="",t=0,n=!1;for(;t=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var pe=1e4;function re(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],rangeStates:t||new Map,linesConsumedInCycle:0}}function me(i){return typeof i=="object"&&"first"in i&&"step"in i}function ge(i){return typeof i=="object"&&"offset"in i}function N(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(me(i)){let{first:a,step:r}=i;return r===0?e===a:(e-a)%r===0&&e>=a}if(typeof i=="object"&&"pattern"in i)try{let a=i.pattern;a===""&&s?.lastPattern?a=s.lastPattern:a!==""&&s&&(s.lastPattern=a);let r=X(V(a));return A(r).test(n)}catch{return!1}return!1}function G(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function be(i,e,t,n,s,a){if(!i||!i.start&&!i.end)return!0;let r=i.start,l=i.end;if(r!==void 0&&l===void 0)return N(r,e,t,n,a);if(r!==void 0&&l!==void 0){let c=typeof r=="object"&&"pattern"in r,f=typeof l=="object"&&"pattern"in l,p=ge(l);if(p&&s){let g=G(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active){let E=d.startLine||e;return e>=E+l.offset&&(d.active=!1,s.set(g,d)),!0}else return N(r,e,t,n,a)?(d.active=!0,d.startLine=e,s.set(g,d),l.offset===0&&(d.active=!1,s.set(g,d)),!0):!1}if(!c&&!f&&!p){let g=typeof r=="number"?r:r==="$"?t:1,d=typeof l=="number"?l:t;if(g<=d)return e>=g&&e<=d;if(s){let E=G(i),u=s.get(E);return u||(u={active:!1},s.set(E,u)),!u.completed&&e>=g?(u.completed=!0,s.set(E,u),!0):!1}return!1}if(s){let g=G(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active)return N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0;{if(d.completed)return!1;let E=!1;return typeof r=="number"?E=e>=r:E=N(r,e,t,n,a),E?(d.active=!0,d.startLine=e,s.set(g,d),N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0):!1}}return N(r,e,t,n,a)}return!0}function w(i,e,t,n,s,a){let r=be(i,e,t,n,s,a);return i?.negated?!r:r}function Ee(i,e,t,n){let s="",a=0,r=!1;for(;a<=i.length;){e.lastIndex=a;let l=e.exec(i);if(!l){s+=i.slice(a);break}if(l.index!==a){s+=i.slice(a,l.index),a=l.index,r=!1;continue}let c=l[0],f=l.slice(1);if(r&&c.length===0){if(a=1&&r<=9){n+=t[r-1]||"",s+=2;continue}n+=a,s+=2;continue}if(i[s]==="&"){n+=e,s++;continue}n+=i[s],s++}return n}function se(i,e,t){if(e>0&&i.length>e)throw new k(`sed: ${t} size limit exceeded (${e} bytes)`,"string_length")}function ve(i,e,t){let{lineNumber:n,totalLines:s,patternSpace:a}=e;if(i.type==="label"){e.coverage?.hit(`sed:cmd:${i.type}`);return}if(w(i.address,n,s,a,e.rangeStates,e))switch(e.coverage?.hit(`sed:cmd:${i.type}`),i.type){case"substitute":{let r=i,l="";r.global&&(l+="g"),r.ignoreCase&&(l+="i");let c=r.pattern;c===""&&e.lastPattern?c=e.lastPattern:c!==""&&(e.lastPattern=c);let f=X(r.extendedRegex?c:V(c));try{let p=A(f,l),x=p.test(e.patternSpace);if(p.lastIndex=0,x){if(e.substitutionMade=!0,r.nthOccurrence&&r.nthOccurrence>0&&!r.global){let g=0,d=r.nthOccurrence,E=A(f,`g${r.ignoreCase?"i":""}`);e.patternSpace=E.replace(e.patternSpace,(u,...h)=>{if(g++,g===d){let b=h.slice(0,-2);return j(r.replacement,u,b)}return u})}else if(r.global){let g=A(f,`g${r.ignoreCase?"i":""}`);e.patternSpace=Ee(e.patternSpace,g,r.replacement,(d,E)=>j(r.replacement,d,E))}else e.patternSpace=p.replace(e.patternSpace,(g,...d)=>{let E=d.slice(0,-2);return j(r.replacement,g,E)});r.printOnMatch&&e.lineNumberOutput.push(e.patternSpace)}}catch{}break}case"print":e.lineNumberOutput.push(e.patternSpace);break;case"printFirstLine":{let r=e.patternSpace.indexOf(` +`);r!==-1?e.lineNumberOutput.push(e.patternSpace.slice(0,r)):e.lineNumberOutput.push(e.patternSpace);break}case"delete":e.deleted=!0;break;case"deleteFirstLine":{let r=e.patternSpace.indexOf(` +`);r!==-1?(e.patternSpace=e.patternSpace.slice(r+1),e.restartCycle=!0,e.inDRestartedCycle=!0):e.deleted=!0;break}case"zap":e.patternSpace="";break;case"append":e.appendBuffer.push(i.text);break;case"insert":e.appendBuffer.unshift(`__INSERT__${i.text}`);break;case"change":e.deleted=!0,e.changedText=i.text;break;case"hold":e.holdSpace=e.patternSpace;break;case"holdAppend":e.holdSpace?e.holdSpace+=` +${e.patternSpace}`:e.holdSpace=e.patternSpace,se(e.holdSpace,t?.maxStringLength??0,"hold space");break;case"get":e.patternSpace=e.holdSpace;break;case"getAppend":e.patternSpace+=` +${e.holdSpace}`,se(e.patternSpace,t?.maxStringLength??0,"pattern space");break;case"exchange":{let r=e.patternSpace;e.patternSpace=e.holdSpace,e.holdSpace=r;break}case"next":e.printed=!0;break;case"quit":e.quit=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"quitSilent":e.quit=!0,e.quitSilent=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"list":{let r=ie(e.patternSpace);e.lineNumberOutput.push(r);break}case"printFilename":e.currentFilename&&e.lineNumberOutput.push(e.currentFilename);break;case"version":{let r=[4,8,0];if(i.minVersion){let l=i.minVersion.split("."),c=[],f=!1;for(let p of l){let x=parseInt(p,10);if(Number.isNaN(x)||x<0){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: invalid version string: ${i.minVersion}`,f=!0;break}c.push(x)}if(!f){for(;c.length<3;)c.push(0);for(let p=0;p<3;p++){if(c[p]>r[p]){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: this is not GNU sed version ${i.minVersion}`;break}if(c[p]a)throw new k(`sed: command execution exceeded maximum iterations (${a})`,"iterations");if(e.deleted||e.quit||e.quitSilent||e.restartCycle)break;let c=i[l];if(c.type==="next"){if(w(c.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.coverage?.hit("sed:cmd:next"),e.nCommandOutput.push(e.patternSpace),t&&t.currentLineIndex+e.linesConsumedInCycle+1=this.input.length)return null;let e=this.line,t=this.column,n=this.peek();return n===` +`?(this.advance(),{type:o.NEWLINE,value:` +`,line:e,column:t}):n===";"?(this.advance(),{type:o.SEMICOLON,value:";",line:e,column:t}):n==="{"?(this.advance(),{type:o.LBRACE,value:"{",line:e,column:t}):n==="}"?(this.advance(),{type:o.RBRACE,value:"}",line:e,column:t}):n===","?(this.advance(),{type:o.COMMA,value:",",line:e,column:t}):n==="!"?(this.advance(),{type:o.NEGATION,value:"!",line:e,column:t}):n==="$"?(this.advance(),{type:o.DOLLAR,value:"$",line:e,column:t}):this.isDigit(n)?this.readNumber():n==="+"&&this.isDigit(this.input[this.pos+1]||"")?this.readRelativeOffset():n==="/"?this.readPattern():n===":"?this.readLabelDef():this.readCommand()}readNumber(){let e=this.line,t=this.column,n="";for(;this.isDigit(this.peek());)n+=this.advance();if(this.peek()==="~"){this.advance();let s="";for(;this.isDigit(this.peek());)s+=this.advance();let a=parseInt(n,10),r=parseInt(s,10)||0;return{type:o.STEP,value:`${a}~${r}`,first:a,step:r,line:e,column:t}}return{type:o.NUMBER,value:parseInt(n,10),line:e,column:t}}readRelativeOffset(){let e=this.line,t=this.column;this.advance();let n="";for(;this.isDigit(this.peek());)n+=this.advance();let s=parseInt(n,10)||0;return{type:o.RELATIVE_OFFSET,value:`+${s}`,offset:s,line:e,column:t}}readPattern(){let e=this.line,t=this.column;this.advance();let n="",s=!1;for(;this.pos="0"&&e<="9"}};var K=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let n=new _(t);for(this.tokens=n.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let s=this.pos,a=this.parseCommand();if(a.error)return{commands:[],error:a.error};if(a.command&&e.push(a.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(o.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(o.NEWLINE)||this.check(o.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null};let n=this.peek();switch(n.type){case o.COMMAND:return this.parseSimpleCommand(n,t);case o.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case o.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case o.LABEL_DEF:return this.advance(),{command:{type:"label",name:n.label||""}};case o.BRANCH:return this.advance(),{command:{type:"branch",address:t,label:n.label}};case o.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:t,label:n.label}};case o.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:t,label:n.label}};case o.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case o.FILE_READ:return this.advance(),{command:{type:"readFile",address:t,filename:n.filename||""}};case o.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:t,filename:n.filename||""}};case o.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:t,filename:n.filename||""}};case o.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:t,filename:n.filename||""}};case o.EXECUTE:return this.advance(),{command:{type:"execute",address:t,command:n.command}};case o.VERSION:return this.advance(),{command:{type:"version",address:t,minVersion:n.label}};case o.LBRACE:return this.parseGroup(t);case o.RBRACE:return{command:null};case o.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case"p":return{command:{type:"print",address:t}};case"P":return{command:{type:"printFirstLine",address:t}};case"d":return{command:{type:"delete",address:t}};case"D":return{command:{type:"deleteFirstLine",address:t}};case"h":return{command:{type:"hold",address:t}};case"H":return{command:{type:"holdAppend",address:t}};case"g":return{command:{type:"get",address:t}};case"G":return{command:{type:"getAppend",address:t}};case"x":return{command:{type:"exchange",address:t}};case"n":return{command:{type:"next",address:t}};case"N":return{command:{type:"nextAppend",address:t}};case"q":return{command:{type:"quit",address:t}};case"Q":return{command:{type:"quitSilent",address:t}};case"z":return{command:{type:"zap",address:t}};case"=":return{command:{type:"lineNumber",address:t}};case"l":return{command:{type:"list",address:t}};case"F":return{command:{type:"printFilename",address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||"",s,a=n.match(/(\d+)/);return a&&(s=parseInt(a[1],10)),{command:{type:"substitute",address:t,pattern:e.pattern||"",replacement:e.replacement||"",global:n.includes("g"),ignoreCase:n.includes("i")||n.includes("I"),printOnMatch:n.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||"",s=e.dest||"";return n.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:t,source:n,dest:s}}}parseTextCommand(e,t){let n=e.value,s=e.text||"";switch(n){case"a":return{command:{type:"append",address:t,text:s}};case"i":return{command:{type:"insert",address:t,text:s}};case"c":return{command:{type:"change",address:t,text:s}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(o.RBRACE);){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let n=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&t.push(s.command),this.pos===n&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(o.RBRACE)?(this.advance(),{command:{type:"group",address:e,commands:t}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(o.COMMA))return{error:"expected context address"};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(o.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(o.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:"expected context address"};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case o.NUMBER:return this.advance(),e.value;case o.DOLLAR:return this.advance(),"$";case o.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case o.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case o.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:o.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===o.EOF}};function ae(i,e=!1){let t=!1,n=!1,s=[];for(let c=0;c0&&s[s.length-1].endsWith("\\")){let p=s[s.length-1];s[s.length-1]=`${p} +${f}`}else s.push(f)}let a=s.join(` +`),l=new K([a],e||n).parse();if(!l.error&&l.commands.length>0){let c=xe(l.commands);if(c)return{commands:[],error:c,silentMode:t,extendedRegexMode:n}}return{...l,silentMode:t,extendedRegexMode:n}}function xe(i){let e=new Set;ce(i,e);let t=oe(i,e);if(t)return`undefined label '${t}'`}function ce(i,e){for(let t of i)t.type==="label"?e.add(t.name):t.type==="group"&&ce(t.commands,e)}function oe(i,e){for(let t of i){if((t.type==="branch"||t.type==="branchOnSubst"||t.type==="branchOnNoSubst")&&t.label&&!e.has(t.label))return t.label;if(t.type==="group"){let n=oe(t.commands,e);if(n)return n}}}var ke={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands: + s/regexp/replacement/[flags] substitute + d delete pattern space + p print pattern space + a\\ text append text after line + i\\ text insert text before line + c\\ text change (replace) line with text + h copy pattern space to hold space + H append pattern space to hold space + g copy hold space to pattern space + G append hold space to pattern space + x exchange pattern and hold spaces + n read next line into pattern space + N append next line to pattern space + y/source/dest/ transliterate characters + = print line number + l list pattern space (escape special chars) + b [label] branch to label + t [label] branch on substitution + T [label] branch if no substitution + :label define label + q quit + Q quit without printing + +Addresses: + N line number + $ last line + /regexp/ lines matching regexp + N,M range from line N to M + first~step every step-th line starting at first`};async function Q(i,e,t,n={}){let{limits:s,filename:a,fs:r,cwd:l,coverage:c,requireDefenseContext:f}=n;U(f,"sed","processing entry");let p=(R,m)=>z(f,"sed",R,m),x=i.endsWith(` +`),g=i.split(` +`);g.length>0&&g[g.length-1]===""&&g.pop();let d=g.length,E="",u,h=!1,b=s?.maxStringLength??0,v=R=>{if(E+=R,b>0&&E.length>b)throw new k(`sed: output size limit exceeded (${b} bytes)`,"string_length")},O="",J,le=new Map,T=new Map,B=new Map,D=new Map,ue=s?{maxIterations:s.maxSedIterations,maxStringLength:b}:void 0;for(let R=0;Rhe)break;if(m.restartCycle=!1,m.pendingFileReads=[],m.pendingFileWrites=[],Z(e,m,F,ue),r&&l){for(let C of m.pendingFileReads){let S=r.resolvePath(l,C.filename);try{if(C.wholeFile){let y=await p("read command file",()=>r.readFile(S));m.appendBuffer.push(y.replace(/\n$/,""))}else{if(!T.has(S)){let de=await p("read command file line cache",()=>r.readFile(S));T.set(S,de.split(` +`)),B.set(S,0)}let y=T.get(S),M=B.get(S);y&&M!==void 0&&M0;for(let C of m.lineNumberOutput)v(`${C} +`);let ee=[],q=[];for(let C of m.appendBuffer)C.startsWith("__INSERT__")?ee.push(C.slice(10)):q.push(C);for(let C of ee)v(`${C} +`);let $=!1;!m.deleted&&!m.quitSilent?t?m.printed&&(v(`${m.patternSpace} +`),$=!0):(v(`${m.patternSpace} +`),$=!0):m.changedText!==void 0&&(v(`${m.changedText} +`),$=!0);for(let C of q)v(`${C} +`);if(h=(fe||$)&&q.length===0,m.quit||m.quitSilent){if(m.exitCode!==void 0&&(u=m.exitCode),m.errorMessage)return{output:"",exitCode:u||1,errorMessage:m.errorMessage};break}}if(r&&l)for(let[R,m]of D)try{await p("flush pending file writes",()=>r.writeFile(R,m))}catch(F){if(F instanceof I)throw F}return!x&&h&&E.endsWith(` +`)&&(E=E.slice(0,-1)),{output:E,exitCode:u}}var Pe={name:"sed",async execute(i,e){U(e.requireDefenseContext,"sed","execution entry");let t=(u,h)=>z(e.requireDefenseContext,"sed",u,h);if(ne(i))return te(ke);let n=[],s=[],a=!1,r=!1,l=!1,c=[];for(let u=0;u1){for(let b of h.slice(1))if(b!=="n"&&b!=="e"&&b!=="f"&&b!=="i"&&b!=="E"&&b!=="r")return W("sed",`-${b}`);h.includes("n")&&(a=!0),h.includes("i")&&(r=!0),(h.includes("E")||h.includes("r"))&&(l=!0),h.includes("e")&&!h.includes("n")&&!h.includes("i")&&u+1e.fs.readFile(h));for(let v of b.split(` +`)){let O=v.trim();O&&!O.startsWith("#")&&n.push(O)}}catch(b){if(b instanceof I)throw b;return{stdout:"",stderr:`sed: couldn't open file ${u}: No such file or directory +`,exitCode:1}}}if(n.length===0)return{stdout:"",stderr:`sed: no script specified +`,exitCode:1};let{commands:f,error:p,silentMode:x}=ae(n,l);if(p)return{stdout:"",stderr:`sed: ${p} +`,exitCode:1};let g=!!(a||x);if(r){if(c.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument +`,exitCode:1};for(let u of c){if(u==="-")continue;let h=e.fs.resolvePath(e.cwd,u);try{let b=await t("in-place input read",()=>e.fs.readFile(h)),v=await t("in-place processing",()=>Q(b,f,g,{limits:e.limits,filename:u,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));if(v.errorMessage)return{stdout:"",stderr:`${v.errorMessage} +`,exitCode:v.exitCode??1};await t("in-place output write",()=>e.fs.writeFile(h,v.output))}catch(b){if(b instanceof I)throw b;return b instanceof k?{stdout:"",stderr:`sed: ${L(b.message)} +`,exitCode:k.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory +`,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let d="";if(c.length===0){d=P(e.stdin);try{let u=await t("stdin processing",()=>Q(d,f,g,{limits:e.limits,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage} +`:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof I)throw u;if(u instanceof k)return{stdout:"",stderr:`sed: ${L(u.message)} +`,exitCode:k.EXIT_CODE};throw u}}let E=!1;for(let u of c){let h;if(u==="-")E?h="":(h=P(e.stdin),E=!0);else{let b=e.fs.resolvePath(e.cwd,u);try{h=await t("input file read",()=>e.fs.readFile(b))}catch(v){if(v instanceof I)throw v;return v instanceof k?{stdout:"",stderr:`sed: ${L(v.message)} +`,exitCode:k.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory +`,exitCode:1}}}d.length>0&&h.length>0&&!d.endsWith(` +`)&&(d+=` +`),d+=h}try{let u=await t("final processing",()=>Q(d,f,g,{limits:e.limits,filename:c.length===1?c[0]:void 0,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage} +`:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof I)throw u;if(u instanceof k)return{stdout:"",stderr:`sed: ${L(u.message)} +`,exitCode:k.EXIT_CODE};throw u}}},We={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{Pe as a,We as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MAVV76T4.js b/packages/just-bash/dist/bin/chunks/chunk-MAVV76T4.js deleted file mode 100644 index aa99f5d4..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-MAVV76T4.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -var e={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},t={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},s={name:"true",flags:[]},r={name:"false",flags:[]};export{e as a,t as b,s as c,r as d}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MLUOPG3W.js b/packages/just-bash/dist/bin/chunks/chunk-MLUOPG3W.js new file mode 100644 index 00000000..5b5ee7a6 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-MLUOPG3W.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +var i=new Set(["__proto__","constructor","prototype"]),p=new Set([...i,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);function a(e,n){if(Array.isArray(e))throw new TypeError(`${n}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${n}: expected null-prototype object, got prototypal object`)}function u(e){return!i.has(e)}function l(e,n,o){a(e,"safeSet"),u(n)&&(e[n]=o)}function y(e,n){return a(e,"safeHasOwn"),Object.hasOwn(e,n)}function O(e){let n=new WeakMap,o=t=>{if(t===null||typeof t!="object"||t instanceof Date)return t;let f=n.get(t);if(f!==void 0)return f;if(Array.isArray(t)){let r=[];n.set(t,r);for(let c of t)r.push(o(c));return r}let s=Object.create(null);n.set(t,s);for(let r of Object.keys(t))s[r]=o(t[r]);return s};return o(e)}function _(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function x(e){return Object.assign(Object.create(null),e)}function S(e){return Object.assign(Object.create(null),e)}function b(...e){return Object.assign(Object.create(null),...e)}export{u as a,l as b,y as c,O as d,_ as e,x as f,S as g,b as h}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MNWK4UIM.js b/packages/just-bash/dist/bin/chunks/chunk-MNWK4UIM.js new file mode 100644 index 00000000..cc2a9cc4 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-MNWK4UIM.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as we,c as Oe}from"./chunk-LNVSXNT7.js";var xe=Oe((de,pe)=>{(function(oe,R){typeof define=="function"&&define.amd?define([],R):typeof pe=="object"&&typeof de<"u"?pe.exports=R():oe.Papa=R()})(de,function oe(){"use strict";var R=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof R<"u"?R:{}})();function _e(){var e=R.URL||R.webkitURL||null,t=oe.toString();return l.BLOB_URL||(l.BLOB_URL=e.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",t,")();"],{type:"text/javascript"})))}var Y=!R.document&&!!R.postMessage,ue=R.IS_PAPA_WORKER||!1,ae={},ge=0,l={};if(l.parse=Ce,l.unparse=Re,l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",` +`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!Y&&!!R.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=1024*1024*10,l.RemoteChunkSize=1024*1024*5,l.DefaultDelimiter=",",l.Parser=fe,l.ParserHandle=ce,l.NetworkStreamer=G,l.FileStreamer=ee,l.StringStreamer=Z,l.ReadableStreamStreamer=te,typeof PAPA_BROWSER_CONTEXT>"u"&&(l.DuplexStreamStreamer=re),R.jQuery){var V=R.jQuery;V.fn.parse=function(e){var t=e.config||{},r=[];return this.each(function(h){var i=V(this).prop("tagName").toUpperCase()==="INPUT"&&V(this).attr("type").toLowerCase()==="file"&&R.FileReader;if(!i||!this.files||this.files.length===0)return!0;for(var y=0;y"u")return n=new re(t),n.getStream();return typeof e=="string"?(e=p(e),t.download?n=new G(t):n=new Z(t)):e.readable===!0&&g(e.read)&&g(e.on)?n=new te(t):(R.File&&e instanceof File||e instanceof Object)&&(n=new ee(t)),n.stream(e);function p(h){return h.charCodeAt(0)===65279?h.slice(1):h}}function Re(e,t){var r=!1,s=!0,n=",",p=`\r +`,h='"',i=h+h,y=!1,E=null,O=!1;L();var d=new RegExp(se(h),"g");if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,y);if(typeof e[0]=="object")return u(E||Object.keys(e[0]),e,y)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||E),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),!Array.isArray(e.data[0])&&typeof e.data[0]!="object"&&(e.data=[e.data])),u(e.fields||[],e.data||[],y);throw new Error("Unable to serialize unrecognized input");function L(){if(typeof t=="object"){if(typeof t.delimiter=="string"&&!l.BAD_DELIMITERS.filter(function(v){return t.delimiter.indexOf(v)!==-1}).length&&(n=t.delimiter),(typeof t.quotes=="boolean"||typeof t.quotes=="function"||Array.isArray(t.quotes))&&(r=t.quotes),(typeof t.skipEmptyLines=="boolean"||typeof t.skipEmptyLines=="string")&&(y=t.skipEmptyLines),typeof t.newline=="string"&&(p=t.newline),typeof t.quoteChar=="string"&&(h=t.quoteChar),typeof t.header=="boolean"&&(s=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");E=t.columns}t.escapeChar!==void 0&&(i=t.escapeChar+h),t.escapeFormulae instanceof RegExp?O=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(O=/^[=+\-@\t\r].*$/)}}function u(v,k,S){var w="";typeof v=="string"&&(v=JSON.parse(v)),typeof k=="string"&&(k=JSON.parse(k));var M=Array.isArray(v)&&v.length>0,T=!Array.isArray(k[0]);if(M&&s){for(var q=0;q0&&(w+=n),w+=c(v[q],q);k.length>0&&(w+=p)}for(var _=0;_0&&!o&&(w+=n);var C=M&&T?v[a]:a;w+=c(k[_][C],a)}_0&&!o)&&(w+=p)}}return w}function c(v,k){if(typeof v>"u"||v===null)return"";if(v.constructor===Date)return JSON.stringify(v).slice(1,25);var S=!1;O&&typeof v=="string"&&O.test(v)&&(v="'"+v,S=!0);var w=v.toString().replace(d,i);return S=S||r===!0||typeof r=="function"&&r(v,k)||Array.isArray(r)&&r[k]||Q(w,l.BAD_DELIMITERS)||w.indexOf(n)>-1||w.charAt(0)===" "||w.charAt(w.length-1)===" ",S?h+w+h:w}function Q(v,k){for(var S=0;S-1)return!0;return!1}}function z(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},t.call(this,e),this.parseChunk=function(r,s){let n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&n>0){let O=this._config.newline;if(!O){let L=this._config.quoteChar||'"';O=this._handle.guessLineEndings(r,L)}r=[...r.split(O).slice(n)].join(O)}if(this.isFirstChunk&&g(this._config.beforeFirstChunk)){var p=this._config.beforeFirstChunk(r);p!==void 0&&(r=p)}this.isFirstChunk=!1,this._halted=!1;var h=this._partialLine+r;this._partialLine="";var i=this._handle.parse(h,this._baseIndex,!this._finished);if(this._handle.paused()||this._handle.aborted()){this._halted=!0;return}var y=i.meta.cursor;this._finished||(this._partialLine=h.substring(y-this._baseIndex),this._baseIndex=y),i&&i.data&&(this._rowCount+=i.data.length);var E=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(ue)R.postMessage({results:i,workerId:l.WORKER_ID,finished:E});else if(g(this._config.chunk)&&!s){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted()){this._halted=!0;return}i=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),!this._completed&&E&&g(this._config.complete)&&(!i||!i.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!E&&(!i||!i.meta.paused)&&this._nextChunk(),i},this._sendError=function(r){g(this._config.error)?this._config.error(r):ue&&this._config.error&&R.postMessage({workerId:l.WORKER_ID,error:r,finished:!1})};function t(r){var s=he(r);s.chunkSize=parseInt(s.chunkSize),!r.step&&!r.chunk&&(s.chunkSize=null),this._handle=new ce(s),this._handle.streamer=this,this._config=s}}function G(e){e=e||{},e.chunkSize||(e.chunkSize=l.RemoteChunkSize),z.call(this,e);var t;Y?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(s){this._input=s,this._nextChunk()},this._readChunk=function(){if(this._finished){this._chunkLoaded();return}if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),Y||(t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!Y),this._config.downloadRequestHeaders){var s=this._config.downloadRequestHeaders;for(var n in s)t.setRequestHeader(n,s[n])}if(this._config.chunkSize){var p=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+p)}try{t.send(this._config.downloadRequestBody)}catch(h){this._chunkError(h.message)}Y&&t.status===0&&this._chunkError()},this._chunkLoaded=function(){if(t.readyState===4){if(t.status<200||t.status>=400){this._chunkError();return}this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=r(t),this.parseChunk(t.responseText)}},this._chunkError=function(s){var n=t.statusText||s;this._sendError(new Error(n))};function r(s){var n=s.getResponseHeader("Content-Range");return n===null?-1:parseInt(n.substring(n.lastIndexOf("/")+1))}}G.prototype=Object.create(z.prototype),G.prototype.constructor=G;function ee(e){e=e||{},e.chunkSize||(e.chunkSize=l.LocalChunkSize),z.call(this,e);var t,r,s=typeof FileReader<"u";this.stream=function(n){this._input=n,r=n.slice||n.webkitSlice||n.mozSlice,s?(t=new FileReader,t.onload=F(this._chunkLoaded,this),t.onerror=F(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){!this._finished&&(!this._config.preview||this._rowCount=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(t.error)}}ee.prototype=Object.create(z.prototype),ee.prototype.constructor=ee;function Z(e){e=e||{},z.call(this,e);var t;this.stream=function(r){return t=r,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var r=this._config.chunkSize,s;return r?(s=t.substring(0,r),t=t.substring(r)):(s=t,t=""),this._finished=!t,this.parseChunk(s)}}}Z.prototype=Object.create(Z.prototype),Z.prototype.constructor=Z;function te(e){e=e||{},z.call(this,e);var t=[],r=!0,s=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=F(function(n){try{t.push(typeof n=="string"?n:n.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(p){this._streamError(p)}},this),this._streamError=F(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=F(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=F(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}te.prototype=Object.create(z.prototype),te.prototype.constructor=te;function re(e){var t=we("stream").Duplex,r=he(e),s=!0,n=!1,p=[],h=null;this._onCsvData=function(i){var y=i.data;!h.push(y)&&!this._handle.paused()&&this._handle.pause()},this._onCsvComplete=function(){h.push(null)},r.step=F(this._onCsvData,this),r.complete=F(this._onCsvComplete,this),z.call(this,r),this._nextChunk=function(){n&&p.length===1&&(this._finished=!0),p.length?p.shift()():s=!0},this._addToParseQueue=function(i,y){p.push(F(function(){if(this.parseChunk(typeof i=="string"?i:i.toString(r.encoding)),g(y))return y()},this)),s&&(s=!1,this._nextChunk())},this._onRead=function(){this._handle.paused()&&this._handle.resume()},this._onWrite=function(i,y,E){this._addToParseQueue(i,E)},this._onWriteComplete=function(){n=!0,this._addToParseQueue("")},this.getStream=function(){return h},h=new t({readableObjectMode:!0,decodeStrings:!1,read:F(this._onRead,this),write:F(this._onWrite,this)}),h.once("finish",F(this._onWriteComplete,this))}typeof PAPA_BROWSER_CONTEXT>"u"&&(re.prototype=Object.create(z.prototype),re.prototype.constructor=re);function ce(e){var t=Math.pow(2,53),r=-t,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,n=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,p=this,h=0,i=0,y,E,O=!1,d=!1,L,u=[],c={data:[],errors:[],meta:{}};if(g(e.step)){var Q=e.step;e.step=function(o){if(c=o,w())S();else{if(S(),c.data.length===0)return;h+=o.data.length,e.preview&&h>e.preview?E.abort():(c.data=c.data[0],Q(c,p))}}}this.parse=function(o,f,m){var b=e.quoteChar||'"';if(e.newline||(e.newline=this.guessLineEndings(o,b)),L=!1,e.delimiter)g(e.delimiter)&&(e.delimiter=e.delimiter(o),c.meta.delimiter=e.delimiter);else{var a=j(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);a.successful?e.delimiter=a.bestDelimiter:(L=!0,e.delimiter=l.DefaultDelimiter),c.meta.delimiter=e.delimiter}var C=he(e);return e.preview&&e.header&&C.preview++,y=o,E=new fe(C),c=E.parse(y,f,m),S(),O?{meta:{paused:!0}}:c||{meta:{paused:!1}}},this.paused=function(){return O},this.pause=function(){O=!0,E.abort(),y=g(e.chunk)?"":y.substring(E.getCharIndex())},this.resume=function(){p.streamer._halted?(O=!1,p.streamer.parseChunk(y,!0)):setTimeout(p.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,E.abort(),c.meta.aborted=!0,g(e.complete)&&e.complete(c),y=""},this.guessLineEndings=function(o,f){o=o.substring(0,1024*1024);var m=new RegExp(se(f)+"([^]*?)"+se(f),"gm");o=o.replace(m,"");var b=o.split("\r"),a=o.split(` +`),C=a.length>1&&a[0].length=b.length/2?`\r +`:"\r"};function v(o){return e.skipEmptyLines==="greedy"?o.join("").trim()==="":o.length===1&&o[0].length===0}function k(o){if(s.test(o)){var f=parseFloat(o);if(f>r&&f=u.length?"__parsed_extra":u[C]),e.transform&&(x=e.transform(x,A)),x=q(A,x),A==="__parsed_extra"?(a[A]=a[A]||[],a[A].push(x)):a[A]=x}return e.header&&(C>u.length?W("FieldMismatch","TooManyFields","Too many fields: expected "+u.length+" fields but parsed "+C,i+b):C"u"){x=P;continue}else P>0&&(X+=Math.abs(P-x),x=P)}H.data.length>0&&(K/=H.data.length-I),(typeof A>"u"||X<=A)&&(typeof J>"u"||K>J)&&K>1.99&&(A=X,C=ie,J=K)}return e.delimiter=C,{successful:!!C,bestDelimiter:C}}function W(o,f,m,b){var a={type:o,code:f,message:m};b!==void 0&&(a.row=b),c.errors.push(a)}}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e){e=e||{};var t=e.delimiter,r=e.newline,s=e.comments,n=e.step,p=e.preview,h=e.fastMode,i,y=null,E=!1;e.quoteChar===void 0||e.quoteChar===null?i='"':i=e.quoteChar;var O=i;if(e.escapeChar!==void 0&&(O=e.escapeChar),(typeof t!="string"||l.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),s===t)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||l.BAD_DELIMITERS.indexOf(s)>-1)&&(s=!1),r!==` +`&&r!=="\r"&&r!==`\r +`&&(r=` +`);var d=0,L=!1;this.parse=function(u,c,Q){if(typeof u!="string")throw new Error("Input must be a string");var v=u.length,k=t.length,S=r.length,w=s.length,M=g(n);d=0;var T=[],q=[],_=[],j=0;if(!u)return I();if(h||h!==!1&&u.indexOf(i)===-1){for(var W=u.split(r),o=0;o=p)return T=T.slice(0,p),I(!0)}}return I()}for(var f=u.indexOf(t,d),m=u.indexOf(r,d),b=new RegExp(se(O)+se(i),"g"),a=u.indexOf(i,d);;){if(u[d]===i){for(a=d,d++;;){if(a=u.indexOf(i,a+1),a===-1)return Q||q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:T.length,index:d}),X();if(a===v-1){var C=u.substring(d,a).replace(b,i);return X(C)}if(i===O&&u[a+1]===O){a++;continue}if(!(i!==O&&a!==0&&u[a-1]===O)){f!==-1&&f=p)return I(!0);break}q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:T.length,index:d}),a++}}continue}if(s&&_.length===0&&u.substring(d,d+w)===s){if(m===-1)return I();d=m+S,m=u.indexOf(r,d),f=u.indexOf(t,d);continue}if(f!==-1&&(f=p)return I(!0);continue}break}return X();function N(D){T.push(D),j=d}function ie(D){var P=0;if(D!==-1){var B=u.substring(a+1,D);B&&B.trim()===""&&(P=B.length)}return P}function X(D){return Q||(typeof D>"u"&&(D=u.substring(d)),_.push(D),d=v,N(_),M&&H()),I()}function K(D){d=D,N(_),_=[],m=u.indexOf(r,d)}function I(D){if(e.header&&!c&&T.length&&!E){let P=T[0],B=Object.create(null),le=new Set(P),ve=!1;for(let $=0;$"u"&&t&&(l.WORKER_ID=t.workerId),typeof t.input=="string")R.postMessage({workerId:l.WORKER_ID,results:l.parse(t.input,t.config),finished:!0});else if(R.File&&t.input instanceof File||t.input instanceof Object){var r=l.parse(t.input,t.config);r&&R.postMessage({workerId:l.WORKER_ID,results:r,finished:!0})}}function he(e){if(typeof e!="object"||e===null)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=he(e[r]);return t}function F(e,t){return function(){e.apply(t,arguments)}}function g(e){return typeof e=="function"}return l})});export{xe as a}; +/*! Bundled license information: + +papaparse/papaparse.js: + (* @license + Papa Parse + v5.5.3 + https://github.com/mholt/PapaParse + License: MIT + *) +*/ diff --git a/packages/just-bash/dist/bin/chunks/chunk-MO4RPBN2.js b/packages/just-bash/dist/bin/chunks/chunk-MO4RPBN2.js deleted file mode 100644 index f6349d16..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-MO4RPBN2.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a as s,b as i}from"./chunk-YU6OGPZR.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MROECM42.js b/packages/just-bash/dist/bin/chunks/chunk-MROECM42.js new file mode 100644 index 00000000..38e0493f --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-MROECM42.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +function r(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function n(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function c(...e){return Object.assign(Object.create(null),...e)}export{r as a,n as b,c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MRP4ZCD7.js b/packages/just-bash/dist/bin/chunks/chunk-MRP4ZCD7.js deleted file mode 100644 index 3d66fdba..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-MRP4ZCD7.js +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env node -import{a as f}from"./chunk-5WFYIUU2.js";import{a as d}from"./chunk-JBABAK44.js";import{a as m,b as p}from"./chunk-GTNBSMZR.js";var b={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},g={number:{short:"n",long:"number",type:"boolean"}},F={name:"cat",async execute(n,s){if(p(n))return m(b);let e=d("cat",n,g);if(!e.ok)return e.error;let r=e.result.flags.number,t=e.result.positional,a=await f(s,t,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",l=1;for(let{content:i}of a.files)if(r){let c=y(i,l);o+=c.content,l=c.nextLineNumber}else o+=i;let u=t.length>0&&t.some(i=>i!=="-");return{stdout:o,stderr:a.stderr,exitCode:a.exitCode,...u?{stdoutEncoding:"binary"}:{}}}};function y(n,s){let e=n.split(` -`),r=n.endsWith(` -`),t=r?e.slice(0,-1):e;return{content:t.map((o,l)=>`${String(s+l).padStart(6," ")} ${o}`).join(` -`)+(r?` -`:""),nextLineNumber:s+t.length}}var w={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0};export{F as a,w as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-MUFNRCMY.js b/packages/just-bash/dist/bin/chunks/chunk-MUFNRCMY.js new file mode 100644 index 00000000..99745911 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-MUFNRCMY.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +function s(t){let e=`${t.name} - ${t.summary} + +`;if(e+=`Usage: ${t.usage} +`,t.description){if(e+=` +Description: +`,typeof t.description=="string")for(let n of t.description.split(` +`))e+=n?` ${n} +`:` +`;else if(t.description.length>0)for(let n of t.description)e+=n?` ${n} +`:` +`}if(t.options&&t.options.length>0){e+=` +Options: +`;for(let n of t.options)e+=` ${n} +`}if(t.examples&&t.examples.length>0){e+=` +Examples: +`;for(let n of t.examples)e+=` ${n} +`}if(t.notes&&t.notes.length>0){e+=` +Notes: +`;for(let n of t.notes)e+=` ${n} +`}return{stdout:e,stderr:"",exitCode:0}}function o(t){return t.includes("--help")}function r(t,e){return{stdout:"",stderr:e.startsWith("--")?`${t}: unrecognized option '${e}' +`:`${t}: invalid option -- '${e.replace(/^-/,"")}' +`,exitCode:1}}export{s as a,o as b,r as c}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-N43DJTSI.js b/packages/just-bash/dist/bin/chunks/chunk-N43DJTSI.js deleted file mode 100644 index a7703cc4..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-N43DJTSI.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import{a as s}from"./chunk-OBI37ZY4.js";var a=s("sha256sum","sha256","compute SHA256 message digest"),m={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0};export{a,m as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-N6YW4W3Z.js b/packages/just-bash/dist/bin/chunks/chunk-N6YW4W3Z.js new file mode 100644 index 00000000..20e9a3e7 --- /dev/null +++ b/packages/just-bash/dist/bin/chunks/chunk-N6YW4W3Z.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +import{createRequire} from"node:module";const require=createRequire(import.meta.url); +import{a as I}from"./chunk-NE4R2FVV.js";import{a as K,b as V}from"./chunk-MUFNRCMY.js";var B=(i,t,e)=>{let s=i instanceof RegExp?Y(i,e):i,n=t instanceof RegExp?Y(t,e):t,r=s!==null&&n!=null&&Et(s,n,e);return r&&{start:r[0],end:r[1],pre:e.slice(0,r[0]),body:e.slice(r[0]+s.length,r[1]),post:e.slice(r[1]+n.length)}},Y=(i,t)=>{let e=t.match(i);return e?e[0]:null},Et=(i,t,e)=>{let s,n,r,o,l,h=e.indexOf(i),c=e.indexOf(t,h+1),g=h;if(h>=0&&c>0){if(i===t)return[h,c];for(s=[],r=e.length;g>=0&&!l;){if(g===h)s.push(g),h=e.indexOf(i,g+1);else if(s.length===1){let a=s.pop();a!==void 0&&(l=[a,c])}else n=s.pop(),n!==void 0&&n=0?h:c}s.length&&o!==void 0&&(l=[r,o])}return l};var Q="\0SLASH"+Math.random()+"\0",tt="\0OPEN"+Math.random()+"\0",q="\0CLOSE"+Math.random()+"\0",et="\0COMMA"+Math.random()+"\0",st="\0PERIOD"+Math.random()+"\0",Mt=new RegExp(Q,"g"),At=new RegExp(tt,"g"),Pt=new RegExp(q,"g"),Tt=new RegExp(et,"g"),Nt=new RegExp(st,"g"),Rt=/\\\\/g,vt=/\\{/g,Ot=/\\}/g,zt=/\\,/g,Ct=/\\\./g,Wt=1e5;function H(i){return isNaN(i)?i.charCodeAt(0):parseInt(i,10)}function Dt(i){return i.replace(Rt,Q).replace(vt,tt).replace(Ot,q).replace(zt,et).replace(Ct,st)}function jt(i){return i.replace(Mt,"\\").replace(At,"{").replace(Pt,"}").replace(Tt,",").replace(Nt,".")}function nt(i){if(!i)return[""];let t=[],e=B("{","}",i);if(!e)return i.split(",");let{pre:s,body:n,post:r}=e,o=s.split(",");o[o.length-1]+="{"+n+"}";let l=nt(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),t.push.apply(t,o),t}function it(i,t={}){if(!i)return[];let{max:e=Wt}=t;return i.slice(0,2)==="{}"&&(i="\\{\\}"+i.slice(2)),j(Dt(i),e,!0).map(jt)}function Lt(i){return"{"+i+"}"}function kt(i){return/^-?0\d/.test(i)}function _t(i,t){return i<=t}function Gt(i,t){return i>=t}function j(i,t,e){let s=[],n=B("{","}",i);if(!n)return[i];let r=n.pre,o=n.post.length?j(n.post,t,!1):[""];if(/\$$/.test(n.pre))for(let l=0;l=0;if(!c&&!g)return n.post.match(/,(?!,).*\}/)?(i=n.pre+"{"+n.body+q+n.post,j(i,t,!0)):[i];let a;if(c)a=n.body.split(/\.\./);else if(a=nt(n.body),a.length===1&&a[0]!==void 0&&(a=j(a[0],t,!1).map(Lt),a.length===1))return o.map(u=>n.pre+a[0]+u);let p;if(c&&a[0]!==void 0&&a[1]!==void 0){let u=H(a[0]),d=H(a[1]),f=Math.max(a[0].length,a[1].length),$=a.length===3&&a[2]!==void 0?Math.max(Math.abs(H(a[2])),1):1,S=_t;d0){let x=new Array(E+1).join("0");y<0?w="-"+x+w.slice(1):w=x+w}}p.push(w)}}else{p=[];for(let u=0;u{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Ft={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},k=i=>i.replace(/[[\]\\-]/g,"\\$&"),Bt=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rt=i=>i.join(""),ot=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],n=[],r=e+1,o=!1,l=!1,h=!1,c=!1,g=e,a="";t:for(;ra?s.push(k(a)+"-"+k(f)):f===a&&s.push(k(f)),a="",r++;continue}if(i.startsWith("-]",r+1)){s.push(k(f+"-")),r+=2;continue}if(i.startsWith("-",r+1)){a=f,r+=2;continue}s.push(k(f)),r++}if(ge?t?i.replace(/\[([^/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?i.replace(/\[([^/\\{}])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var T,Ht=new Set(["!","?","+","*","@"]),J=i=>Ht.has(i),at=i=>J(i.type),qt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Jt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ut=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),lt=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Zt="(?!(?:^|/)\\.\\.?(?:$|/))",_="(?!\\.)",Xt=new Set(["[","."]),Kt=new Set(["..","."]),Vt=new Set("().*{}+?[]^$\\!"),It=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),U="[^/]",ct=U+"*?",ht=U+"+?",Yt=0,z=class{type;#s;#n;#i=!1;#t=[];#e;#a;#c;#l=!1;#r;#o;#h=!1;id=++Yt;get depth(){return(this.#e?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#s.id,parent:this.#e?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#r=this.#s===this?s:this.#s.#r,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#l&&this.#c.push(this),this.#a=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#y(){if(this!==this.#s)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let n=e.#a+1;!s.type&&ntypeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#l&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#a===0)return!0;let t=this.#e;for(let e=0;etypeof u!="string"),c=this.#t.map(u=>{let[d,f,$,S]=typeof u=="string"?T.#E(u,this.#n,h):u.toRegExpSource(t);return this.#n=this.#n||$,this.#i=this.#i||S,d}).join(""),g="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Kt.has(this.#t[0]))){let d=Xt,f=e&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),$=!e&&!t&&d.has(c.charAt(0));g=f?Zt:$?_:""}let a="";return this.isEnd()&&this.#s.#l&&this.#e?.type==="!"&&(a="(?:$|\\/)"),[g+c+a,v(c),this.#n=!!this.#n,this.#i]}let s=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let h=this.toString(),c=this;return c.#t=[h],c.type=null,c.#n=void 0,[h,v(this.toString()),!1,!1]}let o=!s||t||e||!_?"":this.#m(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let l="";if(this.type==="!"&&this.#h)l=(this.isStart()&&!e?_:"")+ht;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?_:"")+ct+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;l=n+r+h}return[l,v(r),this.#n=!!this.#n,this.#i]}#p(){if(at(this)){let t=0,e=!1;do{e=!0;for(let s=0;s{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,n,r,o]=e.toRegExpSource(t);return this.#i=this.#i||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#E(t,e,s=!1){let n=!1,r="",o=!1,l=!1;for(let h=0;he?t?i.replace(/[?*()[\]{}]/g,"[$&]"):i.replace(/[?*()[\]\\{}]/g,"\\$&"):t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var M=(i,t,e={})=>(L(t),!e.nocomment&&t.charAt(0)==="#"?!1:new D(t,e).match(i)),Qt=/^\*+([^+@!?*[(]*)$/,te=i=>t=>!t.startsWith(".")&&t.endsWith(i),ee=i=>t=>t.endsWith(i),se=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),ne=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),ie=/^\*+\.\*+$/,re=i=>!i.startsWith(".")&&i.includes("."),oe=i=>i!=="."&&i!==".."&&i.includes("."),ae=/^\.\*+$/,le=i=>i!=="."&&i!==".."&&i.startsWith("."),ce=/^\*+$/,he=i=>i.length!==0&&!i.startsWith("."),fe=i=>i.length!==0&&i!=="."&&i!=="..",ue=/^\?+([^+@!?*[(]*)?$/,pe=([i,t=""])=>{let e=pt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ge=([i,t=""])=>{let e=gt([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},de=([i,t=""])=>{let e=gt([i]);return t?s=>e(s)&&s.endsWith(t):e},me=([i,t=""])=>{let e=pt([i]);return t?s=>e(s)&&s.endsWith(t):e},pt=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},gt=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},dt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ft={win32:{sep:"\\"},posix:{sep:"/"}},ye=dt==="win32"?ft.win32.sep:ft.posix.sep;M.sep=ye;var A=Symbol("globstar **");M.GLOBSTAR=A;var we="[^/]",Se=we+"*?",$e="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",be="(?:(?!(?:\\/|^)\\.).)*?",xe=(i,t={})=>e=>M(e,i,t);M.filter=xe;var N=(i,t={})=>Object.assign({},i,t),Ee=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return M;let t=M;return Object.assign((s,n,r={})=>t(s,n,N(i,r)),{Minimatch:class extends t.Minimatch{constructor(n,r={}){super(n,N(i,r))}static defaults(n){return t.defaults(N(i,n)).Minimatch}},AST:class extends t.AST{constructor(n,r,o={}){super(n,r,N(i,o))}static fromGlob(n,r={}){return t.AST.fromGlob(n,N(i,r))}},unescape:(s,n={})=>t.unescape(s,N(i,n)),escape:(s,n={})=>t.escape(s,N(i,n)),filter:(s,n={})=>t.filter(s,N(i,n)),defaults:s=>t.defaults(N(i,s)),makeRe:(s,n={})=>t.makeRe(s,N(i,n)),braceExpand:(s,n={})=>t.braceExpand(s,N(i,n)),match:(s,n,r={})=>t.match(s,n,N(i,r)),sep:t.sep,GLOBSTAR:A})};M.defaults=Ee;var mt=(i,t={})=>(L(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:it(i,{max:t.braceExpandMax}));M.braceExpand=mt;var Me=(i,t={})=>new D(i,t).makeRe();M.makeRe=Me;var Ae=(i,t,e={})=>{let s=new D(t,e);return i=i.filter(n=>s.match(n)),s.options.nonull&&!i.length&&i.push(t),i};M.match=Ae;var ut=/[?*]|[+@!]\(.*?\)|\[|\]/,Pe=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),D=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,e={}){L(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||dt,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let n=this.globParts.map((r,o,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=r[0]===""&&r[1]===""&&(r[2]==="?"||!ut.test(r[2]))&&!ut.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(h)return[...r.slice(0,4),...r.slice(4).map(g=>this.parse(g))];if(c)return[r[0],...r.slice(1).map(g=>this.parse(g))]}return r.map(h=>this.parse(h))});if(this.debug(this.pattern,n),this.set=n.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let n=s;for(;e[n+1]==="**";)n++;n!==s&&e.splice(s,n-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,n)=>{let r=s[s.length-1];return n==="**"&&r==="**"?s:n===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(n),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let n=1;nn&&s.splice(n+1,o-n);let l=s[n+1],h=s[n+2],c=s[n+3];if(l!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(n,1);let g=s.slice(0);g[n]="**",t.push(g),n--}if(!this.preserveMultipleSlashes){for(let o=1;oe.length)}partsMatch(t,e,s=!1){let n=0,r=0,o=[],l="";for(;n=2&&(t=this.levelTwoFileOptimize(t)),e.includes(A)?this.#s(t,e,s,n,r):this.#i(t,e,s,n,r)}#s(t,e,s,n,r){let o=e.indexOf(A,r),l=e.lastIndexOf(A),[h,c,g]=s?[e.slice(r,o),e.slice(o+1),[]]:[e.slice(r,o),e.slice(o+1,l),e.slice(l+1)];if(h.length){let m=t.slice(n,n+h.length);if(!this.#i(m,h,s,0,0))return!1;n+=h.length,r+=h.length}let a=0;if(g.length){if(g.length+n>t.length)return!1;let m=t.length-g.length;if(this.#i(t,g,s,m,0))a=g.length;else{if(t[t.length-1]!==""||n+g.length===t.length||(m--,!this.#i(t,g,s,m,0)))return!1;a=g.length+1}}if(!c.length){let m=!!a;for(let b=n;b{let c=h.map(a=>{if(a instanceof RegExp)for(let p of a.flags.split(""))n.add(p);return typeof a=="string"?Pe(a):a===A?A:a._src});c.forEach((a,p)=>{let u=c[p+1],d=c[p-1];a!==A||d===A||(d===void 0?u!==void 0&&u!==A?c[p+1]="(?:\\/|"+s+"\\/)?"+u:c[p]=s:u===void 0?c[p-1]=d+"(?:\\/|\\/"+s+")?":u!==A&&(c[p-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,c[p+1]=A))});let g=c.filter(a=>a!==A);if(this.partial&&g.length>=1){let a=[];for(let p=1;p<=g.length;p++)a.push(g.slice(0,p).join("/"));return"(?:"+a.join("|")+")"}return g.join("/")}).join("|"),[o,l]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+l+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+l+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let n=this.slashSplit(t);this.debug(this.pattern,"split",n);let r=this.set;this.debug(this.pattern,"set",r);let o=n[n.length-1];if(!o)for(let l=n.length-2;!o&&l>=0;l--)o=n[l];for(let l of r){let h=n;if(s.matchBase&&l.length===1&&(h=[o]),this.matchOne(h,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return M.defaults(t).Minimatch}};M.AST=z;M.Minimatch=D;M.escape=Z;M.unescape=v;function G(i){if(i<1024)return String(i);if(i<1024*1024){let e=i/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(i<1024*1024*1024){let e=i/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=i/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function F(i){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i.getMonth()],s=String(i.getDate()).padStart(2," "),n=new Date,r=new Date(n.getTime()-4320*60*60*1e3);if(i>r){let l=String(i.getHours()).padStart(2,"0"),h=String(i.getMinutes()).padStart(2,"0");return`${e} ${s} ${l}:${h}`}let o=i.getFullYear();return`${e} ${s} ${o}`}function C(i){return i.isDirectory?"/":i.isSymbolicLink?"@":(i.mode&73)!==0?"*":""}var Te={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},Ne={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},es={name:"ls",async execute(i,t){if(V(i))return K(Te);let e=I("ls",i,Ne);if(!e.ok)return e.error;let s=e.result.flags.showAll,n=e.result.flags.showAlmostAll,r=e.result.flags.longFormat,o=e.result.flags.humanReadable,l=e.result.flags.recursive,h=e.result.flags.reverse,c=e.result.flags.sortBySize,g=e.result.flags.classifyFiles,a=e.result.flags.directoryOnly,p=e.result.flags.sortByTime;e.result.flags.onePerLine;let u=e.result.positional;u.length===0&&u.push(".");let d="",f="",$=0;for(let S=0;S0&&d&&!d.endsWith(` + +`)&&(d+=` +`),a){let b=t.fs.resolvePath(t.cwd,m);try{let y=await t.fs.stat(b);if(r){let w=y.isDirectory?"drwxr-xr-x":"-rw-r--r--",E=g?C(await t.fs.lstat(b)):y.isDirectory?"/":"",x=y.size??0,P=o?G(x).padStart(5):String(x).padStart(5),R=y.mtime??new Date(0),W=F(R);d+=`${w} 1 user user ${P} ${W} ${m}${E} +`}else{let w=g?C(await t.fs.lstat(b)):"";d+=`${m}${w} +`}}catch{f+=`ls: cannot access '${m}': No such file or directory +`,$=2}continue}if(m.includes("*")||m.includes("?")||m.includes("[")){let b=await Re(m,t,s,n,r,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}else{let b=await yt(m,t,s,n,r,l,u.length>1,h,o,c,g);d+=b.stdout,f+=b.stderr,b.exitCode!==0&&($=b.exitCode)}}return{stdout:d,stderr:f,exitCode:$}}};async function Re(i,t,e,s,n,r=!1,o=!1,l=!1,h=!1){let c=e||s,g=t.fs.getAllPaths(),a=t.fs.resolvePath(t.cwd,"."),p=[];for(let u of g){let d=u.startsWith(a)&&u.slice(a.length+1)||u;if(M(d,i)||M(u,i)){let f=d.split("/").pop()||d;if(!c&&f.startsWith("."))continue;p.push(d||u)}}if(p.length===0)return{stdout:"",stderr:`ls: ${i}: No such file or directory +`,exitCode:2};if(l){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f);u.push({path:d,size:$.size??0})}catch{u.push({path:d,size:0})}}u.sort((d,f)=>f.size-d.size),p.length=0,p.push(...u.map(d=>d.path))}else p.sort();if(r&&p.reverse(),n){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.stat(f),S=$.isDirectory?"drwxr-xr-x":"-rw-r--r--",m=h?C(await t.fs.lstat(f)):$.isDirectory?"/":"",b=$.size??0,y=o?G(b).padStart(5):String(b).padStart(5),w=$.mtime??new Date(0),E=F(w);u.push(`${S} 1 user user ${y} ${E} ${d}${m}`)}catch{u.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${d}`)}}return{stdout:`${u.join(` +`)} +`,stderr:"",exitCode:0}}if(h){let u=[];for(let d of p){let f=t.fs.resolvePath(t.cwd,d);try{let $=await t.fs.lstat(f);u.push(`${d}${C($)}`)}catch{u.push(d)}}return{stdout:`${u.join(` +`)} +`,stderr:"",exitCode:0}}return{stdout:`${p.join(` +`)} +`,stderr:"",exitCode:0}}async function yt(i,t,e,s,n,r,o,l=!1,h=!1,c=!1,g=!1,a=!1){let p=e||s,u=t.fs.resolvePath(t.cwd,i);try{let d=await t.fs.stat(u);if(!d.isDirectory){let S=g?C(await t.fs.lstat(u)):"";if(n){let m=d.size??0,b=h?G(m).padStart(5):String(m).padStart(5),y=d.mtime??new Date(0),w=F(y);return{stdout:`-rw-r--r-- 1 user user ${b} ${w} ${i}${S} +`,stderr:"",exitCode:0}}return{stdout:`${i}${S} +`,stderr:"",exitCode:0}}let f=await t.fs.readdir(u);if(p||(f=f.filter(S=>!S.startsWith("."))),c){let S=[];for(let m of f){let b=u==="/"?`/${m}`:`${u}/${m}`;try{let y=await t.fs.stat(b);S.push({name:m,size:y.size??0})}catch{S.push({name:m,size:0})}}S.sort((m,b)=>b.size-m.size),f=S.map(m=>m.name)}else f.sort();e&&(f=[".","..",...f]),l&&f.reverse();let $="";if((r||o)&&($+=`${i}: +`),n){$+=`total ${f.length} +`;let S=f.filter(w=>w==="."||w===".."),m=f.filter(w=>w!=="."&&w!=="..");for(let w of S)$+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${w} +`;let b=[];for(let w=0;w{let R=u==="/"?`/${P}`:`${u}/${P}`;try{let W=await t.fs.stat(R),wt=W.isDirectory?"drwxr-xr-x":"-rw-r--r--",St=g?C(await t.fs.lstat(R)):W.isDirectory?"/":"",X=W.size??0,$t=h?G(X).padStart(5):String(X).padStart(5),bt=W.mtime??new Date(0),xt=F(bt);return{name:P,line:`${wt} 1 user user ${$t} ${xt} ${P}${St} +`}}catch{return{name:P,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${P} +`}}}));b.push(...x)}let y=new Map(m.map((w,E)=>[w,E]));b.sort((w,E)=>(y.get(w.name)??0)-(y.get(E.name)??0));for(let{line:w}of b)$+=w}else if(g){let S=[],m=f.filter(y=>y!=="."&&y!==".."),b=f.filter(y=>y==="."||y==="..");for(let y of b)S.push(`${y}/`);for(let y=0;y{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.lstat(P);return`${x}${C(R)}`}catch{return x}}));S.push(...E)}$+=S.join(` +`)+(S.length?` +`:"")}else $+=f.join(` +`)+(f.length?` +`:"");if(r){let S=f.filter(y=>y!=="."&&y!==".."),m=[];if(t.fs.readdirWithFileTypes)m=(await t.fs.readdirWithFileTypes(u)).filter(w=>w.isDirectory&&S.includes(w.name)).map(w=>({name:w.name,isDirectory:!0}));else for(let y=0;y{let P=u==="/"?`/${x}`:`${u}/${x}`;try{let R=await t.fs.stat(P);return{name:x,isDirectory:R.isDirectory}}catch{return{name:x,isDirectory:!1}}}));m.push(...E.filter(x=>x.isDirectory))}m.sort((y,w)=>y.name.localeCompare(w.name)),l&&m.reverse();let b=[];for(let y=0;y{let P=i==="."?`./${x.name}`:`${i}/${x.name}`,R=await yt(P,t,e,s,n,r,!1,l,h,c,g,!0);return{name:x.name,result:R}}));b.push(...E)}b.sort((y,w)=>y.name.localeCompare(w.name)),l&&b.reverse();for(let{result:y}of b)$+=` +`,$+=y.stdout}return{stdout:$,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${i}: No such file or directory +`,exitCode:2}}}var ss={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0};export{es as a,ss as b}; diff --git a/packages/just-bash/dist/bin/chunks/chunk-NAX7MTAR.js b/packages/just-bash/dist/bin/chunks/chunk-NAX7MTAR.js deleted file mode 100644 index 880cdbf2..00000000 --- a/packages/just-bash/dist/bin/chunks/chunk-NAX7MTAR.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node -import{a as y}from"./chunk-RLNOQILG.js";import{a as C}from"./chunk-JBABAK44.js";import{a as u,b as m}from"./chunk-GTNBSMZR.js";var x={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax: - a-z character range - [:alnum:] all letters and digits - [:alpha:] all letters - [:digit:] all digits - [:lower:] all lowercase letters - [:upper:] all uppercase letters - [:space:] all whitespace - [:blank:] horizontal whitespace - [:punct:] all punctuation - [:print:] all printable characters - [:graph:] all printable characters except space - [:cntrl:] all control characters - [:xdigit:] all hexadecimal digits - \\n, \\t, \\r escape sequences`},b=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(r,o)=>String.fromCharCode(o)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(r,o)=>String.fromCharCode(33+o)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(r,o)=>String.fromCharCode(32+o)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",` -\r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);function S(r){let o="",e=0;for(;e65536)throw new Error(`tr: character range too large: '${r[e]}-${r[e+2]}'`);for(let l=a;l<=c;l++)o+=String.fromCharCode(l);e+=3;continue}o+=r[e],e++}return o}var w={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},q={name:"tr",async execute(r,o){if(m(r))return u(x);let e=C("tr",r,w);if(!e.ok)return e.error;let a=e.result.flags.complement||e.result.flags.complementUpper,c=e.result.flags.delete,l=e.result.flags.squeeze,p=e.result.positional;if(p.length<1)return{stdout:"",stderr:`tr: missing operand -`,exitCode:1};if(!c&&!l&&p.length<2)return{stdout:"",stderr:`tr: missing operand after SET1 -`,exitCode:1};let d,s;try{d=S(p[0]),s=p.length>1?S(p[1]):""}catch(n){return{stdout:"",stderr:`${y(n.message)} -`,exitCode:1}}let g=o.stdin,h=n=>{let t=d.includes(n);return a?!t:t},i="";if(c)for(let n of g)h(n)||(i+=n);else if(l&&p.length===1){let n="";for(let t of g)h(t)&&t===n||(i+=t,n=t)}else{if(a){let n=s.length>0?s[s.length-1]:"";for(let t of g)d.includes(t)?i+=t:i+=n}else{let n=new Map;for(let t=0;t=i.length)return{ok:!1,error:{stdout:"",stderr:`${a}: option '--${o}' requires an argument +`,exitCode:1}};r=i[++t]}s[f]=u==="number"?parseInt(r,10):r}}else{let n=e.slice(1);for(let o=0;o