/* * AT Terminal — compiled dsh Host services. DO NOT EDIT. * * Generated by `node dsh/esbuild.dsh.mjs` from src/platform/dsh/entry.ts. * `npm run verify:dsh` fails if this file is not the current build of those sources. */ var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __esm = (fn2, res) => function() { return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res; }; var __export = (target2, all) => { for (var name2 in all) __defProp(target2, name2, { get: all[name2], enumerable: !0 }); }; // node_modules/@at-series/command-policy/dist/tree-sitter-runtime.js import { access as qe, readFile as We } from "node:fs/promises"; import { fileURLToPath as Re } from "node:url"; function $(e) { if (e !== D) throw new Error("Illegal constructor"); } function z(e) { return !!e && typeof e.row == "number" && typeof e.column == "number"; } function ce(e) { _ = e; } function _e(e, t2, r2, s) { let n = r2 - t2, o = e.textCallback(t2, s); if (o) { for (t2 += o.length; t2 < r2; ) { let l = e.textCallback(t2, s); if (l && l.length > 0) t2 += l.length, o += l; else break; } t2 > r2 && (o = o.slice(0, n)); } return o ?? ""; } function re(e, t2, r2, s, n) { for (let o = 0, l = n.length; o < l; o++) { let d3 = _.getValue(r2, "i32"); r2 += c; let m3 = E(t2, r2); r2 += L, n[o] = { patternIndex: s, name: e.captureNames[d3], node: m3 }; } return r2; } function w(e, t2 = 0) { let r2 = u + t2 * L; _.setValue(r2, e.id, "i32"), r2 += c, _.setValue(r2, e.startIndex, "i32"), r2 += c, _.setValue(r2, e.startPosition.row, "i32"), r2 += c, _.setValue(r2, e.startPosition.column, "i32"), r2 += c, _.setValue(r2, e[0], "i32"); } function E(e, t2 = u) { let r2 = _.getValue(t2, "i32"); if (t2 += c, r2 === 0) return null; let s = _.getValue(t2, "i32"); t2 += c; let n = _.getValue(t2, "i32"); t2 += c; let o = _.getValue(t2, "i32"); t2 += c; let l = _.getValue(t2, "i32"); return new Ne(D, { id: r2, tree: e, startIndex: s, startPosition: { row: n, column: o }, other: l }); } function A(e, t2 = u) { _.setValue(t2 + 0 * c, e[0], "i32"), _.setValue(t2 + 1 * c, e[1], "i32"), _.setValue(t2 + 2 * c, e[2], "i32"), _.setValue(t2 + 3 * c, e[3], "i32"); } function C(e) { e[0] = _.getValue(u + 0 * c, "i32"), e[1] = _.getValue(u + 1 * c, "i32"), e[2] = _.getValue(u + 2 * c, "i32"), e[3] = _.getValue(u + 3 * c, "i32"); } function F(e, t2) { _.setValue(e, t2.row, "i32"), _.setValue(e + c, t2.column, "i32"); } function B(e) { return { row: _.getValue(e, "i32") >>> 0, column: _.getValue(e + c, "i32") >>> 0 }; } function ge(e, t2) { F(e, t2.startPosition), e += x, F(e, t2.endPosition), e += x, _.setValue(e, t2.startIndex, "i32"), e += c, _.setValue(e, t2.endIndex, "i32"), e += c; } function Y(e) { let t2 = {}; return t2.startPosition = B(e), e += x, t2.endPosition = B(e), e += x, t2.startIndex = _.getValue(e, "i32") >>> 0, e += c, t2.endIndex = _.getValue(e, "i32") >>> 0, t2; } function he(e, t2 = u) { F(t2, e.startPosition), t2 += x, F(t2, e.oldEndPosition), t2 += x, F(t2, e.newEndPosition), t2 += x, _.setValue(t2, e.startIndex, "i32"), t2 += c, _.setValue(t2, e.oldEndIndex, "i32"), t2 += c, _.setValue(t2, e.newEndIndex, "i32"), t2 += c; } function fe(e) { let t2 = _.getValue(e, "i32"), r2 = _.getValue(e += c, "i32"), s = _.getValue(e += c, "i32"); return { major_version: t2, minor_version: r2, patch_version: s }; } async function ye(moduleArg = {}) { var moduleRtn, Module = moduleArg, ENVIRONMENT_IS_WEB = typeof window == "object", ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope < "u", ENVIRONMENT_IS_NODE = typeof process == "object" && process.versions?.node && process.type != "renderer"; if (ENVIRONMENT_IS_NODE) { let { createRequire: e } = await import("node:module"); var require = e(import.meta.url); } Module.currentQueryProgressCallback = null, Module.currentProgressCallback = null, Module.currentLogCallback = null, Module.currentParseCallback = null; var arguments_ = [], thisProgram = "./this.program", quit_ = a((e, t2) => { throw t2; }, "quit_"), _scriptName = import.meta.url, scriptDirectory = ""; function locateFile(e) { return Module.locateFile ? Module.locateFile(e, scriptDirectory) : scriptDirectory + e; } a(locateFile, "locateFile"); var readAsync, readBinary; if (ENVIRONMENT_IS_NODE) { var fs = require("fs"); _scriptName.startsWith("file:") && (scriptDirectory = require("path").dirname(require("url").fileURLToPath(_scriptName)) + "/"), readBinary = a((e) => { e = isFileURI(e) ? new URL(e) : e; var t2 = fs.readFileSync(e); return t2; }, "readBinary"), readAsync = a(async (e, t2 = !0) => { e = isFileURI(e) ? new URL(e) : e; var r2 = fs.readFileSync(e, t2 ? void 0 : "utf8"); return r2; }, "readAsync"), process.argv.length > 1 && (thisProgram = process.argv[1].replace(/\\/g, "/")), arguments_ = process.argv.slice(2), quit_ = a((e, t2) => { throw process.exitCode = e, t2; }, "quit_"); } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { try { scriptDirectory = new URL(".", _scriptName).href; } catch { } ENVIRONMENT_IS_WORKER && (readBinary = a((e) => { var t2 = new XMLHttpRequest(); return t2.open("GET", e, !1), t2.responseType = "arraybuffer", t2.send(null), new Uint8Array(t2.response); }, "readBinary")), readAsync = a(async (e) => { if (isFileURI(e)) return new Promise((r2, s) => { var n = new XMLHttpRequest(); n.open("GET", e, !0), n.responseType = "arraybuffer", n.onload = () => { if (n.status == 200 || n.status == 0 && n.response) { r2(n.response); return; } s(n.status); }, n.onerror = s, n.send(null); }); var t2 = await fetch(e, { credentials: "same-origin" }); if (t2.ok) return t2.arrayBuffer(); throw new Error(t2.status + " : " + t2.url); }, "readAsync"); } var out = console.log.bind(console), err = console.error.bind(console), dynamicLibraries = [], wasmBinary, ABORT = !1, EXITSTATUS, isFileURI = a((e) => e.startsWith("file://"), "isFileURI"), readyPromiseResolve, readyPromiseReject, wasmMemory, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64, HEAP64, HEAPU64, HEAP_DATA_VIEW, runtimeInitialized = !1; function updateMemoryViews() { var e = wasmMemory.buffer; Module.HEAP8 = HEAP8 = new Int8Array(e), Module.HEAP16 = HEAP16 = new Int16Array(e), Module.HEAPU8 = HEAPU8 = new Uint8Array(e), Module.HEAPU16 = HEAPU16 = new Uint16Array(e), Module.HEAP32 = HEAP32 = new Int32Array(e), Module.HEAPU32 = HEAPU32 = new Uint32Array(e), Module.HEAPF32 = HEAPF32 = new Float32Array(e), Module.HEAPF64 = HEAPF64 = new Float64Array(e), Module.HEAP64 = HEAP64 = new BigInt64Array(e), Module.HEAPU64 = HEAPU64 = new BigUint64Array(e), Module.HEAP_DATA_VIEW = HEAP_DATA_VIEW = new DataView(e), LE_HEAP_UPDATE(); } a(updateMemoryViews, "updateMemoryViews"); function initMemory() { if (Module.wasmMemory) wasmMemory = Module.wasmMemory; else { var e = Module.INITIAL_MEMORY || 33554432; wasmMemory = new WebAssembly.Memory({ initial: e / 65536, maximum: 32768 }); } updateMemoryViews(); } a(initMemory, "initMemory"); var __RELOC_FUNCS__ = []; function preRun() { if (Module.preRun) for (typeof Module.preRun == "function" && (Module.preRun = [Module.preRun]); Module.preRun.length; ) addOnPreRun(Module.preRun.shift()); callRuntimeCallbacks(onPreRuns); } a(preRun, "preRun"); function initRuntime() { runtimeInitialized = !0, callRuntimeCallbacks(__RELOC_FUNCS__), wasmExports.__wasm_call_ctors(), callRuntimeCallbacks(onPostCtors); } a(initRuntime, "initRuntime"); function preMain() { } a(preMain, "preMain"); function postRun() { if (Module.postRun) for (typeof Module.postRun == "function" && (Module.postRun = [Module.postRun]); Module.postRun.length; ) addOnPostRun(Module.postRun.shift()); callRuntimeCallbacks(onPostRuns); } a(postRun, "postRun"); function abort(e) { Module.onAbort?.(e), e = "Aborted(" + e + ")", err(e), ABORT = !0, e += ". Build with -sASSERTIONS for more info."; var t2 = new WebAssembly.RuntimeError(e); throw readyPromiseReject?.(t2), t2; } a(abort, "abort"); var wasmBinaryFile; function findWasmBinary() { return Module.locateFile ? locateFile("web-tree-sitter.wasm") : new URL("web-tree-sitter.wasm", import.meta.url).href; } a(findWasmBinary, "findWasmBinary"); function getBinarySync(e) { if (e == wasmBinaryFile && wasmBinary) return new Uint8Array(wasmBinary); if (readBinary) return readBinary(e); throw "both async and sync fetching of the wasm failed"; } a(getBinarySync, "getBinarySync"); async function getWasmBinary(e) { if (!wasmBinary) try { var t2 = await readAsync(e); return new Uint8Array(t2); } catch { } return getBinarySync(e); } a(getWasmBinary, "getWasmBinary"); async function instantiateArrayBuffer(e, t2) { try { var r2 = await getWasmBinary(e), s = await WebAssembly.instantiate(r2, t2); return s; } catch (n) { err(`failed to asynchronously prepare wasm: ${n}`), abort(n); } } a(instantiateArrayBuffer, "instantiateArrayBuffer"); async function instantiateAsync(e, t2, r2) { if (!e && !isFileURI(t2) && !ENVIRONMENT_IS_NODE) try { var s = fetch(t2, { credentials: "same-origin" }), n = await WebAssembly.instantiateStreaming(s, r2); return n; } catch (o) { err(`wasm streaming compile failed: ${o}`), err("falling back to ArrayBuffer instantiation"); } return instantiateArrayBuffer(t2, r2); } a(instantiateAsync, "instantiateAsync"); function getWasmImports() { return { env: wasmImports, wasi_snapshot_preview1: wasmImports, "GOT.mem": new Proxy(wasmImports, GOTHandler), "GOT.func": new Proxy(wasmImports, GOTHandler) }; } a(getWasmImports, "getWasmImports"); async function createWasm() { function e(o, l) { wasmExports = o.exports, wasmExports = relocateExports(wasmExports, 1024); var d3 = getDylinkMetadata(l); return d3.neededDynlibs && (dynamicLibraries = d3.neededDynlibs.concat(dynamicLibraries)), mergeLibSymbols(wasmExports, "main"), LDSO.init(), loadDylibs(), __RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs), assignWasmExports(wasmExports), wasmExports; } a(e, "receiveInstance"); function t2(o) { return e(o.instance, o.module); } a(t2, "receiveInstantiationResult"); var r2 = getWasmImports(); if (Module.instantiateWasm) return new Promise((o, l) => { Module.instantiateWasm(r2, (d3, m3) => { o(e(d3, m3)); }); }); wasmBinaryFile ??= findWasmBinary(); var s = await instantiateAsync(wasmBinary, wasmBinaryFile, r2), n = t2(s); return n; } a(createWasm, "createWasm"); class ExitStatus { static { a(this, "ExitStatus"); } name = "ExitStatus"; constructor(t2) { this.message = `Program terminated with exit(${t2})`, this.status = t2; } } var GOT = {}, currentModuleWeakSymbols = /* @__PURE__ */ new Set([]), GOTHandler = { get(e, t2) { var r2 = GOT[t2]; return r2 || (r2 = GOT[t2] = new WebAssembly.Global({ value: "i32", mutable: !0 })), currentModuleWeakSymbols.has(t2) || (r2.required = !0), r2; } }, LE_ATOMICS_NATIVE_BYTE_ORDER = [], LE_HEAP_LOAD_F32 = a((e) => HEAP_DATA_VIEW.getFloat32(e, !0), "LE_HEAP_LOAD_F32"), LE_HEAP_LOAD_F64 = a((e) => HEAP_DATA_VIEW.getFloat64(e, !0), "LE_HEAP_LOAD_F64"), LE_HEAP_LOAD_I16 = a((e) => HEAP_DATA_VIEW.getInt16(e, !0), "LE_HEAP_LOAD_I16"), LE_HEAP_LOAD_I32 = a((e) => HEAP_DATA_VIEW.getInt32(e, !0), "LE_HEAP_LOAD_I32"), LE_HEAP_LOAD_I64 = a((e) => HEAP_DATA_VIEW.getBigInt64(e, !0), "LE_HEAP_LOAD_I64"), LE_HEAP_LOAD_U32 = a((e) => HEAP_DATA_VIEW.getUint32(e, !0), "LE_HEAP_LOAD_U32"), LE_HEAP_STORE_F32 = a((e, t2) => HEAP_DATA_VIEW.setFloat32(e, t2, !0), "LE_HEAP_STORE_F32"), LE_HEAP_STORE_F64 = a((e, t2) => HEAP_DATA_VIEW.setFloat64(e, t2, !0), "LE_HEAP_STORE_F64"), LE_HEAP_STORE_I16 = a((e, t2) => HEAP_DATA_VIEW.setInt16(e, t2, !0), "LE_HEAP_STORE_I16"), LE_HEAP_STORE_I32 = a((e, t2) => HEAP_DATA_VIEW.setInt32(e, t2, !0), "LE_HEAP_STORE_I32"), LE_HEAP_STORE_I64 = a((e, t2) => HEAP_DATA_VIEW.setBigInt64(e, t2, !0), "LE_HEAP_STORE_I64"), LE_HEAP_STORE_U32 = a((e, t2) => HEAP_DATA_VIEW.setUint32(e, t2, !0), "LE_HEAP_STORE_U32"), callRuntimeCallbacks = a((e) => { for (; e.length > 0; ) e.shift()(Module); }, "callRuntimeCallbacks"), onPostRuns = [], addOnPostRun = a((e) => onPostRuns.push(e), "addOnPostRun"), onPreRuns = [], addOnPreRun = a((e) => onPreRuns.push(e), "addOnPreRun"), UTF8Decoder = typeof TextDecoder < "u" ? new TextDecoder() : void 0, findStringEnd = a((e, t2, r2, s) => { var n = t2 + r2; if (s) return n; for (; e[t2] && !(t2 >= n); ) ++t2; return t2; }, "findStringEnd"), UTF8ArrayToString = a((e, t2 = 0, r2, s) => { var n = findStringEnd(e, t2, r2, s); if (n - t2 > 16 && e.buffer && UTF8Decoder) return UTF8Decoder.decode(e.subarray(t2, n)); for (var o = ""; t2 < n; ) { var l = e[t2++]; if (!(l & 128)) { o += String.fromCharCode(l); continue; } var d3 = e[t2++] & 63; if ((l & 224) == 192) { o += String.fromCharCode((l & 31) << 6 | d3); continue; } var m3 = e[t2++] & 63; if ((l & 240) == 224 ? l = (l & 15) << 12 | d3 << 6 | m3 : l = (l & 7) << 18 | d3 << 12 | m3 << 6 | e[t2++] & 63, l < 65536) o += String.fromCharCode(l); else { var g4 = l - 65536; o += String.fromCharCode(55296 | g4 >> 10, 56320 | g4 & 1023); } } return o; }, "UTF8ArrayToString"), getDylinkMetadata = a((e) => { var t2 = 0, r2 = 0; function s() { return e[t2++]; } a(s, "getU8"); function n() { for (var U4 = 0, W4 = 1; ; ) { var le3 = e[t2++]; if (U4 += (le3 & 127) * W4, W4 *= 128, !(le3 & 128)) break; } return U4; } a(n, "getLEB"); function o() { var U4 = n(); return t2 += U4, UTF8ArrayToString(e, t2 - U4, U4); } a(o, "getString"); function l() { for (var U4 = n(), W4 = []; U4--; ) W4.push(o()); return W4; } a(l, "getStringList"); function d3(U4, W4) { if (U4) throw new Error(W4); } if (a(d3, "failIf"), e instanceof WebAssembly.Module) { var m3 = WebAssembly.Module.customSections(e, "dylink.0"); d3(m3.length === 0, "need dylink section"), e = new Uint8Array(m3[0]), r2 = e.length; } else { var g4 = new Uint32Array(new Uint8Array(e.subarray(0, 24)).buffer), f4 = g4[0] == 1836278016 || g4[0] == 6386541; d3(!f4, "need to see wasm magic number"), d3(e[8] !== 0, "need the dylink section to be first"), t2 = 9; var y4 = n(); r2 = t2 + y4; var b4 = o(); d3(b4 !== "dylink.0"); } for (var v4 = { neededDynlibs: [], tlsExports: /* @__PURE__ */ new Set(), weakImports: /* @__PURE__ */ new Set(), runtimePaths: [] }, T5 = 1, N4 = 2, h3 = 3, M4 = 4, p3 = 5, I3 = 256, P4 = 3, V3 = 1; t2 < r2; ) { var k4 = s(), S3 = n(); if (k4 === T5) v4.memorySize = n(), v4.memoryAlign = n(), v4.tableSize = n(), v4.tableAlign = n(); else if (k4 === N4) v4.neededDynlibs = l(); else if (k4 === h3) for (var H5 = n(); H5--; ) { var q4 = o(), G5 = n(); G5 & I3 && v4.tlsExports.add(q4); } else if (k4 === M4) for (var H5 = n(); H5--; ) { var Qe3 = o(), q4 = o(), G5 = n(); (G5 & P4) == V3 && v4.weakImports.add(q4); } else k4 === p3 ? v4.runtimePaths = l() : t2 += S3; } return v4; }, "getDylinkMetadata"); function getValue(e, t2 = "i8") { switch (t2.endsWith("*") && (t2 = "*"), t2) { case "i1": return HEAP8[e]; case "i8": return HEAP8[e]; case "i16": return LE_HEAP_LOAD_I16((e >> 1) * 2); case "i32": return LE_HEAP_LOAD_I32((e >> 2) * 4); case "i64": return LE_HEAP_LOAD_I64((e >> 3) * 8); case "float": return LE_HEAP_LOAD_F32((e >> 2) * 4); case "double": return LE_HEAP_LOAD_F64((e >> 3) * 8); case "*": return LE_HEAP_LOAD_U32((e >> 2) * 4); default: abort(`invalid type for getValue: ${t2}`); } } a(getValue, "getValue"); var newDSO = a((e, t2, r2) => { var s = { refcount: 1 / 0, name: e, exports: r2, global: !0 }; return LDSO.loadedLibsByName[e] = s, t2 != null && (LDSO.loadedLibsByHandle[t2] = s), s; }, "newDSO"), LDSO = { loadedLibsByName: {}, loadedLibsByHandle: {}, init() { newDSO("__main__", 0, wasmImports); } }, ___heap_base = 78240, alignMemory = a((e, t2) => Math.ceil(e / t2) * t2, "alignMemory"), getMemory = a((e) => { if (runtimeInitialized) return _calloc(e, 1); var t2 = ___heap_base, r2 = t2 + alignMemory(e, 16); return ___heap_base = r2, GOT.__heap_base.value = r2, t2; }, "getMemory"), isInternalSym = a((e) => ["__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js"].includes(e) || e.startsWith("__em_js__"), "isInternalSym"), uleb128EncodeWithLen = a((e) => { let t2 = e.length; return [t2 % 128 | 128, t2 >> 7, ...e]; }, "uleb128EncodeWithLen"), wasmTypeCodes = { i: 127, p: 127, j: 126, f: 125, d: 124, e: 111 }, generateTypePack = a((e) => uleb128EncodeWithLen(Array.from(e, (t2) => { var r2 = wasmTypeCodes[t2]; return r2; })), "generateTypePack"), convertJsFunctionToWasm = a((e, t2) => { var r2 = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, ...uleb128EncodeWithLen([1, 96, ...generateTypePack(t2.slice(1)), ...generateTypePack(t2[0] === "v" ? "" : t2[0])]), 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0), s = new WebAssembly.Module(r2), n = new WebAssembly.Instance(s, { e: { f: e } }), o = n.exports.f; return o; }, "convertJsFunctionToWasm"), wasmTableMirror = [], wasmTable = new WebAssembly.Table({ initial: 31, element: "anyfunc" }), getWasmTableEntry = a((e) => { var t2 = wasmTableMirror[e]; return t2 || (wasmTableMirror[e] = t2 = wasmTable.get(e)), t2; }, "getWasmTableEntry"), updateTableMap = a((e, t2) => { if (functionsInTableMap) for (var r2 = e; r2 < e + t2; r2++) { var s = getWasmTableEntry(r2); s && functionsInTableMap.set(s, r2); } }, "updateTableMap"), functionsInTableMap, getFunctionAddress = a((e) => (functionsInTableMap || (functionsInTableMap = /* @__PURE__ */ new WeakMap(), updateTableMap(0, wasmTable.length)), functionsInTableMap.get(e) || 0), "getFunctionAddress"), freeTableIndexes = [], getEmptyTableSlot = a(() => freeTableIndexes.length ? freeTableIndexes.pop() : wasmTable.grow(1), "getEmptyTableSlot"), setWasmTableEntry = a((e, t2) => { wasmTable.set(e, t2), wasmTableMirror[e] = wasmTable.get(e); }, "setWasmTableEntry"), addFunction = a((e, t2) => { var r2 = getFunctionAddress(e); if (r2) return r2; var s = getEmptyTableSlot(); try { setWasmTableEntry(s, e); } catch (o) { if (!(o instanceof TypeError)) throw o; var n = convertJsFunctionToWasm(e, t2); setWasmTableEntry(s, n); } return functionsInTableMap.set(e, s), s; }, "addFunction"), updateGOT = a((e, t2) => { for (var r2 in e) if (!isInternalSym(r2)) { var s = e[r2]; GOT[r2] ||= new WebAssembly.Global({ value: "i32", mutable: !0 }), (t2 || GOT[r2].value == 0) && (typeof s == "function" ? GOT[r2].value = addFunction(s) : typeof s == "number" ? GOT[r2].value = s : err(`unhandled export type for '${r2}': ${typeof s}`)); } }, "updateGOT"), relocateExports = a((e, t2, r2) => { var s = {}; for (var n in e) { var o = e[n]; typeof o == "object" && (o = o.value), typeof o == "number" && (o += t2), s[n] = o; } return updateGOT(s, r2), s; }, "relocateExports"), isSymbolDefined = a((e) => { var t2 = wasmImports[e]; return !(!t2 || t2.stub); }, "isSymbolDefined"), dynCall = a((e, t2, r2 = [], s = !1) => { var n = getWasmTableEntry(t2), o = n(...r2); function l(d3) { return d3; } return a(l, "convert"), o; }, "dynCall"), stackSave = a(() => _emscripten_stack_get_current(), "stackSave"), stackRestore = a((e) => __emscripten_stack_restore(e), "stackRestore"), createInvokeFunction = a((e) => (t2, ...r2) => { var s = stackSave(); try { return dynCall(e, t2, r2); } catch (n) { if (stackRestore(s), n !== n + 0) throw n; if (_setThrew(1, 0), e[0] == "j") return 0n; } }, "createInvokeFunction"), resolveGlobalSymbol = a((e, t2 = !1) => { var r2; return isSymbolDefined(e) ? r2 = wasmImports[e] : e.startsWith("invoke_") && (r2 = wasmImports[e] = createInvokeFunction(e.split("_")[1])), { sym: r2, name: e }; }, "resolveGlobalSymbol"), onPostCtors = [], addOnPostCtor = a((e) => onPostCtors.push(e), "addOnPostCtor"), UTF8ToString = a((e, t2, r2) => e ? UTF8ArrayToString(HEAPU8, e, t2, r2) : "", "UTF8ToString"), loadWebAssemblyModule = a((binary, flags, libName, localScope, handle) => { var metadata = getDylinkMetadata(binary); function loadModule() { var memAlign = Math.pow(2, metadata.memoryAlign), memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0, tableBase = metadata.tableSize ? wasmTable.length : 0; handle && (HEAP8[handle + 8] = 1, LE_HEAP_STORE_U32((handle + 12 >> 2) * 4, memoryBase), LE_HEAP_STORE_I32((handle + 16 >> 2) * 4, metadata.memorySize), LE_HEAP_STORE_U32((handle + 20 >> 2) * 4, tableBase), LE_HEAP_STORE_I32((handle + 24 >> 2) * 4, metadata.tableSize)), metadata.tableSize && wasmTable.grow(metadata.tableSize); var moduleExports; function resolveSymbol(e) { var t2 = resolveGlobalSymbol(e).sym; return !t2 && localScope && (t2 = localScope[e]), t2 || (t2 = moduleExports[e]), t2; } a(resolveSymbol, "resolveSymbol"); var proxyHandler = { get(e, t2) { switch (t2) { case "__memory_base": return memoryBase; case "__table_base": return tableBase; } if (t2 in wasmImports && !wasmImports[t2].stub) { var r2 = wasmImports[t2]; return r2; } if (!(t2 in e)) { var s; e[t2] = (...n) => (s ||= resolveSymbol(t2), s(...n)); } return e[t2]; } }, proxy = new Proxy({}, proxyHandler); currentModuleWeakSymbols = metadata.weakImports; var info = { "GOT.mem": new Proxy({}, GOTHandler), "GOT.func": new Proxy({}, GOTHandler), env: proxy, wasi_snapshot_preview1: proxy }; function postInstantiation(module, instance) { updateTableMap(tableBase, metadata.tableSize), moduleExports = relocateExports(instance.exports, memoryBase), flags.allowUndefined || reportUndefinedSymbols(); function addEmAsm(addr, body) { for (var args = [], arity = 0; arity < 16 && body.indexOf("$" + arity) != -1; arity++) args.push("$" + arity); args = args.join(","); var func = `(${args}) => { ${body} };`; ASM_CONSTS[start] = eval(func); } if (a(addEmAsm, "addEmAsm"), "__start_em_asm" in moduleExports) for (var start = moduleExports.__start_em_asm, stop = moduleExports.__stop_em_asm; start < stop; ) { var jsString = UTF8ToString(start); addEmAsm(start, jsString), start = HEAPU8.indexOf(0, start) + 1; } function addEmJs(name, cSig, body) { var jsArgs = []; if (cSig = cSig.slice(1, -1), cSig != "void") { cSig = cSig.split(","); for (var i in cSig) { var jsArg = cSig[i].split(" ").pop(); jsArgs.push(jsArg.replace("*", "")); } } var func = `(${jsArgs}) => ${body};`; moduleExports[name] = eval(func); } a(addEmJs, "addEmJs"); for (var name in moduleExports) if (name.startsWith("__em_js__")) { var start = moduleExports[name], jsString = UTF8ToString(start), parts = jsString.split("<::>"); addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]), delete moduleExports[name]; } var applyRelocs = moduleExports.__wasm_apply_data_relocs; applyRelocs && (runtimeInitialized ? applyRelocs() : __RELOC_FUNCS__.push(applyRelocs)); var init = moduleExports.__wasm_call_ctors; return init && (runtimeInitialized ? init() : addOnPostCtor(init)), moduleExports; } if (a(postInstantiation, "postInstantiation"), flags.loadAsync) return (async () => { var e; return binary instanceof WebAssembly.Module ? e = new WebAssembly.Instance(binary, info) : { module: binary, instance: e } = await WebAssembly.instantiate(binary, info), postInstantiation(binary, e); })(); var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary), instance = new WebAssembly.Instance(module, info); return postInstantiation(module, instance); } return a(loadModule, "loadModule"), flags = { ...flags, rpath: { parentLibPath: libName, paths: metadata.runtimePaths } }, flags.loadAsync ? metadata.neededDynlibs.reduce((e, t2) => e.then(() => loadDynamicLibrary(t2, flags, localScope)), Promise.resolve()).then(loadModule) : (metadata.neededDynlibs.forEach((e) => loadDynamicLibrary(e, flags, localScope)), loadModule()); }, "loadWebAssemblyModule"), mergeLibSymbols = a((e, t2) => { for (var [r2, s] of Object.entries(e)) { let n = a((l) => { isSymbolDefined(l) || (wasmImports[l] = s); }, "setImport"); n(r2); let o = "__main_argc_argv"; r2 == "main" && n(o), r2 == o && n("main"); } }, "mergeLibSymbols"), asyncLoad = a(async (e) => { var t2 = await readAsync(e); return new Uint8Array(t2); }, "asyncLoad"); function loadDynamicLibrary(e, t2 = { global: !0, nodelete: !0 }, r2, s) { var n = LDSO.loadedLibsByName[e]; if (n) return t2.global ? n.global || (n.global = !0, mergeLibSymbols(n.exports, e)) : r2 && Object.assign(r2, n.exports), t2.nodelete && n.refcount !== 1 / 0 && (n.refcount = 1 / 0), n.refcount++, s && (LDSO.loadedLibsByHandle[s] = n), t2.loadAsync ? Promise.resolve(!0) : !0; n = newDSO(e, s, "loading"), n.refcount = t2.nodelete ? 1 / 0 : 1, n.global = t2.global; function o() { if (s) { var m3 = LE_HEAP_LOAD_U32((s + 28 >> 2) * 4), g4 = LE_HEAP_LOAD_U32((s + 32 >> 2) * 4); if (m3 && g4) { var f4 = HEAP8.slice(m3, m3 + g4); return t2.loadAsync ? Promise.resolve(f4) : f4; } } var y4 = locateFile(e); if (t2.loadAsync) return asyncLoad(y4); if (!readBinary) throw new Error(`${y4}: file not found, and synchronous loading of external files is not available`); return readBinary(y4); } a(o, "loadLibData"); function l() { return t2.loadAsync ? o().then((m3) => loadWebAssemblyModule(m3, t2, e, r2, s)) : loadWebAssemblyModule(o(), t2, e, r2, s); } a(l, "getExports"); function d3(m3) { n.global ? mergeLibSymbols(m3, e) : r2 && Object.assign(r2, m3), n.exports = m3; } return a(d3, "moduleLoaded"), t2.loadAsync ? l().then((m3) => (d3(m3), !0)) : (d3(l()), !0); } a(loadDynamicLibrary, "loadDynamicLibrary"); var reportUndefinedSymbols = a(() => { for (var [e, t2] of Object.entries(GOT)) if (t2.value == 0) { var r2 = resolveGlobalSymbol(e, !0).sym; if (!r2 && !t2.required) continue; if (typeof r2 == "function") t2.value = addFunction(r2, r2.sig); else if (typeof r2 == "number") t2.value = r2; else throw new Error(`bad export type for '${e}': ${typeof r2}`); } }, "reportUndefinedSymbols"), runDependencies = 0, dependenciesFulfilled = null, removeRunDependency = a((e) => { if (runDependencies--, Module.monitorRunDependencies?.(runDependencies), runDependencies == 0 && dependenciesFulfilled) { var t2 = dependenciesFulfilled; dependenciesFulfilled = null, t2(); } }, "removeRunDependency"), addRunDependency = a((e) => { runDependencies++, Module.monitorRunDependencies?.(runDependencies); }, "addRunDependency"), loadDylibs = a(async () => { if (!dynamicLibraries.length) { reportUndefinedSymbols(); return; } addRunDependency("loadDylibs"); for (var e of dynamicLibraries) await loadDynamicLibrary(e, { loadAsync: !0, global: !0, nodelete: !0, allowUndefined: !0 }); reportUndefinedSymbols(), removeRunDependency("loadDylibs"); }, "loadDylibs"), noExitRuntime = !0; function setValue(e, t2, r2 = "i8") { switch (r2.endsWith("*") && (r2 = "*"), r2) { case "i1": HEAP8[e] = t2; break; case "i8": HEAP8[e] = t2; break; case "i16": LE_HEAP_STORE_I16((e >> 1) * 2, t2); break; case "i32": LE_HEAP_STORE_I32((e >> 2) * 4, t2); break; case "i64": LE_HEAP_STORE_I64((e >> 3) * 8, BigInt(t2)); break; case "float": LE_HEAP_STORE_F32((e >> 2) * 4, t2); break; case "double": LE_HEAP_STORE_F64((e >> 3) * 8, t2); break; case "*": LE_HEAP_STORE_U32((e >> 2) * 4, t2); break; default: abort(`invalid type for setValue: ${r2}`); } } a(setValue, "setValue"); var ___memory_base = new WebAssembly.Global({ value: "i32", mutable: !1 }, 1024), ___stack_high = 78240, ___stack_low = 12704, ___stack_pointer = new WebAssembly.Global({ value: "i32", mutable: !0 }, 78240), ___table_base = new WebAssembly.Global({ value: "i32", mutable: !1 }, 1), __abort_js = a(() => abort(""), "__abort_js"); __abort_js.sig = "v"; var getHeapMax = a(() => 2147483648, "getHeapMax"), growMemory = a((e) => { var t2 = wasmMemory.buffer.byteLength, r2 = (e - t2 + 65535) / 65536 | 0; try { return wasmMemory.grow(r2), updateMemoryViews(), 1; } catch { } }, "growMemory"), _emscripten_resize_heap = a((e) => { var t2 = HEAPU8.length; e >>>= 0; var r2 = getHeapMax(); if (e > r2) return !1; for (var s = 1; s <= 4; s *= 2) { var n = t2 * (1 + 0.2 / s); n = Math.min(n, e + 100663296); var o = Math.min(r2, alignMemory(Math.max(e, n), 65536)), l = growMemory(o); if (l) return !0; } return !1; }, "_emscripten_resize_heap"); _emscripten_resize_heap.sig = "ip"; var _fd_close = a((e) => 52, "_fd_close"); _fd_close.sig = "ii"; var INT53_MAX = 9007199254740992, INT53_MIN = -9007199254740992, bigintToI53Checked = a((e) => e < INT53_MIN || e > INT53_MAX ? NaN : Number(e), "bigintToI53Checked"); function _fd_seek(e, t2, r2, s) { return t2 = bigintToI53Checked(t2), 70; } a(_fd_seek, "_fd_seek"), _fd_seek.sig = "iijip"; var printCharBuffers = [null, [], []], printChar = a((e, t2) => { var r2 = printCharBuffers[e]; t2 === 0 || t2 === 10 ? ((e === 1 ? out : err)(UTF8ArrayToString(r2)), r2.length = 0) : r2.push(t2); }, "printChar"), _fd_write = a((e, t2, r2, s) => { for (var n = 0, o = 0; o < r2; o++) { var l = LE_HEAP_LOAD_U32((t2 >> 2) * 4), d3 = LE_HEAP_LOAD_U32((t2 + 4 >> 2) * 4); t2 += 8; for (var m3 = 0; m3 < d3; m3++) printChar(e, HEAPU8[l + m3]); n += d3; } return LE_HEAP_STORE_U32((s >> 2) * 4, n), 0; }, "_fd_write"); _fd_write.sig = "iippp"; function _tree_sitter_log_callback(e, t2) { if (Module.currentLogCallback) { let r2 = UTF8ToString(t2); Module.currentLogCallback(r2, e !== 0); } } a(_tree_sitter_log_callback, "_tree_sitter_log_callback"); function _tree_sitter_parse_callback(e, t2, r2, s, n) { let l = Module.currentParseCallback(t2, { row: r2, column: s }); typeof l == "string" ? (setValue(n, l.length, "i32"), stringToUTF16(l, e, 10240)) : setValue(n, 0, "i32"); } a(_tree_sitter_parse_callback, "_tree_sitter_parse_callback"); function _tree_sitter_progress_callback(e, t2) { return Module.currentProgressCallback ? Module.currentProgressCallback({ currentOffset: e, hasError: t2 }) : !1; } a(_tree_sitter_progress_callback, "_tree_sitter_progress_callback"); function _tree_sitter_query_progress_callback(e) { return Module.currentQueryProgressCallback ? Module.currentQueryProgressCallback({ currentOffset: e }) : !1; } a(_tree_sitter_query_progress_callback, "_tree_sitter_query_progress_callback"); var runtimeKeepaliveCounter = 0, keepRuntimeAlive = a(() => noExitRuntime || runtimeKeepaliveCounter > 0, "keepRuntimeAlive"), _proc_exit = a((e) => { EXITSTATUS = e, keepRuntimeAlive() || (Module.onExit?.(e), ABORT = !0), quit_(e, new ExitStatus(e)); }, "_proc_exit"); _proc_exit.sig = "vi"; var exitJS = a((e, t2) => { EXITSTATUS = e, _proc_exit(e); }, "exitJS"), handleException = a((e) => { if (e instanceof ExitStatus || e == "unwind") return EXITSTATUS; quit_(1, e); }, "handleException"), lengthBytesUTF8 = a((e) => { for (var t2 = 0, r2 = 0; r2 < e.length; ++r2) { var s = e.charCodeAt(r2); s <= 127 ? t2++ : s <= 2047 ? t2 += 2 : s >= 55296 && s <= 57343 ? (t2 += 4, ++r2) : t2 += 3; } return t2; }, "lengthBytesUTF8"), stringToUTF8Array = a((e, t2, r2, s) => { if (!(s > 0)) return 0; for (var n = r2, o = r2 + s - 1, l = 0; l < e.length; ++l) { var d3 = e.codePointAt(l); if (d3 <= 127) { if (r2 >= o) break; t2[r2++] = d3; } else if (d3 <= 2047) { if (r2 + 1 >= o) break; t2[r2++] = 192 | d3 >> 6, t2[r2++] = 128 | d3 & 63; } else if (d3 <= 65535) { if (r2 + 2 >= o) break; t2[r2++] = 224 | d3 >> 12, t2[r2++] = 128 | d3 >> 6 & 63, t2[r2++] = 128 | d3 & 63; } else { if (r2 + 3 >= o) break; t2[r2++] = 240 | d3 >> 18, t2[r2++] = 128 | d3 >> 12 & 63, t2[r2++] = 128 | d3 >> 6 & 63, t2[r2++] = 128 | d3 & 63, l++; } } return t2[r2] = 0, r2 - n; }, "stringToUTF8Array"), stringToUTF8 = a((e, t2, r2) => stringToUTF8Array(e, HEAPU8, t2, r2), "stringToUTF8"), stackAlloc = a((e) => __emscripten_stack_alloc(e), "stackAlloc"), stringToUTF8OnStack = a((e) => { var t2 = lengthBytesUTF8(e) + 1, r2 = stackAlloc(t2); return stringToUTF8(e, r2, t2), r2; }, "stringToUTF8OnStack"), AsciiToString = a((e) => { for (var t2 = ""; ; ) { var r2 = HEAPU8[e++]; if (!r2) return t2; t2 += String.fromCharCode(r2); } }, "AsciiToString"), stringToUTF16 = a((e, t2, r2) => { if (r2 ??= 2147483647, r2 < 2) return 0; r2 -= 2; for (var s = t2, n = r2 < e.length * 2 ? r2 / 2 : e.length, o = 0; o < n; ++o) { var l = e.charCodeAt(o); LE_HEAP_STORE_I16((t2 >> 1) * 2, l), t2 += 2; } return LE_HEAP_STORE_I16((t2 >> 1) * 2, 0), t2 - s; }, "stringToUTF16"); LE_ATOMICS_NATIVE_BYTE_ORDER = new Int8Array(new Int16Array([1]).buffer)[0] === 1 ? [((e) => e), ((e) => e), void 0, ((e) => e)] : [((e) => e), ((e) => ((e & 65280) << 8 | (e & 255) << 24) >> 16), void 0, ((e) => e >> 24 & 255 | e >> 8 & 65280 | (e & 65280) << 8 | (e & 255) << 24)]; function LE_HEAP_UPDATE() { HEAPU16.unsigned = ((e) => e & 65535), HEAPU32.unsigned = ((e) => e >>> 0); } if (a(LE_HEAP_UPDATE, "LE_HEAP_UPDATE"), initMemory(), Module.noExitRuntime && (noExitRuntime = Module.noExitRuntime), Module.print && (out = Module.print), Module.printErr && (err = Module.printErr), Module.dynamicLibraries && (dynamicLibraries = Module.dynamicLibraries), Module.wasmBinary && (wasmBinary = Module.wasmBinary), Module.arguments && (arguments_ = Module.arguments), Module.thisProgram && (thisProgram = Module.thisProgram), Module.preInit) for (typeof Module.preInit == "function" && (Module.preInit = [Module.preInit]); Module.preInit.length > 0; ) Module.preInit.shift()(); Module.setValue = setValue, Module.getValue = getValue, Module.UTF8ToString = UTF8ToString, Module.stringToUTF8 = stringToUTF8, Module.lengthBytesUTF8 = lengthBytesUTF8, Module.AsciiToString = AsciiToString, Module.stringToUTF16 = stringToUTF16, Module.loadWebAssemblyModule = loadWebAssemblyModule, Module.LE_HEAP_STORE_I64 = LE_HEAP_STORE_I64; var ASM_CONSTS = {}, _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs; function assignWasmExports(e) { Module._malloc = _malloc = e.malloc, Module._calloc = _calloc = e.calloc, Module._realloc = _realloc = e.realloc, Module._free = _free = e.free, Module._ts_range_edit = _ts_range_edit = e.ts_range_edit, Module._memcmp = _memcmp = e.memcmp, Module._ts_language_symbol_count = _ts_language_symbol_count = e.ts_language_symbol_count, Module._ts_language_state_count = _ts_language_state_count = e.ts_language_state_count, Module._ts_language_abi_version = _ts_language_abi_version = e.ts_language_abi_version, Module._ts_language_name = _ts_language_name = e.ts_language_name, Module._ts_language_field_count = _ts_language_field_count = e.ts_language_field_count, Module._ts_language_next_state = _ts_language_next_state = e.ts_language_next_state, Module._ts_language_symbol_name = _ts_language_symbol_name = e.ts_language_symbol_name, Module._ts_language_symbol_for_name = _ts_language_symbol_for_name = e.ts_language_symbol_for_name, Module._strncmp = _strncmp = e.strncmp, Module._ts_language_symbol_type = _ts_language_symbol_type = e.ts_language_symbol_type, Module._ts_language_field_name_for_id = _ts_language_field_name_for_id = e.ts_language_field_name_for_id, Module._ts_lookahead_iterator_new = _ts_lookahead_iterator_new = e.ts_lookahead_iterator_new, Module._ts_lookahead_iterator_delete = _ts_lookahead_iterator_delete = e.ts_lookahead_iterator_delete, Module._ts_lookahead_iterator_reset_state = _ts_lookahead_iterator_reset_state = e.ts_lookahead_iterator_reset_state, Module._ts_lookahead_iterator_reset = _ts_lookahead_iterator_reset = e.ts_lookahead_iterator_reset, Module._ts_lookahead_iterator_next = _ts_lookahead_iterator_next = e.ts_lookahead_iterator_next, Module._ts_lookahead_iterator_current_symbol = _ts_lookahead_iterator_current_symbol = e.ts_lookahead_iterator_current_symbol, Module._ts_point_edit = _ts_point_edit = e.ts_point_edit, Module._ts_parser_delete = _ts_parser_delete = e.ts_parser_delete, Module._ts_parser_reset = _ts_parser_reset = e.ts_parser_reset, Module._ts_parser_set_language = _ts_parser_set_language = e.ts_parser_set_language, Module._ts_parser_set_included_ranges = _ts_parser_set_included_ranges = e.ts_parser_set_included_ranges, Module._ts_query_new = _ts_query_new = e.ts_query_new, Module._ts_query_delete = _ts_query_delete = e.ts_query_delete, Module._iswspace = _iswspace = e.iswspace, Module._iswalnum = _iswalnum = e.iswalnum, Module._ts_query_pattern_count = _ts_query_pattern_count = e.ts_query_pattern_count, Module._ts_query_capture_count = _ts_query_capture_count = e.ts_query_capture_count, Module._ts_query_string_count = _ts_query_string_count = e.ts_query_string_count, Module._ts_query_capture_name_for_id = _ts_query_capture_name_for_id = e.ts_query_capture_name_for_id, Module._ts_query_capture_quantifier_for_id = _ts_query_capture_quantifier_for_id = e.ts_query_capture_quantifier_for_id, Module._ts_query_string_value_for_id = _ts_query_string_value_for_id = e.ts_query_string_value_for_id, Module._ts_query_predicates_for_pattern = _ts_query_predicates_for_pattern = e.ts_query_predicates_for_pattern, Module._ts_query_start_byte_for_pattern = _ts_query_start_byte_for_pattern = e.ts_query_start_byte_for_pattern, Module._ts_query_end_byte_for_pattern = _ts_query_end_byte_for_pattern = e.ts_query_end_byte_for_pattern, Module._ts_query_is_pattern_rooted = _ts_query_is_pattern_rooted = e.ts_query_is_pattern_rooted, Module._ts_query_is_pattern_non_local = _ts_query_is_pattern_non_local = e.ts_query_is_pattern_non_local, Module._ts_query_is_pattern_guaranteed_at_step = _ts_query_is_pattern_guaranteed_at_step = e.ts_query_is_pattern_guaranteed_at_step, Module._ts_query_disable_capture = _ts_query_disable_capture = e.ts_query_disable_capture, Module._ts_query_disable_pattern = _ts_query_disable_pattern = e.ts_query_disable_pattern, Module._ts_tree_copy = _ts_tree_copy = e.ts_tree_copy, Module._ts_tree_delete = _ts_tree_delete = e.ts_tree_delete, Module._ts_init = _ts_init = e.ts_init, Module._ts_parser_new_wasm = _ts_parser_new_wasm = e.ts_parser_new_wasm, Module._ts_parser_enable_logger_wasm = _ts_parser_enable_logger_wasm = e.ts_parser_enable_logger_wasm, Module._ts_parser_parse_wasm = _ts_parser_parse_wasm = e.ts_parser_parse_wasm, Module._ts_parser_included_ranges_wasm = _ts_parser_included_ranges_wasm = e.ts_parser_included_ranges_wasm, Module._ts_language_type_is_named_wasm = _ts_language_type_is_named_wasm = e.ts_language_type_is_named_wasm, Module._ts_language_type_is_visible_wasm = _ts_language_type_is_visible_wasm = e.ts_language_type_is_visible_wasm, Module._ts_language_metadata_wasm = _ts_language_metadata_wasm = e.ts_language_metadata_wasm, Module._ts_language_supertypes_wasm = _ts_language_supertypes_wasm = e.ts_language_supertypes_wasm, Module._ts_language_subtypes_wasm = _ts_language_subtypes_wasm = e.ts_language_subtypes_wasm, Module._ts_tree_root_node_wasm = _ts_tree_root_node_wasm = e.ts_tree_root_node_wasm, Module._ts_tree_root_node_with_offset_wasm = _ts_tree_root_node_with_offset_wasm = e.ts_tree_root_node_with_offset_wasm, Module._ts_tree_edit_wasm = _ts_tree_edit_wasm = e.ts_tree_edit_wasm, Module._ts_tree_included_ranges_wasm = _ts_tree_included_ranges_wasm = e.ts_tree_included_ranges_wasm, Module._ts_tree_get_changed_ranges_wasm = _ts_tree_get_changed_ranges_wasm = e.ts_tree_get_changed_ranges_wasm, Module._ts_tree_cursor_new_wasm = _ts_tree_cursor_new_wasm = e.ts_tree_cursor_new_wasm, Module._ts_tree_cursor_copy_wasm = _ts_tree_cursor_copy_wasm = e.ts_tree_cursor_copy_wasm, Module._ts_tree_cursor_delete_wasm = _ts_tree_cursor_delete_wasm = e.ts_tree_cursor_delete_wasm, Module._ts_tree_cursor_reset_wasm = _ts_tree_cursor_reset_wasm = e.ts_tree_cursor_reset_wasm, Module._ts_tree_cursor_reset_to_wasm = _ts_tree_cursor_reset_to_wasm = e.ts_tree_cursor_reset_to_wasm, Module._ts_tree_cursor_goto_first_child_wasm = _ts_tree_cursor_goto_first_child_wasm = e.ts_tree_cursor_goto_first_child_wasm, Module._ts_tree_cursor_goto_last_child_wasm = _ts_tree_cursor_goto_last_child_wasm = e.ts_tree_cursor_goto_last_child_wasm, Module._ts_tree_cursor_goto_first_child_for_index_wasm = _ts_tree_cursor_goto_first_child_for_index_wasm = e.ts_tree_cursor_goto_first_child_for_index_wasm, Module._ts_tree_cursor_goto_first_child_for_position_wasm = _ts_tree_cursor_goto_first_child_for_position_wasm = e.ts_tree_cursor_goto_first_child_for_position_wasm, Module._ts_tree_cursor_goto_next_sibling_wasm = _ts_tree_cursor_goto_next_sibling_wasm = e.ts_tree_cursor_goto_next_sibling_wasm, Module._ts_tree_cursor_goto_previous_sibling_wasm = _ts_tree_cursor_goto_previous_sibling_wasm = e.ts_tree_cursor_goto_previous_sibling_wasm, Module._ts_tree_cursor_goto_descendant_wasm = _ts_tree_cursor_goto_descendant_wasm = e.ts_tree_cursor_goto_descendant_wasm, Module._ts_tree_cursor_goto_parent_wasm = _ts_tree_cursor_goto_parent_wasm = e.ts_tree_cursor_goto_parent_wasm, Module._ts_tree_cursor_current_node_type_id_wasm = _ts_tree_cursor_current_node_type_id_wasm = e.ts_tree_cursor_current_node_type_id_wasm, Module._ts_tree_cursor_current_node_state_id_wasm = _ts_tree_cursor_current_node_state_id_wasm = e.ts_tree_cursor_current_node_state_id_wasm, Module._ts_tree_cursor_current_node_is_named_wasm = _ts_tree_cursor_current_node_is_named_wasm = e.ts_tree_cursor_current_node_is_named_wasm, Module._ts_tree_cursor_current_node_is_missing_wasm = _ts_tree_cursor_current_node_is_missing_wasm = e.ts_tree_cursor_current_node_is_missing_wasm, Module._ts_tree_cursor_current_node_id_wasm = _ts_tree_cursor_current_node_id_wasm = e.ts_tree_cursor_current_node_id_wasm, Module._ts_tree_cursor_start_position_wasm = _ts_tree_cursor_start_position_wasm = e.ts_tree_cursor_start_position_wasm, Module._ts_tree_cursor_end_position_wasm = _ts_tree_cursor_end_position_wasm = e.ts_tree_cursor_end_position_wasm, Module._ts_tree_cursor_start_index_wasm = _ts_tree_cursor_start_index_wasm = e.ts_tree_cursor_start_index_wasm, Module._ts_tree_cursor_end_index_wasm = _ts_tree_cursor_end_index_wasm = e.ts_tree_cursor_end_index_wasm, Module._ts_tree_cursor_current_field_id_wasm = _ts_tree_cursor_current_field_id_wasm = e.ts_tree_cursor_current_field_id_wasm, Module._ts_tree_cursor_current_depth_wasm = _ts_tree_cursor_current_depth_wasm = e.ts_tree_cursor_current_depth_wasm, Module._ts_tree_cursor_current_descendant_index_wasm = _ts_tree_cursor_current_descendant_index_wasm = e.ts_tree_cursor_current_descendant_index_wasm, Module._ts_tree_cursor_current_node_wasm = _ts_tree_cursor_current_node_wasm = e.ts_tree_cursor_current_node_wasm, Module._ts_node_symbol_wasm = _ts_node_symbol_wasm = e.ts_node_symbol_wasm, Module._ts_node_field_name_for_child_wasm = _ts_node_field_name_for_child_wasm = e.ts_node_field_name_for_child_wasm, Module._ts_node_field_name_for_named_child_wasm = _ts_node_field_name_for_named_child_wasm = e.ts_node_field_name_for_named_child_wasm, Module._ts_node_children_by_field_id_wasm = _ts_node_children_by_field_id_wasm = e.ts_node_children_by_field_id_wasm, Module._ts_node_first_child_for_byte_wasm = _ts_node_first_child_for_byte_wasm = e.ts_node_first_child_for_byte_wasm, Module._ts_node_first_named_child_for_byte_wasm = _ts_node_first_named_child_for_byte_wasm = e.ts_node_first_named_child_for_byte_wasm, Module._ts_node_grammar_symbol_wasm = _ts_node_grammar_symbol_wasm = e.ts_node_grammar_symbol_wasm, Module._ts_node_child_count_wasm = _ts_node_child_count_wasm = e.ts_node_child_count_wasm, Module._ts_node_named_child_count_wasm = _ts_node_named_child_count_wasm = e.ts_node_named_child_count_wasm, Module._ts_node_child_wasm = _ts_node_child_wasm = e.ts_node_child_wasm, Module._ts_node_named_child_wasm = _ts_node_named_child_wasm = e.ts_node_named_child_wasm, Module._ts_node_child_by_field_id_wasm = _ts_node_child_by_field_id_wasm = e.ts_node_child_by_field_id_wasm, Module._ts_node_next_sibling_wasm = _ts_node_next_sibling_wasm = e.ts_node_next_sibling_wasm, Module._ts_node_prev_sibling_wasm = _ts_node_prev_sibling_wasm = e.ts_node_prev_sibling_wasm, Module._ts_node_next_named_sibling_wasm = _ts_node_next_named_sibling_wasm = e.ts_node_next_named_sibling_wasm, Module._ts_node_prev_named_sibling_wasm = _ts_node_prev_named_sibling_wasm = e.ts_node_prev_named_sibling_wasm, Module._ts_node_descendant_count_wasm = _ts_node_descendant_count_wasm = e.ts_node_descendant_count_wasm, Module._ts_node_parent_wasm = _ts_node_parent_wasm = e.ts_node_parent_wasm, Module._ts_node_child_with_descendant_wasm = _ts_node_child_with_descendant_wasm = e.ts_node_child_with_descendant_wasm, Module._ts_node_descendant_for_index_wasm = _ts_node_descendant_for_index_wasm = e.ts_node_descendant_for_index_wasm, Module._ts_node_named_descendant_for_index_wasm = _ts_node_named_descendant_for_index_wasm = e.ts_node_named_descendant_for_index_wasm, Module._ts_node_descendant_for_position_wasm = _ts_node_descendant_for_position_wasm = e.ts_node_descendant_for_position_wasm, Module._ts_node_named_descendant_for_position_wasm = _ts_node_named_descendant_for_position_wasm = e.ts_node_named_descendant_for_position_wasm, Module._ts_node_start_point_wasm = _ts_node_start_point_wasm = e.ts_node_start_point_wasm, Module._ts_node_end_point_wasm = _ts_node_end_point_wasm = e.ts_node_end_point_wasm, Module._ts_node_start_index_wasm = _ts_node_start_index_wasm = e.ts_node_start_index_wasm, Module._ts_node_end_index_wasm = _ts_node_end_index_wasm = e.ts_node_end_index_wasm, Module._ts_node_to_string_wasm = _ts_node_to_string_wasm = e.ts_node_to_string_wasm, Module._ts_node_children_wasm = _ts_node_children_wasm = e.ts_node_children_wasm, Module._ts_node_named_children_wasm = _ts_node_named_children_wasm = e.ts_node_named_children_wasm, Module._ts_node_descendants_of_type_wasm = _ts_node_descendants_of_type_wasm = e.ts_node_descendants_of_type_wasm, Module._ts_node_is_named_wasm = _ts_node_is_named_wasm = e.ts_node_is_named_wasm, Module._ts_node_has_changes_wasm = _ts_node_has_changes_wasm = e.ts_node_has_changes_wasm, Module._ts_node_has_error_wasm = _ts_node_has_error_wasm = e.ts_node_has_error_wasm, Module._ts_node_is_error_wasm = _ts_node_is_error_wasm = e.ts_node_is_error_wasm, Module._ts_node_is_missing_wasm = _ts_node_is_missing_wasm = e.ts_node_is_missing_wasm, Module._ts_node_is_extra_wasm = _ts_node_is_extra_wasm = e.ts_node_is_extra_wasm, Module._ts_node_parse_state_wasm = _ts_node_parse_state_wasm = e.ts_node_parse_state_wasm, Module._ts_node_next_parse_state_wasm = _ts_node_next_parse_state_wasm = e.ts_node_next_parse_state_wasm, Module._ts_query_matches_wasm = _ts_query_matches_wasm = e.ts_query_matches_wasm, Module._ts_query_captures_wasm = _ts_query_captures_wasm = e.ts_query_captures_wasm, Module._memset = _memset = e.memset, Module._memcpy = _memcpy = e.memcpy, Module._memmove = _memmove = e.memmove, Module._iswalpha = _iswalpha = e.iswalpha, Module._iswblank = _iswblank = e.iswblank, Module._iswdigit = _iswdigit = e.iswdigit, Module._iswlower = _iswlower = e.iswlower, Module._iswupper = _iswupper = e.iswupper, Module._iswxdigit = _iswxdigit = e.iswxdigit, Module._memchr = _memchr = e.memchr, Module._strlen = _strlen = e.strlen, Module._strcmp = _strcmp = e.strcmp, Module._strncat = _strncat = e.strncat, Module._strncpy = _strncpy = e.strncpy, Module._towlower = _towlower = e.towlower, Module._towupper = _towupper = e.towupper, _setThrew = e.setThrew, __emscripten_stack_restore = e._emscripten_stack_restore, __emscripten_stack_alloc = e._emscripten_stack_alloc, _emscripten_stack_get_current = e.emscripten_stack_get_current, ___wasm_apply_data_relocs = e.__wasm_apply_data_relocs; } a(assignWasmExports, "assignWasmExports"); var wasmImports = { __heap_base: ___heap_base, __indirect_function_table: wasmTable, __memory_base: ___memory_base, __stack_high: ___stack_high, __stack_low: ___stack_low, __stack_pointer: ___stack_pointer, __table_base: ___table_base, _abort_js: __abort_js, emscripten_resize_heap: _emscripten_resize_heap, fd_close: _fd_close, fd_seek: _fd_seek, fd_write: _fd_write, memory: wasmMemory, tree_sitter_log_callback: _tree_sitter_log_callback, tree_sitter_parse_callback: _tree_sitter_parse_callback, tree_sitter_progress_callback: _tree_sitter_progress_callback, tree_sitter_query_progress_callback: _tree_sitter_query_progress_callback }; function callMain(e = []) { var t2 = resolveGlobalSymbol("main").sym; if (t2) { e.unshift(thisProgram); var r2 = e.length, s = stackAlloc((r2 + 1) * 4), n = s; e.forEach((l) => { LE_HEAP_STORE_U32((n >> 2) * 4, stringToUTF8OnStack(l)), n += 4; }), LE_HEAP_STORE_U32((n >> 2) * 4, 0); try { var o = t2(r2, s); return exitJS(o, !0), o; } catch (l) { return handleException(l); } } } a(callMain, "callMain"); function run(e = arguments_) { if (runDependencies > 0) { dependenciesFulfilled = run; return; } if (preRun(), runDependencies > 0) { dependenciesFulfilled = run; return; } function t2() { if (Module.calledRun = !0, !ABORT) { initRuntime(), readyPromiseResolve?.(Module), Module.onRuntimeInitialized?.(); var r2 = Module.noInitialRun || !1; r2 || callMain(e), postRun(); } } a(t2, "doRun"), Module.setStatus ? (Module.setStatus("Running..."), setTimeout(() => { setTimeout(() => Module.setStatus(""), 1), t2(); }, 1)) : t2(); } a(run, "run"); var wasmExports; return wasmExports = await createWasm(), run(), runtimeInitialized ? moduleRtn = Module : moduleRtn = new Promise((e, t2) => { readyPromiseResolve = e, readyPromiseReject = t2; }), moduleRtn; } async function be(e) { return pe ??= await xe(e); } function ve() { return !!pe; } function Pe(e, t2, r2, s) { if (e.length !== 3) throw new Error(`Wrong number of arguments to \`#${r2}\` predicate. Expected 2, got ${e.length - 1}`); if (!ue(e[1])) throw new Error(`First argument of \`#${r2}\` predicate must be a capture. Got "${e[1].value}"`); let n = r2 === "eq?" || r2 === "any-eq?", o = !r2.startsWith("any-"); if (ue(e[2])) { let l = e[1].name, d3 = e[2].name; s[t2].push((m3) => { let g4 = [], f4 = []; for (let b4 of m3) b4.name === l && g4.push(b4.node), b4.name === d3 && f4.push(b4.node); let y4 = a((b4, v4, T5) => T5 ? b4.text === v4.text : b4.text !== v4.text, "compare"); return o ? g4.every((b4) => f4.some((v4) => y4(b4, v4, n))) : g4.some((b4) => f4.some((v4) => y4(b4, v4, n))); }); } else { let l = e[1].name, d3 = e[2].value, m3 = a((f4) => f4.text === d3, "matches"), g4 = a((f4) => f4.text !== d3, "doesNotMatch"); s[t2].push((f4) => { let y4 = []; for (let v4 of f4) v4.name === l && y4.push(v4.node); let b4 = n ? m3 : g4; return o ? y4.every(b4) : y4.some(b4); }); } } function Me(e, t2, r2, s) { if (e.length !== 3) throw new Error(`Wrong number of arguments to \`#${r2}\` predicate. Expected 2, got ${e.length - 1}.`); if (e[1].type !== "capture") throw new Error(`First argument of \`#${r2}\` predicate must be a capture. Got "${e[1].value}".`); if (e[2].type !== "string") throw new Error(`Second argument of \`#${r2}\` predicate must be a string. Got @${e[2].name}.`); let n = r2 === "match?" || r2 === "any-match?", o = !r2.startsWith("any-"), l = e[1].name, d3 = new RegExp(e[2].value); s[t2].push((m3) => { let g4 = []; for (let y4 of m3) y4.name === l && g4.push(y4.node.text); let f4 = a((y4, b4) => b4 ? d3.test(y4) : !d3.test(y4), "test"); return g4.length === 0 ? !n : o ? g4.every((y4) => f4(y4, n)) : g4.some((y4) => f4(y4, n)); }); } function Ee(e, t2, r2, s) { if (e.length < 2) throw new Error(`Wrong number of arguments to \`#${r2}\` predicate. Expected at least 1. Got ${e.length - 1}.`); if (e[1].type !== "capture") throw new Error(`First argument of \`#${r2}\` predicate must be a capture. Got "${e[1].value}".`); let n = r2 === "any-of?", o = e[1].name, l = e.slice(2); if (!l.every(ne)) throw new Error(`Arguments to \`#${r2}\` predicate must be strings.".`); let d3 = l.map((m3) => m3.value); s[t2].push((m3) => { let g4 = []; for (let f4 of m3) f4.name === o && g4.push(f4.node.text); return g4.length === 0 ? !n : g4.every((f4) => d3.includes(f4)) === n; }); } function Ie(e, t2, r2, s, n) { if (e.length < 2 || e.length > 3) throw new Error(`Wrong number of arguments to \`#${r2}\` predicate. Expected 1 or 2. Got ${e.length - 1}.`); if (!e.every(ne)) throw new Error(`Arguments to \`#${r2}\` predicate must be strings.".`); let o = r2 === "is?" ? s : n; o[t2] || (o[t2] = {}), o[t2][e[1].value] = e[2]?.value ?? null; } function Te(e, t2, r2) { if (e.length < 2 || e.length > 3) throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length - 1}.`); if (!e.every(ne)) throw new Error('Arguments to `#set!` predicate must be strings.".'); r2[t2] || (r2[t2] = {}), r2[t2][e[1].value] = e[2]?.value ?? null; } function Se(e, t2, r2, s, n, o, l, d3, m3, g4, f4) { if (t2 === Ve) { let y4 = s[r2]; o.push({ type: "capture", name: y4 }); } else if (t2 === De) o.push({ type: "string", value: n[r2] }); else if (o.length > 0) { if (o[0].type !== "string") throw new Error("Predicates must begin with a literal value"); let y4 = o[0].value; switch (y4) { case "any-not-eq?": case "not-eq?": case "any-eq?": case "eq?": Pe(o, e, y4, l); break; case "any-not-match?": case "not-match?": case "any-match?": case "match?": Me(o, e, y4, l); break; case "not-any-of?": case "any-of?": Ee(o, e, y4, l); break; case "is?": case "is-not?": Ie(o, e, y4, g4, f4); break; case "set!": Te(o, e, m3); break; default: d3[e].push({ operator: y4, operands: o.slice(1) }); } o.length = 0; } } async function ie(e) { let t2 = [Re(new URL(`./assets/${e.fileName}`, import.meta.url)), Re(new URL(Be[e.id], import.meta.url))]; for (let r2 of t2) try { return await qe(r2), r2; } catch { } throw new Error(`Policy parser asset is unavailable: ${e.id}`); } function oe(e) { return e instanceof URL ? e.toString() : e; } async function $e(e) { X || (X = (async () => { let t2 = oe(await (e ?? ie)(ae["tree-sitter-runtime"])); t2 instanceof Uint8Array ? await K.init({ wasmBinary: t2 }) : await K.init({ locateFile: () => t2 }); })(), X.catch(() => { X = void 0; })), await X; } function je(e) { if (!e) return Ge; let t2 = Le.get(e); return t2 || (t2 = /* @__PURE__ */ new Map(), Le.set(e, t2)), t2; } async function ze(e, t2) { let r2 = je(t2), s = r2.get(e); return s || (s = (async () => { await $e(t2); let n = oe(await (t2 ?? ie)(ae[e])); return se.load(n); })(), r2.set(e, s), s.catch(() => r2.delete(e))), s; } async function it(e, t2) { let r2 = await ze(e, t2), s = new K(); try { s.setLanguage(r2); } catch (n) { throw s.delete(), n; } return { parser: s, parse(n) { return s.reset(), s.parse(n); }, dispose() { s.delete(); } }; } async function ot(e, t2) { let r2 = oe(await (e ?? ie)(ae[t2])); return r2 instanceof Uint8Array ? r2 : We(r2); } var ke, a, Xe, de, c, Z, L, x, Q, R, D, _, Ce, Fe, Oe, Ne, Ue, se, xe, pe, u, J, ee, K, Ve, De, He, Ye, ue, ne, O, j, Ke, ae, Be, X, Ge, Le, init_tree_sitter_runtime = __esm({ "node_modules/@at-series/command-policy/dist/tree-sitter-runtime.js"() { ke = Object.defineProperty, a = (e, t2) => ke(e, "name", { value: t2, configurable: !0 }), Xe = class { static { a(this, "Edit"); } startPosition; oldEndPosition; newEndPosition; startIndex; oldEndIndex; newEndIndex; constructor({ startIndex: e, oldEndIndex: t2, newEndIndex: r2, startPosition: s, oldEndPosition: n, newEndPosition: o }) { this.startIndex = e >>> 0, this.oldEndIndex = t2 >>> 0, this.newEndIndex = r2 >>> 0, this.startPosition = s, this.oldEndPosition = n, this.newEndPosition = o; } editPoint(e, t2) { let r2 = t2, s = { ...e }; if (t2 >= this.oldEndIndex) { r2 = this.newEndIndex + (t2 - this.oldEndIndex); let n = e.row; s.row = this.newEndPosition.row + (e.row - this.oldEndPosition.row), s.column = n === this.oldEndPosition.row ? this.newEndPosition.column + (e.column - this.oldEndPosition.column) : e.column; } else t2 > this.startIndex && (r2 = this.newEndIndex, s.row = this.newEndPosition.row, s.column = this.newEndPosition.column); return { point: s, index: r2 }; } editRange(e) { let t2 = { startIndex: e.startIndex, startPosition: { ...e.startPosition }, endIndex: e.endIndex, endPosition: { ...e.endPosition } }; return e.endIndex >= this.oldEndIndex ? e.endIndex !== Number.MAX_SAFE_INTEGER && (t2.endIndex = this.newEndIndex + (e.endIndex - this.oldEndIndex), t2.endPosition = { row: this.newEndPosition.row + (e.endPosition.row - this.oldEndPosition.row), column: e.endPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (e.endPosition.column - this.oldEndPosition.column) : e.endPosition.column }, t2.endIndex < this.newEndIndex && (t2.endIndex = Number.MAX_SAFE_INTEGER, t2.endPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER })) : e.endIndex > this.startIndex && (t2.endIndex = this.startIndex, t2.endPosition = { ...this.startPosition }), e.startIndex >= this.oldEndIndex ? (t2.startIndex = this.newEndIndex + (e.startIndex - this.oldEndIndex), t2.startPosition = { row: this.newEndPosition.row + (e.startPosition.row - this.oldEndPosition.row), column: e.startPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (e.startPosition.column - this.oldEndPosition.column) : e.startPosition.column }, t2.startIndex < this.newEndIndex && (t2.startIndex = Number.MAX_SAFE_INTEGER, t2.startPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER })) : e.startIndex > this.startIndex && (t2.startIndex = this.startIndex, t2.startPosition = { ...this.startPosition }), t2; } }, de = 2, c = 4, Z = 4 * c, L = 5 * c, x = 2 * c, Q = 2 * c + 2 * x, R = { row: 0, column: 0 }, D = Symbol("INTERNAL"); a($, "assertInternal"); a(z, "isPoint"); a(ce, "setModule"); Ce = class { static { a(this, "LookaheadIterator"); } 0 = 0; language; constructor(e, t2, r2) { $(e), this[0] = t2, this.language = r2; } get currentTypeId() { return _._ts_lookahead_iterator_current_symbol(this[0]); } get currentType() { return this.language.types[this.currentTypeId] || "ERROR"; } delete() { _._ts_lookahead_iterator_delete(this[0]), this[0] = 0; } reset(e, t2) { return _._ts_lookahead_iterator_reset(this[0], e[0], t2) ? (this.language = e, !0) : !1; } resetState(e) { return !!_._ts_lookahead_iterator_reset_state(this[0], e); } [Symbol.iterator]() { return { next: a(() => _._ts_lookahead_iterator_next(this[0]) ? { done: !1, value: this.currentType } : { done: !0, value: "" }, "next") }; } }; a(_e, "getText"); Fe = class te { static { a(this, "Tree"); } 0 = 0; textCallback; language; constructor(t2, r2, s, n) { $(t2), this[0] = r2, this.language = s, this.textCallback = n; } copy() { let t2 = _._ts_tree_copy(this[0]); return new te(D, t2, this.language, this.textCallback); } delete() { _._ts_tree_delete(this[0]), this[0] = 0; } get rootNode() { return _._ts_tree_root_node_wasm(this[0]), E(this); } rootNodeWithOffset(t2, r2) { let s = u + L; return _.setValue(s, t2, "i32"), F(s + c, r2), _._ts_tree_root_node_with_offset_wasm(this[0]), E(this); } edit(t2) { he(t2), _._ts_tree_edit_wasm(this[0]); } walk() { return this.rootNode.walk(); } getChangedRanges(t2) { if (!(t2 instanceof te)) throw new TypeError("Argument must be a Tree"); _._ts_tree_get_changed_ranges_wasm(this[0], t2[0]); let r2 = _.getValue(u, "i32"), s = _.getValue(u + c, "i32"), n = new Array(r2); if (r2 > 0) { let o = s; for (let l = 0; l < r2; l++) n[l] = Y(o), o += Q; _._free(s); } return n; } getIncludedRanges() { _._ts_tree_included_ranges_wasm(this[0]); let t2 = _.getValue(u, "i32"), r2 = _.getValue(u + c, "i32"), s = new Array(t2); if (t2 > 0) { let n = r2; for (let o = 0; o < t2; o++) s[o] = Y(n), n += Q; _._free(r2); } return s; } }, Oe = class me { static { a(this, "TreeCursor"); } 0 = 0; 1 = 0; 2 = 0; 3 = 0; tree; constructor(t2, r2) { $(t2), this.tree = r2, C(this); } copy() { let t2 = new me(D, this.tree); return _._ts_tree_cursor_copy_wasm(this.tree[0]), C(t2), t2; } delete() { A(this), _._ts_tree_cursor_delete_wasm(this.tree[0]), this[0] = this[1] = this[2] = 0; } get currentNode() { return A(this), _._ts_tree_cursor_current_node_wasm(this.tree[0]), E(this.tree); } get currentFieldId() { return A(this), _._ts_tree_cursor_current_field_id_wasm(this.tree[0]); } get currentFieldName() { return this.tree.language.fields[this.currentFieldId]; } get currentDepth() { return A(this), _._ts_tree_cursor_current_depth_wasm(this.tree[0]); } get currentDescendantIndex() { return A(this), _._ts_tree_cursor_current_descendant_index_wasm(this.tree[0]); } get nodeType() { return this.tree.language.types[this.nodeTypeId] || "ERROR"; } get nodeTypeId() { return A(this), _._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]); } get nodeStateId() { return A(this), _._ts_tree_cursor_current_node_state_id_wasm(this.tree[0]); } get nodeId() { return A(this), _._ts_tree_cursor_current_node_id_wasm(this.tree[0]); } get nodeIsNamed() { return A(this), _._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]) === 1; } get nodeIsMissing() { return A(this), _._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]) === 1; } get nodeText() { A(this); let t2 = _._ts_tree_cursor_start_index_wasm(this.tree[0]), r2 = _._ts_tree_cursor_end_index_wasm(this.tree[0]); _._ts_tree_cursor_start_position_wasm(this.tree[0]); let s = B(u); return _e(this.tree, t2, r2, s); } get startPosition() { return A(this), _._ts_tree_cursor_start_position_wasm(this.tree[0]), B(u); } get endPosition() { return A(this), _._ts_tree_cursor_end_position_wasm(this.tree[0]), B(u); } get startIndex() { return A(this), _._ts_tree_cursor_start_index_wasm(this.tree[0]); } get endIndex() { return A(this), _._ts_tree_cursor_end_index_wasm(this.tree[0]); } gotoFirstChild() { A(this); let t2 = _._ts_tree_cursor_goto_first_child_wasm(this.tree[0]); return C(this), t2 === 1; } gotoLastChild() { A(this); let t2 = _._ts_tree_cursor_goto_last_child_wasm(this.tree[0]); return C(this), t2 === 1; } gotoParent() { A(this); let t2 = _._ts_tree_cursor_goto_parent_wasm(this.tree[0]); return C(this), t2 === 1; } gotoNextSibling() { A(this); let t2 = _._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]); return C(this), t2 === 1; } gotoPreviousSibling() { A(this); let t2 = _._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]); return C(this), t2 === 1; } gotoDescendant(t2) { A(this), _._ts_tree_cursor_goto_descendant_wasm(this.tree[0], t2), C(this); } gotoFirstChildForIndex(t2) { A(this), _.setValue(u + Z, t2, "i32"); let r2 = _._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]); return C(this), r2 === 1; } gotoFirstChildForPosition(t2) { A(this), F(u + Z, t2); let r2 = _._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]); return C(this), r2 === 1; } reset(t2) { w(t2), A(this, u + L), _._ts_tree_cursor_reset_wasm(this.tree[0]), C(this); } resetTo(t2) { A(this, u), A(t2, u + Z), _._ts_tree_cursor_reset_to_wasm(this.tree[0], t2.tree[0]), C(this); } }, Ne = class { static { a(this, "Node"); } 0 = 0; _children; _namedChildren; constructor(e, { id: t2, tree: r2, startIndex: s, startPosition: n, other: o }) { $(e), this[0] = o, this.id = t2, this.tree = r2, this.startIndex = s, this.startPosition = n; } id; startIndex; startPosition; tree; get typeId() { return w(this), _._ts_node_symbol_wasm(this.tree[0]); } get grammarId() { return w(this), _._ts_node_grammar_symbol_wasm(this.tree[0]); } get type() { return this.tree.language.types[this.typeId] || "ERROR"; } get grammarType() { return this.tree.language.types[this.grammarId] || "ERROR"; } get isNamed() { return w(this), _._ts_node_is_named_wasm(this.tree[0]) === 1; } get isExtra() { return w(this), _._ts_node_is_extra_wasm(this.tree[0]) === 1; } get isError() { return w(this), _._ts_node_is_error_wasm(this.tree[0]) === 1; } get isMissing() { return w(this), _._ts_node_is_missing_wasm(this.tree[0]) === 1; } get hasChanges() { return w(this), _._ts_node_has_changes_wasm(this.tree[0]) === 1; } get hasError() { return w(this), _._ts_node_has_error_wasm(this.tree[0]) === 1; } get endIndex() { return w(this), _._ts_node_end_index_wasm(this.tree[0]); } get endPosition() { return w(this), _._ts_node_end_point_wasm(this.tree[0]), B(u); } get text() { return _e(this.tree, this.startIndex, this.endIndex, this.startPosition); } get parseState() { return w(this), _._ts_node_parse_state_wasm(this.tree[0]); } get nextParseState() { return w(this), _._ts_node_next_parse_state_wasm(this.tree[0]); } equals(e) { return this.tree === e.tree && this.id === e.id; } child(e) { return w(this), _._ts_node_child_wasm(this.tree[0], e), E(this.tree); } namedChild(e) { return w(this), _._ts_node_named_child_wasm(this.tree[0], e), E(this.tree); } childForFieldId(e) { return w(this), _._ts_node_child_by_field_id_wasm(this.tree[0], e), E(this.tree); } childForFieldName(e) { let t2 = this.tree.language.fields.indexOf(e); return t2 !== -1 ? this.childForFieldId(t2) : null; } fieldNameForChild(e) { w(this); let t2 = _._ts_node_field_name_for_child_wasm(this.tree[0], e); return t2 ? _.AsciiToString(t2) : null; } fieldNameForNamedChild(e) { w(this); let t2 = _._ts_node_field_name_for_named_child_wasm(this.tree[0], e); return t2 ? _.AsciiToString(t2) : null; } childrenForFieldName(e) { let t2 = this.tree.language.fields.indexOf(e); return t2 !== -1 && t2 !== 0 ? this.childrenForFieldId(t2) : []; } childrenForFieldId(e) { w(this), _._ts_node_children_by_field_id_wasm(this.tree[0], e); let t2 = _.getValue(u, "i32"), r2 = _.getValue(u + c, "i32"), s = new Array(t2); if (t2 > 0) { let n = r2; for (let o = 0; o < t2; o++) s[o] = E(this.tree, n), n += L; _._free(r2); } return s; } firstChildForIndex(e) { w(this); let t2 = u + L; return _.setValue(t2, e, "i32"), _._ts_node_first_child_for_byte_wasm(this.tree[0]), E(this.tree); } firstNamedChildForIndex(e) { w(this); let t2 = u + L; return _.setValue(t2, e, "i32"), _._ts_node_first_named_child_for_byte_wasm(this.tree[0]), E(this.tree); } get childCount() { return w(this), _._ts_node_child_count_wasm(this.tree[0]); } get namedChildCount() { return w(this), _._ts_node_named_child_count_wasm(this.tree[0]); } get firstChild() { return this.child(0); } get firstNamedChild() { return this.namedChild(0); } get lastChild() { return this.child(this.childCount - 1); } get lastNamedChild() { return this.namedChild(this.namedChildCount - 1); } get children() { if (!this._children) { w(this), _._ts_node_children_wasm(this.tree[0]); let e = _.getValue(u, "i32"), t2 = _.getValue(u + c, "i32"); if (this._children = new Array(e), e > 0) { let r2 = t2; for (let s = 0; s < e; s++) this._children[s] = E(this.tree, r2), r2 += L; _._free(t2); } } return this._children; } get namedChildren() { if (!this._namedChildren) { w(this), _._ts_node_named_children_wasm(this.tree[0]); let e = _.getValue(u, "i32"), t2 = _.getValue(u + c, "i32"); if (this._namedChildren = new Array(e), e > 0) { let r2 = t2; for (let s = 0; s < e; s++) this._namedChildren[s] = E(this.tree, r2), r2 += L; _._free(t2); } } return this._namedChildren; } descendantsOfType(e, t2 = R, r2 = R) { Array.isArray(e) || (e = [e]); let s = [], n = this.tree.language.types; for (let g4 of e) g4 == "ERROR" && s.push(65535); for (let g4 = 0, f4 = n.length; g4 < f4; g4++) e.includes(n[g4]) && s.push(g4); let o = _._malloc(c * s.length); for (let g4 = 0, f4 = s.length; g4 < f4; g4++) _.setValue(o + g4 * c, s[g4], "i32"); w(this), _._ts_node_descendants_of_type_wasm(this.tree[0], o, s.length, t2.row, t2.column, r2.row, r2.column); let l = _.getValue(u, "i32"), d3 = _.getValue(u + c, "i32"), m3 = new Array(l); if (l > 0) { let g4 = d3; for (let f4 = 0; f4 < l; f4++) m3[f4] = E(this.tree, g4), g4 += L; } return _._free(d3), _._free(o), m3; } get nextSibling() { return w(this), _._ts_node_next_sibling_wasm(this.tree[0]), E(this.tree); } get previousSibling() { return w(this), _._ts_node_prev_sibling_wasm(this.tree[0]), E(this.tree); } get nextNamedSibling() { return w(this), _._ts_node_next_named_sibling_wasm(this.tree[0]), E(this.tree); } get previousNamedSibling() { return w(this), _._ts_node_prev_named_sibling_wasm(this.tree[0]), E(this.tree); } get descendantCount() { return w(this), _._ts_node_descendant_count_wasm(this.tree[0]); } get parent() { return w(this), _._ts_node_parent_wasm(this.tree[0]), E(this.tree); } childWithDescendant(e) { return w(this), w(e, 1), _._ts_node_child_with_descendant_wasm(this.tree[0]), E(this.tree); } descendantForIndex(e, t2 = e) { if (typeof e != "number" || typeof t2 != "number") throw new Error("Arguments must be numbers"); w(this); let r2 = u + L; return _.setValue(r2, e, "i32"), _.setValue(r2 + c, t2, "i32"), _._ts_node_descendant_for_index_wasm(this.tree[0]), E(this.tree); } namedDescendantForIndex(e, t2 = e) { if (typeof e != "number" || typeof t2 != "number") throw new Error("Arguments must be numbers"); w(this); let r2 = u + L; return _.setValue(r2, e, "i32"), _.setValue(r2 + c, t2, "i32"), _._ts_node_named_descendant_for_index_wasm(this.tree[0]), E(this.tree); } descendantForPosition(e, t2 = e) { if (!z(e) || !z(t2)) throw new Error("Arguments must be {row, column} objects"); w(this); let r2 = u + L; return F(r2, e), F(r2 + x, t2), _._ts_node_descendant_for_position_wasm(this.tree[0]), E(this.tree); } namedDescendantForPosition(e, t2 = e) { if (!z(e) || !z(t2)) throw new Error("Arguments must be {row, column} objects"); w(this); let r2 = u + L; return F(r2, e), F(r2 + x, t2), _._ts_node_named_descendant_for_position_wasm(this.tree[0]), E(this.tree); } walk() { return w(this), _._ts_tree_cursor_new_wasm(this.tree[0]), new Oe(D, this.tree); } edit(e) { if (this.startIndex >= e.oldEndIndex) { this.startIndex = e.newEndIndex + (this.startIndex - e.oldEndIndex); let t2, r2; this.startPosition.row > e.oldEndPosition.row ? (t2 = this.startPosition.row - e.oldEndPosition.row, r2 = this.startPosition.column) : (t2 = 0, r2 = this.startPosition.column, this.startPosition.column >= e.oldEndPosition.column && (r2 = this.startPosition.column - e.oldEndPosition.column)), t2 > 0 ? (this.startPosition.row += t2, this.startPosition.column = r2) : this.startPosition.column += r2; } else this.startIndex > e.startIndex && (this.startIndex = e.newEndIndex, this.startPosition.row = e.newEndPosition.row, this.startPosition.column = e.newEndPosition.column); } toString() { w(this); let e = _._ts_node_to_string_wasm(this.tree[0]), t2 = _.AsciiToString(e); return _._free(e), t2; } }; a(re, "unmarshalCaptures"); a(w, "marshalNode"); a(E, "unmarshalNode"); a(A, "marshalTreeCursor"); a(C, "unmarshalTreeCursor"); a(F, "marshalPoint"); a(B, "unmarshalPoint"); a(ge, "marshalRange"); a(Y, "unmarshalRange"); a(he, "marshalEdit"); a(fe, "unmarshalLanguageMetadata"); Ue = /^tree_sitter_\w+$/, se = class we { static { a(this, "Language"); } 0 = 0; types; fields; constructor(t2, r2) { $(t2), this[0] = r2, this.types = new Array(_._ts_language_symbol_count(this[0])); for (let s = 0, n = this.types.length; s < n; s++) _._ts_language_symbol_type(this[0], s) < 2 && (this.types[s] = _.UTF8ToString(_._ts_language_symbol_name(this[0], s))); this.fields = new Array(_._ts_language_field_count(this[0]) + 1); for (let s = 0, n = this.fields.length; s < n; s++) { let o = _._ts_language_field_name_for_id(this[0], s); o !== 0 ? this.fields[s] = _.UTF8ToString(o) : this.fields[s] = null; } } get name() { let t2 = _._ts_language_name(this[0]); return t2 === 0 ? null : _.UTF8ToString(t2); } get abiVersion() { return _._ts_language_abi_version(this[0]); } get metadata() { return _._ts_language_metadata_wasm(this[0]), _.getValue(u, "i32") === 0 ? null : fe(u + c); } get fieldCount() { return this.fields.length - 1; } get stateCount() { return _._ts_language_state_count(this[0]); } fieldIdForName(t2) { let r2 = this.fields.indexOf(t2); return r2 !== -1 ? r2 : null; } fieldNameForId(t2) { return this.fields[t2] ?? null; } idForNodeType(t2, r2) { let s = _.lengthBytesUTF8(t2), n = _._malloc(s + 1); _.stringToUTF8(t2, n, s + 1); let o = _._ts_language_symbol_for_name(this[0], n, s, r2 ? 1 : 0); return _._free(n), o || null; } get nodeTypeCount() { return _._ts_language_symbol_count(this[0]); } nodeTypeForId(t2) { let r2 = _._ts_language_symbol_name(this[0], t2); return r2 ? _.UTF8ToString(r2) : null; } nodeTypeIsNamed(t2) { return !!_._ts_language_type_is_named_wasm(this[0], t2); } nodeTypeIsVisible(t2) { return !!_._ts_language_type_is_visible_wasm(this[0], t2); } get supertypes() { _._ts_language_supertypes_wasm(this[0]); let t2 = _.getValue(u, "i32"), r2 = _.getValue(u + c, "i32"), s = new Array(t2); if (t2 > 0) { let n = r2; for (let o = 0; o < t2; o++) s[o] = _.getValue(n, "i16"), n += de; } return s; } subtypes(t2) { _._ts_language_subtypes_wasm(this[0], t2); let r2 = _.getValue(u, "i32"), s = _.getValue(u + c, "i32"), n = new Array(r2); if (r2 > 0) { let o = s; for (let l = 0; l < r2; l++) n[l] = _.getValue(o, "i16"), o += de; } return n; } nextState(t2, r2) { return _._ts_language_next_state(this[0], t2, r2); } lookaheadIterator(t2) { let r2 = _._ts_lookahead_iterator_new(this[0], t2); return r2 ? new Ce(D, r2, this) : null; } static async load(t2) { let r2; if (t2 instanceof Uint8Array) r2 = t2; else if (globalThis.process?.versions.node) r2 = await (await import("node:fs/promises")).readFile(t2); else { let d3 = await fetch(t2); if (!d3.ok) { let g4 = await d3.text(); throw new Error(`Language.load failed with status ${d3.status}. ${g4}`); } let m3 = d3.clone(); try { r2 = await WebAssembly.compileStreaming(d3); } catch (g4) { console.error("wasm streaming compile failed:", g4), console.error("falling back to ArrayBuffer instantiation"), r2 = new Uint8Array(await m3.arrayBuffer()); } } let s = await _.loadWebAssemblyModule(r2, { loadAsync: !0 }), n = Object.keys(s), o = n.find((d3) => Ue.test(d3) && !d3.includes("external_scanner_")); if (!o) throw console.log(`Couldn't find language function in Wasm file. Symbols: ${JSON.stringify(n, null, 2)}`), new Error("Language.load failed: no language function found in Wasm file"); let l = s[o](); return new we(D, l); } }; a(ye, "Module"); xe = ye, pe = null; a(be, "initializeBinding"); a(ve, "checkModule"); K = class { static { a(this, "Parser"); } 0 = 0; 1 = 0; logCallback = null; language = null; static async init(e) { ce(await be(e)), u = _._ts_init(), J = _.getValue(u, "i32"), ee = _.getValue(u + c, "i32"); } constructor() { this.initialize(); } initialize() { if (!ve()) throw new Error("cannot construct a Parser before calling `init()`"); _._ts_parser_new_wasm(), this[0] = _.getValue(u, "i32"), this[1] = _.getValue(u + c, "i32"); } delete() { _._ts_parser_delete(this[0]), _._free(this[1]), this[0] = 0, this[1] = 0; } setLanguage(e) { let t2; if (!e) t2 = 0, this.language = null; else if (e.constructor === se) { t2 = e[0]; let r2 = _._ts_language_abi_version(t2); if (r2 < ee || J < r2) throw new Error(`Incompatible language version ${r2}. Compatibility range ${ee} through ${J}.`); this.language = e; } else throw new Error("Argument must be a Language"); return _._ts_parser_set_language(this[0], t2), this; } parse(e, t2, r2) { if (typeof e == "string") _.currentParseCallback = (d3) => e.slice(d3); else if (typeof e == "function") _.currentParseCallback = e; else throw new Error("Argument must be a string or a function"); r2?.progressCallback ? _.currentProgressCallback = r2.progressCallback : _.currentProgressCallback = null, this.logCallback ? (_.currentLogCallback = this.logCallback, _._ts_parser_enable_logger_wasm(this[0], 1)) : (_.currentLogCallback = null, _._ts_parser_enable_logger_wasm(this[0], 0)); let s = 0, n = 0; if (r2?.includedRanges) { s = r2.includedRanges.length, n = _._calloc(s, Q); let d3 = n; for (let m3 = 0; m3 < s; m3++) ge(d3, r2.includedRanges[m3]), d3 += Q; } let o = _._ts_parser_parse_wasm(this[0], this[1], t2 ? t2[0] : 0, n, s); if (!o) return _.currentParseCallback = null, _.currentLogCallback = null, _.currentProgressCallback = null, null; if (!this.language) throw new Error("Parser must have a language to parse"); let l = new Fe(D, o, this.language, _.currentParseCallback); return _.currentParseCallback = null, _.currentLogCallback = null, _.currentProgressCallback = null, l; } reset() { _._ts_parser_reset(this[0]); } getIncludedRanges() { _._ts_parser_included_ranges_wasm(this[0]); let e = _.getValue(u, "i32"), t2 = _.getValue(u + c, "i32"), r2 = new Array(e); if (e > 0) { let s = t2; for (let n = 0; n < e; n++) r2[n] = Y(s), s += Q; _._free(t2); } return r2; } setLogger(e) { if (!e) this.logCallback = null; else { if (typeof e != "function") throw new Error("Logger callback must be a function"); this.logCallback = e; } return this; } getLogger() { return this.logCallback; } }, Ve = 1, De = 2, He = /[\w-]+/g, Ye = { Zero: 0, ZeroOrOne: 1, ZeroOrMore: 2, One: 3, OneOrMore: 4 }, ue = a((e) => e.type === "capture", "isCaptureStep"), ne = a((e) => e.type === "string", "isStringStep"), O = { Syntax: 1, NodeName: 2, FieldName: 3, CaptureName: 4, PatternStructure: 5 }, j = class Ae extends Error { constructor(t2, r2, s, n) { super(Ae.formatMessage(t2, r2)), this.kind = t2, this.info = r2, this.index = s, this.length = n, this.name = "QueryError"; } static { a(this, "QueryError"); } static formatMessage(t2, r2) { switch (t2) { case O.NodeName: return `Bad node name '${r2.word}'`; case O.FieldName: return `Bad field name '${r2.word}'`; case O.CaptureName: return `Bad capture name @${r2.word}`; case O.PatternStructure: return `Bad pattern structure at offset ${r2.suffix}`; case O.Syntax: return `Bad syntax at offset ${r2.suffix}`; } } }; a(Pe, "parseAnyPredicate"); a(Me, "parseMatchPredicate"); a(Ee, "parseAnyOfPredicate"); a(Ie, "parseIsPredicate"); a(Te, "parseSetDirective"); a(Se, "parsePattern"); Ke = class { static { a(this, "Query"); } 0 = 0; exceededMatchLimit; textPredicates; captureNames; captureQuantifiers; predicates; setProperties; assertedProperties; refutedProperties; matchLimit; constructor(e, t2) { let r2 = _.lengthBytesUTF8(t2), s = _._malloc(r2 + 1); _.stringToUTF8(t2, s, r2 + 1); let n = _._ts_query_new(e[0], s, r2, u, u + c); if (!n) { let h3 = _.getValue(u + c, "i32"), M4 = _.getValue(u, "i32"), p3 = _.UTF8ToString(s, M4).length, I3 = t2.slice(p3, p3 + 100).split(` `)[0], P4 = I3.match(He)?.[0] ?? ""; switch (_._free(s), h3) { case O.Syntax: throw new j(O.Syntax, { suffix: `${p3}: '${I3}'...` }, p3, 0); case O.NodeName: throw new j(h3, { word: P4 }, p3, P4.length); case O.FieldName: throw new j(h3, { word: P4 }, p3, P4.length); case O.CaptureName: throw new j(h3, { word: P4 }, p3, P4.length); case O.PatternStructure: throw new j(h3, { suffix: `${p3}: '${I3}'...` }, p3, 0); } } let o = _._ts_query_string_count(n), l = _._ts_query_capture_count(n), d3 = _._ts_query_pattern_count(n), m3 = new Array(l), g4 = new Array(d3), f4 = new Array(o); for (let h3 = 0; h3 < l; h3++) { let M4 = _._ts_query_capture_name_for_id(n, h3, u), p3 = _.getValue(u, "i32"); m3[h3] = _.UTF8ToString(M4, p3); } for (let h3 = 0; h3 < d3; h3++) { let M4 = new Array(l); for (let p3 = 0; p3 < l; p3++) { let I3 = _._ts_query_capture_quantifier_for_id(n, h3, p3); M4[p3] = I3; } g4[h3] = M4; } for (let h3 = 0; h3 < o; h3++) { let M4 = _._ts_query_string_value_for_id(n, h3, u), p3 = _.getValue(u, "i32"); f4[h3] = _.UTF8ToString(M4, p3); } let y4 = new Array(d3), b4 = new Array(d3), v4 = new Array(d3), T5 = new Array(d3), N4 = new Array(d3); for (let h3 = 0; h3 < d3; h3++) { let M4 = _._ts_query_predicates_for_pattern(n, h3, u), p3 = _.getValue(u, "i32"); T5[h3] = [], N4[h3] = []; let I3 = new Array(), P4 = M4; for (let V3 = 0; V3 < p3; V3++) { let k4 = _.getValue(P4, "i32"); P4 += c; let S3 = _.getValue(P4, "i32"); P4 += c, Se(h3, k4, S3, m3, f4, I3, N4, T5, y4, b4, v4); } Object.freeze(N4[h3]), Object.freeze(T5[h3]), Object.freeze(y4[h3]), Object.freeze(b4[h3]), Object.freeze(v4[h3]); } _._free(s), this[0] = n, this.captureNames = m3, this.captureQuantifiers = g4, this.textPredicates = N4, this.predicates = T5, this.setProperties = y4, this.assertedProperties = b4, this.refutedProperties = v4, this.exceededMatchLimit = !1; } delete() { _._ts_query_delete(this[0]), this[0] = 0; } matches(e, t2 = {}) { let r2 = t2.startPosition ?? R, s = t2.endPosition ?? R, n = t2.startIndex ?? 0, o = t2.endIndex ?? 0, l = t2.startContainingPosition ?? R, d3 = t2.endContainingPosition ?? R, m3 = t2.startContainingIndex ?? 0, g4 = t2.endContainingIndex ?? 0, f4 = t2.matchLimit ?? 4294967295, y4 = t2.maxStartDepth ?? 4294967295, b4 = t2.progressCallback; if (typeof f4 != "number") throw new Error("Arguments must be numbers"); if (this.matchLimit = f4, o !== 0 && n > o) throw new Error("`startIndex` cannot be greater than `endIndex`"); if (s !== R && (r2.row > s.row || r2.row === s.row && r2.column > s.column)) throw new Error("`startPosition` cannot be greater than `endPosition`"); if (g4 !== 0 && m3 > g4) throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`"); if (d3 !== R && (l.row > d3.row || l.row === d3.row && l.column > d3.column)) throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`"); b4 && (_.currentQueryProgressCallback = b4), w(e), _._ts_query_matches_wasm(this[0], e.tree[0], r2.row, r2.column, s.row, s.column, n, o, l.row, l.column, d3.row, d3.column, m3, g4, f4, y4); let v4 = _.getValue(u, "i32"), T5 = _.getValue(u + c, "i32"), N4 = _.getValue(u + 2 * c, "i32"), h3 = new Array(v4); this.exceededMatchLimit = !!N4; let M4 = 0, p3 = T5; for (let I3 = 0; I3 < v4; I3++) { let P4 = _.getValue(p3, "i32"); p3 += c; let V3 = _.getValue(p3, "i32"); p3 += c; let k4 = new Array(V3); if (p3 = re(this, e.tree, p3, P4, k4), this.textPredicates[P4].every((S3) => S3(k4))) { h3[M4] = { patternIndex: P4, captures: k4 }; let S3 = this.setProperties[P4]; h3[M4].setProperties = S3; let H5 = this.assertedProperties[P4]; h3[M4].assertedProperties = H5; let q4 = this.refutedProperties[P4]; h3[M4].refutedProperties = q4, M4++; } } return h3.length = M4, _._free(T5), _.currentQueryProgressCallback = null, h3; } captures(e, t2 = {}) { let r2 = t2.startPosition ?? R, s = t2.endPosition ?? R, n = t2.startIndex ?? 0, o = t2.endIndex ?? 0, l = t2.startContainingPosition ?? R, d3 = t2.endContainingPosition ?? R, m3 = t2.startContainingIndex ?? 0, g4 = t2.endContainingIndex ?? 0, f4 = t2.matchLimit ?? 4294967295, y4 = t2.maxStartDepth ?? 4294967295, b4 = t2.progressCallback; if (typeof f4 != "number") throw new Error("Arguments must be numbers"); if (this.matchLimit = f4, o !== 0 && n > o) throw new Error("`startIndex` cannot be greater than `endIndex`"); if (s !== R && (r2.row > s.row || r2.row === s.row && r2.column > s.column)) throw new Error("`startPosition` cannot be greater than `endPosition`"); if (g4 !== 0 && m3 > g4) throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`"); if (d3 !== R && (l.row > d3.row || l.row === d3.row && l.column > d3.column)) throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`"); b4 && (_.currentQueryProgressCallback = b4), w(e), _._ts_query_captures_wasm(this[0], e.tree[0], r2.row, r2.column, s.row, s.column, n, o, l.row, l.column, d3.row, d3.column, m3, g4, f4, y4); let v4 = _.getValue(u, "i32"), T5 = _.getValue(u + c, "i32"), N4 = _.getValue(u + 2 * c, "i32"), h3 = new Array(); this.exceededMatchLimit = !!N4; let M4 = new Array(), p3 = T5; for (let I3 = 0; I3 < v4; I3++) { let P4 = _.getValue(p3, "i32"); p3 += c; let V3 = _.getValue(p3, "i32"); p3 += c; let k4 = _.getValue(p3, "i32"); if (p3 += c, M4.length = V3, p3 = re(this, e.tree, p3, P4, M4), this.textPredicates[P4].every((S3) => S3(M4))) { let S3 = M4[k4], H5 = this.setProperties[P4]; S3.setProperties = H5; let q4 = this.assertedProperties[P4]; S3.assertedProperties = q4; let G5 = this.refutedProperties[P4]; S3.refutedProperties = G5, h3.push(S3); } } return _._free(T5), _.currentQueryProgressCallback = null, h3; } predicatesForPattern(e) { return this.predicates[e]; } disableCapture(e) { let t2 = _.lengthBytesUTF8(e), r2 = _._malloc(t2 + 1); _.stringToUTF8(e, r2, t2 + 1), _._ts_query_disable_capture(this[0], r2, t2), _._free(r2); } disablePattern(e) { if (e >= this.predicates.length) throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`); _._ts_query_disable_pattern(this[0], e); } didExceedMatchLimit() { return this.exceededMatchLimit; } startIndexForPattern(e) { if (e >= this.predicates.length) throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`); return _._ts_query_start_byte_for_pattern(this[0], e); } endIndexForPattern(e) { if (e >= this.predicates.length) throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`); return _._ts_query_end_byte_for_pattern(this[0], e); } patternCount() { return _._ts_query_pattern_count(this[0]); } captureIndexForName(e) { return this.captureNames.indexOf(e); } isPatternRooted(e) { return _._ts_query_is_pattern_rooted(this[0], e) === 1; } isPatternNonLocal(e) { return _._ts_query_is_pattern_non_local(this[0], e) === 1; } isPatternGuaranteedAtStep(e) { return _._ts_query_is_pattern_guaranteed_at_step(this[0], e) === 1; } }, ae = { "tree-sitter-runtime": Object.freeze({ id: "tree-sitter-runtime", fileName: "web-tree-sitter.wasm" }), "tree-sitter-bash": Object.freeze({ id: "tree-sitter-bash", fileName: "tree-sitter-bash.wasm" }), "tree-sitter-python": Object.freeze({ id: "tree-sitter-python", fileName: "tree-sitter-python.wasm" }) }, Be = Object.freeze({ "tree-sitter-runtime": "../../../node_modules/web-tree-sitter/web-tree-sitter.wasm", "tree-sitter-bash": "../../../node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter-bash.wasm", "tree-sitter-python": "../../../node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter-python.wasm" }); Ge = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new WeakMap(); } }); // node_modules/@at-series/command-policy/dist/sqlite.js var sqlite_exports = {}; __export(sqlite_exports, { createSqlitePolicyEvaluator: () => y2 }); function O1(r2, i2) { let n = r2.charCodeAt(i2); return n !== n ? 29 : n > 255 ? 27 : tn[n]; } function B2(r2) { return r2 === void 0 ? !1 : r2.charCodeAt(0) >= 128 ? !0 : r2 >= "0" && r2 <= "9" || r2 >= "A" && r2 <= "Z" || r2 >= "a" && r2 <= "z" || r2 === "_" || r2 === "$"; } function $2(r2) { return r2 !== void 0 && r2 >= "0" && r2 <= "9"; } function h1(r2) { return r2 === void 0 ? !1 : r2 >= "0" && r2 <= "9" || r2 >= "A" && r2 <= "F" || r2 >= "a" && r2 <= "f"; } function $1(r2) { if (r2 === " ") return !0; if (r2 === void 0) return !1; let i2 = r2.charCodeAt(0); return i2 >= 9 && i2 <= 13; } function j1(r2, i2, n = {}) { let s = n.digitSeparator ?? rn, m3 = typeof s == "string" && s.length === 1, e = /* @__PURE__ */ new Map(), t2 = /* @__PURE__ */ new Map(); for (let l = 0; l < r2.constants.YYNTOKEN; l++) { let f4 = r2.symbols[l], E4 = l; e.set(f4, E4), t2.set(E4, f4); } function o(l) { let f4 = e.get(l); if (f4 === void 0) throw new Error(`tokenize.ts: parser defs are missing terminal token "${l}". This usually means the parser defs and tokenizer are out of sync.`); return f4; } let a2 = { SPACE: o("SPACE"), COMMENT: o("COMMENT"), ILLEGAL: o("ILLEGAL"), PTR: o("PTR"), MINUS: o("MINUS"), LP: o("LP"), RP: o("RP"), SEMI: o("SEMI"), PLUS: o("PLUS"), STAR: o("STAR"), SLASH: o("SLASH"), REM: o("REM"), EQ: o("EQ"), LE: o("LE"), NE: o("NE"), LT: o("LT"), LSHIFT: o("LSHIFT"), GE: o("GE"), RSHIFT: o("RSHIFT"), GT: o("GT"), BITOR: o("BITOR"), CONCAT: o("CONCAT"), COMMA: o("COMMA"), BITAND: o("BITAND"), BITNOT: o("BITNOT"), DOT: o("DOT"), STRING: o("STRING"), ID: o("ID"), INTEGER: o("INTEGER"), FLOAT: o("FLOAT"), QNUMBER: o("QNUMBER"), VARIABLE: o("VARIABLE"), BLOB: o("BLOB"), CASE: o("CASE"), END: o("END") }, c3 = i2.meta.maskFlags, A4 = Object.keys(c3), C5 = n.flags ?? A4, y4 = c3.ALWAYS ?? V1(0); for (let l of C5) y4 = V1(y4 | (c3[l] ?? 0)); let N4 = [], L5 = 0, P4 = 0; for (let l of i2.keywords) { if ((l.mask & y4) === 0) continue; P4++; let f4 = l.name.length; f4 > L5 && (L5 = f4); let E4 = N4[f4]; E4 === void 0 && (E4 = { names: [], codes: [] }, N4[f4] = E4), E4.names.push(l.name), E4.codes.push(o(l.token)); } function D4(l, f4, E4) { let u4; switch (O1(l, f4)) { case 7: { for (u4 = f4 + 1; $1(l[u4]); u4++) ; return E4[0] = a2.SPACE, u4 - f4; } case 11: { if (l[f4 + 1] === "-") { for (u4 = f4 + 2; l[u4] !== void 0 && l[u4] !== ` `; u4++) ; return E4[0] = a2.COMMENT, u4 - f4; } return l[f4 + 1] === ">" ? (E4[0] = a2.PTR, l[f4 + 2] === ">" ? 3 : 2) : (E4[0] = a2.MINUS, 1); } case 17: return E4[0] = a2.LP, 1; case 18: return E4[0] = a2.RP, 1; case 19: return E4[0] = a2.SEMI, 1; case 20: return E4[0] = a2.PLUS, 1; case 21: return E4[0] = a2.STAR, 1; case 16: { if (l[f4 + 1] !== "*" || l[f4 + 2] === void 0) return E4[0] = a2.SLASH, 1; u4 = f4 + 3; let d3 = l[f4 + 2]; for (; l[u4] !== void 0 && !(d3 === "*" && l[u4] === "/"); ) d3 = l[u4], u4++; return l[u4] !== void 0 && u4++, E4[0] = a2.COMMENT, u4 - f4; } case 22: return E4[0] = a2.REM, 1; case 14: return E4[0] = a2.EQ, l[f4 + 1] === "=" ? 2 : 1; case 12: { let d3 = l[f4 + 1]; return d3 === "=" ? (E4[0] = a2.LE, 2) : d3 === ">" ? (E4[0] = a2.NE, 2) : d3 === "<" ? (E4[0] = a2.LSHIFT, 2) : (E4[0] = a2.LT, 1); } case 13: { let d3 = l[f4 + 1]; return d3 === "=" ? (E4[0] = a2.GE, 2) : d3 === ">" ? (E4[0] = a2.RSHIFT, 2) : (E4[0] = a2.GT, 1); } case 15: return l[f4 + 1] === "=" ? (E4[0] = a2.NE, 2) : (E4[0] = a2.ILLEGAL, 1); case 10: return l[f4 + 1] === "|" ? (E4[0] = a2.CONCAT, 2) : (E4[0] = a2.BITOR, 1); case 23: return E4[0] = a2.COMMA, 1; case 24: return E4[0] = a2.BITAND, 1; case 25: return E4[0] = a2.BITNOT, 1; case 8: { let d3 = l[f4], R4; for (u4 = f4 + 1; (R4 = l[u4]) !== void 0; u4++) if (R4 === d3) if (l[u4 + 1] === d3) u4++; else break; return R4 === "'" ? (E4[0] = a2.STRING, u4 - f4 + 1) : R4 !== void 0 ? (E4[0] = a2.ID, u4 - f4 + 1) : (E4[0] = a2.ILLEGAL, u4 - f4); } case 26: return $2(l[f4 + 1]) ? v4(l, f4, E4, !0) : (E4[0] = a2.DOT, 1); case 3: return v4(l, f4, E4, !1); case 9: { for (u4 = f4 + 1; l[u4] !== void 0; u4++) if (l[u4] === "]") return E4[0] = a2.ID, u4 - f4 + 1; return E4[0] = a2.ILLEGAL, u4 - f4; } case 6: { for (E4[0] = a2.VARIABLE, u4 = f4 + 1; $2(l[u4]); u4++) ; return u4 - f4; } case 4: case 5: { let d3 = 0; for (E4[0] = a2.VARIABLE, u4 = f4 + 1; l[u4] !== void 0; ) { let R4 = l[u4]; if (B2(R4)) { d3++, u4++; continue; } if (R4 === "(" && d3 > 0) { let h3; do u4++, h3 = l[u4]; while (h3 !== void 0 && !$1(h3) && h3 !== ")"); h3 === ")" ? u4++ : E4[0] = a2.ILLEGAL; break; } if (R4 === ":" && l[u4 + 1] === ":") { u4 += 2; continue; } break; } return d3 === 0 && (E4[0] = a2.ILLEGAL), u4 - f4; } case 1: { if (O1(l, f4 + 1) > 2) { if (u4 = f4 + 1, B2(l[u4])) { for (u4++; B2(l[u4]); ) u4++; return E4[0] = a2.ID, u4 - f4; } return x5(l, f4, u4, E4); } for (u4 = f4 + 2; O1(l, u4) <= 2; u4++) ; if (B2(l[u4])) { for (u4++; B2(l[u4]); ) u4++; return E4[0] = a2.ID, u4 - f4; } return x5(l, f4, u4, E4); } case 0: { if (l[f4 + 1] === "'") { for (E4[0] = a2.BLOB, u4 = f4 + 2; h1(l[u4]); u4++) ; if (l[u4] !== "'" || (u4 - f4 - 2) % 2) for (E4[0] = a2.ILLEGAL; l[u4] !== void 0 && l[u4] !== "'"; ) u4++; return l[u4] !== void 0 && u4++, u4 - f4; } for (u4 = f4 + 1; B2(l[u4]); ) u4++; return E4[0] = a2.ID, u4 - f4; } case 2: case 27: { for (u4 = f4 + 1; B2(l[u4]); ) u4++; return E4[0] = a2.ID, u4 - f4; } case 30: { if (l.charCodeAt(f4 + 1) === 187 && l.charCodeAt(f4 + 2) === 191) return E4[0] = a2.SPACE, 3; for (u4 = f4 + 1; B2(l[u4]); ) u4++; return E4[0] = a2.ID, u4 - f4; } case 29: return E4[0] = a2.ILLEGAL, 0; default: return E4[0] = a2.ILLEGAL, 1; } } function v4(l, f4, E4, u4) { let d3 = f4; if (E4[0] = a2.INTEGER, !u4 && l[f4] === "0" && (l[f4 + 1] === "x" || l[f4 + 1] === "X") && h1(l[f4 + 2])) { for (d3 = f4 + 3; l[d3] !== void 0; d3++) if (!h1(l[d3])) { if (m3 && l[d3] === s) { E4[0] = a2.QNUMBER; continue; } break; } } else { if (!u4) { for (d3 = f4; l[d3] !== void 0; d3++) if (!$2(l[d3])) { if (m3 && l[d3] === s) { E4[0] = a2.QNUMBER; continue; } break; } } if (u4 && d3 === f4 || l[d3] === ".") { for (E4[0] === a2.INTEGER && (E4[0] = a2.FLOAT), d3 = u4 ? f4 + 1 : d3 + 1; l[d3] !== void 0; d3++) if (!$2(l[d3])) { if (m3 && l[d3] === s) { E4[0] = a2.QNUMBER; continue; } break; } } if ((l[d3] === "e" || l[d3] === "E") && ($2(l[d3 + 1]) || (l[d3 + 1] === "+" || l[d3 + 1] === "-") && $2(l[d3 + 2]))) { for (E4[0] === a2.INTEGER && (E4[0] = a2.FLOAT), d3 += 2; l[d3] !== void 0; d3++) if (!$2(l[d3])) { if (m3 && l[d3] === s) { E4[0] = a2.QNUMBER; continue; } break; } } } for (; B2(l[d3]); ) E4[0] = a2.ILLEGAL, d3++; return d3 - f4; } function x5(l, f4, E4, u4) { let d3 = E4 - f4; if (d3 >= 2 && d3 <= L5) { let R4 = N4[d3]; if (R4 !== void 0) { let h3 = R4.names, O4 = R4.codes, b4 = h3.length; e: for (let S3 = 0; S3 < b4; S3++) { let _5 = h3[S3]; for (let w4 = 0; w4 < d3; w4++) { let K4 = l.charCodeAt(f4 + w4), M4 = _5.charCodeAt(w4); if (K4 !== M4 && K4 !== (M4 | 32)) continue e; } return u4[0] = O4[S3], d3; } } } return u4[0] = a2.ID, d3; } let U4 = a2.SPACE, e1 = a2.COMMENT, n1 = { done: !0, value: void 0 }; class A1 { sql; len; emitTrivia; offset; line; col; _out = [0]; _result = { done: !1, value: void 0 }; constructor(f4, E4) { this.sql = f4, this.len = f4.length, this.emitTrivia = E4, this.offset = 0, this.line = 1, this.col = 0; } [Symbol.iterator]() { return this; } next() { let f4 = this.sql, E4 = this.len, u4 = this.emitTrivia, d3 = this._out, R4 = this.offset, h3 = this.line, O4 = this.col; for (; R4 < E4; ) { let b4 = D4(f4, R4, d3), S3 = d3[0]; if (b4 === 0) return this.offset = R4, this.line = h3, this.col = O4, n1; let _5 = R4, w4 = h3, K4 = O4, M4 = _5 + b4; for (let V3 = _5; V3 < M4; V3++) f4.charCodeAt(V3) === 10 ? (h3++, O4 = 0) : O4++; if (R4 = M4, !(!u4 && (S3 === U4 || S3 === e1))) return this.offset = R4, this.line = h3, this.col = O4, this._result.value = { type: S3, text: f4.slice(_5, M4), span: { offset: _5, length: b4, line: w4, col: K4 } }, this._result; } return this.offset = R4, this.line = h3, this.col = O4, n1; } } function L1(l, { emitTrivia: f4 = !1 } = {}) { return new A1(l, f4); } return { tokens: a2, tokenName: (l) => t2.get(l), tokenize: L1, _nextToken: D4, _keywordCount: P4 }; } function Z1(r2) { let i2 = r2.constants, n = r2.tables, s = n.yyFallback ?? []; function m3(a2, c3) { if (c3 > i2.YY_MAX_SHIFT) return c3; let A4 = a2; for (; ; ) { let y4 = n.yy_shift_ofst[c3] + A4; if (n.yy_lookahead[y4] !== A4) { if (i2.YYFALLBACK && A4 < s.length) { let N4 = s[A4]; if (N4 !== 0) { A4 = N4; continue; } } if (i2.YYWILDCARD > 0) { let N4 = y4 - A4 + i2.YYWILDCARD; if (N4 >= 0 && N4 < n.yy_lookahead.length && n.yy_lookahead[N4] === i2.YYWILDCARD && A4 > 0) return n.yy_action[N4]; } return n.yy_default[c3]; } return n.yy_action[y4]; } } function e(a2, c3) { if (a2 > i2.YY_REDUCE_COUNT) return n.yy_default[a2]; let A4 = n.yy_reduce_ofst[a2] + c3; return A4 < 0 || A4 >= i2.YY_ACTTAB_COUNT || n.yy_lookahead[A4] !== c3 ? n.yy_default[a2] : n.yy_action[A4]; } class t2 { #e = [{ stateno: 0, major: 0, minor: void 0, span: { offset: 0, length: 0, line: 1, col: 0 } }]; #t = []; #n = "running"; #r; #s; #i = 0; #o; constructor(c3, A4) { this.#o = c3, this.#s = A4; } get phase() { return this.#n; } get root() { return this.#r; } get stack() { return this.#e; } get errors() { return this.#t; } get state() { return this.#s; } next(c3, A4, C5) { if (this.#n !== "running") return; let y4 = this.#e, N4 = y4[y4.length - 1].stateno; for (; ; ) { let L5 = N4; if (N4 = m3(c3, N4), N4 >= i2.YY_MIN_REDUCE) { this.#a(N4 - i2.YY_MIN_REDUCE), N4 = y4[y4.length - 1].stateno; continue; } if (N4 <= i2.YY_MAX_SHIFTREDUCE) { let P4 = N4; P4 > i2.YY_MAX_SHIFT && (P4 += i2.YY_MIN_REDUCE - i2.YY_MIN_SHIFTREDUCE), y4.push({ stateno: P4, major: c3, minor: A4, span: C5 }), this.#i++; return; } if (N4 === i2.YY_ACCEPT_ACTION) { this.#r = y4[y4.length - 1].minor, this.#n = "accepted"; return; } this.#t.push({ stateno: L5, major: c3, minor: A4, tokenIndex: this.#i }), this.#n = "errored"; return; } } #a(c3) { let A4 = n.yyRuleInfoNRhs[c3], C5 = n.yyRuleInfoLhs[c3], y4 = this.#e, N4 = []; for (let x5 = 0; x5 < A4; x5++) { let U4 = y4.pop(); N4.push({ major: U4.major, minor: U4.minor, span: U4.span }); } N4.reverse(); let L5; if (N4.length === 0) { let x5 = y4[y4.length - 1].span; L5 = { offset: x5.offset + x5.length, length: 0, line: x5.line, col: x5.col }; } else { let x5 = N4[0].span, U4 = N4[N4.length - 1].span; L5 = { offset: x5.offset, length: U4.offset + U4.length - x5.offset, line: x5.line, col: x5.col }; } let P4 = this.#o(this.#s, c3, N4, L5), D4 = y4[y4.length - 1].stateno, v4 = e(D4, C5); y4.push({ stateno: v4, major: C5, minor: P4, span: L5 }); } } function o(a2, c3) { return new t2(a2, c3); } return o; } function sn(r2, i2) { let { filename: n } = r2, { message: s, span: m3, hints: e } = i2, t2 = n ? `At ${n}:${m3.line}:${m3.col}:` : `At ${m3.line}:${m3.col}:`, o = [s, "", t2, z1(r2, m3, { indent: " " })]; return e?.forEach(({ message: a2, span: c3 }, A4) => { (A4 === 0 || c3) && o.push(""), o.push(` hint: ${a2}`), c3 && o.push(z1(r2, c3, { indent: " ", contextBefore: 0, contextAfter: 0 })); }), o.join(` `); } function j2(r2, i2) { return i2.map((n) => new _1(r2, n)); } function Q1(r2, i2, n) { let s = n?.line ?? 1, m3 = n?.col ?? 0; for (let e = n?.offset ?? 0; e < i2; e++) r2.charCodeAt(e) === 10 ? (s++, m3 = 0) : m3++; return { line: s, col: m3 }; } function z1(r2, i2, n) { let { source: s } = r2, m3 = Math.max(0, n?.contextBefore ?? 1), e = Math.max(0, n?.contextAfter ?? 1), t2 = n?.indent ?? "", o = Math.max(0, Math.min(i2.offset, s.length)), a2 = Math.max(o, Math.min(i2.offset + i2.length, s.length)), c3 = s.split(` `), A4 = i2.offset === o ? i2 : Q1(s, o), C5 = Q1(s, a2, i2), y4 = Math.max(1, A4.line - m3), N4 = Math.min(c3.length, C5.line + e), L5 = Math.max(2, String(N4).length), P4 = []; for (let D4 = y4; D4 <= N4; D4++) { let v4 = c3[D4 - 1] ?? ""; if (P4.push(`${t2}${String(D4).padStart(L5, " ")}${J1}${v4}`), D4 < A4.line || D4 > C5.line) continue; let x5 = D4 === A4.line ? A4.col : 0, U4 = D4 === C5.line ? C5.col : v4.length, e1 = Math.max(1, U4 - x5), n1 = " ".repeat(L5) + J1 + " ".repeat(x5); P4.push(t2 + n1 + "^".repeat(e1)); } return P4.join(` `); } function p1(r2) { let i2 = [{ message: on(r2.text) }], n = JSON.stringify(r2.text); return n.slice(1, -1) !== String(r2.text) && i2.push({ message: `escaped token text: ${n}` }), { message: `unrecognized token: "${r2.text}"`, span: r2.span, token: r2, hints: i2 }; } function on(r2) { return r2.startsWith("'") ? "unterminated string literal" : r2.startsWith('"') || r2.startsWith("`") || r2.startsWith("[") ? "unterminated quoted identifier" : /^[0-9.]/.test(r2) ? "malformed numeric literal" : "the tokenizer could not classify this input"; } function ee2(r2, i2) { let n = ln(r2, i2); return (s) => un(n, s); } function mn(r2) { return r2.text.length > 0 ? `near "${r2.text}": syntax error` : "incomplete input"; } function ln(r2, i2) { let n = r2.constants.YYNTOKEN, s = /* @__PURE__ */ new Map(), m3 = new Array(n), e = new Uint16Array(n); for (let a2 = 0; a2 < n; a2++) { let c3 = a2, A4 = r2.symbols[a2], C5 = cn[A4]; s.set(A4, c3), m3[a2] = fn(A4, C5), e[a2] = C5?.flags ?? 0; } let t2 = An(s), o = r2.tables.yyFallback ?? []; for (let a2 = 0; a2 < n; a2++) a2 !== t2.ID && (o[a2] ?? 0) === t2.ID && (e[a2] |= T.FallbackToId); for (let a2 of i2.keywords) { let c3 = s.get(a2.token); c3 !== void 0 && (c3 === t2.ID || c3 === t2.STRING || c3 === t2.ILLEGAL || (e[c3] |= T.KeywordLike)); } return { defs: r2, tok: t2, displayById: m3, flagsById: e }; } function un(r2, i2) { let { token: n, state: s, previousToken: m3, sawOverSinceLastFilterOrSemi: e, openers: t2 } = i2, o = mn(n), a2 = dn(r2, s), c3 = Tn(r2, { token: n, canonical: o, expected: a2, previousToken: m3, openers: t2, sawOverSinceLastFilterOrSemi: e }) ?? (a2.length > 0 ? [{ message: `expected ${In(r2, a2)}` }] : void 0); return c3 ? { message: o, span: n.span, token: n, hints: c3 } : { message: o, span: n.span, token: n }; } function fn(r2, i2) { if (!((i2?.flags ?? 0) & T.Hidden)) return i2?.display ? i2.display : /^[A-Z_]+$/.test(r2) ? r2.replace(/_KW$/, "").toLowerCase() : r2; } function En(r2, i2) { let n = r2.get(i2); if (n === void 0) throw new Error(`errors.ts: missing terminal token "${i2}"`); return n; } function An(r2) { return Object.fromEntries(an.map((i2) => [i2, En(r2, i2)])); } function dn(r2, i2) { let n = r2.defs.tables.yy_expected?.[i2] ?? [], s = []; for (let m3 of n) ne2(r2, m3) || s.push(m3); return s; } function ne2(r2, i2) { return H(r2, i2, T.Hidden); } function te2(r2, i2) { return H(r2, i2, T.FallbackToId); } function Cn(r2, i2) { for (let n of i2) if (n === r2.tok.ID || te2(r2, n)) return !0; return !1; } function N1(r2, i2) { return r2.includes(i2); } function re2(r2, i2, n) { for (let s of i2) if (H(r2, s, n)) return !0; return !1; } function Nn(r2, i2) { if (!ne2(r2, i2)) return te2(r2, i2) ? b1(r2, r2.tok.ID) : b1(r2, i2); } function yn(r2, i2) { let n = /^[^a-z0-9]/i.test(r2), s = /^[^a-z0-9]/i.test(i2); return n !== s ? n ? -1 : 1 : r2.localeCompare(i2); } function In(r2, i2) { let n = /* @__PURE__ */ new Set(), s = []; for (let a2 of i2) { let c3 = Nn(r2, a2); c3 === void 0 || n.has(c3) || (n.add(c3), s.push(c3)); } s.sort(yn); let m3 = s.slice(0, 5); if (m3.length === 1) return m3[0]; if (m3.length === 2) return `${m3[0]} or ${m3[1]}`; let e = m3.slice(0, -1).join(", "), t2 = m3[m3.length - 1], o = s.length > m3.length ? ", ..." : ""; return `${e}, or ${t2}${o}`; } function Tn(r2, i2) { let { token: n, canonical: s, expected: m3, previousToken: e, openers: t2, sawOverSinceLastFilterOrSemi: o } = i2, a2 = t2[t2.length - 1], c3 = Rn(r2, n, e); if (c3) return [{ message: c3 }]; if (s === "incomplete input") return se2(r2, n, a2) ?? [{ message: "query ended before a complete statement was formed" }]; let A4 = kn(r2, n, t2); if (A4) return [{ message: A4 }]; let C5 = Ln(r2, n, o); if (C5) return [{ message: C5 }]; let y4 = gn(r2, n, a2); if (y4) return y4; let N4 = xn(r2, n, m3, e); if (N4) return [{ message: N4 }]; if (n.type === r2.tok.FROM && re2(r2, m3, T.ExprStart)) return [{ message: "expected a result expression before FROM" }]; let L5 = On(r2, n, m3); if (L5) return [{ message: L5 }]; } function t1(r2) { return r2.text.length === 0 ? "end of input" : `"${r2.text}"`; } function Rn(r2, i2, n) { if (!n || !H(r2, n.type, T.TableNameContext)) return; let s = b1(r2, n.type); if (S1(r2, i2)) return `expected a table name after ${s}`; if (!(i2.type === r2.tok.ID || i2.type === r2.tok.STRING)) return `expected a table name after ${s}`; } function se2(r2, i2, n) { if (!n) return; let s; if (n.type === r2.tok.LP) s = `missing ")" before ${t1(i2)}`; else if (n.type === r2.tok.CASE) s = `missing END before ${t1(i2)}`; else return; return [{ message: s }, { message: "opened here", span: n.span }]; } function kn(r2, i2, n) { if (i2.type === r2.tok.RP && !n.some((s) => s.type === r2.tok.LP)) return 'unexpected ")" with no matching "("'; } function Ln(r2, i2, n) { if (i2.type === r2.tok.FILTER) return n ? "FILTER clauses must appear before OVER clauses" : void 0; } function gn(r2, i2, n) { if (!(!n || !ie2(r2, i2))) return se2(r2, i2, n); } function xn(r2, i2, n, s) { if (i2.type === r2.tok.COMMA && N1(n, r2.tok.RP)) return 'remove this comma or add another list item before ")"'; if (S1(r2, i2) && s?.type === r2.tok.COMMA) return "remove the trailing comma or add another list item before end of input"; if (s?.type === r2.tok.COMMA && ie2(r2, i2)) return `remove the trailing comma or add another list item before ${t1(i2)}`; if (!(!s || !hn(r2, i2) || !_n(r2, s))) { if (N1(n, r2.tok.COMMA)) return `missing comma before ${t1(i2)}`; if (N1(n, r2.tok.RP) || N1(n, r2.tok.SEMI) || re2(r2, n, T.ClauseBoundary)) return `possible missing comma or operator before ${t1(i2)}`; } } function On(r2, i2, n) { if (Cn(r2, n) && bn(r2, i2)) return `if you intended ${t1(i2)} as an identifier here, quote it`; } function H(r2, i2, n) { return (r2.flagsById[i2] & n) !== 0; } function S1(r2, i2) { return i2.type === 0 || i2.type === r2.tok.SEMI && i2.synthetic === !0; } function ie2(r2, i2) { return S1(r2, i2) || H(r2, i2.type, T.ClauseBoundary); } function hn(r2, i2) { return H(r2, i2.type, T.ItemStart); } function _n(r2, i2) { return H(r2, i2.type, T.ItemEnd); } function bn(r2, i2) { return i2.type === r2.tok.ID || i2.type === r2.tok.STRING || i2.type === r2.tok.ILLEGAL ? !1 : H(r2, i2.type, T.KeywordLike); } function b1(r2, i2) { return r2.displayById[i2] ?? Sn(r2.defs, i2); } function Sn(r2, i2) { return r2.symbols[i2] ?? String(i2); } function Pn(r2) { return r2 !== void 0 && r2 >= "0" && r2 <= "9"; } function Un(r2) { return r2 === void 0 ? !1 : r2 >= "0" && r2 <= "9" || r2 >= "A" && r2 <= "F" || r2 >= "a" && r2 <= "f"; } function wn(r2) { return r2 === "'" || r2 === '"' || r2 === "`" || r2 === "["; } function q(r2) { if (r2.length === 0 || !wn(r2[0])) return r2; let i2 = r2[0] === "[" ? "]" : r2[0], n = ""; for (let s = 1; s < r2.length; s++) { let m3 = r2[s]; if (m3 === i2) if (r2[s + 1] === i2) n += i2, s++; else break; else n += m3; } return n; } function ae2(r2, i2 = {}) { let n = i2.digitSeparator ?? "_", s = r2[0] === "0" && (r2[1] === "x" || r2[1] === "X"), m3 = s ? Un : Pn, e = "INTEGER", t2 = "", o; for (let a2 = 0; a2 < r2.length; a2++) { let c3 = r2[a2]; if (c3 !== n) { t2 += c3, !s && (c3 === "e" || c3 === "E" || c3 === ".") && (e = "FLOAT"); continue; } (!m3(r2[a2 - 1]) || !m3(r2[a2 + 1])) && (o = `unrecognized token: "${r2}"`); } return o ? { op: e, text: t2, error: o } : { op: e, text: t2 }; } function oe2(r2) { if (r2 === void 0) return NaN; let i2 = typeof r2 == "string" ? r2.charCodeAt(0) : r2 | 0; return i2 >= 48 && i2 <= 57 ? i2 - 48 : i2 >= 65 && i2 <= 70 ? i2 - 65 + 10 : i2 >= 97 && i2 <= 102 ? i2 - 97 + 10 : NaN; } function ce2(r2) { if (r2[0] !== "x" && r2[0] !== "X" || r2[1] !== "'" || r2[r2.length - 1] !== "'") throw new Error(`not a blob literal: ${JSON.stringify(r2)}`); let i2 = r2.slice(2, r2.length - 1); if (i2.length % 2 !== 0) throw new Error(`blob literal has odd hex digit count: ${JSON.stringify(r2)}`); let n = new Uint8Array(i2.length / 2); for (let s = 0; s < i2.length; s += 2) n[s / 2] = oe2(i2[s]) << 4 | oe2(i2[s + 1]); return n; } function Y2(r2, i2, ...n) { return n.length > 0 ? { message: r2, span: i2, hints: n } : { message: r2, span: i2 }; } function y1(r2, i2, n) { return Y2(r2, i2, { message: "first specified here", span: n }); } function Mn(r2, i2) { let n = me2(r2), s = me2(i2); return n && s ? Xn : n ? i2 : s ? r2 : { offset: r2.offset, length: i2.offset + i2.length - r2.offset, line: r2.line, col: r2.col }; } function me2(r2) { return r2.line === 0 && r2.offset === 0 && r2.length === 0; } function ue2(r2) { let i2 = r2.span, n = r2.text.toUpperCase(); if (n === "CURRENT_DATE") return { type: "CurrentDateLiteral", span: i2 }; if (n === "CURRENT_TIME") return { type: "CurrentTimeLiteral", span: i2 }; if (n === "CURRENT_TIMESTAMP") return { type: "CurrentTimestampLiteral", span: i2 }; throw new Error(`unreachable CTIME_KW: ${r2.text}`); } function P1(r2, i2) { if (r2.type === i2.MATCH) return "Match"; let n = r2.text.toUpperCase(); if (n === "LIKE") return "Like"; if (n === "GLOB") return "Glob"; if (n === "REGEXP") return "Regexp"; throw new Error(`unreachable LIKE_KW: ${r2.text}`); } function Ce2(r2, i2) { switch (r2) { case i2.AND: return "And"; case i2.OR: return "Or"; case i2.LT: return "Less"; case i2.GT: return "Greater"; case i2.GE: return "GreaterEquals"; case i2.LE: return "LessEquals"; case i2.EQ: return "Equals"; case i2.NE: return "NotEquals"; case i2.BITAND: return "BitwiseAnd"; case i2.BITOR: return "BitwiseOr"; case i2.LSHIFT: return "LeftShift"; case i2.RSHIFT: return "RightShift"; case i2.PLUS: return "Add"; case i2.MINUS: return "Subtract"; case i2.STAR: return "Multiply"; case i2.SLASH: return "Divide"; case i2.REM: return "Modulus"; case i2.CONCAT: return "Concat"; case i2.IS: return "Is"; case i2.NOT: return "IsNot"; default: throw new Error(`unreachable binary op token: ${r2}`); } } function Ne2(r2, i2) { switch (r2) { case i2.BITNOT: return "BitwiseNot"; case i2.MINUS: return "Negative"; case i2.NOT: return "Not"; case i2.PLUS: return "Positive"; default: throw new Error(`unreachable unary op token: ${r2}`); } } function _e2(r2, i2, n, s) { if (i2 === n.ISNULL) return { type: "IsNullExpr", expr: r2, span: s }; if (i2 === n.NOTNULL) return { type: "NotNullExpr", expr: r2, span: s }; throw new Error(`unreachable NULL-test token: ${i2}`); } function w1(r2, i2, n, s, m3, e) { return { type: "LikeExpr", lhs: r2, not: i2, op: n, rhs: s, escape: m3, span: e }; } function Q2(r2, i2, n, s, m3, e, t2) { return n === "Distinct" && (s?.length ?? 0) !== 1 && r2.errors.push({ message: "DISTINCT aggregates must have exactly one argument", span: i2.span }), { type: "FunctionCallExpr", name: r1(i2), distinctness: n, args: s, orderBy: m3, filterOver: e, span: t2 }; } function le(r2) { switch (r2.toUpperCase()) { case "CROSS": return 3; case "FULL": return 56; case "INNER": return 1; case "LEFT": return 40; case "NATURAL": return 4; case "RIGHT": return 48; case "OUTER": return 32; default: return; } } function I1(r2, i2, n, s, m3) { let e = le(i2.text); if (e === void 0) return r2.errors.push({ message: `unknown join type: ${i2.text}`, span: i2.span }), { type: "TypedJoinJoinOperator", joinType: void 0, span: m3 }; for (let A4 of [n, s]) { if (A4 === void 0) continue; let C5 = le(A4.text); if (C5 === void 0) { r2.errors.push({ message: `unknown join type: ${A4.text}`, span: A4.span }); continue; } e |= C5; } let t2 = 1, o = 8, a2 = 16, c3 = 32; return ((e & (t2 | c3)) === (t2 | c3) || (e & (c3 | o | a2)) === c3) && r2.errors.push({ message: `unknown join type: ${i2.text} ${n?.text ?? ""} ${s?.text ?? ""}`.trimEnd(), span: i2.span }), { type: "TypedJoinJoinOperator", joinType: e, span: m3 }; } function Y1(r2, i2) { return { type: "FromClause", select: r2.select, joins: r2.joins.length > 0 ? r2.joins.map((n) => ({ type: "JoinedSelectTable", operator: n.operator, table: n.table, constraint: n.constraint, span: n.operator.span })) : void 0, span: i2 }; } function l1(r2, i2, n, s) { let m3 = i2.pendingOp; i2.pendingOp = void 0, m3 ? (m3.type === "TypedJoinJoinOperator" && m3.joinType !== void 0 && (m3.joinType & 4) !== 0 && s && r2.errors.push({ message: "a NATURAL join may not have an ON or USING clause", span: s.span }), i2.joins.push({ operator: m3, table: n, constraint: s })) : (s && r2.errors.push({ message: "a JOIN clause is required before ON", span: s.span }), i2.select = n); } function T1(r2, i2, n, s, m3) { return { type: "Select", with: r2, select: i2.select, compounds: i2.compounds, orderBy: n, limit: s, span: m3 }; } function Pe2(r2, i2) { let n = r2; n.compounds ? n.compounds.push(i2) : n.compounds = [i2]; } function v1(r2, i2, n, s, m3, e, t2, o, a2) { let c3 = s === void 0 ? n.find((A4) => A4.type === "StarResultColumn" || A4.type === "TableStarResultColumn") : void 0; return c3 && r2.errors.push({ message: "no tables specified", span: c3.span }), { type: "SelectFrom", distinctness: i2, columns: n, from: s, whereClause: m3, groupBy: e, having: t2, windowClause: o, span: a2 }; } function Ue2(r2, i2, n, s) { let m3 = i2[0]?.values; if (m3 && m3.length !== n.length) { let e = m3.length > 0 ? Mn(m3[0].span, m3[m3.length - 1].span) : void 0; r2.errors.push(e ? Y2("all VALUES must have the same number of terms", s, { message: `first row has ${m3.length} terms`, span: e }) : Y2("all VALUES must have the same number of terms", s)); } i2.push({ type: "ValuesRow", values: n, span: s }); } function R1(r2, i2, n, s) { let m3 = 0; for (let e of n) { let t2 = e.constraint; switch (t2.type) { case "CollateColumnConstraint": m3 |= 512; break; case "GeneratedColumnConstraint": { m3 |= 32, t2.typ && t2.typ.name.toUpperCase() === "STORED" && (m3 |= 64); break; } case "PrimaryKeyColumnConstraint": m3 |= 9; break; case "UniqueColumnConstraint": m3 |= 8; break; default: break; } } return i2 && i2.name.length > 0 && (m3 |= 4), { type: "ColumnDefinition", colName: r2, colType: i2, constraints: n, flags: m3, span: s }; } function B1(r2, i2, n) { let s = n.colName.text; for (let m3 = 0; m3 < i2.length; m3++) { let e = i2[m3]; if (e.colName.text === s) { r2.errors.push(y1(`duplicate column name: ${s}`, n.colName.span, e.colName.span)); return; } } i2.push(n); } function we2(r2, i2, n, s) { let m3 = n; for (let e of r2) (e.flags & 1) !== 0 && (m3 |= 4); return { type: "ColumnsAndConstraintsCreateTableBody", columns: r2, constraints: i2, flags: m3, span: s }; } function Xe2(r2, i2, n) { let s = n.tblName.text; for (let m3 = 0; m3 < i2.length; m3++) { let e = i2[m3]; if (e.tblName.text === s) { r2.errors.push(y1(`duplicate WITH table name: ${s}`, n.tblName.span, e.tblName.span)); return; } } i2.push(n); } function G1(r2, i2, n, s) { for (let m3 of i2) m3.nulls && r2.errors.push({ message: `unsupported use of NULLS ${m3.nulls === "First" ? "FIRST" : "LAST"}`, span: m3.span }); return { type: "UpsertIndex", targets: i2, whereClause: n, span: s }; } function Me2(r2) { let i2 = r2.stmt; if (i2 === void 0) return; let n = r2.explain === void 0 ? i2 : { type: "ExplainStmt", queryPlan: r2.explain === "QueryPlan", stmt: i2, span: i2.span }; r2.cmds.push(n), r2.stmt = void 0, r2.explain = void 0; } function Fe2(r2) { let i2 = r2.cmds, n = i2[0]?.span, s = i2[i2.length - 1]?.span, m3 = n !== void 0 && s !== void 0 ? { offset: n.offset, length: s.offset + s.length - n.offset, line: n.line, col: n.col } : { offset: 0, length: 0, line: 1, col: 1 }; return { type: "CmdList", cmds: i2, span: m3 }; } function W1(r2, i2, n) { let { reduce: s, createState: m3 } = r2, e = j1(r2, i2, n), t2 = Z1(r2), o = ee2(r2, i2), { CASE: a2, COMMENT: c3, END: A4, ILLEGAL: C5, LP: y4, RP: N4, SEMI: L5, SPACE: P4 } = e.tokens, D4 = Ye2(r2, "FILTER"), v4 = Ye2(r2, "OVER"), x5 = 0; function U4(l, f4, E4) { let { filename: u4, emitTokens: d3, ...R4 } = f4, h3 = { source: l, filename: u4 }, O4 = [], b4 = d3 ? [] : void 0, S3 = m3(), _5 = t2(s, S3), w4 = [], K4, M4 = !1; function V3(I3) { let k4 = _5.errors[_5.errors.length - 1]; return O4.push(o({ token: I3, state: k4.stateno, previousToken: K4, openers: w4, sawOverSinceLastFilterOrSemi: M4 })), O4.push(...S3.errors), { ok: !1, errors: j2(h3, O4), tokens: b4 }; } function pe3(I3) { let k4 = I3.type; if (k4 === y4 || k4 === a2) w4.push(I3); else if (k4 === N4 || k4 === A4) { let x1 = w4[w4.length - 1]; x1 && (x1.type === y4 && k4 === N4 || x1.type === a2 && k4 === A4) && w4.pop(); } k4 === v4 ? M4 = !0 : (k4 === D4 || k4 === L5) && (M4 = !1), K4 = I3, K1 = k4; } let K1, g1 = l.length, d1 = e.tokenize(l, R4); for (let I3 of d1) { if (I3.type === P4 || I3.type === c3) continue; if (I3.type === C5) return b4?.push(I3), O4.push(p1(I3)), O4.push(...S3.errors), { ok: !1, errors: j2(h3, O4), tokens: b4 }; b4?.push(I3), _5.next(I3.type, I3, I3.span); let k4 = S3.cmds.length >= 1 && I3.type !== L5; if (k4 && E4.rejectTrailing) return O4.push({ message: "expected end of input after single statement", token: I3, span: { offset: I3.span.offset, length: l.length - I3.span.offset, line: I3.span.line, col: I3.span.col } }), O4.push(...S3.errors), { ok: !1, errors: j2(h3, O4), tokens: b4 }; if (k4 && E4.firstStatement) return g1 = I3.span.offset, { ok: !0, state: S3, tail: g1, tokens: b4 }; if (_5.phase === "errored") return V3(I3); if (pe3(I3), _5.phase !== "running") break; } if (_5.phase === "running") { let I3 = { offset: d1.offset, length: 0, line: d1.line, col: d1.col }; if (K1 !== L5) { let k4 = { type: L5, text: "", span: I3, synthetic: !0 }; if (b4?.push(k4), _5.next(L5, k4, I3), _5.errors.length > 0) return V3(k4); } if (_5.phase === "running") { let k4 = { type: x5, text: "", span: I3, synthetic: !0 }; if (b4?.push(k4), _5.next(x5, k4, I3), _5.errors.length > 0) return V3(k4); } } return O4.push(...S3.errors), O4.length > 0 ? { ok: !1, errors: j2(h3, O4), tokens: b4 } : _5.phase === "accepted" ? { ok: !0, state: S3, tail: g1, tokens: b4 } : { ok: !1, errors: j2(h3, [{ message: "parse did not accept input", span: { offset: 0, length: 0, line: 1, col: 0 } }]), tokens: b4 }; } function e1(l, f4 = {}) { let E4 = U4(l, f4, { firstStatement: !1, rejectTrailing: !!n.singleStatement }); return E4.ok ? { status: "ok", root: Fe2(E4.state), tokens: E4.tokens } : { status: "error", errors: E4.errors, tokens: E4.tokens }; } function n1(l, f4) { let E4 = e1(l, f4); if (E4.status === "error") throw new a1(E4.errors); return E4; } function A1(l, f4 = {}) { let { allowTrailing: E4 = !1, ...u4 } = f4, d3 = U4(l, u4, { firstStatement: !0, rejectTrailing: !E4 }); if (!d3.ok) return { status: "error", errors: d3.errors, tokens: d3.tokens }; let R4 = d3.state.cmds[0]; return R4 ? { status: "ok", root: R4, tail: d3.tail, tokens: d3.tokens } : { status: "error", errors: j2({ source: l, filename: f4.filename }, [{ message: "no SQL statement in input", span: { offset: 0, length: 0, line: 1, col: 0 } }]), tokens: d3.tokens }; } function L1(l, f4 = {}) { let E4 = A1(l, f4); if (E4.status === "error") throw new a1(E4.errors); return E4; } return { parse: e1, parseOrThrow: n1, parseStmt: A1, parseStmtOrThrow: L1, tokenize: e.tokenize, tokenName: e.tokenName, createEngine: t2, reduce: s, createState: m3, withOptions: (l) => W1(r2, i2, { ...n, ...l }), parserDefs: r2, keywordDefs: i2 }; } function Ye2(r2, i2) { let n = r2.symbols.indexOf(i2); if (n < 0) throw new Error(`parser.ts: missing terminal token "${i2}"`); return n; } function ve2() { return { stmt: void 0, explain: void 0, cmds: [], constraintName: void 0, vtabArgs: [], vtabArgCurrent: "", errors: [] }; } function zn(r2) { let i2 = 1, n = 0; for (let s = 0; s < r2.length; s += 1) r2.charCodeAt(s) === 10 && (i2 += 1, n = s + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: r2.length, line: i2, column: r2.length - n + 1 } }; } function He2(r2, i2, n, s) { let m3 = typeof i2.sourceText == "string" ? i2.sourceText : "", e = s.length > 0 ? s : [{ effectCode: `${r2}.process.noop`, action: "allow", reasonCode: `${r2}.read_only`, kind: "statement", summary: `${r2} source has no external effect.` }], t2 = e[0]; for (let C5 of e.slice(1)) We2[C5.action] > We2[t2.action] && (t2 = C5); let o, a2 = () => o ??= zn(m3), c3 = e.map((C5) => Object.freeze({ kind: C5.kind, location: C5.location ?? a2(), redacted: !0, summary: C5.summary })), A4 = e.map((C5, y4) => Object.freeze({ effectCode: C5.effectCode, action: C5.action, evidenceIndexes: Object.freeze([y4]) })); return Object.freeze({ schemaVersion: u1, action: t2.action, effects: Object.freeze(A4), reasonCode: t2.reasonCode, evidence: Object.freeze(c3), versions: Object.freeze({ policy: f1, rules: Object.freeze({ core: J2.core, [r2]: J2[r2] }), parsers: Object.freeze({ [r2]: n }) }) }); } function qe2(r2) { let i2 = { ...pn, ...r2 }; for (let [n, s] of Object.entries(i2)) if (!Number.isSafeInteger(s) || s < 1) throw new TypeError(`${n} must be a positive safe integer`); return Object.freeze(i2); } function Ke2(r2, i2) { return r2.length * 3 <= i2.maxInputBytes ? !1 : Buffer.byteLength(r2, "utf8") > i2.maxInputBytes; } function nt(r2) { let i2 = 1, n = 0; for (let s = 0; s < r2.length; s += 1) r2.charCodeAt(s) === 10 && (i2 += 1, n = s + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: r2.length, line: i2, column: r2.length - n + 1 } }; } function Ve2(r2, i2, n) { return { kind: "unknown", location: nt(n), redacted: !0, summary: `${r2} source requires review because ${et[i2]}.` }; } function z2({ domain: r2, failure: i2, input: n }) { let s = typeof n.sourceText == "string" ? n.sourceText : ""; return { schemaVersion: u1, action: "review", effects: [{ effectCode: `${r2}.analysis.unknown`, action: "review", evidenceIndexes: [0] }], reasonCode: tt[i2], evidence: [Ve2(r2, i2, s)], versions: { policy: f1, rules: { core: J2.core, [r2]: J2[r2] }, parsers: { [r2]: "unavailable" } } }; } function $e2(r2) { return r2 === "*" || rt.test(r2.replaceAll(".", "_")); } function p(r2) { return typeof r2 == "object" && r2 !== null && !Array.isArray(r2); } function q1(r2) { return { effectCode: `${r2}.database.read`, action: "allow", reasonCode: `${r2}.read_only`, kind: "statement", summary: `${r2} statements have an ordinary read-only contract.` }; } function W(r2, i2) { let n = { write: `${r2} statements may modify database or server state.`, sensitive_read: `${r2} statements may read sensitive database data.`, unknown: `${r2} statement semantics are not statically established.` }; return { effectCode: `${r2}.database.${i2}`, action: "review", reasonCode: `${r2}.${i2}`, kind: "statement", summary: n[i2] }; } function k1(r2) { return r2 !== "*" && $e2(r2); } function it2(r2) { return st.has(r2.toLowerCase()); } function ot2(r2) { return k1(r2) || /^(?:auth|credential|credentials|private_keys?|secrets?|tokens?|api_keys?|service_accounts?)$/i.test(r2); } function Ze(r2, i2) { return r2 !== void 0 && it2(r2) ? !0 : ot2(i2); } function Qe(r2, i2) { let n = [], s = [{ value: r2, depth: 1 }], m3 = 0; for (; s.length > 0; ) { let e = s.pop(); if (m3 += 1, m3 > i2.maxWorkUnits || n.length > i2.maxAstNodes || e.depth > i2.maxNestingDepth) return; if (Array.isArray(e.value)) for (let t2 of e.value) s.push({ value: t2, depth: e.depth + 1 }); else if (p(e.value)) { n.push(e.value); for (let t2 of Object.values(e.value)) s.push({ value: t2, depth: e.depth + 1 }); } } return n; } function E1(r2) { if (p(r2)) { if (typeof r2.name == "string") return r2.name; if (typeof r2.text == "string") return r2.text; if ("objName" in r2) return E1(r2.objName); } } function mt(r2) { return E1(r2.name)?.toLowerCase(); } function lt(r2) { return p(r2) ? E1(r2.dbName) : void 0; } function Je(r2, i2) { let n = Qe(r2, i2); if (!n) return W("sqlite", "unknown"); for (let s of n) { if (s.type !== "TableSelectTable") continue; let m3 = E1(s.tblName); if (m3 === void 0) continue; let e = lt(s.tblName); if (Ze(e, m3) || k1(m3)) return W("sqlite", "sensitive_read"); } if (n.some((s) => s.type === "Id" && typeof s.name == "string" && k1(s.name))) return W("sqlite", "sensitive_read"); for (let s of n) if (typeof s.type == "string" && s.type.startsWith("FunctionCall")) { let m3 = mt(s); if (!m3 || !je2.has(m3)) return W("sqlite", "unknown"); } return q1("sqlite"); } function ut(r2) { let i2 = E1(r2.name)?.toLowerCase(), n = r2.body; return !i2 || !ct.has(i2) || p(n) && n.type !== "CallPragmaBody" && n.type !== "MinusPragmaBody" ? W("sqlite", "write") : q1("sqlite"); } function ft(r2, i2) { if (!p(r2) || typeof r2.type != "string") return W("sqlite", "unknown"); if (r2.type === "SelectStmt") return Je(r2, i2); if (r2.type === "ExplainStmt") { let n = r2.stmt; return p(n) && n.type === "SelectStmt" ? Je(n, i2) : W("sqlite", "write"); } return r2.type === "PragmaStmt" ? ut(r2) : W("sqlite", "write"); } function ze2(r2 = {}) { let i2 = qe2(r2.limits); return { async evaluate(n) { let s = typeof n.sourceText == "string" ? n.sourceText : ""; if (s.trim().length === 0) return z2({ domain: "sqlite", failure: "parse-failed", input: n }); if (Ke2(s, i2)) return z2({ domain: "sqlite", failure: "resource-limit-exceeded", input: n }); let m3; try { m3 = Ge2(s); } catch { return z2({ domain: "sqlite", failure: "parse-failed", input: n }); } if (m3.status !== "ok") return z2({ domain: "sqlite", failure: "parse-failed", input: n }); let e = m3.root.cmds; return e.length === 0 ? z2({ domain: "sqlite", failure: "parse-failed", input: n }) : e.length > i2.maxStatements ? z2({ domain: "sqlite", failure: "resource-limit-exceeded", input: n }) : He2("sqlite", n, at, e.map((t2) => ft(t2, i2))); } }; } function y2(r2 = {}) { return ze2(r2); } var en, nn, V1, tn, rn, _1, J1, T, an, F2, G, g, C1, cn, Dn, D1, a1, Xn, c1, r1, fe2, Ee2, Ae2, m1, de2, ye2, U1, Ie2, Te2, Re2, Z2, s1, ke2, Le2, ge2, xe2, Oe2, he2, X1, M1, F1, be2, Se2, De2, H1, i1, Fn, Yn, vn, Bn, Gn, Wn, Hn, qn, Kn, Vn, $n, jn, Zn, Qn, Be2, X2, Ge2, Ft, Yt, vt, Bt, Gt, Wt, Ht, qt, Kt, Vt, $t, u1, f1, J2, Jn, Jt, We2, pn, o1, et, tt, rt, je2, st, at, ct, init_sqlite = __esm({ "node_modules/@at-series/command-policy/dist/sqlite.js"() { en = Object.defineProperty, nn = (r2, i2) => { for (var n in i2) en(r2, n, { get: i2[n], enumerable: !0 }); }, V1 = (r2) => r2, tn = new Uint8Array([29, 28, 28, 28, 28, 28, 28, 28, 28, 7, 7, 28, 7, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 9, 28, 28, 28, 2, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 28, 10, 28, 25, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 30, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27]); rn = ""; _1 = class { #e; #t; #n; #r; constructor(i2, n) { if (!i2) throw new TypeError(`Expected a ParseErrorContext, got ${typeof i2} (${i2})`); this.#e = n, this.#t = i2, this.#r = i2.filename; } get message() { return this.#e.message; } get span() { return this.#e.span; } get token() { return this.#e.token; } get hints() { return this.#e.hints; } get filename() { return this.#r; } format() { if (this.#n !== void 0) return this.#n; if (!this.#t) throw new Error("ParserDiagnostic: context is required to format a diagnostic"); return this.#n = sn(this.#t, this.#e), this.#t = void 0, this.#n; } toString() { return this.format(); } toJSON() { return { message: this.message, span: this.span, token: this.token, hints: this.hints, filename: this.filename }; } }; J1 = "\u2502 "; (function(r2) { r2[r2.ExprStart = 1] = "ExprStart", r2[r2.ItemStart = 2] = "ItemStart", r2[r2.ItemEnd = 4] = "ItemEnd", r2[r2.ClauseBoundary = 8] = "ClauseBoundary", r2[r2.TableNameContext = 16] = "TableNameContext", r2[r2.Hidden = 32] = "Hidden", r2[r2.KeywordLike = 64] = "KeywordLike", r2[r2.FallbackToId = 128] = "FallbackToId"; })(T || (T = {})); an = ["ID", "STRING", "ILLEGAL", "SPACE", "COMMENT", "COMMA", "SEMI", "LP", "RP", "CASE", "END", "FROM", "FILTER", "OVER"], F2 = T.ExprStart | T.ItemStart | T.ItemEnd, G = T.ExprStart | T.ItemStart, g = T.ClauseBoundary, C1 = T.TableNameContext, cn = { $: { display: "end of input" }, SPACE: { flags: T.Hidden }, COMMENT: { flags: T.Hidden }, ILLEGAL: { flags: T.Hidden }, ID: { display: "identifier", flags: F2 }, STRING: { display: "string literal", flags: F2 }, INTEGER: { display: "integer literal", flags: F2 }, FLOAT: { display: "float literal", flags: F2 }, QNUMBER: { display: "numeric literal", flags: F2 }, BLOB: { display: "blob literal", flags: F2 }, VARIABLE: { display: "bind parameter", flags: F2 }, LP: { display: "(", flags: G }, RP: { display: ")", flags: T.ItemEnd }, COMMA: { display: "," }, SEMI: { display: ";" }, STAR: { display: "*", flags: G }, DOT: { display: "." }, PLUS: { display: "+", flags: G }, MINUS: { display: "-", flags: G }, SLASH: { display: "/" }, REM: { display: "%" }, EQ: { display: "=" }, LT: { display: "<" }, LE: { display: "<=" }, GT: { display: ">" }, GE: { display: ">=" }, NE: { display: "!=" }, CONCAT: { display: "||" }, BITAND: { display: "&" }, BITOR: { display: "|" }, BITNOT: { display: "~", flags: G }, LSHIFT: { display: "<<" }, RSHIFT: { display: ">>" }, PTR: { display: "->" }, NULL: { flags: F2 }, CASE: { flags: G }, CAST: { flags: G }, EXISTS: { flags: G }, NOT: { flags: G }, CURRENT: { flags: F2 }, CTIME_KW: { display: "date/time literal", flags: F2 }, TRUEFALSE: { flags: T.ItemEnd }, SELECT: { flags: T.ItemStart }, VALUES: { flags: T.ItemStart | g }, END: { flags: T.ItemEnd }, FROM: { flags: g | C1 }, WHERE: { flags: g }, GROUP: { flags: g }, HAVING: { flags: g }, WINDOW: { flags: g }, ORDER: { flags: g }, LIMIT: { flags: g }, FILTER: { flags: g }, OVER: { flags: g }, JOIN: { flags: g | C1 }, ON: { flags: g }, USING: { flags: g }, UNION: { flags: g }, INTERSECT: { flags: g }, EXCEPT: { flags: g }, THEN: { flags: g }, ELSE: { flags: g }, WHEN: { flags: g }, DO: { flags: g }, SET: { flags: g }, RETURNING: { flags: g }, INTO: { flags: C1 }, UPDATE: { flags: C1 }, JOIN_KW: { display: "join operator" } }; Dn = Symbol("Sqlite3ParserError"), D1 = class r extends Error { name = "Sqlite3ParserError"; static wrap(i2) { return i2 instanceof r ? i2 : new r(i2.stack ?? `${i2.name}: ${i2.message}`, { cause: i2 }); } [Dn] = !0; toJSON() { return Object.assign({ name: this.name, message: this.message, stack: this.stack, cause: this.cause }, this); } }, a1 = class extends D1 { name = "Sqlite3ParserDiagnosticError"; constructor(i2) { let n = ""; switch (i2.length) { case 0: n = "No diagnostics provided when constructing error"; break; case 1: n = i2[0].format(); break; default: n = `${i2.length} diagnostics: ${i2.map((s) => s.format()).join(` `)}`; } super(n), this.errors = i2; } }; Xn = { offset: 0, length: 0, line: 0, col: 0 }; c1 = (r2) => ({ type: "Name", text: q(r2.text), span: r2.span }), r1 = (r2) => ({ type: "Id", name: q(r2.text), span: r2.span }); fe2 = (r2) => ({ type: "NullLiteral", span: r2.span }), Ee2 = (r2) => ({ type: "StringLiteral", value: q(r2.text), span: r2.span }), Ae2 = (r2) => ({ type: "BlobLiteral", bytes: ce2(r2.text), span: r2.span }), m1 = (r2) => ({ type: "NumericLiteral", value: r2.text, span: r2.span }), de2 = (r2) => ({ type: "KeywordLiteral", value: r2.text, span: r2.span }); ye2 = (r2) => r2.text === "->>" ? "ArrowRightShift" : "ArrowRight", U1 = (r2, i2) => ({ type: "ParenthesizedExpr", exprs: [r2], span: i2 }), Ie2 = (r2) => ({ type: "VariableExpr", name: r2.text, span: r2.span }), Te2 = (r2, i2, n) => ({ type: "CollateExpr", expr: r2, collation: q(i2.text), span: n }), Re2 = (r2, i2, n) => ({ type: "CastExpr", expr: r2, typeName: i2, span: n }), Z2 = (r2, i2, n, s) => ({ type: "BinaryExpr", left: r2, op: i2, right: n, span: s }), s1 = (r2, i2, n) => ({ type: "UnaryExpr", op: r2, expr: i2, span: n }), ke2 = (r2, i2, n, s, m3) => ({ type: "BetweenExpr", lhs: r2, not: i2, start: n, end: s, span: m3 }), Le2 = (r2, i2, n, s) => ({ type: "InListExpr", lhs: r2, not: i2, rhs: n, span: s }), ge2 = (r2, i2, n, s) => ({ type: "InSelectExpr", lhs: r2, not: i2, rhs: n, span: s }), xe2 = (r2, i2, n, s, m3) => ({ type: "InTableExpr", lhs: r2, not: i2, rhs: n, args: s, span: m3 }), Oe2 = (r2, i2) => ({ type: "SubqueryExpr", select: r2, span: i2 }), he2 = (r2, i2) => ({ type: "ExistsExpr", select: r2, span: i2 }); X1 = (r2, i2, n) => ({ type: "FunctionCallStarExpr", name: r1(r2), filterOver: i2, span: n }), M1 = (r2, i2) => ({ type: "QualifiedName", dbName: void 0, objName: r2, alias: void 0, span: i2 }), F1 = (r2, i2, n) => ({ type: "QualifiedName", dbName: r2, objName: i2, alias: void 0, span: n }), be2 = (r2, i2, n) => ({ type: "QualifiedName", dbName: void 0, objName: r2, alias: i2, span: n }), Se2 = (r2, i2, n, s) => ({ type: "QualifiedName", dbName: r2, objName: i2, alias: n, span: s }); De2 = () => ({ select: void 0, joins: [], pendingOp: void 0 }); H1 = {}; nn(H1, { constants: () => Fn, createState: () => Qn, reduce: () => Zn, symbols: () => $n, tables: () => jn, tokens: () => i1 }); i1 = { SEMI: 1, EXPLAIN: 2, QUERY: 3, PLAN: 4, BEGIN: 5, TRANSACTION: 6, DEFERRED: 7, IMMEDIATE: 8, EXCLUSIVE: 9, COMMIT: 10, END: 11, ROLLBACK: 12, SAVEPOINT: 13, RELEASE: 14, TO: 15, TABLE: 16, CREATE: 17, IF: 18, NOT: 19, EXISTS: 20, TEMP: 21, LP: 22, RP: 23, AS: 24, COMMA: 25, WITHOUT: 26, ABORT: 27, ACTION: 28, AFTER: 29, ANALYZE: 30, ASC: 31, ATTACH: 32, BEFORE: 33, BY: 34, CASCADE: 35, CAST: 36, CONFLICT: 37, DATABASE: 38, DESC: 39, DETACH: 40, EACH: 41, FAIL: 42, OR: 43, AND: 44, IS: 45, MATCH: 46, LIKE_KW: 47, BETWEEN: 48, IN: 49, ISNULL: 50, NOTNULL: 51, NE: 52, EQ: 53, GT: 54, LE: 55, LT: 56, GE: 57, ESCAPE: 58, ID: 59, COLUMNKW: 60, DO: 61, FOR: 62, IGNORE: 63, INITIALLY: 64, INSTEAD: 65, NO: 66, KEY: 67, OF: 68, OFFSET: 69, PRAGMA: 70, RAISE: 71, RECURSIVE: 72, REPLACE: 73, RESTRICT: 74, ROW: 75, ROWS: 76, TRIGGER: 77, VACUUM: 78, VIEW: 79, VIRTUAL: 80, WITH: 81, NULLS: 82, FIRST: 83, LAST: 84, CURRENT: 85, FOLLOWING: 86, PARTITION: 87, PRECEDING: 88, RANGE: 89, UNBOUNDED: 90, EXCLUDE: 91, GROUPS: 92, OTHERS: 93, TIES: 94, WITHIN: 95, GENERATED: 96, ALWAYS: 97, MATERIALIZED: 98, REINDEX: 99, RENAME: 100, CTIME_KW: 101, ANY: 102, BITAND: 103, BITOR: 104, LSHIFT: 105, RSHIFT: 106, PLUS: 107, MINUS: 108, STAR: 109, SLASH: 110, REM: 111, CONCAT: 112, PTR: 113, COLLATE: 114, BITNOT: 115, ON: 116, INDEXED: 117, STRING: 118, JOIN_KW: 119, CONSTRAINT: 120, DEFAULT: 121, NULL: 122, PRIMARY: 123, UNIQUE: 124, CHECK: 125, REFERENCES: 126, AUTOINCR: 127, INSERT: 128, DELETE: 129, UPDATE: 130, SET: 131, DEFERRABLE: 132, FOREIGN: 133, DROP: 134, UNION: 135, ALL: 136, EXCEPT: 137, INTERSECT: 138, SELECT: 139, VALUES: 140, DISTINCT: 141, DOT: 142, FROM: 143, JOIN: 144, USING: 145, ORDER: 146, GROUP: 147, HAVING: 148, LIMIT: 149, WHERE: 150, RETURNING: 151, INTO: 152, NOTHING: 153, BLOB: 154, FLOAT: 155, INTEGER: 156, VARIABLE: 157, CASE: 158, WHEN: 159, THEN: 160, ELSE: 161, INDEX: 162, ALTER: 163, ADD: 164, WINDOW: 165, OVER: 166, FILTER: 167, COLUMN: 168, AGG_FUNCTION: 169, AGG_COLUMN: 170, TRUEFALSE: 171, ISNOT: 172, FUNCTION: 173, UPLUS: 174, UMINUS: 175, TRUTH: 176, REGISTER: 177, VECTOR: 178, SELECT_COLUMN: 179, IF_NULL_ROW: 180, ASTERISK: 181, SPAN: 182, ERROR: 183, QNUMBER: 184, SPACE: 185, COMMENT: 186, ILLEGAL: 187 }, Fn = { YYNSTATE: 586, YYNRULE: 413, YYNTOKEN: 188, YYNSYMBOL: 314, YY_MAX_SHIFT: 585, YY_MIN_SHIFTREDUCE: 858, YY_MAX_SHIFTREDUCE: 1270, YY_ERROR_ACTION: 1271, YY_ACCEPT_ACTION: 1272, YY_NO_ACTION: 1273, YY_MIN_REDUCE: 1274, YY_MAX_REDUCE: 1686, YY_ACTTAB_COUNT: 2353, YY_SHIFT_COUNT: 585, YY_REDUCE_COUNT: 405, YYWILDCARD: 102, YYFALLBACK: 1 }, Yn = [490, 230, 579, 133, 130, 188, 579, 1363, 391, 1337, 579, 382, 579, 402, 579, 383, 579, 1361, 378, 406, 1396, 579, 48, 48, 274, 1317, 48, 48, 187, 538, 48, 48, 83, 83, 148, 148, 83, 83, 133, 130, 188, 81, 81, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 1320, 984, 335, 223, 1379, 406, 579, 133, 130, 188, 539, 133, 130, 188, 539, 378, 567, 1015, 560, 533, 1314, 271, 186, 540, 1319, 1016, 83, 83, 1328, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 384, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1640, 381, 45, 984, 1642, 539, 380, 1624, 1640, 553, 570, 570, 570, 1302, 433, 139, 139, 139, 139, 132, 445, 521, 1632, 406, 1300, 8, 187, 139, 139, 139, 139, 1549, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 133, 130, 188, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 1623, 1592, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1199, 1681, 1230, 1681, 1228, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 579, 282, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1272, 1, 1, 585, 3, 1278, 21, 21, 406, 218, 226, 376, 431, 890, 111, 573, 1632, 364, 1375, 8, 890, 417, 1585, 136, 136, 135, 135, 135, 134, 131, 445, 1264, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 426, 1302, 1197, 223, 1379, 244, 520, 223, 1379, 230, 581, 142, 581, 1354, 443, 442, 567, 1558, 560, 579, 567, 405, 560, 1143, 890, 891, 890, 896, 1145, 157, 256, 890, 891, 890, 460, 459, 1144, 486, 1472, 83, 83, 313, 512, 1355, 249, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 6, 478, 449, 428, 537, 1147, 1147, 579, 406, 281, 239, 372, 515, 367, 514, 269, 376, 534, 545, 327, 561, 363, 298, 1633, 20, 20, 8, 83, 83, 896, 327, 561, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 460, 437, 223, 1379, 488, 436, 406, 223, 1379, 95, 331, 1662, 585, 3, 1278, 567, 539, 560, 1658, 226, 567, 1052, 560, 1199, 1682, 535, 1682, 1375, 578, 157, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 327, 561, 223, 1379, 579, 577, 579, 443, 442, 264, 275, 1076, 509, 506, 505, 567, 526, 560, 300, 353, 479, 352, 504, 544, 150, 150, 61, 61, 1063, 256, 327, 561, 1061, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 890, 1197, 488, 223, 1379, 444, 444, 444, 406, 890, 1147, 1147, 332, 449, 1683, 399, 567, 527, 560, 1062, 1064, 1064, 159, 135, 135, 135, 134, 131, 445, 1367, 1367, 378, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 1365, 1365, 1244, 890, 536, 406, 967, 968, 425, 274, 96, 890, 891, 890, 264, 557, 161, 509, 506, 505, 890, 891, 890, 401, 412, 890, 305, 504, 47, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 984, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 584, 1149, 1278, 1472, 890, 891, 890, 226, 216, 1379, 1305, 412, 309, 127, 568, 1375, 4, 337, 982, 928, 525, 567, 1373, 560, 577, 575, 890, 891, 890, 379, 571, 1623, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 223, 1379, 984, 223, 1379, 374, 513, 171, 406, 446, 223, 1379, 378, 567, 929, 560, 567, 1298, 560, 1052, 157, 564, 25, 567, 890, 560, 474, 157, 569, 412, 256, 157, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 244, 520, 223, 1379, 1076, 488, 134, 131, 445, 44, 125, 125, 449, 461, 418, 567, 1630, 560, 126, 8, 446, 580, 446, 890, 429, 1061, 890, 353, 479, 352, 528, 327, 561, 558, 209, 890, 891, 890, 327, 561, 576, 1625, 327, 561, 484, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1062, 1064, 1064, 1065, 36, 223, 1379, 1631, 223, 1379, 8, 579, 1623, 406, 890, 7, 255, 360, 567, 308, 560, 567, 236, 560, 890, 891, 890, 890, 891, 890, 1244, 83, 83, 1155, 1154, 475, 234, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 890, 1222, 1003, 1222, 406, 413, 117, 98, 510, 1264, 1052, 1472, 549, 577, 1221, 323, 1221, 1223, 407, 1223, 890, 891, 890, 579, 12, 378, 274, 2, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 83, 83, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1222, 890, 891, 890, 984, 224, 1379, 890, 353, 466, 338, 1264, 46, 1221, 548, 890, 1223, 575, 567, 406, 560, 422, 439, 910, 210, 1087, 1087, 1101, 1104, 472, 246, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 406, 577, 579, 890, 902, 984, 1599, 890, 891, 890, 392, 879, 415, 251, 1623, 890, 891, 890, 454, 462, 579, 41, 50, 50, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 579, 51, 51, 1002, 1091, 579, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 579, 890, 21, 21, 890, 891, 890, 21, 21, 1626, 242, 1380, 1604, 469, 356, 406, 358, 420, 1602, 1243, 83, 83, 427, 567, 456, 560, 163, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 406, 425, 440, 1124, 170, 890, 891, 890, 342, 897, 868, 869, 870, 267, 266, 265, 577, 1629, 577, 579, 8, 1597, 579, 416, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 83, 83, 1541, 21, 21, 1488, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 312, 1257, 488, 579, 577, 389, 425, 171, 1558, 1591, 301, 897, 339, 1628, 341, 406, 8, 237, 441, 1077, 229, 373, 1655, 83, 83, 1554, 1556, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 406, 291, 579, 1e3, 1057, 324, 1151, 1015, 577, 577, 1150, 371, 501, 1548, 1374, 1016, 398, 1269, 303, 310, 144, 370, 66, 66, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 268, 579, 1554, 473, 340, 406, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 905, 577, 577, 67, 67, 577, 1370, 468, 237, 1490, 471, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 579, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1270, 247, 555, 1076, 373, 1655, 1603, 21, 21, 241, 240, 398, 1198, 411, 414, 190, 425, 1489, 1472, 905, 1063, 554, 432, 390, 1061, 171, 1001, 579, 425, 363, 1236, 1585, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 890, 1172, 579, 21, 21, 530, 579, 373, 1655, 297, 1172, 1472, 1062, 1064, 1064, 425, 1173, 1222, 220, 223, 1379, 517, 21, 21, 124, 1173, 23, 23, 572, 1491, 1221, 1174, 567, 1223, 560, 464, 579, 221, 304, 1235, 1174, 423, 1244, 296, 90, 118, 579, 1270, 977, 486, 350, 114, 952, 976, 1341, 579, 21, 21, 890, 891, 890, 563, 953, 373, 1655, 406, 52, 52, 457, 1171, 495, 556, 330, 287, 577, 68, 68, 577, 424, 355, 543, 311, 289, 577, 1204, 406, 579, 547, 357, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 579, 406, 53, 53, 541, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 69, 69, 579, 293, 186, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 579, 557, 70, 70, 268, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 579, 577, 579, 71, 71, 579, 328, 1600, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 72, 72, 73, 73, 1340, 54, 54, 579, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 579, 465, 579, 1611, 481, 542, 579, 55, 55, 579, 90, 470, 579, 90, 579, 485, 579, 411, 579, 1580, 56, 56, 58, 58, 90, 122, 59, 59, 579, 60, 60, 326, 74, 74, 146, 146, 147, 147, 75, 75, 90, 117, 579, 99, 233, 406, 492, 1414, 76, 76, 231, 1353, 977, 940, 123, 1415, 120, 976, 1194, 494, 400, 242, 77, 77, 451, 406, 579, 453, 359, 140, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 1339, 406, 22, 22, 579, 140, 129, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 165, 579, 17, 579, 78, 78, 141, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 260, 62, 62, 79, 79, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 480, 579, 919, 493, 579, 344, 579, 117, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 579, 63, 63, 348, 80, 80, 64, 64, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 82, 82, 579, 913, 579, 115, 579, 1357, 406, 579, 482, 579, 1e3, 349, 1054, 117, 273, 1338, 487, 39, 273, 366, 174, 174, 175, 175, 87, 87, 377, 65, 65, 149, 149, 306, 91, 1086, 1086, 1100, 1103, 1090, 1090, 138, 138, 139, 139, 139, 139, 1248, 448, 579, 40, 295, 579, 489, 579, 273, 396, 396, 395, 284, 393, 262, 913, 1251, 579, 502, 361, 270, 117, 84, 84, 294, 172, 172, 151, 151, 193, 1404, 334, 927, 926, 934, 935, 166, 145, 145, 333, 579, 169, 579, 117, 1425, 137, 137, 137, 137, 136, 136, 135, 135, 135, 134, 131, 445, 1471, 579, 247, 173, 173, 167, 167, 1131, 127, 568, 1399, 4, 195, 579, 1127, 579, 270, 1018, 1019, 579, 179, 155, 155, 156, 1066, 571, 579, 1001, 127, 568, 579, 4, 579, 154, 154, 152, 152, 10, 579, 153, 153, 194, 579, 1148, 1148, 571, 86, 86, 446, 322, 88, 88, 85, 85, 1006, 975, 273, 124, 49, 49, 564, 1648, 57, 57, 562, 972, 1131, 124, 446, 974, 1411, 124, 1146, 1146, 551, 894, 408, 162, 1476, 550, 564, 327, 561, 1066, 497, 1316, 1301, 1306, 1290, 252, 1076, 1289, 1291, 1282, 551, 288, 125, 125, 318, 552, 319, 13, 518, 320, 126, 458, 446, 580, 446, 397, 1076, 1061, 299, 250, 254, 1452, 125, 125, 463, 127, 568, 1457, 4, 302, 126, 346, 446, 580, 446, 1445, 1462, 1061, 1461, 507, 491, 1583, 571, 243, 369, 1337, 1545, 347, 1544, 1062, 1064, 1064, 1065, 36, 307, 351, 565, 388, 227, 228, 1292, 516, 1264, 1261, 1408, 446, 1409, 1606, 1407, 1062, 1064, 1064, 1065, 36, 321, 295, 1406, 564, 238, 1244, 396, 396, 395, 284, 393, 98, 1608, 1251, 1607, 207, 235, 551, 184, 1458, 197, 1550, 550, 14, 248, 1244, 193, 94, 334, 97, 467, 500, 199, 1076, 203, 200, 333, 201, 202, 125, 125, 115, 204, 1464, 1463, 127, 568, 126, 4, 446, 580, 446, 1539, 1584, 1061, 483, 15, 1582, 211, 1467, 100, 477, 571, 496, 354, 217, 195, 213, 498, 214, 403, 1360, 1359, 1358, 179, 430, 106, 156, 1348, 404, 1331, 1330, 919, 244, 1325, 446, 1062, 1064, 1064, 1065, 36, 1661, 1248, 448, 368, 194, 295, 564, 1323, 1324, 1347, 396, 396, 395, 284, 393, 1322, 143, 1251, 434, 1654, 435, 1377, 529, 316, 375, 1244, 317, 11, 1524, 276, 193, 438, 334, 1430, 1636, 1635, 1076, 119, 164, 408, 333, 1429, 125, 125, 327, 561, 1386, 116, 325, 386, 126, 385, 446, 580, 446, 387, 546, 1061, 1378, 1376, 43, 582, 127, 568, 1249, 4, 225, 283, 458, 285, 195, 286, 583, 160, 1287, 1279, 532, 176, 179, 571, 409, 156, 191, 410, 177, 314, 861, 447, 232, 1062, 1064, 1064, 1065, 36, 178, 329, 450, 1189, 452, 194, 92, 455, 446, 93, 253, 336, 192, 196, 1141, 1139, 180, 198, 1257, 955, 564, 257, 343, 24, 258, 1244, 345, 1152, 273, 205, 1159, 1163, 206, 181, 182, 476, 419, 421, 208, 101, 408, 183, 102, 1165, 259, 327, 561, 261, 1162, 5, 1076, 103, 212, 16, 878, 104, 125, 125, 981, 499, 89, 568, 370, 4, 126, 263, 446, 580, 446, 458, 215, 1061, 503, 105, 26, 508, 362, 571, 27, 917, 127, 568, 365, 4, 107, 930, 315, 185, 168, 28, 108, 519, 522, 1241, 511, 523, 110, 571, 109, 524, 446, 1106, 1206, 1062, 1064, 1064, 1065, 36, 18, 1205, 112, 113, 564, 1122, 1107, 1105, 966, 290, 245, 272, 446, 124, 292, 219, 1010, 1004, 1225, 29, 1227, 30, 1233, 31, 564, 1244, 32, 1229, 117, 33, 1234, 1109, 34, 1110, 1076, 35, 559, 121, 9, 1170, 125, 125, 277, 37, 566, 19, 278, 1067, 126, 895, 446, 580, 446, 128, 1076, 1061, 1211, 42, 574, 38, 125, 125, 222, 189, 158, 279, 280, 1307, 126, 394, 446, 580, 446, 859, 531, 1061, 858, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1062, 1064, 1064, 1065, 36, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1062, 1064, 1064, 1065, 36, 1273, 1273, 1273, 1273, 1273, 1244, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1244], vn = [196, 196, 196, 273, 274, 275, 196, 223, 203, 225, 196, 219, 196, 208, 196, 219, 196, 233, 196, 19, 255, 196, 216, 217, 24, 216, 216, 217, 196, 206, 216, 217, 216, 217, 216, 217, 216, 217, 273, 274, 275, 216, 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, 59, 196, 238, 239, 19, 196, 273, 274, 275, 252, 273, 274, 275, 252, 196, 251, 31, 253, 261, 215, 256, 257, 261, 216, 39, 216, 217, 223, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 277, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 309, 310, 240, 118, 309, 252, 311, 300, 309, 310, 212, 213, 214, 196, 261, 54, 55, 56, 57, 58, 114, 304, 305, 19, 207, 308, 196, 54, 55, 56, 57, 282, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 273, 274, 275, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 300, 292, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 22, 23, 86, 25, 88, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 26, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 188, 189, 190, 191, 192, 193, 216, 217, 19, 25, 198, 196, 19, 59, 25, 304, 305, 24, 206, 308, 59, 231, 206, 107, 108, 109, 110, 111, 112, 113, 114, 60, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 232, 196, 102, 238, 239, 166, 167, 238, 239, 196, 205, 69, 207, 230, 107, 108, 251, 196, 253, 196, 251, 208, 253, 116, 117, 118, 119, 59, 121, 81, 265, 117, 118, 119, 213, 214, 129, 268, 196, 216, 217, 228, 96, 230, 120, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 288, 289, 294, 114, 196, 155, 156, 196, 19, 120, 121, 122, 123, 124, 125, 126, 196, 206, 252, 139, 140, 132, 206, 305, 216, 217, 308, 216, 217, 118, 139, 140, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 283, 263, 238, 239, 196, 232, 19, 238, 239, 67, 23, 190, 191, 192, 193, 251, 252, 253, 196, 198, 251, 73, 253, 22, 23, 261, 25, 206, 196, 81, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 139, 140, 238, 239, 196, 196, 196, 107, 108, 120, 201, 101, 123, 124, 125, 251, 206, 253, 267, 128, 129, 130, 133, 196, 216, 217, 216, 217, 118, 265, 139, 140, 122, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 59, 102, 196, 238, 239, 212, 213, 214, 19, 59, 155, 156, 23, 294, 297, 298, 251, 252, 253, 154, 155, 156, 72, 109, 110, 111, 112, 113, 114, 235, 236, 196, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 235, 236, 184, 59, 135, 19, 137, 138, 196, 24, 24, 117, 118, 119, 120, 146, 72, 123, 124, 125, 117, 118, 119, 210, 211, 59, 267, 133, 240, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 191, 11, 193, 196, 117, 118, 119, 198, 238, 239, 210, 211, 206, 19, 20, 206, 22, 262, 109, 35, 95, 251, 206, 253, 196, 196, 117, 118, 119, 201, 36, 300, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 238, 239, 118, 238, 239, 241, 66, 243, 19, 59, 238, 239, 196, 251, 74, 253, 251, 206, 253, 73, 81, 71, 22, 251, 59, 253, 263, 81, 210, 211, 265, 81, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 166, 167, 238, 239, 101, 196, 112, 113, 114, 240, 107, 108, 294, 121, 61, 251, 305, 253, 115, 308, 117, 118, 119, 59, 131, 122, 59, 128, 129, 130, 206, 139, 140, 206, 22, 117, 118, 119, 139, 140, 302, 303, 139, 140, 116, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 154, 155, 156, 157, 158, 238, 239, 305, 238, 239, 308, 196, 300, 19, 59, 22, 15, 23, 251, 267, 253, 251, 151, 253, 117, 118, 119, 117, 118, 119, 184, 216, 217, 128, 129, 130, 151, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 76, 144, 76, 19, 199, 25, 152, 23, 60, 73, 196, 87, 196, 89, 252, 89, 92, 201, 92, 117, 118, 119, 196, 22, 196, 24, 22, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, 217, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 76, 117, 118, 119, 59, 238, 239, 59, 128, 129, 130, 60, 240, 89, 146, 59, 92, 196, 251, 19, 253, 263, 252, 23, 22, 46, 47, 48, 49, 280, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 19, 196, 196, 59, 23, 118, 201, 117, 118, 119, 16, 21, 196, 120, 300, 117, 118, 119, 125, 268, 196, 22, 216, 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 196, 216, 217, 144, 122, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 59, 216, 217, 117, 118, 119, 216, 217, 303, 25, 239, 196, 80, 77, 19, 79, 231, 196, 23, 216, 217, 231, 251, 196, 253, 22, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 19, 196, 252, 124, 23, 117, 118, 119, 16, 59, 7, 8, 9, 128, 129, 130, 196, 305, 196, 196, 308, 201, 196, 201, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, 217, 162, 216, 217, 272, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 231, 25, 196, 196, 196, 241, 196, 243, 196, 201, 262, 118, 77, 305, 79, 19, 308, 143, 252, 23, 196, 306, 307, 216, 217, 213, 214, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 19, 23, 196, 25, 23, 252, 29, 31, 196, 196, 33, 122, 19, 201, 201, 39, 22, 23, 262, 267, 22, 132, 216, 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 46, 196, 283, 65, 162, 19, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 59, 196, 196, 216, 217, 196, 201, 201, 143, 272, 201, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 102, 119, 66, 101, 306, 307, 196, 216, 217, 107, 108, 22, 23, 116, 295, 296, 196, 272, 196, 117, 118, 85, 231, 241, 122, 243, 144, 196, 196, 132, 94, 206, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 59, 12, 196, 216, 217, 19, 196, 306, 307, 100, 12, 196, 154, 155, 156, 196, 27, 76, 231, 238, 239, 109, 216, 217, 25, 27, 216, 217, 87, 272, 89, 42, 251, 92, 253, 245, 196, 231, 262, 147, 42, 263, 184, 134, 254, 160, 196, 102, 136, 268, 262, 116, 63, 141, 226, 196, 216, 217, 117, 118, 119, 63, 73, 306, 307, 19, 216, 217, 196, 23, 289, 231, 163, 164, 196, 216, 217, 196, 263, 201, 145, 262, 201, 196, 98, 19, 196, 146, 201, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 196, 19, 216, 217, 19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, 217, 196, 256, 257, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 196, 146, 216, 217, 46, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 196, 196, 216, 217, 196, 201, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 216, 217, 216, 217, 226, 216, 217, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 245, 196, 196, 245, 117, 196, 216, 217, 196, 254, 196, 196, 254, 196, 245, 196, 116, 196, 196, 216, 217, 216, 217, 254, 160, 216, 217, 196, 216, 217, 245, 216, 217, 216, 217, 216, 217, 216, 217, 254, 25, 196, 150, 151, 19, 19, 196, 216, 217, 24, 23, 136, 25, 159, 196, 161, 141, 23, 196, 25, 25, 216, 217, 131, 19, 196, 134, 196, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 226, 19, 216, 217, 196, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 22, 196, 24, 196, 216, 217, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 24, 216, 217, 216, 217, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 130, 196, 127, 117, 196, 23, 196, 25, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 216, 217, 153, 216, 217, 216, 217, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 216, 217, 196, 59, 196, 150, 196, 196, 19, 196, 130, 196, 25, 23, 23, 25, 25, 196, 23, 22, 25, 196, 216, 217, 216, 217, 216, 217, 196, 216, 217, 216, 217, 153, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 1, 2, 196, 53, 5, 196, 23, 196, 25, 10, 11, 12, 13, 14, 142, 118, 17, 196, 23, 23, 25, 25, 216, 217, 22, 216, 217, 216, 217, 30, 258, 32, 121, 122, 7, 8, 23, 216, 217, 40, 196, 23, 196, 25, 196, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 196, 196, 119, 216, 217, 216, 217, 59, 19, 20, 196, 22, 70, 196, 23, 196, 25, 83, 84, 196, 78, 216, 217, 81, 59, 36, 196, 144, 19, 20, 196, 22, 196, 216, 217, 216, 217, 48, 196, 216, 217, 99, 196, 155, 156, 36, 216, 217, 59, 255, 216, 217, 216, 217, 23, 23, 25, 25, 216, 217, 71, 313, 216, 217, 236, 23, 118, 25, 59, 23, 196, 25, 155, 156, 85, 23, 134, 25, 196, 90, 71, 139, 140, 118, 285, 196, 196, 142, 196, 293, 101, 196, 196, 196, 85, 284, 107, 108, 255, 90, 255, 244, 146, 255, 115, 163, 117, 118, 119, 194, 101, 122, 246, 293, 293, 266, 107, 108, 259, 19, 20, 270, 22, 259, 115, 290, 117, 118, 119, 266, 270, 122, 270, 220, 290, 270, 36, 229, 219, 225, 219, 247, 219, 154, 155, 156, 157, 158, 247, 246, 279, 246, 241, 241, 202, 116, 60, 38, 260, 59, 260, 218, 260, 154, 155, 156, 157, 158, 259, 5, 260, 71, 244, 184, 10, 11, 12, 13, 14, 152, 218, 17, 218, 22, 151, 85, 43, 271, 234, 282, 90, 269, 293, 184, 30, 291, 32, 291, 18, 18, 237, 101, 200, 237, 40, 237, 237, 107, 108, 150, 200, 271, 271, 19, 20, 115, 22, 117, 118, 119, 247, 247, 122, 247, 269, 247, 234, 234, 159, 62, 36, 287, 286, 22, 70, 200, 221, 200, 221, 218, 218, 218, 78, 64, 22, 81, 227, 221, 224, 224, 127, 166, 218, 59, 154, 155, 156, 157, 158, 0, 1, 2, 218, 99, 5, 71, 218, 220, 227, 10, 11, 12, 13, 14, 218, 149, 17, 24, 307, 114, 242, 301, 281, 221, 184, 281, 22, 276, 91, 30, 82, 32, 264, 312, 312, 101, 159, 165, 134, 40, 264, 107, 108, 139, 140, 250, 148, 278, 248, 115, 249, 117, 118, 119, 247, 147, 122, 242, 242, 25, 204, 19, 20, 13, 22, 200, 197, 163, 197, 70, 6, 195, 222, 195, 195, 141, 209, 78, 36, 299, 81, 296, 299, 209, 222, 4, 3, 22, 154, 155, 156, 157, 158, 209, 122, 19, 122, 19, 99, 22, 125, 59, 22, 15, 140, 16, 152, 23, 23, 131, 143, 25, 20, 71, 145, 16, 22, 116, 184, 162, 68, 25, 68, 75, 1, 143, 131, 131, 41, 61, 37, 152, 53, 134, 131, 53, 117, 34, 139, 140, 24, 1, 5, 101, 53, 116, 24, 20, 53, 107, 108, 109, 19, 19, 20, 132, 22, 115, 126, 117, 118, 119, 163, 22, 122, 67, 22, 22, 67, 23, 36, 22, 59, 19, 20, 24, 22, 22, 28, 67, 37, 23, 34, 150, 22, 146, 23, 97, 22, 25, 36, 34, 147, 59, 23, 23, 154, 155, 156, 157, 158, 22, 98, 143, 143, 71, 23, 23, 23, 136, 23, 142, 34, 59, 25, 23, 22, 117, 144, 88, 34, 86, 34, 93, 34, 71, 184, 34, 75, 25, 34, 75, 23, 22, 11, 101, 22, 25, 25, 44, 23, 107, 108, 22, 22, 25, 22, 142, 23, 115, 23, 117, 118, 119, 22, 101, 122, 23, 22, 24, 34, 107, 108, 25, 25, 23, 142, 142, 142, 115, 15, 117, 118, 119, 1, 141, 122, 1, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 154, 155, 156, 157, 158, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 154, 155, 156, 157, 158, 314, 314, 314, 314, 314, 184, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 184, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188], Bn = [1696, 2013, 585, 1918, 585, 333, 581, 229, 1743, 1763, 1854, 2168, 2168, 2168, 574, 229, 229, 229, 229, 229, 0, 44, 44, 327, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 188, 188, 1209, 1209, 428, 218, 218, 218, 218, 119, 223, 372, 476, 520, 624, 733, 776, 848, 887, 959, 998, 1070, 1109, 1153, 1314, 1334, 1495, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1515, 1354, 1535, 1639, 1639, 1948, 2056, 2148, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 76, 88, 88, 88, 88, 88, 88, 88, 105, 150, 401, 437, 478, 195, 600, 1121, 600, 342, 342, 600, 600, 516, 576, 120, 120, 120, 303, 21, 21, 2353, 2353, 227, 227, 227, 646, 694, 694, 694, 694, 1257, 1257, 732, 716, 796, 195, 181, 386, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 403, 600, 600, 600, 772, 772, 600, 403, 403, 600, 896, 718, 718, 249, 249, 249, 2353, 2353, 2353, 2353, 2353, 2353, 2353, 1126, 352, 352, 850, 331, 905, 500, 649, 804, 600, 600, 600, 600, 600, 600, 600, 600, 728, 600, 600, 600, 600, 600, 600, 600, 600, 575, 575, 575, 600, 600, 600, 1106, 600, 600, 600, 793, 1160, 1266, 600, 600, 600, 600, 600, 600, 600, 600, 600, 799, 644, 1105, 519, 519, 519, 1637, 1180, 1020, 205, 740, 610, 1362, 948, 1357, 1362, 1357, 1496, 1505, 610, 610, 1505, 610, 948, 1496, 1485, 1497, 1370, 1104, 1104, 1104, 1203, 1203, 1203, 1203, 1357, 1267, 1267, 1364, 1050, 1385, 1551, 1793, 1850, 1793, 1793, 1873, 1873, 1781, 1787, 1915, 1897, 1934, 1934, 1934, 1934, 1935, 1813, 1935, 1813, 1787, 1787, 1813, 1915, 1813, 1897, 1897, 1823, 1921, 1935, 1965, 1935, 1965, 1793, 1793, 1793, 1933, 1976, 1976, 1965, 1793, 1877, 1793, 1933, 1793, 1793, 1839, 1880, 2007, 1919, 1919, 1965, 2018, 1951, 1951, 1962, 1962, 1891, 1886, 1912, 1922, 1813, 1880, 1880, 2048, 1935, 2064, 2064, 2078, 2078, 2078, 2353, 2353, 2353, 2353, 2353, 2353, 2353, 2353, 827, 1177, 1009, 1122, 1213, 902, 967, 900, 1504, 1402, 1647, 1592, 1480, 1530, 1640, 635, 1641, 1645, 1680, 1569, 1692, 1693, 1594, 1608, 1724, 1017, 1715, 1710, 1254, 1702, 1745, 1785, 1688, 1786, 1796, 1800, 1642, 1671, 1806, 1719, 1699, 2095, 2097, 2079, 1986, 2090, 1988, 2092, 2091, 2094, 1989, 2102, 2103, 2098, 2099, 1978, 1968, 1992, 2100, 2100, 1981, 2106, 1983, 2113, 2108, 2015, 1971, 2066, 2110, 2068, 2062, 2101, 2137, 1996, 2009, 2100, 2010, 2082, 2107, 2100, 1993, 2093, 2096, 2105, 2109, 2017, 2033, 2117, 2130, 2154, 2151, 2043, 2136, 2141, 2147, 2037, 2046, 2155, 2112, 2158, 2159, 2160, 2163, 2115, 2127, 2165, 2104, 2164, 2169, 2126, 2157, 2172, 2162, 2047, 2176, 2177, 2171, 2053, 2180, 2059, 2185, 2178, 2186, 2193, 2118, 2074, 2075, 2197, 2198, 2199, 2087, 2083, 2201, 2203, 2206, 2114, 2192, 2208, 2088, 2203, 2200, 2202, 2204, 2207, 2145, 2167, 2149, 2209, 2170, 2144, 2218, 2210, 2223, 2225, 2226, 2228, 2227, 2231, 2235, 2237, 2236, 2234, 2238, 2239, 2241, 2246, 2240, 2248, 2250, 2249, 2252, 2119, 2138, 2139, 2140, 2253, 2256, 2269, 2287, 2290], Gn = [46, 206, 149, 400, 252, 50, 1049, -177, -194, -190, -186, -184, -180, -132, 154, 397, 407, 446, 506, 509, -235, -208, -204, -114, 24, 749, 754, 843, 1015, 104, 1055, 1074, 554, 1108, 618, 767, -175, 840, 881, 102, 886, -168, -55, 94, 361, 615, 361, 615, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -182, 146, 250, 712, 730, 934, 972, 1078, 1118, 1127, 1158, 1176, 1198, 1216, 1233, 1235, 1238, 1260, 1273, 1275, 1279, 1282, 1285, 1287, 1289, 1291, 1301, 1315, 1339, 1361, 1378, 1380, 1415, 1418, 1420, 1434, 1456, 1458, 1460, 1463, 1465, 1503, 1506, 1508, 1518, 1541, 1543, 1559, 1571, 1573, 1577, 1584, 1588, 1590, 1596, 1600, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -123, 322, 86, 451, -216, 620, -87, 280, 420, -195, 789, -270, 922, 969, 1025, 735, -270, -270, -270, -270, -137, -137, -137, -136, 193, 293, 491, 880, 281, 299, 251, 56, 419, -68, 204, 204, 608, 711, 837, 839, 346, 822, 884, 882, 940, 941, 990, 991, 994, 398, 1044, 606, 1056, 1046, 1083, 1087, 1146, 1149, 1155, 49, 399, 158, -178, 123, 393, 441, 669, 838, 1006, 1234, 597, 729, 782, 347, 391, 453, 943, 1058, 1225, 1228, 1239, 1139, 1255, -191, -158, -134, -196, 64, 207, 217, 269, 682, 722, 779, 785, 791, 898, 1034, 1140, 1240, 657, 1276, 1284, 1292, 1320, 1328, 1332, 1341, 1461, 1096, 1227, 1327, 1471, 1475, 1482, 1469, 1545, 1558, 1568, 1548, 1502, 1582, 1628, 1636, 217, 1643, 1644, 1646, 1649, 1650, 1651, 1550, 1553, 1565, 1597, 1599, 1602, 1469, 1611, 1669, 1574, 1575, 1605, 1603, 1620, 1613, 1617, 1618, 1589, 1648, 1614, 1616, 1655, 1619, 1657, 1598, 1667, 1662, 1668, 1673, 1675, 1677, 1652, 1654, 1656, 1664, 1663, 1665, 1666, 1625, 1659, 1682, 1706, 1697, 1653, 1716, 1718, 1658, 1660, 1661, 1670, 1676, 1708, 1717, 1720, 1722, 1723, 1756, 1727, 1764, 1728, 1694, 1695, 1730, 1709, 1732, 1746, 1747, 1698, 1700, 1789, 1769, 1791, 1771, 1775, 1776, 1777, 1773, 1778, 1779, 1780, 1788, 1801, 1798, 1795, 1802, 1810, 1725, 1792, 1734, 1755, 1758, 1816, 1765, 1735, 1736, 1782, 1790, 1783, 1809, 1815, 1814, 1821, 1829, 1830, 1870, 1879, 1883, 1885, 1890, 1892, 1893, 1794, 1797, 1799, 1881, 1888, 1864, 1876, 1898], Wn = [1616, 1616, 1534, 1616, 1271, 1271, 1271, 1405, 1271, 1271, 1271, 1534, 1534, 1534, 1271, 1271, 1271, 1271, 1271, 1271, 1401, 1433, 1433, 1594, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1532, 1271, 1271, 1271, 1271, 1634, 1634, 1271, 1618, 1617, 1271, 1271, 1271, 1442, 1271, 1271, 1271, 1449, 1271, 1271, 1271, 1271, 1271, 1271, 1535, 1536, 1271, 1271, 1271, 1271, 1593, 1595, 1551, 1577, 1456, 1455, 1454, 1453, 1444, 1421, 1447, 1440, 1528, 1529, 1527, 1531, 1535, 1536, 1271, 1443, 1495, 1512, 1494, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1504, 1511, 1510, 1509, 1518, 1508, 1505, 1497, 1496, 1498, 1499, 1271, 1271, 1299, 1271, 1362, 1271, 1271, 1271, 1271, 1271, 1484, 1500, 1486, 1485, 1487, 1271, 1515, 1501, 1514, 1513, 1601, 1304, 1303, 1552, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1634, 1271, 1271, 1271, 1271, 1271, 1598, 1596, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1427, 1271, 1271, 1271, 1634, 1634, 1271, 1427, 1427, 1271, 1296, 1634, 1634, 1308, 1308, 1308, 1612, 1395, 1395, 1395, 1395, 1405, 1395, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1401, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1281, 1679, 1271, 1569, 1401, 1401, 1401, 1403, 1394, 1283, 1679, 1679, 1459, 1448, 1402, 1424, 1448, 1424, 1676, 1446, 1459, 1459, 1446, 1459, 1402, 1676, 1334, 1671, 1327, 1433, 1433, 1433, 1423, 1423, 1423, 1423, 1424, 1427, 1427, 1530, 1402, 1394, 1271, 1364, 1679, 1364, 1364, 1678, 1678, 1552, 1466, 1469, 1366, 1372, 1372, 1372, 1372, 1293, 1446, 1293, 1446, 1466, 1466, 1446, 1469, 1446, 1366, 1366, 1576, 1574, 1293, 1542, 1293, 1542, 1364, 1364, 1364, 1349, 1271, 1271, 1542, 1364, 1334, 1364, 1349, 1364, 1364, 1656, 1441, 1271, 1546, 1546, 1542, 1537, 1647, 1647, 1436, 1436, 1271, 1385, 1439, 1437, 1446, 1441, 1441, 1352, 1293, 1666, 1666, 1280, 1280, 1280, 1684, 1684, 1612, 1315, 1315, 1336, 1336, 1315, 1271, 1271, 1271, 1271, 1271, 1271, 1309, 1271, 1271, 1271, 1553, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1412, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1619, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1474, 1271, 1276, 1609, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1450, 1451, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1573, 1572, 1271, 1271, 1271, 1271, 1271, 1465, 1271, 1271, 1271, 1460, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1413, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1332, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1381, 1271, 1271, 1533, 1271, 1271, 1271, 1271, 1271, 1438, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1428, 1271, 1271, 1271, 1389, 1271, 1271, 1271, 1271, 1271, 1271, 1387, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1653, 1410, 1475, 1271, 1479, 1297, 1271, 1288, 1271, 1271], Hn = [0, 0, 59, 59, 59, 59, 0, 59, 59, 59, 0, 59, 59, 59, 59, 0, 0, 0, 59, 0, 0, 59, 0, 0, 0, 0, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 0, 0, 0, 59, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], qn = [190, 190, 192, 192, 191, 193, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 193, 193, 200, 200, 199, 199, 202, 202, 205, 205, 207, 207, 203, 203, 208, 196, 196, 210, 210, 210, 210, 211, 211, 209, 209, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 224, 224, 220, 220, 222, 222, 225, 225, 225, 225, 226, 226, 226, 226, 226, 223, 223, 227, 227, 227, 204, 204, 228, 228, 229, 230, 230, 230, 230, 230, 233, 233, 218, 218, 234, 234, 235, 235, 193, 237, 237, 193, 193, 193, 206, 206, 206, 238, 238, 243, 243, 243, 243, 239, 239, 239, 251, 239, 253, 253, 244, 244, 244, 254, 245, 245, 245, 255, 255, 255, 246, 246, 257, 257, 256, 256, 256, 256, 201, 201, 262, 262, 262, 262, 258, 258, 258, 258, 258, 260, 260, 260, 259, 259, 259, 241, 241, 231, 231, 219, 219, 219, 264, 264, 264, 248, 248, 249, 249, 242, 242, 242, 242, 193, 247, 247, 266, 266, 266, 266, 193, 267, 267, 267, 267, 193, 193, 270, 270, 270, 270, 270, 270, 271, 271, 268, 268, 269, 269, 263, 263, 217, 217, 217, 217, 216, 216, 216, 216, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 216, 217, 217, 217, 217, 217, 217, 217, 217, 217, 273, 273, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, 274, 274, 217, 275, 275, 217, 217, 217, 217, 217, 217, 278, 278, 279, 279, 277, 277, 261, 261, 252, 252, 276, 276, 193, 280, 280, 221, 221, 232, 232, 281, 281, 193, 193, 193, 282, 282, 193, 193, 193, 193, 193, 283, 283, 283, 283, 213, 213, 214, 193, 284, 284, 284, 284, 285, 285, 285, 285, 286, 286, 287, 287, 288, 288, 290, 290, 289, 289, 289, 289, 217, 217, 236, 236, 236, 193, 193, 193, 292, 292, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 294, 296, 297, 297, 298, 265, 265, 265, 301, 301, 301, 300, 240, 240, 302, 302, 303, 304, 304, 304, 304, 304, 304, 305, 305, 305, 308, 308, 308, 310, 310, 311, 311, 309, 309, 309, 312, 312, 313, 313, 313, 313, 250, 272, 272, 272, 307, 307, 306, 216, 188, 189, 189, 190, 197, 197, 198, 205, 212, 212, 229, 235, 254, 217, 283, 290, 291, 291, 293, 293, 295, 295, 296, 299, 299, 299], Kn = [2, 3, 1, 3, 1, 3, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 3, 5, 6, 0, 3, 1, 0, 5, 2, 0, 3, 2, 1, 4, 2, 2, 1, 1, 0, 1, 4, 6, 1, 2, 2, 0, 2, 2, 4, 3, 3, 2, 2, 3, 5, 2, 4, 4, 1, 2, 4, 2, 3, 4, 0, 1, 0, 2, 2, 3, 3, 3, 2, 2, 1, 1, 2, 3, 2, 0, 2, 2, 0, 2, 3, 1, 1, 2, 7, 5, 5, 10, 0, 1, 0, 3, 0, 2, 1, 1, 4, 2, 0, 8, 4, 1, 5, 6, 3, 1, 3, 1, 2, 1, 1, 7, 8, 1, 4, 1, 5, 5, 1, 1, 0, 0, 3, 2, 4, 2, 1, 0, 0, 2, 2, 0, 5, 7, 6, 6, 1, 3, 1, 3, 3, 5, 1, 1, 2, 3, 4, 2, 4, 0, 0, 3, 2, 0, 3, 5, 3, 1, 1, 0, 2, 2, 0, 0, 3, 0, 2, 0, 2, 4, 4, 6, 0, 2, 0, 2, 2, 4, 9, 5, 7, 3, 5, 7, 8, 0, 2, 12, 9, 5, 8, 2, 0, 2, 1, 0, 3, 3, 1, 3, 1, 3, 5, 1, 1, 1, 1, 1, 3, 6, 5, 8, 4, 12, 6, 9, 5, 13, 1, 5, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 3, 5, 2, 3, 3, 4, 6, 5, 2, 2, 2, 3, 1, 2, 5, 1, 2, 5, 3, 5, 4, 4, 5, 5, 4, 2, 0, 1, 0, 1, 0, 3, 1, 0, 3, 11, 1, 0, 0, 3, 5, 3, 0, 2, 4, 2, 3, 2, 0, 2, 4, 5, 4, 5, 1, 1, 1, 1, 2, 1, 2, 14, 1, 1, 2, 0, 1, 1, 1, 3, 0, 3, 0, 2, 3, 2, 3, 2, 8, 6, 5, 1, 4, 6, 1, 1, 1, 4, 6, 3, 0, 2, 1, 2, 1, 2, 6, 8, 6, 8, 6, 9, 10, 11, 9, 1, 4, 7, 0, 1, 3, 1, 0, 2, 3, 1, 2, 3, 6, 1, 3, 1, 3, 5, 5, 6, 4, 5, 1, 2, 0, 3, 6, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 0, 2, 2, 2, 1, 1, 2, 2, 1, 1, 4, 2, 5, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 1, 0, 1, 0, 0, 1, 1, 3, 2, 0, 4, 2], Vn = [[1, 2, 5, 10, 11, 12, 13, 14, 17, 30, 32, 40, 70, 78, 81, 99, 134, 139, 140, 163], [0, 1, 2, 5, 10, 11, 12, 13, 14, 17, 30, 32, 40, 70, 78, 81, 99, 134, 139, 140, 163], [19, 20, 22, 36, 59, 71, 81, 101, 107, 108, 115, 117, 118, 119, 122, 139, 140, 154, 155, 156, 157, 158, 184], [5, 10, 11, 12, 13, 14, 17, 30, 32, 40, 70, 78, 81, 99, 134, 139, 140, 163], [19, 20, 22, 36, 59, 71, 81, 101, 107, 108, 115, 117, 118, 119, 122, 139, 140, 154, 155, 156, 157, 158, 184], [73, 81, 128, 129, 130, 139, 140], [11, 73, 81, 128, 129, 130, 139, 140], [81, 139, 140], [19, 20, 22, 36, 48, 59, 71, 85, 90, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 85, 90, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 85, 90, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [81, 121, 139, 140], [81, 139, 140], [81, 139, 140], [81, 139, 140], [81, 139, 140], [81, 139, 140], [19, 24, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 118], [19, 31, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 31, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 67, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [59, 107, 108, 116, 117, 118, 119, 121, 129, 155, 156], [59, 107, 108, 116, 117, 118, 119, 121, 129, 155, 156], [59, 76, 87, 89, 92, 117, 118, 119, 146], [59, 76, 87, 89, 92, 117, 118, 119, 146], [59, 117, 118, 119, 120, 123, 124, 125, 133], [25, 139, 140], [25, 139, 140], [25, 139, 140], [25, 139, 140], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 86, 88, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 25, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 69, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 24, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 151], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 160], [19, 23, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 160], [19, 24, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 141, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 109, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 141, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [19, 20, 22, 36, 59, 71, 101, 107, 108, 115, 117, 118, 119, 122, 154, 155, 156, 157, 158, 184], [54, 55, 56, 57, 58, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [54, 55, 56, 57, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114], [107, 108, 109, 110, 111, 112, 113, 114], [109, 110, 111, 112, 113, 114], [59, 72, 117, 118, 119], [59, 72, 117, 118, 119], [26, 59, 117, 118, 119], [59, 117, 118, 119], [19, 46, 116, 132], [59, 117, 118, 119], [107, 108, 155, 156], [107, 108, 155, 156], [59, 117, 118, 119], [59, 117, 118, 119], [95, 166, 167], [112, 113, 114], [166, 167], [166, 167], [166, 167], [139, 140], [114], [114], [], [], [19, 24, 96, 114, 120, 121, 122, 123, 124, 125, 126, 132], [19, 24, 96, 114, 120, 121, 122, 123, 124, 125, 126, 132], [19, 24, 96, 114, 120, 121, 122, 123, 124, 125, 126, 132], [59, 117, 118, 119, 152], [22, 59, 117, 118, 119], [22, 59, 117, 118, 119], [22, 59, 117, 118, 119], [22, 59, 117, 118, 119], [12, 27, 42, 63, 73], [12, 27, 42, 63, 73], [22, 59, 117, 118, 119], [76, 87, 89, 92, 146], [22, 59, 117, 118, 119], [26, 59, 117, 118, 119], [22, 23, 25, 102], [22, 23, 25, 102], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [135, 137, 138, 146], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [25, 76, 89, 92], [25, 76, 89, 92], [59, 117, 118, 119], [135, 137, 138, 146], [135, 137, 138, 146], [59, 117, 118, 119], [21, 80, 124, 162], [76, 89, 92], [76, 89, 92], [59, 118], [59, 118], [59, 118], [], [], [], [], [], [], [], [22, 59, 101, 107, 108, 117, 118, 122, 154, 155, 156, 184], [101, 118, 122, 154, 155, 156, 184], [101, 118, 122, 154, 155, 156, 184], [22, 59, 117, 118, 119], [120, 123, 124, 125, 133], [22, 59, 117, 118, 119], [59, 109, 117, 118, 119], [59, 117, 118, 119, 144], [59, 117, 118, 119, 144], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [73, 128, 129, 130], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [35, 66, 74, 131], [35, 66, 74, 131], [35, 66, 74, 131], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [23, 25, 119, 144], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [22, 24, 59, 118], [66, 85, 94, 147], [12, 27, 42, 63], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [59, 117, 118, 119], [60, 120, 125], [128, 129, 130], [29, 33, 65], [24, 59, 118], [24, 59, 118], [24, 59, 118], [25, 119, 144], [109, 136, 141], [7, 8, 9], [60, 120], [15, 60], [116, 151], [150, 151], [25, 143], [19, 117], [150, 151], [19, 117], [19, 117], [25, 150], [116, 151], [116, 151], [25, 150], [116, 151], [25, 143], [19, 117], [25, 127], [23, 25], [46, 116], [31, 39], [31, 39], [31, 39], [116, 145], [116, 145], [116, 145], [116, 145], [19, 117], [25, 146], [25, 146], [159, 161], [25, 143], [136, 141], [22, 24], [116], [60], [116], [116], [38], [38], [152], [151], [22], [43], [18], [18], [18], [18], [18], [150], [18], [150], [151], [151], [150], [22], [150], [43], [43], [159], [62], [18], [22], [18], [22], [116], [116], [116], [64], [22], [22], [22], [116], [127], [116], [64], [116], [116], [166], [149], [24], [114], [114], [22], [22], [91], [91], [82], [82], [159], [165], [148], [147], [150], [149], [149], [25], [18], [13], [13], [6], [6], [6], [], [], [], [], [], [], [], [], [46, 47, 48, 49, 122], [100, 134, 163, 164], [16, 77, 79, 162], [22, 23, 102], [22, 23, 102], [128, 129, 130], [22, 59, 118], [16, 77, 79], [23, 25], [131, 134], [22, 53], [23, 25], [130, 153], [130, 153], [23, 25], [22, 61], [23, 25], [23, 25], [23, 25], [24, 142], [23, 25], [23, 25], [59, 118], [121, 122], [7, 8], [122, 132], [23, 25], [23, 146], [19, 98], [59, 118], [23, 25], [23, 25], [83, 84], [23, 25], [23, 25], [23, 25], [155, 156], [155, 156], [23, 25], [59, 118], [22, 142], [4], [3], [22], [122], [19], [122], [19], [22], [22], [125], [15], [16], [23], [23], [140], [152], [131], [25], [25], [143], [20], [145], [16], [22], [116], [162], [68], [25], [68], [75], [41], [1], [143], [131], [25], [131], [61], [37], [25], [152], [53], [53], [53], [53], [131], [117], [34], [24], [1], [5], [116], [24], [20], [19], [132], [126], [22], [67], [22], [22], [23], [22], [67], [59], [24], [97], [28], [22], [67], [37], [23], [34], [150], [22], [23], [34], [146], [22], [147], [23], [25], [23], [22], [98], [143], [143], [23], [23], [23], [136], [142], [23], [25], [23], [117], [34], [22], [144], [25], [34], [34], [34], [34], [88], [75], [86], [44], [75], [93], [25], [34], [23], [22], [25], [22], [25], [23], [22], [11], [22], [25], [22], [23], [23], [22], [34], [23], [22], [24], [25], [142], [142], [142], [142], [25], [23], [15], [1], [1]], $n = ["$", "SEMI", "EXPLAIN", "QUERY", "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", "ROLLBACK", "SAVEPOINT", "RELEASE", "TO", "TABLE", "CREATE", "IF", "NOT", "EXISTS", "TEMP", "LP", "RP", "AS", "COMMA", "WITHOUT", "ABORT", "ACTION", "AFTER", "ANALYZE", "ASC", "ATTACH", "BEFORE", "BY", "CASCADE", "CAST", "CONFLICT", "DATABASE", "DESC", "DETACH", "EACH", "FAIL", "OR", "AND", "IS", "MATCH", "LIKE_KW", "BETWEEN", "IN", "ISNULL", "NOTNULL", "NE", "EQ", "GT", "LE", "LT", "GE", "ESCAPE", "ID", "COLUMNKW", "DO", "FOR", "IGNORE", "INITIALLY", "INSTEAD", "NO", "KEY", "OF", "OFFSET", "PRAGMA", "RAISE", "RECURSIVE", "REPLACE", "RESTRICT", "ROW", "ROWS", "TRIGGER", "VACUUM", "VIEW", "VIRTUAL", "WITH", "NULLS", "FIRST", "LAST", "CURRENT", "FOLLOWING", "PARTITION", "PRECEDING", "RANGE", "UNBOUNDED", "EXCLUDE", "GROUPS", "OTHERS", "TIES", "WITHIN", "GENERATED", "ALWAYS", "MATERIALIZED", "REINDEX", "RENAME", "CTIME_KW", "ANY", "BITAND", "BITOR", "LSHIFT", "RSHIFT", "PLUS", "MINUS", "STAR", "SLASH", "REM", "CONCAT", "PTR", "COLLATE", "BITNOT", "ON", "INDEXED", "STRING", "JOIN_KW", "CONSTRAINT", "DEFAULT", "NULL", "PRIMARY", "UNIQUE", "CHECK", "REFERENCES", "AUTOINCR", "INSERT", "DELETE", "UPDATE", "SET", "DEFERRABLE", "FOREIGN", "DROP", "UNION", "ALL", "EXCEPT", "INTERSECT", "SELECT", "VALUES", "DISTINCT", "DOT", "FROM", "JOIN", "USING", "ORDER", "GROUP", "HAVING", "LIMIT", "WHERE", "RETURNING", "INTO", "NOTHING", "BLOB", "FLOAT", "INTEGER", "VARIABLE", "CASE", "WHEN", "THEN", "ELSE", "INDEX", "ALTER", "ADD", "WINDOW", "OVER", "FILTER", "COLUMN", "AGG_FUNCTION", "AGG_COLUMN", "TRUEFALSE", "ISNOT", "FUNCTION", "UPLUS", "UMINUS", "TRUTH", "REGISTER", "VECTOR", "SELECT_COLUMN", "IF_NULL_ROW", "ASTERISK", "SPAN", "ERROR", "QNUMBER", "SPACE", "COMMENT", "ILLEGAL", "input", "cmdlist", "ecmd", "cmdx", "explain", "cmd", "transtype", "trans_opt", "nm", "savepoint_opt", "createkw", "temp", "ifnotexists", "fullname", "create_table_args", "columnlist", "conslist_opt", "table_option_set", "select", "table_option", "columnname", "carglist", "typetoken", "typename", "signed", "plus_num", "minus_num", "ccons", "term", "expr", "onconf", "sortorder", "autoinc", "eidlist_opt", "refargs", "defer_subclause", "generated", "refarg", "refact", "init_deferred_pred_opt", "conslist", "tconscomma", "tcons", "sortlist", "eidlist", "defer_subclause_opt", "orconf", "resolvetype", "raisetype", "ifexists", "selectnowith", "oneselect", "wqlist", "orderby_opt", "limit_opt", "multiselect_op", "distinct", "selcollist", "from", "where_opt", "groupby_opt", "having_opt", "window_clause", "values", "nexprlist", "mvalues", "sclp", "as", "seltablist", "stl_prefix", "joinop", "indexed_opt", "on_using", "exprlist", "xfullname", "idlist", "nulls", "with", "where_opt_ret", "setlist", "insert_cmd", "idlist_opt", "upsert", "returning", "filter_over", "likeop", "between_op", "in_op", "paren_exprlist", "case_operand", "case_exprlist", "case_else", "uniqueflag", "collate", "vinto", "nmnum", "trigger_time", "trigger_event", "foreach_clause", "when_clause", "trigger_cmd_list", "trigger_cmd", "tridxby", "database_kw_opt", "key_opt", "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken", "lp", "anylist", "wqitem", "wqas", "windowdefn_list", "windowdefn", "window", "frame_opt", "filter_clause", "over_clause", "range_or_rows", "frame_bound", "frame_bound_s", "frame_bound_e", "frame_exclude_opt", "frame_exclude"], jn = { yy_action: Yn, yy_lookahead: vn, yy_shift_ofst: Bn, yy_reduce_ofst: Gn, yy_default: Wn, yyFallback: Hn, yyRuleInfoLhs: qn, yyRuleInfoNRhs: Kn, yy_expected: Vn }, Zn = (r2, i2, n, s) => { let m3 = (e, t2, ...o) => { r2.errors.push({ message: e, span: t2, hints: o }); }; switch (i2) { case 0: case 1: { Me2(r2); return; } case 2: { r2.explain = "Explain"; return; } case 3: { r2.explain = "QueryPlan"; return; } case 4: return; case 5: { let e = n[1].minor, t2 = n[2].minor; r2.stmt = { type: "BeginStmt", tx: e, txName: t2, span: s }; return; } case 6: case 7: { let e; return e = void 0, e; } case 8: { let e = n[1].minor, t2; return t2 = e, t2; } case 9: { let e; return e = void 0, e; } case 10: { let e; return e = "Deferred", e; } case 11: { let e; return e = "Immediate", e; } case 12: { let e; return e = "Exclusive", e; } case 13: { let e = n[1].minor; r2.stmt = { type: "CommitStmt", txName: e, span: s }; return; } case 14: { let e = n[1].minor; r2.stmt = { type: "RollbackStmt", txName: e, savepointName: void 0, span: s }; return; } case 15: { let e = n[1].minor; r2.stmt = { type: "SavepointStmt", savepointName: e, span: s }; return; } case 16: { let e = n[2].minor; r2.stmt = { type: "ReleaseStmt", savepointName: e, span: s }; return; } case 17: { let e = n[1].minor, t2 = n[4].minor; r2.stmt = { type: "RollbackStmt", txName: e, savepointName: t2, span: s }; return; } case 18: { let e = n[1].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor; r2.stmt = { type: "CreateTableStmt", temporary: e, ifNotExists: t2, tblName: o, body: a2, span: s }; return; } case 19: { let e; return e = !1, e; } case 20: case 21: { let e; return e = !0, e; } case 22: { let e; return e = !1, e; } case 23: { let e = n[1].minor, t2 = n[2].minor, o = n[4].minor, a2; return a2 = we2(e, t2, o, s), a2; } case 24: { let e = n[1].minor, t2; return t2 = { type: "AsSelectCreateTableBody", select: e, span: s }, t2; } case 25: { let e; return e = 0, e; } case 26: { let e = n[0].minor, t2 = n[2].minor, o; return o = e | t2, o; } case 27: { let e = n[1].minor, t2; return e.text.toLowerCase() === "rowid" ? t2 = 128 : (r2.errors.push(Y2(`unknown table option: ${e.text}`, e.span, { message: "expected WITHOUT ROWID", span: void 0 })), t2 = 0), t2; } case 28: { let e = n[0].minor, t2; return e.text.toLowerCase() === "strict" ? t2 = 65536 : (r2.errors.push(Y2(`unknown table option: ${e.text}`, e.span, { message: "expected STRICT or WITHOUT ROWID", span: void 0 })), t2 = 0), t2; } case 29: { let e = n[2].minor, t2 = n[3].minor, o = n[0].minor, a2 = R1(e.colName, e.colType, t2, s); return B1(r2, o, a2), o; } case 30: { let e = n[0].minor, t2 = n[1].minor, o, a2 = R1(e.colName, e.colType, t2, s); return o = [], B1(r2, o, a2), o; } case 31: { let e = n[0].minor, t2 = n[1].minor, o; return o = { colName: e, colType: t2, span: s }, o; } case 32: case 33: { let e = n[0].minor, t2; return t2 = c1(e), t2; } case 34: { let e; return e = void 0, e; } case 35: { let e = n[0].minor, t2; return t2 = { type: "Type", name: e, size: void 0, span: s }, t2; } case 36: { let e = n[0].minor, t2 = n[2].minor, o; return o = { type: "Type", name: e, size: { type: "MaxSizeTypeSize", size: t2, span: s }, span: s }, o; } case 37: { let e = n[0].minor, t2 = n[2].minor, o = n[4].minor, a2; return a2 = { type: "Type", name: e, size: { type: "TypeSizeTypeSize", size1: t2, size2: o, span: s }, span: s }, a2; } case 38: { let e = n[0].minor, t2; return t2 = q(e.text), t2; } case 39: { let e = n[1].minor, t2 = n[0].minor; return t2 = t2 + " " + q(e.text), t2; } case 40: { let e = n[1].minor, t2 = n[0].minor; return e && t2.push(e), t2; } case 41: { let e; return e = [], e; } case 42: { let e = n[1].minor, t2; return r2.constraintName = e, t2 = void 0, t2; } case 43: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "DefaultColumnConstraint", expr: e, span: s }, span: s }, r2.constraintName = void 0, t2; } case 44: { let e = n[2].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "DefaultColumnConstraint", expr: U1(e, s), span: s }, span: s }, r2.constraintName = void 0, t2; } case 45: { let e = n[2].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "DefaultColumnConstraint", expr: s1("Positive", e, s), span: s }, span: s }, r2.constraintName = void 0, t2; } case 46: { let e = n[2].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "DefaultColumnConstraint", expr: s1("Negative", e, s), span: s }, span: s }, r2.constraintName = void 0, t2; } case 47: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "DefaultColumnConstraint", expr: r1(e), span: s }, span: s }, r2.constraintName = void 0, t2; } case 48: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "NotNullColumnConstraint", nullable: !0, conflictClause: e, span: s }, span: s }, r2.constraintName = void 0, t2; } case 49: { let e = n[2].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "NotNullColumnConstraint", nullable: !1, conflictClause: e, span: s }, span: s }, r2.constraintName = void 0, t2; } case 50: { let e = n[2].minor, t2 = n[3].minor, o = n[4].minor, a2; return a2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "PrimaryKeyColumnConstraint", order: e, conflictClause: t2, autoIncrement: o, span: s }, span: s }, r2.constraintName = void 0, a2; } case 51: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "UniqueColumnConstraint", conflictClause: e, span: s }, span: s }, r2.constraintName = void 0, t2; } case 52: { let e = n[2].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "CheckColumnConstraint", expr: e, span: s }, span: s }, r2.constraintName = void 0, t2; } case 53: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2; return a2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "ForeignKeyColumnConstraint", clause: { type: "ForeignKeyClause", tblName: e, columns: t2, args: o, span: s }, deferClause: void 0, span: s }, span: s }, r2.constraintName = void 0, a2; } case 54: { let e = n[0].minor, t2; return t2 = { type: "NamedColumnConstraint", name: void 0, constraint: { type: "DeferColumnConstraint", clause: e, span: s }, span: s }, t2; } case 55: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: { type: "CollateColumnConstraint", collationName: c1(e), span: s }, span: s }, r2.constraintName = void 0, t2; } case 56: { let e = n[3].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: e, span: s }, r2.constraintName = void 0, t2; } case 57: { let e = n[1].minor, t2; return t2 = { type: "NamedColumnConstraint", name: r2.constraintName, constraint: e, span: s }, r2.constraintName = void 0, t2; } case 58: { let e = n[1].minor, t2; return t2 = { type: "GeneratedColumnConstraint", expr: e, typ: void 0, span: s }, t2; } case 59: { let e = n[1].minor, t2 = n[3].minor, o; return o = { type: "GeneratedColumnConstraint", expr: e, typ: r1(t2), span: s }, o; } case 60: { let e; return e = !1, e; } case 61: { let e; return e = !0, e; } case 62: { let e; return e = [], e; } case 63: { let e = n[1].minor, t2 = n[0].minor; return t2.push(e), t2; } case 64: { let e = n[1].minor, t2; return t2 = { type: "MatchRefArg", name: e, span: s }, t2; } case 65: { let e = n[2].minor, t2; return t2 = { type: "OnInsertRefArg", action: e, span: s }, t2; } case 66: { let e = n[2].minor, t2; return t2 = { type: "OnDeleteRefArg", action: e, span: s }, t2; } case 67: { let e = n[2].minor, t2; return t2 = { type: "OnUpdateRefArg", action: e, span: s }, t2; } case 68: { let e; return e = "SetNull", e; } case 69: { let e; return e = "SetDefault", e; } case 70: { let e; return e = "Cascade", e; } case 71: { let e; return e = "Restrict", e; } case 72: { let e; return e = "NoAction", e; } case 73: { let e = n[2].minor, t2; return t2 = { type: "DeferSubclause", deferrable: !1, initDeferred: e, span: s }, t2; } case 74: { let e = n[1].minor, t2; return t2 = { type: "DeferSubclause", deferrable: !0, initDeferred: e, span: s }, t2; } case 75: { let e; return e = void 0, e; } case 76: { let e; return e = "InitiallyDeferred", e; } case 77: { let e; return e = "InitiallyImmediate", e; } case 78: { let e; return e = void 0, e; } case 79: { let e = n[1].minor, t2; return t2 = e, t2; } case 80: { let e = n[2].minor, t2 = n[0].minor; return e && t2.push(e), t2; } case 81: { let e = n[0].minor, t2; return t2 = e ? [e] : [], t2; } case 82: { r2.constraintName = void 0; return; } case 83: { let e = n[1].minor, t2; return r2.constraintName = e, t2 = void 0, t2; } case 84: { let e = n[3].minor, t2 = n[4].minor, o = n[6].minor, a2; return a2 = { type: "NamedTableConstraint", name: r2.constraintName, constraint: { type: "PrimaryKeyTableConstraint", columns: e, autoIncrement: t2, conflictClause: o, span: s }, span: s }, r2.constraintName = void 0, a2; } case 85: { let e = n[2].minor, t2 = n[4].minor, o; return o = { type: "NamedTableConstraint", name: r2.constraintName, constraint: { type: "UniqueTableConstraint", columns: e, conflictClause: t2, span: s }, span: s }, r2.constraintName = void 0, o; } case 86: { let e = n[2].minor, t2 = n[4].minor, o; return o = { type: "NamedTableConstraint", name: r2.constraintName, constraint: { type: "CheckTableConstraint", expr: e, conflictClause: t2, span: s }, span: s }, r2.constraintName = void 0, o; } case 87: { let e = n[3].minor, t2 = n[6].minor, o = n[7].minor, a2 = n[8].minor, c3 = n[9].minor, A4; return A4 = { type: "NamedTableConstraint", name: r2.constraintName, constraint: { type: "ForeignKeyTableConstraint", columns: e, clause: { type: "ForeignKeyClause", tblName: t2, columns: o, args: a2, span: s }, deferClause: c3, span: s }, span: s }, r2.constraintName = void 0, A4; } case 88: { let e; return e = void 0, e; } case 89: { let e = n[0].minor, t2; return t2 = e, t2; } case 90: { let e; return e = void 0, e; } case 91: { let e = n[2].minor, t2; return t2 = e, t2; } case 92: { let e; return e = void 0, e; } case 93: { let e = n[1].minor, t2; return t2 = e, t2; } case 94: { let e; return e = "Ignore", e; } case 95: { let e; return e = "Replace", e; } case 96: { let e = n[2].minor, t2 = n[3].minor; r2.stmt = { type: "DropTableStmt", ifExists: e, tblName: t2, span: s }; return; } case 97: { let e; return e = !0, e; } case 98: { let e; return e = !1, e; } case 99: { let e = n[1].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor, c3 = n[7].minor; r2.stmt = { type: "CreateViewStmt", temporary: e, ifNotExists: t2, viewName: o, columns: a2, select: c3, span: s }; return; } case 100: { let e = n[2].minor, t2 = n[3].minor; r2.stmt = { type: "DropViewStmt", ifExists: e, viewName: t2, span: s }; return; } case 101: { let e = n[0].minor; r2.stmt = { type: "SelectStmt", body: e, span: s }; return; } case 102: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3; return c3 = T1({ type: "With", recursive: !1, ctes: e, span: s }, t2, o, a2, s), c3; } case 103: { let e = n[2].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor, c3; return c3 = T1({ type: "With", recursive: !0, ctes: e, span: s }, t2, o, a2, s), c3; } case 104: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = T1(void 0, e, t2, o, s), a2; } case 105: { let e = n[0].minor, t2; return t2 = { select: e, compounds: void 0 }, t2; } case 106: { let e = n[1].minor, t2 = n[2].minor, o = n[0].minor; return Pe2(o, { type: "CompoundSelect", operator: e, select: t2, span: s }), o; } case 107: { let e; return e = "Union", e; } case 108: { let e; return e = "UnionAll", e; } case 109: { let e; return e = "Except", e; } case 110: { let e; return e = "Intersect", e; } case 111: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[5].minor, A4 = n[6].minor, C5; return C5 = v1(r2, e, t2, o, a2, c3, A4, void 0, s), C5; } case 112: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[5].minor, A4 = n[6].minor, C5 = n[7].minor, y4; return y4 = v1(r2, e, t2, o, a2, c3, A4, C5, s), y4; } case 113: { let e = n[0].minor, t2; return t2 = { type: "SelectValues", values: e, span: s }, t2; } case 114: { let e = n[2].minor, t2; return t2 = [{ type: "ValuesRow", values: e, span: s }], t2; } case 115: { let e = n[0].minor, t2; return t2 = { type: "SelectValues", values: e, span: s }, t2; } case 116: case 117: { let e = n[3].minor, t2 = n[0].minor; return Ue2(r2, t2, e, s), t2; } case 118: { let e; return e = "Distinct", e; } case 119: { let e; return e = "All", e; } case 120: { let e; return e = void 0, e; } case 121: { let e; return e = [], e; } case 122: { let e = n[1].minor, t2 = n[2].minor, o = n[0].minor; return o.push({ type: "ExprResultColumn", expr: e, alias: t2, span: s }), o; } case 123: { let e = n[0].minor; return e.push({ type: "StarResultColumn", span: s }), e; } case 124: { let e = n[1].minor, t2 = n[0].minor; return t2.push({ type: "TableStarResultColumn", table: e, span: s }), t2; } case 125: { let e = n[1].minor, t2; return t2 = { type: "AsAs", name: e, span: s }, t2; } case 126: { let e = n[0].minor, t2; return t2 = { type: "ElidedAs", name: c1(e), span: s }, t2; } case 127: { let e; return e = void 0, e; } case 128: { let e; return e = void 0, e; } case 129: { let e = n[1].minor, t2; return t2 = Y1(e, s), t2; } case 130: { let e = n[1].minor, t2 = n[0].minor; return t2.pendingOp = e, t2; } case 131: { let e; return e = De2(), e; } case 132: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[0].minor; return l1(r2, c3, { type: "TableSelectTable", tblName: e, alias: t2, indexed: o, span: s }, a2), c3; } case 133: { let e = n[1].minor, t2 = n[3].minor, o = n[5].minor, a2 = n[6].minor, c3 = n[0].minor; return l1(r2, c3, { type: "TableCallSelectTable", tblName: e, args: t2, alias: o, span: s }, a2), c3; } case 134: { let e = n[2].minor, t2 = n[4].minor, o = n[5].minor, a2 = n[0].minor; return l1(r2, a2, { type: "SelectSelectTable", select: e, alias: t2, span: s }, o), a2; } case 135: { let e = n[2].minor, t2 = n[4].minor, o = n[5].minor, a2 = n[0].minor; return l1(r2, a2, { type: "SubSelectTable", from: Y1(e, s), alias: t2, span: s }, o), a2; } case 136: { let e = n[0].minor, t2; return t2 = M1(e, s), t2; } case 137: { let e = n[0].minor, t2 = n[2].minor, o; return o = F1(e, t2, s), o; } case 138: { let e = n[0].minor, t2; return t2 = M1(e, s), t2; } case 139: { let e = n[0].minor, t2 = n[2].minor, o; return o = F1(e, t2, s), o; } case 140: { let e = n[0].minor, t2 = n[2].minor, o; return o = be2(e, t2, s), o; } case 141: { let e = n[0].minor, t2 = n[2].minor, o = n[4].minor, a2; return a2 = Se2(e, t2, o, s), a2; } case 142: { let e; return e = { type: "CommaJoinOperator", span: s }, e; } case 143: { let e; return e = { type: "TypedJoinJoinOperator", joinType: void 0, span: s }, e; } case 144: { let e = n[0].minor, t2; return t2 = I1(r2, e, void 0, void 0, s), t2; } case 145: { let e = n[0].minor, t2 = n[1].minor, o; return o = I1(r2, e, t2, void 0, s), o; } case 146: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = I1(r2, e, t2, o, s), a2; } case 147: { let e = n[1].minor, t2; return t2 = { type: "OnJoinConstraint", expr: e, span: s }, t2; } case 148: { let e = n[2].minor, t2; return t2 = { type: "UsingJoinConstraint", columns: e, span: s }, t2; } case 149: { let e; return e = void 0, e; } case 150: { let e; return e = void 0, e; } case 151: { let e = n[2].minor, t2; return t2 = { type: "IndexedByIndexed", idxName: e, span: s }, t2; } case 152: { let e; return e = { type: "NotIndexedIndexed", span: s }, e; } case 153: { let e; return e = void 0, e; } case 154: { let e = n[2].minor, t2; return t2 = e, t2; } case 155: { let e = n[2].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[0].minor; return a2.push({ type: "SortedColumn", expr: e, order: t2, nulls: o, span: s }), a2; } case 156: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = [{ type: "SortedColumn", expr: e, order: t2, nulls: o, span: s }], a2; } case 157: { let e; return e = "Asc", e; } case 158: { let e; return e = "Desc", e; } case 159: { let e; return e = void 0, e; } case 160: { let e; return e = "First", e; } case 161: { let e; return e = "Last", e; } case 162: { let e; return e = void 0, e; } case 163: { let e; return e = void 0, e; } case 164: { let e = n[2].minor, t2; return t2 = e, t2; } case 165: { let e; return e = void 0, e; } case 166: { let e = n[1].minor, t2; return t2 = e, t2; } case 167: { let e; return e = void 0, e; } case 168: { let e = n[1].minor, t2; return t2 = { type: "Limit", expr: e, offset: void 0, span: s }, t2; } case 169: { let e = n[1].minor, t2 = n[3].minor, o; return o = { type: "Limit", expr: e, offset: t2, span: s }, o; } case 170: { let e = n[1].minor, t2 = n[3].minor, o; return o = { type: "Limit", expr: t2, offset: e, span: s }, o; } case 171: { let e = n[0].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor; r2.stmt = { type: "DeleteStmt", with: e, tblName: t2, indexed: o, whereClause: a2.where, returning: a2.returning, orderBy: void 0, limit: void 0, span: s }; return; } case 172: { let e; return e = void 0, e; } case 173: { let e = n[1].minor, t2; return t2 = e, t2; } case 174: { let e; return e = { where: void 0, returning: void 0, span: s }, e; } case 175: { let e = n[1].minor, t2; return t2 = { where: e, returning: void 0, span: s }, t2; } case 176: { let e = n[1].minor, t2; return t2 = { where: void 0, returning: e, span: s }, t2; } case 177: { let e = n[1].minor, t2 = n[3].minor, o; return o = { where: e, returning: t2, span: s }, o; } case 178: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[6].minor, A4 = n[7].minor, C5 = n[8].minor; r2.stmt = { type: "UpdateStmt", with: e, orConflict: t2, tblName: o, indexed: a2, sets: c3, from: A4, whereClause: C5.where, returning: C5.returning, orderBy: void 0, limit: void 0, span: s }; return; } case 179: { let e = n[2].minor, t2 = n[4].minor, o = n[0].minor; return o.push({ type: "SetAssignment", colNames: [e], expr: t2, span: s }), o; } case 180: { let e = n[3].minor, t2 = n[6].minor, o = n[0].minor; return o.push({ type: "SetAssignment", colNames: e, expr: t2, span: s }), o; } case 181: { let e = n[0].minor, t2 = n[2].minor, o; return o = [{ type: "SetAssignment", colNames: [e], expr: t2, span: s }], o; } case 182: { let e = n[1].minor, t2 = n[4].minor, o; return o = [{ type: "SetAssignment", colNames: e, expr: t2, span: s }], o; } case 183: { let e = n[0].minor, t2 = n[1].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[5].minor, A4 = n[6].minor; r2.stmt = { type: "InsertStmt", with: e, orConflict: t2, tblName: o, columns: a2, body: { type: "SelectInsertBody", select: c3, upsert: A4.upsert, span: s }, returning: A4.returning, span: s }; return; } case 184: { let e = n[0].minor, t2 = n[1].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[7].minor; r2.stmt = { type: "InsertStmt", with: e, orConflict: t2, tblName: o, columns: a2, body: { type: "DefaultValuesInsertBody", span: s }, returning: c3.columns, span: s }; return; } case 185: { let e; return e = { upsert: void 0, returning: void 0, returningSpan: void 0, span: s }, e; } case 186: { let e = n[1].minor, t2; return t2 = { upsert: void 0, returning: e, returningSpan: s, span: s }, t2; } case 187: { let e = n[3].minor, t2 = n[5].minor, o = n[9].minor, a2 = n[10].minor, c3 = n[11].minor, A4; return A4 = { upsert: { type: "Upsert", index: G1(r2, e, t2, s), doClause: { type: "SetUpsertDo", sets: o, whereClause: a2, span: s }, next: c3.upsert, span: s }, returning: c3.returning, returningSpan: c3.returningSpan, span: s }, A4; } case 188: { let e = n[3].minor, t2 = n[5].minor, o = n[8].minor, a2; return a2 = { upsert: { type: "Upsert", index: G1(r2, e, t2, s), doClause: { type: "NothingUpsertDo", span: s }, next: o.upsert, span: s }, returning: o.returning, returningSpan: o.returningSpan, span: s }, a2; } case 189: { let e = n[4].minor, t2; return t2 = { upsert: { type: "Upsert", index: void 0, doClause: { type: "NothingUpsertDo", span: s }, next: void 0, span: s }, returning: e.columns, returningSpan: e.span, span: s }, t2; } case 190: { let e = n[5].minor, t2 = n[6].minor, o = n[7].minor, a2; return a2 = { upsert: { type: "Upsert", index: void 0, doClause: { type: "SetUpsertDo", sets: e, whereClause: t2, span: s }, next: void 0, span: s }, returning: o.columns, returningSpan: o.span, span: s }, a2; } case 191: { let e = n[1].minor, t2; return t2 = { columns: e, span: s }, t2; } case 192: { let e; return e = { columns: void 0, span: void 0 }, e; } case 193: { let e = n[1].minor, t2; return t2 = e, t2; } case 194: { let e; return e = "Replace", e; } case 195: { let e; return e = void 0, e; } case 196: { let e = n[1].minor, t2; return t2 = e, t2; } case 197: { let e = n[2].minor, t2 = n[0].minor, o = t2.find((a2) => a2.text === e.text); return o ? r2.errors.push(y1(`column "${e.text}" specified more than once`, e.span, o.span)) : t2.push(e), t2; } case 198: { let e = n[0].minor, t2; return t2 = [e], t2; } case 199: { let e = n[1].minor, t2; return t2 = U1(e, s), t2; } case 200: { let e = n[0].minor, t2; return t2 = r1(e), t2; } case 201: { let e = n[0].minor, t2 = n[2].minor, o; return o = { type: "QualifiedExpr", schema: void 0, table: e, column: t2, span: s }, o; } case 202: { let e = n[0].minor, t2 = n[2].minor, o = n[4].minor, a2; return a2 = { type: "QualifiedExpr", schema: e, table: t2, column: o, span: s }, a2; } case 203: { let e = n[0].minor, t2; return t2 = fe2(e), t2; } case 204: { let e = n[0].minor, t2; return t2 = Ae2(e), t2; } case 205: { let e = n[0].minor, t2; return t2 = Ee2(e), t2; } case 206: { let e = n[0].minor, t2; return t2 = m1(e), t2; } case 207: { let e = n[0].minor, t2; return t2 = Ie2(e), t2; } case 208: { let e = n[0].minor, t2 = n[2].minor, o; return o = Te2(e, t2, s), o; } case 209: { let e = n[2].minor, t2 = n[4].minor, o; return o = Re2(e, t2, s), o; } case 210: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2; return a2 = Q2(r2, e, t2, o, void 0, void 0, s), a2; } case 211: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[6].minor, c3; return c3 = Q2(r2, e, t2, o, { type: "SortListFunctionCallOrder", columns: a2, span: s }, void 0, s), c3; } case 212: { let e = n[0].minor, t2; return t2 = X1(e, void 0, s), t2; } case 213: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[10].minor, c3; return c3 = Q2(r2, e, t2, o, { type: "WithinGroupFunctionCallOrder", expr: a2, span: s }, void 0, s), c3; } case 214: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[5].minor, c3; return c3 = Q2(r2, e, t2, o, void 0, a2, s), c3; } case 215: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[6].minor, c3 = n[8].minor, A4; return A4 = Q2(r2, e, t2, o, { type: "SortListFunctionCallOrder", columns: a2, span: s }, c3, s), A4; } case 216: { let e = n[0].minor, t2 = n[4].minor, o; return o = X1(e, t2, s), o; } case 217: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[10].minor, c3 = n[12].minor, A4; return A4 = Q2(r2, e, t2, o, { type: "WithinGroupFunctionCallOrder", expr: a2, span: s }, c3, s), A4; } case 218: { let e = n[0].minor, t2; return t2 = ue2(e), t2; } case 219: { let e = n[1].minor, t2 = n[3].minor, o; return o = { type: "ParenthesizedExpr", exprs: [...e, t2], span: s }, o; } case 220: case 221: case 222: case 223: case 224: case 225: case 226: case 227: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = Z2(e, Ce2(t2.type, i1), o, s), a2; } case 228: { let e = n[0].minor, t2; return t2 = { not: !1, op: P1(e, i1), span: s }, t2; } case 229: { let e = n[1].minor, t2; return t2 = { not: !0, op: P1(e, i1), span: s }, t2; } case 230: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = w1(e, t2.not, t2.op, o, void 0, s), a2; } case 231: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2 = n[4].minor, c3; return c3 = w1(e, t2.not, t2.op, o, a2, s), c3; } case 232: { let e = n[0].minor, t2 = n[1].minor, o; return o = _e2(e, t2.type, i1, s), o; } case 233: { let e = n[0].minor, t2; return t2 = { type: "NotNullExpr", expr: e, span: s }, t2; } case 234: { let e = n[0].minor, t2 = n[2].minor, o; return o = Z2(e, "Is", t2, s), o; } case 235: { let e = n[0].minor, t2 = n[3].minor, o; return o = Z2(e, "IsNot", t2, s), o; } case 236: { let e = n[0].minor, t2 = n[5].minor, o; return o = Z2(e, "Is", t2, s), o; } case 237: { let e = n[0].minor, t2 = n[4].minor, o; return o = Z2(e, "IsNot", t2, s), o; } case 238: case 239: case 240: { let e = n[0].minor, t2 = n[1].minor, o; return o = s1(Ne2(e.type, i1), t2, s), o; } case 241: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = Z2(e, ye2(t2), o, s), a2; } case 242: { let e; return e = !1, e; } case 243: { let e; return e = !0, e; } case 244: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2 = n[4].minor, c3; return c3 = ke2(e, t2, o, a2, s), c3; } case 245: { let e; return e = !1, e; } case 246: { let e; return e = !0, e; } case 247: { let e = n[0].minor, t2 = n[1].minor, o = n[3].minor, a2; return a2 = Le2(e, t2, o, s), a2; } case 248: { let e = n[1].minor, t2; return t2 = Oe2(e, s), t2; } case 249: { let e = n[0].minor, t2 = n[1].minor, o = n[3].minor, a2; return a2 = ge2(e, t2, o, s), a2; } case 250: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2 = n[3].minor, c3; return c3 = xe2(e, t2, o, a2, s), c3; } case 251: { let e = n[2].minor, t2; return t2 = he2(e, s), t2; } case 252: { let e = n[1].minor, t2 = n[2].minor, o = n[3].minor, a2; return a2 = { type: "CaseExpr", base: e, whenThenPairs: t2, elseExpr: o, span: s }, a2; } case 253: { let e = n[2].minor, t2 = n[4].minor, o = n[0].minor; return o.push({ type: "WhenThen", when: e, then: t2, span: s }), o; } case 254: { let e = n[1].minor, t2 = n[3].minor, o; return o = [{ type: "WhenThen", when: e, then: t2, span: s }], o; } case 255: { let e = n[1].minor, t2; return t2 = e, t2; } case 256: { let e; return e = void 0, e; } case 257: { let e = n[0].minor, t2; return t2 = e, t2; } case 258: { let e; return e = void 0, e; } case 259: { let e = n[0].minor, t2; return t2 = e, t2; } case 260: { let e; return e = void 0, e; } case 261: { let e = n[2].minor, t2 = n[0].minor; return t2.push(e), t2; } case 262: { let e = n[0].minor, t2; return t2 = [e], t2; } case 263: { let e; return e = void 0, e; } case 264: { let e = n[1].minor, t2; return t2 = e, t2; } case 265: { let e = n[1].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[6].minor, c3 = n[8].minor, A4 = n[10].minor; r2.stmt = { type: "CreateIndexStmt", unique: e, ifNotExists: t2, idxName: o, tblName: a2, columns: c3, whereClause: A4, span: s }; return; } case 266: { let e; return e = !0, e; } case 267: { let e; return e = !1, e; } case 268: { let e; return e = void 0, e; } case 269: { let e = n[1].minor, t2; return t2 = e, t2; } case 270: { let e = n[2].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[0].minor; return a2.push({ type: "IndexedColumn", colName: e, collationName: t2, order: o, span: s }), a2; } case 271: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = [{ type: "IndexedColumn", colName: e, collationName: t2, order: o, span: s }], a2; } case 272: { let e; return e = void 0, e; } case 273: { let e = n[1].minor, t2; return t2 = c1(e), t2; } case 274: { let e = n[2].minor, t2 = n[3].minor; r2.stmt = { type: "DropIndexStmt", ifExists: e, idxName: t2, span: s }; return; } case 275: { let e = n[1].minor; r2.stmt = { type: "VacuumStmt", dbName: void 0, into: e, span: s }; return; } case 276: { let e = n[1].minor, t2 = n[2].minor; r2.stmt = { type: "VacuumStmt", dbName: e, into: t2, span: s }; return; } case 277: { let e = n[1].minor, t2; return t2 = e, t2; } case 278: { let e; return e = void 0, e; } case 279: { let e = n[1].minor; r2.stmt = { type: "PragmaStmt", name: e, body: void 0, span: s }; return; } case 280: { let e = n[1].minor, t2 = n[3].minor; r2.stmt = { type: "PragmaStmt", name: e, body: { type: "EqualsPragmaBody", value: t2, span: s }, span: s }; return; } case 281: { let e = n[1].minor, t2 = n[3].minor; r2.stmt = { type: "PragmaStmt", name: e, body: { type: "CallPragmaBody", value: t2, span: s }, span: s }; return; } case 282: { let e = n[1].minor, t2 = n[3].minor; r2.stmt = { type: "PragmaStmt", name: e, body: { type: "EqualsPragmaBody", value: t2, span: s }, span: s }; return; } case 283: { let e = n[1].minor, t2 = n[3].minor; r2.stmt = { type: "PragmaStmt", name: e, body: { type: "CallPragmaBody", value: t2, span: s }, span: s }; return; } case 284: { let e = n[0].minor, t2; return t2 = { type: "NameExpr", name: e, span: s }, t2; } case 285: case 286: case 287: { let e = n[0].minor, t2; return t2 = de2(e), t2; } case 288: { let e = n[1].minor, t2; return t2 = s1("Positive", m1(e), s), t2; } case 289: { let e = n[0].minor, t2; return t2 = m1(e), t2; } case 290: { let e = n[1].minor, t2; return t2 = s1("Negative", m1(e), s), t2; } case 291: { let e = n[1].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor, c3 = n[6].minor, A4 = n[8].minor, C5 = n[9].minor, y4 = n[10].minor, N4 = n[12].minor; r2.stmt = { type: "CreateTriggerStmt", temporary: e, ifNotExists: t2, triggerName: o, time: a2, event: c3, tblName: A4, forEachRow: C5, whenClause: y4, commands: N4, span: s }; return; } case 292: { let e; return e = "Before", e; } case 293: { let e; return e = "After", e; } case 294: { let e; return e = "InsteadOf", e; } case 295: { let e; return e = void 0, e; } case 296: { let e; return e = { type: "DeleteTriggerEvent", span: s }, e; } case 297: { let e; return e = { type: "InsertTriggerEvent", span: s }, e; } case 298: { let e; return e = { type: "UpdateTriggerEvent", span: s }, e; } case 299: { let e = n[2].minor, t2; return t2 = { type: "UpdateOfTriggerEvent", columns: e, span: s }, t2; } case 300: { let e; return e = !1, e; } case 301: { let e; return e = !0, e; } case 302: { let e; return e = void 0, e; } case 303: { let e = n[1].minor, t2; return t2 = e, t2; } case 304: { let e = n[1].minor, t2 = n[0].minor; return t2.push(e), t2; } case 305: { let e = n[0].minor, t2; return t2 = [e], t2; } case 306: { r2.errors.push(Y2("the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers", s)); return; } case 307: { r2.errors.push(Y2("the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers", s)); return; } case 308: { let e = n[1].minor, t2 = n[2].minor, o = n[5].minor, a2 = n[6].minor, c3 = n[7].minor, A4; return A4 = { type: "UpdateTriggerCmd", orConflict: e, tblName: t2, sets: o, from: a2, whereClause: c3, span: s }, A4; } case 309: { let e = n[0].minor, t2 = n[2].minor, o = n[3].minor, a2 = n[4].minor, c3 = n[5].minor, A4; return c3.returning && r2.errors.push(Y2("cannot use RETURNING in a trigger", c3.returningSpan ?? s)), A4 = { type: "InsertTriggerCmd", orConflict: e, tblName: t2, colNames: o, select: a2, upsert: c3.upsert, span: s }, A4; } case 310: { let e = n[2].minor, t2 = n[4].minor, o; return o = { type: "DeleteTriggerCmd", tblName: e, whereClause: t2, span: s }, o; } case 311: { let e = n[0].minor, t2; return t2 = { type: "SelectTriggerCmd", select: e, span: s }, t2; } case 312: { let e; return e = { type: "RaiseExpr", resolve: "Ignore", message: void 0, span: s }, e; } case 313: { let e = n[2].minor, t2 = n[4].minor, o; return o = { type: "RaiseExpr", resolve: e, message: t2, span: s }, o; } case 314: { let e; return e = "Rollback", e; } case 315: { let e; return e = "Abort", e; } case 316: { let e; return e = "Fail", e; } case 317: { let e = n[2].minor, t2 = n[3].minor; r2.stmt = { type: "DropTriggerStmt", ifExists: e, triggerName: t2, span: s }; return; } case 318: { let e = n[2].minor, t2 = n[4].minor, o = n[5].minor; r2.stmt = { type: "AttachStmt", expr: e, dbName: t2, key: o, span: s }; return; } case 319: { let e = n[2].minor; r2.stmt = { type: "DetachStmt", expr: e, span: s }; return; } case 320: { let e; return e = void 0, e; } case 321: { let e = n[1].minor, t2; return t2 = e, t2; } case 322: { r2.stmt = { type: "ReindexStmt", objName: void 0, span: s }; return; } case 323: { let e = n[1].minor; r2.stmt = { type: "ReindexStmt", objName: e, span: s }; return; } case 324: { r2.stmt = { type: "AnalyzeStmt", objName: void 0, span: s }; return; } case 325: { let e = n[1].minor; r2.stmt = { type: "AnalyzeStmt", objName: e, span: s }; return; } case 326: { let e = n[2].minor, t2 = n[5].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "RenameToAlterTableBody", name: t2, span: s }, span: s }; return; } case 327: { let e = n[2].minor, t2 = n[5].minor, o = n[6].minor, a2 = n[7].minor, c3 = R1(t2, o, a2, s); r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "AddColumnAlterTableBody", column: c3, span: s }, span: s }; return; } case 328: { let e = n[2].minor, t2 = n[5].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "DropColumnAlterTableBody", column: t2, span: s }, span: s }; return; } case 329: { let e = n[2].minor, t2 = n[5].minor, o = n[7].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "RenameColumnAlterTableBody", old: t2, new: o, span: s }, span: s }; return; } case 330: { let e = n[2].minor, t2 = n[5].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "DropConstraintAlterTableBody", name: t2, span: s }, span: s }; return; } case 331: { let e = n[2].minor, t2 = n[5].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "DropColumnNotNullAlterTableBody", column: t2, span: s }, span: s }; return; } case 332: { let e = n[2].minor, t2 = n[5].minor, o = n[9].minor; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "SetColumnNotNullAlterTableBody", column: t2, onConflict: o, span: s }, span: s }; return; } case 333: { let e = n[2].minor, t2 = n[5].minor, o = n[8].minor, a2 = n[10].minor, c3 = { type: "CheckTableConstraint", expr: o, conflictClause: a2, span: s }; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "AddConstraintAlterTableBody", constraint: { type: "NamedTableConstraint", name: t2, constraint: c3, span: s }, span: s }, span: s }; return; } case 334: { let e = n[2].minor, t2 = n[6].minor, o = n[8].minor, a2 = { type: "CheckTableConstraint", expr: t2, conflictClause: o, span: s }; r2.stmt = { type: "AlterTableStmt", tblName: e, body: { type: "AddConstraintAlterTableBody", constraint: { type: "NamedTableConstraint", name: void 0, constraint: a2, span: s }, span: s }, span: s }; return; } case 335: { let e = n[0].minor; r2.stmt = e; return; } case 336: { let e = n[0].minor; r2.vtabArgCurrent.length > 0 && (r2.vtabArgs.push(r2.vtabArgCurrent), r2.vtabArgCurrent = ""), e.type === "CreateVirtualTableStmt" ? r2.stmt = { ...e, args: r2.vtabArgs.slice(), span: s } : r2.stmt = e, r2.vtabArgs = []; return; } case 337: { let e = n[3].minor, t2 = n[4].minor, o = n[6].minor, a2; return a2 = { type: "CreateVirtualTableStmt", ifNotExists: e, tblName: t2, moduleName: o, args: void 0, span: s }, a2; } case 338: { r2.vtabArgCurrent.length > 0 && r2.vtabArgs.push(r2.vtabArgCurrent), r2.vtabArgCurrent = ""; return; } case 339: { let e = n[0].minor; r2.vtabArgCurrent += e.text; return; } case 340: { let e = n[2].minor; r2.vtabArgCurrent += e.text; return; } case 341: { let e = n[0].minor; r2.vtabArgCurrent += e.text; return; } case 342: { let e; return e = void 0, e; } case 343: { let e = n[1].minor, t2; return t2 = { type: "With", recursive: !1, ctes: e, span: s }, t2; } case 344: { let e = n[2].minor, t2; return t2 = { type: "With", recursive: !0, ctes: e, span: s }, t2; } case 345: { let e; return e = "Any", e; } case 346: { let e; return e = "Yes", e; } case 347: { let e; return e = "No", e; } case 348: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2 = n[4].minor, c3; return c3 = { type: "CommonTableExpr", tblName: e, columns: t2, materialized: o, select: a2, span: s }, c3; } case 349: { let e = n[0].minor, t2; return t2 = [e], t2; } case 350: { let e = n[2].minor, t2 = n[0].minor; return Xe2(r2, t2, e), t2; } case 351: { let e = n[0].minor, t2; return t2 = [e], t2; } case 352: { let e = n[2].minor, t2 = n[0].minor; return t2.push(e), t2; } case 353: { let e = n[0].minor, t2 = n[3].minor, o; return o = { type: "WindowDef", name: e, window: t2, span: s }, o; } case 354: { let e = n[2].minor, t2 = n[3].minor, o = n[4].minor, a2; return a2 = { type: "Window", base: void 0, partitionBy: e, orderBy: t2, frameClause: o, span: s }, a2; } case 355: { let e = n[0].minor, t2 = n[3].minor, o = n[4].minor, a2 = n[5].minor, c3; return c3 = { type: "Window", base: e, partitionBy: t2, orderBy: o, frameClause: a2, span: s }, c3; } case 356: { let e = n[2].minor, t2 = n[3].minor, o; return o = { type: "Window", base: void 0, partitionBy: void 0, orderBy: e, frameClause: t2, span: s }, o; } case 357: { let e = n[0].minor, t2 = n[3].minor, o = n[4].minor, a2; return a2 = { type: "Window", base: e, partitionBy: void 0, orderBy: t2, frameClause: o, span: s }, a2; } case 358: { let e = n[0].minor, t2; return t2 = { type: "Window", base: void 0, partitionBy: void 0, orderBy: void 0, frameClause: e, span: s }, t2; } case 359: { let e = n[0].minor, t2 = n[1].minor, o; return o = { type: "Window", base: e, partitionBy: void 0, orderBy: void 0, frameClause: t2, span: s }, o; } case 360: { let e; return e = void 0, e; } case 361: { let e = n[0].minor, t2 = n[1].minor, o = n[2].minor, a2; return a2 = { type: "FrameClause", mode: e, start: t2, end: void 0, exclude: o, span: s }, a2; } case 362: { let e = n[0].minor, t2 = n[2].minor, o = n[4].minor, a2 = n[5].minor, c3; return c3 = { type: "FrameClause", mode: e, start: t2, end: o, exclude: a2, span: s }, c3; } case 363: { let e; return e = "Range", e; } case 364: { let e; return e = "Rows", e; } case 365: { let e; return e = "Groups", e; } case 366: { let e = n[0].minor, t2; return t2 = e, t2; } case 367: { let e; return e = { type: "UnboundedPrecedingFrameBound", span: s }, e; } case 368: { let e = n[0].minor, t2; return t2 = e, t2; } case 369: { let e; return e = { type: "UnboundedFollowingFrameBound", span: s }, e; } case 370: { let e = n[0].minor, t2; return t2 = { type: "PrecedingFrameBound", expr: e, span: s }, t2; } case 371: { let e; return e = { type: "CurrentRowFrameBound", span: s }, e; } case 372: { let e = n[0].minor, t2; return t2 = { type: "FollowingFrameBound", expr: e, span: s }, t2; } case 373: { let e; return e = void 0, e; } case 374: { let e = n[1].minor, t2; return t2 = e, t2; } case 375: { let e; return e = "NoOthers", e; } case 376: { let e; return e = "CurrentRow", e; } case 377: { let e; return e = "Group", e; } case 378: { let e; return e = "Ties", e; } case 379: { let e = n[1].minor, t2; return t2 = e, t2; } case 380: { let e = n[0].minor, t2 = n[1].minor, o; return o = { type: "FunctionTail", filterClause: e, overClause: t2, span: s }, o; } case 381: { let e = n[0].minor, t2; return t2 = { type: "FunctionTail", filterClause: void 0, overClause: e, span: s }, t2; } case 382: { let e = n[0].minor, t2; return t2 = { type: "FunctionTail", filterClause: e, overClause: void 0, span: s }, t2; } case 383: { let e = n[2].minor, t2; return t2 = { type: "WindowOver", window: e, span: s }, t2; } case 384: { let e = n[1].minor, t2; return t2 = { type: "NameOver", name: e, span: s }, t2; } case 385: { let e = n[3].minor, t2; return t2 = e, t2; } case 386: { let e = n[0].minor, t2, o = ae2(e.text, { digitSeparator: r2.digitSeparator }); return o.error && r2.errors.push(Y2(o.error, e.span, { message: "digit separators must sit between two digits (e.g. 1_000, 0xDE_AD)", span: void 0 })), t2 = { type: "NumericLiteral", value: o.text, span: e.span }, t2; } case 387: case 388: case 389: case 390: case 391: return n[0].minor; case 392: return; case 393: return n[0].minor; case 394: return n[0].minor; case 395: case 396: return n[0].minor; case 397: return; case 398: return n[0].minor; case 399: return n[0].minor; case 400: case 401: return n[0].minor; case 402: return; case 403: return n[0].minor; case 404: case 405: return; case 406: case 407: case 408: case 409: return n[0].minor; case 410: return; case 411: case 412: return n[0].minor; default: return; } }, Qn = ve2, Be2 = { meta: { maskFlags: { ALTER: 1, ALWAYS: 2, ANALYZE: 4, ATTACH: 8, AUTOINCR: 16, CAST: 32, COMPOUND: 64, CONFLICT: 128, EXPLAIN: 256, FKEY: 512, PRAGMA: 1024, REINDEX: 2048, SUBQUERY: 4096, TRIGGER: 8192, VACUUM: 16384, VIEW: 32768, VTAB: 65536, AUTOVACUUM: 131072, CTE: 262144, UPSERT: 524288, WINDOWFUNC: 1048576, GENCOL: 2097152, RETURNING: 4194304, ORDERSET: 8388608 } }, keywords: [{ name: "ABORT", token: "ABORT", mask: 8320 }, { name: "ACTION", token: "ACTION", mask: 512 }, { name: "ADD", token: "ADD", mask: 1 }, { name: "AFTER", token: "AFTER", mask: 8192 }, { name: "ALL", token: "ALL", mask: 2 }, { name: "ALTER", token: "ALTER", mask: 1 }, { name: "ALWAYS", token: "ALWAYS", mask: 2097152 }, { name: "ANALYZE", token: "ANALYZE", mask: 4 }, { name: "AND", token: "AND", mask: 2 }, { name: "AS", token: "AS", mask: 2 }, { name: "ASC", token: "ASC", mask: 2 }, { name: "ATTACH", token: "ATTACH", mask: 8 }, { name: "AUTOINCREMENT", token: "AUTOINCR", mask: 16 }, { name: "BEFORE", token: "BEFORE", mask: 8192 }, { name: "BEGIN", token: "BEGIN", mask: 2 }, { name: "BETWEEN", token: "BETWEEN", mask: 2 }, { name: "BY", token: "BY", mask: 2 }, { name: "CASCADE", token: "CASCADE", mask: 512 }, { name: "CASE", token: "CASE", mask: 2 }, { name: "CAST", token: "CAST", mask: 32 }, { name: "CHECK", token: "CHECK", mask: 2 }, { name: "COLLATE", token: "COLLATE", mask: 2 }, { name: "COLUMN", token: "COLUMNKW", mask: 1 }, { name: "COMMIT", token: "COMMIT", mask: 2 }, { name: "CONFLICT", token: "CONFLICT", mask: 128 }, { name: "CONSTRAINT", token: "CONSTRAINT", mask: 2 }, { name: "CREATE", token: "CREATE", mask: 2 }, { name: "CROSS", token: "JOIN_KW", mask: 2 }, { name: "CURRENT", token: "CURRENT", mask: 1048576 }, { name: "CURRENT_DATE", token: "CTIME_KW", mask: 2 }, { name: "CURRENT_TIME", token: "CTIME_KW", mask: 2 }, { name: "CURRENT_TIMESTAMP", token: "CTIME_KW", mask: 2 }, { name: "DATABASE", token: "DATABASE", mask: 8 }, { name: "DEFAULT", token: "DEFAULT", mask: 2 }, { name: "DEFERRED", token: "DEFERRED", mask: 2 }, { name: "DEFERRABLE", token: "DEFERRABLE", mask: 512 }, { name: "DELETE", token: "DELETE", mask: 2 }, { name: "DESC", token: "DESC", mask: 2 }, { name: "DETACH", token: "DETACH", mask: 8 }, { name: "DISTINCT", token: "DISTINCT", mask: 2 }, { name: "DO", token: "DO", mask: 524288 }, { name: "DROP", token: "DROP", mask: 2 }, { name: "END", token: "END", mask: 2 }, { name: "EACH", token: "EACH", mask: 8192 }, { name: "ELSE", token: "ELSE", mask: 2 }, { name: "ESCAPE", token: "ESCAPE", mask: 2 }, { name: "EXCEPT", token: "EXCEPT", mask: 64 }, { name: "EXCLUSIVE", token: "EXCLUSIVE", mask: 2 }, { name: "EXCLUDE", token: "EXCLUDE", mask: 1048576 }, { name: "EXISTS", token: "EXISTS", mask: 2 }, { name: "EXPLAIN", token: "EXPLAIN", mask: 256 }, { name: "FAIL", token: "FAIL", mask: 8320 }, { name: "FILTER", token: "FILTER", mask: 1048576 }, { name: "FIRST", token: "FIRST", mask: 2 }, { name: "FOLLOWING", token: "FOLLOWING", mask: 1048576 }, { name: "FOR", token: "FOR", mask: 8192 }, { name: "FOREIGN", token: "FOREIGN", mask: 512 }, { name: "FROM", token: "FROM", mask: 2 }, { name: "FULL", token: "JOIN_KW", mask: 2 }, { name: "GENERATED", token: "GENERATED", mask: 2 }, { name: "GLOB", token: "LIKE_KW", mask: 2 }, { name: "GROUP", token: "GROUP", mask: 2 }, { name: "GROUPS", token: "GROUPS", mask: 1048576 }, { name: "HAVING", token: "HAVING", mask: 2 }, { name: "IF", token: "IF", mask: 2 }, { name: "IGNORE", token: "IGNORE", mask: 8320 }, { name: "IMMEDIATE", token: "IMMEDIATE", mask: 2 }, { name: "IN", token: "IN", mask: 2 }, { name: "INDEX", token: "INDEX", mask: 2 }, { name: "INDEXED", token: "INDEXED", mask: 2 }, { name: "INITIALLY", token: "INITIALLY", mask: 512 }, { name: "INNER", token: "JOIN_KW", mask: 2 }, { name: "INSERT", token: "INSERT", mask: 2 }, { name: "INSTEAD", token: "INSTEAD", mask: 8192 }, { name: "INTERSECT", token: "INTERSECT", mask: 64 }, { name: "INTO", token: "INTO", mask: 2 }, { name: "IS", token: "IS", mask: 2 }, { name: "ISNULL", token: "ISNULL", mask: 2 }, { name: "JOIN", token: "JOIN", mask: 2 }, { name: "KEY", token: "KEY", mask: 2 }, { name: "LAST", token: "LAST", mask: 2 }, { name: "LEFT", token: "JOIN_KW", mask: 2 }, { name: "LIKE", token: "LIKE_KW", mask: 2 }, { name: "LIMIT", token: "LIMIT", mask: 2 }, { name: "MATCH", token: "MATCH", mask: 2 }, { name: "MATERIALIZED", token: "MATERIALIZED", mask: 262144 }, { name: "NATURAL", token: "JOIN_KW", mask: 2 }, { name: "NO", token: "NO", mask: 1049088 }, { name: "NOT", token: "NOT", mask: 2 }, { name: "NOTHING", token: "NOTHING", mask: 524288 }, { name: "NOTNULL", token: "NOTNULL", mask: 2 }, { name: "NULL", token: "NULL", mask: 2 }, { name: "NULLS", token: "NULLS", mask: 2 }, { name: "OF", token: "OF", mask: 2 }, { name: "OFFSET", token: "OFFSET", mask: 2 }, { name: "ON", token: "ON", mask: 2 }, { name: "OR", token: "OR", mask: 2 }, { name: "ORDER", token: "ORDER", mask: 2 }, { name: "OTHERS", token: "OTHERS", mask: 1048576 }, { name: "OUTER", token: "JOIN_KW", mask: 2 }, { name: "OVER", token: "OVER", mask: 1048576 }, { name: "PARTITION", token: "PARTITION", mask: 1048576 }, { name: "PLAN", token: "PLAN", mask: 256 }, { name: "PRAGMA", token: "PRAGMA", mask: 1024 }, { name: "PRECEDING", token: "PRECEDING", mask: 1048576 }, { name: "PRIMARY", token: "PRIMARY", mask: 2 }, { name: "QUERY", token: "QUERY", mask: 256 }, { name: "RAISE", token: "RAISE", mask: 8192 }, { name: "RANGE", token: "RANGE", mask: 1048576 }, { name: "RECURSIVE", token: "RECURSIVE", mask: 262144 }, { name: "REFERENCES", token: "REFERENCES", mask: 512 }, { name: "REGEXP", token: "LIKE_KW", mask: 2 }, { name: "REINDEX", token: "REINDEX", mask: 2048 }, { name: "RELEASE", token: "RELEASE", mask: 2 }, { name: "RENAME", token: "RENAME", mask: 1 }, { name: "REPLACE", token: "REPLACE", mask: 128 }, { name: "RESTRICT", token: "RESTRICT", mask: 512 }, { name: "RETURNING", token: "RETURNING", mask: 4194304 }, { name: "RIGHT", token: "JOIN_KW", mask: 2 }, { name: "ROLLBACK", token: "ROLLBACK", mask: 2 }, { name: "ROW", token: "ROW", mask: 8192 }, { name: "ROWS", token: "ROWS", mask: 2 }, { name: "SAVEPOINT", token: "SAVEPOINT", mask: 2 }, { name: "SELECT", token: "SELECT", mask: 2 }, { name: "SET", token: "SET", mask: 2 }, { name: "TABLE", token: "TABLE", mask: 2 }, { name: "TEMP", token: "TEMP", mask: 2 }, { name: "TEMPORARY", token: "TEMP", mask: 2 }, { name: "THEN", token: "THEN", mask: 2 }, { name: "TIES", token: "TIES", mask: 1048576 }, { name: "TO", token: "TO", mask: 2 }, { name: "TRANSACTION", token: "TRANSACTION", mask: 2 }, { name: "TRIGGER", token: "TRIGGER", mask: 8192 }, { name: "UNBOUNDED", token: "UNBOUNDED", mask: 1048576 }, { name: "UNION", token: "UNION", mask: 64 }, { name: "UNIQUE", token: "UNIQUE", mask: 2 }, { name: "UPDATE", token: "UPDATE", mask: 2 }, { name: "USING", token: "USING", mask: 2 }, { name: "VACUUM", token: "VACUUM", mask: 16384 }, { name: "VALUES", token: "VALUES", mask: 2 }, { name: "VIEW", token: "VIEW", mask: 32768 }, { name: "VIRTUAL", token: "VIRTUAL", mask: 65536 }, { name: "WHEN", token: "WHEN", mask: 2 }, { name: "WHERE", token: "WHERE", mask: 2 }, { name: "WINDOW", token: "WINDOW", mask: 1048576 }, { name: "WITH", token: "WITH", mask: 262144 }, { name: "WITHIN", token: "WITHIN", mask: 8388608 }, { name: "WITHOUT", token: "WITHOUT", mask: 2 }] }, X2 = W1(H1, Be2, {}), Ge2 = X2.parse, Ft = X2.parseOrThrow, Yt = X2.parseStmt, vt = X2.parseStmtOrThrow, Bt = X2.tokenize, Gt = X2.tokenName, Wt = X2.createEngine, Ht = X2.withOptions, qt = X2.reduce, Kt = X2.createState, Vt = X2.parserDefs, $t = X2.keywordDefs, u1 = "1.0.0", f1 = "0.1.1", J2 = Object.freeze({ core: "0.1.1", shell: "0.1.1", python: "0.1.0", sqlite: "0.1.1", mysql: "0.1.2", redis: "0.1.1" }), Jn = Object.freeze({ shell: "tree-sitter-bash@0.25.1", python: "tree-sitter-python@0.25.0", sqlite: "sqlite3-parser@0.7.1/sqlite-3.53.0", mysql: "node-sql-parser@5.4.0/mysql", redis: "redis-command-table@1" }), Jt = Object.freeze({ schemaVersion: u1, policy: f1, rules: J2, parsers: Jn }), We2 = Object.freeze({ allow: 0, review: 1, deny: 2 }); pn = Object.freeze({ maxInputBytes: 65536, maxAstNodes: 12e3, maxNestingDepth: 64, maxStatements: 512, maxWorkUnits: 1e5 }); o1 = Object.freeze({ ANALYSIS_UNAVAILABLE: "policy.analysis_unavailable", INITIALIZATION_FAILED: "policy.initialization_failed", PARSE_FAILED: "policy.parse_failed", RESOURCE_LIMIT_EXCEEDED: "policy.resource_limit_exceeded", UNKNOWN_SEMANTICS: "policy.unknown_semantics", INVALID_DECISION: "policy.invalid_decision" }), et = { "analysis-unavailable": "analysis is unavailable", "initialization-failed": "analyzer initialization failed", "parse-failed": "parsing failed", "resource-limit-exceeded": "an analysis resource limit was exceeded", "unknown-semantics": "semantics are unknown" }; tt = { "analysis-unavailable": o1.ANALYSIS_UNAVAILABLE, "initialization-failed": o1.INITIALIZATION_FAILED, "parse-failed": o1.PARSE_FAILED, "resource-limit-exceeded": o1.RESOURCE_LIMIT_EXCEEDED, "unknown-semantics": o1.UNKNOWN_SEMANTICS }; rt = /(?:^|[_-])(?:pass(?:word|wd)?|secret|token|api[_-]?key|private[_-]?key|credential|auth)(?:$|[_-])/i; je2 = /* @__PURE__ */ new Set(["abs", "avg", "cast", "char", "coalesce", "concat", "count", "date", "datetime", "format", "glob", "group_concat", "hex", "if", "ifnull", "instr", "json", "json_array", "json_array_length", "json_extract", "json_object", "json_quote", "json_type", "julianday", "length", "like", "likely", "lower", "ltrim", "max", "min", "nullif", "printf", "quote", "random", "randomblob", "rank", "replace", "round", "row_number", "rtrim", "soundex", "strftime", "substr", "substring", "sum", "time", "total", "trim", "typeof", "unicode", "unixepoch", "unlikely", "upper", "zeroblob"]); st = /* @__PURE__ */ new Set(["mysql", "performance_schema", "information_schema", "sys", "pg_catalog"]); at = "sqlite3-parser@0.7.1/sqlite-3.53.0", ct = /* @__PURE__ */ new Set(["application_id", "collation_list", "compile_options", "database_list", "encoding", "foreign_key_list", "freelist_count", "function_list", "index_info", "index_list", "index_xinfo", "journal_mode", "module_list", "page_count", "pragma_list", "schema_version", "table_info", "table_list", "table_xinfo", "user_version"]); } }); // node_modules/@at-series/command-policy/dist/python.js var python_exports = {}; __export(python_exports, { createPythonPolicyEvaluator: () => Ie3 }); function D2(e) { let t2 = 1, i2 = 0; for (let n = 0; n < e.length; n += 1) e.charCodeAt(n) === 10 && (t2 += 1, i2 = n + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: t2, column: e.length - i2 + 1 } }; } function w2(e, t2, i2, n) { let o = typeof t2.sourceText == "string" ? t2.sourceText : "", r2 = n.length > 0 ? n : [{ effectCode: `${e}.process.noop`, action: "allow", reasonCode: `${e}.read_only`, kind: "statement", summary: `${e} source has no external effect.` }], s = r2[0]; for (let a2 of r2.slice(1)) b[a2.action] > b[s.action] && (s = a2); let l, d3 = () => l ??= D2(o), u4 = r2.map((a2) => Object.freeze({ kind: a2.kind, location: a2.location ?? d3(), redacted: !0, summary: a2.summary })), p3 = r2.map((a2, A4) => Object.freeze({ effectCode: a2.effectCode, action: a2.action, evidenceIndexes: Object.freeze([A4]) })); return Object.freeze({ schemaVersion: E2, action: s.action, effects: Object.freeze(p3), reasonCode: s.reasonCode, evidence: Object.freeze(u4), versions: Object.freeze({ policy: x2, rules: Object.freeze({ core: f.core, [e]: f[e] }), parsers: Object.freeze({ [e]: i2 }) }) }); } function N(e) { let t2 = { ...j3, ...e }; for (let [i2, n] of Object.entries(t2)) if (!Number.isSafeInteger(n) || n < 1) throw new TypeError(`${i2} must be a positive safe integer`); return Object.freeze(t2); } function O2(e, t2) { return e.length * 3 <= t2.maxInputBytes ? !1 : Buffer.byteLength(e, "utf8") > t2.maxInputBytes; } function C2(e) { let t2 = e.replaceAll("\\", "/").toLowerCase(), i2 = t2.split("/").filter(Boolean), n = i2.at(-1) ?? ""; return t2 === "/etc/shadow" || t2 === "/etc/gshadow" || $3.test(t2) || i2.some((o) => V.has(o)) || i2.some((o, r2) => o === ".config" && i2[r2 + 1] === "gcloud") ? !0 : n === ".env" || n.startsWith(".env.") || n === ".netrc" || n === ".npmrc" || n === ".pypirc" || n === ".bash_history" || n === ".zsh_history" || n === "credentials" || n === "known_hosts" || /^id_(?:rsa|dsa|ecdsa|ed25519)$/.test(n) || /\.(?:pem|p12|pfx|key)$/.test(n) || T2.test(n); } function Y3(e) { let t2 = 1, i2 = 0; for (let n = 0; n < e.length; n += 1) e.charCodeAt(n) === 10 && (t2 += 1, i2 = n + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: t2, column: e.length - i2 + 1 } }; } function L2(e, t2, i2) { return { kind: "unknown", location: Y3(i2), redacted: !0, summary: `${e} source requires review because ${M[t2]}.` }; } function h({ domain: e, failure: t2, input: i2 }) { let n = typeof i2.sourceText == "string" ? i2.sourceText : ""; return { schemaVersion: E2, action: "review", effects: [{ effectCode: `${e}.analysis.unknown`, action: "review", evidenceIndexes: [0] }], reasonCode: U[t2], evidence: [L2(e, t2, n)], versions: { policy: x2, rules: { core: f.core, [e]: f[e] }, parsers: { [e]: "unavailable" } } }; } function P(e) { if (!e || e.type !== "string" || e.namedChildren.some((r2) => r2.type === "interpolation")) return; let t2 = /^([rRuU]*)(['"]{1,3})([\s\S]*)(\2)$/.exec(e.text); if (!t2) return; let i2 = /r/i.test(t2[1] ?? ""), n = t2[3] ?? ""; if (i2) return n; let o = ""; for (let r2 = 0; r2 < n.length; r2 += 1) { let s = n[r2]; if (s !== "\\") { o += s; continue; } r2 += 1; let l = n[r2]; if (l === void 0) return; let u4 = { "\\": "\\", '"': '"', "'": "'", n: ` `, r: "\r", t: " " }[l]; if (u4 === void 0) return; o += u4; } return o; } function _2(e) { return e.childForFieldName("arguments")?.namedChildren ?? []; } function v(e) { return e.split(".")[0] ?? e; } function J3(e) { let t2 = /* @__PURE__ */ new Map(), i2 = [], n = [e]; for (; n.length > 0; ) { let o = n.pop(); if (o.type === "import_statement") for (let r2 of o.namedChildren) { let s = r2.type === "aliased_import" ? r2.childForFieldName("name") : r2, l = r2.childForFieldName("alias"), d3 = s?.text; if (!d3 || !z3.has(v(d3))) { i2.push(c2("python.import.unknown", "A Python import is outside the approved standard-library subset.")); continue; } t2.set(l?.text ?? v(d3), d3), i2.push(y("python.import.approved", "A Python import is in the approved standard-library subset.")); } else if (o.type === "import_from_statement") { let r2 = o.childForFieldName("module_name")?.text; if (!r2 || !z3.has(v(r2))) i2.push(c2("python.import.unknown", "A Python import is outside the approved standard-library subset.")); else { for (let s of o.childrenForFieldName("name")) { let l = s.text; t2.set(l, `${r2}.${l}`); } i2.push(y("python.import.approved", "A Python import is in the approved standard-library subset.")); } } n.push(...o.namedChildren); } return { symbols: t2, sqliteImported: [...t2.values()].some((o) => v(o) === "sqlite3"), effects: i2 }; } function S(e) { return e === void 0 ? c2("python.filesystem.unknown_read", "A Python filesystem path is not statically established.") : C2(e) ? c2("python.filesystem.sensitive_read", "Python code may read a sensitive filesystem resource.") : y("python.filesystem.read", "Python code reads an ordinary static filesystem resource."); } function q2(e) { let t2 = _2(e), i2 = P(t2[0]), n = P(t2[1]) ?? "r"; return /[wax+]/.test(n) ? c2("python.filesystem.write", "Python code may modify a filesystem resource.") : S(i2); } function g2(e, t2) { return t2.symbols.get(e) ?? e; } function ee3(e) { let t2 = e.childForFieldName("function"); if (!(t2?.type !== "identifier" || t2.text !== "Path")) return P(_2(e)[0]); } function te3(e, t2, i2, n) { let o = t2.childForFieldName("object"), r2 = t2.childForFieldName("attribute")?.text; if (!o || !r2) return c2(); if (i2.sqliteImported && X3.has(r2)) return c2("python.sqlite.write", "Python sqlite3 code may modify database state."); if (i2.sqliteImported && Q3.has(r2)) { let s = P(_2(e)[0]); return s ? (n.push(s), y("python.sqlite.execute", "Python sqlite3 code executes a static SQL payload.")) : c2("python.sqlite.unknown_sql", "A sqlite3 statement is not statically established."); } if (i2.sqliteImported && G2.has(r2)) return y("python.sqlite.cursor", "Python sqlite3 code uses a read-only cursor API."); if (i2.sqliteImported && r2 === "connect" && o.type === "identifier" && v(g2(o.text, i2)) === "sqlite3") return S(P(_2(e)[0])); if (o.type === "identifier") { let s = `${g2(o.text, i2)}.${r2}`; return /^(?:json\.(?:dumps|loads)|math\.[A-Za-z_][A-Za-z0-9_]*|statistics\.[A-Za-z_][A-Za-z0-9_]*|re\.(?:compile|escape|findall|fullmatch|match|search|split))$/.test(s) ? y() : c2(); } if (o.type === "call") { let s = o.childForFieldName("function"); if (s?.type === "identifier" && s.text === "open") return (/* @__PURE__ */ new Set(["read", "readline", "readlines"])).has(r2) ? q2(o) : c2("python.filesystem.write", "Python code may invoke a side-effecting file API."); let l = ee3(o); if (l !== void 0 || s?.text === "Path") { if ((/* @__PURE__ */ new Set(["read_bytes", "read_text"])).has(r2)) return S(l); if (r2 === "open") { let d3 = P(_2(e)[0]) ?? "r"; return /[wax+]/.test(d3) ? c2("python.filesystem.write", "Python code may modify a filesystem resource.") : S(l); } return c2("python.filesystem.write", "Python code may invoke a side-effecting path API."); } } return (/* @__PURE__ */ new Set(["integer", "list", "set", "string", "tuple"])).has(o.type) && (/* @__PURE__ */ new Set(["capitalize", "casefold", "count", "endswith", "find", "index", "isalnum", "isalpha", "isdigit", "join", "lower", "replace", "split", "startswith", "strip", "upper"])).has(r2) ? y() : c2(); } function ne3(e, t2, i2) { let n = e.childForFieldName("function"); if (!n) return c2(); if (n.type === "attribute") return te3(e, n, t2, i2); if (n.type !== "identifier") return c2(); let o = g2(n.text, t2); return Z3.has(o) ? c2("python.dynamic_code", "Python code invokes dynamic execution or reflection.") : o === "open" ? q2(e) : o === "pathlib.Path" || o === "Path" || W2.has(o) || /^(?:math|statistics)\.[A-Za-z_][A-Za-z0-9_]*$/.test(o) ? y() : c2(); } function ie3(e, t2, i2) { let n = e.parse(t2); if (!n) return { ok: !1, failure: "resource-limit-exceeded" }; try { if (n.rootNode.hasError) return { ok: !1, failure: "parse-failed" }; let o = J3(n.rootNode), r2 = [...o.effects], s = [], l = new I(i2.maxWorkUnits), d3 = [{ node: n.rootNode, depth: 1 }], u4 = 0, p3 = 0; for (; d3.length > 0; ) { let { node: a2, depth: A4 } = d3.pop(); if (u4 += 1, u4 > i2.maxAstNodes || A4 > i2.maxNestingDepth || !l.consume()) return { ok: !1, failure: "resource-limit-exceeded" }; if (a2.isError || a2.isMissing) return { ok: !1, failure: "parse-failed" }; if (K2.has(a2.type) && r2.push(c2()), a2.type.endsWith("_statement") && (p3 += 1, p3 > i2.maxStatements)) return { ok: !1, failure: "resource-limit-exceeded" }; a2.type === "call" && r2.push(ne3(a2, o, s)), d3.push(...a2.namedChildren.map((R4) => ({ node: R4, depth: A4 + 1 }))); } return { ok: !0, effects: r2.length > 0 || s.length > 0 ? r2 : [y()], sqlPayloads: s }; } finally { n.delete(); } } function k(e = {}) { let t2 = N(e.limits), i2, n = () => (i2 ??= it("tree-sitter-python", e.assetResolver), i2); return { async evaluate(o) { let r2 = typeof o.sourceText == "string" ? o.sourceText : ""; if (r2.trim().length === 0) return h({ domain: "python", failure: "parse-failed", input: o }); if (O2(r2, t2)) return h({ domain: "python", failure: "resource-limit-exceeded", input: o }); let s; try { s = await n(); } catch { return h({ domain: "python", failure: "initialization-failed", input: o }); } let l; try { l = ie3(s, r2, t2); } catch { return h({ domain: "python", failure: "parse-failed", input: o }); } if (!l.ok) return h({ domain: "python", failure: l.failure, input: o }); let d3 = []; if (l.sqlPayloads.length > 0) if (!e.sqliteEvaluator) d3.push(c2("python.sqlite.unavailable", "Python sqlite3 payloads cannot be analyzed without a sqlite evaluator.")); else { let u4 = await e.sqliteEvaluator(); for (let p3 of l.sqlPayloads) { let a2 = await u4.evaluate({ sourceText: p3 }); d3.push({ effectCode: `python.embedded.sqlite.${a2.action}`, action: a2.action, reasonCode: a2.action === "allow" ? "python.read_only" : a2.reasonCode.startsWith("sqlite.") ? a2.reasonCode.replace(/^sqlite\./, "python.sqlite_") : a2.reasonCode, kind: "statement", summary: a2.action === "allow" ? "Python sqlite3 code executes an ordinary read-only SQL payload." : "Python sqlite3 code executes a SQL payload that requires review." }); } } return w2("python", o, H2, [...l.effects, ...d3]); } }; } function Ie3(e = {}) { let t2; return k({ ...e, sqliteEvaluator() { return t2 ??= Promise.resolve().then(() => (init_sqlite(), sqlite_exports)).then(({ createSqlitePolicyEvaluator: i2 }) => i2(e.limits ? { limits: e.limits } : {})), t2; } }); } var E2, x2, f, F3, oe3, b, j3, I, T2, V, $3, m, M, U, H2, z3, W2, Z3, K2, G2, Q3, X3, y, c2, init_python = __esm({ "node_modules/@at-series/command-policy/dist/python.js"() { init_tree_sitter_runtime(); E2 = "1.0.0", x2 = "0.1.1", f = Object.freeze({ core: "0.1.1", shell: "0.1.1", python: "0.1.0", sqlite: "0.1.1", mysql: "0.1.2", redis: "0.1.1" }), F3 = Object.freeze({ shell: "tree-sitter-bash@0.25.1", python: "tree-sitter-python@0.25.0", sqlite: "sqlite3-parser@0.7.1/sqlite-3.53.0", mysql: "node-sql-parser@5.4.0/mysql", redis: "redis-command-table@1" }), oe3 = Object.freeze({ schemaVersion: E2, policy: x2, rules: f, parsers: F3 }), b = Object.freeze({ allow: 0, review: 1, deny: 2 }); j3 = Object.freeze({ maxInputBytes: 65536, maxAstNodes: 12e3, maxNestingDepth: 64, maxStatements: 512, maxWorkUnits: 1e5 }); I = class { #e; #t = 0; constructor(t2) { this.#e = t2; } consume(t2 = 1) { return this.#t += t2, this.#t <= this.#e; } }, T2 = /(?:^|[_-])(?:pass(?:word|wd)?|secret|token|api[_-]?key|private[_-]?key|credential|auth)(?:$|[_-])/i, V = /* @__PURE__ */ new Set([".ssh", ".aws", ".azure", ".kube", ".gnupg", ".docker", "credentials", "secrets", "serviceaccount", "service-account"]), $3 = /^\/proc\/(?:self|\d+)\/(?:environ|cmdline|maps|mem)$/; m = Object.freeze({ ANALYSIS_UNAVAILABLE: "policy.analysis_unavailable", INITIALIZATION_FAILED: "policy.initialization_failed", PARSE_FAILED: "policy.parse_failed", RESOURCE_LIMIT_EXCEEDED: "policy.resource_limit_exceeded", UNKNOWN_SEMANTICS: "policy.unknown_semantics", INVALID_DECISION: "policy.invalid_decision" }), M = { "analysis-unavailable": "analysis is unavailable", "initialization-failed": "analyzer initialization failed", "parse-failed": "parsing failed", "resource-limit-exceeded": "an analysis resource limit was exceeded", "unknown-semantics": "semantics are unknown" }; U = { "analysis-unavailable": m.ANALYSIS_UNAVAILABLE, "initialization-failed": m.INITIALIZATION_FAILED, "parse-failed": m.PARSE_FAILED, "resource-limit-exceeded": m.RESOURCE_LIMIT_EXCEEDED, "unknown-semantics": m.UNKNOWN_SEMANTICS }; H2 = "tree-sitter-python@0.25.0", z3 = /* @__PURE__ */ new Set(["collections", "csv", "datetime", "decimal", "fractions", "functools", "itertools", "json", "math", "pathlib", "re", "sqlite3", "statistics"]), W2 = /* @__PURE__ */ new Set(["abs", "all", "any", "bool", "dict", "enumerate", "float", "frozenset", "int", "len", "list", "max", "min", "object", "print", "range", "repr", "reversed", "round", "set", "sorted", "str", "sum", "tuple", "zip"]), Z3 = /* @__PURE__ */ new Set(["__import__", "breakpoint", "compile", "delattr", "eval", "exec", "getattr", "globals", "help", "input", "locals", "memoryview", "setattr", "vars"]), K2 = /* @__PURE__ */ new Set(["async_function_definition", "await", "class_definition", "decorated_definition", "function_definition", "global_statement", "lambda", "nonlocal_statement", "yield"]), G2 = /* @__PURE__ */ new Set(["close", "cursor", "description", "fetchall", "fetchmany", "fetchone", "keys"]), Q3 = /* @__PURE__ */ new Set(["execute", "executemany", "executescript"]), X3 = /* @__PURE__ */ new Set(["backup", "commit", "create_aggregate", "create_collation", "create_function", "dump", "enable_load_extension", "iterdump", "load_extension", "rollback", "set_authorizer"]), y = (e = "python.process.pure", t2 = "Python syntax is within the approved pure static subset.") => ({ effectCode: e, action: "allow", reasonCode: "python.read_only", kind: "statement", summary: t2 }), c2 = (e = "python.semantics.unknown", t2 = "Python semantics are outside the approved static subset.") => ({ effectCode: e, action: "review", reasonCode: "python.unknown_semantics", kind: "statement", summary: t2 }); } }); // node_modules/@at-series/command-policy/dist/mysql.js var mysql_exports = {}; __export(mysql_exports, { createMysqlPolicyEvaluator: () => Dy }); function ey(Q5) { let at3 = 1, ct3 = 0; for (let X6 = 0; X6 < Q5.length; X6 += 1) Q5.charCodeAt(X6) === 10 && (at3 += 1, ct3 = X6 + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: Q5.length, line: at3, column: Q5.length - ct3 + 1 } }; } function ti(Q5, at3, ct3, X6) { let Et2 = typeof at3.sourceText == "string" ? at3.sourceText : "", i2 = X6.length > 0 ? X6 : [{ effectCode: `${Q5}.process.noop`, action: "allow", reasonCode: `${Q5}.read_only`, kind: "statement", summary: `${Q5} source has no external effect.` }], Wt2 = i2[0]; for (let xt of i2.slice(1)) Sl[xt.action] > Sl[Wt2.action] && (Wt2 = xt); let tt3, t2 = () => tt3 ??= ey(Et2), st3 = i2.map((xt) => Object.freeze({ kind: xt.kind, location: xt.location ?? t2(), redacted: !0, summary: xt.summary })), ft3 = i2.map((xt, Mt) => Object.freeze({ effectCode: xt.effectCode, action: xt.action, evidenceIndexes: Object.freeze([Mt]) })); return Object.freeze({ schemaVersion: jo, action: Wt2.action, effects: Object.freeze(ft3), reasonCode: Wt2.reasonCode, evidence: Object.freeze(st3), versions: Object.freeze({ policy: ko, rules: Object.freeze({ core: lr.core, [Q5]: lr[Q5] }), parsers: Object.freeze({ [Q5]: ct3 }) }) }); } function Tl(Q5) { let at3 = { ...ny, ...Q5 }; for (let [ct3, X6] of Object.entries(at3)) if (!Number.isSafeInteger(X6) || X6 < 1) throw new TypeError(`${ct3} must be a positive safe integer`); return Object.freeze(at3); } function Ol(Q5, at3) { return Q5.length * 3 <= at3.maxInputBytes ? !1 : Buffer.byteLength(Q5, "utf8") > at3.maxInputBytes; } function oy(Q5) { let at3 = 1, ct3 = 0; for (let X6 = 0; X6 < Q5.length; X6 += 1) Q5.charCodeAt(X6) === 10 && (at3 += 1, ct3 = X6 + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: Q5.length, line: at3, column: Q5.length - ct3 + 1 } }; } function Nl(Q5, at3, ct3) { return { kind: "unknown", location: oy(ct3), redacted: !0, summary: `${Q5} source requires review because ${ry[at3]}.` }; } function Fr({ domain: Q5, failure: at3, input: ct3 }) { let X6 = typeof ct3.sourceText == "string" ? ct3.sourceText : ""; return { schemaVersion: jo, action: "review", effects: [{ effectCode: `${Q5}.analysis.unknown`, action: "review", evidenceIndexes: [0] }], reasonCode: sy[at3], evidence: [Nl(Q5, at3, X6)], versions: { policy: ko, rules: { core: lr.core, [Q5]: lr[Q5] }, parsers: { [Q5]: "unavailable" } } }; } function Rl(Q5) { return Q5 === "*" || uy.test(Q5.replaceAll(".", "_")); } function An2(Q5) { return typeof Q5 == "object" && Q5 !== null && !Array.isArray(Q5); } function ei(Q5) { return { effectCode: `${Q5}.database.read`, action: "allow", reasonCode: `${Q5}.read_only`, kind: "statement", summary: `${Q5} statements have an ordinary read-only contract.` }; } function Ke3(Q5, at3) { let ct3 = { write: `${Q5} statements may modify database or server state.`, sensitive_read: `${Q5} statements may read sensitive database data.`, unknown: `${Q5} statement semantics are not statically established.` }; return { effectCode: `${Q5}.database.${at3}`, action: "review", reasonCode: `${Q5}.${at3}`, kind: "statement", summary: ct3[at3] }; } function bu(Q5) { return Q5 !== "*" && Rl(Q5); } function iy(Q5) { return ay.has(Q5.toLowerCase()); } function jl(Q5) { return bu(Q5) || cy.has(Q5.toLowerCase()); } function ly(Q5) { return bu(Q5) || /^(?:auth|credential|credentials|private_keys?|secrets?|tokens?|api_keys?|service_accounts?)$/i.test(Q5); } function kl(Q5, at3) { return Q5 !== void 0 && iy(Q5) ? !0 : ly(at3); } function Ul(Q5, at3) { let ct3 = [], X6 = [{ value: Q5, depth: 1 }], Et2 = 0; for (; X6.length > 0; ) { let i2 = X6.pop(); if (Et2 += 1, Et2 > at3.maxWorkUnits || ct3.length > at3.maxAstNodes || i2.depth > at3.maxNestingDepth) return; if (Array.isArray(i2.value)) for (let Wt2 of i2.value) X6.push({ value: Wt2, depth: i2.depth + 1 }); else if (An2(i2.value)) { ct3.push(i2.value); for (let Wt2 of Object.values(i2.value)) X6.push({ value: Wt2, depth: i2.depth + 1 }); } } return ct3; } function Pl(Q5) { return typeof Q5 == "string" ? Q5 : An2(Q5) && typeof Q5.value == "string" ? Q5.value : void 0; } function by(Q5) { if (typeof Q5.name == "string") return Q5.name.toLowerCase(); if (!An2(Q5.name) || !Array.isArray(Q5.name.name)) return; let at3 = Q5.name.name.at(-1); return An2(at3) && typeof at3.value == "string" ? at3.value.toLowerCase() : void 0; } function Dl(Q5, at3) { let ct3 = Ul(Q5, at3); if (!ct3) return Ke3("mysql", "unknown"); for (let X6 of ct3) { if (X6.type === "select" && (typeof X6.locking_read == "string" || An2(X6.into) && (typeof X6.into.keyword == "string" || An2(X6.into.expr)))) return Ke3("mysql", "write"); if (X6.type === "column_ref" && typeof X6.column == "string" && jl(X6.column)) return Ke3("mysql", "sensitive_read"); if (X6.type === "assign" || X6.type === "var") return Ke3("mysql", "unknown"); } for (let X6 of ct3) { let Et2 = Pl(X6.table); if (Et2 === void 0) continue; let i2 = Pl(X6.db); if (kl(i2, Et2) || bu(Et2)) return Ke3("mysql", "sensitive_read"); } for (let X6 of ct3) if (X6.type === "function" || X6.type === "aggr_func") { let Et2 = by(X6); if (!Et2 || !xl.has(Et2)) return Ke3("mysql", "unknown"); } return ei("mysql"); } function vy(Q5, at3) { return !An2(Q5) || typeof Q5.type != "string" ? Ke3("mysql", "unknown") : Q5.type === "select" ? Dl(Q5, at3) : Q5.type === "show" || Q5.type === "desc" ? ei("mysql") : Q5.type === "explain" ? An2(Q5.expr) && Q5.expr.type === "select" ? Dl(Q5.expr, at3) : Ke3("mysql", "unknown") : Ke3("mysql", "write"); } function Bl(Q5 = {}) { let at3 = Tl(Q5.limits), ct3 = new py(); return { async evaluate(X6) { let Et2 = typeof X6.sourceText == "string" ? X6.sourceText : ""; if (Et2.trim().length === 0) return Fr({ domain: "mysql", failure: "parse-failed", input: X6 }); if (Ol(Et2, at3)) return Fr({ domain: "mysql", failure: "resource-limit-exceeded", input: X6 }); if (fy.test(Et2)) return ti("mysql", X6, Ml, [Ke3("mysql", "unknown")]); let i2; try { i2 = ct3.astify(Et2, { database: "MySQL" }); } catch { return Fr({ domain: "mysql", failure: "parse-failed", input: X6 }); } let Wt2 = Array.isArray(i2) ? i2 : [i2]; return Wt2.length === 0 ? Fr({ domain: "mysql", failure: "parse-failed", input: X6 }) : Wt2.length > at3.maxStatements ? Fr({ domain: "mysql", failure: "resource-limit-exceeded", input: X6 }) : ti("mysql", X6, Ml, Wt2.map((tt3) => vy(tt3, at3))); } }; } function Dy(Q5 = {}) { return Bl(Q5); } var Vv, El, zv, Kv, Xv, Qv, Al, Zv, Jv, gl, Il, ql, jo, ko, lr, ty, wy, Sl, ny, Br, ry, sy, uy, xl, ay, cy, Ml, fy, py, init_mysql = __esm({ "node_modules/@at-series/command-policy/dist/mysql.js"() { Vv = Object.create, El = Object.defineProperty, zv = Object.getOwnPropertyDescriptor, Kv = Object.getOwnPropertyNames, Xv = Object.getPrototypeOf, Qv = Object.prototype.hasOwnProperty, Al = (Q5, at3) => () => { try { return at3 || Q5((at3 = { exports: {} }).exports, at3), at3.exports; } catch (ct3) { throw at3 = 0, ct3; } }, Zv = (Q5, at3, ct3, X6) => { if (at3 && typeof at3 == "object" || typeof at3 == "function") for (let Et2 of Kv(at3)) !Qv.call(Q5, Et2) && Et2 !== ct3 && El(Q5, Et2, { get: () => at3[Et2], enumerable: !(X6 = zv(at3, Et2)) || X6.enumerable }); return Q5; }, Jv = (Q5, at3, ct3) => (ct3 = Q5 != null ? Vv(Xv(Q5)) : {}, Zv(at3 || !Q5 || !Q5.__esModule ? El(ct3, "default", { value: Q5, enumerable: !0 }) : ct3, Q5)), gl = Al((dy, pu) => { var ve4 = (function(Q5) { "use strict"; var at3 = 1e7, ct3 = 7, X6 = 9007199254740992, Et2 = Mt(X6), i2 = "0123456789abcdefghijklmnopqrstuvwxyz", Wt2 = typeof BigInt == "function"; function tt3(g4, T5, x5, D4) { return typeof g4 > "u" ? tt3[0] : typeof T5 < "u" ? +T5 == 10 && !x5 ? Tt(g4) : Nn2(g4, T5, x5, D4) : Tt(g4); } function t2(g4, T5) { this.value = g4, this.sign = T5, this.isSmall = !1; } t2.prototype = Object.create(tt3.prototype); function st3(g4) { this.value = g4, this.sign = g4 < 0, this.isSmall = !0; } st3.prototype = Object.create(tt3.prototype); function ft3(g4) { this.value = g4; } ft3.prototype = Object.create(tt3.prototype); function xt(g4) { return -X6 < g4 && g4 < X6; } function Mt(g4) { return g4 < 1e7 ? [g4] : g4 < 1e14 ? [g4 % 1e7, Math.floor(g4 / 1e7)] : [g4 % 1e7, Math.floor(g4 / 1e7) % 1e7, Math.floor(g4 / 1e14)]; } function oe5(g4) { Ce4(g4); var T5 = g4.length; if (T5 < 4 && Ye4(g4, Et2) < 0) switch (T5) { case 0: return 0; case 1: return g4[0]; case 2: return g4[0] + g4[1] * at3; default: return g4[0] + (g4[1] + g4[2] * at3) * at3; } return g4; } function Ce4(g4) { for (var T5 = g4.length; g4[--T5] === 0; ) ; g4.length = T5 + 1; } function Zt(g4) { for (var T5 = new Array(g4), x5 = -1; ++x5 < g4; ) T5[x5] = 0; return T5; } function yt2(g4) { return g4 > 0 ? Math.floor(g4) : Math.ceil(g4); } function R4(g4, T5) { var x5 = g4.length, D4 = T5.length, V3 = new Array(x5), Y5 = 0, et3 = at3, J5, nt3; for (nt3 = 0; nt3 < D4; nt3++) J5 = g4[nt3] + T5[nt3] + Y5, Y5 = J5 >= et3 ? 1 : 0, V3[nt3] = J5 - Y5 * et3; for (; nt3 < x5; ) J5 = g4[nt3] + Y5, Y5 = J5 === et3 ? 1 : 0, V3[nt3++] = J5 - Y5 * et3; return Y5 > 0 && V3.push(Y5), V3; } function P4(g4, T5) { return g4.length >= T5.length ? R4(g4, T5) : R4(T5, g4); } function lt3(g4, T5) { var x5 = g4.length, D4 = new Array(x5), V3 = at3, Y5, et3; for (et3 = 0; et3 < x5; et3++) Y5 = g4[et3] - V3 + T5, T5 = Math.floor(Y5 / V3), D4[et3] = Y5 - T5 * V3, T5 += 1; for (; T5 > 0; ) D4[et3++] = T5 % V3, T5 = Math.floor(T5 / V3); return D4; } t2.prototype.add = function(g4) { var T5 = Tt(g4); if (this.sign !== T5.sign) return this.subtract(T5.negate()); var x5 = this.value, D4 = T5.value; return T5.isSmall ? new t2(lt3(x5, Math.abs(D4)), this.sign) : new t2(P4(x5, D4), this.sign); }, t2.prototype.plus = t2.prototype.add, st3.prototype.add = function(g4) { var T5 = Tt(g4), x5 = this.value; if (x5 < 0 !== T5.sign) return this.subtract(T5.negate()); var D4 = T5.value; if (T5.isSmall) { if (xt(x5 + D4)) return new st3(x5 + D4); D4 = Mt(Math.abs(D4)); } return new t2(lt3(D4, Math.abs(x5)), x5 < 0); }, st3.prototype.plus = st3.prototype.add, ft3.prototype.add = function(g4) { return new ft3(this.value + Tt(g4).value); }, ft3.prototype.plus = ft3.prototype.add; function ye4(g4, T5) { var x5 = g4.length, D4 = T5.length, V3 = new Array(x5), Y5 = 0, et3 = at3, J5, nt3; for (J5 = 0; J5 < D4; J5++) nt3 = g4[J5] - Y5 - T5[J5], nt3 < 0 ? (nt3 += et3, Y5 = 1) : Y5 = 0, V3[J5] = nt3; for (J5 = D4; J5 < x5; J5++) { if (nt3 = g4[J5] - Y5, nt3 < 0) nt3 += et3; else { V3[J5++] = nt3; break; } V3[J5] = nt3; } for (; J5 < x5; J5++) V3[J5] = g4[J5]; return Ce4(V3), V3; } function Yn2(g4, T5, x5) { var D4; return Ye4(g4, T5) >= 0 ? D4 = ye4(g4, T5) : (D4 = ye4(T5, g4), x5 = !x5), D4 = oe5(D4), typeof D4 == "number" ? (x5 && (D4 = -D4), new st3(D4)) : new t2(D4, x5); } function Ne4(g4, T5, x5) { var D4 = g4.length, V3 = new Array(D4), Y5 = -T5, et3 = at3, J5, nt3; for (J5 = 0; J5 < D4; J5++) nt3 = g4[J5] + Y5, Y5 = Math.floor(nt3 / et3), nt3 %= et3, V3[J5] = nt3 < 0 ? nt3 + et3 : nt3; return V3 = oe5(V3), typeof V3 == "number" ? (x5 && (V3 = -V3), new st3(V3)) : new t2(V3, x5); } t2.prototype.subtract = function(g4) { var T5 = Tt(g4); if (this.sign !== T5.sign) return this.add(T5.negate()); var x5 = this.value, D4 = T5.value; return T5.isSmall ? Ne4(x5, Math.abs(D4), this.sign) : Yn2(x5, D4, this.sign); }, t2.prototype.minus = t2.prototype.subtract, st3.prototype.subtract = function(g4) { var T5 = Tt(g4), x5 = this.value; if (x5 < 0 !== T5.sign) return this.add(T5.negate()); var D4 = T5.value; return T5.isSmall ? new st3(x5 - D4) : Ne4(D4, Math.abs(x5), x5 >= 0); }, st3.prototype.minus = st3.prototype.subtract, ft3.prototype.subtract = function(g4) { return new ft3(this.value - Tt(g4).value); }, ft3.prototype.minus = ft3.prototype.subtract, t2.prototype.negate = function() { return new t2(this.value, !this.sign); }, st3.prototype.negate = function() { var g4 = this.sign, T5 = new st3(-this.value); return T5.sign = !g4, T5; }, ft3.prototype.negate = function() { return new ft3(-this.value); }, t2.prototype.abs = function() { return new t2(this.value, !1); }, st3.prototype.abs = function() { return new st3(Math.abs(this.value)); }, ft3.prototype.abs = function() { return new ft3(this.value >= 0 ? this.value : -this.value); }; function Re4(g4, T5) { var x5 = g4.length, D4 = T5.length, V3 = x5 + D4, Y5 = Zt(V3), et3 = at3, J5, nt3, jt, Ht2, kt; for (jt = 0; jt < x5; ++jt) { Ht2 = g4[jt]; for (var zt = 0; zt < D4; ++zt) kt = T5[zt], J5 = Ht2 * kt + Y5[jt + zt], nt3 = Math.floor(J5 / et3), Y5[jt + zt] = J5 - nt3 * et3, Y5[jt + zt + 1] += nt3; } return Ce4(Y5), Y5; } function xe4(g4, T5) { var x5 = g4.length, D4 = new Array(x5), V3 = at3, Y5 = 0, et3, J5; for (J5 = 0; J5 < x5; J5++) et3 = g4[J5] * T5 + Y5, Y5 = Math.floor(et3 / V3), D4[J5] = et3 - Y5 * V3; for (; Y5 > 0; ) D4[J5++] = Y5 % V3, Y5 = Math.floor(Y5 / V3); return D4; } function fn2(g4, T5) { for (var x5 = []; T5-- > 0; ) x5.push(0); return x5.concat(g4); } function pn2(g4, T5) { var x5 = Math.max(g4.length, T5.length); if (x5 <= 30) return Re4(g4, T5); x5 = Math.ceil(x5 / 2); var D4 = g4.slice(x5), V3 = g4.slice(0, x5), Y5 = T5.slice(x5), et3 = T5.slice(0, x5), J5 = pn2(V3, et3), nt3 = pn2(D4, Y5), jt = pn2(P4(V3, D4), P4(et3, Y5)), Ht2 = P4(P4(J5, fn2(ye4(ye4(jt, J5), nt3), x5)), fn2(nt3, 2 * x5)); return Ce4(Ht2), Ht2; } function gn2(g4, T5) { return -0.012 * g4 - 0.012 * T5 + 15e-6 * g4 * T5 > 0; } t2.prototype.multiply = function(g4) { var T5 = Tt(g4), x5 = this.value, D4 = T5.value, V3 = this.sign !== T5.sign, Y5; if (T5.isSmall) { if (D4 === 0) return tt3[0]; if (D4 === 1) return this; if (D4 === -1) return this.negate(); if (Y5 = Math.abs(D4), Y5 < at3) return new t2(xe4(x5, Y5), V3); D4 = Mt(Y5); } return gn2(x5.length, D4.length) ? new t2(pn2(x5, D4), V3) : new t2(Re4(x5, D4), V3); }, t2.prototype.times = t2.prototype.multiply; function _n2(g4, T5, x5) { return g4 < at3 ? new t2(xe4(T5, g4), x5) : new t2(Re4(T5, Mt(g4)), x5); } st3.prototype._multiplyBySmall = function(g4) { return xt(g4.value * this.value) ? new st3(g4.value * this.value) : _n2(Math.abs(g4.value), Mt(Math.abs(this.value)), this.sign !== g4.sign); }, t2.prototype._multiplyBySmall = function(g4) { return g4.value === 0 ? tt3[0] : g4.value === 1 ? this : g4.value === -1 ? this.negate() : _n2(Math.abs(g4.value), this.value, this.sign !== g4.sign); }, st3.prototype.multiply = function(g4) { return Tt(g4)._multiplyBySmall(this); }, st3.prototype.times = st3.prototype.multiply, ft3.prototype.multiply = function(g4) { return new ft3(this.value * Tt(g4).value); }, ft3.prototype.times = ft3.prototype.multiply; function $n2(g4) { var T5 = g4.length, x5 = Zt(T5 + T5), D4 = at3, V3, Y5, et3, J5, nt3; for (et3 = 0; et3 < T5; et3++) { J5 = g4[et3], Y5 = 0 - J5 * J5; for (var jt = et3; jt < T5; jt++) nt3 = g4[jt], V3 = 2 * (J5 * nt3) + x5[et3 + jt] + Y5, Y5 = Math.floor(V3 / D4), x5[et3 + jt] = V3 - Y5 * D4; x5[et3 + T5] = Y5; } return Ce4(x5), x5; } t2.prototype.square = function() { return new t2($n2(this.value), !1); }, st3.prototype.square = function() { var g4 = this.value * this.value; return xt(g4) ? new st3(g4) : new t2($n2(Mt(Math.abs(this.value))), !1); }, ft3.prototype.square = function(g4) { return new ft3(this.value * this.value); }; function Hn2(g4, T5) { var x5 = g4.length, D4 = T5.length, V3 = at3, Y5 = Zt(T5.length), et3 = T5[D4 - 1], J5 = Math.ceil(V3 / (2 * et3)), nt3 = xe4(g4, J5), jt = xe4(T5, J5), Ht2, kt, zt, le3, Kt2, ne6, Rn2; for (nt3.length <= x5 && nt3.push(0), jt.push(0), et3 = jt[D4 - 1], kt = x5 - D4; kt >= 0; kt--) { for (Ht2 = V3 - 1, nt3[kt + D4] !== et3 && (Ht2 = Math.floor((nt3[kt + D4] * V3 + nt3[kt + D4 - 1]) / et3)), zt = 0, le3 = 0, ne6 = jt.length, Kt2 = 0; Kt2 < ne6; Kt2++) zt += Ht2 * jt[Kt2], Rn2 = Math.floor(zt / V3), le3 += nt3[kt + Kt2] - (zt - Rn2 * V3), zt = Rn2, le3 < 0 ? (nt3[kt + Kt2] = le3 + V3, le3 = -1) : (nt3[kt + Kt2] = le3, le3 = 0); for (; le3 !== 0; ) { for (Ht2 -= 1, zt = 0, Kt2 = 0; Kt2 < ne6; Kt2++) zt += nt3[kt + Kt2] - V3 + jt[Kt2], zt < 0 ? (nt3[kt + Kt2] = zt + V3, zt = 0) : (nt3[kt + Kt2] = zt, zt = 1); le3 += zt; } Y5[kt] = Ht2; } return nt3 = Sn2(nt3, J5)[0], [oe5(Y5), oe5(nt3)]; } function In2(g4, T5) { for (var x5 = g4.length, D4 = T5.length, V3 = [], Y5 = [], et3 = at3, J5, nt3, jt, Ht2, kt; x5; ) { if (Y5.unshift(g4[--x5]), Ce4(Y5), Ye4(Y5, T5) < 0) { V3.push(0); continue; } nt3 = Y5.length, jt = Y5[nt3 - 1] * et3 + Y5[nt3 - 2], Ht2 = T5[D4 - 1] * et3 + T5[D4 - 2], nt3 > D4 && (jt = (jt + 1) * et3), J5 = Math.ceil(jt / Ht2); do { if (kt = xe4(T5, J5), Ye4(kt, Y5) <= 0) break; J5--; } while (J5); V3.push(J5), Y5 = ye4(Y5, kt); } return V3.reverse(), [oe5(V3), oe5(Y5)]; } function Sn2(g4, T5) { var x5 = g4.length, D4 = Zt(x5), V3 = at3, Y5, et3, J5, nt3; for (J5 = 0, Y5 = x5 - 1; Y5 >= 0; --Y5) nt3 = J5 * V3 + g4[Y5], et3 = yt2(nt3 / T5), J5 = nt3 - et3 * T5, D4[Y5] = et3 | 0; return [D4, J5 | 0]; } function je4(g4, T5) { var x5, D4 = Tt(T5); if (Wt2) return [new ft3(g4.value / D4.value), new ft3(g4.value % D4.value)]; var V3 = g4.value, Y5 = D4.value, et3; if (Y5 === 0) throw new Error("Cannot divide by zero"); if (g4.isSmall) return D4.isSmall ? [new st3(yt2(V3 / Y5)), new st3(V3 % Y5)] : [tt3[0], g4]; if (D4.isSmall) { if (Y5 === 1) return [g4, tt3[0]]; if (Y5 == -1) return [g4.negate(), tt3[0]]; var J5 = Math.abs(Y5); if (J5 < at3) { x5 = Sn2(V3, J5), et3 = oe5(x5[0]); var nt3 = x5[1]; return g4.sign && (nt3 = -nt3), typeof et3 == "number" ? (g4.sign !== D4.sign && (et3 = -et3), [new st3(et3), new st3(nt3)]) : [new t2(et3, g4.sign !== D4.sign), new st3(nt3)]; } Y5 = Mt(J5); } var jt = Ye4(V3, Y5); if (jt === -1) return [tt3[0], g4]; if (jt === 0) return [tt3[g4.sign === D4.sign ? 1 : -1], tt3[0]]; V3.length + Y5.length <= 200 ? x5 = Hn2(V3, Y5) : x5 = In2(V3, Y5), et3 = x5[0]; var Ht2 = g4.sign !== D4.sign, kt = x5[1], zt = g4.sign; return typeof et3 == "number" ? (Ht2 && (et3 = -et3), et3 = new st3(et3)) : et3 = new t2(et3, Ht2), typeof kt == "number" ? (zt && (kt = -kt), kt = new st3(kt)) : kt = new t2(kt, zt), [et3, kt]; } t2.prototype.divmod = function(g4) { var T5 = je4(this, g4); return { quotient: T5[0], remainder: T5[1] }; }, ft3.prototype.divmod = st3.prototype.divmod = t2.prototype.divmod, t2.prototype.divide = function(g4) { return je4(this, g4)[0]; }, ft3.prototype.over = ft3.prototype.divide = function(g4) { return new ft3(this.value / Tt(g4).value); }, st3.prototype.over = st3.prototype.divide = t2.prototype.over = t2.prototype.divide, t2.prototype.mod = function(g4) { return je4(this, g4)[1]; }, ft3.prototype.mod = ft3.prototype.remainder = function(g4) { return new ft3(this.value % Tt(g4).value); }, st3.prototype.remainder = st3.prototype.mod = t2.prototype.remainder = t2.prototype.mod, t2.prototype.pow = function(g4) { var T5 = Tt(g4), x5 = this.value, D4 = T5.value, V3, Y5, et3; if (D4 === 0) return tt3[1]; if (x5 === 0) return tt3[0]; if (x5 === 1) return tt3[1]; if (x5 === -1) return T5.isEven() ? tt3[1] : tt3[-1]; if (T5.sign) return tt3[0]; if (!T5.isSmall) throw new Error("The exponent " + T5.toString() + " is too large."); if (this.isSmall && xt(V3 = Math.pow(x5, D4))) return new st3(yt2(V3)); for (Y5 = this, et3 = tt3[1]; D4 & !0 && (et3 = et3.times(Y5), --D4), D4 !== 0; ) D4 /= 2, Y5 = Y5.square(); return et3; }, st3.prototype.pow = t2.prototype.pow, ft3.prototype.pow = function(g4) { var T5 = Tt(g4), x5 = this.value, D4 = T5.value, V3 = BigInt(0), Y5 = BigInt(1), et3 = BigInt(2); if (D4 === V3) return tt3[1]; if (x5 === V3) return tt3[0]; if (x5 === Y5) return tt3[1]; if (x5 === BigInt(-1)) return T5.isEven() ? tt3[1] : tt3[-1]; if (T5.isNegative()) return new ft3(V3); for (var J5 = this, nt3 = tt3[1]; (D4 & Y5) === Y5 && (nt3 = nt3.times(J5), --D4), D4 !== V3; ) D4 /= et3, J5 = J5.square(); return nt3; }, t2.prototype.modPow = function(g4, T5) { if (g4 = Tt(g4), T5 = Tt(T5), T5.isZero()) throw new Error("Cannot take modPow with modulus 0"); var x5 = tt3[1], D4 = this.mod(T5); for (g4.isNegative() && (g4 = g4.multiply(tt3[-1]), D4 = D4.modInv(T5)); g4.isPositive(); ) { if (D4.isZero()) return tt3[0]; g4.isOdd() && (x5 = x5.multiply(D4).mod(T5)), g4 = g4.divide(2), D4 = D4.square().mod(T5); } return x5; }, ft3.prototype.modPow = st3.prototype.modPow = t2.prototype.modPow; function Ye4(g4, T5) { if (g4.length !== T5.length) return g4.length > T5.length ? 1 : -1; for (var x5 = g4.length - 1; x5 >= 0; x5--) if (g4[x5] !== T5[x5]) return g4[x5] > T5[x5] ? 1 : -1; return 0; } t2.prototype.compareAbs = function(g4) { var T5 = Tt(g4), x5 = this.value, D4 = T5.value; return T5.isSmall ? 1 : Ye4(x5, D4); }, st3.prototype.compareAbs = function(g4) { var T5 = Tt(g4), x5 = Math.abs(this.value), D4 = T5.value; return T5.isSmall ? (D4 = Math.abs(D4), x5 === D4 ? 0 : x5 > D4 ? 1 : -1) : -1; }, ft3.prototype.compareAbs = function(g4) { var T5 = this.value, x5 = Tt(g4).value; return T5 = T5 >= 0 ? T5 : -T5, x5 = x5 >= 0 ? x5 : -x5, T5 === x5 ? 0 : T5 > x5 ? 1 : -1; }, t2.prototype.compare = function(g4) { if (g4 === 1 / 0) return -1; if (g4 === -1 / 0) return 1; var T5 = Tt(g4), x5 = this.value, D4 = T5.value; return this.sign !== T5.sign ? T5.sign ? 1 : -1 : T5.isSmall ? this.sign ? -1 : 1 : Ye4(x5, D4) * (this.sign ? -1 : 1); }, t2.prototype.compareTo = t2.prototype.compare, st3.prototype.compare = function(g4) { if (g4 === 1 / 0) return -1; if (g4 === -1 / 0) return 1; var T5 = Tt(g4), x5 = this.value, D4 = T5.value; return T5.isSmall ? x5 == D4 ? 0 : x5 > D4 ? 1 : -1 : x5 < 0 !== T5.sign ? x5 < 0 ? -1 : 1 : x5 < 0 ? 1 : -1; }, st3.prototype.compareTo = st3.prototype.compare, ft3.prototype.compare = function(g4) { if (g4 === 1 / 0) return -1; if (g4 === -1 / 0) return 1; var T5 = this.value, x5 = Tt(g4).value; return T5 === x5 ? 0 : T5 > x5 ? 1 : -1; }, ft3.prototype.compareTo = ft3.prototype.compare, t2.prototype.equals = function(g4) { return this.compare(g4) === 0; }, ft3.prototype.eq = ft3.prototype.equals = st3.prototype.eq = st3.prototype.equals = t2.prototype.eq = t2.prototype.equals, t2.prototype.notEquals = function(g4) { return this.compare(g4) !== 0; }, ft3.prototype.neq = ft3.prototype.notEquals = st3.prototype.neq = st3.prototype.notEquals = t2.prototype.neq = t2.prototype.notEquals, t2.prototype.greater = function(g4) { return this.compare(g4) > 0; }, ft3.prototype.gt = ft3.prototype.greater = st3.prototype.gt = st3.prototype.greater = t2.prototype.gt = t2.prototype.greater, t2.prototype.lesser = function(g4) { return this.compare(g4) < 0; }, ft3.prototype.lt = ft3.prototype.lesser = st3.prototype.lt = st3.prototype.lesser = t2.prototype.lt = t2.prototype.lesser, t2.prototype.greaterOrEquals = function(g4) { return this.compare(g4) >= 0; }, ft3.prototype.geq = ft3.prototype.greaterOrEquals = st3.prototype.geq = st3.prototype.greaterOrEquals = t2.prototype.geq = t2.prototype.greaterOrEquals, t2.prototype.lesserOrEquals = function(g4) { return this.compare(g4) <= 0; }, ft3.prototype.leq = ft3.prototype.lesserOrEquals = st3.prototype.leq = st3.prototype.lesserOrEquals = t2.prototype.leq = t2.prototype.lesserOrEquals, t2.prototype.isEven = function() { return (this.value[0] & 1) === 0; }, st3.prototype.isEven = function() { return (this.value & 1) === 0; }, ft3.prototype.isEven = function() { return (this.value & BigInt(1)) === BigInt(0); }, t2.prototype.isOdd = function() { return (this.value[0] & 1) === 1; }, st3.prototype.isOdd = function() { return (this.value & 1) === 1; }, ft3.prototype.isOdd = function() { return (this.value & BigInt(1)) === BigInt(1); }, t2.prototype.isPositive = function() { return !this.sign; }, st3.prototype.isPositive = function() { return this.value > 0; }, ft3.prototype.isPositive = st3.prototype.isPositive, t2.prototype.isNegative = function() { return this.sign; }, st3.prototype.isNegative = function() { return this.value < 0; }, ft3.prototype.isNegative = st3.prototype.isNegative, t2.prototype.isUnit = function() { return !1; }, st3.prototype.isUnit = function() { return Math.abs(this.value) === 1; }, ft3.prototype.isUnit = function() { return this.abs().value === BigInt(1); }, t2.prototype.isZero = function() { return !1; }, st3.prototype.isZero = function() { return this.value === 0; }, ft3.prototype.isZero = function() { return this.value === BigInt(0); }, t2.prototype.isDivisibleBy = function(g4) { var T5 = Tt(g4); return T5.isZero() ? !1 : T5.isUnit() ? !0 : T5.compareAbs(2) === 0 ? this.isEven() : this.mod(T5).isZero(); }, ft3.prototype.isDivisibleBy = st3.prototype.isDivisibleBy = t2.prototype.isDivisibleBy; function bn2(g4) { var T5 = g4.abs(); if (T5.isUnit()) return !1; if (T5.equals(2) || T5.equals(3) || T5.equals(5)) return !0; if (T5.isEven() || T5.isDivisibleBy(3) || T5.isDivisibleBy(5)) return !1; if (T5.lesser(49)) return !0; } function vn2(g4, T5) { for (var x5 = g4.prev(), D4 = x5, V3 = 0, Y5, et3, J5, nt3; D4.isEven(); ) D4 = D4.divide(2), V3++; t: for (J5 = 0; J5 < T5.length; J5++) if (!g4.lesser(T5[J5]) && (nt3 = ve4(T5[J5]).modPow(D4, g4), !(nt3.isUnit() || nt3.equals(x5)))) { for (Y5 = V3 - 1; Y5 != 0; Y5--) { if (nt3 = nt3.square().mod(g4), nt3.isUnit()) return !1; if (nt3.equals(x5)) continue t; } return !1; } return !0; } t2.prototype.isPrime = function(g4) { var T5 = bn2(this); if (T5 !== Q5) return T5; var x5 = this.abs(), D4 = x5.bitLength(); if (D4 <= 64) return vn2(x5, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); for (var V3 = Math.log(2) * D4.toJSNumber(), Y5 = Math.ceil(g4 === !0 ? 2 * Math.pow(V3, 2) : V3), et3 = [], J5 = 0; J5 < Y5; J5++) et3.push(ve4(J5 + 2)); return vn2(x5, et3); }, ft3.prototype.isPrime = st3.prototype.isPrime = t2.prototype.isPrime, t2.prototype.isProbablePrime = function(g4, T5) { var x5 = bn2(this); if (x5 !== Q5) return x5; for (var D4 = this.abs(), V3 = g4 === Q5 ? 5 : g4, Y5 = [], et3 = 0; et3 < V3; et3++) Y5.push(ve4.randBetween(2, D4.minus(2), T5)); return vn2(D4, Y5); }, ft3.prototype.isProbablePrime = st3.prototype.isProbablePrime = t2.prototype.isProbablePrime, t2.prototype.modInv = function(g4) { for (var T5 = ve4.zero, x5 = ve4.one, D4 = Tt(g4), V3 = this.abs(), Y5, et3, J5; !V3.isZero(); ) Y5 = D4.divide(V3), et3 = T5, J5 = D4, T5 = x5, D4 = V3, x5 = et3.subtract(Y5.multiply(x5)), V3 = J5.subtract(Y5.multiply(V3)); if (!D4.isUnit()) throw new Error(this.toString() + " and " + g4.toString() + " are not co-prime"); return T5.compare(0) === -1 && (T5 = T5.add(g4)), this.isNegative() ? T5.negate() : T5; }, ft3.prototype.modInv = st3.prototype.modInv = t2.prototype.modInv, t2.prototype.next = function() { var g4 = this.value; return this.sign ? Ne4(g4, 1, this.sign) : new t2(lt3(g4, 1), this.sign); }, st3.prototype.next = function() { var g4 = this.value; return g4 + 1 < X6 ? new st3(g4 + 1) : new t2(Et2, !1); }, ft3.prototype.next = function() { return new ft3(this.value + BigInt(1)); }, t2.prototype.prev = function() { var g4 = this.value; return this.sign ? new t2(lt3(g4, 1), !0) : Ne4(g4, 1, this.sign); }, st3.prototype.prev = function() { var g4 = this.value; return g4 - 1 > -X6 ? new st3(g4 - 1) : new t2(Et2, !0); }, ft3.prototype.prev = function() { return new ft3(this.value - BigInt(1)); }; for (var ie5 = [1]; 2 * ie5[ie5.length - 1] <= at3; ) ie5.push(2 * ie5[ie5.length - 1]); var yn2 = ie5.length, $e4 = ie5[yn2 - 1]; function Wn2(g4) { return Math.abs(g4) <= at3; } t2.prototype.shiftLeft = function(g4) { var T5 = Tt(g4).toJSNumber(); if (!Wn2(T5)) throw new Error(String(T5) + " is too large for shifting."); if (T5 < 0) return this.shiftRight(-T5); var x5 = this; if (x5.isZero()) return x5; for (; T5 >= yn2; ) x5 = x5.multiply($e4), T5 -= yn2 - 1; return x5.multiply(ie5[T5]); }, ft3.prototype.shiftLeft = st3.prototype.shiftLeft = t2.prototype.shiftLeft, t2.prototype.shiftRight = function(g4) { var T5, x5 = Tt(g4).toJSNumber(); if (!Wn2(x5)) throw new Error(String(x5) + " is too large for shifting."); if (x5 < 0) return this.shiftLeft(-x5); for (var D4 = this; x5 >= yn2; ) { if (D4.isZero() || D4.isNegative() && D4.isUnit()) return D4; T5 = je4(D4, $e4), D4 = T5[1].isNegative() ? T5[0].prev() : T5[0], x5 -= yn2 - 1; } return T5 = je4(D4, ie5[x5]), T5[1].isNegative() ? T5[0].prev() : T5[0]; }, ft3.prototype.shiftRight = st3.prototype.shiftRight = t2.prototype.shiftRight; function Xe4(g4, T5, x5) { T5 = Tt(T5); for (var D4 = g4.isNegative(), V3 = T5.isNegative(), Y5 = D4 ? g4.not() : g4, et3 = V3 ? T5.not() : T5, J5 = 0, nt3 = 0, jt = null, Ht2 = null, kt = []; !Y5.isZero() || !et3.isZero(); ) jt = je4(Y5, $e4), J5 = jt[1].toJSNumber(), D4 && (J5 = $e4 - 1 - J5), Ht2 = je4(et3, $e4), nt3 = Ht2[1].toJSNumber(), V3 && (nt3 = $e4 - 1 - nt3), Y5 = jt[0], et3 = Ht2[0], kt.push(x5(J5, nt3)); for (var zt = x5(D4 ? 1 : 0, V3 ? 1 : 0) !== 0 ? ve4(-1) : ve4(0), le3 = kt.length - 1; le3 >= 0; le3 -= 1) zt = zt.multiply($e4).add(ve4(kt[le3])); return zt; } t2.prototype.not = function() { return this.negate().prev(); }, ft3.prototype.not = st3.prototype.not = t2.prototype.not, t2.prototype.and = function(g4) { return Xe4(this, g4, function(T5, x5) { return T5 & x5; }); }, ft3.prototype.and = st3.prototype.and = t2.prototype.and, t2.prototype.or = function(g4) { return Xe4(this, g4, function(T5, x5) { return T5 | x5; }); }, ft3.prototype.or = st3.prototype.or = t2.prototype.or, t2.prototype.xor = function(g4) { return Xe4(this, g4, function(T5, x5) { return T5 ^ x5; }); }, ft3.prototype.xor = st3.prototype.xor = t2.prototype.xor; var Tn2 = 1 << 30, Qe3 = (at3 & -at3) * (at3 & -at3) | Tn2; function Ze3(g4) { var T5 = g4.value, x5 = typeof T5 == "number" ? T5 | Tn2 : typeof T5 == "bigint" ? T5 | BigInt(Tn2) : T5[0] + T5[1] * at3 | Qe3; return x5 & -x5; } function Vn2(g4, T5) { if (T5.compareTo(g4) <= 0) { var x5 = Vn2(g4, T5.square(T5)), D4 = x5.p, V3 = x5.e, Y5 = D4.multiply(T5); return Y5.compareTo(g4) <= 0 ? { p: Y5, e: V3 * 2 + 1 } : { p: D4, e: V3 * 2 }; } return { p: ve4(1), e: 0 }; } t2.prototype.bitLength = function() { var g4 = this; return g4.compareTo(ve4(0)) < 0 && (g4 = g4.negate().subtract(ve4(1))), g4.compareTo(ve4(0)) === 0 ? ve4(0) : ve4(Vn2(g4, ve4(2)).e).add(ve4(1)); }, ft3.prototype.bitLength = st3.prototype.bitLength = t2.prototype.bitLength; function dn2(g4, T5) { return g4 = Tt(g4), T5 = Tt(T5), g4.greater(T5) ? g4 : T5; } function Je3(g4, T5) { return g4 = Tt(g4), T5 = Tt(T5), g4.lesser(T5) ? g4 : T5; } function On2(g4, T5) { if (g4 = Tt(g4).abs(), T5 = Tt(T5).abs(), g4.equals(T5)) return g4; if (g4.isZero()) return T5; if (T5.isZero()) return g4; for (var x5 = tt3[1], D4, V3; g4.isEven() && T5.isEven(); ) D4 = Je3(Ze3(g4), Ze3(T5)), g4 = g4.divide(D4), T5 = T5.divide(D4), x5 = x5.multiply(D4); for (; g4.isEven(); ) g4 = g4.divide(Ze3(g4)); do { for (; T5.isEven(); ) T5 = T5.divide(Ze3(T5)); g4.greater(T5) && (V3 = T5, T5 = g4, g4 = V3), T5 = T5.subtract(g4); } while (!T5.isZero()); return x5.isUnit() ? g4 : g4.multiply(x5); } function tn2(g4, T5) { return g4 = Tt(g4).abs(), T5 = Tt(T5).abs(), g4.divide(On2(g4, T5)).multiply(T5); } function Gr(g4, T5, x5) { g4 = Tt(g4), T5 = Tt(T5); var D4 = x5 || Math.random, V3 = Je3(g4, T5), Y5 = dn2(g4, T5), et3 = Y5.subtract(V3).add(1); if (et3.isSmall) return V3.add(Math.floor(D4() * et3)); for (var J5 = He4(et3, at3).value, nt3 = [], jt = !0, Ht2 = 0; Ht2 < J5.length; Ht2++) { var kt = jt ? J5[Ht2] + (Ht2 + 1 < J5.length ? J5[Ht2 + 1] / at3 : 0) : at3, zt = yt2(D4() * kt); nt3.push(zt), zt < J5[Ht2] && (jt = !1); } return V3.add(tt3.fromArray(nt3, at3, !1)); } var Nn2 = function(g4, T5, x5, D4) { x5 = x5 || i2, g4 = String(g4), D4 || (g4 = g4.toLowerCase(), x5 = x5.toLowerCase()); var V3 = g4.length, Y5, et3 = Math.abs(T5), J5 = {}; for (Y5 = 0; Y5 < x5.length; Y5++) J5[x5[Y5]] = Y5; for (Y5 = 0; Y5 < V3; Y5++) { var nt3 = g4[Y5]; if (nt3 !== "-" && nt3 in J5 && J5[nt3] >= et3) { if (nt3 === "1" && et3 === 1) continue; throw new Error(nt3 + " is not a valid digit in base " + T5 + "."); } } T5 = Tt(T5); var jt = [], Ht2 = g4[0] === "-"; for (Y5 = Ht2 ? 1 : 0; Y5 < g4.length; Y5++) { var nt3 = g4[Y5]; if (nt3 in J5) jt.push(Tt(J5[nt3])); else if (nt3 === "<") { var kt = Y5; do Y5++; while (g4[Y5] !== ">" && Y5 < g4.length); jt.push(Tt(g4.slice(kt + 1, Y5))); } else throw new Error(nt3 + " is not a valid character"); } return ke4(jt, T5, Ht2); }; function ke4(g4, T5, x5) { var D4 = tt3[0], V3 = tt3[1], Y5; for (Y5 = g4.length - 1; Y5 >= 0; Y5--) D4 = D4.add(g4[Y5].times(V3)), V3 = V3.times(T5); return x5 ? D4.negate() : D4; } function fr(g4, T5) { return T5 = T5 || i2, g4 < T5.length ? T5[g4] : "<" + g4 + ">"; } function He4(g4, T5) { if (T5 = ve4(T5), T5.isZero()) { if (g4.isZero()) return { value: [0], isNegative: !1 }; throw new Error("Cannot convert nonzero numbers to base 0."); } if (T5.equals(-1)) { if (g4.isZero()) return { value: [0], isNegative: !1 }; if (g4.isNegative()) return { value: [].concat.apply([], Array.apply(null, Array(-g4.toJSNumber())).map(Array.prototype.valueOf, [1, 0])), isNegative: !1 }; var x5 = Array.apply(null, Array(g4.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]); return x5.unshift([1]), { value: [].concat.apply([], x5), isNegative: !1 }; } var D4 = !1; if (g4.isNegative() && T5.isPositive() && (D4 = !0, g4 = g4.abs()), T5.isUnit()) return g4.isZero() ? { value: [0], isNegative: !1 } : { value: Array.apply(null, Array(g4.toJSNumber())).map(Number.prototype.valueOf, 1), isNegative: D4 }; for (var V3 = [], Y5 = g4, et3; Y5.isNegative() || Y5.compareAbs(T5) >= 0; ) { et3 = Y5.divmod(T5), Y5 = et3.quotient; var J5 = et3.remainder; J5.isNegative() && (J5 = T5.minus(J5).abs(), Y5 = Y5.next()), V3.push(J5.toJSNumber()); } return V3.push(Y5.toJSNumber()), { value: V3.reverse(), isNegative: D4 }; } function zn2(g4, T5, x5) { var D4 = He4(g4, T5); return (D4.isNegative ? "-" : "") + D4.value.map(function(V3) { return fr(V3, x5); }).join(""); } t2.prototype.toArray = function(g4) { return He4(this, g4); }, st3.prototype.toArray = function(g4) { return He4(this, g4); }, ft3.prototype.toArray = function(g4) { return He4(this, g4); }, t2.prototype.toString = function(g4, T5) { if (g4 === Q5 && (g4 = 10), g4 !== 10 || T5) return zn2(this, g4, T5); for (var x5 = this.value, D4 = x5.length, V3 = String(x5[--D4]), Y5 = "0000000", et3; --D4 >= 0; ) et3 = String(x5[D4]), V3 += Y5.slice(et3.length) + et3; var J5 = this.sign ? "-" : ""; return J5 + V3; }, st3.prototype.toString = function(g4, T5) { return g4 === Q5 && (g4 = 10), g4 != 10 || T5 ? zn2(this, g4, T5) : String(this.value); }, ft3.prototype.toString = st3.prototype.toString, ft3.prototype.toJSON = t2.prototype.toJSON = st3.prototype.toJSON = function() { return this.toString(); }, t2.prototype.valueOf = function() { return parseInt(this.toString(), 10); }, t2.prototype.toJSNumber = t2.prototype.valueOf, st3.prototype.valueOf = function() { return this.value; }, st3.prototype.toJSNumber = st3.prototype.valueOf, ft3.prototype.valueOf = ft3.prototype.toJSNumber = function() { return parseInt(this.toString(), 10); }; function Kn2(g4) { if (xt(+g4)) { var T5 = +g4; if (T5 === yt2(T5)) return Wt2 ? new ft3(BigInt(T5)) : new st3(T5); throw new Error("Invalid integer: " + g4); } var x5 = g4[0] === "-"; x5 && (g4 = g4.slice(1)); var D4 = g4.split(/e/i); if (D4.length > 2) throw new Error("Invalid integer: " + D4.join("e")); if (D4.length === 2) { var V3 = D4[1]; if (V3[0] === "+" && (V3 = V3.slice(1)), V3 = +V3, V3 !== yt2(V3) || !xt(V3)) throw new Error("Invalid integer: " + V3 + " is not a valid exponent."); var Y5 = D4[0], et3 = Y5.indexOf("."); if (et3 >= 0 && (V3 -= Y5.length - et3 - 1, Y5 = Y5.slice(0, et3) + Y5.slice(et3 + 1)), V3 < 0) throw new Error("Cannot include negative exponent part for integers"); Y5 += new Array(V3 + 1).join("0"), g4 = Y5; } var J5 = /^([0-9][0-9]*)$/.test(g4); if (!J5) throw new Error("Invalid integer: " + g4); if (Wt2) return new ft3(BigInt(x5 ? "-" + g4 : g4)); for (var nt3 = [], jt = g4.length, Ht2 = ct3, kt = jt - Ht2; jt > 0; ) nt3.push(+g4.slice(kt, jt)), kt -= Ht2, kt < 0 && (kt = 0), jt -= Ht2; return Ce4(nt3), new t2(nt3, x5); } function pr(g4) { if (Wt2) return new ft3(BigInt(g4)); if (xt(g4)) { if (g4 !== yt2(g4)) throw new Error(g4 + " is not an integer."); return new st3(g4); } return Kn2(g4.toString()); } function Tt(g4) { return typeof g4 == "number" ? pr(g4) : typeof g4 == "string" ? Kn2(g4) : typeof g4 == "bigint" ? new ft3(g4) : g4; } for (var ge4 = 0; ge4 < 1e3; ge4++) tt3[ge4] = Tt(ge4), ge4 > 0 && (tt3[-ge4] = Tt(-ge4)); return tt3.one = tt3[1], tt3.zero = tt3[0], tt3.minusOne = tt3[-1], tt3.max = dn2, tt3.min = Je3, tt3.gcd = On2, tt3.lcm = tn2, tt3.isInstance = function(g4) { return g4 instanceof t2 || g4 instanceof st3 || g4 instanceof ft3; }, tt3.randBetween = Gr, tt3.fromArray = function(g4, T5, x5) { return ke4(g4.map(Tt), Tt(T5 || 10), x5); }, tt3; })(); typeof pu < "u" && pu.hasOwnProperty("exports") && (pu.exports = ve4), typeof define == "function" && define.amd && define(function() { return ve4; }); }), Il = Al((_l) => { (function(Q5, at3) { for (var ct3 in at3) Q5[ct3] = at3[ct3]; })(_l, (function(Q5) { var at3 = {}; function ct3(X6) { if (at3[X6]) return at3[X6].exports; var Et2 = at3[X6] = { i: X6, l: !1, exports: {} }; return Q5[X6].call(Et2.exports, Et2, Et2.exports, ct3), Et2.l = !0, Et2.exports; } return ct3.m = Q5, ct3.c = at3, ct3.d = function(X6, Et2, i2) { ct3.o(X6, Et2) || Object.defineProperty(X6, Et2, { enumerable: !0, get: i2 }); }, ct3.r = function(X6) { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(X6, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(X6, "__esModule", { value: !0 }); }, ct3.t = function(X6, Et2) { if (1 & Et2 && (X6 = ct3(X6)), 8 & Et2 || 4 & Et2 && typeof X6 == "object" && X6 && X6.__esModule) return X6; var i2 = /* @__PURE__ */ Object.create(null); if (ct3.r(i2), Object.defineProperty(i2, "default", { enumerable: !0, value: X6 }), 2 & Et2 && typeof X6 != "string") for (var Wt2 in X6) ct3.d(i2, Wt2, function(tt3) { return X6[tt3]; }.bind(null, Wt2)); return i2; }, ct3.n = function(X6) { var Et2 = X6 && X6.__esModule ? function() { return X6.default; } : function() { return X6; }; return ct3.d(Et2, "a", Et2), Et2; }, ct3.o = function(X6, Et2) { return Object.prototype.hasOwnProperty.call(X6, Et2); }, ct3.p = "", ct3(ct3.s = 1); })([function(Q5, at3, ct3) { "use strict"; var X6 = ct3(2); function Et2(i2, Wt2, tt3, t2) { this.message = i2, this.expected = Wt2, this.found = tt3, this.location = t2, this.name = "SyntaxError", typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, Et2); } (function(i2, Wt2) { function tt3() { this.constructor = i2; } tt3.prototype = Wt2.prototype, i2.prototype = new tt3(); })(Et2, Error), Et2.buildMessage = function(i2, Wt2) { var tt3 = { literal: function(xt) { return '"' + st3(xt.text) + '"'; }, class: function(xt) { var Mt, oe5 = ""; for (Mt = 0; Mt < xt.parts.length; Mt++) oe5 += xt.parts[Mt] instanceof Array ? ft3(xt.parts[Mt][0]) + "-" + ft3(xt.parts[Mt][1]) : ft3(xt.parts[Mt]); return "[" + (xt.inverted ? "^" : "") + oe5 + "]"; }, any: function(xt) { return "any character"; }, end: function(xt) { return "end of input"; }, other: function(xt) { return xt.description; } }; function t2(xt) { return xt.charCodeAt(0).toString(16).toUpperCase(); } function st3(xt) { return xt.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (function(Mt) { return "\\x0" + t2(Mt); })).replace(/[\x10-\x1F\x7F-\x9F]/g, (function(Mt) { return "\\x" + t2(Mt); })); } function ft3(xt) { return xt.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (function(Mt) { return "\\x0" + t2(Mt); })).replace(/[\x10-\x1F\x7F-\x9F]/g, (function(Mt) { return "\\x" + t2(Mt); })); } return "Expected " + (function(xt) { var Mt, oe5, Ce4, Zt = new Array(xt.length); for (Mt = 0; Mt < xt.length; Mt++) Zt[Mt] = (Ce4 = xt[Mt], tt3[Ce4.type](Ce4)); if (Zt.sort(), Zt.length > 0) { for (Mt = 1, oe5 = 1; Mt < Zt.length; Mt++) Zt[Mt - 1] !== Zt[Mt] && (Zt[oe5] = Zt[Mt], oe5++); Zt.length = oe5; } switch (Zt.length) { case 1: return Zt[0]; case 2: return Zt[0] + " or " + Zt[1]; default: return Zt.slice(0, -1).join(", ") + ", or " + Zt[Zt.length - 1]; } })(i2) + " but " + (function(xt) { return xt ? '"' + st3(xt) + '"' : "end of input"; })(Wt2) + " found."; }, Q5.exports = { SyntaxError: Et2, parse: function(i2, Wt2) { Wt2 = Wt2 !== void 0 ? Wt2 : {}; var tt3, t2 = {}, st3 = { start: ic }, ft3 = ic, xt = function(n, r2) { return ze4(n, r2); }, Mt = function(n, r2) { return { ...n, order_by: r2 && r2.toLowerCase() }; }, oe5 = function(n, r2) { return ze4(n, r2, 1); }, Ce4 = E4("IF", !0), Zt = "IDENTIFIED", yt2 = E4("IDENTIFIED", !1), R4 = E4("WITH", !0), P4 = E4("BY", !0), lt3 = E4("RANDOM", !0), ye4 = E4("PASSWORD", !0), Yn2 = E4("AS", !0), Ne4 = function(n, r2) { return ze4(n, r2); }, Re4 = E4("role", !0), xe4 = E4("NONE", !0), fn2 = E4("SSL", !0), pn2 = E4("X509", !0), gn2 = E4("CIPHER", !0), _n2 = E4("ISSUER", !0), $n2 = E4("SUBJECT", !0), Hn2 = function(n, r2) { return r2.prefix = n.toLowerCase(), r2; }, In2 = E4("REQUIRE", !0), Sn2 = E4("MAX_QUERIES_PER_HOUR", !0), je4 = E4("MAX_UPDATES_PER_HOUR", !0), Ye4 = E4("MAX_CONNECTIONS_PER_HOUR", !0), bn2 = E4("MAX_USER_CONNECTIONS", !0), vn2 = E4("EXPIRE", !0), ie5 = E4("DEFAULT", !0), yn2 = E4("NEVER", !0), $e4 = E4("HISTORY", !0), Wn2 = E4("REUSE", !1), Xe4 = E4("CURRENT", !0), Tn2 = E4("OPTIONAL", !0), Qe3 = E4("FAILED_LOGIN_ATTEMPTS", !0), Ze3 = E4("PASSWORD_LOCK_TIME", !0), Vn2 = E4("UNBOUNDED", !0), dn2 = E4("ACCOUNT", !0), Je3 = E4("LOCK", !0), On2 = E4("UNLOCK", !0), tn2 = E4("ATTRIBUTE", !0), Gr = E4("CASCADED", !0), Nn2 = E4("LOCAL", !0), ke4 = E4("CHECK", !0), fr = E4("OPTION", !1), He4 = E4("ALGORITHM", !0), zn2 = E4("UNDEFINED", !0), Kn2 = E4("MERGE", !0), pr = E4("TEMPTABLE", !0), Tt = E4("SQL", !0), ge4 = E4("SECURITY", !0), g4 = E4("DEFINER", !0), T5 = E4("INVOKER", !0), x5 = function(n, r2) { return ze4(n, r2); }, D4 = E4("AUTO_INCREMENT", !0), V3 = E4("UNIQUE", !0), Y5 = E4("KEY", !0), et3 = E4("PRIMARY", !0), J5 = E4("@", !1), nt3 = function() { return ln2("=", { type: "origin", value: "definer" }, { type: "function", name: { name: [{ type: "default", value: "current_user" }] }, args: { type: "expr_list", value: [] } }); }, jt = E4("BEFORE", !0), Ht2 = E4("AFTER", !0), kt = E4("FOR", !0), zt = E4("EACH", !0), le3 = E4("ROW", !0), Kt2 = E4("STATEMENT", !0), ne6 = E4("FOLLOWS", !0), Rn2 = E4("PRECEDES", !0), vu = E4("COLUMN_FORMAT", !0), Yr = E4("FIXED", !0), $r = E4("DYNAMIC", !0), br = E4("STORAGE", !0), Uo = E4("DISK", !0), Mo = E4("MEMORY", !0), Po = E4("GENERATED", !0), Hr = E4("ALWAYS", !0), Wr = E4("STORED", !0), Vr = E4("VIRTUAL", !0), Do = E4("if", !0), vr = E4("exists", !0), qo = E4("first", !0), Bo = E4("after", !0), zr = E4("LESS", !0), Kr = E4("THAN", !0), Fo = E4("DROP", !0), Xr = E4("TRUNCATE", !0), yu = E4("DISCARD", !0), yr = E4("IMPORT", !0), Go = E4("COALESCE", !0), Yo = E4("ANALYZE", !0), Qr = E4("TABLESPACE", !0), Zr = E4("INSTANT", !0), $o = E4("INPLACE", !0), Jr = E4("COPY", !0), xn2 = E4("SHARED", !0), du = E4("EXCLUSIVE", !0), hu = E4("CHANGE", !0), wu = E4("FOREIGN", !0), Ho = E4("CONSTRAINT", !0), mu = E4("NOCHECK", !0), Wo = E4("NOT", !0), hn2 = E4("REPLICATION", !0), jn2 = E4("FOREIGN KEY", !0), Vo = E4("ENFORCED", !0), Lu = E4("MATCH FULL", !0), zo = E4("MATCH PARTIAL", !0), Ko = E4("MATCH SIMPLE", !0), wn2 = E4("RESTRICT", !0), to = E4("CASCADE", !0), $5 = E4("SET NULL", !0), eo = E4("NO ACTION", !0), Se4 = E4("SET DEFAULT", !0), en2 = E4("CHARACTER", !0), mn2 = E4("SET", !0), Xo = E4("CHARSET", !0), no = E4("COLLATE", !0), Cu = E4("AVG_ROW_LENGTH", !0), kn2 = E4("KEY_BLOCK_SIZE", !0), Qo = E4("MAX_ROWS", !0), ro = E4("MIN_ROWS", !0), Zo = E4("STATS_SAMPLE_PAGES", !0), oo = E4("CHECKSUM", !1), fe4 = E4("DELAY_KEY_WRITE", !1), Jo = /^[01]/, ts = pe3(["0", "1"], !1, !1), Eu = E4("CONNECTION", !0), Au = E4("ENGINE_ATTRIBUTE", !0), dr = E4("SECONDARY_ENGINE_ATTRIBUTE", !0), so = E4("DATA", !0), Un2 = E4("INDEX", !0), es = E4("DIRECTORY", !0), Ln2 = E4("COMPRESSION", !0), Ee4 = E4("'", !1), hr = E4("ZLIB", !0), Xn2 = E4("LZ4", !0), Qn2 = E4("ENGINE", !0), wr = function(n, r2, o) { return { keyword: n.toLowerCase(), symbol: r2, value: o.toUpperCase() }; }, ns = E4("ROW_FORMAT", !0), mr = E4("COMPRESSED", !0), rs = E4("REDUNDANT", !0), os = E4("COMPACT", !0), Zn2 = E4("READ", !0), ss = E4("LOW_PRIORITY", !0), Lr = E4("WRITE", !0), Mn2 = function(n, r2) { return ze4(n, r2); }, p3 = E4("BINARY", !0), y4 = E4("MASTER", !0), L5 = E4("LOGS", !0), m3 = E4("TRIGGERS", !0), S3 = E4("STATUS", !0), I3 = E4("PROCESSLIST", !0), N4 = E4("PROCEDURE", !0), q4 = E4("FUNCTION", !0), U4 = E4("BINLOG", !0), H5 = E4("EVENTS", !0), Z5 = E4("COLLATION", !0), ut3 = E4("DATABASES", !0), pt2 = E4("COLUMNS", !0), vt2 = E4("INDEXES", !0), wt2 = E4("EVENT", !0), Rt = E4("GRANTS", !0), mt3 = E4("SERIALIZABLE", !0), gt2 = E4("REPEATABLE", !0), Ct = E4("COMMITTED", !0), Ft2 = E4("UNCOMMITTED", !0), qt2 = function(n) { return { type: "origin", value: "read " + n.toLowerCase() }; }, te5 = E4("ISOLATION", !0), Gt2 = E4("LEVEL", !0), se3 = E4("ONLY", !0), Yt2 = E4("DEFERRABLE", !0), ae4 = E4("commit", !0), Ae4 = E4("rollback", !0), we4 = E4("begin", !0), me4 = E4("WORK", !0), uo = E4("TRANSACTION", !0), Jn2 = E4("start", !0), re3 = E4("transaction", !0), Ue4 = E4("FIELDS", !0), qe4 = E4("TERMINATED", !0), Be4 = E4("OPTIONALLY", !0), us = E4("ENCLOSED", !0), gu = E4("ESCAPED", !0), _u = E4("STARTING", !0), Cr = E4("LINES", !0), as = E4("LOAD", !0), Fl = E4("CONCURRENT", !0), Gl = E4("INFILE", !0), ni = E4("INTO", !0), ri = E4("TABLE", !0), oi = E4("ROWS", !0), si = E4("VIEW", !0), is = E4("GRANT", !0), cs = E4("OPTION", !0), ui = function(n) { return { type: "origin", value: Array.isArray(n) ? n[0] : n }; }, ai = E4("ROUTINE", !0), Yl = E4("EXECUTE", !0), $l = E4("ADMIN", !0), ii = E4("GRANT", !1), Hl = E4("PROXY", !1), ci = E4("(", !1), li = E4(")", !1), _e4 = /^[0-9]/, Ie5 = pe3([["0", "9"]], !1, !1), fi = E4("IN", !0), Wl = E4("SHARE", !0), ls = E4("MODE", !0), Vl = E4("WAIT", !0), zl = E4("NOWAIT", !0), Kl = E4("SKIP", !0), Xl = E4("LOCKED", !0), pi = E4("NATURAL", !0), bi = E4("LANGUAGE", !0), vi = E4("QUERY", !0), yi = E4("EXPANSION", !0), Ql = E4("BOOLEAN", !0), Zl = E4("MATCH", !0), Jl = E4("AGAINST", !1), tf = E4("OUTFILE", !0), ef = E4("DUMPFILE", !0), nf = E4("BTREE", !0), rf = E4("HASH", !0), of = E4("PARSER", !0), sf = E4("VISIBLE", !0), uf = E4("INVISIBLE", !0), af = E4("LATERAL", !0), di = /^[_0-9]/, hi = pe3(["_", ["0", "9"]], !1, !1), cf = E4("ROLLUP", !0), fs2 = E4("?", !1), ps = E4("=", !1), lf = E4("DUPLICATE", !0), Iu = function(n, r2) { return Gn2(n, r2); }, bs = function(n) { return n[0] + " " + n[2]; }, ff = E4(">=", !1), pf = E4(">", !1), bf = E4("<=", !1), vf = E4("<>", !1), yf = E4("<", !1), df = E4("!=", !1), hf = E4("ESCAPE", !0), vs = E4("+", !1), ys = E4("-", !1), Su = E4("*", !1), wf = E4("/", !1), mf = E4("%", !1), wi = E4("||", !1), Lf = E4("div", !0), Cf = E4("mod", !0), Ef = E4("&", !1), Af = E4(">>", !1), gf = E4("<<", !1), _f = E4("^", !1), If = E4("|", !1), Sf = E4("!", !1), Tf = E4("~", !1), mi = E4("?|", !1), Li = E4("?&", !1), Ci = E4("#-", !1), Ei = E4("#>>", !1), Ai = E4("#>", !1), gi = E4("@>", !1), _i = E4("<@", !1), Ii = function(n) { return wl[n.toUpperCase()] === !0; }, Er = E4('"', !1), Si = /^[^"]/, Ti = pe3(['"'], !0, !1), Oi = /^[^']/, Ni = pe3(["'"], !0, !1), Ri = E4("`", !1), xi = /^[^`\\]/, ji = pe3(["`", "\\"], !0, !1), Tu = function(n, r2) { return n + r2.join(""); }, Of = /^[A-Za-z_\u4E00-\u9FA5\xC0-\u017F]/, Nf = pe3([["A", "Z"], ["a", "z"], "_", ["\u4E00", "\u9FA5"], ["\xC0", "\u017F"]], !1, !1), Rf = /^[A-Za-z0-9_$\x80-\uFFFF]/, xf = pe3([["A", "Z"], ["a", "z"], ["0", "9"], "_", "$", ["\x80", "\uFFFF"]], !1, !1), jf = /^[A-Za-z0-9_:\u4E00-\u9FA5\xC0-\u017F]/, kf = pe3([["A", "Z"], ["a", "z"], ["0", "9"], "_", ":", ["\u4E00", "\u9FA5"], ["\xC0", "\u017F"]], !1, !1), Uf = E4(":", !1), Mf = E4("NOW", !0), Pf = E4("OVER", !0), Df = E4("WINDOW", !0), ki = E4("FOLLOWING", !0), qf = E4("PRECEDING", !0), Bf = E4("SEPARATOR", !0), Ui = E4("YEAR_MONTH", !0), Mi = E4("DAY_HOUR", !0), Pi = E4("DAY_MINUTE", !0), Di = E4("DAY_SECOND", !0), qi = E4("DAY_MICROSECOND", !0), Bi = E4("HOUR_MINUTE", !0), Fi = E4("HOUR_SECOND", !0), Gi = E4("HOUR_MICROSECOND", !0), Yi = E4("MINUTE_SECOND", !0), $i = E4("MINUTE_MICROSECOND", !0), Hi = E4("SECOND_MICROSECOND", !0), Ff = E4("TIMEZONE_HOUR", !0), Gf = E4("TIMEZONE_MINUTE", !0), Yf = E4("CENTURY", !0), Wi = E4("DAY", !0), Vi = E4("DATE", !0), $f = E4("DECADE", !0), Hf = E4("DOW", !0), Wf = E4("DOY", !0), Vf = E4("EPOCH", !0), zi = E4("HOUR", !0), zf = E4("ISODOW", !0), Kf = E4("ISOWEEK", !0), Xf = E4("ISOYEAR", !0), Qf = E4("MICROSECONDS", !0), Zf = E4("MILLENNIUM", !0), Jf = E4("MILLISECONDS", !0), Ki = E4("MINUTE", !0), Xi = E4("MONTH", !0), Qi = E4("QUARTER", !0), Zi = E4("SECOND", !0), Ji = E4("TIME", !0), tp = E4("TIMEZONE", !0), tc = E4("WEEK", !0), Ou = E4("YEAR", !0), ep = E4("DATE_TRUNC", !0), np = E4("BOTH", !0), rp = E4("LEADING", !0), op = E4("TRAILING", !0), sp = E4("trim", !0), up = E4("convert", !0), ap = E4("binary", !0), ds = E4("_binary", !0), Nu = E4("_latin1", !0), ip = E4("X", !0), Ar = /^[0-9A-Fa-f]/, gr = pe3([["0", "9"], ["A", "F"], ["a", "f"]], !1, !1), cp = E4("b", !0), lp = E4("0x", !0), fp = E4("N", !0), ec = function(n, r2) { return { type: n.toLowerCase(), value: r2[1].join("") }; }, pp = /^[^"\\\0-\x1F\x7F]/, bp = pe3(['"', "\\", ["\0", ""], "\x7F"], !0, !1), vp = /^[\n]/, yp = pe3([` `], !1, !1), dp = /^[^'\\]/, hp = pe3(["'", "\\"], !0, !1), wp = E4("\\'", !1), mp = E4('\\"', !1), Lp = E4("\\\\", !1), Cp = E4("\\/", !1), Ep = E4("\\b", !1), Ap = E4("\\f", !1), gp = E4("\\n", !1), _p = E4("\\r", !1), Ip = E4("\\t", !1), Sp = E4("\\u", !1), Tp = E4("\\", !1), Op = E4("''", !1), Np = E4('""', !1), Rp = E4("``", !1), nc = /^[\n\r]/, rc = pe3([` `, "\r"], !1, !1), hs = E4(".", !1), xp = /^[0-9a-fA-F]/, jp = pe3([["0", "9"], ["a", "f"], ["A", "F"]], !1, !1), kp = /^[eE]/, Up = pe3(["e", "E"], !1, !1), Mp = /^[+\-]/, Pp = pe3(["+", "-"], !1, !1), Dp = E4("NULL", !0), qp = E4("NOT NULL", !0), Bp = E4("TRUE", !0), Fp = E4("TO", !0), Gp = E4("FALSE", !0), Yp = E4("SHOW", !0), $p = E4("USE", !0), Hp = E4("ALTER", !0), Wp = E4("SELECT", !0), Vp = E4("UPDATE", !0), zp = E4("CREATE", !0), Kp = E4("TEMPORARY", !0), Xp = E4("DELETE", !0), Qp = E4("INSERT", !0), Zp = E4("RECURSIVE", !0), Jp = E4("REPLACE", !0), t0 = E4("RENAME", !0), e0 = E4("IGNORE", !0), n0 = E4("EXPLAIN", !0), r0 = E4("PARTITION", !0), o0 = E4("FROM", !0), s0 = E4("TRIGGER", !0), u0 = E4("TABLES", !0), a0 = E4("DATABASE", !0), i0 = E4("SCHEMA", !0), c0 = E4("ON", !0), l0 = E4("LEFT", !0), f0 = E4("RIGHT", !0), p0 = E4("FULL", !0), b0 = E4("INNER", !0), v0 = E4("CROSS", !0), y0 = E4("STRAIGHT_JOIN", !0), d0 = E4("JOIN", !0), h0 = E4("OUTER", !0), w0 = E4("UNION", !0), m0 = E4("MINUS", !0), L0 = E4("INTERSECT", !0), C0 = E4("EXCEPT", !0), E0 = E4("VALUES", !0), A0 = E4("USING", !0), g0 = E4("WHERE", !0), _0 = E4("GO", !0), I0 = E4("GROUP", !0), S0 = E4("ORDER", !0), T0 = E4("HAVING", !0), O0 = E4("LIMIT", !0), N0 = E4("OFFSET", !0), R0 = E4("ASC", !0), x0 = E4("DESC", !0), j0 = E4("DESCRIBE", !0), k0 = E4("ALL", !0), U0 = E4("DISTINCT", !0), M0 = E4("BETWEEN", !0), P0 = E4("IS", !0), D0 = E4("LIKE", !0), q0 = E4("RLIKE", !0), B0 = E4("REGEXP", !0), F0 = E4("EXISTS", !0), G0 = E4("AND", !0), Y0 = E4("OR", !0), $0 = E4("COUNT", !0), H0 = E4("GROUP_CONCAT", !0), W0 = E4("MAX", !0), V0 = E4("MIN", !0), z0 = E4("SUM", !0), K0 = E4("AVG", !0), X0 = E4("EXTRACT", !0), Q0 = E4("CALL", !0), Z0 = E4("CASE", !0), J0 = E4("WHEN", !0), tb = E4("THEN", !0), eb = E4("ELSE", !0), nb = E4("END", !0), rb = E4("CAST", !0), ob = E4("VARBINARY", !0), sb = E4("BIT", !0), ub = E4("CHAR", !0), ab = E4("VARCHAR", !0), ib = E4("NUMERIC", !0), cb = E4("DECIMAL", !0), lb = E4("SIGNED", !0), fb = E4("UNSIGNED", !0), pb = E4("INT", !0), bb = E4("ZEROFILL", !0), vb = E4("INTEGER", !0), yb = E4("JSON", !0), db = E4("SMALLINT", !0), hb = E4("MEDIUMINT", !0), wb = E4("TINYINT", !0), mb = E4("TINYTEXT", !0), Lb = E4("TEXT", !0), Cb = E4("MEDIUMTEXT", !0), Eb = E4("LONGTEXT", !0), Ab = E4("BIGINT", !0), gb = E4("ENUM", !0), _b = E4("FLOAT", !0), Ib = E4("DOUBLE", !0), Sb = E4("DATETIME", !0), Tb = E4("TIMESTAMP", !0), Ob = E4("USER", !0), Nb = E4("VECTOR", !0), Rb = E4("CURRENT_DATE", !0), xb = (E4("ADDDATE", !0), E4("INTERVAL", !0)), jb = E4("MICROSECOND", !0), kb = E4("CURRENT_TIME", !0), Ub = E4("CURRENT_TIMESTAMP", !0), Mb = E4("CURRENT_USER", !0), Pb = E4("SESSION_USER", !0), Db = E4("SYSTEM_USER", !0), qb = E4("GLOBAL", !0), Bb = E4("SESSION", !0), Fb = E4("PERSIST", !0), Gb = E4("PERSIST_ONLY", !0), Yb = E4("GEOMETRY", !0), $b = E4("POINT", !0), Hb = E4("LINESTRING", !0), Wb = E4("POLYGON", !0), Vb = E4("MULTIPOINT", !0), zb = E4("MULTILINESTRING", !0), Kb = E4("MULTIPOLYGON", !0), Xb = E4("GEOMETRYCOLLECTION", !0), Qb = E4("@@", !1), Zb = E4("$", !1), Jb = E4("return", !0), tv = E4(":=", !1), ev = E4("DUAL", !0), nv = E4("ADD", !0), rv = E4("COLUMN", !0), ov = E4("MODIFY", !0), sv = E4("FULLTEXT", !0), uv = E4("SPATIAL", !0), av = E4("COMMENT", !0), iv = E4("REFERENCES", !0), cv = E4("SQL_CALC_FOUND_ROWS", !0), lv = E4("SQL_CACHE", !0), fv = E4("SQL_NO_CACHE", !0), pv = E4("SQL_SMALL_RESULT", !0), bv = E4("SQL_BIG_RESULT", !0), vv = E4("SQL_BUFFER_RESULT", !0), yv = E4(",", !1), dv = E4("[", !1), hv = E4("]", !1), wv = E4(";", !1), mv = E4("->", !1), Lv = E4("->>", !1), Cv = E4("&&", !1), Ev = E4("XOR", !0), Av = E4("/*", !1), Ru = E4("*/", !1), gv = E4("--", !1), _v = E4("#", !1), oc = { type: "any" }, Iv = /^[ \t\n\r]/, Sv = pe3([" ", " ", ` `, "\r"], !1, !1), sc = function(n, r2, o) { return { type: "assign", left: n, symbol: r2, right: o }; }, Tv = E4("boolean", !0), Ov = E4("blob", !0), Nv = E4("tinyblob", !0), Rv = E4("mediumblob", !0), xv = E4("longblob", !0), uc = function(n, r2) { return { dataType: n, ...r2 || {} }; }, jv = E4("ARRAY", !0), kv = /^[0-6]/, Uv = pe3([["0", "6"]], !1, !1), e = 0, w4 = 0, ws = [{ line: 1, column: 1 }], nn2 = 0, xu = [], l = 0; if ("startRule" in Wt2) { if (!(Wt2.startRule in st3)) throw new Error(`Can't start parsing from rule "` + Wt2.startRule + '".'); ft3 = st3[Wt2.startRule]; } function E4(n, r2) { return { type: "literal", text: n, ignoreCase: r2 }; } function pe3(n, r2, o) { return { type: "class", parts: n, inverted: r2, ignoreCase: o }; } function ac(n) { var r2, o = ws[n]; if (o) return o; for (r2 = n - 1; !ws[r2]; ) r2--; for (o = { line: (o = ws[r2]).line, column: o.column }; r2 < n; ) i2.charCodeAt(r2) === 10 ? (o.line++, o.column = 1) : o.column++, r2++; return ws[n] = o, o; } function ju(n, r2) { var o = ac(n), s = ac(r2); return { start: { offset: n, line: o.line, column: o.column }, end: { offset: r2, line: s.line, column: s.column } }; } function v4(n) { e < nn2 || (e > nn2 && (nn2 = e, xu = []), xu.push(n)); } function Mv(n, r2, o) { return new Et2(Et2.buildMessage(n, r2), n, r2, o); } function ic() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = ku()) !== t2) if (f4() !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = zc()) !== t2 && (c3 = f4()) !== t2 && (b4 = ku()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = zc()) !== t2 && (c3 = f4()) !== t2 && (b4 = ku()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { if (!h3 || h3.length === 0) return d3; delete d3.tableList, delete d3.columnList; let C5 = d3; for (let A4 = 0; A4 < h3.length; A4++) delete h3[A4][3].tableList, delete h3[A4][3].columnList, C5.go_next = h3[A4][3], C5.go = "go", C5 = C5.go_next; return { tableList: Array.from(_t), columnList: Dt(At2), ast: d3 }; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; return n; } function ku() { var n, r2; return n = e, f4() !== t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3; if (o = e, (s = Uu()) !== t2) { for (u4 = [], a2 = e, (c3 = f4()) !== t2 && (b4 = cl()) !== t2 && (d3 = f4()) !== t2 && (h3 = Uu()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); a2 !== t2; ) u4.push(a2), a2 = e, (c3 = f4()) !== t2 && (b4 = cl()) !== t2 && (d3 = f4()) !== t2 && (h3 = Uu()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); u4 !== t2 ? (w4 = o, s = (function(C5, A4) { let _5 = C5 && C5.ast || C5, O4 = A4 && A4.length && A4[0].length >= 4 ? [_5] : _5; for (let M4 = 0; M4 < A4.length; M4++) A4[M4][3] && A4[M4][3].length !== 0 && O4.push(A4[M4][3] && A4[M4][3].ast || A4[M4][3]); return { tableList: Array.from(_t), columnList: Dt(At2), ast: O4 }; })(s, u4), o = s) : (e = o, o = t2); } else e = o, o = t2; return o; })()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function Pv() { var n; return (n = (function() { var r2, o, s, u4, a2, c3, b4; r2 = e, (o = Fe4()) !== t2 && f4() !== t2 && (s = Fn2()) !== t2 && f4() !== t2 ? ((u4 = ms()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = rn2()) !== t2 ? (w4 = r2, d3 = o, h3 = s, C5 = u4, (A4 = a2) && A4.forEach((_5) => _t.add(`${d3}::${_5.db}::${_5.table}`)), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: d3.toLowerCase(), keyword: h3.toLowerCase(), prefix: C5, name: A4 } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var d3, h3, C5, A4; return r2 === t2 && (r2 = e, (o = Fe4()) !== t2 && f4() !== t2 && (s = eu()) !== t2 && f4() !== t2 ? ((u4 = ms()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = rn2()) !== t2 && f4() !== t2 ? ((c3 = vc()) === t2 && (c3 = null), c3 !== t2 ? (w4 = r2, o = (function(_5, O4, M4, k4, B5) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: _5.toLowerCase(), keyword: O4.toLowerCase(), prefix: M4, name: k4, options: B5 && [{ type: "origin", value: B5 }] } }; })(o, s, u4, a2, c3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = Fe4()) !== t2 && f4() !== t2 && (s = ur()) !== t2 && f4() !== t2 && (u4 = he4()) !== t2 && f4() !== t2 && (a2 = un2()) !== t2 && f4() !== t2 && (c3 = de4()) !== t2 && f4() !== t2 ? ((b4 = (function() { var _5, O4, M4, k4, B5, j5; if (_5 = e, (O4 = co()) === t2 && (O4 = lo()), O4 !== t2) { for (M4 = [], k4 = e, (B5 = f4()) !== t2 ? ((j5 = co()) === t2 && (j5 = lo()), j5 !== t2 ? k4 = B5 = [B5, j5] : (e = k4, k4 = t2)) : (e = k4, k4 = t2); k4 !== t2; ) M4.push(k4), k4 = e, (B5 = f4()) !== t2 ? ((j5 = co()) === t2 && (j5 = lo()), j5 !== t2 ? k4 = B5 = [B5, j5] : (e = k4, k4 = t2)) : (e = k4, k4 = t2); M4 !== t2 ? (w4 = _5, O4 = oe5(O4, M4), _5 = O4) : (e = _5, _5 = t2); } else e = _5, _5 = t2; return _5; })()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? (w4 = r2, o = (function(_5, O4, M4, k4, B5) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: _5.toLowerCase(), keyword: O4.toLowerCase(), name: M4, table: k4, options: B5 } }; })(o, s, u4, c3, b4), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = Fe4()) !== t2 && f4() !== t2 ? ((s = Wc()) === t2 && (s = Vc()), s !== t2 && f4() !== t2 ? ((u4 = ms()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = ue4()) !== t2 ? (w4 = r2, o = (function(_5, O4, M4, k4) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: _5.toLowerCase(), keyword: O4.toLowerCase(), prefix: M4, name: k4 } }; })(o, s, u4, a2), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = Fe4()) !== t2 && f4() !== t2 && (s = Vs()) !== t2 && f4() !== t2 ? ((u4 = ms()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = er()) !== t2 ? (w4 = r2, o = (function(_5, O4, M4, k4) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: _5.toLowerCase(), keyword: O4.toLowerCase(), prefix: M4, name: [{ schema: k4.db, trigger: k4.table }] } }; })(o, s, u4, a2), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2))))), r2; })()) === t2 && (n = (function() { var r2; return (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3, C5, A4; o = e, (s = We4()) !== t2 && f4() !== t2 ? ((u4 = Hc()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && Fn2() !== t2 && f4() !== t2 ? ((a2 = ao()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = de4()) !== t2 && f4() !== t2 && (b4 = (function j5() { var W4, K4; (W4 = (function() { var ot4, it4; return ot4 = e, xa() !== t2 && f4() !== t2 && (it4 = rn2()) !== t2 ? (w4 = ot4, ot4 = { type: "like", table: it4 }) : (e = ot4, ot4 = t2), ot4; })()) === t2 && (W4 = e, Ot() !== t2 && f4() !== t2 && (K4 = j5()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = W4, (z5 = K4).parentheses = !0, W4 = z5) : (e = W4, W4 = t2)); var z5; return W4; })()) !== t2 ? (w4 = o, _5 = s, O4 = u4, M4 = a2, B5 = b4, (k4 = c3) && _t.add(`create::${k4.db}::${k4.table}`), s = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: _5[0].toLowerCase(), keyword: "table", temporary: O4 && O4[0].toLowerCase(), if_not_exists: M4, table: [k4], like: B5 } }, o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2); var _5, O4, M4, k4, B5; return o === t2 && (o = e, (s = We4()) !== t2 && f4() !== t2 ? ((u4 = Hc()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && Fn2() !== t2 && f4() !== t2 ? ((a2 = ao()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = de4()) !== t2 && f4() !== t2 ? ((b4 = (function() { var j5, W4, K4, z5, ot4, it4, G5, rt3, bt2; if (j5 = e, (W4 = Ot()) !== t2) if (f4() !== t2) if ((K4 = Gu()) !== t2) { for (z5 = [], ot4 = e, (it4 = f4()) !== t2 && (G5 = ht2()) !== t2 && (rt3 = f4()) !== t2 && (bt2 = Gu()) !== t2 ? ot4 = it4 = [it4, G5, rt3, bt2] : (e = ot4, ot4 = t2); ot4 !== t2; ) z5.push(ot4), ot4 = e, (it4 = f4()) !== t2 && (G5 = ht2()) !== t2 && (rt3 = f4()) !== t2 && (bt2 = Gu()) !== t2 ? ot4 = it4 = [it4, G5, rt3, bt2] : (e = ot4, ot4 = t2); z5 !== t2 && (ot4 = f4()) !== t2 && (it4 = Nt()) !== t2 ? (w4 = j5, W4 = x5(K4, z5), j5 = W4) : (e = j5, j5 = t2); } else e = j5, j5 = t2; else e = j5, j5 = t2; else e = j5, j5 = t2; return j5; })()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = (function() { var j5, W4, K4, z5, ot4, it4, G5, rt3; if (j5 = e, (W4 = Es()) !== t2) { for (K4 = [], z5 = e, (ot4 = f4()) !== t2 ? ((it4 = ht2()) === t2 && (it4 = null), it4 !== t2 && (G5 = f4()) !== t2 && (rt3 = Es()) !== t2 ? z5 = ot4 = [ot4, it4, G5, rt3] : (e = z5, z5 = t2)) : (e = z5, z5 = t2); z5 !== t2; ) K4.push(z5), z5 = e, (ot4 = f4()) !== t2 ? ((it4 = ht2()) === t2 && (it4 = null), it4 !== t2 && (G5 = f4()) !== t2 && (rt3 = Es()) !== t2 ? z5 = ot4 = [ot4, it4, G5, rt3] : (e = z5, z5 = t2)) : (e = z5, z5 = t2); K4 !== t2 ? (w4 = j5, W4 = xt(W4, K4), j5 = W4) : (e = j5, j5 = t2); } else e = j5, j5 = t2; return j5; })()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 ? ((h3 = Ao()) === t2 && (h3 = Aa()), h3 === t2 && (h3 = null), h3 !== t2 && f4() !== t2 ? ((C5 = Me4()) === t2 && (C5 = null), C5 !== t2 && f4() !== t2 ? ((A4 = Pn2()) === t2 && (A4 = null), A4 !== t2 ? (w4 = o, s = (function(j5, W4, K4, z5, ot4, it4, G5, rt3, bt2) { return z5 && _t.add(`create::${z5.db}::${z5.table}`), { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: j5[0].toLowerCase(), keyword: "table", temporary: W4 && W4[0].toLowerCase(), if_not_exists: K4, table: [z5], ignore_replace: G5 && G5[0].toLowerCase(), as: rt3 && rt3[0].toLowerCase(), query_expr: bt2 && bt2.ast, create_definitions: ot4, table_options: it4 } }; })(s, u4, a2, c3, b4, d3, h3, C5, A4), o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)), o; })()) === t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5; o = e, (s = We4()) !== t2 && f4() !== t2 ? ((u4 = cc()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && Vs() !== t2 && f4() !== t2 ? ((a2 = ao()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = de4()) !== t2 && f4() !== t2 && (b4 = (function() { var G5; return i2.substr(e, 6).toLowerCase() === "before" ? (G5 = i2.substr(e, 6), e += 6) : (G5 = t2, l === 0 && v4(jt)), G5 === t2 && (i2.substr(e, 5).toLowerCase() === "after" ? (G5 = i2.substr(e, 5), e += 5) : (G5 = t2, l === 0 && v4(Ht2))), G5; })()) !== t2 && f4() !== t2 && (d3 = (function() { var G5, rt3; return G5 = e, (rt3 = Ea()) === t2 && (rt3 = Bn2()) === t2 && (rt3 = Hs()), rt3 !== t2 && (w4 = G5, rt3 = { keyword: rt3[0].toLowerCase() }), G5 = rt3; })()) !== t2 && f4() !== t2 && un2() !== t2 && f4() !== t2 && (h3 = de4()) !== t2 && f4() !== t2 && (C5 = (function() { var G5, rt3, bt2, dt2; G5 = e, i2.substr(e, 3).toLowerCase() === "for" ? (rt3 = i2.substr(e, 3), e += 3) : (rt3 = t2, l === 0 && v4(kt)), rt3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "each" ? (bt2 = i2.substr(e, 4), e += 4) : (bt2 = t2, l === 0 && v4(zt)), bt2 === t2 && (bt2 = null), bt2 !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "row" ? (dt2 = i2.substr(e, 3), e += 3) : (dt2 = t2, l === 0 && v4(le3)), dt2 === t2 && (i2.substr(e, 9).toLowerCase() === "statement" ? (dt2 = i2.substr(e, 9), e += 9) : (dt2 = t2, l === 0 && v4(Kt2))), dt2 !== t2 ? (w4 = G5, It = rt3, Lt = dt2, rt3 = { keyword: (Ut = bt2) ? `${It.toLowerCase()} ${Ut.toLowerCase()}` : It.toLowerCase(), args: Lt.toLowerCase() }, G5 = rt3) : (e = G5, G5 = t2)) : (e = G5, G5 = t2)) : (e = G5, G5 = t2); var It, Ut, Lt; return G5; })()) !== t2 && f4() !== t2 ? ((A4 = (function() { var G5, rt3, bt2; return G5 = e, i2.substr(e, 7).toLowerCase() === "follows" ? (rt3 = i2.substr(e, 7), e += 7) : (rt3 = t2, l === 0 && v4(ne6)), rt3 === t2 && (i2.substr(e, 8).toLowerCase() === "precedes" ? (rt3 = i2.substr(e, 8), e += 8) : (rt3 = t2, l === 0 && v4(Rn2))), rt3 !== t2 && f4() !== t2 && (bt2 = Jt2()) !== t2 ? (w4 = G5, G5 = rt3 = { keyword: rt3, trigger: bt2 }) : (e = G5, G5 = t2), G5; })()) === t2 && (A4 = null), A4 !== t2 && f4() !== t2 && (_5 = (function() { var G5, rt3; return G5 = e, jr() !== t2 && f4() !== t2 && (rt3 = Lo()) !== t2 ? (w4 = G5, G5 = { type: "set", expr: rt3 }) : (e = G5, G5 = t2), G5; })()) !== t2 ? (w4 = o, O4 = s, M4 = u4, k4 = a2, B5 = c3, j5 = b4, W4 = d3, K4 = h3, z5 = C5, ot4 = A4, it4 = _5, s = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: O4[0].toLowerCase(), definer: M4, keyword: "trigger", for_each: z5, if_not_exists: k4, trigger: B5, time: j5, events: [W4], order: ot4, table: K4, execute: it4 } }, o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2); var O4, M4, k4, B5, j5, W4, K4, z5, ot4, it4; return o; })()) === t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4; o = e, (s = We4()) !== t2 && f4() !== t2 ? ((u4 = ul()) === t2 && (u4 = ol()) === t2 && (u4 = sl()), u4 === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = ur()) !== t2 && f4() !== t2 && (c3 = Jt2()) !== t2 && f4() !== t2 ? ((b4 = ho()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 && (d3 = un2()) !== t2 && f4() !== t2 && (h3 = de4()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (C5 = (function() { var bt2, dt2, It, Ut, Lt, Pt2, Bt2, St2; if (bt2 = e, (dt2 = Pu()) !== t2) { for (It = [], Ut = e, (Lt = f4()) !== t2 && (Pt2 = ht2()) !== t2 && (Bt2 = f4()) !== t2 && (St2 = Pu()) !== t2 ? Ut = Lt = [Lt, Pt2, Bt2, St2] : (e = Ut, Ut = t2); Ut !== t2; ) It.push(Ut), Ut = e, (Lt = f4()) !== t2 && (Pt2 = ht2()) !== t2 && (Bt2 = f4()) !== t2 && (St2 = Pu()) !== t2 ? Ut = Lt = [Lt, Pt2, Bt2, St2] : (e = Ut, Ut = t2); It !== t2 ? (w4 = bt2, dt2 = xt(dt2, It), bt2 = dt2) : (e = bt2, bt2 = t2); } else e = bt2, bt2 = t2; return bt2; })()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((A4 = wo()) === t2 && (A4 = null), A4 !== t2 && f4() !== t2 ? ((_5 = co()) === t2 && (_5 = null), _5 !== t2 && f4() !== t2 ? ((O4 = lo()) === t2 && (O4 = null), O4 !== t2 && f4() !== t2 ? (w4 = o, M4 = s, k4 = u4, B5 = a2, j5 = c3, W4 = b4, K4 = d3, z5 = h3, ot4 = C5, it4 = A4, G5 = _5, rt3 = O4, s = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: M4[0].toLowerCase(), index_type: k4 && k4.toLowerCase(), keyword: B5.toLowerCase(), index: j5, on_kw: K4[0].toLowerCase(), table: z5, index_columns: ot4, index_using: W4, index_options: it4, algorithm_option: G5, lock_option: rt3 } }, o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2); var M4, k4, B5, j5, W4, K4, z5, ot4, it4, G5, rt3; return o; })()) === t2 && (r2 = (function() { var o, s, u4, a2, c3, b4; return o = e, (s = We4()) !== t2 && f4() !== t2 ? ((u4 = Wc()) === t2 && (u4 = Vc()), u4 !== t2 && f4() !== t2 ? ((a2 = ao()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = iu()) !== t2 && f4() !== t2 ? ((b4 = (function() { var d3, h3, C5, A4, _5, O4; if (d3 = e, (h3 = Cs()) !== t2) { for (C5 = [], A4 = e, (_5 = f4()) !== t2 && (O4 = Cs()) !== t2 ? A4 = _5 = [_5, O4] : (e = A4, A4 = t2); A4 !== t2; ) C5.push(A4), A4 = e, (_5 = f4()) !== t2 && (O4 = Cs()) !== t2 ? A4 = _5 = [_5, O4] : (e = A4, A4 = t2); C5 !== t2 ? (w4 = d3, h3 = oe5(h3, C5), d3 = h3) : (e = d3, d3 = t2); } else e = d3, d3 = t2; return d3; })()) === t2 && (b4 = null), b4 !== t2 ? (w4 = o, s = (function(d3, h3, C5, A4, _5) { let O4 = h3.toLowerCase(); return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: d3[0].toLowerCase(), keyword: O4, if_not_exists: C5, [O4]: { db: A4.schema, schema: A4.name }, create_definitions: _5 } }; })(s, u4, a2, c3, b4), o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2), o; })()) === t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4, M4, k4, B5, j5, W4, K4, z5, ot4, it4; o = e, (s = We4()) !== t2 && f4() !== t2 ? (u4 = e, (a2 = Cn2()) !== t2 && (c3 = f4()) !== t2 && (b4 = Aa()) !== t2 ? u4 = a2 = [a2, c3, b4] : (e = u4, u4 = t2), u4 === t2 && (u4 = null), u4 !== t2 && (a2 = f4()) !== t2 ? (c3 = e, i2.substr(e, 9).toLowerCase() === "algorithm" ? (b4 = i2.substr(e, 9), e += 9) : (b4 = t2, l === 0 && v4(He4)), b4 !== t2 && (d3 = f4()) !== t2 && (h3 = be4()) !== t2 && (C5 = f4()) !== t2 ? (i2.substr(e, 9).toLowerCase() === "undefined" ? (A4 = i2.substr(e, 9), e += 9) : (A4 = t2, l === 0 && v4(zn2)), A4 === t2 && (i2.substr(e, 5).toLowerCase() === "merge" ? (A4 = i2.substr(e, 5), e += 5) : (A4 = t2, l === 0 && v4(Kn2)), A4 === t2 && (i2.substr(e, 9).toLowerCase() === "temptable" ? (A4 = i2.substr(e, 9), e += 9) : (A4 = t2, l === 0 && v4(pr)))), A4 !== t2 ? c3 = b4 = [b4, d3, h3, C5, A4] : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3 === t2 && (c3 = null), c3 !== t2 && (b4 = f4()) !== t2 ? ((d3 = cc()) === t2 && (d3 = null), d3 !== t2 && (h3 = f4()) !== t2 ? (C5 = e, i2.substr(e, 3).toLowerCase() === "sql" ? (A4 = i2.substr(e, 3), e += 3) : (A4 = t2, l === 0 && v4(Tt)), A4 !== t2 && (_5 = f4()) !== t2 ? (i2.substr(e, 8).toLowerCase() === "security" ? (O4 = i2.substr(e, 8), e += 8) : (O4 = t2, l === 0 && v4(ge4)), O4 !== t2 && (M4 = f4()) !== t2 ? (i2.substr(e, 7).toLowerCase() === "definer" ? (k4 = i2.substr(e, 7), e += 7) : (k4 = t2, l === 0 && v4(g4)), k4 === t2 && (i2.substr(e, 7).toLowerCase() === "invoker" ? (k4 = i2.substr(e, 7), e += 7) : (k4 = t2, l === 0 && v4(T5))), k4 !== t2 ? C5 = A4 = [A4, _5, O4, M4, k4] : (e = C5, C5 = t2)) : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5 === t2 && (C5 = null), C5 !== t2 && (A4 = f4()) !== t2 && (_5 = eu()) !== t2 && (O4 = f4()) !== t2 && (M4 = de4()) !== t2 && (k4 = f4()) !== t2 ? (B5 = e, (j5 = Ot()) !== t2 && (W4 = f4()) !== t2 && (K4 = Sc()) !== t2 && (z5 = f4()) !== t2 && (ot4 = Nt()) !== t2 ? B5 = j5 = [j5, W4, K4, z5, ot4] : (e = B5, B5 = t2), B5 === t2 && (B5 = null), B5 !== t2 && (j5 = f4()) !== t2 && (W4 = Me4()) !== t2 && (K4 = f4()) !== t2 && (z5 = Ju()) !== t2 && (ot4 = f4()) !== t2 ? ((it4 = (function() { var St2, Vt2, $t2, Qt, ce4; return St2 = e, (Vt2 = an2()) !== t2 && f4() !== t2 ? (i2.substr(e, 8).toLowerCase() === "cascaded" ? ($t2 = i2.substr(e, 8), e += 8) : ($t2 = t2, l === 0 && v4(Gr)), $t2 === t2 && (i2.substr(e, 5).toLowerCase() === "local" ? ($t2 = i2.substr(e, 5), e += 5) : ($t2 = t2, l === 0 && v4(Nn2))), $t2 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (Qt = i2.substr(e, 5), e += 5) : (Qt = t2, l === 0 && v4(ke4)), Qt !== t2 && f4() !== t2 ? (i2.substr(e, 6) === "OPTION" ? (ce4 = "OPTION", e += 6) : (ce4 = t2, l === 0 && v4(fr)), ce4 !== t2 ? (w4 = St2, Vt2 = `with ${$t2.toLowerCase()} check option`, St2 = Vt2) : (e = St2, St2 = t2)) : (e = St2, St2 = t2)) : (e = St2, St2 = t2)) : (e = St2, St2 = t2), St2 === t2 && (St2 = e, (Vt2 = an2()) !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? ($t2 = i2.substr(e, 5), e += 5) : ($t2 = t2, l === 0 && v4(ke4)), $t2 !== t2 && f4() !== t2 ? (i2.substr(e, 6) === "OPTION" ? (Qt = "OPTION", e += 6) : (Qt = t2, l === 0 && v4(fr)), Qt !== t2 ? (w4 = St2, St2 = Vt2 = "with check option") : (e = St2, St2 = t2)) : (e = St2, St2 = t2)) : (e = St2, St2 = t2)), St2; })()) === t2 && (it4 = null), it4 !== t2 ? (w4 = o, G5 = s, rt3 = u4, bt2 = c3, dt2 = d3, It = C5, Lt = B5, Pt2 = z5, Bt2 = it4, (Ut = M4).view = Ut.table, delete Ut.table, s = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: G5[0].toLowerCase(), keyword: "view", replace: rt3 && "or replace", algorithm: bt2 && bt2[4], definer: dt2, sql_security: It && It[4], columns: Lt && Lt[2], select: Pt2, view: Ut, with: Bt2 } }, o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2); var G5, rt3, bt2, dt2, It, Ut, Lt, Pt2, Bt2; return o; })()) === t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5; o = e, (s = We4()) !== t2 && f4() !== t2 && Jc() !== t2 && f4() !== t2 ? ((u4 = ao()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = (function() { var G5, rt3, bt2, dt2, It, Ut, Lt, Pt2; if (G5 = e, (rt3 = Du()) !== t2) { for (bt2 = [], dt2 = e, (It = f4()) !== t2 && (Ut = ht2()) !== t2 && (Lt = f4()) !== t2 && (Pt2 = Du()) !== t2 ? dt2 = It = [It, Ut, Lt, Pt2] : (e = dt2, dt2 = t2); dt2 !== t2; ) bt2.push(dt2), dt2 = e, (It = f4()) !== t2 && (Ut = ht2()) !== t2 && (Lt = f4()) !== t2 && (Pt2 = Du()) !== t2 ? dt2 = It = [It, Ut, Lt, Pt2] : (e = dt2, dt2 = t2); bt2 !== t2 ? (w4 = G5, rt3 = Ne4(rt3, bt2), G5 = rt3) : (e = G5, G5 = t2); } else e = G5, G5 = t2; return G5; })()) !== t2 && f4() !== t2 ? ((c3 = (function() { var G5, rt3, bt2; return G5 = e, La() !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "role" ? (rt3 = i2.substr(e, 4), e += 4) : (rt3 = t2, l === 0 && v4(Re4)), rt3 !== t2 && f4() !== t2 && (bt2 = As()) !== t2 ? (w4 = G5, G5 = { keyword: "default role", value: bt2 }) : (e = G5, G5 = t2)) : (e = G5, G5 = t2), G5; })()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? ((b4 = (function() { var G5, rt3, bt2; return G5 = e, i2.substr(e, 7).toLowerCase() === "require" ? (rt3 = i2.substr(e, 7), e += 7) : (rt3 = t2, l === 0 && v4(In2)), rt3 !== t2 && f4() !== t2 && (bt2 = (function() { var dt2, It, Ut, Lt, Pt2, Bt2, St2, Vt2; if (dt2 = e, (It = qu()) !== t2) { for (Ut = [], Lt = e, (Pt2 = f4()) !== t2 && (Bt2 = Ge4()) !== t2 && (St2 = f4()) !== t2 && (Vt2 = qu()) !== t2 ? Lt = Pt2 = [Pt2, Bt2, St2, Vt2] : (e = Lt, Lt = t2); Lt !== t2; ) Ut.push(Lt), Lt = e, (Pt2 = f4()) !== t2 && (Bt2 = Ge4()) !== t2 && (St2 = f4()) !== t2 && (Vt2 = qu()) !== t2 ? Lt = Pt2 = [Pt2, Bt2, St2, Vt2] : (e = Lt, Lt = t2); Ut !== t2 ? (w4 = dt2, It = Gn2(It, Ut), dt2 = It) : (e = dt2, dt2 = t2); } else e = dt2, dt2 = t2; return dt2; })()) !== t2 ? (w4 = G5, G5 = rt3 = { keyword: "require", value: bt2 }) : (e = G5, G5 = t2), G5; })()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = (function() { var G5, rt3, bt2, dt2, It, Ut, Lt; if (G5 = e, (rt3 = an2()) !== t2) if (f4() !== t2) if ((bt2 = Bu()) !== t2) { for (dt2 = [], It = e, (Ut = f4()) !== t2 && (Lt = Bu()) !== t2 ? It = Ut = [Ut, Lt] : (e = It, It = t2); It !== t2; ) dt2.push(It), It = e, (Ut = f4()) !== t2 && (Lt = Bu()) !== t2 ? It = Ut = [Ut, Lt] : (e = It, It = t2); dt2 !== t2 ? (w4 = G5, rt3 = (function(Pt2, Bt2) { let St2 = [Pt2]; if (Bt2) for (let Vt2 of Bt2) St2.push(Vt2[1]); return { keyword: "with", value: St2 }; })(bt2, dt2), G5 = rt3) : (e = G5, G5 = t2); } else e = G5, G5 = t2; else e = G5, G5 = t2; else e = G5, G5 = t2; return G5; })()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 ? ((h3 = (function() { var G5, rt3, bt2, dt2, It, Ut; if (G5 = e, (rt3 = Fu()) !== t2) { for (bt2 = [], dt2 = e, (It = f4()) !== t2 && (Ut = Fu()) !== t2 ? dt2 = It = [It, Ut] : (e = dt2, dt2 = t2); dt2 !== t2; ) bt2.push(dt2), dt2 = e, (It = f4()) !== t2 && (Ut = Fu()) !== t2 ? dt2 = It = [It, Ut] : (e = dt2, dt2 = t2); bt2 !== t2 ? (w4 = G5, rt3 = ze4(rt3, bt2, 1), G5 = rt3) : (e = G5, G5 = t2); } else e = G5, G5 = t2; return G5; })()) === t2 && (h3 = null), h3 !== t2 && f4() !== t2 ? ((C5 = (function() { var G5, rt3, bt2; return G5 = e, i2.substr(e, 7).toLowerCase() === "account" ? (rt3 = i2.substr(e, 7), e += 7) : (rt3 = t2, l === 0 && v4(dn2)), rt3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "lock" ? (bt2 = i2.substr(e, 4), e += 4) : (bt2 = t2, l === 0 && v4(Je3)), bt2 === t2 && (i2.substr(e, 6).toLowerCase() === "unlock" ? (bt2 = i2.substr(e, 6), e += 6) : (bt2 = t2, l === 0 && v4(On2))), bt2 !== t2 ? (w4 = G5, rt3 = (function(dt2) { return { type: "origin", value: dt2.toLowerCase(), prefix: "account" }; })(bt2), G5 = rt3) : (e = G5, G5 = t2)) : (e = G5, G5 = t2), G5; })()) === t2 && (C5 = null), C5 !== t2 && f4() !== t2 ? ((A4 = Wa()) === t2 && (A4 = null), A4 !== t2 && f4() !== t2 ? ((_5 = (function() { var G5, rt3, bt2; G5 = e, i2.substr(e, 9).toLowerCase() === "attribute" ? (rt3 = i2.substr(e, 9), e += 9) : (rt3 = t2, l === 0 && v4(tn2)), rt3 !== t2 && f4() !== t2 && (bt2 = Le4()) !== t2 ? (w4 = G5, (dt2 = bt2).prefix = "attribute", G5 = rt3 = dt2) : (e = G5, G5 = t2); var dt2; return G5; })()) === t2 && (_5 = null), _5 !== t2 ? (w4 = o, O4 = s, M4 = u4, k4 = a2, B5 = c3, j5 = b4, W4 = d3, K4 = h3, z5 = C5, ot4 = A4, it4 = _5, s = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: O4[0].toLowerCase(), keyword: "user", if_not_exists: M4, user: k4, default_role: B5, require: j5, resource_options: W4, password_options: K4, lock_option: z5, comment: ot4, attribute: it4 } }, o = s) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2); var O4, M4, k4, B5, j5, W4, K4, z5, ot4, it4; return o; })()), r2; })()) === t2 && (n = (function() { var r2, o, s, u4; r2 = e, (o = (function() { var d3, h3, C5, A4; return d3 = e, i2.substr(e, 8).toLowerCase() === "truncate" ? (h3 = i2.substr(e, 8), e += 8) : (h3 = t2, l === 0 && v4(Xr)), h3 !== t2 ? (C5 = e, l++, A4 = F6(), l--, A4 === t2 ? C5 = void 0 : (e = C5, C5 = t2), C5 !== t2 ? (w4 = d3, d3 = h3 = "TRUNCATE") : (e = d3, d3 = t2)) : (e = d3, d3 = t2), d3; })()) !== t2 && f4() !== t2 ? ((s = Fn2()) === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = rn2()) !== t2 ? (w4 = r2, a2 = o, c3 = s, (b4 = u4) && b4.forEach((d3) => _t.add(`${a2}::${d3.db}::${d3.table}`)), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: a2.toLowerCase(), keyword: c3 && c3.toLowerCase() || "table", name: b4 } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var a2, c3, b4; return r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = ga()) !== t2 && f4() !== t2 && Fn2() !== t2 && f4() !== t2 && (s = (function() { var a2, c3, b4, d3, h3, C5, A4, _5; if (a2 = e, (c3 = na()) !== t2) { for (b4 = [], d3 = e, (h3 = f4()) !== t2 && (C5 = ht2()) !== t2 && (A4 = f4()) !== t2 && (_5 = na()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2); d3 !== t2; ) b4.push(d3), d3 = e, (h3 = f4()) !== t2 && (C5 = ht2()) !== t2 && (A4 = f4()) !== t2 && (_5 = na()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2); b4 !== t2 ? (w4 = a2, c3 = x5(c3, b4), a2 = c3) : (e = a2, a2 = t2); } else e = a2, a2 = t2; return a2; })()) !== t2 ? (w4 = r2, (u4 = s).forEach((a2) => a2.forEach((c3) => c3.table && _t.add(`rename::${c3.db}::${c3.table}`))), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "rename", table: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = (function() { var a2, c3, b4, d3; return a2 = e, i2.substr(e, 4).toLowerCase() === "call" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Q0)), c3 !== t2 ? (b4 = e, l++, d3 = F6(), l--, d3 === t2 ? b4 = void 0 : (e = b4, b4 = t2), b4 !== t2 ? (w4 = a2, a2 = c3 = "CALL") : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && f4() !== t2 && (s = (function() { var a2; return (a2 = bl()) === t2 && (a2 = vl()), a2; })()) !== t2 ? (w4 = r2, u4 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "call", expr: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = (function() { var a2, c3, b4, d3; return a2 = e, i2.substr(e, 3).toLowerCase() === "use" ? (c3 = i2.substr(e, 3), e += 3) : (c3 = t2, l === 0 && v4($p)), c3 !== t2 ? (b4 = e, l++, d3 = F6(), l--, d3 === t2 ? b4 = void 0 : (e = b4, b4 = t2), b4 !== t2 ? a2 = c3 = [c3, b4] : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && f4() !== t2 && (s = Jt2()) !== t2 ? (w4 = r2, u4 = s, _t.add(`use::${u4}::null`), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "use", db: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4; r2 = e, (o = Ca()) !== t2 && f4() !== t2 && Fn2() !== t2 && f4() !== t2 && (s = de4()) !== t2 && f4() !== t2 && (u4 = (function() { var b4, d3, h3, C5, A4, _5, O4, M4; if (b4 = e, (d3 = $u()) !== t2) { for (h3 = [], C5 = e, (A4 = f4()) !== t2 && (_5 = ht2()) !== t2 && (O4 = f4()) !== t2 && (M4 = $u()) !== t2 ? C5 = A4 = [A4, _5, O4, M4] : (e = C5, C5 = t2); C5 !== t2; ) h3.push(C5), C5 = e, (A4 = f4()) !== t2 && (_5 = ht2()) !== t2 && (O4 = f4()) !== t2 && (M4 = $u()) !== t2 ? C5 = A4 = [A4, _5, O4, M4] : (e = C5, C5 = t2); h3 !== t2 ? (w4 = b4, d3 = x5(d3, h3), b4 = d3) : (e = b4, b4 = t2); } else e = b4, b4 = t2; return b4; })()) !== t2 ? (w4 = r2, a2 = s, c3 = u4, _t.add(`alter::${a2.db}::${a2.table}`), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "alter", table: [a2], expr: c3 } }, r2 = o) : (e = r2, r2 = t2); var a2, c3; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4; r2 = e, (o = jr()) !== t2 && f4() !== t2 ? ((s = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 6).toLowerCase() === "global" ? (d3 = i2.substr(e, 6), e += 6) : (d3 = t2, l === 0 && v4(qb)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? (w4 = b4, b4 = d3 = "GLOBAL") : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()) === t2 && (s = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 7).toLowerCase() === "session" ? (d3 = i2.substr(e, 7), e += 7) : (d3 = t2, l === 0 && v4(Bb)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? (w4 = b4, b4 = d3 = "SESSION") : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()) === t2 && (s = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 5).toLowerCase() === "local" ? (d3 = i2.substr(e, 5), e += 5) : (d3 = t2, l === 0 && v4(Nn2)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? (w4 = b4, b4 = d3 = "LOCAL") : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()) === t2 && (s = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 7).toLowerCase() === "persist" ? (d3 = i2.substr(e, 7), e += 7) : (d3 = t2, l === 0 && v4(Fb)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? (w4 = b4, b4 = d3 = "PERSIST") : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()) === t2 && (s = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 12).toLowerCase() === "persist_only" ? (d3 = i2.substr(e, 12), e += 12) : (d3 = t2, l === 0 && v4(Gb)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? (w4 = b4, b4 = d3 = "PERSIST_ONLY") : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()), s === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = (function() { var b4, d3, h3, C5, A4, _5, O4, M4; if (b4 = e, (d3 = uu()) !== t2) { for (h3 = [], C5 = e, (A4 = f4()) !== t2 && (_5 = ht2()) !== t2 && (O4 = f4()) !== t2 && (M4 = uu()) !== t2 ? C5 = A4 = [A4, _5, O4, M4] : (e = C5, C5 = t2); C5 !== t2; ) h3.push(C5), C5 = e, (A4 = f4()) !== t2 && (_5 = ht2()) !== t2 && (O4 = f4()) !== t2 && (M4 = uu()) !== t2 ? C5 = A4 = [A4, _5, O4, M4] : (e = C5, C5 = t2); h3 !== t2 ? (w4 = b4, d3 = Mn2(d3, h3), b4 = d3) : (e = b4, b4 = t2); } else e = b4, b4 = t2; return b4; })()) !== t2 ? (w4 = r2, a2 = s, (c3 = u4).keyword = a2, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "set", keyword: a2, expr: c3 } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var a2, c3; return r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = (function() { var a2, c3, b4, d3; return a2 = e, i2.substr(e, 4).toLowerCase() === "lock" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Je3)), c3 !== t2 ? (b4 = e, l++, d3 = F6(), l--, d3 === t2 ? b4 = void 0 : (e = b4, b4 = t2), b4 !== t2 ? a2 = c3 = [c3, b4] : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && f4() !== t2 && _a() !== t2 && f4() !== t2 && (s = (function() { var a2, c3, b4, d3, h3, C5, A4, _5; if (a2 = e, (c3 = Vu()) !== t2) { for (b4 = [], d3 = e, (h3 = f4()) !== t2 && (C5 = ht2()) !== t2 && (A4 = f4()) !== t2 && (_5 = Vu()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2); d3 !== t2; ) b4.push(d3), d3 = e, (h3 = f4()) !== t2 && (C5 = ht2()) !== t2 && (A4 = f4()) !== t2 && (_5 = Vu()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2); b4 !== t2 ? (w4 = a2, c3 = Mn2(c3, b4), a2 = c3) : (e = a2, a2 = t2); } else e = a2, a2 = t2; return a2; })()) !== t2 ? (w4 = r2, u4 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "lock", keyword: "tables", tables: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o; return r2 = e, (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 6).toLowerCase() === "unlock" ? (u4 = i2.substr(e, 6), e += 6) : (u4 = t2, l === 0 && v4(On2)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2)) : (e = s, s = t2), s; })()) !== t2 && f4() !== t2 && _a() !== t2 ? (w4 = r2, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "unlock", keyword: "tables" } }, r2 = o) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3; r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "binary" ? (s = i2.substr(e, 6), e += 6) : (s = t2, l === 0 && v4(p3)), s === t2 && (i2.substr(e, 6).toLowerCase() === "master" ? (s = i2.substr(e, 6), e += 6) : (s = t2, l === 0 && v4(y4))), s !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 4).toLowerCase() === "logs" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(L5)), a2 !== t2 ? (w4 = r2, C5 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", suffix: "logs", keyword: C5.toLowerCase() } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var C5; r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 && (s = _a()) !== t2 ? (w4 = r2, _t.add("show::null::null"), o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: "tables" } }, r2 = o) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 8).toLowerCase() === "triggers" ? (s = i2.substr(e, 8), e += 8) : (s = t2, l === 0 && v4(m3)), s === t2 && (i2.substr(e, 6).toLowerCase() === "status" ? (s = i2.substr(e, 6), e += 6) : (s = t2, l === 0 && v4(S3)), s === t2 && (i2.substr(e, 11).toLowerCase() === "processlist" ? (s = i2.substr(e, 11), e += 11) : (s = t2, l === 0 && v4(I3)))), s !== t2 ? (w4 = r2, M4 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: M4.toLowerCase() } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "procedure" ? (s = i2.substr(e, 9), e += 9) : (s = t2, l === 0 && v4(N4)), s === t2 && (i2.substr(e, 8).toLowerCase() === "function" ? (s = i2.substr(e, 8), e += 8) : (s = t2, l === 0 && v4(q4))), s !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "status" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(S3)), a2 !== t2 ? (w4 = r2, o = (function(k4) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: k4.toLowerCase(), suffix: "status" } }; })(s), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "binlog" ? (s = i2.substr(e, 6), e += 6) : (s = t2, l === 0 && v4(U4)), s !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "events" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(H5)), a2 !== t2 && (c3 = f4()) !== t2 ? ((b4 = pa()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = Is()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 ? ((h3 = mo()) === t2 && (h3 = null), h3 !== t2 ? (w4 = r2, A4 = b4, _5 = d3, O4 = h3, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", suffix: "events", keyword: "binlog", in: A4, from: _5, limit: O4 } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (s = e, i2.substr(e, 9).toLowerCase() === "character" ? (u4 = i2.substr(e, 9), e += 9) : (u4 = t2, l === 0 && v4(en2)), u4 !== t2 && (a2 = f4()) !== t2 ? (i2.substr(e, 3).toLowerCase() === "set" ? (c3 = i2.substr(e, 3), e += 3) : (c3 = t2, l === 0 && v4(mn2)), c3 !== t2 ? s = u4 = [u4, a2, c3] : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (i2.substr(e, 9).toLowerCase() === "collation" ? (s = i2.substr(e, 9), e += 9) : (s = t2, l === 0 && v4(Z5)), s === t2 && (i2.substr(e, 9).toLowerCase() === "databases" ? (s = i2.substr(e, 9), e += 9) : (s = t2, l === 0 && v4(ut3)))), s !== t2 && (u4 = f4()) !== t2 ? ((a2 = Ic()) === t2 && (a2 = Ts()), a2 === t2 && (a2 = null), a2 !== t2 ? (w4 = r2, o = (function(k4, B5) { let j5 = Array.isArray(k4) && k4 || [k4]; return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", suffix: j5[2] && j5[2].toLowerCase(), keyword: j5[0].toLowerCase(), expr: B5 } }; })(s, a2), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "columns" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(pt2)), s === t2 && (i2.substr(e, 7).toLowerCase() === "indexes" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(vt2)), s === t2 && (i2.substr(e, 5).toLowerCase() === "index" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(Un2)))), s !== t2 && (u4 = f4()) !== t2 && (a2 = Is()) !== t2 ? (w4 = r2, o = (function(k4, B5) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: k4.toLowerCase(), from: B5 } }; })(s, a2), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, (o = sn3()) !== t2 && f4() !== t2 && (s = We4()) !== t2 && (u4 = f4()) !== t2 ? ((a2 = eu()) === t2 && (a2 = Fn2()) === t2 && (i2.substr(e, 5).toLowerCase() === "event" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(wt2)), a2 === t2 && (a2 = Vs()) === t2 && (i2.substr(e, 9).toLowerCase() === "procedure" ? (a2 = i2.substr(e, 9), e += 9) : (a2 = t2, l === 0 && v4(N4)))), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = de4()) !== t2 ? (w4 = r2, o = (function(k4, B5) { let j5 = k4.toLowerCase(); return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: "create", suffix: j5, [j5]: B5 } }; })(a2, b4), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = (function() { var k4, B5, j5, W4; k4 = e, (B5 = sn3()) !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "grants" ? (j5 = i2.substr(e, 6), e += 6) : (j5 = t2, l === 0 && v4(Rt)), j5 !== t2 && f4() !== t2 ? ((W4 = (function() { var z5, ot4, it4, G5, rt3, bt2, dt2; z5 = e, i2.substr(e, 3).toLowerCase() === "for" ? (ot4 = i2.substr(e, 3), e += 3) : (ot4 = t2, l === 0 && v4(kt)), ot4 !== t2 && f4() !== t2 && (it4 = Jt2()) !== t2 && f4() !== t2 ? (G5 = e, (rt3 = nl()) !== t2 && (bt2 = f4()) !== t2 && (dt2 = Jt2()) !== t2 ? G5 = rt3 = [rt3, bt2, dt2] : (e = G5, G5 = t2), G5 === t2 && (G5 = null), G5 !== t2 && (rt3 = f4()) !== t2 ? ((bt2 = (function() { var Lt, Pt2; return Lt = e, zs() !== t2 && f4() !== t2 && (Pt2 = (function() { var Bt2, St2, Vt2, $t2, Qt, ce4, En2, De4; if (Bt2 = e, (St2 = Jt2()) !== t2) { for (Vt2 = [], $t2 = e, (Qt = f4()) !== t2 && (ce4 = ht2()) !== t2 && (En2 = f4()) !== t2 && (De4 = Jt2()) !== t2 ? $t2 = Qt = [Qt, ce4, En2, De4] : (e = $t2, $t2 = t2); $t2 !== t2; ) Vt2.push($t2), $t2 = e, (Qt = f4()) !== t2 && (ce4 = ht2()) !== t2 && (En2 = f4()) !== t2 && (De4 = Jt2()) !== t2 ? $t2 = Qt = [Qt, ce4, En2, De4] : (e = $t2, $t2 = t2); Vt2 !== t2 ? (w4 = Bt2, St2 = Mn2(St2, Vt2), Bt2 = St2) : (e = Bt2, Bt2 = t2); } else e = Bt2, Bt2 = t2; return Bt2; })()) !== t2 ? (w4 = Lt, Lt = Pt2) : (e = Lt, Lt = t2), Lt; })()) === t2 && (bt2 = null), bt2 !== t2 ? (w4 = z5, Ut = bt2, ot4 = { user: it4, host: (It = G5) && It[2], role_list: Ut }, z5 = ot4) : (e = z5, z5 = t2)) : (e = z5, z5 = t2)) : (e = z5, z5 = t2); var It, Ut; return z5; })()) === t2 && (W4 = null), W4 !== t2 ? (w4 = k4, K4 = W4, B5 = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "show", keyword: "grants", for: K4 } }, k4 = B5) : (e = k4, k4 = t2)) : (e = k4, k4 = t2)) : (e = k4, k4 = t2); var K4; return k4; })())))))))); var A4, _5, O4, M4; return r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = kr()) === t2 && (o = (function() { var a2, c3, b4, d3; return a2 = e, i2.substr(e, 8).toLowerCase() === "describe" ? (c3 = i2.substr(e, 8), e += 8) : (c3 = t2, l === 0 && v4(j0)), c3 !== t2 ? (b4 = e, l++, d3 = F6(), l--, d3 === t2 ? b4 = void 0 : (e = b4, b4 = t2), b4 !== t2 ? (w4 = a2, a2 = c3 = "DESCRIBE") : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()), o !== t2 && f4() !== t2 && (s = Jt2()) !== t2 ? (w4 = r2, u4 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "desc", table: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3; r2 = e, i2.substr(e, 5).toLowerCase() === "grant" ? (o = i2.substr(e, 5), e += 5) : (o = t2, l === 0 && v4(is)), o !== t2 && f4() !== t2 && (s = (function() { var B5, j5, W4, K4, z5, ot4, it4, G5; if (B5 = e, (j5 = Ku()) !== t2) { for (W4 = [], K4 = e, (z5 = f4()) !== t2 && (ot4 = ht2()) !== t2 && (it4 = f4()) !== t2 && (G5 = Ku()) !== t2 ? K4 = z5 = [z5, ot4, it4, G5] : (e = K4, K4 = t2); K4 !== t2; ) W4.push(K4), K4 = e, (z5 = f4()) !== t2 && (ot4 = ht2()) !== t2 && (it4 = f4()) !== t2 && (G5 = Ku()) !== t2 ? K4 = z5 = [z5, ot4, it4, G5] : (e = K4, K4 = t2); W4 !== t2 ? (w4 = B5, j5 = Ne4(j5, W4), B5 = j5) : (e = B5, B5 = t2); } else e = B5, B5 = t2; return B5; })()) !== t2 && f4() !== t2 && (u4 = un2()) !== t2 && f4() !== t2 ? ((a2 = (function() { var B5, j5; return B5 = e, (j5 = Fn2()) === t2 && (i2.substr(e, 8).toLowerCase() === "function" ? (j5 = i2.substr(e, 8), e += 8) : (j5 = t2, l === 0 && v4(q4)), j5 === t2 && (i2.substr(e, 9).toLowerCase() === "procedure" ? (j5 = i2.substr(e, 9), e += 9) : (j5 = t2, l === 0 && v4(N4)))), j5 !== t2 && (w4 = B5, j5 = { type: "origin", value: j5.toUpperCase() }), B5 = j5; })()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = (function() { var B5, j5, W4, K4, z5; B5 = e, j5 = e, (W4 = Jt2()) === t2 && (W4 = ar()), W4 !== t2 && (K4 = f4()) !== t2 && (z5 = Pe4()) !== t2 ? j5 = W4 = [W4, K4, z5] : (e = j5, j5 = t2), j5 === t2 && (j5 = null), j5 !== t2 && (W4 = f4()) !== t2 ? ((K4 = Jt2()) === t2 && (K4 = ar()), K4 !== t2 ? (w4 = B5, it4 = K4, j5 = { prefix: (ot4 = j5) && ot4[0], name: it4 }, B5 = j5) : (e = B5, B5 = t2)) : (e = B5, B5 = t2); var ot4, it4; return B5; })()) !== t2 && f4() !== t2 && (b4 = Rr()) !== t2 && f4() !== t2 && (d3 = As()) !== t2 && f4() !== t2 ? ((h3 = (function() { var B5, j5, W4; return B5 = e, an2() !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "grant" ? (j5 = i2.substr(e, 5), e += 5) : (j5 = t2, l === 0 && v4(is)), j5 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "option" ? (W4 = i2.substr(e, 6), e += 6) : (W4 = t2, l === 0 && v4(cs)), W4 !== t2 ? (w4 = B5, B5 = { type: "origin", value: "with grant option" }) : (e = B5, B5 = t2)) : (e = B5, B5 = t2)) : (e = B5, B5 = t2), B5; })()) === t2 && (h3 = null), h3 !== t2 ? (w4 = r2, C5 = s, A4 = a2, _5 = c3, O4 = b4, M4 = d3, k4 = h3, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "grant", keyword: "priv", objects: C5, on: { object_type: A4, priv_level: [_5] }, to_from: O4[0], user_or_roles: M4, with: k4 } }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var C5, A4, _5, O4, M4, k4; return r2 === t2 && (r2 = e, i2.substr(e, 5) === "GRANT" ? (o = "GRANT", e += 5) : (o = t2, l === 0 && v4(ii)), o !== t2 && f4() !== t2 ? (i2.substr(e, 5) === "PROXY" ? (s = "PROXY", e += 5) : (s = t2, l === 0 && v4(Hl)), s !== t2 && f4() !== t2 && (u4 = un2()) !== t2 && f4() !== t2 && (a2 = bo()) !== t2 && f4() !== t2 && (c3 = Rr()) !== t2 && f4() !== t2 && (b4 = As()) !== t2 && f4() !== t2 ? ((d3 = hc()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, o = (function(B5, j5, W4, K4) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "grant", keyword: "proxy", objects: [{ priv: { type: "origin", value: "proxy" } }], on: B5, to_from: j5[0], user_or_roles: W4, with: K4 } }; })(a2, c3, b4, d3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, i2.substr(e, 5) === "GRANT" ? (o = "GRANT", e += 5) : (o = t2, l === 0 && v4(ii)), o !== t2 && f4() !== t2 && (s = (function() { var B5, j5, W4, K4, z5, ot4, it4, G5; if (B5 = e, (j5 = Jt2()) !== t2) { for (W4 = [], K4 = e, (z5 = f4()) !== t2 && (ot4 = ht2()) !== t2 && (it4 = f4()) !== t2 && (G5 = Jt2()) !== t2 ? K4 = z5 = [z5, ot4, it4, G5] : (e = K4, K4 = t2); K4 !== t2; ) W4.push(K4), K4 = e, (z5 = f4()) !== t2 && (ot4 = ht2()) !== t2 && (it4 = f4()) !== t2 && (G5 = Jt2()) !== t2 ? K4 = z5 = [z5, ot4, it4, G5] : (e = K4, K4 = t2); W4 !== t2 ? (w4 = B5, j5 = Ne4(j5, W4), B5 = j5) : (e = B5, B5 = t2); } else e = B5, B5 = t2; return B5; })()) !== t2 && f4() !== t2 && (u4 = Rr()) !== t2 && f4() !== t2 && (a2 = As()) !== t2 && f4() !== t2 ? ((c3 = hc()) === t2 && (c3 = null), c3 !== t2 ? (w4 = r2, o = (function(B5, j5, W4, K4) { return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "grant", keyword: "role", objects: B5.map((z5) => ({ priv: { type: "string", value: z5 } })), to_from: j5[0], user_or_roles: W4, with: K4 } }; })(s, u4, a2, c3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2))), r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = (function() { var a2, c3, b4, d3; return a2 = e, i2.substr(e, 7).toLowerCase() === "explain" ? (c3 = i2.substr(e, 7), e += 7) : (c3 = t2, l === 0 && v4(n0)), c3 !== t2 ? (b4 = e, l++, d3 = F6(), l--, d3 === t2 ? b4 = void 0 : (e = b4, b4 = t2), b4 !== t2 ? a2 = c3 = [c3, b4] : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && f4() !== t2 && (s = Ju()) !== t2 ? (w4 = r2, u4 = s, o = { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: "explain", expr: u4 } }, r2 = o) : (e = r2, r2 = t2); var u4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 6).toLowerCase() === "commit" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(ae4)), o === t2 && (i2.substr(e, 8).toLowerCase() === "rollback" ? (o = i2.substr(e, 8), e += 8) : (o = t2, l === 0 && v4(Ae4))), o !== t2 && (w4 = r2, o = { type: "transaction", expr: { action: { type: "origin", value: o } } }), (r2 = o) === t2 && (r2 = e, i2.substr(e, 5).toLowerCase() === "begin" ? (o = i2.substr(e, 5), e += 5) : (o = t2, l === 0 && v4(we4)), o !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "work" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(me4)), s === t2 && (i2.substr(e, 11).toLowerCase() === "transaction" ? (s = i2.substr(e, 11), e += 11) : (s = t2, l === 0 && v4(uo))), s === t2 && (s = null), s !== t2 && f4() !== t2 ? ((u4 = yc()) === t2 && (u4 = null), u4 !== t2 ? (w4 = r2, o = /* @__PURE__ */ (function(a2, c3) { return { type: "transaction", expr: { action: { type: "origin", value: "begin" }, keyword: a2, modes: c3 } }; })(s, u4), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = e, i2.substr(e, 5).toLowerCase() === "start" ? (o = i2.substr(e, 5), e += 5) : (o = t2, l === 0 && v4(Jn2)), o !== t2 && f4() !== t2 ? (i2.substr(e, 11).toLowerCase() === "transaction" ? (s = i2.substr(e, 11), e += 11) : (s = t2, l === 0 && v4(re3)), s !== t2 && f4() !== t2 ? ((u4 = yc()) === t2 && (u4 = null), u4 !== t2 ? (w4 = r2, o = /* @__PURE__ */ (function(a2, c3) { return { type: "transaction", expr: { action: { type: "origin", value: "start" }, keyword: a2, modes: c3 } }; })(s, u4), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2))), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4, M4, k4, B5, j5, W4, K4, z5, ot4, it4, G5, rt3, bt2; r2 = e, i2.substr(e, 4).toLowerCase() === "load" ? (o = i2.substr(e, 4), e += 4) : (o = t2, l === 0 && v4(as)), o !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "data" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(so)), s !== t2 && f4() !== t2 ? (i2.substr(e, 12).toLowerCase() === "low_priority" ? (u4 = i2.substr(e, 12), e += 12) : (u4 = t2, l === 0 && v4(ss)), u4 === t2 && (i2.substr(e, 10).toLowerCase() === "concurrent" ? (u4 = i2.substr(e, 10), e += 10) : (u4 = t2, l === 0 && v4(Fl))), u4 === t2 && (u4 = null), u4 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "local" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(Nn2)), a2 === t2 && (a2 = null), a2 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "infile" ? (c3 = i2.substr(e, 6), e += 6) : (c3 = t2, l === 0 && v4(Gl)), c3 !== t2 && f4() !== t2 && (b4 = Te4()) !== t2 && f4() !== t2 ? ((d3 = Ns()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "into" ? (h3 = i2.substr(e, 4), e += 4) : (h3 = t2, l === 0 && v4(ni)), h3 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "table" ? (C5 = i2.substr(e, 5), e += 5) : (C5 = t2, l === 0 && v4(ri)), C5 !== t2 && f4() !== t2 && (A4 = de4()) !== t2 && f4() !== t2 ? ((_5 = Os()) === t2 && (_5 = null), _5 !== t2 && f4() !== t2 ? (O4 = e, (M4 = po()) !== t2 && (k4 = f4()) !== t2 && (B5 = Te4()) !== t2 ? O4 = M4 = [M4, k4, B5] : (e = O4, O4 = t2), O4 === t2 && (O4 = null), O4 !== t2 && (M4 = f4()) !== t2 ? ((k4 = (function() { var Lt, Pt2, Bt2, St2, Vt2, $t2, Qt, ce4, En2, De4, cu, lu; Lt = e, i2.substr(e, 6).toLowerCase() === "fields" ? (Pt2 = i2.substr(e, 6), e += 6) : (Pt2 = t2, l === 0 && v4(Ue4)), Pt2 === t2 && (i2.substr(e, 7).toLowerCase() === "columns" ? (Pt2 = i2.substr(e, 7), e += 7) : (Pt2 = t2, l === 0 && v4(pt2))), Pt2 !== t2 && f4() !== t2 ? (Bt2 = e, i2.substr(e, 10).toLowerCase() === "terminated" ? (St2 = i2.substr(e, 10), e += 10) : (St2 = t2, l === 0 && v4(qe4)), St2 !== t2 && (Vt2 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? ($t2 = i2.substr(e, 2), e += 2) : ($t2 = t2, l === 0 && v4(P4)), $t2 !== t2 && (Qt = f4()) !== t2 && (ce4 = Te4()) !== t2 ? Bt2 = St2 = [St2, Vt2, $t2, Qt, ce4] : (e = Bt2, Bt2 = t2)) : (e = Bt2, Bt2 = t2), Bt2 === t2 && (Bt2 = null), Bt2 !== t2 && (St2 = f4()) !== t2 ? (Vt2 = e, i2.substr(e, 10).toLowerCase() === "optionally" ? ($t2 = i2.substr(e, 10), e += 10) : ($t2 = t2, l === 0 && v4(Be4)), $t2 === t2 && ($t2 = null), $t2 !== t2 && (Qt = f4()) !== t2 ? (i2.substr(e, 8).toLowerCase() === "enclosed" ? (ce4 = i2.substr(e, 8), e += 8) : (ce4 = t2, l === 0 && v4(us)), ce4 !== t2 && (En2 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? (De4 = i2.substr(e, 2), e += 2) : (De4 = t2, l === 0 && v4(P4)), De4 !== t2 && (cu = f4()) !== t2 && (lu = Te4()) !== t2 ? Vt2 = $t2 = [$t2, Qt, ce4, En2, De4, cu, lu] : (e = Vt2, Vt2 = t2)) : (e = Vt2, Vt2 = t2)) : (e = Vt2, Vt2 = t2), Vt2 === t2 && (Vt2 = null), Vt2 !== t2 && ($t2 = f4()) !== t2 ? (Qt = e, i2.substr(e, 7).toLowerCase() === "escaped" ? (ce4 = i2.substr(e, 7), e += 7) : (ce4 = t2, l === 0 && v4(gu)), ce4 !== t2 && (En2 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? (De4 = i2.substr(e, 2), e += 2) : (De4 = t2, l === 0 && v4(P4)), De4 !== t2 && (cu = f4()) !== t2 && (lu = Te4()) !== t2 ? Qt = ce4 = [ce4, En2, De4, cu, lu] : (e = Qt, Qt = t2)) : (e = Qt, Qt = t2), Qt === t2 && (Qt = null), Qt !== t2 ? (w4 = Lt, Cl = Pt2, cr = Vt2, xo = Qt, (fu = Bt2) && (fu[4].prefix = "TERMINATED BY"), cr && (cr[6].prefix = (cr[0] && cr[0].toUpperCase() === "OPTIONALLY" ? "OPTIONALLY " : "") + "ENCLOSED BY"), xo && (xo[4].prefix = "ESCAPED BY"), Pt2 = { keyword: Cl, terminated: fu && fu[4], enclosed: cr && cr[6], escaped: xo && xo[4] }, Lt = Pt2) : (e = Lt, Lt = t2)) : (e = Lt, Lt = t2)) : (e = Lt, Lt = t2)) : (e = Lt, Lt = t2); var Cl, fu, cr, xo; return Lt; })()) === t2 && (k4 = null), k4 !== t2 && (B5 = f4()) !== t2 ? ((j5 = (function() { var Lt, Pt2, Bt2, St2; return Lt = e, i2.substr(e, 5).toLowerCase() === "lines" ? (Pt2 = i2.substr(e, 5), e += 5) : (Pt2 = t2, l === 0 && v4(Cr)), Pt2 !== t2 && f4() !== t2 ? ((Bt2 = dc()) === t2 && (Bt2 = null), Bt2 !== t2 && f4() !== t2 ? ((St2 = dc()) === t2 && (St2 = null), St2 !== t2 ? (w4 = Lt, Pt2 = (function(Vt2, $t2, Qt) { if ($t2 && Qt && $t2.type === Qt.type) throw new Error("LINES cannot be specified twice"); return $t2 && Reflect.deleteProperty($t2, "type"), Qt && Reflect.deleteProperty(Qt, "type"), { keyword: Vt2, ...$t2 || {}, ...Qt || {} }; })(Pt2, Bt2, St2), Lt = Pt2) : (e = Lt, Lt = t2)) : (e = Lt, Lt = t2)) : (e = Lt, Lt = t2), Lt; })()) === t2 && (j5 = null), j5 !== t2 && f4() !== t2 ? (W4 = e, (K4 = Ao()) !== t2 && (z5 = f4()) !== t2 && (ot4 = Oe4()) !== t2 && (it4 = f4()) !== t2 ? (i2.substr(e, 5).toLowerCase() === "lines" ? (G5 = i2.substr(e, 5), e += 5) : (G5 = t2, l === 0 && v4(Cr)), G5 === t2 && (i2.substr(e, 4).toLowerCase() === "rows" ? (G5 = i2.substr(e, 4), e += 4) : (G5 = t2, l === 0 && v4(oi))), G5 !== t2 ? W4 = K4 = [K4, z5, ot4, it4, G5] : (e = W4, W4 = t2)) : (e = W4, W4 = t2), W4 === t2 && (W4 = null), W4 !== t2 && (K4 = f4()) !== t2 ? ((z5 = _s()) === t2 && (z5 = null), z5 !== t2 && (ot4 = f4()) !== t2 ? (it4 = e, (G5 = jr()) !== t2 && (rt3 = f4()) !== t2 && (bt2 = Lo()) !== t2 ? it4 = G5 = [G5, rt3, bt2] : (e = it4, it4 = t2), it4 === t2 && (it4 = null), it4 !== t2 ? (w4 = r2, It = z5, Ut = it4, o = { type: "load_data", mode: u4, local: a2, file: b4, replace_ignore: d3, table: A4, partition: _5, character_set: O4, fields: k4, lines: j5, ignore: (dt2 = W4) && { count: dt2[2], suffix: dt2[4] }, column: It, set: Ut && Ut[2] }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var dt2, It, Ut; return r2; })()), n; } function Uu() { var n; return (n = Pn2()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; return r2 = e, (o = f4()) !== t2 ? ((s = Xu()) === t2 && (s = null), s !== t2 && f4() !== t2 && Bn2() !== t2 && f4() !== t2 && (u4 = rn2()) !== t2 && f4() !== t2 && jr() !== t2 && f4() !== t2 && (a2 = Lo()) !== t2 && f4() !== t2 ? ((c3 = Ts()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? ((b4 = Sr()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = mo()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, o = (function(h3, C5, A4, _5, O4, M4) { let k4 = {}; return C5 && C5.forEach((B5) => { let { db: j5, as: W4, table: K4, join: z5 } = B5, ot4 = z5 ? "select" : "update"; j5 && (k4[K4] = j5), K4 && _t.add(`${ot4}::${j5}::${K4}`); }), A4 && A4.forEach((B5) => { if (B5.table) { let j5 = Ll(B5.table); _t.add(`update::${k4[j5] || null}::${j5}`); } At2.add(`update::${B5.table}::${B5.column}`); }), { tableList: Array.from(_t), columnList: Dt(At2), ast: { with: h3, type: "update", table: C5, set: A4, where: _5, orderby: O4, limit: M4 } }; })(s, u4, a2, c3, b4, d3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3; return r2 = e, (o = Ns()) !== t2 && f4() !== t2 ? ((s = Ao()) === t2 && (s = null), s !== t2 && f4() !== t2 ? ((u4 = go()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = de4()) !== t2 && f4() !== t2 ? ((c3 = Os()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (b4 = Sc()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 && (d3 = Lc()) !== t2 && f4() !== t2 ? ((h3 = ia()) === t2 && (h3 = null), h3 !== t2 ? (w4 = r2, o = (function(C5, A4, _5, O4, M4, k4, B5, j5) { if (O4 && (_t.add(`insert::${O4.db}::${O4.table}`), O4.as = null), k4) { let K4 = O4 && O4.table || null; Array.isArray(B5.values) && B5.values.forEach((z5, ot4) => { if (z5.value.length != k4.length) throw new Error("Error: column count doesn't match value count at row " + (ot4 + 1)); }), k4.forEach((z5) => At2.add(`insert::${K4}::${z5}`)); } let W4 = [A4, _5].filter((K4) => K4).map((K4) => K4[0] && K4[0].toLowerCase()).join(" "); return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: C5, table: [O4], columns: k4, values: B5, partition: M4, prefix: W4, on_duplicate_update: j5 } }; })(o, s, u4, a2, c3, b4, d3, h3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; return r2 = e, (o = Ns()) !== t2 && f4() !== t2 ? ((s = Ao()) === t2 && (s = null), s !== t2 && f4() !== t2 ? ((u4 = go()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = de4()) !== t2 && f4() !== t2 ? ((c3 = Os()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && (b4 = Lc()) !== t2 && f4() !== t2 ? ((d3 = ia()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, o = (function(h3, C5, A4, _5, O4, M4, k4) { _5 && (_t.add(`insert::${_5.db}::${_5.table}`), At2.add(`insert::${_5.table}::(.*)`), _5.as = null); let B5 = [C5, A4].filter((j5) => j5).map((j5) => j5[0] && j5[0].toLowerCase()).join(" "); return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: h3, table: [_5], columns: null, values: M4, partition: O4, prefix: B5, on_duplicate_update: k4 } }; })(o, s, u4, a2, c3, b4, d3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; return r2 = e, (o = Ns()) !== t2 && f4() !== t2 ? ((s = Ao()) === t2 && (s = null), s !== t2 && f4() !== t2 ? ((u4 = go()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = de4()) !== t2 && f4() !== t2 ? ((c3 = Os()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && jr() !== t2 && f4() !== t2 && (b4 = Lo()) !== t2 && f4() !== t2 ? ((d3 = ia()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, o = (function(h3, C5, A4, _5, O4, M4, k4) { _5 && (_t.add(`insert::${_5.db}::${_5.table}`), At2.add(`insert::${_5.table}::(.*)`), _5.as = null); let B5 = [C5, A4].filter((j5) => j5).map((j5) => j5[0] && j5[0].toLowerCase()).join(" "); return { tableList: Array.from(_t), columnList: Dt(At2), ast: { type: h3, table: [_5], columns: null, partition: O4, prefix: B5, set: M4, on_duplicate_update: k4 } }; })(o, s, u4, a2, c3, b4, d3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; return r2 = e, (o = f4()) !== t2 ? ((s = Xu()) === t2 && (s = null), s !== t2 && f4() !== t2 && Hs() !== t2 && f4() !== t2 ? ((u4 = rn2()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = Is()) !== t2 && f4() !== t2 ? ((c3 = Ts()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? ((b4 = Sr()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = mo()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, o = (function(h3, C5, A4, _5, O4, M4) { if (A4 && (Array.isArray(A4) ? A4 : A4.expr).forEach((k4) => { let { db: B5, as: j5, table: W4, join: K4 } = k4, z5 = K4 ? "select" : "delete"; W4 && _t.add(`${z5}::${B5}::${W4}`), K4 || At2.add(`delete::${W4}::(.*)`); }), C5 === null && A4.length === 1) { let k4 = A4[0]; C5 = [{ db: k4.db, table: k4.table, as: k4.as, addition: !0 }]; } return { tableList: Array.from(_t), columnList: Dt(At2), ast: { with: h3, type: "delete", table: C5, from: A4, where: _5, orderby: O4, limit: M4 } }; })(s, u4, a2, c3, b4, d3), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = Pv()) === t2 && (n = (function() { var r2, o; for (r2 = [], o = pl(); o !== t2; ) r2.push(o), o = pl(); return r2; })()), n; } function Mu() { var n, r2, o, s; return n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "union" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(w0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && f4() !== t2 ? ((o = Oa()) === t2 && (o = Na()), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (s = o) ? "union " + s.toLowerCase() : "union") : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "minus" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(m0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (w4 = n, r2 = "minus"), (n = r2) === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 9).toLowerCase() === "intersect" ? (a2 = i2.substr(e, 9), e += 9) : (a2 = t2, l === 0 && v4(L0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (w4 = n, r2 = "intersect"), (n = r2) === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 6).toLowerCase() === "except" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(C0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (w4 = n, r2 = "except"), n = r2))), n; } function Pn2() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = vo()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = Mu()) !== t2 && (c3 = f4()) !== t2 && (b4 = vo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = Mu()) !== t2 && (c3 = f4()) !== t2 && (b4 = vo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 && (s = f4()) !== t2 ? ((u4 = Sr()) === t2 && (u4 = null), u4 !== t2 && (a2 = f4()) !== t2 ? ((c3 = mo()) === t2 && (c3 = null), c3 !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5, A4) { let _5 = d3; for (let O4 = 0; O4 < h3.length; O4++) _5._next = h3[O4][3], _5.set_op = h3[O4][1], _5 = _5._next; return C5 && (d3._orderby = C5), A4 && (d3._limit = A4), { tableList: Array.from(_t), columnList: Dt(At2), ast: d3 }; })(r2, o, u4, c3)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Pu() { var n, r2, o; return n = e, (r2 = Xt()) !== t2 && f4() !== t2 ? ((o = Io()) === t2 && (o = kr()), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = Mt(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = (function() { var s, u4, a2; return s = e, (u4 = he4()) !== t2 && f4() !== t2 ? ((a2 = Io()) === t2 && (a2 = kr()), a2 === t2 && (a2 = null), a2 !== t2 ? (w4 = s, u4 = Mt(u4, a2), s = u4) : (e = s, s = t2)) : (e = s, s = t2), s; })()), n; } function ao() { var n, r2; return n = e, i2.substr(e, 2).toLowerCase() === "if" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(Ce4)), r2 !== t2 && f4() !== t2 && cn2() !== t2 && f4() !== t2 && ja() !== t2 ? (w4 = n, n = r2 = "IF NOT EXISTS") : (e = n, n = t2), n; } function Du() { var n, r2, o; return n = e, (r2 = bo()) !== t2 && f4() !== t2 ? ((o = (function() { var s, u4, a2, c3, b4, d3, h3, C5, A4; return s = e, i2.substr(e, 10) === Zt ? (u4 = Zt, e += 10) : (u4 = t2, l === 0 && v4(yt2)), u4 !== t2 && f4() !== t2 ? (a2 = e, i2.substr(e, 4).toLowerCase() === "with" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(R4)), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Jt2()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 === t2 && (a2 = null), a2 !== t2 && (c3 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? (b4 = i2.substr(e, 2), e += 2) : (b4 = t2, l === 0 && v4(P4)), b4 !== t2 && (d3 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "random" ? (h3 = i2.substr(e, 6), e += 6) : (h3 = t2, l === 0 && v4(lt3)), h3 !== t2 && f4() !== t2 ? (i2.substr(e, 8).toLowerCase() === "password" ? (C5 = i2.substr(e, 8), e += 8) : (C5 = t2, l === 0 && v4(ye4)), C5 !== t2 ? (w4 = s, s = u4 = { keyword: ["identified", (A4 = a2) && A4[0].toLowerCase()].filter((_5) => _5).join(" "), auth_plugin: A4 && A4[2], value: { prefix: "by", type: "origin", value: "random password" } }) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, i2.substr(e, 10) === Zt ? (u4 = Zt, e += 10) : (u4 = t2, l === 0 && v4(yt2)), u4 !== t2 && f4() !== t2 ? (a2 = e, i2.substr(e, 4).toLowerCase() === "with" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(R4)), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Jt2()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 === t2 && (a2 = null), a2 !== t2 && (c3 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? (b4 = i2.substr(e, 2), e += 2) : (b4 = t2, l === 0 && v4(P4)), b4 !== t2 && (d3 = f4()) !== t2 && (h3 = Le4()) !== t2 ? (w4 = s, s = u4 = (function(_5, O4) { return O4.prefix = "by", { keyword: ["identified", _5 && _5[0].toLowerCase()].filter((M4) => M4).join(" "), auth_plugin: _5 && _5[2], value: O4 }; })(a2, h3)) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, i2.substr(e, 10) === Zt ? (u4 = Zt, e += 10) : (u4 = t2, l === 0 && v4(yt2)), u4 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "with" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(R4)), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Jt2()) !== t2 && (d3 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "as" ? (h3 = i2.substr(e, 2), e += 2) : (h3 = t2, l === 0 && v4(Yn2)), h3 !== t2 && f4() !== t2 && (C5 = Le4()) !== t2 ? (w4 = s, s = u4 = (function(_5, O4) { return O4.prefix = "as", { keyword: "identified with", auth_plugin: _5 && _5[2], value: O4 }; })(b4, C5)) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2))), s; })()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = { user: r2, auth_option: o }) : (e = n, n = t2)) : (e = n, n = t2), n; } function qu() { var n, r2, o; return n = e, i2.substr(e, 4).toLowerCase() === "none" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(xe4)), r2 === t2 && (i2.substr(e, 3).toLowerCase() === "ssl" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(fn2)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "x509" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(pn2)))), r2 !== t2 && (w4 = n, r2 = { type: "origin", value: r2 }), (n = r2) === t2 && (n = e, i2.substr(e, 6).toLowerCase() === "cipher" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(gn2)), r2 === t2 && (i2.substr(e, 6).toLowerCase() === "issuer" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(_n2)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "subject" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4($n2)))), r2 !== t2 && f4() !== t2 && (o = Le4()) !== t2 ? (w4 = n, n = r2 = Hn2(r2, o)) : (e = n, n = t2)), n; } function Bu() { var n, r2, o; return n = e, i2.substr(e, 20).toLowerCase() === "max_queries_per_hour" ? (r2 = i2.substr(e, 20), e += 20) : (r2 = t2, l === 0 && v4(Sn2)), r2 === t2 && (i2.substr(e, 20).toLowerCase() === "max_updates_per_hour" ? (r2 = i2.substr(e, 20), e += 20) : (r2 = t2, l === 0 && v4(je4)), r2 === t2 && (i2.substr(e, 24).toLowerCase() === "max_connections_per_hour" ? (r2 = i2.substr(e, 24), e += 24) : (r2 = t2, l === 0 && v4(Ye4)), r2 === t2 && (i2.substr(e, 20).toLowerCase() === "max_user_connections" ? (r2 = i2.substr(e, 20), e += 20) : (r2 = t2, l === 0 && v4(bn2))))), r2 !== t2 && f4() !== t2 && (o = Oe4()) !== t2 ? (w4 = n, n = r2 = Hn2(r2, o)) : (e = n, n = t2), n; } function Fu() { var n, r2, o, s, u4, a2; return n = e, i2.substr(e, 8).toLowerCase() === "password" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ye4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "expire" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(vn2)), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(ie5)), s === t2 && (i2.substr(e, 5).toLowerCase() === "never" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(yn2)), s === t2 && (s = ca())), s !== t2 ? (w4 = n, n = r2 = { keyword: "password expire", value: typeof (a2 = s) == "string" ? { type: "origin", value: a2 } : a2 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 8).toLowerCase() === "password" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ye4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "history" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4($e4)), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(ie5)), s === t2 && (s = Oe4()), s !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(c3) { return { keyword: "password history", value: typeof c3 == "string" ? { type: "origin", value: c3 } : c3 }; })(s)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 8).toLowerCase() === "password" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ye4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 5) === "REUSE" ? (o = "REUSE", e += 5) : (o = t2, l === 0 && v4(Wn2)), o !== t2 && f4() !== t2 && (s = ca()) !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(c3) { return { keyword: "password reuse", value: c3 }; })(s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 8).toLowerCase() === "password" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ye4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "require" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4(In2)), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "current" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(Xe4)), s !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(ie5)), u4 === t2 && (i2.substr(e, 8).toLowerCase() === "optional" ? (u4 = i2.substr(e, 8), e += 8) : (u4 = t2, l === 0 && v4(Tn2))), u4 !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(c3) { return { keyword: "password require current", value: { type: "origin", value: c3 } }; })(u4)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 21).toLowerCase() === "failed_login_attempts" ? (r2 = i2.substr(e, 21), e += 21) : (r2 = t2, l === 0 && v4(Qe3)), r2 !== t2 && f4() !== t2 && (o = Oe4()) !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(c3) { return { keyword: "failed_login_attempts", value: c3 }; })(o)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 18).toLowerCase() === "password_lock_time" ? (r2 = i2.substr(e, 18), e += 18) : (r2 = t2, l === 0 && v4(Ze3)), r2 !== t2 && f4() !== t2 ? ((o = Oe4()) === t2 && (i2.substr(e, 9).toLowerCase() === "unbounded" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(Vn2))), o !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(c3) { return { keyword: "password_lock_time", value: typeof c3 == "string" ? { type: "origin", value: c3 } : c3 }; })(o)) : (e = n, n = t2)) : (e = n, n = t2)))))), n; } function Gu() { var n; return (n = pc()) === t2 && (n = io()) === t2 && (n = lc()) === t2 && (n = fc()), n; } function Yu() { var n, r2, o, s, u4; return n = e, (r2 = (function() { var a2, c3; return a2 = e, (c3 = (function() { var b4, d3, h3, C5; return b4 = e, i2.substr(e, 8).toLowerCase() === "not null" ? (d3 = i2.substr(e, 8), e += 8) : (d3 = t2, l === 0 && v4(qp)), d3 !== t2 ? (h3 = e, l++, C5 = F6(), l--, C5 === t2 ? h3 = void 0 : (e = h3, h3 = t2), h3 !== t2 ? b4 = d3 = [d3, h3] : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4; })()) !== t2 && (w4 = a2, c3 = { type: "not null", value: "not null" }), a2 = c3; })()) === t2 && (r2 = Fc()), r2 !== t2 && (w4 = n, (u4 = r2) && !u4.value && (u4.value = "null"), r2 = { nullable: u4 }), (n = r2) === t2 && (n = e, (r2 = (function() { var a2, c3; return a2 = e, La() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 ? (w4 = a2, a2 = { type: "default", value: c3 }) : (e = a2, a2 = t2), a2; })()) !== t2 && (w4 = n, r2 = { default_val: r2 }), (n = r2) === t2 && (n = e, i2.substr(e, 14).toLowerCase() === "auto_increment" ? (r2 = i2.substr(e, 14), e += 14) : (r2 = t2, l === 0 && v4(D4)), r2 !== t2 && (w4 = n, r2 = { auto_increment: r2.toLowerCase() }), (n = r2) === t2 && (n = e, i2.substr(e, 6).toLowerCase() === "unique" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(V3)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "key" ? (o = i2.substr(e, 3), e += 3) : (o = t2, l === 0 && v4(Y5)), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(a2) { let c3 = ["unique"]; return a2 && c3.push(a2), { unique: c3.join(" ").toLowerCase("") }; })(o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "primary" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(et3)), r2 === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "key" ? (o = i2.substr(e, 3), e += 3) : (o = t2, l === 0 && v4(Y5)), o !== t2 ? (w4 = n, n = r2 = (function(a2) { let c3 = []; return a2 && c3.push("primary"), c3.push("key"), { primary_key: c3.join(" ").toLowerCase("") }; })(r2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Wa()) !== t2 && (w4 = n, r2 = { comment: r2 }), (n = r2) === t2 && (n = e, (r2 = tr()) !== t2 && (w4 = n, r2 = { collate: r2 }), (n = r2) === t2 && (n = e, (r2 = (function() { var a2, c3, b4; return a2 = e, i2.substr(e, 13).toLowerCase() === "column_format" ? (c3 = i2.substr(e, 13), e += 13) : (c3 = t2, l === 0 && v4(vu)), c3 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "fixed" ? (b4 = i2.substr(e, 5), e += 5) : (b4 = t2, l === 0 && v4(Yr)), b4 === t2 && (i2.substr(e, 7).toLowerCase() === "dynamic" ? (b4 = i2.substr(e, 7), e += 7) : (b4 = t2, l === 0 && v4($r)), b4 === t2 && (i2.substr(e, 7).toLowerCase() === "default" ? (b4 = i2.substr(e, 7), e += 7) : (b4 = t2, l === 0 && v4(ie5)))), b4 !== t2 ? (w4 = a2, c3 = { type: "column_format", value: b4.toLowerCase() }, a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && (w4 = n, r2 = { column_format: r2 }), (n = r2) === t2 && (n = e, (r2 = (function() { var a2, c3, b4; return a2 = e, i2.substr(e, 7).toLowerCase() === "storage" ? (c3 = i2.substr(e, 7), e += 7) : (c3 = t2, l === 0 && v4(br)), c3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "disk" ? (b4 = i2.substr(e, 4), e += 4) : (b4 = t2, l === 0 && v4(Uo)), b4 === t2 && (i2.substr(e, 6).toLowerCase() === "memory" ? (b4 = i2.substr(e, 6), e += 6) : (b4 = t2, l === 0 && v4(Mo))), b4 !== t2 ? (w4 = a2, c3 = { type: "storage", value: b4.toLowerCase() }, a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && (w4 = n, r2 = { storage: r2 }), (n = r2) === t2 && (n = e, (r2 = bc()) !== t2 && (w4 = n, r2 = { reference_definition: r2 }), (n = r2) === t2 && (n = e, (r2 = (function() { var a2, c3, b4, d3, h3, C5, A4, _5; return a2 = e, (c3 = fo()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (b4 = i2.substr(e, 5), e += 5) : (b4 = t2, l === 0 && v4(ke4)), b4 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (d3 = xs()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? (h3 = e, (C5 = cn2()) === t2 && (C5 = null), C5 !== t2 && (A4 = f4()) !== t2 ? (i2.substr(e, 8).toLowerCase() === "enforced" ? (_5 = i2.substr(e, 8), e += 8) : (_5 = t2, l === 0 && v4(Vo)), _5 !== t2 ? h3 = C5 = [C5, A4, _5] : (e = h3, h3 = t2)) : (e = h3, h3 = t2), h3 === t2 && (h3 = null), h3 !== t2 ? (w4 = a2, c3 = (function(O4, M4, k4, B5) { let j5 = []; return B5 && j5.push(B5[0], B5[2]), { constraint_type: M4.toLowerCase(), keyword: O4 && O4.keyword, constraint: O4 && O4.constraint, definition: [k4], enforced: j5.filter((W4) => W4).join(" ").toLowerCase(), resource: "constraint" }; })(c3, b4, d3, h3), a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) !== t2 && (w4 = n, r2 = { check: r2 }), (n = r2) === t2 && (n = e, (r2 = po()) !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Te4()) !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(a2, c3, b4) { return { character_set: { type: a2, value: b4, symbol: c3 } }; })(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var a2, c3, b4, d3, h3, C5, A4, _5; if (a2 = e, c3 = e, (b4 = (function() { var M4, k4, B5, j5, W4; return M4 = e, k4 = e, i2.substr(e, 9).toLowerCase() === "generated" ? (B5 = i2.substr(e, 9), e += 9) : (B5 = t2, l === 0 && v4(Po)), B5 !== t2 && (j5 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "always" ? (W4 = i2.substr(e, 6), e += 6) : (W4 = t2, l === 0 && v4(Hr)), W4 !== t2 ? k4 = B5 = [B5, j5, W4] : (e = k4, k4 = t2)) : (e = k4, k4 = t2), k4 !== t2 && (w4 = M4, k4 = k4.join("").toLowerCase()), M4 = k4; })()) === t2 && (b4 = null), b4 !== t2 && (d3 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "as" ? (h3 = i2.substr(e, 2), e += 2) : (h3 = t2, l === 0 && v4(Yn2)), h3 !== t2 ? c3 = b4 = [b4, d3, h3] : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3 !== t2) if ((b4 = f4()) !== t2) if ((d3 = Ot()) !== t2) if ((h3 = f4()) !== t2) if ((C5 = Or()) === t2 && (C5 = Xt()), C5 !== t2) if (f4() !== t2) if (Nt() !== t2) if (f4() !== t2) { for (A4 = [], i2.substr(e, 6).toLowerCase() === "stored" ? (_5 = i2.substr(e, 6), e += 6) : (_5 = t2, l === 0 && v4(Wr)), _5 === t2 && (i2.substr(e, 7).toLowerCase() === "virtual" ? (_5 = i2.substr(e, 7), e += 7) : (_5 = t2, l === 0 && v4(Vr))); _5 !== t2; ) A4.push(_5), i2.substr(e, 6).toLowerCase() === "stored" ? (_5 = i2.substr(e, 6), e += 6) : (_5 = t2, l === 0 && v4(Wr)), _5 === t2 && (i2.substr(e, 7).toLowerCase() === "virtual" ? (_5 = i2.substr(e, 7), e += 7) : (_5 = t2, l === 0 && v4(Vr))); A4 !== t2 ? (w4 = a2, O4 = A4, c3 = { type: "generated", expr: C5, value: c3.filter((M4) => typeof M4 == "string").join(" ").toLowerCase(), storage_type: O4 && O4[0] && O4[0].toLowerCase() }, a2 = c3) : (e = a2, a2 = t2); } else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; else e = a2, a2 = t2; var O4; return a2; })()) !== t2 && (w4 = n, r2 = { generated: r2 }), n = r2)))))))))))), n; } function io() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = he4()) !== t2 && f4() !== t2 && (o = Ka()) !== t2 && f4() !== t2 ? ((s = (function() { var b4, d3, h3, C5, A4, _5; if (b4 = e, (d3 = Yu()) !== t2) if (f4() !== t2) { for (h3 = [], C5 = e, (A4 = f4()) !== t2 && (_5 = Yu()) !== t2 ? C5 = A4 = [A4, _5] : (e = C5, C5 = t2); C5 !== t2; ) h3.push(C5), C5 = e, (A4 = f4()) !== t2 && (_5 = Yu()) !== t2 ? C5 = A4 = [A4, _5] : (e = C5, C5 = t2); h3 !== t2 ? (w4 = b4, b4 = d3 = (function(O4, M4) { let k4 = O4; for (let B5 = 0; B5 < M4.length; B5++) k4 = { ...k4, ...M4[B5][1] }; return k4; })(d3, h3)) : (e = b4, b4 = t2); } else e = b4, b4 = t2; else e = b4, b4 = t2; return b4; })()) === t2 && (s = null), s !== t2 ? (w4 = n, u4 = r2, a2 = o, c3 = s, At2.add(`create::${u4.table}::${u4.column}`), n = r2 = { column: u4, definition: a2, resource: "column", ...c3 || {} }) : (e = n, n = t2)) : (e = n, n = t2), n; } function cc() { var n, r2, o, s, u4; return n = e, i2.substr(e, 7).toLowerCase() === "definer" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(g4)), r2 !== t2 && f4() !== t2 && be4() !== t2 && f4() !== t2 ? ((o = on2()) === t2 && (o = Le4()), o !== t2 && f4() !== t2 ? (i2.charCodeAt(e) === 64 ? (s = "@", e++) : (s = t2, l === 0 && v4(J5)), s !== t2 && f4() !== t2 ? ((u4 = on2()) === t2 && (u4 = Le4()), u4 !== t2 ? (w4 = n, n = r2 = (function(a2, c3) { let b4 = ln2("@", a2, c3); return ln2("=", { type: "origin", value: "definer" }, b4); })(o, u4)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "definer" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(g4)), r2 !== t2 && f4() !== t2 && be4() !== t2 && f4() !== t2 && (o = $a()) !== t2 && f4() !== t2 && (s = Ot()) !== t2 && f4() !== t2 && (u4 = Nt()) !== t2 ? (w4 = n, n = r2 = nt3()) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "definer" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(g4)), r2 !== t2 && f4() !== t2 && be4() !== t2 && f4() !== t2 && (o = $a()) !== t2 ? (w4 = n, n = r2 = nt3()) : (e = n, n = t2))), n; } function tr() { var n, r2, o; return n = e, (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 7).toLowerCase() === "collate" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(no)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "COLLATE") : (e = s, s = t2)) : (e = s, s = t2), s; })() !== t2 && f4() !== t2 ? ((r2 = be4()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && (o = Jt2()) !== t2 ? (w4 = n, n = { type: "collate", keyword: "collate", collate: { name: o, symbol: r2 } }) : (e = n, n = t2)) : (e = n, n = t2), n; } function ms() { var n, r2, o; return n = e, i2.substr(e, 2).toLowerCase() === "if" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(Do)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "exists" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(vr)), o !== t2 ? (w4 = n, n = r2 = "if exists") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ls() { var n, r2, o; return n = e, i2.substr(e, 5).toLowerCase() === "first" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(qo)), r2 !== t2 && (w4 = n, r2 = { keyword: r2 }), (n = r2) === t2 && (n = e, i2.substr(e, 5).toLowerCase() === "after" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Bo)), r2 !== t2 && f4() !== t2 && (o = he4()) !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(s, u4) { return { keyword: s, expr: u4 }; })(r2, o)) : (e = n, n = t2)), n; } function $u() { var n, r2, o; return (n = (function() { var s, u4; return s = e, Ur() !== t2 && f4() !== t2 && (u4 = pc()) !== t2 ? (w4 = s, s = { action: "add", create_definitions: u4, resource: "constraint", type: "alter" }) : (e = s, s = t2), s; })()) === t2 && (n = (function() { var s, u4, a2, c3; return s = e, (u4 = Fe4()) !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(ke4)), a2 !== t2 && f4() !== t2 && (c3 = ue4()) !== t2 ? (w4 = s, u4 = { action: "drop", constraint: c3, keyword: a2.toLowerCase(), resource: "constraint", type: "alter" }, s = u4) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, (u4 = Fe4()) !== t2 && f4() !== t2 ? (i2.substr(e, 10).toLowerCase() === "constraint" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(Ho)), a2 !== t2 && f4() !== t2 && (c3 = ue4()) !== t2 ? (w4 = s, u4 = (function(b4, d3) { return { action: "drop", constraint: d3, keyword: b4.toLowerCase(), resource: "constraint", type: "alter" }; })(a2, c3), s = u4) : (e = s, s = t2)) : (e = s, s = t2)), s; })()) === t2 && (n = (function() { var s, u4, a2, c3, b4, d3; return s = e, (u4 = Fe4()) !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "primary" ? (a2 = i2.substr(e, 7), e += 7) : (a2 = t2, l === 0 && v4(et3)), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Mr()) !== t2 ? (w4 = s, s = u4 = { action: "drop", key: "", keyword: "primary key", resource: "key", type: "alter" }) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, (u4 = Fe4()) !== t2 && f4() !== t2 ? (a2 = e, i2.substr(e, 7).toLowerCase() === "foreign" ? (c3 = i2.substr(e, 7), e += 7) : (c3 = t2, l === 0 && v4(wu)), c3 === t2 && (c3 = null), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Mr()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 === t2 && (a2 = ur()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Jt2()) !== t2 ? (w4 = s, u4 = (function(h3, C5) { let A4 = Array.isArray(h3) ? "key" : "index"; return { action: "drop", [A4]: C5, keyword: Array.isArray(h3) ? "" + [h3[0], h3[2]].filter((_5) => _5).join(" ").toLowerCase() : h3.toLowerCase(), resource: A4, type: "alter" }; })(a2, b4), s = u4) : (e = s, s = t2)) : (e = s, s = t2)), s; })()) === t2 && (n = (function() { var s, u4, a2, c3; return s = e, an2() !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (u4 = i2.substr(e, 5), e += 5) : (u4 = t2, l === 0 && v4(ke4)), u4 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(ke4)), a2 !== t2 && f4() !== t2 && Ha() !== t2 && f4() !== t2 && (c3 = ue4()) !== t2 ? (w4 = s, s = { action: "with", constraint: c3, keyword: "check check", resource: "constraint", type: "alter" }) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (n = (function() { var s, u4, a2; return s = e, i2.substr(e, 7).toLowerCase() === "nocheck" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(mu)), u4 !== t2 && f4() !== t2 && Ha() !== t2 && f4() !== t2 && (a2 = ue4()) !== t2 ? (w4 = s, s = u4 = { action: "nocheck", constraint: a2, resource: "constraint", type: "alter" }) : (e = s, s = t2), s; })()) === t2 && (n = (function() { var s, u4, a2, c3, b4; s = e, (u4 = Ur()) !== t2 && f4() !== t2 && (a2 = No()) !== t2 && f4() !== t2 && (c3 = io()) !== t2 && f4() !== t2 ? ((b4 = Ls()) === t2 && (b4 = null), b4 !== t2 ? (w4 = s, d3 = a2, h3 = c3, C5 = b4, u4 = { action: "add", ...h3, keyword: d3, suffix: C5, resource: "column", type: "alter" }, s = u4) : (e = s, s = t2)) : (e = s, s = t2); var d3, h3, C5; return s === t2 && (s = e, (u4 = Ur()) !== t2 && f4() !== t2 && (a2 = io()) !== t2 && f4() !== t2 ? ((c3 = Ls()) === t2 && (c3 = null), c3 !== t2 ? (w4 = s, u4 = (function(A4, _5) { return { action: "add", ...A4, suffix: _5, resource: "column", type: "alter" }; })(a2, c3), s = u4) : (e = s, s = t2)) : (e = s, s = t2)), s; })()) === t2 && (n = (function() { var s, u4, a2, c3; return s = e, (u4 = Fe4()) !== t2 && f4() !== t2 && (a2 = No()) !== t2 && f4() !== t2 && (c3 = he4()) !== t2 ? (w4 = s, s = u4 = { action: "drop", column: c3, keyword: a2, resource: "column", type: "alter" }) : (e = s, s = t2), s === t2 && (s = e, (u4 = Fe4()) !== t2 && f4() !== t2 && (a2 = he4()) !== t2 ? (w4 = s, u4 = /* @__PURE__ */ (function(b4) { return { action: "drop", column: b4, resource: "column", type: "alter" }; })(a2), s = u4) : (e = s, s = t2)), s; })()) === t2 && (n = (function() { var s, u4, a2, c3, b4; s = e, (u4 = (function() { var C5, A4, _5, O4; return C5 = e, i2.substr(e, 6).toLowerCase() === "modify" ? (A4 = i2.substr(e, 6), e += 6) : (A4 = t2, l === 0 && v4(ov)), A4 !== t2 ? (_5 = e, l++, O4 = F6(), l--, O4 === t2 ? _5 = void 0 : (e = _5, _5 = t2), _5 !== t2 ? (w4 = C5, C5 = A4 = "MODIFY") : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5; })()) !== t2 && f4() !== t2 ? ((a2 = No()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = io()) !== t2 && f4() !== t2 ? ((b4 = Ls()) === t2 && (b4 = null), b4 !== t2 ? (w4 = s, d3 = c3, h3 = b4, u4 = { action: "modify", keyword: a2, ...d3, suffix: h3, resource: "column", type: "alter" }, s = u4) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2); var d3, h3; return s; })()) === t2 && (n = (function() { var s, u4, a2; s = e, (u4 = Ur()) !== t2 && f4() !== t2 && (a2 = lc()) !== t2 ? (w4 = s, c3 = a2, u4 = { action: "add", type: "alter", ...c3 }, s = u4) : (e = s, s = t2); var c3; return s; })()) === t2 && (n = (function() { var s, u4, a2; s = e, (u4 = Ur()) !== t2 && f4() !== t2 && (a2 = fc()) !== t2 ? (w4 = s, c3 = a2, u4 = { action: "add", type: "alter", ...c3 }, s = u4) : (e = s, s = t2); var c3; return s; })()) === t2 && (n = (function() { var s, u4, a2, c3, b4; s = e, (u4 = ga()) !== t2 && f4() !== t2 && No() !== t2 && f4() !== t2 && (a2 = he4()) !== t2 && f4() !== t2 ? ((c3 = Rr()) === t2 && (c3 = Me4()), c3 === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && (b4 = he4()) !== t2 ? (w4 = s, h3 = b4, u4 = { action: "rename", type: "alter", resource: "column", keyword: "column", old_column: a2, prefix: (d3 = c3) && d3[0].toLowerCase(), column: h3 }, s = u4) : (e = s, s = t2)) : (e = s, s = t2); var d3, h3; return s; })()) === t2 && (n = (function() { var s, u4, a2, c3; s = e, (u4 = ga()) !== t2 && f4() !== t2 ? ((a2 = Rr()) === t2 && (a2 = Me4()), a2 === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = Jt2()) !== t2 ? (w4 = s, d3 = c3, u4 = { action: "rename", type: "alter", resource: "table", keyword: (b4 = a2) && b4[0].toLowerCase(), table: d3 }, s = u4) : (e = s, s = t2)) : (e = s, s = t2); var b4, d3; return s; })()) === t2 && (n = co()) === t2 && (n = lo()) === t2 && (n = (function() { var s, u4, a2, c3, b4, d3; s = e, i2.substr(e, 6).toLowerCase() === "change" ? (u4 = i2.substr(e, 6), e += 6) : (u4 = t2, l === 0 && v4(hu)), u4 !== t2 && f4() !== t2 ? ((a2 = No()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && (c3 = he4()) !== t2 && f4() !== t2 && (b4 = io()) !== t2 && f4() !== t2 ? ((d3 = Ls()) === t2 && (d3 = null), d3 !== t2 ? (w4 = s, h3 = a2, C5 = b4, A4 = d3, u4 = { action: "change", old_column: c3, ...C5, keyword: h3, resource: "column", type: "alter", suffix: A4 }, s = u4) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2); var h3, C5, A4; return s; })()) === t2 && (n = (function() { var s, u4, a2, c3, b4; return s = e, i2.substr(e, 4).toLowerCase() === "drop" ? (u4 = i2.substr(e, 4), e += 4) : (u4 = t2, l === 0 && v4(Fo)), u4 === t2 && (i2.substr(e, 8).toLowerCase() === "truncate" ? (u4 = i2.substr(e, 8), e += 8) : (u4 = t2, l === 0 && v4(Xr)), u4 === t2 && (i2.substr(e, 7).toLowerCase() === "discard" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(yu)), u4 === t2 && (i2.substr(e, 6).toLowerCase() === "import" ? (u4 = i2.substr(e, 6), e += 6) : (u4 = t2, l === 0 && v4(yr)), u4 === t2 && (i2.substr(e, 8).toLowerCase() === "coalesce" ? (u4 = i2.substr(e, 8), e += 8) : (u4 = t2, l === 0 && v4(Go)), u4 === t2 && (i2.substr(e, 7).toLowerCase() === "analyze" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(Yo)), u4 === t2 && (i2.substr(e, 5).toLowerCase() === "check" ? (u4 = i2.substr(e, 5), e += 5) : (u4 = t2, l === 0 && v4(ke4)))))))), u4 !== t2 && f4() !== t2 && (a2 = xr()) !== t2 && f4() !== t2 && (c3 = _s()) !== t2 && f4() !== t2 ? (i2.substr(e, 10).toLowerCase() === "tablespace" ? (b4 = i2.substr(e, 10), e += 10) : (b4 = t2, l === 0 && v4(Qr)), b4 === t2 && (b4 = null), b4 !== t2 ? (w4 = s, u4 = (function(d3, h3, C5, A4) { let _5 = { action: d3.toLowerCase(), keyword: h3, resource: "partition", type: "alter", partitions: C5 }; return A4 && (_5.suffix = { keyword: A4 }), _5; })(u4, a2, c3, b4), s = u4) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, (u4 = Ur()) !== t2 && f4() !== t2 && (a2 = xr()) !== t2 && f4() !== t2 && (c3 = Ot()) !== t2 && f4() !== t2 && (b4 = (function() { var d3, h3, C5, A4, _5, O4, M4, k4; if (d3 = e, (h3 = Hu()) !== t2) { for (C5 = [], A4 = e, (_5 = f4()) !== t2 && (O4 = ht2()) !== t2 && (M4 = f4()) !== t2 && (k4 = Hu()) !== t2 ? A4 = _5 = [_5, O4, M4, k4] : (e = A4, A4 = t2); A4 !== t2; ) C5.push(A4), A4 = e, (_5 = f4()) !== t2 && (O4 = ht2()) !== t2 && (M4 = f4()) !== t2 && (k4 = Hu()) !== t2 ? A4 = _5 = [_5, O4, M4, k4] : (e = A4, A4 = t2); C5 !== t2 ? (w4 = d3, h3 = xt(h3, C5), d3 = h3) : (e = d3, d3 = t2); } else e = d3, d3 = t2; return d3; })()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = s, s = u4 = { action: "add", keyword: a2, resource: "partition", type: "alter", partitions: b4 }) : (e = s, s = t2)), s; })()) === t2 && (n = e, (r2 = Es()) !== t2 && (w4 = n, (o = r2).resource = o.keyword, o[o.keyword] = o.value, delete o.value, r2 = { type: "alter", ...o }), n = r2), n; } function Hu() { var n, r2, o, s, u4; return n = e, xr() !== t2 && f4() !== t2 && (r2 = Te4()) !== t2 && f4() !== t2 && Sa() !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "less" ? (o = i2.substr(e, 4), e += 4) : (o = t2, l === 0 && v4(zr)), o !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "than" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(Kr)), s !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (u4 = Oe4()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = { name: r2, value: { type: "less than", expr: u4, parentheses: !0 } }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function co() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "algorithm" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(He4)), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(ie5)), s === t2 && (i2.substr(e, 7).toLowerCase() === "instant" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(Zr)), s === t2 && (i2.substr(e, 7).toLowerCase() === "inplace" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4($o)), s === t2 && (i2.substr(e, 4).toLowerCase() === "copy" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(Jr))))), s !== t2 ? (w4 = n, n = r2 = { type: "alter", keyword: "algorithm", resource: "algorithm", symbol: o, algorithm: s }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function lo() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "lock" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Je3)), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(ie5)), s === t2 && (i2.substr(e, 4).toLowerCase() === "none" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(xe4)), s === t2 && (i2.substr(e, 6).toLowerCase() === "shared" ? (s = i2.substr(e, 6), e += 6) : (s = t2, l === 0 && v4(xn2)), s === t2 && (i2.substr(e, 9).toLowerCase() === "exclusive" ? (s = i2.substr(e, 9), e += 9) : (s = t2, l === 0 && v4(du))))), s !== t2 ? (w4 = n, n = r2 = { type: "alter", keyword: "lock", resource: "lock", symbol: o, lock: s }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function lc() { var n, r2, o, s, u4, a2, c3, b4; return n = e, (r2 = ur()) === t2 && (r2 = Mr()), r2 !== t2 && f4() !== t2 ? ((o = qn2()) === t2 && (o = null), o !== t2 && f4() !== t2 ? ((s = ho()) === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = Zu()) !== t2 && f4() !== t2 ? ((a2 = wo()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 ? (w4 = n, c3 = s, b4 = a2, n = r2 = { index: o, definition: u4, keyword: r2.toLowerCase(), index_type: c3, resource: "index", index_options: b4 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function fc() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, (r2 = ol()) === t2 && (r2 = sl()), r2 !== t2 && f4() !== t2 ? ((o = ur()) === t2 && (o = Mr()), o === t2 && (o = null), o !== t2 && f4() !== t2 ? ((s = qn2()) === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = gs()) !== t2 && f4() !== t2 ? ((a2 = wo()) === t2 && (a2 = null), a2 !== t2 ? (w4 = n, c3 = r2, d3 = a2, n = r2 = { index: s, definition: u4, keyword: (b4 = o) && `${c3.toLowerCase()} ${b4.toLowerCase()}` || c3.toLowerCase(), index_options: d3, resource: "index" }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function pc() { var n; return (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; r2 = e, (o = fo()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (s = e, i2.substr(e, 7).toLowerCase() === "primary" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(et3)), u4 !== t2 && (a2 = f4()) !== t2 ? (i2.substr(e, 3).toLowerCase() === "key" ? (c3 = i2.substr(e, 3), e += 3) : (c3 = t2, l === 0 && v4(Y5)), c3 !== t2 ? s = u4 = [u4, a2, c3] : (e = s, s = t2)) : (e = s, s = t2), s !== t2 && (u4 = f4()) !== t2 ? ((a2 = ho()) === t2 && (a2 = null), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Zu()) !== t2 && f4() !== t2 ? ((d3 = wo()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, C5 = s, A4 = a2, _5 = b4, O4 = d3, o = { constraint: (h3 = o) && h3.constraint, definition: _5, constraint_type: `${C5[0].toLowerCase()} ${C5[2].toLowerCase()}`, keyword: h3 && h3.keyword, index_type: A4, resource: "constraint", index_options: O4 }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var h3, C5, A4, _5, O4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; r2 = e, (o = fo()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = ul()) !== t2 && f4() !== t2 ? ((u4 = ur()) === t2 && (u4 = Mr()), u4 === t2 && (u4 = null), u4 !== t2 && f4() !== t2 ? ((a2 = qn2()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 ? ((c3 = ho()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && (b4 = Zu()) !== t2 && f4() !== t2 ? ((d3 = wo()) === t2 && (d3 = null), d3 !== t2 ? (w4 = r2, C5 = s, A4 = u4, _5 = a2, O4 = c3, M4 = b4, k4 = d3, o = { constraint: (h3 = o) && h3.constraint, definition: M4, constraint_type: A4 && `${C5.toLowerCase()} ${A4.toLowerCase()}` || C5.toLowerCase(), keyword: h3 && h3.keyword, index_type: O4, index: _5, resource: "constraint", index_options: k4 }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var h3, C5, A4, _5, O4, M4, k4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3; r2 = e, (o = fo()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (i2.substr(e, 11).toLowerCase() === "foreign key" ? (s = i2.substr(e, 11), e += 11) : (s = t2, l === 0 && v4(jn2)), s !== t2 && f4() !== t2 ? ((u4 = qn2()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && (a2 = gs()) !== t2 && f4() !== t2 ? ((c3 = bc()) === t2 && (c3 = null), c3 !== t2 ? (w4 = r2, d3 = s, h3 = u4, C5 = a2, A4 = c3, o = { constraint: (b4 = o) && b4.constraint, definition: C5, constraint_type: d3, keyword: b4 && b4.keyword, index: h3, resource: "constraint", reference_definition: A4 }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var b4, d3, h3, C5, A4; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3, C5; r2 = e, (o = fo()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "check" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(ke4)), s !== t2 && f4() !== t2 ? (u4 = e, i2.substr(e, 3).toLowerCase() === "not" ? (a2 = i2.substr(e, 3), e += 3) : (a2 = t2, l === 0 && v4(Wo)), a2 !== t2 && (c3 = f4()) !== t2 ? (i2.substr(e, 3).toLowerCase() === "for" ? (b4 = i2.substr(e, 3), e += 3) : (b4 = t2, l === 0 && v4(kt)), b4 !== t2 && (d3 = f4()) !== t2 ? (i2.substr(e, 11).toLowerCase() === "replication" ? (h3 = i2.substr(e, 11), e += 11) : (h3 = t2, l === 0 && v4(hn2)), h3 !== t2 && (C5 = f4()) !== t2 ? u4 = a2 = [a2, c3, b4, d3, h3, C5] : (e = u4, u4 = t2)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4 === t2 && (u4 = null), u4 !== t2 && (a2 = Ot()) !== t2 && (c3 = f4()) !== t2 && (b4 = xs()) !== t2 && (d3 = f4()) !== t2 && (h3 = Nt()) !== t2 ? (w4 = r2, A4 = o, _5 = u4, O4 = b4, o = { constraint_type: s.toLowerCase(), keyword: A4 && A4.keyword, constraint: A4 && A4.constraint, index_type: _5 && { keyword: "not for replication" }, definition: [O4], resource: "constraint" }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); var A4, _5, O4; return r2; })()), n; } function fo() { var n, r2, o, s; return n = e, (r2 = Ha()) !== t2 && f4() !== t2 ? ((o = Jt2()) === t2 && (o = null), o !== t2 ? (w4 = n, s = o, n = r2 = { keyword: r2.toLowerCase(), constraint: s }) : (e = n, n = t2)) : (e = n, n = t2), n; } function bc() { var n, r2, o, s, u4, a2, c3, b4, d3, h3; return n = e, (r2 = il()) !== t2 && f4() !== t2 && (o = rn2()) !== t2 && f4() !== t2 && (s = gs()) !== t2 && f4() !== t2 ? (i2.substr(e, 10).toLowerCase() === "match full" ? (u4 = i2.substr(e, 10), e += 10) : (u4 = t2, l === 0 && v4(Lu)), u4 === t2 && (i2.substr(e, 13).toLowerCase() === "match partial" ? (u4 = i2.substr(e, 13), e += 13) : (u4 = t2, l === 0 && v4(zo)), u4 === t2 && (i2.substr(e, 12).toLowerCase() === "match simple" ? (u4 = i2.substr(e, 12), e += 12) : (u4 = t2, l === 0 && v4(Ko)))), u4 === t2 && (u4 = null), u4 !== t2 && f4() !== t2 ? ((a2 = Wu()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 ? ((c3 = Wu()) === t2 && (c3 = null), c3 !== t2 ? (w4 = n, b4 = u4, d3 = a2, h3 = c3, n = r2 = { definition: s, table: o, keyword: r2.toLowerCase(), match: b4 && b4.toLowerCase(), on_action: [d3, h3].filter((C5) => C5) }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Wu()) !== t2 && (w4 = n, r2 = { on_action: [r2] }), n = r2), n; } function Wu() { var n, r2, o, s; return n = e, un2() !== t2 && f4() !== t2 ? ((r2 = Hs()) === t2 && (r2 = Bn2()), r2 !== t2 && f4() !== t2 && (o = (function() { var u4, a2, c3; return u4 = e, (a2 = tu()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 ? ((c3 = nr()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = u4, u4 = a2 = { type: "function", name: { name: [{ type: "origin", value: a2 }] }, args: c3 }) : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, (a2 = vc()) === t2 && (i2.substr(e, 8).toLowerCase() === "set null" ? (a2 = i2.substr(e, 8), e += 8) : (a2 = t2, l === 0 && v4($5)), a2 === t2 && (i2.substr(e, 9).toLowerCase() === "no action" ? (a2 = i2.substr(e, 9), e += 9) : (a2 = t2, l === 0 && v4(eo)), a2 === t2 && (i2.substr(e, 11).toLowerCase() === "set default" ? (a2 = i2.substr(e, 11), e += 11) : (a2 = t2, l === 0 && v4(Se4)), a2 === t2 && (a2 = tu())))), a2 !== t2 && (w4 = u4, a2 = { type: "origin", value: a2.toLowerCase() }), u4 = a2), u4; })()) !== t2 ? (w4 = n, s = o, n = { type: "on " + r2[0].toLowerCase(), value: s }) : (e = n, n = t2)) : (e = n, n = t2), n; } function vc() { var n, r2; return n = e, i2.substr(e, 8).toLowerCase() === "restrict" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(wn2)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "cascade" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(to))), r2 !== t2 && (w4 = n, r2 = r2.toLowerCase()), n = r2; } function po() { var n, r2, o; return n = e, i2.substr(e, 9).toLowerCase() === "character" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(en2)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "set" ? (o = i2.substr(e, 3), e += 3) : (o = t2, l === 0 && v4(mn2)), o !== t2 ? (w4 = n, n = r2 = "CHARACTER SET") : (e = n, n = t2)) : (e = n, n = t2), n; } function Cs() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, (r2 = La()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? ((o = po()) === t2 && (i2.substr(e, 7).toLowerCase() === "charset" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4(Xo)), o === t2 && (i2.substr(e, 7).toLowerCase() === "collate" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4(no)))), o !== t2 && f4() !== t2 ? ((s = be4()) === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = Te4()) !== t2 ? (w4 = n, c3 = o, b4 = s, d3 = u4, n = r2 = { keyword: (a2 = r2) && `${a2[0].toLowerCase()} ${c3.toLowerCase()}` || c3.toLowerCase(), symbol: b4, value: d3 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function Es() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, i2.substr(e, 14).toLowerCase() === "auto_increment" ? (r2 = i2.substr(e, 14), e += 14) : (r2 = t2, l === 0 && v4(D4)), r2 === t2 && (i2.substr(e, 14).toLowerCase() === "avg_row_length" ? (r2 = i2.substr(e, 14), e += 14) : (r2 = t2, l === 0 && v4(Cu)), r2 === t2 && (i2.substr(e, 14).toLowerCase() === "key_block_size" ? (r2 = i2.substr(e, 14), e += 14) : (r2 = t2, l === 0 && v4(kn2)), r2 === t2 && (i2.substr(e, 8).toLowerCase() === "max_rows" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(Qo)), r2 === t2 && (i2.substr(e, 8).toLowerCase() === "min_rows" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ro)), r2 === t2 && (i2.substr(e, 18).toLowerCase() === "stats_sample_pages" ? (r2 = i2.substr(e, 18), e += 18) : (r2 = t2, l === 0 && v4(Zo))))))), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Oe4()) !== t2 ? (w4 = n, b4 = o, d3 = s, n = r2 = { keyword: r2.toLowerCase(), symbol: b4, value: d3.value }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 8) === "CHECKSUM" ? (r2 = "CHECKSUM", e += 8) : (r2 = t2, l === 0 && v4(oo)), r2 === t2 && (i2.substr(e, 15) === "DELAY_KEY_WRITE" ? (r2 = "DELAY_KEY_WRITE", e += 15) : (r2 = t2, l === 0 && v4(fe4))), r2 !== t2 && f4() !== t2 && (o = be4()) !== t2 && f4() !== t2 ? (Jo.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(ts)), s !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { return { keyword: h3.toLowerCase(), symbol: C5, value: A4 }; })(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = Cs()) === t2 && (n = e, (r2 = al()) === t2 && (i2.substr(e, 10).toLowerCase() === "connection" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Eu)), r2 === t2 && (i2.substr(e, 16).toLowerCase() === "engine_attribute" ? (r2 = i2.substr(e, 16), e += 16) : (r2 = t2, l === 0 && v4(Au)), r2 === t2 && (i2.substr(e, 26).toLowerCase() === "secondary_engine_attribute" ? (r2 = i2.substr(e, 26), e += 26) : (r2 = t2, l === 0 && v4(dr))))), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Le4()) !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { return { keyword: h3.toLowerCase(), symbol: C5, value: `'${A4.value}'` }; })(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 4).toLowerCase() === "data" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(so)), r2 === t2 && (i2.substr(e, 5).toLowerCase() === "index" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Un2))), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "directory" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(es)), o !== t2 && f4() !== t2 ? ((s = be4()) === t2 && (s = null), s !== t2 && (u4 = f4()) !== t2 && (a2 = Le4()) !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { return { keyword: h3.toLowerCase() + " directory", symbol: C5, value: `'${A4.value}'` }; })(r2, s, a2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 11).toLowerCase() === "compression" ? (r2 = i2.substr(e, 11), e += 11) : (r2 = t2, l === 0 && v4(Ln2)), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (s = e, i2.charCodeAt(e) === 39 ? (u4 = "'", e++) : (u4 = t2, l === 0 && v4(Ee4)), u4 !== t2 ? (i2.substr(e, 4).toLowerCase() === "zlib" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(hr)), a2 === t2 && (i2.substr(e, 3).toLowerCase() === "lz4" ? (a2 = i2.substr(e, 3), e += 3) : (a2 = t2, l === 0 && v4(Xn2)), a2 === t2 && (i2.substr(e, 4).toLowerCase() === "none" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(xe4)))), a2 !== t2 ? (i2.charCodeAt(e) === 39 ? (c3 = "'", e++) : (c3 = t2, l === 0 && v4(Ee4)), c3 !== t2 ? s = u4 = [u4, a2, c3] : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2), s !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { return { keyword: h3.toLowerCase(), symbol: C5, value: A4.join("").toUpperCase() }; })(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 6).toLowerCase() === "engine" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Qn2)), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = ue4()) !== t2 ? (w4 = n, n = r2 = wr(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 10).toLowerCase() === "row_format" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(ns)), r2 !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "default" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(ie5)), s === t2 && (i2.substr(e, 7).toLowerCase() === "dynamic" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4($r)), s === t2 && (i2.substr(e, 5).toLowerCase() === "fixed" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(Yr)), s === t2 && (i2.substr(e, 10).toLowerCase() === "compressed" ? (s = i2.substr(e, 10), e += 10) : (s = t2, l === 0 && v4(mr)), s === t2 && (i2.substr(e, 9).toLowerCase() === "redundant" ? (s = i2.substr(e, 9), e += 9) : (s = t2, l === 0 && v4(rs)), s === t2 && (i2.substr(e, 7).toLowerCase() === "compact" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(os))))))), s !== t2 ? (w4 = n, n = r2 = wr(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2))))))), n; } function Vu() { var n, r2, o, s, u4; return n = e, (r2 = er()) !== t2 && f4() !== t2 && (o = (function() { var a2, c3, b4; return a2 = e, i2.substr(e, 4).toLowerCase() === "read" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Zn2)), c3 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "local" ? (b4 = i2.substr(e, 5), e += 5) : (b4 = t2, l === 0 && v4(Nn2)), b4 === t2 && (b4 = null), b4 !== t2 ? (w4 = a2, a2 = c3 = { type: "read", suffix: b4 && "local" }) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2 === t2 && (a2 = e, i2.substr(e, 12).toLowerCase() === "low_priority" ? (c3 = i2.substr(e, 12), e += 12) : (c3 = t2, l === 0 && v4(ss)), c3 === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "write" ? (b4 = i2.substr(e, 5), e += 5) : (b4 = t2, l === 0 && v4(Lr)), b4 !== t2 ? (w4 = a2, a2 = c3 = { type: "write", prefix: c3 && "low_priority" }) : (e = a2, a2 = t2)) : (e = a2, a2 = t2)), a2; })()) !== t2 ? (w4 = n, s = r2, u4 = o, _t.add(`lock::${s.db}::${s.table}`), n = r2 = { table: s, lock_type: u4 }) : (e = n, n = t2), n; } function zu() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "isolation" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(te5)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "level" ? (o = i2.substr(e, 5), e += 5) : (o = t2, l === 0 && v4(Gt2)), o !== t2 && f4() !== t2 && (s = (function() { var u4, a2, c3; return u4 = e, i2.substr(e, 12).toLowerCase() === "serializable" ? (a2 = i2.substr(e, 12), e += 12) : (a2 = t2, l === 0 && v4(mt3)), a2 !== t2 && (w4 = u4, a2 = { type: "origin", value: "serializable" }), (u4 = a2) === t2 && (u4 = e, i2.substr(e, 10).toLowerCase() === "repeatable" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(gt2)), a2 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "read" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Zn2)), c3 !== t2 ? (w4 = u4, u4 = a2 = { type: "origin", value: "repeatable read" }) : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, i2.substr(e, 4).toLowerCase() === "read" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(Zn2)), a2 !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "committed" ? (c3 = i2.substr(e, 9), e += 9) : (c3 = t2, l === 0 && v4(Ct)), c3 === t2 && (i2.substr(e, 11).toLowerCase() === "uncommitted" ? (c3 = i2.substr(e, 11), e += 11) : (c3 = t2, l === 0 && v4(Ft2))), c3 !== t2 ? (w4 = u4, u4 = a2 = qt2(c3)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2))), u4; })()) !== t2 ? (w4 = n, n = r2 = { type: "origin", value: "isolation level " + s.value }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 4).toLowerCase() === "read" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Zn2)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "write" ? (o = i2.substr(e, 5), e += 5) : (o = t2, l === 0 && v4(Lr)), o === t2 && (i2.substr(e, 4).toLowerCase() === "only" ? (o = i2.substr(e, 4), e += 4) : (o = t2, l === 0 && v4(se3))), o !== t2 ? (w4 = n, n = r2 = qt2(o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = cn2()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 10).toLowerCase() === "deferrable" ? (o = i2.substr(e, 10), e += 10) : (o = t2, l === 0 && v4(Yt2)), o !== t2 ? (w4 = n, n = r2 = { type: "origin", value: r2 ? "not deferrable" : "deferrable" }) : (e = n, n = t2)) : (e = n, n = t2))), n; } function yc() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = zu()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = zu()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = zu()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = xt(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function dc() { var n, r2, o, s, u4, a2; return n = e, i2.substr(e, 8).toLowerCase() === "starting" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(_u)), r2 === t2 && (i2.substr(e, 10).toLowerCase() === "terminated" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(qe4))), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 2).toLowerCase() === "by" ? (o = i2.substr(e, 2), e += 2) : (o = t2, l === 0 && v4(P4)), o !== t2 && f4() !== t2 && (s = Te4()) !== t2 ? (w4 = n, u4 = r2, (a2 = s).prefix = u4.toUpperCase() + " BY", n = r2 = { type: u4.toLowerCase(), [u4.toLowerCase()]: a2 }) : (e = n, n = t2)) : (e = n, n = t2), n; } function Dv() { var n; return (n = (function() { var r2, o, s, u4, a2; return r2 = e, (o = Oa()) === t2 && (o = Ca()) === t2 && (o = e, (s = We4()) !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 4).toLowerCase() === "view" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(si)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = We4()) === t2 && (o = Hs()) === t2 && (o = Fe4()) === t2 && (o = e, i2.substr(e, 5).toLowerCase() === "grant" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(is)), s !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "option" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(cs)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = ur()) === t2 && (o = Ea()) === t2 && (o = il()) === t2 && (o = $c()) === t2 && (o = e, (s = sn3()) !== t2 && (u4 = f4()) !== t2 && (a2 = eu()) !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2), o === t2 && (o = Vs()) === t2 && (o = Bn2())))), o !== t2 && (w4 = r2, o = ui(o)), r2 = o; })()) === t2 && (n = (function() { var r2, o, s, u4, a2; return r2 = e, o = e, (s = Ca()) !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 7).toLowerCase() === "routine" ? (a2 = i2.substr(e, 7), e += 7) : (a2 = t2, l === 0 && v4(ai)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (i2.substr(e, 7).toLowerCase() === "execute" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4(Yl)), o === t2 && (o = e, i2.substr(e, 5).toLowerCase() === "grant" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(is)), s !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "option" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(cs)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = e, (s = We4()) !== t2 && (u4 = f4()) !== t2 ? (i2.substr(e, 7).toLowerCase() === "routine" ? (a2 = i2.substr(e, 7), e += 7) : (a2 = t2, l === 0 && v4(ai)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2)))), o !== t2 && (w4 = r2, o = ui(o)), r2 = o; })()), n; } function Ku() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, (r2 = Dv()) !== t2 && f4() !== t2 ? (o = e, (s = Ot()) !== t2 && (u4 = f4()) !== t2 && (a2 = sa()) !== t2 && (c3 = f4()) !== t2 && (b4 = Nt()) !== t2 ? o = s = [s, u4, a2, c3, b4] : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = { priv: r2, columns: (d3 = o) && d3[2] }) : (e = n, n = t2)) : (e = n, n = t2), n; } function bo() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = Jt2()) !== t2 && f4() !== t2 ? (o = e, i2.charCodeAt(e) === 64 ? (s = "@", e++) : (s = t2, l === 0 && v4(J5)), s !== t2 && (u4 = f4()) !== t2 && (a2 = Jt2()) !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = { name: { type: "single_quote_string", value: r2 }, host: (c3 = o) ? { type: "single_quote_string", value: c3[2] } : null }) : (e = n, n = t2)) : (e = n, n = t2), n; } function As() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = bo()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = bo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = bo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = Ne4(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function hc() { var n, r2, o; return n = e, an2() !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "admin" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4($l)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "option" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(cs)), o !== t2 ? (w4 = n, n = { type: "origin", value: "with admin option" }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function vo() { var n, r2, o, s, u4, a2, c3; return (n = Ju()) === t2 && (n = e, r2 = e, i2.charCodeAt(e) === 40 ? (o = "(", e++) : (o = t2, l === 0 && v4(ci)), o !== t2 && (s = f4()) !== t2 && (u4 = vo()) !== t2 && (a2 = f4()) !== t2 ? (i2.charCodeAt(e) === 41 ? (c3 = ")", e++) : (c3 = t2, l === 0 && v4(li)), c3 !== t2 ? r2 = o = [o, s, u4, a2, c3] : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 !== t2 && (w4 = n, r2 = { ...r2[2], parentheses_symbol: !0 }), n = r2), n; } function Xu() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5; if (n = e, an2() !== t2) if (f4() !== t2) if ((r2 = _r()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = _r()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = _r()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; if (n === t2) if (n = e, f4() !== t2) if (an2() !== t2) if ((r2 = f4()) !== t2) if ((o = (function() { var O4, M4, k4, B5; return O4 = e, i2.substr(e, 9).toLowerCase() === "recursive" ? (M4 = i2.substr(e, 9), e += 9) : (M4 = t2, l === 0 && v4(Zp)), M4 !== t2 ? (k4 = e, l++, B5 = F6(), l--, B5 === t2 ? k4 = void 0 : (e = k4, k4 = t2), k4 !== t2 ? O4 = M4 = [M4, k4] : (e = O4, O4 = t2)) : (e = O4, O4 = t2), O4; })()) !== t2) if ((s = f4()) !== t2) if ((u4 = _r()) !== t2) { for (a2 = [], c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = _r()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); c3 !== t2; ) a2.push(c3), c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = _r()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); a2 !== t2 ? (w4 = n, _5 = a2, (A4 = u4).recursive = !0, n = ze4(A4, _5)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; return n; } function _r() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = Le4()) === t2 && (r2 = ue4()) === t2 && (r2 = de4()), r2 !== t2 && f4() !== t2 ? ((o = gs()) === t2 && (o = null), o !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 ? ((s = Rs()) === t2 && (s = Pn2()), s !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, a2 = o, c3 = s, typeof (u4 = r2) == "string" && (u4 = { type: "default", value: u4 }), u4.table && (u4 = { type: "default", value: u4.table }), n = r2 = { name: u4, stmt: c3, columns: a2 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function gs() { var n, r2; return n = e, Ot() !== t2 && f4() !== t2 && (r2 = (function() { var o; return (o = sa()) === t2 && (o = (function() { var s, u4, a2, c3, b4, d3, h3, C5; if (s = e, (u4 = Or()) !== t2) { for (a2 = [], c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Or()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); c3 !== t2; ) a2.push(c3), c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Or()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); a2 !== t2 ? (w4 = s, u4 = x5(u4, a2), s = u4) : (e = s, s = t2); } else e = s, s = t2; return s; })()), o; })()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function Qu() { var n, r2, o, s, u4, a2, c3; if (n = e, (r2 = Tr()) !== t2) if (f4() !== t2) if ((o = Ot()) !== t2) if (f4() !== t2) { if (s = [], _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)), u4 !== t2) for (; u4 !== t2; ) s.push(u4), _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)); else s = t2; s !== t2 && (u4 = f4()) !== t2 && Nt() !== t2 && f4() !== t2 ? ((a2 = Io()) === t2 && (a2 = kr()), a2 === t2 && (a2 = null), a2 !== t2 ? (w4 = n, c3 = a2, n = r2 = { type: "column_ref", column: r2, suffix: `(${parseInt(s.join(""), 10)})`, order_by: c3, ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; return n === t2 && (n = e, (r2 = Tr()) !== t2 && f4() !== t2 ? ((o = Io()) === t2 && (o = kr()), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(b4, d3) { return { type: "column_ref", column: b4, order_by: d3, ...ee5() }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2)), n; } function Zu() { var n, r2, o; return n = e, Ot() !== t2 && f4() !== t2 ? ((r2 = (function() { var s, u4, a2, c3, b4, d3, h3, C5; if (s = e, (u4 = Qu()) !== t2) { for (a2 = [], c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Qu()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); c3 !== t2; ) a2.push(c3), c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Qu()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); a2 !== t2 ? (w4 = s, s = u4 = x5(u4, a2)) : (e = s, s = t2); } else e = s, s = t2; return s; })()) === t2 && (r2 = nr()), r2 !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = (o = r2).type ? o.value : o) : (e = n, n = t2)) : (e = n, n = t2), n; } function qv() { var n, r2, o, s; return n = e, (r2 = (function() { var u4, a2, c3, b4, d3, h3; return u4 = e, a2 = e, i2.substr(e, 3).toLowerCase() === "for" ? (c3 = i2.substr(e, 3), e += 3) : (c3 = t2, l === 0 && v4(kt)), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Bn2()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 !== t2 && (w4 = u4, a2 = `${(h3 = a2)[0]} ${h3[2][0]}`), u4 = a2; })()) === t2 && (r2 = (function() { var u4, a2, c3, b4, d3, h3, C5, A4, _5, O4; return u4 = e, a2 = e, i2.substr(e, 4).toLowerCase() === "lock" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Je3)), c3 !== t2 && (b4 = f4()) !== t2 ? (i2.substr(e, 2).toLowerCase() === "in" ? (d3 = i2.substr(e, 2), e += 2) : (d3 = t2, l === 0 && v4(fi)), d3 !== t2 && (h3 = f4()) !== t2 ? (i2.substr(e, 5).toLowerCase() === "share" ? (C5 = i2.substr(e, 5), e += 5) : (C5 = t2, l === 0 && v4(Wl)), C5 !== t2 && (A4 = f4()) !== t2 ? (i2.substr(e, 4).toLowerCase() === "mode" ? (_5 = i2.substr(e, 4), e += 4) : (_5 = t2, l === 0 && v4(ls)), _5 !== t2 ? a2 = c3 = [c3, b4, d3, h3, C5, A4, _5] : (e = a2, a2 = t2)) : (e = a2, a2 = t2)) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2 !== t2 && (w4 = u4, a2 = `${(O4 = a2)[0]} ${O4[2]} ${O4[4]} ${O4[6]}`), u4 = a2; })()), r2 !== t2 && f4() !== t2 ? ((o = (function() { var u4, a2, c3, b4, d3, h3, C5; return u4 = e, a2 = e, i2.substr(e, 4).toLowerCase() === "wait" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Vl)), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Oe4()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 !== t2 && (w4 = u4, a2 = `${(h3 = a2)[0]} ${h3[2].value}`), (u4 = a2) === t2 && (i2.substr(e, 6).toLowerCase() === "nowait" ? (u4 = i2.substr(e, 6), e += 6) : (u4 = t2, l === 0 && v4(zl)), u4 === t2 && (u4 = e, a2 = e, i2.substr(e, 4).toLowerCase() === "skip" ? (c3 = i2.substr(e, 4), e += 4) : (c3 = t2, l === 0 && v4(Kl)), c3 !== t2 && (b4 = f4()) !== t2 ? (i2.substr(e, 6).toLowerCase() === "locked" ? (d3 = i2.substr(e, 6), e += 6) : (d3 = t2, l === 0 && v4(Xl)), d3 !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2 !== t2 && (w4 = u4, a2 = `${(C5 = a2)[0]} ${C5[2]}`), u4 = a2)), u4; })()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = r2 + ((s = o) ? " " + s : "")) : (e = n, n = t2)) : (e = n, n = t2), n; } function Ju() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4, M4, k4, B5; return n = e, f4() !== t2 ? ((r2 = Xu()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && $c() !== t2 && f4() !== t2 ? ((o = (function() { var j5, W4, K4, z5, ot4, it4; if (j5 = e, (W4 = ta()) !== t2) { for (K4 = [], z5 = e, (ot4 = f4()) !== t2 && (it4 = ta()) !== t2 ? z5 = ot4 = [ot4, it4] : (e = z5, z5 = t2); z5 !== t2; ) K4.push(z5), z5 = e, (ot4 = f4()) !== t2 && (it4 = ta()) !== t2 ? z5 = ot4 = [ot4, it4] : (e = z5, z5 = t2); K4 !== t2 ? (w4 = j5, W4 = (function(G5, rt3) { let bt2 = [G5]; for (let dt2 = 0, It = rt3.length; dt2 < It; ++dt2) bt2.push(rt3[dt2][1]); return bt2; })(W4, K4), j5 = W4) : (e = j5, j5 = t2); } else e = j5, j5 = t2; return j5; })()) === t2 && (o = null), o !== t2 && f4() !== t2 ? ((s = Na()) === t2 && (s = null), s !== t2 && f4() !== t2 && (u4 = _s()) !== t2 && f4() !== t2 ? ((a2 = ea()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 ? ((c3 = Is()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? ((b4 = ea()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 ? ((d3 = Ts()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 ? ((h3 = (function() { var j5, W4, K4, z5; j5 = e, (W4 = (function() { var it4, G5, rt3, bt2; return it4 = e, i2.substr(e, 5).toLowerCase() === "group" ? (G5 = i2.substr(e, 5), e += 5) : (G5 = t2, l === 0 && v4(I0)), G5 !== t2 ? (rt3 = e, l++, bt2 = F6(), l--, bt2 === t2 ? rt3 = void 0 : (e = rt3, rt3 = t2), rt3 !== t2 ? it4 = G5 = [G5, rt3] : (e = it4, it4 = t2)) : (e = it4, it4 = t2), it4; })()) !== t2 && f4() !== t2 && Ta() !== t2 && f4() !== t2 && (K4 = nr()) !== t2 && f4() !== t2 ? ((z5 = (function() { var it4, G5; return it4 = e, an2() !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "rollup" ? (G5 = i2.substr(e, 6), e += 6) : (G5 = t2, l === 0 && v4(cf)), G5 !== t2 ? (w4 = it4, it4 = { type: "origin", value: "with rollup" }) : (e = it4, it4 = t2)) : (e = it4, it4 = t2), it4; })()) === t2 && (z5 = null), z5 !== t2 ? (w4 = j5, ot4 = z5, W4 = { columns: K4.value, modifiers: [ot4] }, j5 = W4) : (e = j5, j5 = t2)) : (e = j5, j5 = t2); var ot4; return j5; })()) === t2 && (h3 = null), h3 !== t2 && f4() !== t2 ? ((C5 = (function() { var j5, W4; return j5 = e, (function() { var K4, z5, ot4, it4; return K4 = e, i2.substr(e, 6).toLowerCase() === "having" ? (z5 = i2.substr(e, 6), e += 6) : (z5 = t2, l === 0 && v4(T0)), z5 !== t2 ? (ot4 = e, l++, it4 = F6(), l--, it4 === t2 ? ot4 = void 0 : (e = ot4, ot4 = t2), ot4 !== t2 ? K4 = z5 = [z5, ot4] : (e = K4, K4 = t2)) : (e = K4, K4 = t2), K4; })() !== t2 && f4() !== t2 && (W4 = rr()) !== t2 ? (w4 = j5, j5 = W4) : (e = j5, j5 = t2), j5; })()) === t2 && (C5 = null), C5 !== t2 && f4() !== t2 ? ((A4 = Sr()) === t2 && (A4 = null), A4 !== t2 && f4() !== t2 ? ((_5 = tr()) === t2 && (_5 = null), _5 !== t2 && f4() !== t2 ? ((O4 = mo()) === t2 && (O4 = null), O4 !== t2 && f4() !== t2 ? ((M4 = qv()) === t2 && (M4 = null), M4 !== t2 && f4() !== t2 ? ((k4 = (function() { var j5, W4, K4; return j5 = e, i2.substr(e, 6).toLowerCase() === "window" ? (W4 = i2.substr(e, 6), e += 6) : (W4 = t2, l === 0 && v4(Df)), W4 !== t2 && f4() !== t2 && (K4 = (function() { var z5, ot4, it4, G5, rt3, bt2, dt2, It; if (z5 = e, (ot4 = ha()) !== t2) { for (it4 = [], G5 = e, (rt3 = f4()) !== t2 && (bt2 = ht2()) !== t2 && (dt2 = f4()) !== t2 && (It = ha()) !== t2 ? G5 = rt3 = [rt3, bt2, dt2, It] : (e = G5, G5 = t2); G5 !== t2; ) it4.push(G5), G5 = e, (rt3 = f4()) !== t2 && (bt2 = ht2()) !== t2 && (dt2 = f4()) !== t2 && (It = ha()) !== t2 ? G5 = rt3 = [rt3, bt2, dt2, It] : (e = G5, G5 = t2); it4 !== t2 ? (w4 = z5, ot4 = ze4(ot4, it4), z5 = ot4) : (e = z5, z5 = t2); } else e = z5, z5 = t2; return z5; })()) !== t2 ? (w4 = j5, j5 = W4 = { keyword: "window", type: "window", expr: K4 }) : (e = j5, j5 = t2), j5; })()) === t2 && (k4 = null), k4 !== t2 && f4() !== t2 ? ((B5 = ea()) === t2 && (B5 = null), B5 !== t2 ? (w4 = n, n = (function(j5, W4, K4, z5, ot4, it4, G5, rt3, bt2, dt2, It, Ut, Lt, Pt2, Bt2, St2) { if (ot4 && G5 || ot4 && St2 || G5 && St2 || ot4 && G5 && St2) throw new Error("A given SQL statement can contain at most one INTO clause"); return it4 && (Array.isArray(it4) ? it4 : it4.expr).forEach((Vt2) => Vt2.table && _t.add(`select::${Vt2.db}::${Vt2.table}`)), { with: j5, type: "select", options: W4, distinct: K4, columns: z5, into: { ...ot4 || G5 || St2 || {}, position: (ot4 ? "column" : G5 && "from") || St2 && "end" }, from: it4, where: rt3, groupby: bt2, having: dt2, orderby: It, limit: Lt, locking_read: Pt2 && Pt2, window: Bt2, collate: Ut, ...ee5() }; })(r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4, M4, k4, B5)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function ta() { var n, r2; return n = e, (r2 = (function() { var o; return i2.substr(e, 19).toLowerCase() === "sql_calc_found_rows" ? (o = i2.substr(e, 19), e += 19) : (o = t2, l === 0 && v4(cv)), o; })()) === t2 && ((r2 = (function() { var o; return i2.substr(e, 9).toLowerCase() === "sql_cache" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(lv)), o; })()) === t2 && (r2 = (function() { var o; return i2.substr(e, 12).toLowerCase() === "sql_no_cache" ? (o = i2.substr(e, 12), e += 12) : (o = t2, l === 0 && v4(fv)), o; })()), r2 === t2 && (r2 = (function() { var o; return i2.substr(e, 14).toLowerCase() === "sql_big_result" ? (o = i2.substr(e, 14), e += 14) : (o = t2, l === 0 && v4(bv)), o; })()) === t2 && (r2 = (function() { var o; return i2.substr(e, 16).toLowerCase() === "sql_small_result" ? (o = i2.substr(e, 16), e += 16) : (o = t2, l === 0 && v4(pv)), o; })()) === t2 && (r2 = (function() { var o; return i2.substr(e, 17).toLowerCase() === "sql_buffer_result" ? (o = i2.substr(e, 17), e += 17) : (o = t2, l === 0 && v4(vv)), o; })())), r2 !== t2 && (w4 = n, r2 = r2), n = r2; } function _s() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Oa()) === t2 && (r2 = e, (o = ar()) !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? r2 = o = [o, s] : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2 === t2 && (r2 = ar())), r2 !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = yo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = yo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { At2.add("select::null::(.*)"); let C5 = { expr: { type: "column_ref", table: null, column: "*" }, as: null, ...ee5() }; return h3 && h3.length > 0 ? ze4(C5, h3) : [C5]; })(0, o)) : (e = n, n = t2); } else e = n, n = t2; if (n === t2) if (n = e, (r2 = yo()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = yo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = yo()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function wc() { var n, r2, o, s, u4, a2, c3; return n = e, i2.substr(e, 5).toLowerCase() === "match" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Zl)), r2 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (o = sa()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? (i2.substr(e, 7) === "AGAINST" ? (s = "AGAINST", e += 7) : (s = t2, l === 0 && v4(Jl)), s !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (u4 = Xt()) !== t2 && f4() !== t2 ? ((a2 = (function() { var b4, d3, h3, C5, A4, _5, O4; return b4 = e, So() !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "natural" ? (d3 = i2.substr(e, 7), e += 7) : (d3 = t2, l === 0 && v4(pi)), d3 !== t2 && f4() !== t2 ? (i2.substr(e, 8).toLowerCase() === "language" ? (h3 = i2.substr(e, 8), e += 8) : (h3 = t2, l === 0 && v4(bi)), h3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "mode" ? (C5 = i2.substr(e, 4), e += 4) : (C5 = t2, l === 0 && v4(ls)), C5 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "with" ? (A4 = i2.substr(e, 4), e += 4) : (A4 = t2, l === 0 && v4(R4)), A4 !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "query" ? (_5 = i2.substr(e, 5), e += 5) : (_5 = t2, l === 0 && v4(vi)), _5 !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "expansion" ? (O4 = i2.substr(e, 9), e += 9) : (O4 = t2, l === 0 && v4(yi)), O4 !== t2 ? (w4 = b4, b4 = { type: "origin", value: "IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION" }) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4 === t2 && (b4 = e, So() !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "natural" ? (d3 = i2.substr(e, 7), e += 7) : (d3 = t2, l === 0 && v4(pi)), d3 !== t2 && f4() !== t2 ? (i2.substr(e, 8).toLowerCase() === "language" ? (h3 = i2.substr(e, 8), e += 8) : (h3 = t2, l === 0 && v4(bi)), h3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "mode" ? (C5 = i2.substr(e, 4), e += 4) : (C5 = t2, l === 0 && v4(ls)), C5 !== t2 ? (w4 = b4, b4 = { type: "origin", value: "IN NATURAL LANGUAGE MODE" }) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4 === t2 && (b4 = e, So() !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "boolean" ? (d3 = i2.substr(e, 7), e += 7) : (d3 = t2, l === 0 && v4(Ql)), d3 !== t2 && f4() !== t2 ? (i2.substr(e, 4).toLowerCase() === "mode" ? (h3 = i2.substr(e, 4), e += 4) : (h3 = t2, l === 0 && v4(ls)), h3 !== t2 ? (w4 = b4, b4 = { type: "origin", value: "IN BOOLEAN MODE" }) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2), b4 === t2 && (b4 = e, an2() !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "query" ? (d3 = i2.substr(e, 5), e += 5) : (d3 = t2, l === 0 && v4(vi)), d3 !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "expansion" ? (h3 = i2.substr(e, 9), e += 9) : (h3 = t2, l === 0 && v4(yi)), h3 !== t2 ? (w4 = b4, b4 = { type: "origin", value: "WITH QUERY EXPANSION" }) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)) : (e = b4, b4 = t2)))), b4; })()) === t2 && (a2 = null), a2 !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((c3 = Dn2()) === t2 && (c3 = null), c3 !== t2 ? (w4 = n, n = r2 = { against: "against", columns: o, expr: u4, match: "match", mode: a2, type: "fulltext_search", as: c3 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function yo() { var n, r2, o, s, u4, a2, c3, b4; return n = e, (r2 = wc()) !== t2 && (w4 = n, r2 = (function(d3) { let { as: h3, ...C5 } = d3; return { expr: C5, as: h3 }; })(r2)), (n = r2) === t2 && (n = e, (r2 = Jt2()) !== t2 && (o = f4()) !== t2 && (s = Pe4()) !== t2 && (u4 = f4()) !== t2 && (a2 = Jt2()) !== t2 && f4() !== t2 && Pe4() !== t2 && f4() !== t2 && ar() !== t2 ? (w4 = n, c3 = r2, b4 = a2, At2.add(`select::${c3}::${b4}::(.*)`), n = r2 = { expr: { type: "column_ref", db: c3, table: b4, column: "*" }, as: null, ...ee5() }) : (e = n, n = t2), n === t2 && (n = e, r2 = e, (o = Jt2()) !== t2 && (s = f4()) !== t2 && (u4 = Pe4()) !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2), r2 === t2 && (r2 = null), r2 !== t2 && (o = f4()) !== t2 && (s = ar()) !== t2 ? (w4 = n, n = r2 = (function(d3) { let h3 = d3 && d3[0] || null; return At2.add(`select::${h3}::(.*)`), { expr: { type: "column_ref", table: h3, column: "*" }, as: null, ...ee5() }; })(r2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var d3, h3, C5, A4; return d3 = e, (h3 = Ve4()) === t2 && (h3 = za()), h3 !== t2 && f4() !== t2 && (C5 = rl()) !== t2 && f4() !== t2 && (A4 = Xt()) !== t2 ? (w4 = d3, h3 = sc(h3, C5, A4), d3 = h3) : (e = d3, d3 = t2), d3; })()) !== t2 && (o = f4()) !== t2 ? ((s = Dn2()) === t2 && (s = null), s !== t2 ? (w4 = n, n = r2 = { expr: r2, as: s }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var d3, h3, C5, A4, _5, O4, M4, k4; if (d3 = e, (h3 = Xt()) !== t2) { for (C5 = [], A4 = e, (_5 = f4()) !== t2 ? ((O4 = Ge4()) === t2 && (O4 = Cn2()) === t2 && (O4 = Pr()), O4 !== t2 && (M4 = f4()) !== t2 && (k4 = Xt()) !== t2 ? A4 = _5 = [_5, O4, M4, k4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2); A4 !== t2; ) C5.push(A4), A4 = e, (_5 = f4()) !== t2 ? ((O4 = Ge4()) === t2 && (O4 = Cn2()) === t2 && (O4 = Pr()), O4 !== t2 && (M4 = f4()) !== t2 && (k4 = Xt()) !== t2 ? A4 = _5 = [_5, O4, M4, k4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2); C5 !== t2 ? (w4 = d3, h3 = (function(B5, j5) { let W4 = B5.ast; if (W4 && W4.type === "select" && (!(B5.parentheses_symbol || B5.parentheses || B5.ast.parentheses || B5.ast.parentheses_symbol) || W4.columns.length !== 1 || W4.columns[0].expr.column === "*")) throw new Error("invalid column clause with select statement"); if (!j5 || j5.length === 0) return B5; let K4 = j5.length, z5 = j5[K4 - 1][3]; for (let ot4 = K4 - 1; ot4 >= 0; ot4--) { let it4 = ot4 === 0 ? B5 : j5[ot4 - 1][3]; z5 = ln2(j5[ot4][1], it4, z5); } return z5; })(h3, C5), d3 = h3) : (e = d3, d3 = t2); } else e = d3, d3 = t2; return d3; })()) !== t2 && (o = f4()) !== t2 ? ((s = Dn2()) === t2 && (s = null), s !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { return d3.type !== "double_quote_string" && d3.type !== "single_quote_string" || At2.add("select::null::" + d3.value), { expr: d3, as: h3 }; })(r2, s)) : (e = n, n = t2)) : (e = n, n = t2))))), n; } function Dn2() { var n, r2, o; return n = e, (r2 = Me4()) !== t2 && f4() !== t2 && (o = (function() { var s, u4; return s = e, (u4 = ue4()) !== t2 ? (w4 = e, ((function(a2) { if (wl[a2.toUpperCase()] === !0) throw new Error("Error: " + JSON.stringify(a2) + " is a reserved word, can not as alias clause"); return !1; })(u4) ? t2 : void 0) !== t2 ? (w4 = s, s = u4 = u4) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, (u4 = Ps()) !== t2 && (w4 = s, u4 = u4), s = u4), s; })()) !== t2 ? (w4 = n, n = r2 = o) : (e = n, n = t2), n === t2 && (n = e, (r2 = Me4()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && (o = Jt2()) !== t2 ? (w4 = n, n = r2 = o) : (e = n, n = t2)), n; } function ea() { var n, r2, o; return n = e, go() !== t2 && f4() !== t2 && (r2 = (function() { var s, u4, a2, c3, b4, d3, h3, C5; if (s = e, (u4 = Ve4()) !== t2) { for (a2 = [], c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Ve4()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); c3 !== t2; ) a2.push(c3), c3 = e, (b4 = f4()) !== t2 && (d3 = ht2()) !== t2 && (h3 = f4()) !== t2 && (C5 = Ve4()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); a2 !== t2 ? (w4 = s, u4 = xt(u4, a2), s = u4) : (e = s, s = t2); } else e = s, s = t2; return s; })()) !== t2 ? (w4 = n, n = { keyword: "var", type: "into", expr: r2 }) : (e = n, n = t2), n === t2 && (n = e, go() !== t2 && f4() !== t2 ? (i2.substr(e, 7).toLowerCase() === "outfile" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(tf)), r2 === t2 && (i2.substr(e, 8).toLowerCase() === "dumpfile" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(ef))), r2 === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? ((o = Le4()) === t2 && (o = Jt2()), o !== t2 ? (w4 = n, n = { keyword: r2, type: "into", expr: o }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)), n; } function Is() { var n, r2; return n = e, Ws() !== t2 && f4() !== t2 && (r2 = rn2()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function na() { var n, r2, o; return n = e, (r2 = de4()) !== t2 && f4() !== t2 && Rr() !== t2 && f4() !== t2 && (o = de4()) !== t2 ? (w4 = n, n = r2 = [r2, o]) : (e = n, n = t2), n; } function ho() { var n, r2; return n = e, zs() !== t2 && f4() !== t2 ? (i2.substr(e, 5).toLowerCase() === "btree" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(nf)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "hash" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(rf))), r2 !== t2 ? (w4 = n, n = { keyword: "using", type: r2.toLowerCase() }) : (e = n, n = t2)) : (e = n, n = t2), n; } function wo() { var n, r2, o, s, u4, a2; if (n = e, (r2 = ra()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ra()) !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ra()) !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(c3, b4) { let d3 = [c3]; for (let h3 = 0; h3 < b4.length; h3++) d3.push(b4[h3][1]); return d3; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function ra() { var n, r2, o, s, u4, a2; return n = e, (r2 = (function() { var c3, b4, d3, h3; return c3 = e, i2.substr(e, 14).toLowerCase() === "key_block_size" ? (b4 = i2.substr(e, 14), e += 14) : (b4 = t2, l === 0 && v4(kn2)), b4 !== t2 ? (d3 = e, l++, h3 = F6(), l--, h3 === t2 ? d3 = void 0 : (e = d3, d3 = t2), d3 !== t2 ? (w4 = c3, c3 = b4 = "KEY_BLOCK_SIZE") : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3; })()) !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Oe4()) !== t2 ? (w4 = n, u4 = o, a2 = s, n = r2 = { type: r2.toLowerCase(), symbol: u4, expr: a2 }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = ho()) === t2 && (n = e, i2.substr(e, 4).toLowerCase() === "with" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(R4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "parser" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(of)), o !== t2 && f4() !== t2 && (s = ue4()) !== t2 ? (w4 = n, n = r2 = { type: "with parser", expr: s }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "visible" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(sf)), r2 === t2 && (i2.substr(e, 9).toLowerCase() === "invisible" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(uf))), r2 !== t2 && (w4 = n, r2 = (function(c3) { return { type: c3.toLowerCase(), expr: c3.toLowerCase() }; })(r2)), (n = r2) === t2 && (n = Wa()))), n; } function rn2() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4; if (n = e, (r2 = er()) !== t2) { for (o = [], s = Ir(); s !== t2; ) o.push(s), s = Ir(); o !== t2 ? (w4 = n, C5 = r2, (A4 = o).unshift(C5), A4.forEach((_5) => { let { table: O4, as: M4 } = _5; ir[O4] = O4, M4 && (ir[M4] = O4), Za(At2); }), n = r2 = A4) : (e = n, n = t2); } else e = n, n = t2; if (n === t2) { if (n = e, r2 = [], (o = Ot()) !== t2) for (; o !== t2; ) r2.push(o), o = Ot(); else r2 = t2; if (r2 !== t2) if ((o = f4()) !== t2) if ((s = er()) !== t2) { for (u4 = [], a2 = Ir(); a2 !== t2; ) u4.push(a2), a2 = Ir(); if (u4 !== t2) if ((a2 = f4()) !== t2) { if (c3 = [], (b4 = Nt()) !== t2) for (; b4 !== t2; ) c3.push(b4), b4 = Nt(); else c3 = t2; if (c3 !== t2) if ((b4 = f4()) !== t2) { for (d3 = [], h3 = Ir(); h3 !== t2; ) d3.push(h3), h3 = Ir(); d3 !== t2 ? (w4 = n, n = r2 = (function(_5, O4, M4, k4, B5) { if (_5.length !== k4.length) throw new Error(`parentheses not match in from clause: ${_5.length} != ${k4.length}`); return M4.unshift(O4), M4.forEach((j5) => { let { table: W4, as: K4 } = j5; ir[W4] = W4, K4 && (ir[K4] = W4), Za(At2); }), B5.forEach((j5) => { let { table: W4, as: K4 } = j5; ir[W4] = W4, K4 && (ir[K4] = W4), Za(At2); }), { expr: M4, parentheses: { length: k4.length }, joins: B5 }; })(r2, s, u4, c3, d3)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; } else e = n, n = t2; else e = n, n = t2; } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; } return n; } function Ir() { var n, r2, o; return n = e, f4() !== t2 && (r2 = ht2()) !== t2 && f4() !== t2 && (o = er()) !== t2 ? (w4 = n, n = o) : (e = n, n = t2), n === t2 && (n = e, f4() !== t2 && (r2 = (function() { var s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4; if (s = e, (u4 = Ss()) !== t2) if (f4() !== t2) if ((a2 = er()) === t2 && (a2 = rn2()), a2 !== t2) if (f4() !== t2) if ((c3 = zs()) !== t2) if (f4() !== t2) if (Ot() !== t2) if (f4() !== t2) if ((b4 = Te4()) !== t2) { for (d3 = [], h3 = e, (C5 = f4()) !== t2 && (A4 = ht2()) !== t2 && (_5 = f4()) !== t2 && (O4 = Te4()) !== t2 ? h3 = C5 = [C5, A4, _5, O4] : (e = h3, h3 = t2); h3 !== t2; ) d3.push(h3), h3 = e, (C5 = f4()) !== t2 && (A4 = ht2()) !== t2 && (_5 = f4()) !== t2 && (O4 = Te4()) !== t2 ? h3 = C5 = [C5, A4, _5, O4] : (e = h3, h3 = t2); d3 !== t2 && (h3 = f4()) !== t2 && (C5 = Nt()) !== t2 ? (w4 = s, M4 = u4, B5 = b4, j5 = d3, (k4 = a2).join = M4, k4.using = ze4(B5, j5), s = u4 = k4) : (e = s, s = t2); } else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; else e = s, s = t2; var M4, k4, B5, j5; return s === t2 && (s = e, (u4 = Ss()) !== t2 && f4() !== t2 ? ((a2 = er()) === t2 && (a2 = rn2()), a2 !== t2 && f4() !== t2 ? ((c3 = oa()) === t2 && (c3 = null), c3 !== t2 ? (w4 = s, u4 = (function(W4, K4, z5) { return K4.join = W4, K4.on = z5, K4; })(u4, a2, c3), s = u4) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2), s === t2 && (s = e, (u4 = Ss()) === t2 && (u4 = Mu()), u4 !== t2 && f4() !== t2 && (a2 = Ot()) !== t2 && f4() !== t2 && (c3 = Pn2()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((b4 = Dn2()) === t2 && (b4 = null), b4 !== t2 && (d3 = f4()) !== t2 ? ((h3 = oa()) === t2 && (h3 = null), h3 !== t2 ? (w4 = s, u4 = (function(W4, K4, z5, ot4) { return K4.parentheses = !0, { expr: K4, as: z5, join: W4, on: ot4 }; })(u4, c3, b4, h3), s = u4) : (e = s, s = t2)) : (e = s, s = t2)) : (e = s, s = t2))), s; })()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2)), n; } function er() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = (function() { var b4; return i2.substr(e, 4).toLowerCase() === "dual" ? (b4 = i2.substr(e, 4), e += 4) : (b4 = t2, l === 0 && v4(ev)), b4; })()) !== t2 && (w4 = n, r2 = { type: "dual" }), (n = r2) === t2 && (n = e, (r2 = de4()) !== t2 && f4() !== t2 ? ((o = Dn2()) === t2 && (o = null), o !== t2 ? (w4 = n, c3 = o, n = r2 = (a2 = r2).type === "var" ? (a2.as = c3, a2) : { db: a2.db, table: a2.table, as: c3, ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Ot()) !== t2 && f4() !== t2 && (o = de4()) !== t2 && f4() !== t2 ? ((s = Dn2()) === t2 && (s = null), s !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = (function(b4, d3, h3) { return b4.type === "var" ? (b4.as = d3, b4.parentheses = !0, b4) : { db: b4.db, table: b4.table, as: d3, parentheses: !0 }; })(o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Rs()) !== t2 && f4() !== t2 ? ((o = Dn2()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(b4, d3) { return { expr: { type: "values", values: b4, prefix: "row" }, as: d3 }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "lateral" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(af)), r2 === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && (o = Ot()) !== t2 && f4() !== t2 ? ((s = Pn2()) === t2 && (s = Rs()), s !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((u4 = Dn2()) === t2 && (u4 = null), u4 !== t2 ? (w4 = n, n = r2 = (function(b4, d3, h3) { Array.isArray(d3) && (d3 = { type: "values", values: d3, prefix: "row" }), d3.parentheses = !0; let C5 = { expr: d3, as: h3 }; return b4 && (C5.prefix = b4), C5; })(r2, s, u4)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2))))), n; } function Ss() { var n, r2, o, s; return n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "left" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(l0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (o = f4()) !== t2 ? ((s = Ia()) === t2 && (s = null), s !== t2 && f4() !== t2 && _o() !== t2 ? (w4 = n, n = r2 = "LEFT JOIN") : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "right" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(f0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (o = f4()) !== t2 ? ((s = Ia()) === t2 && (s = null), s !== t2 && f4() !== t2 && _o() !== t2 ? (w4 = n, n = r2 = "RIGHT JOIN") : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "full" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(p0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (o = f4()) !== t2 ? ((s = Ia()) === t2 && (s = null), s !== t2 && f4() !== t2 && _o() !== t2 ? (w4 = n, n = r2 = "FULL JOIN") : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "cross" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(v0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (o = f4()) !== t2 && (s = _o()) !== t2 ? (w4 = n, n = r2 = "CROSS JOIN") : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 13).toLowerCase() === "straight_join" ? (a2 = i2.substr(e, 13), e += 13) : (a2 = t2, l === 0 && v4(y0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (w4 = n, r2 = "STRAIGHT_JOIN"), (n = r2) === t2 && (n = e, r2 = e, (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "inner" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(b0)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) !== t2 && (s = f4()) !== t2 ? r2 = o = [o, s] : (e = r2, r2 = t2), r2 === t2 && (r2 = null), r2 !== t2 && (o = _o()) !== t2 ? (w4 = n, n = r2 = "INNER JOIN") : (e = n, n = t2)))))), n; } function de4() { var n, r2, o, s, u4, a2, c3, b4, d3; if (n = e, r2 = [], di.test(i2.charAt(e)) ? (o = i2.charAt(e), e++) : (o = t2, l === 0 && v4(hi)), o !== t2) for (; o !== t2; ) r2.push(o), di.test(i2.charAt(e)) ? (o = i2.charAt(e), e++) : (o = t2, l === 0 && v4(hi)); else r2 = t2; return r2 !== t2 && (o = da()) !== t2 ? (s = e, (u4 = f4()) !== t2 && (a2 = Pe4()) !== t2 && (c3 = f4()) !== t2 && (b4 = da()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2), s === t2 && (s = null), s !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { let _5 = `${h3.join("")}${C5}`, O4 = { db: null, table: _5 }; return A4 !== null && (O4.db = _5, O4.table = A4[3]), O4; })(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Jt2()) !== t2 ? (o = e, (s = f4()) !== t2 && (u4 = Pe4()) !== t2 && (a2 = f4()) !== t2 && (c3 = da()) !== t2 ? o = s = [s, u4, a2, c3] : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(h3, C5) { let A4 = { db: null, table: h3 }; return C5 !== null && (A4.db = h3, A4.table = C5[3]), A4; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Ve4()) !== t2 && (w4 = n, (d3 = r2).db = null, d3.table = d3.name, r2 = d3), n = r2)), n; } function oa() { var n, r2; return n = e, un2() !== t2 && f4() !== t2 && (r2 = xs()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function Ts() { var n, r2; return n = e, (function() { var o, s, u4, a2; return o = e, i2.substr(e, 5).toLowerCase() === "where" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(g0)), s !== t2 ? (u4 = e, l++, a2 = F6(), l--, a2 === t2 ? u4 = void 0 : (e = u4, u4 = t2), u4 !== t2 ? o = s = [s, u4] : (e = o, o = t2)) : (e = o, o = t2), o; })() !== t2 && f4() !== t2 && (r2 = rr()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function sa() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = he4()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = he4()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = he4()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Bv() { var n, r2; return n = e, xr() !== t2 && f4() !== t2 && Ta() !== t2 && f4() !== t2 && (r2 = _s()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function Sr() { var n, r2; return n = e, (function() { var o, s, u4, a2; return o = e, i2.substr(e, 5).toLowerCase() === "order" ? (s = i2.substr(e, 5), e += 5) : (s = t2, l === 0 && v4(S0)), s !== t2 ? (u4 = e, l++, a2 = F6(), l--, a2 === t2 ? u4 = void 0 : (e = u4, u4 = t2), u4 !== t2 ? o = s = [s, u4] : (e = o, o = t2)) : (e = o, o = t2), o; })() !== t2 && f4() !== t2 && Ta() !== t2 && f4() !== t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3; if (o = e, (s = ua()) !== t2) { for (u4 = [], a2 = e, (c3 = f4()) !== t2 && (b4 = ht2()) !== t2 && (d3 = f4()) !== t2 && (h3 = ua()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); a2 !== t2; ) u4.push(a2), a2 = e, (c3 = f4()) !== t2 && (b4 = ht2()) !== t2 && (d3 = f4()) !== t2 && (h3 = ua()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); u4 !== t2 ? (w4 = o, s = x5(s, u4), o = s) : (e = o, o = t2); } else e = o, o = t2; return o; })()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2), n; } function ua() { var n, r2, o; return n = e, (r2 = Xt()) !== t2 && f4() !== t2 ? ((o = kr()) === t2 && (o = Io()), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = { expr: r2, type: o }) : (e = n, n = t2)) : (e = n, n = t2), n; } function mc() { var n, r2; return (n = Oe4()) === t2 && (n = qs()) === t2 && (n = e, i2.charCodeAt(e) === 63 ? (r2 = "?", e++) : (r2 = t2, l === 0 && v4(fs2)), r2 !== t2 && (w4 = n, r2 = { type: "origin", value: "?" }), n = r2), n; } function mo() { var n, r2, o, s, u4, a2; return n = e, (function() { var c3, b4, d3, h3; return c3 = e, i2.substr(e, 5).toLowerCase() === "limit" ? (b4 = i2.substr(e, 5), e += 5) : (b4 = t2, l === 0 && v4(O0)), b4 !== t2 ? (d3 = e, l++, h3 = F6(), l--, h3 === t2 ? d3 = void 0 : (e = d3, d3 = t2), d3 !== t2 ? c3 = b4 = [b4, d3] : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3; })() !== t2 && f4() !== t2 && (r2 = mc()) !== t2 && f4() !== t2 ? (o = e, (s = ht2()) === t2 && (s = (function() { var c3, b4, d3, h3; return c3 = e, i2.substr(e, 6).toLowerCase() === "offset" ? (b4 = i2.substr(e, 6), e += 6) : (b4 = t2, l === 0 && v4(N0)), b4 !== t2 ? (d3 = e, l++, h3 = F6(), l--, h3 === t2 ? d3 = void 0 : (e = d3, d3 = t2), d3 !== t2 ? (w4 = c3, c3 = b4 = "OFFSET") : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3; })()), s !== t2 && (u4 = f4()) !== t2 && (a2 = mc()) !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = (function(c3, b4) { let d3 = [c3]; return b4 && d3.push(b4[2]), { seperator: b4 && b4[0] && b4[0].toLowerCase() || "", value: d3, ...ee5() }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n; } function Lo() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = aa()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = aa()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = aa()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function aa() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, r2 = e, (o = Jt2()) !== t2 && (s = f4()) !== t2 && (u4 = Pe4()) !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2), r2 === t2 && (r2 = null), r2 !== t2 && (o = f4()) !== t2 && (s = Tr()) !== t2 && (u4 = f4()) !== t2 ? (i2.charCodeAt(e) === 61 ? (a2 = "=", e++) : (a2 = t2, l === 0 && v4(ps)), a2 !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 ? (w4 = n, n = r2 = { column: s, value: c3, table: (d3 = r2) && d3[0] }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, r2 = e, (o = Jt2()) !== t2 && (s = f4()) !== t2 && (u4 = Pe4()) !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2), r2 === t2 && (r2 = null), r2 !== t2 && (o = f4()) !== t2 && (s = Tr()) !== t2 && (u4 = f4()) !== t2 ? (i2.charCodeAt(e) === 61 ? (a2 = "=", e++) : (a2 = t2, l === 0 && v4(ps)), a2 !== t2 && f4() !== t2 && (c3 = Sa()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (b4 = he4()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = (function(h3, C5, A4) { return { column: C5, value: A4, table: h3 && h3[0], keyword: "values" }; })(r2, s, b4)) : (e = n, n = t2)) : (e = n, n = t2)), n; } function Lc() { var n, r2; return (n = Rs()) === t2 && (n = e, (r2 = Pn2()) !== t2 && (w4 = n, r2 = r2.ast), n = r2), n; } function Os() { var n, r2, o, s, u4, a2, c3, b4, d3; if (n = e, xr() !== t2) if (f4() !== t2) if ((r2 = Ot()) !== t2) if (f4() !== t2) if ((o = ue4()) !== t2) { for (s = [], u4 = e, (a2 = f4()) !== t2 && (c3 = ht2()) !== t2 && (b4 = f4()) !== t2 && (d3 = ue4()) !== t2 ? u4 = a2 = [a2, c3, b4, d3] : (e = u4, u4 = t2); u4 !== t2; ) s.push(u4), u4 = e, (a2 = f4()) !== t2 && (c3 = ht2()) !== t2 && (b4 = f4()) !== t2 && (d3 = ue4()) !== t2 ? u4 = a2 = [a2, c3, b4, d3] : (e = u4, u4 = t2); s !== t2 && (u4 = f4()) !== t2 && (a2 = Nt()) !== t2 ? (w4 = n, n = Ne4(o, s)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; return n === t2 && (n = e, xr() !== t2 && f4() !== t2 && (r2 = Co()) !== t2 ? (w4 = n, n = r2) : (e = n, n = t2)), n; } function ia() { var n, r2, o; return n = e, un2() !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "duplicate" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(lf)), r2 !== t2 && f4() !== t2 && Mr() !== t2 && f4() !== t2 && Bn2() !== t2 && f4() !== t2 && (o = Lo()) !== t2 ? (w4 = n, n = { keyword: "on duplicate key update", set: o }) : (e = n, n = t2)) : (e = n, n = t2), n; } function Ns() { var n, r2; return n = e, (r2 = Ea()) !== t2 && (w4 = n, r2 = "insert"), (n = r2) === t2 && (n = e, (r2 = Aa()) !== t2 && (w4 = n, r2 = "replace"), n = r2), n; } function Rs() { var n, r2; return n = e, Sa() !== t2 && f4() !== t2 && (r2 = (function() { var o, s, u4, a2, c3, b4, d3, h3; if (o = e, (s = Co()) !== t2) { for (u4 = [], a2 = e, (c3 = f4()) !== t2 && (b4 = ht2()) !== t2 && (d3 = f4()) !== t2 && (h3 = Co()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); a2 !== t2; ) u4.push(a2), a2 = e, (c3 = f4()) !== t2 && (b4 = ht2()) !== t2 && (d3 = f4()) !== t2 && (h3 = Co()) !== t2 ? a2 = c3 = [c3, b4, d3, h3] : (e = a2, a2 = t2); u4 !== t2 ? (w4 = o, s = x5(s, u4), o = s) : (e = o, o = t2); } else e = o, o = t2; return o; })()) !== t2 ? (w4 = n, n = { type: "values", values: r2 }) : (e = n, n = t2), n; } function Co() { var n, r2, o, s, u4; return n = e, i2.substr(e, 3).toLowerCase() === "row" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(le3)), r2 === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (o = nr()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, s = r2, (u4 = o).prefix = s && s.toLowerCase(), n = r2 = u4) : (e = n, n = t2), n; } function nr() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Xt()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { let C5 = { type: "expr_list" }; return C5.value = ze4(d3, h3), C5; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function ca() { var n, r2, o; return n = e, el() !== t2 && f4() !== t2 && (r2 = Xt()) !== t2 && f4() !== t2 && (o = (function() { var s; return (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "year" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(Ou)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "YEAR") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 7).toLowerCase() === "quarter" ? (a2 = i2.substr(e, 7), e += 7) : (a2 = t2, l === 0 && v4(Qi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "QUARTER") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 5).toLowerCase() === "month" ? (a2 = i2.substr(e, 5), e += 5) : (a2 = t2, l === 0 && v4(Xi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MONTH") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "week" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(tc)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "WEEK") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 3).toLowerCase() === "day" ? (a2 = i2.substr(e, 3), e += 3) : (a2 = t2, l === 0 && v4(Wi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "DAY") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "hour" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(zi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "HOUR") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 6).toLowerCase() === "minute" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(Ki)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MINUTE") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 6).toLowerCase() === "second" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(Zi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "SECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 11).toLowerCase() === "microsecond" ? (a2 = i2.substr(e, 11), e += 11) : (a2 = t2, l === 0 && v4(jb)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MICROSECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 18).toLowerCase() === "second_microsecond" ? (a2 = i2.substr(e, 18), e += 18) : (a2 = t2, l === 0 && v4(Hi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "SECOND_MICROSECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 18).toLowerCase() === "minute_microsecond" ? (a2 = i2.substr(e, 18), e += 18) : (a2 = t2, l === 0 && v4($i)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MINUTE_MICROSECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 13).toLowerCase() === "minute_second" ? (a2 = i2.substr(e, 13), e += 13) : (a2 = t2, l === 0 && v4(Yi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MINUTE_SECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 16).toLowerCase() === "hour_microsecond" ? (a2 = i2.substr(e, 16), e += 16) : (a2 = t2, l === 0 && v4(Gi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "HOUR_MICROSECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 11).toLowerCase() === "hour_second" ? (a2 = i2.substr(e, 11), e += 11) : (a2 = t2, l === 0 && v4(Fi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "HOUR_SECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 11).toLowerCase() === "hour_minute" ? (a2 = i2.substr(e, 11), e += 11) : (a2 = t2, l === 0 && v4(Bi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "HOUR_MINUTE") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 15).toLowerCase() === "day_microsecond" ? (a2 = i2.substr(e, 15), e += 15) : (a2 = t2, l === 0 && v4(qi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "DAY_MICROSECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 10).toLowerCase() === "day_second" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(Di)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "DAY_SECOND") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 10).toLowerCase() === "day_minute" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(Pi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "DAY_MINUTE") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 8).toLowerCase() === "day_hour" ? (a2 = i2.substr(e, 8), e += 8) : (a2 = t2, l === 0 && v4(Mi)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "DAY_HOUR") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 10).toLowerCase() === "year_month" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(Ui)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "YEAR_MONTH") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()), s; })()) !== t2 ? (w4 = n, n = { type: "interval", expr: r2, unit: o.toLowerCase() }) : (e = n, n = t2), n; } function Cc() { var n, r2, o, s, u4, a2; if (n = e, (r2 = la()) !== t2) if (f4() !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = la()) !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = la()) !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = oe5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; return n; } function la() { var n, r2, o; return n = e, (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 4).toLowerCase() === "when" ? (u4 = i2.substr(e, 4), e += 4) : (u4 = t2, l === 0 && v4(J0)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2)) : (e = s, s = t2), s; })() !== t2 && f4() !== t2 && (r2 = rr()) !== t2 && f4() !== t2 && (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 4).toLowerCase() === "then" ? (u4 = i2.substr(e, 4), e += 4) : (u4 = t2, l === 0 && v4(tb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2)) : (e = s, s = t2), s; })() !== t2 && f4() !== t2 && (o = Xt()) !== t2 ? (w4 = n, n = { type: "when", cond: r2, result: o }) : (e = n, n = t2), n; } function Ec() { var n, r2; return n = e, (function() { var o, s, u4, a2; return o = e, i2.substr(e, 4).toLowerCase() === "else" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(eb)), s !== t2 ? (u4 = e, l++, a2 = F6(), l--, a2 === t2 ? u4 = void 0 : (e = u4, u4 = t2), u4 !== t2 ? o = s = [s, u4] : (e = o, o = t2)) : (e = o, o = t2), o; })() !== t2 && f4() !== t2 && (r2 = Xt()) !== t2 ? (w4 = n, n = { type: "else", result: r2 }) : (e = n, n = t2), n; } function Xt() { var n; return (n = (function() { var r2, o, s, u4, a2, c3, b4, d3; if (r2 = e, (o = fa()) !== t2) { for (s = [], u4 = e, (a2 = nu()) !== t2 && (c3 = Cn2()) !== t2 && (b4 = f4()) !== t2 && (d3 = fa()) !== t2 ? u4 = a2 = [a2, c3, b4, d3] : (e = u4, u4 = t2); u4 !== t2; ) s.push(u4), u4 = e, (a2 = nu()) !== t2 && (c3 = Cn2()) !== t2 && (b4 = f4()) !== t2 && (d3 = fa()) !== t2 ? u4 = a2 = [a2, c3, b4, d3] : (e = u4, u4 = t2); s !== t2 ? (w4 = r2, o = Iu(o, s), r2 = o) : (e = r2, r2 = t2); } else e = r2, r2 = t2; return r2; })()) === t2 && (n = Pn2()), n; } function xs() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Xt()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 ? ((a2 = Ge4()) === t2 && (a2 = Cn2()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 ? ((a2 = Ge4()) === t2 && (a2 = Cn2()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { let C5 = h3.length, A4 = d3; for (let _5 = 0; _5 < C5; ++_5) A4 = ln2(h3[_5][1], A4, h3[_5][3]); return A4; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function rr() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Xt()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 ? ((a2 = Ge4()) === t2 && (a2 = Cn2()) === t2 && (a2 = ht2()) === t2 && (a2 = Pr()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 ? ((a2 = Ge4()) === t2 && (a2 = Cn2()) === t2 && (a2 = ht2()) === t2 && (a2 = Pr()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Xt()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { let C5 = h3.length, A4 = d3, _5 = ""; for (let O4 = 0; O4 < C5; ++O4) h3[O4][1] === "," ? (_5 = ",", Array.isArray(A4) || (A4 = [A4]), A4.push(h3[O4][3])) : A4 = ln2(h3[O4][1], A4, h3[O4][3]); if (_5 === ",") { let O4 = { type: "expr_list" }; return O4.value = Array.isArray(A4) ? A4 : [A4], O4; } return A4; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function fa() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = js()) !== t2) { for (o = [], s = e, (u4 = nu()) !== t2 && (a2 = Ge4()) !== t2 && (c3 = f4()) !== t2 && (b4 = js()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = nu()) !== t2 && (a2 = Ge4()) !== t2 && (c3 = f4()) !== t2 && (b4 = js()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = Gn2(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function js() { var n, r2; return (n = Ac()) === t2 && (n = (function() { var o, s, u4; o = e, (s = (function() { var b4, d3, h3, C5, A4; return b4 = e, d3 = e, (h3 = cn2()) !== t2 && (C5 = f4()) !== t2 && (A4 = ja()) !== t2 ? d3 = h3 = [h3, C5, A4] : (e = d3, d3 = t2), d3 !== t2 && (w4 = b4, d3 = bs(d3)), (b4 = d3) === t2 && (b4 = ja()), b4; })()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (u4 = Pn2()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = o, a2 = s, (c3 = u4).parentheses = !0, s = Qa(a2, c3), o = s) : (e = o, o = t2); var a2, c3; return o; })()) === t2 && (n = e, cn2() !== t2 && f4() !== t2 && (r2 = js()) !== t2 ? (w4 = n, n = Qa("NOT", r2)) : (e = n, n = t2)), n; } function Ac() { var n, r2, o; return n = e, (r2 = or()) !== t2 && f4() !== t2 ? ((o = (function() { var s; return (s = (function() { var u4, a2, c3, b4, d3, h3, C5; if (u4 = e, a2 = [], c3 = e, (b4 = f4()) !== t2 && (d3 = gc()) !== t2 && (h3 = f4()) !== t2 && (C5 = or()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2), c3 !== t2) for (; c3 !== t2; ) a2.push(c3), c3 = e, (b4 = f4()) !== t2 && (d3 = gc()) !== t2 && (h3 = f4()) !== t2 && (C5 = or()) !== t2 ? c3 = b4 = [b4, d3, h3, C5] : (e = c3, c3 = t2); else a2 = t2; return a2 !== t2 && (c3 = f4()) !== t2 ? ((b4 = pa()) === t2 && (b4 = null), b4 !== t2 ? (w4 = u4, u4 = a2 = { type: "arithmetic", tail: a2, in: b4 }) : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (s = pa()) === t2 && (s = (function() { var u4, a2, c3, b4; return u4 = e, (a2 = (function() { var d3, h3, C5, A4, _5; return d3 = e, h3 = e, (C5 = cn2()) !== t2 && (A4 = f4()) !== t2 && (_5 = Ra()) !== t2 ? h3 = C5 = [C5, A4, _5] : (e = h3, h3 = t2), h3 !== t2 && (w4 = d3, h3 = bs(h3)), (d3 = h3) === t2 && (d3 = Ra()), d3; })()) !== t2 && f4() !== t2 && (c3 = or()) !== t2 && f4() !== t2 && Ge4() !== t2 && f4() !== t2 && (b4 = or()) !== t2 ? (w4 = u4, u4 = a2 = { op: a2, right: { type: "expr_list", value: [c3, b4] } }) : (e = u4, u4 = t2), u4; })()) === t2 && (s = (function() { var u4, a2, c3, b4, d3; return u4 = e, (a2 = Kc()) !== t2 && (c3 = f4()) !== t2 && (b4 = or()) !== t2 ? (w4 = u4, u4 = a2 = { op: "IS", right: b4 }) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, a2 = e, (c3 = Kc()) !== t2 && (b4 = f4()) !== t2 && (d3 = cn2()) !== t2 ? a2 = c3 = [c3, b4, d3] : (e = a2, a2 = t2), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = or()) !== t2 ? (w4 = u4, a2 = /* @__PURE__ */ (function(h3) { return { op: "IS NOT", right: h3 }; })(b4), u4 = a2) : (e = u4, u4 = t2)), u4; })()) === t2 && (s = Ic()) === t2 && (s = (function() { var u4, a2, c3, b4; u4 = e, (a2 = (function() { var C5, A4, _5; C5 = e, (A4 = cn2()) === t2 && (A4 = null), A4 !== t2 && f4() !== t2 ? ((_5 = (function() { var k4, B5, j5, W4; return k4 = e, i2.substr(e, 6).toLowerCase() === "regexp" ? (B5 = i2.substr(e, 6), e += 6) : (B5 = t2, l === 0 && v4(B0)), B5 !== t2 ? (j5 = e, l++, W4 = F6(), l--, W4 === t2 ? j5 = void 0 : (e = j5, j5 = t2), j5 !== t2 ? (w4 = k4, k4 = B5 = "REGEXP") : (e = k4, k4 = t2)) : (e = k4, k4 = t2), k4; })()) === t2 && (_5 = (function() { var k4, B5, j5, W4; return k4 = e, i2.substr(e, 5).toLowerCase() === "rlike" ? (B5 = i2.substr(e, 5), e += 5) : (B5 = t2, l === 0 && v4(q0)), B5 !== t2 ? (j5 = e, l++, W4 = F6(), l--, W4 === t2 ? j5 = void 0 : (e = j5, j5 = t2), j5 !== t2 ? (w4 = k4, k4 = B5 = "RLIKE") : (e = k4, k4 = t2)) : (e = k4, k4 = t2), k4; })()), _5 !== t2 ? (w4 = C5, M4 = _5, C5 = A4 = (O4 = A4) ? `${O4} ${M4}` : M4) : (e = C5, C5 = t2)) : (e = C5, C5 = t2); var O4, M4; return C5; })()) !== t2 && f4() !== t2 ? (i2.substr(e, 6).toLowerCase() === "binary" ? (c3 = i2.substr(e, 6), e += 6) : (c3 = t2, l === 0 && v4(p3)), c3 === t2 && (c3 = null), c3 !== t2 && f4() !== t2 ? ((b4 = Dc()) === t2 && (b4 = Le4()) === t2 && (b4 = he4()), b4 !== t2 ? (w4 = u4, d3 = a2, u4 = a2 = { op: (h3 = c3) ? `${d3} ${h3}` : d3, right: b4 }) : (e = u4, u4 = t2)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2); var d3, h3; return u4; })()), s; })()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(s, u4) { if (u4 === null) return s; if (u4.type === "arithmetic") { if (!u4.in) return Gn2(s, u4.tail); let a2 = Gn2(s, u4.tail); return ln2(u4.in.op, a2, u4.in.right); } return ln2(u4.op, s, u4.right); })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = Le4()) === t2 && (n = he4()), n; } function gc() { var n; return i2.substr(e, 2) === ">=" ? (n = ">=", e += 2) : (n = t2, l === 0 && v4(ff)), n === t2 && (i2.charCodeAt(e) === 62 ? (n = ">", e++) : (n = t2, l === 0 && v4(pf)), n === t2 && (i2.substr(e, 2) === "<=" ? (n = "<=", e += 2) : (n = t2, l === 0 && v4(bf)), n === t2 && (i2.substr(e, 2) === "<>" ? (n = "<>", e += 2) : (n = t2, l === 0 && v4(vf)), n === t2 && (i2.charCodeAt(e) === 60 ? (n = "<", e++) : (n = t2, l === 0 && v4(yf)), n === t2 && (i2.charCodeAt(e) === 61 ? (n = "=", e++) : (n = t2, l === 0 && v4(ps)), n === t2 && (i2.substr(e, 2) === "!=" ? (n = "!=", e += 2) : (n = t2, l === 0 && v4(df)))))))), n; } function _c() { var n, r2, o, s, u4; return n = e, r2 = e, (o = cn2()) !== t2 && (s = f4()) !== t2 && (u4 = So()) !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2), r2 !== t2 && (w4 = n, r2 = bs(r2)), (n = r2) === t2 && (n = So()), n; } function Ic() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = (function() { var b4, d3, h3, C5, A4; return b4 = e, d3 = e, (h3 = cn2()) !== t2 && (C5 = f4()) !== t2 && (A4 = xa()) !== t2 ? d3 = h3 = [h3, C5, A4] : (e = d3, d3 = t2), d3 !== t2 && (w4 = b4, d3 = bs(d3)), (b4 = d3) === t2 && (b4 = xa()), b4; })()) !== t2 && f4() !== t2 ? ((o = Or()) === t2 && (o = qs()) === t2 && (o = Ac()), o !== t2 && f4() !== t2 ? ((s = (function() { var b4, d3, h3; return b4 = e, i2.substr(e, 6).toLowerCase() === "escape" ? (d3 = i2.substr(e, 6), e += 6) : (d3 = t2, l === 0 && v4(hf)), d3 !== t2 && f4() !== t2 && (h3 = Le4()) !== t2 ? (w4 = b4, b4 = d3 = { type: "ESCAPE", value: h3 }) : (e = b4, b4 = t2), b4; })()) === t2 && (s = null), s !== t2 ? (w4 = n, u4 = r2, a2 = o, (c3 = s) && (a2.escape = c3), n = r2 = { op: u4, right: a2 }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n; } function pa() { var n, r2, o, s; return n = e, (r2 = _c()) !== t2 && f4() !== t2 && (o = Ot()) !== t2 && f4() !== t2 && (s = nr()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = { op: r2, right: s }) : (e = n, n = t2), n === t2 && (n = e, (r2 = _c()) !== t2 && f4() !== t2 ? ((o = Ve4()) === t2 && (o = he4()) === t2 && (o = Le4()), o !== t2 ? (w4 = n, n = r2 = /* @__PURE__ */ (function(u4, a2) { return { op: u4, right: a2 }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2)), n; } function or() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = ba()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ks()) !== t2 && (c3 = f4()) !== t2 && (b4 = ba()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ks()) !== t2 && (c3 = f4()) !== t2 && (b4 = ba()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { if (h3 && h3.length && d3.type === "column_ref" && d3.column === "*") throw new Error(JSON.stringify({ message: "args could not be star column in additive expr", ...ee5() })); return Gn2(d3, h3); })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function ks() { var n; return i2.charCodeAt(e) === 43 ? (n = "+", e++) : (n = t2, l === 0 && v4(vs)), n === t2 && (i2.charCodeAt(e) === 45 ? (n = "-", e++) : (n = t2, l === 0 && v4(ys))), n; } function ba() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Ms()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 ? ((a2 = Us()) === t2 && (a2 = Pr()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Ms()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 ? ((a2 = Us()) === t2 && (a2 = Pr()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Ms()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2)) : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = Gn2(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Us() { var n, r2; return i2.charCodeAt(e) === 42 ? (n = "*", e++) : (n = t2, l === 0 && v4(Su)), n === t2 && (i2.charCodeAt(e) === 47 ? (n = "/", e++) : (n = t2, l === 0 && v4(wf)), n === t2 && (i2.charCodeAt(e) === 37 ? (n = "%", e++) : (n = t2, l === 0 && v4(mf)), n === t2 && (i2.substr(e, 2) === "||" ? (n = "||", e += 2) : (n = t2, l === 0 && v4(wi)), n === t2 && (n = e, i2.substr(e, 3).toLowerCase() === "div" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Lf)), r2 === t2 && (i2.substr(e, 3).toLowerCase() === "mod" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Cf))), r2 !== t2 && (w4 = n, r2 = r2.toUpperCase()), (n = r2) === t2 && (i2.charCodeAt(e) === 38 ? (n = "&", e++) : (n = t2, l === 0 && v4(Ef)), n === t2 && (i2.substr(e, 2) === ">>" ? (n = ">>", e += 2) : (n = t2, l === 0 && v4(Af)), n === t2 && (i2.substr(e, 2) === "<<" ? (n = "<<", e += 2) : (n = t2, l === 0 && v4(gf)), n === t2 && (i2.charCodeAt(e) === 94 ? (n = "^", e++) : (n = t2, l === 0 && v4(_f)), n === t2 && (i2.charCodeAt(e) === 124 ? (n = "|", e++) : (n = t2, l === 0 && v4(If))))))))))), n; } function Ms() { var n, r2, o, s, u4; return (n = (function() { var a2, c3, b4, d3, h3, C5, A4, _5; if (a2 = e, (c3 = va()) !== t2) if (f4() !== t2) { for (b4 = [], d3 = e, (h3 = f4()) !== t2 ? (i2.substr(e, 2) === "?|" ? (C5 = "?|", e += 2) : (C5 = t2, l === 0 && v4(mi)), C5 === t2 && (i2.substr(e, 2) === "?&" ? (C5 = "?&", e += 2) : (C5 = t2, l === 0 && v4(Li)), C5 === t2 && (i2.charCodeAt(e) === 63 ? (C5 = "?", e++) : (C5 = t2, l === 0 && v4(fs2)), C5 === t2 && (i2.substr(e, 2) === "#-" ? (C5 = "#-", e += 2) : (C5 = t2, l === 0 && v4(Ci)), C5 === t2 && (i2.substr(e, 3) === "#>>" ? (C5 = "#>>", e += 3) : (C5 = t2, l === 0 && v4(Ei)), C5 === t2 && (i2.substr(e, 2) === "#>" ? (C5 = "#>", e += 2) : (C5 = t2, l === 0 && v4(Ai)), C5 === t2 && (C5 = fl()) === t2 && (C5 = ll()) === t2 && (i2.substr(e, 2) === "@>" ? (C5 = "@>", e += 2) : (C5 = t2, l === 0 && v4(gi)), C5 === t2 && (i2.substr(e, 2) === "<@" ? (C5 = "<@", e += 2) : (C5 = t2, l === 0 && v4(_i))))))))), C5 !== t2 && (A4 = f4()) !== t2 && (_5 = va()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2)) : (e = d3, d3 = t2); d3 !== t2; ) b4.push(d3), d3 = e, (h3 = f4()) !== t2 ? (i2.substr(e, 2) === "?|" ? (C5 = "?|", e += 2) : (C5 = t2, l === 0 && v4(mi)), C5 === t2 && (i2.substr(e, 2) === "?&" ? (C5 = "?&", e += 2) : (C5 = t2, l === 0 && v4(Li)), C5 === t2 && (i2.charCodeAt(e) === 63 ? (C5 = "?", e++) : (C5 = t2, l === 0 && v4(fs2)), C5 === t2 && (i2.substr(e, 2) === "#-" ? (C5 = "#-", e += 2) : (C5 = t2, l === 0 && v4(Ci)), C5 === t2 && (i2.substr(e, 3) === "#>>" ? (C5 = "#>>", e += 3) : (C5 = t2, l === 0 && v4(Ei)), C5 === t2 && (i2.substr(e, 2) === "#>" ? (C5 = "#>", e += 2) : (C5 = t2, l === 0 && v4(Ai)), C5 === t2 && (C5 = fl()) === t2 && (C5 = ll()) === t2 && (i2.substr(e, 2) === "@>" ? (C5 = "@>", e += 2) : (C5 = t2, l === 0 && v4(gi)), C5 === t2 && (i2.substr(e, 2) === "<@" ? (C5 = "<@", e += 2) : (C5 = t2, l === 0 && v4(_i))))))))), C5 !== t2 && (A4 = f4()) !== t2 && (_5 = va()) !== t2 ? d3 = h3 = [h3, C5, A4, _5] : (e = d3, d3 = t2)) : (e = d3, d3 = t2); b4 !== t2 && (d3 = f4()) !== t2 ? ((h3 = tr()) === t2 && (h3 = null), h3 !== t2 ? (w4 = a2, c3 = (function(O4, M4, k4) { let B5 = O4; return M4 && M4.length > 0 && (B5 = Gn2(O4, M4)), k4 && (B5.collate = k4), B5; })(c3, b4, h3), a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2); } else e = a2, a2 = t2; else e = a2, a2 = t2; return a2; })()) === t2 && (n = e, (r2 = (function() { var a2; return i2.charCodeAt(e) === 33 ? (a2 = "!", e++) : (a2 = t2, l === 0 && v4(Sf)), a2 === t2 && (i2.charCodeAt(e) === 45 ? (a2 = "-", e++) : (a2 = t2, l === 0 && v4(ys)), a2 === t2 && (i2.charCodeAt(e) === 43 ? (a2 = "+", e++) : (a2 = t2, l === 0 && v4(vs)), a2 === t2 && (i2.charCodeAt(e) === 126 ? (a2 = "~", e++) : (a2 = t2, l === 0 && v4(Tf))))), a2; })()) !== t2 ? (o = e, (s = f4()) !== t2 && (u4 = Ms()) !== t2 ? o = s = [s, u4] : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = Qa(r2, o[1])) : (e = n, n = t2)) : (e = n, n = t2)), n; } function va() { var n, r2, o, s; return (n = ca()) === t2 && (n = (function() { var u4; return (u4 = (function() { var a2, c3, b4, d3; return a2 = e, (c3 = (function() { var h3, C5, A4, _5; return h3 = e, i2.substr(e, 5).toLowerCase() === "count" ? (C5 = i2.substr(e, 5), e += 5) : (C5 = t2, l === 0 && v4($0)), C5 !== t2 ? (A4 = e, l++, _5 = F6(), l--, _5 === t2 ? A4 = void 0 : (e = A4, A4 = t2), A4 !== t2 ? (w4 = h3, h3 = C5 = "COUNT") : (e = h3, h3 = t2)) : (e = h3, h3 = t2), h3; })()) === t2 && (c3 = (function() { var h3, C5, A4, _5; return h3 = e, i2.substr(e, 12).toLowerCase() === "group_concat" ? (C5 = i2.substr(e, 12), e += 12) : (C5 = t2, l === 0 && v4(H0)), C5 !== t2 ? (A4 = e, l++, _5 = F6(), l--, _5 === t2 ? A4 = void 0 : (e = A4, A4 = t2), A4 !== t2 ? (w4 = h3, h3 = C5 = "GROUP_CONCAT") : (e = h3, h3 = t2)) : (e = h3, h3 = t2), h3; })()), c3 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (b4 = (function() { var h3, C5, A4, _5, O4; return h3 = e, (C5 = (function() { var M4, k4; return M4 = e, i2.charCodeAt(e) === 42 ? (k4 = "*", e++) : (k4 = t2, l === 0 && v4(Su)), k4 !== t2 && (w4 = M4, k4 = { type: "star", value: "*" }), M4 = k4; })()) !== t2 && (w4 = h3, C5 = { expr: C5, ...ee5() }), (h3 = C5) === t2 && (h3 = e, (C5 = Na()) === t2 && (C5 = null), C5 !== t2 && f4() !== t2 && (A4 = rr()) !== t2 && f4() !== t2 ? ((_5 = Sr()) === t2 && (_5 = null), _5 !== t2 && f4() !== t2 ? ((O4 = (function() { var M4, k4, B5; return M4 = e, i2.substr(e, 9).toLowerCase() === "separator" ? (k4 = i2.substr(e, 9), e += 9) : (k4 = t2, l === 0 && v4(Bf)), k4 === t2 && (k4 = null), k4 !== t2 && f4() !== t2 && (B5 = Le4()) !== t2 ? (w4 = M4, M4 = k4 = { keyword: k4, value: B5 }) : (e = M4, M4 = t2), M4; })()) === t2 && (O4 = null), O4 !== t2 ? (w4 = h3, C5 = { distinct: C5, expr: A4, orderby: _5, separator: O4, ...ee5() }, h3 = C5) : (e = h3, h3 = t2)) : (e = h3, h3 = t2)) : (e = h3, h3 = t2)), h3; })()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((d3 = Bs()) === t2 && (d3 = null), d3 !== t2 ? (w4 = a2, c3 = { type: "aggr_func", name: c3, args: b4, over: d3, ...ee5() }, a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()) === t2 && (u4 = (function() { var a2, c3, b4, d3; return a2 = e, (c3 = (function() { var h3; return (h3 = (function() { var C5, A4, _5, O4; return C5 = e, i2.substr(e, 3).toLowerCase() === "sum" ? (A4 = i2.substr(e, 3), e += 3) : (A4 = t2, l === 0 && v4(z0)), A4 !== t2 ? (_5 = e, l++, O4 = F6(), l--, O4 === t2 ? _5 = void 0 : (e = _5, _5 = t2), _5 !== t2 ? (w4 = C5, C5 = A4 = "SUM") : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5; })()) === t2 && (h3 = (function() { var C5, A4, _5, O4; return C5 = e, i2.substr(e, 3).toLowerCase() === "max" ? (A4 = i2.substr(e, 3), e += 3) : (A4 = t2, l === 0 && v4(W0)), A4 !== t2 ? (_5 = e, l++, O4 = F6(), l--, O4 === t2 ? _5 = void 0 : (e = _5, _5 = t2), _5 !== t2 ? (w4 = C5, C5 = A4 = "MAX") : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5; })()) === t2 && (h3 = (function() { var C5, A4, _5, O4; return C5 = e, i2.substr(e, 3).toLowerCase() === "min" ? (A4 = i2.substr(e, 3), e += 3) : (A4 = t2, l === 0 && v4(V0)), A4 !== t2 ? (_5 = e, l++, O4 = F6(), l--, O4 === t2 ? _5 = void 0 : (e = _5, _5 = t2), _5 !== t2 ? (w4 = C5, C5 = A4 = "MIN") : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5; })()) === t2 && (h3 = (function() { var C5, A4, _5, O4; return C5 = e, i2.substr(e, 3).toLowerCase() === "avg" ? (A4 = i2.substr(e, 3), e += 3) : (A4 = t2, l === 0 && v4(K0)), A4 !== t2 ? (_5 = e, l++, O4 = F6(), l--, O4 === t2 ? _5 = void 0 : (e = _5, _5 = t2), _5 !== t2 ? (w4 = C5, C5 = A4 = "AVG") : (e = C5, C5 = t2)) : (e = C5, C5 = t2), C5; })()), h3; })()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (b4 = xs()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 ? ((d3 = Bs()) === t2 && (d3 = null), d3 !== t2 ? (w4 = a2, c3 = { type: "aggr_func", name: c3, args: { expr: b4 }, over: d3, ...ee5() }, a2 = c3) : (e = a2, a2 = t2)) : (e = a2, a2 = t2), a2; })()), u4; })()) === t2 && (n = wc()) === t2 && (n = Dc()) === t2 && (n = (function() { var u4, a2, c3, b4, d3, h3, C5; u4 = e, (a2 = To()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (b4 = Xa()) !== t2 && f4() !== t2 && (d3 = po()) !== t2 && f4() !== t2 && (h3 = Te4()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = u4, a2 = (function(O4, M4, k4, B5, j5) { let { dataType: W4, length: K4 } = k4, z5 = W4; return K4 !== void 0 && (z5 = `${z5}(${K4})`), { type: "cast", keyword: O4.toLowerCase(), expr: M4, symbol: "as", target: [{ dataType: z5, suffix: [{ type: "origin", value: B5 }, j5] }] }; })(a2, c3, b4, d3, h3), u4 = a2) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, (a2 = To()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (b4 = Ka()) !== t2 && f4() !== t2 && (d3 = Nt()) !== t2 ? (w4 = u4, A4 = c3, _5 = b4, a2 = { type: "cast", keyword: a2.toLowerCase(), expr: A4, symbol: "as", target: [_5] }, u4 = a2) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, (a2 = To()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (b4 = Oo()) !== t2 && f4() !== t2 && (d3 = Ot()) !== t2 && f4() !== t2 && (h3 = sr()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 && (C5 = Nt()) !== t2 ? (w4 = u4, a2 = (function(O4, M4, k4) { return { type: "cast", keyword: O4.toLowerCase(), expr: M4, symbol: "as", target: [{ dataType: "DECIMAL(" + k4 + ")" }] }; })(a2, c3, h3), u4 = a2) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, (a2 = To()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (b4 = Oo()) !== t2 && f4() !== t2 && (d3 = Ot()) !== t2 && f4() !== t2 && (h3 = sr()) !== t2 && f4() !== t2 && ht2() !== t2 && f4() !== t2 && (C5 = sr()) !== t2 && f4() !== t2 && Nt() !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = u4, a2 = (function(O4, M4, k4, B5) { return { type: "cast", keyword: O4.toLowerCase(), expr: M4, symbol: "as", target: [{ dataType: "DECIMAL(" + k4 + ", " + B5 + ")" }] }; })(a2, c3, h3, C5), u4 = a2) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, (a2 = To()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (c3 = Xt()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (b4 = ma()) !== t2 && f4() !== t2 ? ((d3 = Xs()) === t2 && (d3 = null), d3 !== t2 && f4() !== t2 && (h3 = Nt()) !== t2 ? (w4 = u4, a2 = (function(O4, M4, k4, B5) { return { type: "cast", keyword: O4.toLowerCase(), expr: M4, symbol: "as", target: [{ dataType: [k4, B5].filter(Boolean).join(" ") }] }; })(a2, c3, b4, d3), u4 = a2) : (e = u4, u4 = t2)) : (e = u4, u4 = t2))))); var A4, _5; return u4; })()) === t2 && (n = (function() { var u4, a2, c3, b4, d3, h3, C5, A4; return u4 = e, Ks() !== t2 && f4() !== t2 && (a2 = Cc()) !== t2 && f4() !== t2 ? ((c3 = Ec()) === t2 && (c3 = null), c3 !== t2 && f4() !== t2 && (b4 = Qc()) !== t2 && f4() !== t2 ? ((d3 = Ks()) === t2 && (d3 = null), d3 !== t2 ? (w4 = u4, C5 = a2, (A4 = c3) && C5.push(A4), u4 = { type: "case", expr: null, args: C5 }) : (e = u4, u4 = t2)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4 === t2 && (u4 = e, Ks() !== t2 && f4() !== t2 && (a2 = Xt()) !== t2 && f4() !== t2 && (c3 = Cc()) !== t2 && f4() !== t2 ? ((b4 = Ec()) === t2 && (b4 = null), b4 !== t2 && f4() !== t2 && (d3 = Qc()) !== t2 && f4() !== t2 ? ((h3 = Ks()) === t2 && (h3 = null), h3 !== t2 ? (w4 = u4, u4 = (function(_5, O4, M4) { return M4 && O4.push(M4), { type: "case", expr: _5, args: O4 }; })(a2, c3, b4)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2)) : (e = u4, u4 = t2)), u4; })()) === t2 && (n = Bc()) === t2 && (n = he4()) === t2 && (n = Oe4()) === t2 && (n = qs()) === t2 && (n = e, Ot() !== t2 && (r2 = f4()) !== t2 && (o = rr()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, (s = o).parentheses = !0, n = s) : (e = n, n = t2), n === t2 && (n = Ve4()) === t2 && (n = e, f4() !== t2 ? (i2.charCodeAt(e) === 63 ? (r2 = "?", e++) : (r2 = t2, l === 0 && v4(fs2)), r2 !== t2 ? (w4 = n, n = { type: "origin", value: r2 }) : (e = n, n = t2)) : (e = n, n = t2))), n; } function he4() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5, O4, M4, k4, B5; return n = e, (r2 = ue4()) === t2 && (r2 = on2()), r2 !== t2 && (o = f4()) !== t2 && (s = Pe4()) !== t2 && (u4 = f4()) !== t2 ? ((a2 = ue4()) === t2 && (a2 = on2()), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Pe4()) !== t2 && (d3 = f4()) !== t2 && (h3 = Tr()) !== t2 ? (C5 = e, (A4 = f4()) !== t2 && (_5 = tr()) !== t2 ? C5 = A4 = [A4, _5] : (e = C5, C5 = t2), C5 === t2 && (C5 = null), C5 !== t2 ? (w4 = n, O4 = r2, M4 = a2, k4 = h3, B5 = C5, At2.add(`select::${typeof O4 == "object" ? O4.value : O4}::${typeof M4 == "object" ? M4.value : M4}::${k4}`), n = r2 = { type: "column_ref", db: O4, table: M4, column: k4, collate: B5 && B5[1], ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = ue4()) === t2 && (r2 = on2()), r2 !== t2 && (o = f4()) !== t2 && (s = Pe4()) !== t2 && (u4 = f4()) !== t2 && (a2 = Tr()) !== t2 ? (c3 = e, (b4 = f4()) !== t2 && (d3 = tr()) !== t2 ? c3 = b4 = [b4, d3] : (e = c3, c3 = t2), c3 === t2 && (c3 = null), c3 !== t2 ? (w4 = n, n = r2 = (function(j5, W4, K4) { return At2.add(`select::${typeof j5 == "object" ? j5.value : j5}::${W4}`), { type: "column_ref", table: j5, column: W4, collate: K4 && K4[1], ...ee5() }; })(r2, a2, c3)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, r2 = e, (o = Jt2()) !== t2 && (s = f4()) !== t2 && (u4 = Pe4()) !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2), r2 === t2 && (r2 = null), r2 !== t2 && (o = f4()) !== t2 && (s = ar()) !== t2 ? (w4 = n, n = r2 = (function(j5) { let W4 = j5 && j5[0] || null; return At2.add(`select::${W4}::(.*)`), { expr: { type: "column_ref", table: W4, column: "*" }, as: null, ...ee5() }; })(r2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = qn2()) !== t2 ? (o = e, (s = f4()) !== t2 && (u4 = tr()) !== t2 ? o = s = [s, u4] : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(j5, W4) { return At2.add("select::null::" + j5), { type: "column_ref", table: null, column: j5, collate: W4 && W4[1], ...ee5() }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2)))), n; } function Sc() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = qn2()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = qn2()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = qn2()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function ya() { var n, r2; return n = e, (r2 = ue4()) !== t2 && (w4 = n, r2 = { type: "default", value: r2 }), n = r2; } function Te4() { var n; return (n = ya()) === t2 && (n = Fv()), n; } function da() { var n; return (n = ue4()) === t2 && (n = Ps()), n; } function Jt2() { var n, r2; return n = e, (r2 = ue4()) !== t2 ? (w4 = e, (Ii(r2) ? t2 : void 0) !== t2 ? (w4 = n, n = r2 = r2) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = Ps()), n; } function Fv() { var n; return (n = Tc()) === t2 && (n = Oc()) === t2 && (n = on2()), n; } function Ps() { var n, r2; return n = e, (r2 = Tc()) === t2 && (r2 = Oc()) === t2 && (r2 = on2()), r2 !== t2 && (w4 = n, r2 = r2.value), n = r2; } function Tc() { var n, r2, o, s; if (n = e, i2.charCodeAt(e) === 34 ? (r2 = '"', e++) : (r2 = t2, l === 0 && v4(Er)), r2 !== t2) { if (o = [], Si.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(Ti)), s !== t2) for (; s !== t2; ) o.push(s), Si.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(Ti)); else o = t2; o !== t2 ? (i2.charCodeAt(e) === 34 ? (s = '"', e++) : (s = t2, l === 0 && v4(Er)), s !== t2 ? (w4 = n, n = r2 = { type: "double_quote_string", value: o.join("") }) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Oc() { var n, r2, o, s; if (n = e, i2.charCodeAt(e) === 39 ? (r2 = "'", e++) : (r2 = t2, l === 0 && v4(Ee4)), r2 !== t2) { for (o = [], Oi.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(Ni)); s !== t2; ) o.push(s), Oi.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(Ni)); o !== t2 ? (i2.charCodeAt(e) === 39 ? (s = "'", e++) : (s = t2, l === 0 && v4(Ee4)), s !== t2 ? (w4 = n, n = r2 = { type: "single_quote_string", value: o.join("") }) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; return n; } function on2() { var n, r2, o, s; if (n = e, i2.charCodeAt(e) === 96 ? (r2 = "`", e++) : (r2 = t2, l === 0 && v4(Ri)), r2 !== t2) { if (o = [], xi.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(ji)), s === t2 && (s = Gs()), s !== t2) for (; s !== t2; ) o.push(s), xi.test(i2.charAt(e)) ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(ji)), s === t2 && (s = Gs()); else o = t2; o !== t2 ? (i2.charCodeAt(e) === 96 ? (s = "`", e++) : (s = t2, l === 0 && v4(Ri)), s !== t2 ? (w4 = n, n = r2 = { type: "backticks_quote_string", value: o.join("") }) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Tr() { var n, r2; return n = e, (r2 = Nc()) !== t2 && (w4 = n, r2 = r2), (n = r2) === t2 && (n = Ps()), n; } function qn2() { var n, r2; return n = e, (r2 = Nc()) !== t2 ? (w4 = e, (Ii(r2) ? t2 : void 0) !== t2 ? (w4 = n, n = r2 = r2) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = on2()) !== t2 && (w4 = n, r2 = r2.value), n = r2), n; } function Nc() { var n, r2, o, s; if (n = e, (r2 = F6()) !== t2) { for (o = [], s = Ds(); s !== t2; ) o.push(s), s = Ds(); o !== t2 ? (w4 = n, n = r2 = Tu(r2, o)) : (e = n, n = t2); } else e = n, n = t2; if (n === t2) if (n = e, (r2 = Eo()) !== t2) { if (o = [], (s = Ds()) !== t2) for (; s !== t2; ) o.push(s), s = Ds(); else o = t2; o !== t2 ? (w4 = n, n = r2 = Tu(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function ue4() { var n, r2, o, s; if (n = e, (r2 = F6()) !== t2) { for (o = [], s = Rc(); s !== t2; ) o.push(s), s = Rc(); o !== t2 ? (w4 = n, n = r2 = Tu(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function F6() { var n; return Of.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(Nf)), n; } function Rc() { var n; return Rf.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(xf)), n; } function Ds() { var n; return jf.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(kf)), n; } function qs() { var n, r2, o, s; return n = e, r2 = e, i2.charCodeAt(e) === 58 ? (o = ":", e++) : (o = t2, l === 0 && v4(Uf)), o !== t2 && (s = ue4()) !== t2 ? r2 = o = [o, s] : (e = r2, r2 = t2), r2 !== t2 && (w4 = n, r2 = { type: "param", value: r2[1] }), n = r2; } function xc() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, un2() !== t2 && f4() !== t2 && Bn2() !== t2 && f4() !== t2 && (r2 = tu()) !== t2 && f4() !== t2 ? (o = e, (s = Ot()) !== t2 && (u4 = f4()) !== t2 ? ((a2 = nr()) === t2 && (a2 = null), a2 !== t2 && (c3 = f4()) !== t2 && (b4 = Nt()) !== t2 ? o = s = [s, u4, a2, c3, b4] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = { type: "on update", keyword: r2, parentheses: !!(d3 = o), expr: d3 ? d3[2] : null }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, un2() !== t2 && f4() !== t2 && Bn2() !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "now" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Mf)), r2 !== t2 && f4() !== t2 && (o = Ot()) !== t2 && (s = f4()) !== t2 && (u4 = Nt()) !== t2 ? (w4 = n, n = /* @__PURE__ */ (function(h3) { return { type: "on update", keyword: h3, parentheses: !0 }; })(r2)) : (e = n, n = t2)) : (e = n, n = t2)), n; } function Bs() { var n, r2, o; return n = e, i2.substr(e, 4).toLowerCase() === "over" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Pf)), r2 !== t2 && f4() !== t2 && (o = jc()) !== t2 ? (w4 = n, n = r2 = { type: "window", as_window_specification: o }) : (e = n, n = t2), n === t2 && (n = xc()), n; } function ha() { var n, r2, o; return n = e, (r2 = ue4()) !== t2 && f4() !== t2 && Me4() !== t2 && f4() !== t2 && (o = jc()) !== t2 ? (w4 = n, n = r2 = { name: r2, as_window_specification: o }) : (e = n, n = t2), n; } function jc() { var n, r2; return (n = ue4()) === t2 && (n = e, Ot() !== t2 && f4() !== t2 ? ((r2 = (function() { var o, s, u4, a2; return o = e, (s = Bv()) === t2 && (s = null), s !== t2 && f4() !== t2 ? ((u4 = Sr()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 ? ((a2 = (function() { var c3, b4, d3, h3, C5; return c3 = e, (b4 = Zc()) !== t2 && f4() !== t2 ? ((d3 = kc()) === t2 && (d3 = Uc()), d3 !== t2 ? (w4 = c3, c3 = b4 = { type: "rows", expr: d3 }) : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3 === t2 && (c3 = e, (b4 = Zc()) !== t2 && f4() !== t2 && (d3 = Ra()) !== t2 && f4() !== t2 && (h3 = Uc()) !== t2 && f4() !== t2 && Ge4() !== t2 && f4() !== t2 && (C5 = kc()) !== t2 ? (w4 = c3, b4 = ln2(d3, { type: "origin", value: "rows" }, { type: "expr_list", value: [h3, C5] }), c3 = b4) : (e = c3, c3 = t2)), c3; })()) === t2 && (a2 = null), a2 !== t2 ? (w4 = o, o = s = { name: null, partitionby: s, orderby: u4, window_frame_clause: a2 }) : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2), o; })()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = { window_specification: r2 || {}, parentheses: !0 }) : (e = n, n = t2)) : (e = n, n = t2)), n; } function kc() { var n, r2, o, s; return n = e, (r2 = Pc()) !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "following" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(ki)), o !== t2 ? (w4 = n, (s = r2).value += " FOLLOWING", n = r2 = s) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = Mc()), n; } function Uc() { var n, r2, o, s, u4; return n = e, (r2 = Pc()) !== t2 && f4() !== t2 ? (i2.substr(e, 9).toLowerCase() === "preceding" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(qf)), o === t2 && (i2.substr(e, 9).toLowerCase() === "following" ? (o = i2.substr(e, 9), e += 9) : (o = t2, l === 0 && v4(ki))), o !== t2 ? (w4 = n, u4 = o, (s = r2).value += " " + u4.toUpperCase(), n = r2 = s) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = Mc()), n; } function Mc() { var n, r2, o; return n = e, i2.substr(e, 7).toLowerCase() === "current" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Xe4)), r2 !== t2 && f4() !== t2 ? (i2.substr(e, 3).toLowerCase() === "row" ? (o = i2.substr(e, 3), e += 3) : (o = t2, l === 0 && v4(le3)), o !== t2 ? (w4 = n, n = r2 = { type: "origin", value: "current row", ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2), n; } function Pc() { var n, r2; return n = e, i2.substr(e, 9).toLowerCase() === "unbounded" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(Vn2)), r2 !== t2 && (w4 = n, r2 = { type: "origin", value: r2.toUpperCase(), ...ee5() }), (n = r2) === t2 && (n = Oe4()), n; } function wa() { var n, r2; return n = e, i2.substr(e, 10).toLowerCase() === "year_month" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Ui)), r2 === t2 && (i2.substr(e, 8).toLowerCase() === "day_hour" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(Mi)), r2 === t2 && (i2.substr(e, 10).toLowerCase() === "day_minute" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Pi)), r2 === t2 && (i2.substr(e, 10).toLowerCase() === "day_second" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Di)), r2 === t2 && (i2.substr(e, 15).toLowerCase() === "day_microsecond" ? (r2 = i2.substr(e, 15), e += 15) : (r2 = t2, l === 0 && v4(qi)), r2 === t2 && (i2.substr(e, 11).toLowerCase() === "hour_minute" ? (r2 = i2.substr(e, 11), e += 11) : (r2 = t2, l === 0 && v4(Bi)), r2 === t2 && (i2.substr(e, 11).toLowerCase() === "hour_second" ? (r2 = i2.substr(e, 11), e += 11) : (r2 = t2, l === 0 && v4(Fi)), r2 === t2 && (i2.substr(e, 16).toLowerCase() === "hour_microsecond" ? (r2 = i2.substr(e, 16), e += 16) : (r2 = t2, l === 0 && v4(Gi)), r2 === t2 && (i2.substr(e, 13).toLowerCase() === "minute_second" ? (r2 = i2.substr(e, 13), e += 13) : (r2 = t2, l === 0 && v4(Yi)), r2 === t2 && (i2.substr(e, 18).toLowerCase() === "minute_microsecond" ? (r2 = i2.substr(e, 18), e += 18) : (r2 = t2, l === 0 && v4($i)), r2 === t2 && (i2.substr(e, 18).toLowerCase() === "second_microsecond" ? (r2 = i2.substr(e, 18), e += 18) : (r2 = t2, l === 0 && v4(Hi)), r2 === t2 && (i2.substr(e, 13).toLowerCase() === "timezone_hour" ? (r2 = i2.substr(e, 13), e += 13) : (r2 = t2, l === 0 && v4(Ff)), r2 === t2 && (i2.substr(e, 15).toLowerCase() === "timezone_minute" ? (r2 = i2.substr(e, 15), e += 15) : (r2 = t2, l === 0 && v4(Gf)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "century" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Yf)), r2 === t2 && (i2.substr(e, 3).toLowerCase() === "day" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Wi)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "date" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Vi)), r2 === t2 && (i2.substr(e, 6).toLowerCase() === "decade" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4($f)), r2 === t2 && (i2.substr(e, 3).toLowerCase() === "dow" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Hf)), r2 === t2 && (i2.substr(e, 3).toLowerCase() === "doy" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Wf)), r2 === t2 && (i2.substr(e, 5).toLowerCase() === "epoch" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Vf)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "hour" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(zi)), r2 === t2 && (i2.substr(e, 6).toLowerCase() === "isodow" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(zf)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "isoweek" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Kf)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "isoyear" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Xf)), r2 === t2 && (i2.substr(e, 12).toLowerCase() === "microseconds" ? (r2 = i2.substr(e, 12), e += 12) : (r2 = t2, l === 0 && v4(Qf)), r2 === t2 && (i2.substr(e, 10).toLowerCase() === "millennium" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Zf)), r2 === t2 && (i2.substr(e, 12).toLowerCase() === "milliseconds" ? (r2 = i2.substr(e, 12), e += 12) : (r2 = t2, l === 0 && v4(Jf)), r2 === t2 && (i2.substr(e, 6).toLowerCase() === "minute" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Ki)), r2 === t2 && (i2.substr(e, 5).toLowerCase() === "month" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Xi)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "quarter" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Qi)), r2 === t2 && (i2.substr(e, 6).toLowerCase() === "second" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Zi)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "time" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Ji)), r2 === t2 && (i2.substr(e, 8).toLowerCase() === "timezone" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(tp)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "week" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(tc)), r2 === t2 && (i2.substr(e, 4).toLowerCase() === "year" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Ou)))))))))))))))))))))))))))))))))))), r2 !== t2 && (w4 = n, r2 = r2), n = r2; } function Gv() { var n, r2, o, s, u4, a2, c3, b4; return n = e, (r2 = Xc()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (o = wa()) !== t2 && f4() !== t2 && Ws() !== t2 && f4() !== t2 ? ((s = Js()) === t2 && (s = el()) === t2 && (s = Zs()) === t2 && (s = Qs()), s !== t2 && f4() !== t2 && (u4 = Xt()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, a2 = o, c3 = s, b4 = u4, n = r2 = { type: r2.toLowerCase(), args: { field: a2, cast_type: c3, source: b4 }, ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = Xc()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (o = wa()) !== t2 && f4() !== t2 && Ws() !== t2 && f4() !== t2 && (s = Xt()) !== t2 && f4() !== t2 && (u4 = Nt()) !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5) { return { type: d3.toLowerCase(), args: { field: h3, source: C5 }, ...ee5() }; })(r2, o, s)) : (e = n, n = t2), n === t2 && (n = e, i2.substr(e, 10).toLowerCase() === "date_trunc" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(ep)), r2 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 && (o = Xt()) !== t2 && f4() !== t2 && ht2() !== t2 && f4() !== t2 && (s = wa()) !== t2 && f4() !== t2 && (u4 = Nt()) !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { return { type: "function", name: { name: [{ type: "origin", value: "date_trunc" }] }, args: { type: "expr_list", value: [d3, { type: "origin", value: h3 }] }, over: null, ...ee5() }; })(o, s)) : (e = n, n = t2))), n; } function Yv() { var n, r2, o; return n = e, (r2 = (function() { var s; return i2.substr(e, 4).toLowerCase() === "both" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(np)), s === t2 && (i2.substr(e, 7).toLowerCase() === "leading" ? (s = i2.substr(e, 7), e += 7) : (s = t2, l === 0 && v4(rp)), s === t2 && (i2.substr(e, 8).toLowerCase() === "trailing" ? (s = i2.substr(e, 8), e += 8) : (s = t2, l === 0 && v4(op)))), s; })()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? ((o = Xt()) === t2 && (o = null), o !== t2 && f4() !== t2 && Ws() !== t2 ? (w4 = n, n = r2 = (function(s, u4, a2) { let c3 = []; return s && c3.push({ type: "origin", value: s }), u4 && c3.push(u4), c3.push({ type: "origin", value: "from" }), { type: "expr_list", value: c3 }; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n; } function $v() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "trim" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(sp)), r2 !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 ? ((o = Yv()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Xt()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = (function(u4, a2) { let c3 = u4 || { type: "expr_list", value: [] }; return c3.value.push(a2), { type: "function", name: { name: [{ type: "origin", value: "trim" }] }, args: c3, ...ee5() }; })(o, s)) : (e = n, n = t2)) : (e = n, n = t2), n; } function Dc() { var n, r2, o, s, u4, a2, c3, b4; return (n = Gv()) === t2 && (n = $v()) === t2 && (n = e, i2.substr(e, 7).toLowerCase() === "convert" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(up)), r2 !== t2 && f4() !== t2 && (o = Ot()) !== t2 && f4() !== t2 && (s = (function() { var d3, h3, C5, A4, _5, O4; return d3 = e, (h3 = au()) !== t2 && f4() !== t2 && ht2() !== t2 && f4() !== t2 ? ((C5 = Xa()) === t2 && (C5 = hl()), C5 !== t2 && f4() !== t2 && (A4 = po()) !== t2 && f4() !== t2 && (_5 = Te4()) !== t2 ? (w4 = d3, d3 = h3 = (function(M4, k4, B5, j5) { let { dataType: W4, length: K4 } = k4, z5 = W4; return K4 !== void 0 && (z5 = `${z5}(${K4})`), { type: "expr_list", value: [M4, { type: "origin", value: z5, suffix: { prefix: B5, ...j5 } }] }; })(h3, C5, A4, _5)) : (e = d3, d3 = t2)) : (e = d3, d3 = t2), d3 === t2 && (d3 = e, (h3 = au()) !== t2 && f4() !== t2 && ht2() !== t2 && f4() !== t2 ? ((C5 = ma()) === t2 && (C5 = Ka()), C5 !== t2 ? (w4 = d3, d3 = h3 = { type: "expr_list", value: [h3, { type: "datatype", ...typeof (O4 = C5) == "string" ? { dataType: O4 } : O4 }] }) : (e = d3, d3 = t2)) : (e = d3, d3 = t2), d3 === t2 && (d3 = e, (h3 = rr()) !== t2 && f4() !== t2 && zs() !== t2 && f4() !== t2 && (C5 = ue4()) !== t2 ? (w4 = d3, d3 = h3 = (function(M4, k4) { return M4.suffix = "USING " + k4.toUpperCase(), { type: "expr_list", value: [M4] }; })(h3, C5)) : (e = d3, d3 = t2))), d3; })()) !== t2 && (u4 = f4()) !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = { type: "function", name: { name: [{ type: "origin", value: "convert" }] }, args: s, ...ee5() }) : (e = n, n = t2), n === t2 && (n = e, (r2 = (function() { var d3; return (d3 = qc()) === t2 && (d3 = $a()) === t2 && (d3 = Jc()) === t2 && (d3 = (function() { var h3, C5, A4, _5; return h3 = e, i2.substr(e, 12).toLowerCase() === "session_user" ? (C5 = i2.substr(e, 12), e += 12) : (C5 = t2, l === 0 && v4(Pb)), C5 !== t2 ? (A4 = e, l++, _5 = F6(), l--, _5 === t2 ? A4 = void 0 : (e = A4, A4 = t2), A4 !== t2 ? (w4 = h3, h3 = C5 = "SESSION_USER") : (e = h3, h3 = t2)) : (e = h3, h3 = t2), h3; })()) === t2 && (d3 = (function() { var h3, C5, A4, _5; return h3 = e, i2.substr(e, 11).toLowerCase() === "system_user" ? (C5 = i2.substr(e, 11), e += 11) : (C5 = t2, l === 0 && v4(Db)), C5 !== t2 ? (A4 = e, l++, _5 = F6(), l--, _5 === t2 ? A4 = void 0 : (e = A4, A4 = t2), A4 !== t2 ? (w4 = h3, h3 = C5 = "SYSTEM_USER") : (e = h3, h3 = t2)) : (e = h3, h3 = t2), h3; })()), d3; })()) !== t2 && f4() !== t2 && (o = Ot()) !== t2 && f4() !== t2 ? ((s = nr()) === t2 && (s = null), s !== t2 && (u4 = f4()) !== t2 && Nt() !== t2 && f4() !== t2 ? ((a2 = Bs()) === t2 && (a2 = null), a2 !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5) { return { type: "function", name: { name: [{ type: "default", value: d3 }] }, args: h3 || { type: "expr_list", value: [] }, over: C5, ...ee5() }; })(r2, s, a2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = qc()) !== t2 && f4() !== t2 ? ((o = xc()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = { type: "function", name: { name: [{ type: "origin", value: r2 }] }, over: o, ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = e, (r2 = iu()) !== t2 ? (w4 = e, (Wv[(b4 = r2).name[0] && b4.name[0].value.toLowerCase()] ? t2 : void 0) !== t2 && (o = f4()) !== t2 && Ot() !== t2 && (s = f4()) !== t2 ? ((u4 = rr()) === t2 && (u4 = null), u4 !== t2 && f4() !== t2 && Nt() !== t2 && (a2 = f4()) !== t2 ? ((c3 = Bs()) === t2 && (c3 = null), c3 !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5) { return h3 && h3.type !== "expr_list" && (h3 = { type: "expr_list", value: [h3] }), (d3.name[0] && d3.name[0].value.toUpperCase() === "TIMESTAMPDIFF" || d3.name[0] && d3.name[0].value.toUpperCase() === "TIMESTAMPADD") && h3.value && h3.value[0] && (h3.value[0] = { type: "origin", value: h3.value[0].column }), { type: "function", name: d3, args: h3 || { type: "expr_list", value: [] }, over: C5, ...ee5() }; })(r2, u4, c3)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2)) : (e = n, n = t2))))), n; } function qc() { var n; return (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 12).toLowerCase() === "current_date" ? (o = i2.substr(e, 12), e += 12) : (o = t2, l === 0 && v4(Rb)), o !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? (w4 = r2, r2 = o = "CURRENT_DATE") : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 12).toLowerCase() === "current_time" ? (o = i2.substr(e, 12), e += 12) : (o = t2, l === 0 && v4(kb)), o !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? (w4 = r2, r2 = o = "CURRENT_TIME") : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = tu()), n; } function ma() { var n; return (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 6).toLowerCase() === "signed" ? (o = i2.substr(e, 6), e += 6) : (o = t2, l === 0 && v4(lb)), o !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? (w4 = r2, r2 = o = "SIGNED") : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 8).toLowerCase() === "unsigned" ? (o = i2.substr(e, 8), e += 8) : (o = t2, l === 0 && v4(fb)), o !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? (w4 = r2, r2 = o = "UNSIGNED") : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()), n; } function Bc() { var n, r2, o, s, u4, a2, c3, b4, d3; return n = e, i2.substr(e, 6).toLowerCase() === "binary" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(ap)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "_binary" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ds))), r2 === t2 && (r2 = null), r2 !== t2 && f4() !== t2 && (o = Le4()) !== t2 ? (s = e, (u4 = f4()) !== t2 && (a2 = tr()) !== t2 ? s = u4 = [u4, a2] : (e = s, s = t2), s === t2 && (s = null), s !== t2 ? (w4 = n, b4 = o, d3 = s, (c3 = r2) && (b4.prefix = c3.toLowerCase()), d3 && (b4.suffix = { collate: d3[1] }), n = r2 = b4) : (e = n, n = t2)) : (e = n, n = t2), n === t2 && (n = (function() { var h3, C5; return h3 = e, (C5 = (function() { var A4, _5, O4, M4; return A4 = e, i2.substr(e, 4).toLowerCase() === "true" ? (_5 = i2.substr(e, 4), e += 4) : (_5 = t2, l === 0 && v4(Bp)), _5 !== t2 ? (O4 = e, l++, M4 = F6(), l--, M4 === t2 ? O4 = void 0 : (e = O4, O4 = t2), O4 !== t2 ? A4 = _5 = [_5, O4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2), A4; })()) !== t2 && (w4 = h3, C5 = { type: "bool", value: !0 }), (h3 = C5) === t2 && (h3 = e, (C5 = (function() { var A4, _5, O4, M4; return A4 = e, i2.substr(e, 5).toLowerCase() === "false" ? (_5 = i2.substr(e, 5), e += 5) : (_5 = t2, l === 0 && v4(Gp)), _5 !== t2 ? (O4 = e, l++, M4 = F6(), l--, M4 === t2 ? O4 = void 0 : (e = O4, O4 = t2), O4 !== t2 ? A4 = _5 = [_5, O4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2), A4; })()) !== t2 && (w4 = h3, C5 = { type: "bool", value: !1 }), h3 = C5), h3; })()) === t2 && (n = Fc()) === t2 && (n = (function() { var h3, C5, A4, _5, O4, M4; if (h3 = e, (C5 = Zs()) === t2 && (C5 = Qs()) === t2 && (C5 = Js()) === t2 && (C5 = Ya()), C5 !== t2) if (f4() !== t2) { if (A4 = e, i2.charCodeAt(e) === 39 ? (_5 = "'", e++) : (_5 = t2, l === 0 && v4(Ee4)), _5 !== t2) { for (O4 = [], M4 = Nr(); M4 !== t2; ) O4.push(M4), M4 = Nr(); O4 !== t2 ? (i2.charCodeAt(e) === 39 ? (M4 = "'", e++) : (M4 = t2, l === 0 && v4(Ee4)), M4 !== t2 ? A4 = _5 = [_5, O4, M4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2); } else e = A4, A4 = t2; A4 !== t2 ? (w4 = h3, C5 = ec(C5, A4), h3 = C5) : (e = h3, h3 = t2); } else e = h3, h3 = t2; else e = h3, h3 = t2; if (h3 === t2) if (h3 = e, (C5 = Zs()) === t2 && (C5 = Qs()) === t2 && (C5 = Js()) === t2 && (C5 = Ya()), C5 !== t2) if (f4() !== t2) { if (A4 = e, i2.charCodeAt(e) === 34 ? (_5 = '"', e++) : (_5 = t2, l === 0 && v4(Er)), _5 !== t2) { for (O4 = [], M4 = Fs(); M4 !== t2; ) O4.push(M4), M4 = Fs(); O4 !== t2 ? (i2.charCodeAt(e) === 34 ? (M4 = '"', e++) : (M4 = t2, l === 0 && v4(Er)), M4 !== t2 ? A4 = _5 = [_5, O4, M4] : (e = A4, A4 = t2)) : (e = A4, A4 = t2); } else e = A4, A4 = t2; A4 !== t2 ? (w4 = h3, C5 = ec(C5, A4), h3 = C5) : (e = h3, h3 = t2); } else e = h3, h3 = t2; else e = h3, h3 = t2; return h3; })()), n; } function Or() { var n; return (n = Bc()) === t2 && (n = Oe4()), n; } function Fc() { var n, r2; return n = e, (r2 = (function() { var o, s, u4, a2; return o = e, i2.substr(e, 4).toLowerCase() === "null" ? (s = i2.substr(e, 4), e += 4) : (s = t2, l === 0 && v4(Dp)), s !== t2 ? (u4 = e, l++, a2 = F6(), l--, a2 === t2 ? u4 = void 0 : (e = u4, u4 = t2), u4 !== t2 ? o = s = [s, u4] : (e = o, o = t2)) : (e = o, o = t2), o; })()) !== t2 && (w4 = n, r2 = { type: "null", value: null }), n = r2; } function Le4() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, i2.substr(e, 7).toLowerCase() === "_binary" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ds)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "_latin1" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Nu))), r2 === t2 && (r2 = null), r2 !== t2) if ((o = f4()) !== t2) if (i2.substr(e, 1).toLowerCase() === "x" ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(ip)), s !== t2) { if (u4 = e, i2.charCodeAt(e) === 39 ? (a2 = "'", e++) : (a2 = t2, l === 0 && v4(Ee4)), a2 !== t2) { for (c3 = [], Ar.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(gr)); b4 !== t2; ) c3.push(b4), Ar.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(gr)); c3 !== t2 ? (i2.charCodeAt(e) === 39 ? (b4 = "'", e++) : (b4 = t2, l === 0 && v4(Ee4)), b4 !== t2 ? u4 = a2 = [a2, c3, b4] : (e = u4, u4 = t2)) : (e = u4, u4 = t2); } else e = u4, u4 = t2; u4 !== t2 ? (w4 = n, n = r2 = { type: "hex_string", prefix: r2, value: u4[1].join("") }) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; if (n === t2) { if (n = e, i2.substr(e, 7).toLowerCase() === "_binary" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ds)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "_latin1" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Nu))), r2 === t2 && (r2 = null), r2 !== t2) if ((o = f4()) !== t2) if (i2.substr(e, 1).toLowerCase() === "b" ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(cp)), s !== t2) { if (u4 = e, i2.charCodeAt(e) === 39 ? (a2 = "'", e++) : (a2 = t2, l === 0 && v4(Ee4)), a2 !== t2) { for (c3 = [], Ar.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(gr)); b4 !== t2; ) c3.push(b4), Ar.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(gr)); c3 !== t2 ? (i2.charCodeAt(e) === 39 ? (b4 = "'", e++) : (b4 = t2, l === 0 && v4(Ee4)), b4 !== t2 ? u4 = a2 = [a2, c3, b4] : (e = u4, u4 = t2)) : (e = u4, u4 = t2); } else e = u4, u4 = t2; u4 !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5) { return { type: "bit_string", prefix: d3, value: C5[1].join("") }; })(r2, 0, u4)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; if (n === t2) { if (n = e, i2.substr(e, 7).toLowerCase() === "_binary" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ds)), r2 === t2 && (i2.substr(e, 7).toLowerCase() === "_latin1" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Nu))), r2 === t2 && (r2 = null), r2 !== t2) if ((o = f4()) !== t2) if (i2.substr(e, 2).toLowerCase() === "0x" ? (s = i2.substr(e, 2), e += 2) : (s = t2, l === 0 && v4(lp)), s !== t2) { for (u4 = [], Ar.test(i2.charAt(e)) ? (a2 = i2.charAt(e), e++) : (a2 = t2, l === 0 && v4(gr)); a2 !== t2; ) u4.push(a2), Ar.test(i2.charAt(e)) ? (a2 = i2.charAt(e), e++) : (a2 = t2, l === 0 && v4(gr)); u4 !== t2 ? (w4 = n, n = r2 = (function(d3, h3, C5) { return { type: "full_hex_string", prefix: d3, value: C5.join("") }; })(r2, 0, u4)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; else e = n, n = t2; if (n === t2) { if (n = e, i2.substr(e, 1).toLowerCase() === "n" ? (r2 = i2.charAt(e), e++) : (r2 = t2, l === 0 && v4(fp)), r2 !== t2) { if (o = e, i2.charCodeAt(e) === 39 ? (s = "'", e++) : (s = t2, l === 0 && v4(Ee4)), s !== t2) { for (u4 = [], a2 = Nr(); a2 !== t2; ) u4.push(a2), a2 = Nr(); u4 !== t2 ? (i2.charCodeAt(e) === 39 ? (a2 = "'", e++) : (a2 = t2, l === 0 && v4(Ee4)), a2 !== t2 ? o = s = [s, u4, a2] : (e = o, o = t2)) : (e = o, o = t2); } else e = o, o = t2; o !== t2 ? (w4 = n, n = r2 = (function(d3, h3) { return { type: "natural_string", value: h3[1].join("") }; })(0, o)) : (e = n, n = t2); } else e = n, n = t2; if (n === t2) { if (n = e, r2 = e, i2.charCodeAt(e) === 39 ? (o = "'", e++) : (o = t2, l === 0 && v4(Ee4)), o !== t2) { for (s = [], u4 = Nr(); u4 !== t2; ) s.push(u4), u4 = Nr(); s !== t2 ? (i2.charCodeAt(e) === 39 ? (u4 = "'", e++) : (u4 = t2, l === 0 && v4(Ee4)), u4 !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2)) : (e = r2, r2 = t2); } else e = r2, r2 = t2; if (r2 !== t2 && (w4 = n, r2 = (function(d3) { return { type: "single_quote_string", value: d3[1].join("") }; })(r2)), (n = r2) === t2) { if (n = e, r2 = e, i2.charCodeAt(e) === 34 ? (o = '"', e++) : (o = t2, l === 0 && v4(Er)), o !== t2) { for (s = [], u4 = Fs(); u4 !== t2; ) s.push(u4), u4 = Fs(); s !== t2 ? (i2.charCodeAt(e) === 34 ? (u4 = '"', e++) : (u4 = t2, l === 0 && v4(Er)), u4 !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2)) : (e = r2, r2 = t2); } else e = r2, r2 = t2; r2 !== t2 && (w4 = n, r2 = (function(d3) { return { type: "double_quote_string", value: d3[1].join("") }; })(r2)), n = r2; } } } } } return n; } function Fs() { var n; return pp.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(bp)), n === t2 && (n = Gs()) === t2 && (vp.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(yp))), n; } function Nr() { var n; return dp.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(hp)), n === t2 && (n = Gs()), n; } function Gs() { var n, r2, o, s, u4, a2, c3, b4, d3, h3; return n = e, i2.substr(e, 2) === "\\'" ? (r2 = "\\'", e += 2) : (r2 = t2, l === 0 && v4(wp)), r2 !== t2 && (w4 = n, r2 = "\\'"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === '\\"' ? (r2 = '\\"', e += 2) : (r2 = t2, l === 0 && v4(mp)), r2 !== t2 && (w4 = n, r2 = '\\"'), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\\\" ? (r2 = "\\\\", e += 2) : (r2 = t2, l === 0 && v4(Lp)), r2 !== t2 && (w4 = n, r2 = "\\\\"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\/" ? (r2 = "\\/", e += 2) : (r2 = t2, l === 0 && v4(Cp)), r2 !== t2 && (w4 = n, r2 = "\\/"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\b" ? (r2 = "\\b", e += 2) : (r2 = t2, l === 0 && v4(Ep)), r2 !== t2 && (w4 = n, r2 = "\b"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\f" ? (r2 = "\\f", e += 2) : (r2 = t2, l === 0 && v4(Ap)), r2 !== t2 && (w4 = n, r2 = "\f"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\n" ? (r2 = "\\n", e += 2) : (r2 = t2, l === 0 && v4(gp)), r2 !== t2 && (w4 = n, r2 = ` `), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\r" ? (r2 = "\\r", e += 2) : (r2 = t2, l === 0 && v4(_p)), r2 !== t2 && (w4 = n, r2 = "\r"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\t" ? (r2 = "\\t", e += 2) : (r2 = t2, l === 0 && v4(Ip)), r2 !== t2 && (w4 = n, r2 = " "), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "\\u" ? (r2 = "\\u", e += 2) : (r2 = t2, l === 0 && v4(Sp)), r2 !== t2 && (o = $s()) !== t2 && (s = $s()) !== t2 && (u4 = $s()) !== t2 && (a2 = $s()) !== t2 ? (w4 = n, c3 = o, b4 = s, d3 = u4, h3 = a2, n = r2 = String.fromCharCode(parseInt("0x" + c3 + b4 + d3 + h3))) : (e = n, n = t2), n === t2 && (n = e, i2.charCodeAt(e) === 92 ? (r2 = "\\", e++) : (r2 = t2, l === 0 && v4(Tp)), r2 !== t2 && (w4 = n, r2 = "\\"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "''" ? (r2 = "''", e += 2) : (r2 = t2, l === 0 && v4(Op)), r2 !== t2 && (w4 = n, r2 = "''"), (n = r2) === t2 && (n = e, i2.substr(e, 2) === '""' ? (r2 = '""', e += 2) : (r2 = t2, l === 0 && v4(Np)), r2 !== t2 && (w4 = n, r2 = '""'), (n = r2) === t2 && (n = e, i2.substr(e, 2) === "``" ? (r2 = "``", e += 2) : (r2 = t2, l === 0 && v4(Rp)), r2 !== t2 && (w4 = n, r2 = "``"), n = r2))))))))))))), n; } function Oe4() { var n, r2, o; return n = e, (r2 = (function() { var s, u4, a2, c3; return s = e, (u4 = sr()) !== t2 && (a2 = Gc()) !== t2 && (c3 = Yc()) !== t2 ? (w4 = s, s = u4 = { type: "bigint", value: u4 + a2 + c3 }) : (e = s, s = t2), s === t2 && (s = e, (u4 = sr()) !== t2 && (a2 = Gc()) !== t2 ? (w4 = s, u4 = (function(b4, d3) { let h3 = b4 + d3; if (ml(b4)) return { type: "bigint", value: h3 }; let C5 = d3.length >= 1 ? d3.length - 1 : 0; return parseFloat(h3).toFixed(C5); })(u4, a2), s = u4) : (e = s, s = t2), s === t2 && (s = e, (u4 = sr()) !== t2 && (a2 = Yc()) !== t2 ? (w4 = s, u4 = (function(b4, d3) { return { type: "bigint", value: b4 + d3 }; })(u4, a2), s = u4) : (e = s, s = t2), s === t2 && (s = e, (u4 = sr()) !== t2 && (w4 = s, u4 = (function(b4) { return ml(b4) ? { type: "bigint", value: b4 } : parseFloat(b4); })(u4)), s = u4))), s; })()) !== t2 && (w4 = n, r2 = (o = r2) && o.type === "bigint" ? o : { type: "number", value: o }), n = r2; } function sr() { var n, r2, o; return (n = Eo()) === t2 && (n = Ys()) === t2 && (n = e, i2.charCodeAt(e) === 45 ? (r2 = "-", e++) : (r2 = t2, l === 0 && v4(ys)), r2 === t2 && (i2.charCodeAt(e) === 43 ? (r2 = "+", e++) : (r2 = t2, l === 0 && v4(vs))), r2 !== t2 && (o = Eo()) !== t2 ? (w4 = n, n = r2 = r2 + o) : (e = n, n = t2), n === t2 && (n = e, i2.charCodeAt(e) === 45 ? (r2 = "-", e++) : (r2 = t2, l === 0 && v4(ys)), r2 === t2 && (i2.charCodeAt(e) === 43 ? (r2 = "+", e++) : (r2 = t2, l === 0 && v4(vs))), r2 !== t2 && (o = Ys()) !== t2 ? (w4 = n, n = r2 = (function(s, u4) { return s + u4; })(r2, o)) : (e = n, n = t2))), n; } function Gc() { var n, r2, o, s; return n = e, i2.charCodeAt(e) === 46 ? (r2 = ".", e++) : (r2 = t2, l === 0 && v4(hs)), r2 !== t2 ? ((o = Eo()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (s = o) ? "." + s : "") : (e = n, n = t2)) : (e = n, n = t2), n; } function Yc() { var n, r2, o; return n = e, (r2 = (function() { var s, u4, a2; s = e, kp.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Up)), u4 !== t2 ? (Mp.test(i2.charAt(e)) ? (a2 = i2.charAt(e), e++) : (a2 = t2, l === 0 && v4(Pp)), a2 === t2 && (a2 = null), a2 !== t2 ? (w4 = s, s = u4 = u4 + ((c3 = a2) !== null ? c3 : "")) : (e = s, s = t2)) : (e = s, s = t2); var c3; return s; })()) !== t2 && (o = Eo()) !== t2 ? (w4 = n, n = r2 = r2 + o) : (e = n, n = t2), n; } function Eo() { var n, r2, o; if (n = e, r2 = [], (o = Ys()) !== t2) for (; o !== t2; ) r2.push(o), o = Ys(); else r2 = t2; return r2 !== t2 && (w4 = n, r2 = r2.join("")), n = r2; } function Ys() { var n; return _e4.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(Ie5)), n; } function $s() { var n; return xp.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(jp)), n; } function La() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "default" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ie5)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Rr() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "to" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(Fp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function sn3() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "show" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Yp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Fe4() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "drop" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Fo)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DROP") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ca() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "alter" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Hp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function $c() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "select" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Wp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Bn2() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "update" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Vp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function We4() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "create" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(zp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Hc() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "temporary" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(Kp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Hs() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "delete" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Xp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Ea() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "insert" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Qp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Aa() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "replace" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(Jp)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function ga() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "rename" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(t0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Ao() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "ignore" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(e0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function xr() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "partition" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(r0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "PARTITION") : (e = n, n = t2)) : (e = n, n = t2), n; } function go() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "into" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(ni)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Ws() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "from" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(o0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function jr() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "set" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(mn2)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "SET") : (e = n, n = t2)) : (e = n, n = t2), n; } function Me4() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "as" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(Yn2)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Fn2() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "table" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(ri)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TABLE") : (e = n, n = t2)) : (e = n, n = t2), n; } function Vs() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "trigger" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(s0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TRIGGER") : (e = n, n = t2)) : (e = n, n = t2), n; } function _a() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "tables" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(u0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TABLES") : (e = n, n = t2)) : (e = n, n = t2), n; } function Wc() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "database" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(a0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DATABASE") : (e = n, n = t2)) : (e = n, n = t2), n; } function Vc() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "schema" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(i0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "SCHEMA") : (e = n, n = t2)) : (e = n, n = t2), n; } function un2() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "on" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(c0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function _o() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "join" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(d0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Ia() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "outer" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(h0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Sa() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "values" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(E0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function zs() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "using" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(A0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function an2() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "with" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(R4)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function zc() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "go" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(_0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "GO") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ta() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "by" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(P4)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Io() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "asc" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(R0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "ASC") : (e = n, n = t2)) : (e = n, n = t2), n; } function kr() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "desc" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(x0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DESC") : (e = n, n = t2)) : (e = n, n = t2), n; } function Oa() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "all" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(k0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "ALL") : (e = n, n = t2)) : (e = n, n = t2), n; } function Na() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "distinct" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(U0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DISTINCT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ra() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "between" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(M0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "BETWEEN") : (e = n, n = t2)) : (e = n, n = t2), n; } function So() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "in" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(fi)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "IN") : (e = n, n = t2)) : (e = n, n = t2), n; } function Kc() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "is" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(P0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "IS") : (e = n, n = t2)) : (e = n, n = t2), n; } function xa() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "like" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(D0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "LIKE") : (e = n, n = t2)) : (e = n, n = t2), n; } function ja() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "exists" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(F0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "EXISTS") : (e = n, n = t2)) : (e = n, n = t2), n; } function cn2() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "not" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Wo)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "NOT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ge4() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "and" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(G0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "AND") : (e = n, n = t2)) : (e = n, n = t2), n; } function Cn2() { var n, r2, o, s; return n = e, i2.substr(e, 2).toLowerCase() === "or" ? (r2 = i2.substr(e, 2), e += 2) : (r2 = t2, l === 0 && v4(Y0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "OR") : (e = n, n = t2)) : (e = n, n = t2), n; } function Xc() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "extract" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(X0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "EXTRACT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ks() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "case" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Z0)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function Qc() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "end" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(nb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? n = r2 = [r2, o] : (e = n, n = t2)) : (e = n, n = t2), n; } function To() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "cast" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(rb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "CAST") : (e = n, n = t2)) : (e = n, n = t2), n; } function ka() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "bit" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(sb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "BIT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ua() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "numeric" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(ib)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "NUMERIC") : (e = n, n = t2)) : (e = n, n = t2), n; } function Oo() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "decimal" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(cb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DECIMAL") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ma() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "int" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(pb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "INT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Xs() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "integer" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(vb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "INTEGER") : (e = n, n = t2)) : (e = n, n = t2), n; } function Pa() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "smallint" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(db)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "SMALLINT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Da() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "mediumint" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(hb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "MEDIUMINT") : (e = n, n = t2)) : (e = n, n = t2), n; } function qa() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "tinyint" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(wb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TINYINT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ba() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "bigint" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Ab)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "BIGINT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Fa() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "float" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(_b)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "FLOAT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ga() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "double" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Ib)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DOUBLE") : (e = n, n = t2)) : (e = n, n = t2), n; } function Qs() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "date" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Vi)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DATE") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ya() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "datetime" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(Sb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "DATETIME") : (e = n, n = t2)) : (e = n, n = t2), n; } function Zc() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "rows" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(oi)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "ROWS") : (e = n, n = t2)) : (e = n, n = t2), n; } function Zs() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "time" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Ji)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TIME") : (e = n, n = t2)) : (e = n, n = t2), n; } function Js() { var n, r2, o, s; return n = e, i2.substr(e, 9).toLowerCase() === "timestamp" ? (r2 = i2.substr(e, 9), e += 9) : (r2 = t2, l === 0 && v4(Tb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "TIMESTAMP") : (e = n, n = t2)) : (e = n, n = t2), n; } function Jc() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "user" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(Ob)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "USER") : (e = n, n = t2)) : (e = n, n = t2), n; } function tl() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "vector" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(Nb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "VECTOR") : (e = n, n = t2)) : (e = n, n = t2), n; } function el() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "interval" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(xb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "INTERVAL") : (e = n, n = t2)) : (e = n, n = t2), n; } function tu() { var n, r2, o, s; return n = e, i2.substr(e, 17).toLowerCase() === "current_timestamp" ? (r2 = i2.substr(e, 17), e += 17) : (r2 = t2, l === 0 && v4(Ub)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "CURRENT_TIMESTAMP") : (e = n, n = t2)) : (e = n, n = t2), n; } function $a() { var n, r2, o, s; return n = e, i2.substr(e, 12).toLowerCase() === "current_user" ? (r2 = i2.substr(e, 12), e += 12) : (r2 = t2, l === 0 && v4(Mb)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "CURRENT_USER") : (e = n, n = t2)) : (e = n, n = t2), n; } function eu() { var n, r2, o, s; return n = e, i2.substr(e, 4).toLowerCase() === "view" ? (r2 = i2.substr(e, 4), e += 4) : (r2 = t2, l === 0 && v4(si)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "VIEW") : (e = n, n = t2)) : (e = n, n = t2), n; } function nl() { var n; return i2.charCodeAt(e) === 64 ? (n = "@", e++) : (n = t2, l === 0 && v4(J5)), n; } function Hv() { var n; return (n = (function() { var r2; return i2.substr(e, 2) === "@@" ? (r2 = "@@", e += 2) : (r2 = t2, l === 0 && v4(Qb)), r2; })()) === t2 && (n = nl()) === t2 && (n = (function() { var r2; return i2.charCodeAt(e) === 36 ? (r2 = "$", e++) : (r2 = t2, l === 0 && v4(Zb)), r2; })()), n; } function rl() { var n; return i2.substr(e, 2) === ":=" ? (n = ":=", e += 2) : (n = t2, l === 0 && v4(tv)), n; } function be4() { var n; return i2.charCodeAt(e) === 61 ? (n = "=", e++) : (n = t2, l === 0 && v4(ps)), n; } function Ur() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "add" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(nv)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "ADD") : (e = n, n = t2)) : (e = n, n = t2), n; } function No() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "column" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(rv)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "COLUMN") : (e = n, n = t2)) : (e = n, n = t2), n; } function ur() { var n, r2, o, s; return n = e, i2.substr(e, 5).toLowerCase() === "index" ? (r2 = i2.substr(e, 5), e += 5) : (r2 = t2, l === 0 && v4(Un2)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "INDEX") : (e = n, n = t2)) : (e = n, n = t2), n; } function Mr() { var n, r2, o, s; return n = e, i2.substr(e, 3).toLowerCase() === "key" ? (r2 = i2.substr(e, 3), e += 3) : (r2 = t2, l === 0 && v4(Y5)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "KEY") : (e = n, n = t2)) : (e = n, n = t2), n; } function ol() { var n, r2, o, s; return n = e, i2.substr(e, 8).toLowerCase() === "fulltext" ? (r2 = i2.substr(e, 8), e += 8) : (r2 = t2, l === 0 && v4(sv)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "FULLTEXT") : (e = n, n = t2)) : (e = n, n = t2), n; } function sl() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "spatial" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(uv)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "SPATIAL") : (e = n, n = t2)) : (e = n, n = t2), n; } function ul() { var n, r2, o, s; return n = e, i2.substr(e, 6).toLowerCase() === "unique" ? (r2 = i2.substr(e, 6), e += 6) : (r2 = t2, l === 0 && v4(V3)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "UNIQUE") : (e = n, n = t2)) : (e = n, n = t2), n; } function al() { var n, r2, o, s; return n = e, i2.substr(e, 7).toLowerCase() === "comment" ? (r2 = i2.substr(e, 7), e += 7) : (r2 = t2, l === 0 && v4(av)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "COMMENT") : (e = n, n = t2)) : (e = n, n = t2), n; } function Ha() { var n, r2, o, s; return n = e, i2.substr(e, 10).toLowerCase() === "constraint" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(Ho)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "CONSTRAINT") : (e = n, n = t2)) : (e = n, n = t2), n; } function il() { var n, r2, o, s; return n = e, i2.substr(e, 10).toLowerCase() === "references" ? (r2 = i2.substr(e, 10), e += 10) : (r2 = t2, l === 0 && v4(iv)), r2 !== t2 ? (o = e, l++, s = F6(), l--, s === t2 ? o = void 0 : (e = o, o = t2), o !== t2 ? (w4 = n, n = r2 = "REFERENCES") : (e = n, n = t2)) : (e = n, n = t2), n; } function Pe4() { var n; return i2.charCodeAt(e) === 46 ? (n = ".", e++) : (n = t2, l === 0 && v4(hs)), n; } function ht2() { var n; return i2.charCodeAt(e) === 44 ? (n = ",", e++) : (n = t2, l === 0 && v4(yv)), n; } function ar() { var n; return i2.charCodeAt(e) === 42 ? (n = "*", e++) : (n = t2, l === 0 && v4(Su)), n; } function Ot() { var n; return i2.charCodeAt(e) === 40 ? (n = "(", e++) : (n = t2, l === 0 && v4(ci)), n; } function Nt() { var n; return i2.charCodeAt(e) === 41 ? (n = ")", e++) : (n = t2, l === 0 && v4(li)), n; } function cl() { var n; return i2.charCodeAt(e) === 59 ? (n = ";", e++) : (n = t2, l === 0 && v4(wv)), n; } function ll() { var n; return i2.substr(e, 2) === "->" ? (n = "->", e += 2) : (n = t2, l === 0 && v4(mv)), n; } function fl() { var n; return i2.substr(e, 3) === "->>" ? (n = "->>", e += 3) : (n = t2, l === 0 && v4(Lv)), n; } function Pr() { var n; return (n = (function() { var r2; return i2.substr(e, 2) === "||" ? (r2 = "||", e += 2) : (r2 = t2, l === 0 && v4(wi)), r2; })()) === t2 && (n = (function() { var r2; return i2.substr(e, 2) === "&&" ? (r2 = "&&", e += 2) : (r2 = t2, l === 0 && v4(Cv)), r2; })()) === t2 && (n = (function() { var r2, o, s, u4; return r2 = e, i2.substr(e, 3).toLowerCase() === "xor" ? (o = i2.substr(e, 3), e += 3) : (o = t2, l === 0 && v4(Ev)), o !== t2 ? (s = e, l++, u4 = F6(), l--, u4 === t2 ? s = void 0 : (e = s, s = t2), s !== t2 ? (w4 = r2, r2 = o = "XOR") : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()), n; } function f4() { var n, r2; for (n = [], (r2 = ou()) === t2 && (r2 = ru()); r2 !== t2; ) n.push(r2), (r2 = ou()) === t2 && (r2 = ru()); return n; } function nu() { var n, r2; if (n = [], (r2 = ou()) === t2 && (r2 = ru()), r2 !== t2) for (; r2 !== t2; ) n.push(r2), (r2 = ou()) === t2 && (r2 = ru()); else n = t2; return n; } function ru() { var n; return (n = (function() { var r2, o, s, u4, a2, c3; if (r2 = e, i2.substr(e, 2) === "/*" ? (o = "/*", e += 2) : (o = t2, l === 0 && v4(Av)), o !== t2) { for (s = [], u4 = e, a2 = e, l++, i2.substr(e, 2) === "*/" ? (c3 = "*/", e += 2) : (c3 = t2, l === 0 && v4(Ru)), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); u4 !== t2; ) s.push(u4), u4 = e, a2 = e, l++, i2.substr(e, 2) === "*/" ? (c3 = "*/", e += 2) : (c3 = t2, l === 0 && v4(Ru)), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); s !== t2 ? (i2.substr(e, 2) === "*/" ? (u4 = "*/", e += 2) : (u4 = t2, l === 0 && v4(Ru)), u4 !== t2 ? r2 = o = [o, s, u4] : (e = r2, r2 = t2)) : (e = r2, r2 = t2); } else e = r2, r2 = t2; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3; if (r2 = e, i2.substr(e, 2) === "--" ? (o = "--", e += 2) : (o = t2, l === 0 && v4(gv)), o !== t2) { for (s = [], u4 = e, a2 = e, l++, c3 = su(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); u4 !== t2; ) s.push(u4), u4 = e, a2 = e, l++, c3 = su(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); s !== t2 ? r2 = o = [o, s] : (e = r2, r2 = t2); } else e = r2, r2 = t2; return r2; })()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3; if (r2 = e, i2.charCodeAt(e) === 35 ? (o = "#", e++) : (o = t2, l === 0 && v4(_v)), o !== t2) { for (s = [], u4 = e, a2 = e, l++, c3 = su(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); u4 !== t2; ) s.push(u4), u4 = e, a2 = e, l++, c3 = su(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 && (c3 = Dr()) !== t2 ? u4 = a2 = [a2, c3] : (e = u4, u4 = t2); s !== t2 ? r2 = o = [o, s] : (e = r2, r2 = t2); } else e = r2, r2 = t2; return r2; })()), n; } function Wa() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = al()) !== t2 && f4() !== t2 ? ((o = be4()) === t2 && (o = null), o !== t2 && f4() !== t2 && (s = Le4()) !== t2 ? (w4 = n, a2 = o, c3 = s, n = r2 = { type: (u4 = r2).toLowerCase(), keyword: u4.toLowerCase(), symbol: a2, value: c3 }) : (e = n, n = t2)) : (e = n, n = t2), n; } function Dr() { var n; return i2.length > e ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(oc)), n; } function ou() { var n; return Iv.test(i2.charAt(e)) ? (n = i2.charAt(e), e++) : (n = t2, l === 0 && v4(Sv)), n; } function su() { var n, r2; if ((n = (function() { var o, s; return o = e, l++, i2.length > e ? (s = i2.charAt(e), e++) : (s = t2, l === 0 && v4(oc)), l--, s === t2 ? o = void 0 : (e = o, o = t2), o; })()) === t2) if (n = [], nc.test(i2.charAt(e)) ? (r2 = i2.charAt(e), e++) : (r2 = t2, l === 0 && v4(rc)), r2 !== t2) for (; r2 !== t2; ) n.push(r2), nc.test(i2.charAt(e)) ? (r2 = i2.charAt(e), e++) : (r2 = t2, l === 0 && v4(rc)); else n = t2; return n; } function pl() { var n, r2; return n = e, w4 = e, Ja = [], t2 !== void 0 && f4() !== t2 ? ((r2 = uu()) === t2 && (r2 = (function() { var o, s; return o = e, (function() { var u4; return i2.substr(e, 6).toLowerCase() === "return" ? (u4 = i2.substr(e, 6), e += 6) : (u4 = t2, l === 0 && v4(Jb)), u4; })() !== t2 && f4() !== t2 && (s = (function() { var u4; return (u4 = vo()) === t2 && (u4 = (function() { var a2, c3, b4, d3, h3; return a2 = e, (c3 = Ve4()) !== t2 && f4() !== t2 && (b4 = Ss()) !== t2 && f4() !== t2 && (d3 = Ve4()) !== t2 && f4() !== t2 && (h3 = oa()) !== t2 ? (w4 = a2, a2 = c3 = { type: "join", ltable: c3, rtable: d3, op: b4, on: h3 }) : (e = a2, a2 = t2), a2; })()) === t2 && (u4 = au()) === t2 && (u4 = (function() { var a2, c3; return a2 = e, (function() { var b4; return i2.charCodeAt(e) === 91 ? (b4 = "[", e++) : (b4 = t2, l === 0 && v4(dv)), b4; })() !== t2 && f4() !== t2 && (c3 = yl()) !== t2 && f4() !== t2 && (function() { var b4; return i2.charCodeAt(e) === 93 ? (b4 = "]", e++) : (b4 = t2, l === 0 && v4(hv)), b4; })() !== t2 ? (w4 = a2, a2 = { type: "array", value: c3 }) : (e = a2, a2 = t2), a2; })()), u4; })()) !== t2 ? (w4 = o, o = { type: "return", expr: s }) : (e = o, o = t2), o; })()), r2 !== t2 ? (w4 = n, n = { stmt: r2, vars: Ja }) : (e = n, n = t2)) : (e = n, n = t2), n; } function uu() { var n, r2, o, s; return n = e, (r2 = Ve4()) === t2 && (r2 = za()), r2 !== t2 && f4() !== t2 ? ((o = rl()) === t2 && (o = be4()), o !== t2 && f4() !== t2 && (s = Xt()) !== t2 ? (w4 = n, n = r2 = sc(r2, o, s)) : (e = n, n = t2)) : (e = n, n = t2), n; } function au() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = Va()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ks()) !== t2 && (c3 = f4()) !== t2 && (b4 = Va()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ks()) !== t2 && (c3 = f4()) !== t2 && (b4 = Va()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = Iu(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Va() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = qr()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = Us()) !== t2 && (c3 = f4()) !== t2 && (b4 = qr()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = Us()) !== t2 && (c3 = f4()) !== t2 && (b4 = qr()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = Iu(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function qr() { var n, r2, o; return (n = bl()) === t2 && (n = Or()) === t2 && (n = Ve4()) === t2 && (n = he4()) === t2 && (n = vl()) === t2 && (n = qs()) === t2 && (n = e, Ot() !== t2 && f4() !== t2 && (r2 = au()) !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, (o = r2).parentheses = !0, n = o) : (e = n, n = t2)), n; } function iu() { var n, r2, o, s, u4, a2, c3; return n = e, (r2 = ya()) === t2 && (r2 = on2()), r2 !== t2 ? (o = e, (s = f4()) !== t2 && (u4 = Pe4()) !== t2 && (a2 = f4()) !== t2 ? ((c3 = ya()) === t2 && (c3 = on2()), c3 !== t2 ? o = s = [s, u4, a2, c3] : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(b4, d3) { let h3 = { name: [b4] }; return d3 !== null && (h3.schema = b4, h3.name = [d3[3]]), h3; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n; } function bl() { var n, r2, o; return n = e, (r2 = iu()) !== t2 && f4() !== t2 && Ot() !== t2 && f4() !== t2 ? ((o = yl()) === t2 && (o = null), o !== t2 && f4() !== t2 && Nt() !== t2 ? (w4 = n, n = r2 = { type: "function", name: r2, args: { type: "expr_list", value: o }, ...ee5() }) : (e = n, n = t2)) : (e = n, n = t2), n; } function vl() { var n, r2; return n = e, (r2 = iu()) !== t2 && (w4 = n, r2 = { type: "function", name: r2, args: null, ...ee5() }), n = r2; } function yl() { var n, r2, o, s, u4, a2, c3, b4; if (n = e, (r2 = qr()) !== t2) { for (o = [], s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = qr()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); s !== t2; ) o.push(s), s = e, (u4 = f4()) !== t2 && (a2 = ht2()) !== t2 && (c3 = f4()) !== t2 && (b4 = qr()) !== t2 ? s = u4 = [u4, a2, c3, b4] : (e = s, s = t2); o !== t2 ? (w4 = n, n = r2 = x5(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Ve4() { var n, r2, o, s, u4; return n = e, (r2 = Hv()) !== t2 && (o = za()) !== t2 ? (w4 = n, s = r2, u4 = o, n = r2 = { type: "var", ...u4, prefix: s }) : (e = n, n = t2), n; } function za() { var n, r2, o, s, u4; return n = e, (r2 = ue4()) !== t2 && (o = (function() { var a2, c3, b4, d3, h3; for (a2 = e, c3 = [], b4 = e, i2.charCodeAt(e) === 46 ? (d3 = ".", e++) : (d3 = t2, l === 0 && v4(hs)), d3 !== t2 && (h3 = ue4()) !== t2 ? b4 = d3 = [d3, h3] : (e = b4, b4 = t2); b4 !== t2; ) c3.push(b4), b4 = e, i2.charCodeAt(e) === 46 ? (d3 = ".", e++) : (d3 = t2, l === 0 && v4(hs)), d3 !== t2 && (h3 = ue4()) !== t2 ? b4 = d3 = [d3, h3] : (e = b4, b4 = t2); return c3 !== t2 && (w4 = a2, c3 = (function(C5) { let A4 = []; for (let _5 = 0; _5 < C5.length; _5++) A4.push(C5[_5][1]); return A4; })(c3)), a2 = c3; })()) !== t2 ? (w4 = n, s = r2, u4 = o, Ja.push(s), n = r2 = { type: "var", name: s, members: u4, prefix: null }) : (e = n, n = t2), n === t2 && (n = e, (r2 = Oe4()) !== t2 && (w4 = n, r2 = { type: "var", name: r2.value, members: [], quoted: null, prefix: null }), n = r2), n; } function Ka() { var n; return (n = Xa()) === t2 && (n = (function() { var r2, o, s, u4, a2, c3, b4, d3, h3, C5, A4, _5; if (r2 = e, (o = Ua()) === t2 && (o = Oo()) === t2 && (o = Ma()) === t2 && (o = Xs()) === t2 && (o = Pa()) === t2 && (o = Da()) === t2 && (o = qa()) === t2 && (o = Ba()) === t2 && (o = Fa()) === t2 && (o = Ga()) === t2 && (o = ka()), o !== t2) if ((s = f4()) !== t2) if ((u4 = Ot()) !== t2) if ((a2 = f4()) !== t2) { if (c3 = [], _e4.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(Ie5)), b4 !== t2) for (; b4 !== t2; ) c3.push(b4), _e4.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(Ie5)); else c3 = t2; if (c3 !== t2) if ((b4 = f4()) !== t2) { if (d3 = e, (h3 = ht2()) !== t2) if ((C5 = f4()) !== t2) { if (A4 = [], _e4.test(i2.charAt(e)) ? (_5 = i2.charAt(e), e++) : (_5 = t2, l === 0 && v4(Ie5)), _5 !== t2) for (; _5 !== t2; ) A4.push(_5), _e4.test(i2.charAt(e)) ? (_5 = i2.charAt(e), e++) : (_5 = t2, l === 0 && v4(Ie5)); else A4 = t2; A4 !== t2 ? d3 = h3 = [h3, C5, A4] : (e = d3, d3 = t2); } else e = d3, d3 = t2; else e = d3, d3 = t2; d3 === t2 && (d3 = null), d3 !== t2 && (h3 = f4()) !== t2 && (C5 = Nt()) !== t2 && (A4 = f4()) !== t2 ? ((_5 = Ro()) === t2 && (_5 = null), _5 !== t2 ? (w4 = r2, O4 = d3, M4 = _5, o = { dataType: o, length: parseInt(c3.join(""), 10), scale: O4 && parseInt(O4[2].join(""), 10), parentheses: !0, suffix: M4 }, r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); } else e = r2, r2 = t2; else e = r2, r2 = t2; } else e = r2, r2 = t2; else e = r2, r2 = t2; else e = r2, r2 = t2; else e = r2, r2 = t2; var O4, M4; if (r2 === t2) { if (r2 = e, (o = Ua()) === t2 && (o = Oo()) === t2 && (o = Ma()) === t2 && (o = Xs()) === t2 && (o = Pa()) === t2 && (o = Da()) === t2 && (o = qa()) === t2 && (o = Ba()) === t2 && (o = Fa()) === t2 && (o = Ga()) === t2 && (o = ka()), o !== t2) { if (s = [], _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)), u4 !== t2) for (; u4 !== t2; ) s.push(u4), _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)); else s = t2; s !== t2 && (u4 = f4()) !== t2 ? ((a2 = Ro()) === t2 && (a2 = null), a2 !== t2 ? (w4 = r2, o = (function(k4, B5, j5) { return { dataType: k4, length: parseInt(B5.join(""), 10), suffix: j5 }; })(o, s, a2), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2); } else e = r2, r2 = t2; r2 === t2 && (r2 = e, (o = Ua()) === t2 && (o = Oo()) === t2 && (o = Ma()) === t2 && (o = Xs()) === t2 && (o = Pa()) === t2 && (o = Da()) === t2 && (o = qa()) === t2 && (o = Ba()) === t2 && (o = Fa()) === t2 && (o = Ga()) === t2 && (o = ka()), o !== t2 && (s = f4()) !== t2 ? ((u4 = Ro()) === t2 && (u4 = null), u4 !== t2 && (a2 = f4()) !== t2 ? (w4 = r2, o = /* @__PURE__ */ (function(k4, B5) { return { dataType: k4, suffix: B5 }; })(o, u4), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2)); } return r2; })()) === t2 && (n = hl()) === t2 && (n = (function() { var r2, o; return r2 = e, (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 4).toLowerCase() === "json" ? (u4 = i2.substr(e, 4), e += 4) : (u4 = t2, l === 0 && v4(yb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "JSON") : (e = s, s = t2)) : (e = s, s = t2), s; })()) !== t2 && (w4 = r2, o = { dataType: o }), r2 = o; })()) === t2 && (n = (function() { var r2, o, s; return r2 = e, (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 8).toLowerCase() === "tinytext" ? (a2 = i2.substr(e, 8), e += 8) : (a2 = t2, l === 0 && v4(mb)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "TINYTEXT") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 4).toLowerCase() === "text" ? (a2 = i2.substr(e, 4), e += 4) : (a2 = t2, l === 0 && v4(Lb)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "TEXT") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 10).toLowerCase() === "mediumtext" ? (a2 = i2.substr(e, 10), e += 10) : (a2 = t2, l === 0 && v4(Cb)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "MEDIUMTEXT") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 8).toLowerCase() === "longtext" ? (a2 = i2.substr(e, 8), e += 8) : (a2 = t2, l === 0 && v4(Eb)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "LONGTEXT") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()), o !== t2 ? ((s = dl()) === t2 && (s = null), s !== t2 ? (w4 = r2, o = uc(o, s), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o, s; r2 = e, (o = (function() { var c3, b4, d3, h3; return c3 = e, i2.substr(e, 4).toLowerCase() === "enum" ? (b4 = i2.substr(e, 4), e += 4) : (b4 = t2, l === 0 && v4(gb)), b4 !== t2 ? (d3 = e, l++, h3 = F6(), l--, h3 === t2 ? d3 = void 0 : (e = d3, d3 = t2), d3 !== t2 ? (w4 = c3, c3 = b4 = "ENUM") : (e = c3, c3 = t2)) : (e = c3, c3 = t2), c3; })()) === t2 && (o = jr()), o !== t2 && f4() !== t2 && (s = Co()) !== t2 ? (w4 = r2, u4 = o, (a2 = s).parentheses = !0, r2 = o = { dataType: u4, expr: a2 }) : (e = r2, r2 = t2); var u4, a2; return r2; })()) === t2 && (n = (function() { var r2, o; return r2 = e, i2.substr(e, 7).toLowerCase() === "boolean" ? (o = i2.substr(e, 7), e += 7) : (o = t2, l === 0 && v4(Tv)), o !== t2 && (w4 = r2, o = { dataType: "BOOLEAN" }), r2 = o; })()) === t2 && (n = (function() { var r2, o, s; return r2 = e, (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 6).toLowerCase() === "binary" ? (a2 = i2.substr(e, 6), e += 6) : (a2 = t2, l === 0 && v4(p3)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "BINARY") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()) === t2 && (o = (function() { var u4, a2, c3, b4; return u4 = e, i2.substr(e, 9).toLowerCase() === "varbinary" ? (a2 = i2.substr(e, 9), e += 9) : (a2 = t2, l === 0 && v4(ob)), a2 !== t2 ? (c3 = e, l++, b4 = F6(), l--, b4 === t2 ? c3 = void 0 : (e = c3, c3 = t2), c3 !== t2 ? (w4 = u4, u4 = a2 = "VARBINARY") : (e = u4, u4 = t2)) : (e = u4, u4 = t2), u4; })()), o !== t2 && f4() !== t2 ? ((s = dl()) === t2 && (s = null), s !== t2 ? (w4 = r2, o = uc(o, s), r2 = o) : (e = r2, r2 = t2)) : (e = r2, r2 = t2), r2; })()) === t2 && (n = (function() { var r2, o; return r2 = e, i2.substr(e, 4).toLowerCase() === "blob" ? (o = i2.substr(e, 4), e += 4) : (o = t2, l === 0 && v4(Ov)), o === t2 && (i2.substr(e, 8).toLowerCase() === "tinyblob" ? (o = i2.substr(e, 8), e += 8) : (o = t2, l === 0 && v4(Nv)), o === t2 && (i2.substr(e, 10).toLowerCase() === "mediumblob" ? (o = i2.substr(e, 10), e += 10) : (o = t2, l === 0 && v4(Rv)), o === t2 && (i2.substr(e, 8).toLowerCase() === "longblob" ? (o = i2.substr(e, 8), e += 8) : (o = t2, l === 0 && v4(xv))))), o !== t2 && (w4 = r2, o = { dataType: o.toUpperCase() }), r2 = o; })()) === t2 && (n = (function() { var r2, o; return r2 = e, (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 8).toLowerCase() === "geometry" ? (u4 = i2.substr(e, 8), e += 8) : (u4 = t2, l === 0 && v4(Yb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "GEOMETRY") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 5).toLowerCase() === "point" ? (u4 = i2.substr(e, 5), e += 5) : (u4 = t2, l === 0 && v4($b)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "POINT") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 10).toLowerCase() === "linestring" ? (u4 = i2.substr(e, 10), e += 10) : (u4 = t2, l === 0 && v4(Hb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "LINESTRING") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 7).toLowerCase() === "polygon" ? (u4 = i2.substr(e, 7), e += 7) : (u4 = t2, l === 0 && v4(Wb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "POLYGON") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 10).toLowerCase() === "multipoint" ? (u4 = i2.substr(e, 10), e += 10) : (u4 = t2, l === 0 && v4(Vb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "MULTIPOINT") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 15).toLowerCase() === "multilinestring" ? (u4 = i2.substr(e, 15), e += 15) : (u4 = t2, l === 0 && v4(zb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "MULTILINESTRING") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 12).toLowerCase() === "multipolygon" ? (u4 = i2.substr(e, 12), e += 12) : (u4 = t2, l === 0 && v4(Kb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "MULTIPOLYGON") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 18).toLowerCase() === "geometrycollection" ? (u4 = i2.substr(e, 18), e += 18) : (u4 = t2, l === 0 && v4(Xb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "GEOMETRYCOLLECTION") : (e = s, s = t2)) : (e = s, s = t2), s; })()), o !== t2 && (w4 = r2, o = { dataType: o }), r2 = o; })()) === t2 && (n = (function() { var r2, o, s, u4; if (r2 = e, (o = tl()) !== t2) if (f4() !== t2) if (Ot() !== t2) if (f4() !== t2) { if (s = [], _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)), u4 !== t2) for (; u4 !== t2; ) s.push(u4), _e4.test(i2.charAt(e)) ? (u4 = i2.charAt(e), e++) : (u4 = t2, l === 0 && v4(Ie5)); else s = t2; s !== t2 && (u4 = f4()) !== t2 && Nt() !== t2 ? (w4 = r2, o = { dataType: o, length: parseInt(s.join(""), 10), parentheses: !0 }, r2 = o) : (e = r2, r2 = t2); } else e = r2, r2 = t2; else e = r2, r2 = t2; else e = r2, r2 = t2; else e = r2, r2 = t2; return r2 === t2 && (r2 = e, (o = tl()) !== t2 && (w4 = r2, o = /* @__PURE__ */ (function(a2) { return { dataType: a2 }; })(o)), r2 = o), r2; })()), n; } function dl() { var n, r2, o, s, u4; if (n = e, Ot() !== t2) if (f4() !== t2) { if (r2 = [], _e4.test(i2.charAt(e)) ? (o = i2.charAt(e), e++) : (o = t2, l === 0 && v4(Ie5)), o !== t2) for (; o !== t2; ) r2.push(o), _e4.test(i2.charAt(e)) ? (o = i2.charAt(e), e++) : (o = t2, l === 0 && v4(Ie5)); else r2 = t2; r2 !== t2 && (o = f4()) !== t2 && Nt() !== t2 && f4() !== t2 ? ((s = Ro()) === t2 && (s = null), s !== t2 ? (w4 = n, u4 = s, n = { length: parseInt(r2.join(""), 10), parentheses: !0, suffix: u4 }) : (e = n, n = t2)) : (e = n, n = t2); } else e = n, n = t2; else e = n, n = t2; return n; } function Xa() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5; if (n = e, (r2 = (function() { var A4, _5, O4, M4; return A4 = e, i2.substr(e, 4).toLowerCase() === "char" ? (_5 = i2.substr(e, 4), e += 4) : (_5 = t2, l === 0 && v4(ub)), _5 !== t2 ? (O4 = e, l++, M4 = F6(), l--, M4 === t2 ? O4 = void 0 : (e = O4, O4 = t2), O4 !== t2 ? (w4 = A4, A4 = _5 = "CHAR") : (e = A4, A4 = t2)) : (e = A4, A4 = t2), A4; })()) === t2 && (r2 = (function() { var A4, _5, O4, M4; return A4 = e, i2.substr(e, 7).toLowerCase() === "varchar" ? (_5 = i2.substr(e, 7), e += 7) : (_5 = t2, l === 0 && v4(ab)), _5 !== t2 ? (O4 = e, l++, M4 = F6(), l--, M4 === t2 ? O4 = void 0 : (e = O4, O4 = t2), O4 !== t2 ? (w4 = A4, A4 = _5 = "VARCHAR") : (e = A4, A4 = t2)) : (e = A4, A4 = t2), A4; })()), r2 !== t2) { if (o = e, (s = f4()) !== t2) if ((u4 = Ot()) !== t2) if ((a2 = f4()) !== t2) { if (c3 = [], _e4.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(Ie5)), b4 !== t2) for (; b4 !== t2; ) c3.push(b4), _e4.test(i2.charAt(e)) ? (b4 = i2.charAt(e), e++) : (b4 = t2, l === 0 && v4(Ie5)); else c3 = t2; c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Nt()) !== t2 && (h3 = f4()) !== t2 ? (i2.substr(e, 5).toLowerCase() === "array" ? (C5 = i2.substr(e, 5), e += 5) : (C5 = t2, l === 0 && v4(jv)), C5 === t2 && (C5 = null), C5 !== t2 ? o = s = [s, u4, a2, c3, b4, d3, h3, C5] : (e = o, o = t2)) : (e = o, o = t2); } else e = o, o = t2; else e = o, o = t2; else e = o, o = t2; o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(A4, _5) { let O4 = { dataType: A4 }; return _5 && (O4.length = parseInt(_5[3].join(""), 10), O4.parentheses = !0, O4.suffix = _5[7] && ["ARRAY"]), O4; })(r2, o)) : (e = n, n = t2); } else e = n, n = t2; return n; } function Ro() { var n, r2, o; return n = e, (r2 = ma()) === t2 && (r2 = null), r2 !== t2 && f4() !== t2 ? ((o = (function() { var s, u4, a2, c3; return s = e, i2.substr(e, 8).toLowerCase() === "zerofill" ? (u4 = i2.substr(e, 8), e += 8) : (u4 = t2, l === 0 && v4(bb)), u4 !== t2 ? (a2 = e, l++, c3 = F6(), l--, c3 === t2 ? a2 = void 0 : (e = a2, a2 = t2), a2 !== t2 ? (w4 = s, s = u4 = "ZEROFILL") : (e = s, s = t2)) : (e = s, s = t2), s; })()) === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(s, u4) { let a2 = []; return s && a2.push(s), u4 && a2.push(u4), a2; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n; } function hl() { var n, r2, o, s, u4, a2, c3, b4, d3, h3, C5; return n = e, (r2 = Qs()) === t2 && (r2 = Ya()) === t2 && (r2 = Zs()) === t2 && (r2 = Js()) === t2 && (r2 = (function() { var A4, _5, O4, M4; return A4 = e, i2.substr(e, 4).toLowerCase() === "year" ? (_5 = i2.substr(e, 4), e += 4) : (_5 = t2, l === 0 && v4(Ou)), _5 !== t2 ? (O4 = e, l++, M4 = F6(), l--, M4 === t2 ? O4 = void 0 : (e = O4, O4 = t2), O4 !== t2 ? (w4 = A4, A4 = _5 = "YEAR") : (e = A4, A4 = t2)) : (e = A4, A4 = t2), A4; })()), r2 !== t2 ? (o = e, (s = f4()) !== t2 && (u4 = Ot()) !== t2 && (a2 = f4()) !== t2 ? (kv.test(i2.charAt(e)) ? (c3 = i2.charAt(e), e++) : (c3 = t2, l === 0 && v4(Uv)), c3 !== t2 && (b4 = f4()) !== t2 && (d3 = Nt()) !== t2 && (h3 = f4()) !== t2 ? ((C5 = Ro()) === t2 && (C5 = null), C5 !== t2 ? o = s = [s, u4, a2, c3, b4, d3, h3, C5] : (e = o, o = t2)) : (e = o, o = t2)) : (e = o, o = t2), o === t2 && (o = null), o !== t2 ? (w4 = n, n = r2 = (function(A4, _5) { let O4 = { dataType: A4 }; return _5 && (O4.length = parseInt(_5[3], 10), O4.parentheses = !0, O4.suffix = _5[7]), O4; })(r2, o)) : (e = n, n = t2)) : (e = n, n = t2), n; } let wl = { ALTER: !0, ALL: !0, ADD: !0, AND: !0, AS: !0, ASC: !0, ANALYZE: !0, ACCESSIBLE: !0, BEFORE: !0, BETWEEN: !0, BIGINT: !0, BLOB: !0, BOTH: !0, BY: !0, BOOLEAN: !0, CALL: !0, CASCADE: !0, CASE: !0, CHAR: !0, CHECK: !0, COLLATE: !0, CONDITION: !0, CONSTRAINT: !0, CONTINUE: !0, CONVERT: !0, CREATE: !0, CROSS: !0, CURRENT_DATE: !0, CURRENT_TIME: !0, CURRENT_TIMESTAMP: !0, CURRENT_USER: !0, CURSOR: !0, DATABASE: !0, DATABASES: !0, DAY_HOUR: !0, DAY_MICROSECOND: !0, DAY_MINUTE: !0, DAY_SECOND: !0, DEC: !0, DECIMAL: !0, DECLARE: !0, DEFAULT: !0, DELAYED: !0, DELETE: !0, DESC: !0, DESCRIBE: !0, DETERMINISTIC: !0, DISTINCT: !0, DISTINCTROW: !0, DIV: !0, DROP: !0, DOUBLE: !0, DUAL: !0, ELSE: !0, EACH: !0, ELSEIF: !0, ENCLOSED: !0, ESCAPED: !0, EXCEPT: !0, EXISTS: !0, EXIT: !0, EXPLAIN: !0, FALSE: !0, FULL: !0, FROM: !0, FETCH: !0, FLOAT: !0, FLOAT4: !0, FLOAT8: !0, FOR: !0, FORCE: !0, FOREIGN: !0, FULLTEXT: !0, FUNCTION: !0, GENERATED: !0, GET: !0, GO: !0, GRANT: !0, GROUP: !0, GROUPING: !0, GROUPS: !0, HAVING: !0, HIGH_PRIORITY: !0, HOUR_MICROSECOND: !0, HOUR_MINUTE: !0, HOUR_SECOND: !0, IGNORE: !0, IN: !0, INNER: !0, INFILE: !0, INOUT: !0, INSENSITIVE: !0, INSERT: !0, INTERSECT: !0, INT: !0, INT1: !0, INT2: !0, INT3: !0, INT4: !0, INT8: !0, INTEGER: !0, INTERVAL: !0, INTO: !0, IO_AFTER_GTIDS: !0, IO_BEFORE_GTIDS: !0, IS: !0, ITERATE: !0, JOIN: !0, JSON_TABLE: !0, KEY: !0, KEYS: !0, KILL: !0, LAG: !0, LAST_VALUE: !0, LATERAL: !0, LEAD: !0, LEADING: !0, LEAVE: !0, LEFT: !0, LIKE: !0, LIMIT: !0, LINEAR: !0, LINES: !0, LOAD: !0, LOCALTIME: !0, LOCALTIMESTAMP: !0, LOCK: !0, LONG: !0, LONGBLOB: !0, LONGTEXT: !0, LOOP: !0, LOW_PRIORITY: !0, MASTER_BIND: !0, MATCH: !0, MAXVALUE: !0, MEDIUMBLOB: !0, MEDIUMINT: !0, MEDIUMTEXT: !0, MIDDLEINT: !0, MINUTE_MICROSECOND: !0, MINUTE_SECOND: !0, MINUS: !0, MOD: !0, MODIFIES: !0, NATURAL: !0, NOT: !0, NO_WRITE_TO_BINLOG: !0, NTH_VALUE: !0, NTILE: !0, NULL: !0, NUMERIC: !0, OF: !0, ON: !0, OPTIMIZE: !0, OPTIMIZER_COSTS: !0, OPTION: !0, OPTIONALLY: !0, OR: !0, ORDER: !0, OUT: !0, OUTER: !0, OUTFILE: !0, OVER: !0, PARTITION: !0, PERCENT_RANK: !0, PRECISION: !0, PRIMARY: !0, PROCEDURE: !0, PURGE: !0, RANGE: !0, RANK: !0, READ: !0, READS: !0, READ_WRITE: !0, REAL: !0, RECURSIVE: !0, REFERENCES: !0, REGEXP: !0, RELEASE: !0, RENAME: !0, REPEAT: !0, REPLACE: !0, REQUIRE: !0, RESIGNAL: !0, RESTRICT: !0, RETURN: !0, REVOKE: !0, RIGHT: !0, RLIKE: !0, ROW: !0, ROWS: !0, ROW_NUMBER: !0, SCHEMA: !0, SCHEMAS: !0, SELECT: !0, SENSITIVE: !0, SEPARATOR: !0, SET: !0, SHOW: !0, SIGNAL: !0, SMALLINT: !0, SPATIAL: !0, SPECIFIC: !0, SQL: !0, SQLEXCEPTION: !0, SQLSTATE: !0, SQLWARNING: !0, SQL_BIG_RESULT: !0, SSL: !0, STARTING: !0, STORED: !0, STRAIGHT_JOIN: !0, TABLE: !0, TERMINATED: !0, THEN: !0, TINYBLOB: !0, TINYINT: !0, TINYTEXT: !0, TO: !0, TRAILING: !0, TRIGGER: !0, TRUE: !0, UNION: !0, UNIQUE: !0, UNLOCK: !0, UNSIGNED: !0, UPDATE: !0, USAGE: !0, USE: !0, USING: !0, UTC_DATE: !0, UTC_TIME: !0, UTC_TIMESTAMP: !0, VALUES: !0, VARBINARY: !0, VARCHAR: !0, VARCHARACTER: !0, VARYING: !0, VIRTUAL: !0, VECTOR: !0, WHEN: !0, WHERE: !0, WHILE: !0, WINDOW: !0, WITH: !0, WRITE: !0, XOR: !0, YEAR_MONTH: !0, ZEROFILL: !0 }, Wv = { avg: !0, sum: !0, count: !0, convert: !0, max: !0, min: !0, group_concat: !0, std: !0, variance: !0, current_date: !0, current_time: !0, current_timestamp: !0, current_user: !0, user: !0, session_user: !0, system_user: !0 }; function ee5() { return Wt2.includeLocations ? { loc: ju(w4, e) } : {}; } function Qa(n, r2) { return { type: "unary_expr", operator: n, expr: r2 }; } function ln2(n, r2, o) { return { type: "binary_expr", operator: n, left: r2, right: o, ...ee5() }; } function ml(n) { let r2 = X6(Number.MAX_SAFE_INTEGER); return !(X6(n) < r2); } function ze4(n, r2, o = 3) { let s = [n]; for (let u4 = 0; u4 < r2.length; u4++) delete r2[u4][o].tableList, delete r2[u4][o].columnList, s.push(r2[u4][o]); return s; } function Gn2(n, r2) { let o = n; for (let s = 0; s < r2.length; s++) o = ln2(r2[s][1], o, r2[s][3]); return o; } function Ll(n) { return ir[n] || n || null; } function Dt(n) { let r2 = /* @__PURE__ */ new Set(); for (let o of n.keys()) { let s = o.split("::"); if (!s) { r2.add(o); break; } s && s[1] && (s[1] = Ll(s[1])), r2.add(s.join("::")); } return Array.from(r2); } function Za(n) { let r2 = Dt(n); n.clear(), r2.forEach((o) => n.add(o)); } let Ja = [], _t = /* @__PURE__ */ new Set(), At2 = /* @__PURE__ */ new Set(), ir = {}; if ((tt3 = ft3()) !== t2 && e === i2.length) return tt3; throw tt3 !== t2 && e < i2.length && v4({ type: "end" }), Mv(xu, nn2 < i2.length ? i2.charAt(nn2) : null, nn2 < i2.length ? ju(nn2, nn2 + 1) : ju(nn2, nn2)); } }; }, function(Q5, at3, ct3) { Q5.exports = ct3(3); }, function(Q5, at3) { Q5.exports = gl(); }, function(Q5, at3, ct3) { "use strict"; ct3.r(at3), ct3.d(at3, "Parser", (function() { return Lr; })), ct3.d(at3, "util", (function() { return X6; })); var X6 = {}; function Et2(p3) { return (Et2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } ct3.r(X6), ct3.d(X6, "arrayStructTypeToSQL", (function() { return xe4; })), ct3.d(X6, "autoIncrementToSQL", (function() { return $n2; })), ct3.d(X6, "columnOrderListToSQL", (function() { return Hn2; })), ct3.d(X6, "commonKeywordArgsToSQL", (function() { return _n2; })), ct3.d(X6, "commonOptionConnector", (function() { return tt3; })), ct3.d(X6, "connector", (function() { return t2; })), ct3.d(X6, "commonTypeValue", (function() { return ye4; })), ct3.d(X6, "commentToSQL", (function() { return fn2; })), ct3.d(X6, "createBinaryExpr", (function() { return ft3; })), ct3.d(X6, "createValueExpr", (function() { return st3; })), ct3.d(X6, "dataTypeToSQL", (function() { return Re4; })), ct3.d(X6, "DEFAULT_OPT", (function() { return i2; })), ct3.d(X6, "escape", (function() { return xt; })), ct3.d(X6, "literalToSQL", (function() { return lt3; })), ct3.d(X6, "columnIdentifierToSql", (function() { return Zt; })), ct3.d(X6, "getParserOpt", (function() { return Mt; })), ct3.d(X6, "identifierToSql", (function() { return yt2; })), ct3.d(X6, "onPartitionsToSQL", (function() { return Ne4; })), ct3.d(X6, "replaceParams", (function() { return Yn2; })), ct3.d(X6, "returningToSQL", (function() { return gn2; })), ct3.d(X6, "hasVal", (function() { return P4; })), ct3.d(X6, "setParserOpt", (function() { return oe5; })), ct3.d(X6, "toUpper", (function() { return R4; })), ct3.d(X6, "topToSQL", (function() { return Ce4; })), ct3.d(X6, "triggerEventToSQL", (function() { return pn2; })); var i2 = { database: "mysql", type: "table", trimQuery: !0, parseOptions: { includeLocations: !1 } }, Wt2 = i2; function tt3(p3, y4, L5) { if (L5) return p3 ? "".concat(p3.toUpperCase(), " ").concat(y4(L5)) : y4(L5); } function t2(p3, y4) { if (y4) return "".concat(p3.toUpperCase(), " ").concat(y4); } function st3(p3) { var y4 = Et2(p3); if (Array.isArray(p3)) return { type: "expr_list", value: p3.map(st3) }; if (p3 === null) return { type: "null", value: null }; switch (y4) { case "boolean": return { type: "bool", value: p3 }; case "string": return { type: "string", value: p3 }; case "number": return { type: "number", value: p3 }; default: throw new Error('Cannot convert value "'.concat(y4, '" to SQL')); } } function ft3(p3, y4, L5) { var m3 = { operator: p3, type: "binary_expr" }; return m3.left = y4.type ? y4 : st3(y4), p3 === "BETWEEN" || p3 === "NOT BETWEEN" ? (m3.right = { type: "expr_list", value: [st3(L5[0]), st3(L5[1])] }, m3) : (m3.right = L5.type ? L5 : st3(L5), m3); } function xt(p3) { return p3; } function Mt() { return Wt2; } function oe5(p3) { Wt2 = p3; } function Ce4(p3) { if (p3) { var y4 = p3.value, L5 = p3.percent, m3 = p3.parentheses ? "(".concat(y4, ")") : y4, S3 = "TOP ".concat(m3); return L5 ? "".concat(S3, " ").concat(L5.toUpperCase()) : S3; } } function Zt(p3) { var y4 = Mt().database; if (p3) switch (y4 && y4.toLowerCase()) { case "athena": case "db2": case "postgresql": case "redshift": case "snowflake": case "noql": case "trino": case "sqlite": return '"'.concat(p3, '"'); case "transactsql": return "[".concat(p3, "]"); default: return "`".concat(p3, "`"); } } function yt2(p3, y4, L5) { if (y4 === !0) return "'".concat(p3, "'"); if (p3) { if (p3 === "*") return p3; if (L5 != null) return "".concat(L5).concat(p3).concat(L5); var m3 = Mt().database; switch (m3 && m3.toLowerCase()) { case "mysql": case "mariadb": return "`".concat(p3, "`"); case "athena": case "postgresql": case "redshift": case "snowflake": case "trino": case "noql": case "sqlite": return '"'.concat(p3, '"'); case "transactsql": return "[".concat(p3, "]"); case "bigquery": case "db2": return p3; default: return "`".concat(p3, "`"); } } } function R4(p3) { if (p3) return p3.toUpperCase(); } function P4(p3) { return p3; } function lt3(p3) { if (p3) { var y4 = p3.prefix, L5 = p3.type, m3 = p3.parentheses, S3 = p3.suffix, I3 = p3.value, N4 = Et2(p3) === "object" ? I3 : p3; switch (L5) { case "backticks_quote_string": N4 = "`".concat(I3, "`"); break; case "string": N4 = "'".concat(I3, "'"); break; case "regex_string": N4 = 'r"'.concat(I3, '"'); break; case "hex_string": N4 = "X'".concat(I3, "'"); break; case "full_hex_string": N4 = "0x".concat(I3); break; case "natural_string": N4 = "N'".concat(I3, "'"); break; case "bit_string": N4 = "b'".concat(I3, "'"); break; case "double_quote_string": N4 = '"'.concat(I3, '"'); break; case "single_quote_string": N4 = "'".concat(I3, "'"); break; case "boolean": case "bool": N4 = I3 ? "TRUE" : "FALSE"; break; case "null": N4 = "NULL"; break; case "star": N4 = "*"; break; case "param": N4 = "".concat(y4 || ":").concat(I3), y4 = null; break; case "origin": N4 = I3.toUpperCase(); break; case "date": case "datetime": case "time": case "timestamp": N4 = "".concat(L5.toUpperCase(), " '").concat(I3, "'"); break; case "var_string": N4 = "N'".concat(I3, "'"); break; case "unicode_string": N4 = "U&'".concat(I3, "'"); } var q4 = []; return y4 && q4.push(R4(y4)), q4.push(N4), S3 && (typeof S3 == "string" && q4.push(S3), Et2(S3) === "object" && (S3.collate ? q4.push(en2(S3.collate)) : q4.push(lt3(S3)))), N4 = q4.join(" "), m3 ? "(".concat(N4, ")") : N4; } } function ye4(p3) { if (!p3) return []; var y4 = p3.type, L5 = p3.symbol, m3 = p3.value; return [y4.toUpperCase(), L5, typeof m3 == "string" ? m3.toUpperCase() : lt3(m3)].filter(P4); } function Yn2(p3, y4) { return (function L5(m3, S3) { return Object.keys(m3).filter((function(I3) { var N4 = m3[I3]; return Array.isArray(N4) || Et2(N4) === "object" && N4 !== null; })).forEach((function(I3) { var N4 = m3[I3]; if (Et2(N4) !== "object" || N4.type !== "param") return L5(N4, S3); if (S3[N4.value] === void 0) throw new Error("no value for parameter :".concat(N4.value, " found")); return m3[I3] = st3(S3[N4.value]), null; })), m3; })(JSON.parse(JSON.stringify(p3)), y4); } function Ne4(p3) { var y4 = p3.type, L5 = p3.partitions; return [R4(y4), "(".concat(L5.map((function(m3) { if (m3.type !== "range") return lt3(m3); var S3 = m3.start, I3 = m3.end, N4 = m3.symbol; return "".concat(lt3(S3), " ").concat(R4(N4), " ").concat(lt3(I3)); })).join(", "), ")")].join(" "); } function Re4(p3) { var y4 = p3.schema, L5 = p3.dataType, m3 = p3.length, S3 = p3.parentheses, I3 = p3.scale, N4 = p3.suffix, q4 = ""; m3 != null && (q4 = I3 ? "".concat(m3, ", ").concat(I3) : m3), S3 && (q4 = "(".concat(q4, ")")), N4 && N4.length && (q4 += " ".concat(N4.join(" "))); var U4 = y4 ? "".concat(y4, ".") : ""; return "".concat(U4).concat(L5).concat(q4); } function xe4(p3) { if (p3) { var y4 = p3.dataType, L5 = p3.definition, m3 = p3.anglebracket, S3 = R4(y4); if (S3 !== "ARRAY" && S3 !== "STRUCT") return S3; var I3 = L5 && L5.map((function(N4) { return [N4.field_name, xe4(N4.field_type)].filter(P4).join(" "); })).join(", "); return m3 ? "".concat(S3, "<").concat(I3, ">") : "".concat(S3, " ").concat(I3); } } function fn2(p3) { if (p3) { var y4 = [], L5 = p3.keyword, m3 = p3.symbol, S3 = p3.value; return y4.push(L5.toUpperCase()), m3 && y4.push(m3), y4.push(lt3(S3)), y4.join(" "); } } function pn2(p3) { return p3.map((function(y4) { var L5 = y4.keyword, m3 = y4.args, S3 = [R4(L5)]; if (m3) { var I3 = m3.keyword, N4 = m3.columns; S3.push(R4(I3), N4.map(fe4).join(", ")); } return S3.join(" "); })).join(" OR "); } function gn2(p3) { return p3 ? ["RETURNING", p3.columns.map(Un2).filter(P4).join(", ")].join(" ") : ""; } function _n2(p3) { return p3 ? [R4(p3.keyword), R4(p3.args)] : []; } function $n2(p3) { if (p3) { if (typeof p3 == "string") { var y4 = Mt().database; return (y4 && y4.toLowerCase()) === "sqlite" ? "AUTOINCREMENT" : "AUTO_INCREMENT"; } var L5 = p3.keyword, m3 = p3.seed, S3 = p3.increment, I3 = p3.parentheses, N4 = R4(L5); return I3 && (N4 += "(".concat(lt3(m3), ", ").concat(lt3(S3), ")")), N4; } } function Hn2(p3) { if (p3) return p3.map(Au).filter(P4).join(", "); } function In2(p3) { return (function(y4) { if (Array.isArray(y4)) return Sn2(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || (function(y4, L5) { if (y4) { if (typeof y4 == "string") return Sn2(y4, L5); var m3 = {}.toString.call(y4).slice(8, -1); return m3 === "Object" && y4.constructor && (m3 = y4.constructor.name), m3 === "Map" || m3 === "Set" ? Array.from(y4) : m3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m3) ? Sn2(y4, L5) : void 0; } })(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function Sn2(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function je4(p3) { if (!p3) return []; var y4 = p3.keyword, L5 = p3.type; return [y4.toUpperCase(), R4(L5)]; } function Ye4(p3) { if (p3) { var y4 = p3.type, L5 = p3.expr, m3 = p3.symbol, S3 = y4.toUpperCase(), I3 = []; switch (I3.push(S3), S3) { case "KEY_BLOCK_SIZE": m3 && I3.push(m3), I3.push(lt3(L5)); break; case "BTREE": case "HASH": I3.length = 0, I3.push.apply(I3, In2(je4(p3))); break; case "WITH PARSER": I3.push(L5); break; case "VISIBLE": case "INVISIBLE": break; case "COMMENT": I3.shift(), I3.push(fn2(p3)); break; case "DATA_COMPRESSION": I3.push(m3, R4(L5.value), Ne4(L5.on)); break; default: I3.push(m3, lt3(L5)); } return I3.filter(P4).join(" "); } } function bn2(p3) { return p3 ? p3.map(Ye4) : []; } function vn2(p3) { var y4 = p3.constraint_type, L5 = p3.index_type, m3 = p3.index_options, S3 = m3 === void 0 ? [] : m3, I3 = p3.definition, N4 = p3.on, q4 = p3.with, U4 = []; if (U4.push.apply(U4, In2(je4(L5))), I3 && I3.length) { var H5 = R4(y4) === "CHECK" ? "(".concat($5(I3[0]), ")") : "(".concat(I3.map((function(Z5) { return $5(Z5); })).join(", "), ")"); U4.push(H5); } return U4.push(bn2(S3).join(" ")), q4 && U4.push("WITH (".concat(bn2(q4).join(", "), ")")), N4 && U4.push("ON [".concat(N4, "]")), U4; } function ie5(p3) { var y4 = p3.operator || p3.op, L5 = $5(p3.right), m3 = !1; if (Array.isArray(L5)) { switch (y4) { case "=": y4 = "IN"; break; case "!=": y4 = "NOT IN"; break; case "BETWEEN": case "NOT BETWEEN": m3 = !0, L5 = "".concat(L5[0], " AND ").concat(L5[1]); } m3 || (L5 = "(".concat(L5.join(", "), ")")); } var S3 = p3.right.escape || {}, I3 = Array.isArray(p3.left) ? p3.left.map($5).join(", ") : $5(p3.left), N4 = en2(p3.collate), q4 = [I3, y4, L5, R4(S3.type), $5(S3.value)].filter(P4).join(y4 === "." ? "" : " "), U4 = p3.parentheses ? "(".concat(q4, ")") : q4; return N4 && (U4 = "".concat(U4, " ").concat(N4)), U4; } function yn2(p3) { var y4 = p3.name, L5 = p3.type; switch (L5) { case "table": case "view": var m3 = [yt2(y4.db), yt2(y4.table)].filter(P4).join("."); return "".concat(R4(L5), " ").concat(m3); case "column": return "COLUMN ".concat(fe4(y4)); default: return "".concat(R4(L5), " ").concat(lt3(y4)); } } function $e4(p3) { var y4 = p3.keyword, L5 = p3.expr; return [R4(y4), lt3(L5)].filter(P4).join(" "); } function Wn2(p3) { return (function(y4) { if (Array.isArray(y4)) return Xe4(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || (function(y4, L5) { if (y4) { if (typeof y4 == "string") return Xe4(y4, L5); var m3 = {}.toString.call(y4).slice(8, -1); return m3 === "Object" && y4.constructor && (m3 = y4.constructor.name), m3 === "Map" || m3 === "Set" ? Array.from(y4) : m3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m3) ? Xe4(y4, L5) : void 0; } })(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function Xe4(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function Tn2(p3) { return p3 ? [p3.prefix.map(lt3).join(" "), $5(p3.value), p3.suffix.map(lt3).join(" ")] : []; } function Qe3(p3) { return p3 ? p3.fetch || p3.offset ? (L5 = (y4 = p3).fetch, m3 = y4.offset, [].concat(Wn2(Tn2(m3)), Wn2(Tn2(L5))).filter(P4).join(" ")) : (function(S3) { var I3 = S3.seperator, N4 = S3.value; return N4.length === 1 && I3 === "offset" ? t2("OFFSET", $5(N4[0])) : t2("LIMIT", N4.map($5).join("".concat(I3 === "offset" ? " " : "").concat(R4(I3), " "))); })(p3) : ""; var y4, L5, m3; } function Ze3(p3) { if (p3 && p3.length !== 0) { var y4 = p3[0].recursive ? "RECURSIVE " : "", L5 = p3.map((function(m3) { var S3 = m3.name, I3 = m3.stmt, N4 = m3.columns, q4 = Array.isArray(N4) ? "(".concat(N4.map(fe4).join(", "), ")") : "", U4 = tt3(I3.type === "values" ? "VALUES" : "", $5, I3); return "".concat(S3.type === "default" ? yt2(S3.value) : lt3(S3)).concat(q4, " AS (").concat(U4, ")"); })).join(", "); return "WITH ".concat(y4).concat(L5); } } function Vn2(p3) { if (p3 && p3.position) { var y4 = p3.keyword, L5 = p3.expr, m3 = [], S3 = R4(y4); return S3 === "VAR" ? m3.push(L5.map(to).join(", ")) : m3.push(S3, typeof L5 == "string" ? yt2(L5) : $5(L5)), m3.filter(P4).join(" "); } } function dn2(p3) { var y4 = p3.as_struct_val, L5 = p3.columns, m3 = p3.collate, S3 = p3.distinct, I3 = p3.for, N4 = p3.from, q4 = p3.for_sys_time_as_of, U4 = q4 === void 0 ? {} : q4, H5 = p3.locking_read, Z5 = p3.groupby, ut3 = p3.having, pt2 = p3.into, vt2 = pt2 === void 0 ? {} : pt2, wt2 = p3.isolation, Rt = p3.limit, mt3 = p3.options, gt2 = p3.orderby, Ct = p3.parentheses_symbol, Ft2 = p3.qualify, qt2 = p3.top, te5 = p3.window, Gt2 = p3.with, se3 = p3.where, Yt2 = [Ze3(Gt2), "SELECT", R4(y4)]; Array.isArray(mt3) && Yt2.push(mt3.join(" ")), Yt2.push((function(re3) { if (re3) { if (typeof re3 == "string") return re3; var Ue4 = re3.type, qe4 = re3.columns, Be4 = [R4(Ue4)]; return qe4 && Be4.push("(".concat(qe4.map($5).join(", "), ")")), Be4.filter(P4).join(" "); } })(S3), Ce4(qt2), Ln2(L5, N4)); var ae4 = vt2.position, Ae4 = ""; ae4 && (Ae4 = tt3("INTO", Vn2, vt2)), ae4 === "column" && Yt2.push(Ae4), Yt2.push(tt3("FROM", ne6, N4)), ae4 === "from" && Yt2.push(Ae4); var we4 = U4 || {}, me4 = we4.keyword, uo = we4.expr; Yt2.push(tt3(me4, $5, uo)), Yt2.push(tt3("WHERE", $5, se3)), Z5 && (Yt2.push(t2("GROUP BY", eo(Z5.columns).join(", "))), Yt2.push(eo(Z5.modifiers).join(", "))), Yt2.push(tt3("HAVING", $5, ut3)), Yt2.push(tt3("QUALIFY", $5, Ft2)), Yt2.push(tt3("WINDOW", $5, te5)), Yt2.push(Se4(gt2, "order by")), Yt2.push(en2(m3)), Yt2.push(Qe3(Rt)), wt2 && Yt2.push(tt3(wt2.keyword, lt3, wt2.expr)), Yt2.push(R4(H5)), ae4 === "end" && Yt2.push(Ae4), Yt2.push((function(re3) { if (re3) { var Ue4 = re3.expr, qe4 = re3.keyword, Be4 = [R4(re3.type), R4(qe4)]; return Ue4 ? "".concat(Be4.join(" "), "(").concat($5(Ue4), ")") : Be4.join(" "); } })(I3)); var Jn2 = Yt2.filter(P4).join(" "); return Ct ? "(".concat(Jn2, ")") : Jn2; } function Je3(p3, y4) { var L5 = typeof Symbol < "u" && p3[Symbol.iterator] || p3["@@iterator"]; if (!L5) { if (Array.isArray(p3) || (L5 = (function(U4, H5) { if (U4) { if (typeof U4 == "string") return On2(U4, H5); var Z5 = {}.toString.call(U4).slice(8, -1); return Z5 === "Object" && U4.constructor && (Z5 = U4.constructor.name), Z5 === "Map" || Z5 === "Set" ? Array.from(U4) : Z5 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z5) ? On2(U4, H5) : void 0; } })(p3)) || y4 && p3 && typeof p3.length == "number") { L5 && (p3 = L5); var m3 = 0, S3 = function() { }; return { s: S3, n: function() { return m3 >= p3.length ? { done: !0 } : { done: !1, value: p3[m3++] }; }, e: function(U4) { throw U4; }, f: S3 }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var I3, N4 = !0, q4 = !1; return { s: function() { L5 = L5.call(p3); }, n: function() { var U4 = L5.next(); return N4 = U4.done, U4; }, e: function(U4) { q4 = !0, I3 = U4; }, f: function() { try { N4 || L5.return == null || L5.return(); } finally { if (q4) throw I3; } } }; } function On2(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function tn2(p3) { if (!p3 || p3.length === 0) return ""; var y4, L5 = [], m3 = Je3(p3); try { for (m3.s(); !(y4 = m3.n()).done; ) { var S3 = y4.value, I3 = {}, N4 = S3.value; for (var q4 in S3) q4 !== "value" && q4 !== "keyword" && (I3[q4] = S3[q4]); var U4 = [fe4(I3)], H5 = ""; N4 && (H5 = $5(N4), U4.push("=", H5)), L5.push(U4.filter(P4).join(" ")); } } catch (Z5) { m3.e(Z5); } finally { m3.f(); } return L5.join(", "); } function Gr(p3) { var y4 = p3.name, L5 = p3.value; return ["@".concat(y4), "=", $5(L5)].filter(P4).join(" "); } function Nn2(p3) { if (!p3) return ""; var y4 = p3.keyword, L5 = p3.terminated, m3 = p3.enclosed, S3 = p3.escaped; return [R4(y4), lt3(L5), lt3(m3), lt3(S3)].filter(P4).join(" "); } function ke4(p3) { if (!p3) return ""; var y4 = p3.keyword, L5 = p3.starting, m3 = p3.terminated; return [R4(y4), lt3(L5), lt3(m3)].filter(P4).join(" "); } function fr(p3) { if (!p3) return ""; var y4 = p3.count, L5 = p3.suffix; return ["IGNORE", lt3(y4), L5].filter(P4).join(" "); } function He4(p3) { if (!p3) return ""; var y4 = p3.mode, L5 = p3.local, m3 = p3.file, S3 = p3.replace_ignore, I3 = p3.table, N4 = p3.partition, q4 = p3.character_set, U4 = p3.column, H5 = p3.fields, Z5 = p3.lines, ut3 = p3.set, pt2 = p3.ignore; return ["LOAD DATA", R4(y4), R4(L5), "INFILE", lt3(m3), R4(S3), "INTO TABLE", Kt2(I3), T5(N4), tt3("CHARACTER SET", lt3, q4), Nn2(H5), ke4(Z5), fr(pt2), Ln2(U4), tt3("SET", tn2, ut3)].filter(P4).join(" "); } function zn2(p3) { var y4 = p3.left, L5 = p3.right, m3 = p3.symbol, S3 = p3.keyword; y4.keyword = S3; var I3 = $5(y4), N4 = $5(L5); return [I3, R4(m3), N4].filter(P4).join(" "); } function Kn2(p3) { var y4, L5, m3, S3, I3 = p3.keyword, N4 = p3.suffix, q4 = ""; switch (R4(I3)) { case "BINLOG": L5 = (y4 = p3).in, m3 = y4.from, S3 = y4.limit, q4 = [tt3("IN", lt3, L5 && L5.right), tt3("FROM", ne6, m3), Qe3(S3)].filter(P4).join(" "); break; case "CHARACTER": case "COLLATION": q4 = (function(U4) { var H5 = U4.expr; if (H5) return R4(H5.op) === "LIKE" ? tt3("LIKE", lt3, H5.right) : tt3("WHERE", $5, H5); })(p3); break; case "COLUMNS": case "INDEXES": case "INDEX": q4 = tt3("FROM", ne6, p3.from); break; case "GRANTS": q4 = (function(U4) { var H5 = U4.for; if (H5) { var Z5 = H5.user, ut3 = H5.host, pt2 = H5.role_list, vt2 = "'".concat(Z5, "'"); return ut3 && (vt2 += "@'".concat(ut3, "'")), ["FOR", vt2, pt2 && "USING", pt2 && pt2.map((function(wt2) { return "'".concat(wt2, "'"); })).join(", ")].filter(P4).join(" "); } })(p3); break; case "CREATE": q4 = tt3("", Kt2, p3[N4]); break; case "VAR": q4 = to(p3.var), I3 = ""; } return ["SHOW", R4(I3), R4(N4), q4].filter(P4).join(" "); } var pr = { alter: function(p3) { var y4 = p3.keyword; switch (y4 === void 0 ? "table" : y4) { case "aggregate": return (function(L5) { var m3 = L5.args, S3 = L5.expr, I3 = L5.keyword, N4 = L5.name, q4 = L5.type, U4 = m3.expr, H5 = m3.orderby; return [R4(q4), R4(I3), [[yt2(N4.schema), yt2(N4.name)].filter(P4).join("."), "(".concat(U4.map(jn2).join(", ")).concat(H5 ? [" ORDER", "BY", H5.map(jn2).join(", ")].join(" ") : "", ")")].filter(P4).join(""), hn2(S3)].filter(P4).join(" "); })(p3); case "table": return (function(L5) { var m3 = L5.type, S3 = L5.table, I3 = L5.if_exists, N4 = L5.prefix, q4 = L5.expr, U4 = q4 === void 0 ? [] : q4, H5 = R4(m3), Z5 = ne6(S3), ut3 = U4.map($5); return [H5, "TABLE", R4(I3), lt3(N4), Z5, ut3.join(", ")].filter(P4).join(" "); })(p3); case "schema": return (function(L5) { var m3 = L5.expr, S3 = L5.keyword, I3 = L5.schema; return [R4(L5.type), R4(S3), yt2(I3), hn2(m3)].filter(P4).join(" "); })(p3); case "sequence": return (function(L5) { var m3 = L5.type, S3 = L5.keyword, I3 = L5.sequence, N4 = L5.if_exists, q4 = L5.expr, U4 = q4 === void 0 ? [] : q4, H5 = R4(m3), Z5 = ne6(I3), ut3 = U4.map(xn2); return [H5, R4(S3), R4(N4), Z5, ut3.join(", ")].filter(P4).join(" "); })(p3); case "domain": case "type": return (function(L5) { var m3 = L5.expr, S3 = L5.keyword, I3 = L5.name; return [R4(L5.type), R4(S3), [yt2(I3.schema), yt2(I3.name)].filter(P4).join("."), hn2(m3)].filter(P4).join(" "); })(p3); case "function": return (function(L5) { var m3 = L5.args, S3 = L5.expr, I3 = L5.keyword, N4 = L5.name; return [R4(L5.type), R4(I3), [[yt2(N4.schema), yt2(N4.name)].filter(P4).join("."), m3 && "(".concat(m3.expr ? m3.expr.map(jn2).join(", ") : "", ")")].filter(P4).join(""), hn2(S3)].filter(P4).join(" "); })(p3); case "view": return (function(L5) { var m3 = L5.type, S3 = L5.columns, I3 = L5.attributes, N4 = L5.select, q4 = L5.view, U4 = L5.with, H5 = R4(m3), Z5 = Kt2(q4), ut3 = [H5, "VIEW", Z5]; return S3 && ut3.push("(".concat(S3.map(fe4).join(", "), ")")), I3 && ut3.push("WITH ".concat(I3.map(R4).join(", "))), ut3.push("AS", dn2(N4)), U4 && ut3.push(R4(U4)), ut3.filter(P4).join(" "); })(p3); } }, analyze: function(p3) { var y4 = p3.type, L5 = p3.table; return [R4(y4), Kt2(L5)].join(" "); }, attach: function(p3) { var y4 = p3.type, L5 = p3.database, m3 = p3.expr, S3 = p3.as, I3 = p3.schema; return [R4(y4), R4(L5), $5(m3), R4(S3), yt2(I3)].filter(P4).join(" "); }, create: function(p3) { var y4 = p3.keyword, L5 = ""; switch (y4.toLowerCase()) { case "aggregate": L5 = (function(m3) { var S3 = m3.type, I3 = m3.replace, N4 = m3.keyword, q4 = m3.name, U4 = m3.args, H5 = m3.options, Z5 = [R4(S3), R4(I3), R4(N4)], ut3 = [yt2(q4.schema), q4.name].filter(P4).join("."), pt2 = "".concat(U4.expr.map(jn2).join(", ")).concat(U4.orderby ? [" ORDER", "BY", U4.orderby.map(jn2).join(", ")].join(" ") : ""); return Z5.push("".concat(ut3, "(").concat(pt2, ")"), "(".concat(H5.map(mu).join(", "), ")")), Z5.filter(P4).join(" "); })(p3); break; case "table": L5 = (function(m3) { var S3 = m3.type, I3 = m3.keyword, N4 = m3.table, q4 = m3.like, U4 = m3.as, H5 = m3.temporary, Z5 = m3.if_not_exists, ut3 = m3.create_definitions, pt2 = m3.table_options, vt2 = m3.ignore_replace, wt2 = m3.replace, Rt = m3.partition_of, mt3 = m3.query_expr, gt2 = m3.unlogged, Ct = m3.with, Ft2 = [R4(S3), R4(wt2), R4(H5), R4(gt2), R4(I3), R4(Z5), ne6(N4)]; if (q4) { var qt2 = q4.type, te5 = ne6(q4.table); return Ft2.push(R4(qt2), te5), Ft2.filter(P4).join(" "); } if (Rt) return Ft2.concat([hu(Rt)]).filter(P4).join(" "); if (ut3 && Ft2.push("(".concat(ut3.map(xn2).join(", "), ")")), pt2) { var Gt2 = Mt().database, se3 = Gt2 && Gt2.toLowerCase() === "sqlite" ? ", " : " "; Ft2.push(pt2.map(Rn2).join(se3)); } if (Ct) { var Yt2 = Ct.map((function(ae4) { return [lt3(ae4.keyword), R4(ae4.symbol), lt3(ae4.value)].join(" "); })).join(", "); Ft2.push("WITH (".concat(Yt2, ")")); } return Ft2.push(R4(vt2), R4(U4)), mt3 && Ft2.push(Tt(mt3)), Ft2.filter(P4).join(" "); })(p3); break; case "trigger": L5 = p3.resource === "constraint" ? (function(m3) { var S3 = m3.constraint, I3 = m3.constraint_kw, N4 = m3.deferrable, q4 = m3.events, U4 = m3.execute, H5 = m3.for_each, Z5 = m3.from, ut3 = m3.location, pt2 = m3.keyword, vt2 = m3.or, wt2 = m3.type, Rt = m3.table, mt3 = m3.when, gt2 = [R4(wt2), R4(vt2), R4(I3), R4(pt2), yt2(S3), R4(ut3)], Ct = pn2(q4); return gt2.push(Ct, "ON", Kt2(Rt)), Z5 && gt2.push("FROM", Kt2(Z5)), gt2.push.apply(gt2, Zr(_n2(N4)).concat(Zr(_n2(H5)))), mt3 && gt2.push(R4(mt3.type), $5(mt3.cond)), gt2.push(R4(U4.keyword), Qr(U4.expr)), gt2.filter(P4).join(" "); })(p3) : (function(m3) { var S3 = m3.definer, I3 = m3.for_each, N4 = m3.keyword, q4 = m3.execute, U4 = m3.type, H5 = m3.table, Z5 = m3.if_not_exists, ut3 = m3.temporary, pt2 = m3.trigger, vt2 = m3.events, wt2 = m3.order, Rt = m3.time, mt3 = m3.when, gt2 = [R4(U4), R4(ut3), $5(S3), R4(N4), R4(Z5), Kt2(pt2), R4(Rt), vt2.map((function(Ct) { var Ft2 = [R4(Ct.keyword)], qt2 = Ct.args; return qt2 && Ft2.push(R4(qt2.keyword), qt2.columns.map(fe4).join(", ")), Ft2.join(" "); })), "ON", Kt2(H5), R4(I3 && I3.keyword), R4(I3 && I3.args), wt2 && "".concat(R4(wt2.keyword), " ").concat(yt2(wt2.trigger)), tt3("WHEN", $5, mt3), R4(q4.prefix)]; switch (q4.type) { case "set": gt2.push(tt3("SET", tn2, q4.expr)); break; case "multiple": gt2.push(ge4(q4.expr.ast)); } return gt2.push(R4(q4.suffix)), gt2.filter(P4).join(" "); })(p3); break; case "extension": L5 = (function(m3) { var S3 = m3.extension, I3 = m3.from, N4 = m3.if_not_exists, q4 = m3.keyword, U4 = m3.schema, H5 = m3.type, Z5 = m3.with, ut3 = m3.version; return [R4(H5), R4(q4), R4(N4), lt3(S3), R4(Z5), tt3("SCHEMA", lt3, U4), tt3("VERSION", lt3, ut3), tt3("FROM", lt3, I3)].filter(P4).join(" "); })(p3); break; case "function": L5 = (function(m3) { var S3 = m3.type, I3 = m3.replace, N4 = m3.keyword, q4 = m3.name, U4 = m3.args, H5 = m3.returns, Z5 = m3.options, ut3 = m3.last, pt2 = [R4(S3), R4(I3), R4(N4)], vt2 = [lt3(q4.schema), q4.name.map(lt3).join(".")].filter(P4).join("."), wt2 = U4.map(jn2).filter(P4).join(", "); return pt2.push("".concat(vt2, "(").concat(wt2, ")"), (function(Rt) { var mt3 = Rt.type, gt2 = Rt.keyword, Ct = Rt.expr; return [R4(mt3), R4(gt2), Array.isArray(Ct) ? "(".concat(Ct.map(dr).join(", "), ")") : wu(Ct)].filter(P4).join(" "); })(H5), Z5.map(Ho).join(" "), ut3), pt2.filter(P4).join(" "); })(p3); break; case "index": L5 = (function(m3) { var S3 = m3.concurrently, I3 = m3.filestream_on, N4 = m3.keyword, q4 = m3.if_not_exists, U4 = m3.include, H5 = m3.index_columns, Z5 = m3.index_type, ut3 = m3.index_using, pt2 = m3.index, vt2 = m3.on, wt2 = m3.index_options, Rt = m3.algorithm_option, mt3 = m3.lock_option, gt2 = m3.on_kw, Ct = m3.table, Ft2 = m3.tablespace, qt2 = m3.type, te5 = m3.where, Gt2 = m3.with, se3 = m3.with_before_where, Yt2 = Gt2 && "WITH (".concat(bn2(Gt2).join(", "), ")"), ae4 = U4 && "".concat(R4(U4.keyword), " (").concat(U4.columns.map((function(me4) { return typeof me4 == "string" ? yt2(me4) : $5(me4); })).join(", "), ")"), Ae4 = pt2; pt2 && (Ae4 = typeof pt2 == "string" ? yt2(pt2) : [yt2(pt2.schema), yt2(pt2.name)].filter(P4).join(".")); var we4 = [R4(qt2), R4(Z5), R4(N4), R4(q4), R4(S3), Ae4, R4(gt2), Kt2(Ct)].concat(Zr(je4(ut3)), ["(".concat(Hn2(H5), ")"), ae4, bn2(wt2).join(" "), hn2(Rt), hn2(mt3), tt3("TABLESPACE", lt3, Ft2)]); return se3 ? we4.push(Yt2, tt3("WHERE", $5, te5)) : we4.push(tt3("WHERE", $5, te5), Yt2), we4.push(tt3("ON", $5, vt2), tt3("FILESTREAM_ON", lt3, I3)), we4.filter(P4).join(" "); })(p3); break; case "sequence": L5 = (function(m3) { var S3 = m3.type, I3 = m3.keyword, N4 = m3.sequence, q4 = m3.temporary, U4 = m3.if_not_exists, H5 = m3.create_definitions, Z5 = [R4(S3), R4(q4), R4(I3), R4(U4), ne6(N4)]; return H5 && Z5.push(H5.map(xn2).join(" ")), Z5.filter(P4).join(" "); })(p3); break; case "database": case "schema": L5 = (function(m3) { var S3 = m3.type, I3 = m3.keyword, N4 = m3.replace, q4 = m3.if_not_exists, U4 = m3.create_definitions, H5 = m3[I3], Z5 = H5.db, ut3 = H5.schema, pt2 = [lt3(Z5), ut3.map(lt3).join(".")].filter(P4).join("."), vt2 = [R4(S3), R4(N4), R4(I3), R4(q4), pt2]; return U4 && vt2.push(U4.map(Rn2).join(" ")), vt2.filter(P4).join(" "); })(p3); break; case "view": L5 = (function(m3) { var S3 = m3.algorithm, I3 = m3.columns, N4 = m3.definer, q4 = m3.if_not_exists, U4 = m3.keyword, H5 = m3.recursive, Z5 = m3.replace, ut3 = m3.select, pt2 = m3.sql_security, vt2 = m3.temporary, wt2 = m3.type, Rt = m3.view, mt3 = m3.with, gt2 = m3.with_options, Ct = Rt.db, Ft2 = Rt.schema, qt2 = Rt.view, te5 = [yt2(Ct), yt2(Ft2), yt2(qt2)].filter(P4).join("."); return [R4(wt2), R4(Z5), R4(vt2), R4(H5), S3 && "ALGORITHM = ".concat(R4(S3)), $5(N4), pt2 && "SQL SECURITY ".concat(R4(pt2)), R4(U4), R4(q4), te5, I3 && "(".concat(I3.map(Zt).join(", "), ")"), gt2 && ["WITH", "(".concat(gt2.map((function(Gt2) { return ye4(Gt2).join(" "); })).join(", "), ")")].join(" "), "AS", Tt(ut3), R4(mt3)].filter(P4).join(" "); })(p3); break; case "domain": L5 = (function(m3) { var S3 = m3.as, I3 = m3.domain, N4 = m3.type, q4 = m3.keyword, U4 = m3.target, H5 = m3.create_definitions, Z5 = [R4(N4), R4(q4), [yt2(I3.schema), yt2(I3.name)].filter(P4).join("."), R4(S3), Re4(U4)]; if (H5 && H5.length > 0) { var ut3, pt2 = [], vt2 = (function(mt3, gt2) { var Ct = typeof Symbol < "u" && mt3[Symbol.iterator] || mt3["@@iterator"]; if (!Ct) { if (Array.isArray(mt3) || (Ct = $o(mt3)) || gt2 && mt3 && typeof mt3.length == "number") { Ct && (mt3 = Ct); var Ft2 = 0, qt2 = function() { }; return { s: qt2, n: function() { return Ft2 >= mt3.length ? { done: !0 } : { done: !1, value: mt3[Ft2++] }; }, e: function(Yt2) { throw Yt2; }, f: qt2 }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var te5, Gt2 = !0, se3 = !1; return { s: function() { Ct = Ct.call(mt3); }, n: function() { var Yt2 = Ct.next(); return Gt2 = Yt2.done, Yt2; }, e: function(Yt2) { se3 = !0, te5 = Yt2; }, f: function() { try { Gt2 || Ct.return == null || Ct.return(); } finally { if (se3) throw te5; } } }; })(H5); try { for (vt2.s(); !(ut3 = vt2.n()).done; ) { var wt2 = ut3.value, Rt = wt2.type; switch (Rt) { case "collate": pt2.push($5(wt2)); break; case "default": pt2.push(R4(Rt), $5(wt2.value)); break; case "constraint": pt2.push(Kr(wt2)); } } } catch (mt3) { vt2.e(mt3); } finally { vt2.f(); } Z5.push(pt2.filter(P4).join(" ")); } return Z5.filter(P4).join(" "); })(p3); break; case "type": L5 = (function(m3) { var S3 = m3.as, I3 = m3.create_definitions, N4 = m3.keyword, q4 = m3.name, U4 = m3.resource, H5 = [R4(m3.type), R4(N4), [yt2(q4.schema), yt2(q4.name)].filter(P4).join("."), R4(S3), R4(U4)]; if (I3) { var Z5 = []; switch (U4) { case "enum": case "range": Z5.push($5(I3)); break; default: Z5.push("(".concat(I3.map(xn2).join(", "), ")")); } H5.push(Z5.filter(P4).join(" ")); } return H5.filter(P4).join(" "); })(p3); break; case "user": L5 = (function(m3) { var S3 = m3.attribute, I3 = m3.comment, N4 = m3.default_role, q4 = m3.if_not_exists, U4 = m3.keyword, H5 = m3.lock_option, Z5 = m3.password_options, ut3 = m3.require, pt2 = m3.resource_options, vt2 = m3.type, wt2 = m3.user.map((function(mt3) { var gt2 = mt3.user, Ct = mt3.auth_option, Ft2 = [vr(gt2)]; return Ct && Ft2.push(R4(Ct.keyword), Ct.auth_plugin, lt3(Ct.value)), Ft2.filter(P4).join(" "); })).join(", "), Rt = [R4(vt2), R4(U4), R4(q4), wt2]; return N4 && Rt.push(R4(N4.keyword), N4.value.map(vr).join(", ")), Rt.push(tt3(ut3 && ut3.keyword, $5, ut3 && ut3.value)), pt2 && Rt.push(R4(pt2.keyword), pt2.value.map((function(mt3) { return $5(mt3); })).join(" ")), Z5 && Z5.forEach((function(mt3) { return Rt.push(tt3(mt3.keyword, $5, mt3.value)); })), Rt.push(lt3(H5), fn2(I3), lt3(S3)), Rt.filter(P4).join(" "); })(p3); break; default: throw new Error("unknown create resource ".concat(y4)); } return L5; }, comment: function(p3) { var y4 = p3.expr, L5 = p3.keyword, m3 = p3.target; return [R4(p3.type), R4(L5), yn2(m3), $e4(y4)].filter(P4).join(" "); }, select: dn2, deallocate: function(p3) { var y4 = p3.type, L5 = p3.keyword, m3 = p3.expr; return [R4(y4), R4(L5), $5(m3)].filter(P4).join(" "); }, delete: function(p3) { var y4 = p3.columns, L5 = p3.from, m3 = p3.table, S3 = p3.where, I3 = p3.orderby, N4 = p3.with, q4 = p3.limit, U4 = p3.returning, H5 = [Ze3(N4), "DELETE"], Z5 = Ln2(y4, L5); return H5.push(Z5), Array.isArray(m3) && (m3.length === 1 && m3[0].addition === !0 || H5.push(ne6(m3))), H5.push(tt3("FROM", ne6, L5)), H5.push(tt3("WHERE", $5, S3)), H5.push(Se4(I3, "order by")), H5.push(Qe3(q4)), H5.push(gn2(U4)), H5.filter(P4).join(" "); }, exec: function(p3) { var y4 = p3.keyword, L5 = p3.module, m3 = p3.parameters; return [R4(y4), Kt2(L5), (m3 || []).map(Gr).filter(P4).join(", ")].filter(P4).join(" "); }, execute: function(p3) { var y4 = p3.type, L5 = p3.name, m3 = p3.args, S3 = [R4(y4)], I3 = [L5]; return m3 && I3.push("(".concat($5(m3).join(", "), ")")), S3.push(I3.join("")), S3.filter(P4).join(" "); }, explain: function(p3) { var y4 = p3.type, L5 = p3.expr; return [R4(y4), dn2(L5)].join(" "); }, for: function(p3) { var y4 = p3.type, L5 = p3.label, m3 = p3.target, S3 = p3.query, I3 = p3.stmts; return [L5, R4(y4), m3, "IN", ge4([S3]), "LOOP", ge4(I3), "END LOOP", L5].filter(P4).join(" "); }, update: function(p3) { var y4 = p3.from, L5 = p3.table, m3 = p3.set, S3 = p3.where, I3 = p3.orderby, N4 = p3.with, q4 = p3.limit, U4 = p3.returning; return [Ze3(N4), "UPDATE", ne6(L5), tt3("SET", tn2, m3), tt3("FROM", ne6, y4), tt3("WHERE", $5, S3), Se4(I3, "order by"), Qe3(q4), gn2(U4)].filter(P4).join(" "); }, if: function(p3) { var y4 = p3.boolean_expr, L5 = p3.else_expr, m3 = p3.elseif_expr, S3 = p3.if_expr, I3 = p3.prefix, N4 = p3.go, q4 = p3.semicolons, U4 = p3.suffix, H5 = [R4(p3.type), $5(y4), lt3(I3), "".concat(br(S3.ast || S3)).concat(q4[0]), R4(N4)]; return m3 && H5.push(m3.map((function(Z5) { return [R4(Z5.type), $5(Z5.boolean_expr), "THEN", br(Z5.then.ast || Z5.then), Z5.semicolon].filter(P4).join(" "); })).join(" ")), L5 && H5.push("ELSE", "".concat(br(L5.ast || L5)).concat(q4[1])), H5.push(lt3(U4)), H5.filter(P4).join(" "); }, insert: Y5, load_data: He4, drop: Wr, truncate: Wr, replace: Y5, declare: function(p3) { var y4 = p3.type, L5 = p3.declare, m3 = p3.symbol, S3 = [R4(y4)], I3 = L5.map((function(N4) { var q4 = N4.at, U4 = N4.name, H5 = N4.as, Z5 = N4.constant, ut3 = N4.datatype, pt2 = N4.not_null, vt2 = N4.prefix, wt2 = N4.definition, Rt = N4.keyword, mt3 = [[q4, U4].filter(P4).join(""), R4(H5), R4(Z5)]; switch (Rt) { case "variable": mt3.push(Jo(ut3), $5(N4.collate), R4(pt2)), wt2 && mt3.push(R4(wt2.keyword), $5(wt2.value)); break; case "cursor": mt3.push(R4(vt2)); break; case "table": mt3.push(R4(vt2), "(".concat(wt2.map(xn2).join(", "), ")")); } return mt3.filter(P4).join(" "); })).join("".concat(m3, " ")); return S3.push(I3), S3.join(" "); }, use: function(p3) { var y4 = p3.type, L5 = p3.db, m3 = R4(y4), S3 = yt2(L5); return "".concat(m3, " ").concat(S3); }, rename: function(p3) { var y4 = p3.type, L5 = p3.table, m3 = [], S3 = "".concat(y4 && y4.toUpperCase(), " TABLE"); if (L5) { var I3, N4 = Uo(L5); try { for (N4.s(); !(I3 = N4.n()).done; ) { var q4 = I3.value.map(Kt2); m3.push(q4.join(" TO ")); } } catch (U4) { N4.e(U4); } finally { N4.f(); } } return "".concat(S3, " ").concat(m3.join(", ")); }, call: function(p3) { var y4 = $5(p3.expr); return "".concat("CALL", " ").concat(y4); }, desc: Vr, describe: Vr, set: function(p3) { var y4 = p3.type, L5 = p3.expr, m3 = p3.keyword, S3 = R4(y4), I3 = L5.map($5).join(", "); return [S3, R4(m3), I3].filter(P4).join(" "); }, lock: Do, unlock: Do, show: Kn2, grant: qo, revoke: qo, proc: function(p3) { var y4 = p3.stmt; switch (y4.type) { case "assign": return zn2(y4); case "return": return (function(L5) { var m3 = L5.type, S3 = L5.expr; return [R4(m3), $5(S3)].join(" "); })(y4); } }, raise: function(p3) { var y4 = p3.type, L5 = p3.level, m3 = p3.raise, S3 = p3.using, I3 = [R4(y4), R4(L5)]; return m3 && I3.push([lt3(m3.keyword), m3.type === "format" && m3.expr.length > 0 && ","].filter(P4).join(""), m3.expr.map((function(N4) { return $5(N4); })).join(", ")), S3 && I3.push(R4(S3.type), R4(S3.option), S3.symbol, S3.expr.map((function(N4) { return $5(N4); })).join(", ")), I3.filter(P4).join(" "); }, transaction: function(p3) { var y4 = p3.expr, L5 = y4.action, m3 = y4.keyword, S3 = y4.modes, I3 = [lt3(L5), R4(m3)]; return S3 && I3.push(S3.map(lt3).join(", ")), I3.filter(P4).join(" "); } }; function Tt(p3) { if (!p3) return ""; for (var y4 = pr[p3.type], L5 = p3, m3 = L5._parentheses, S3 = L5._orderby, I3 = L5._limit, N4 = [m3 && "(", y4(p3)]; p3._next; ) { var q4 = pr[p3._next.type], U4 = R4(p3.set_op); N4.push(U4, q4(p3._next)), p3 = p3._next; } return N4.push(m3 && ")", Se4(S3, "order by"), Qe3(I3)), N4.filter(P4).join(" "); } function ge4(p3) { for (var y4 = [], L5 = 0, m3 = p3.length; L5 < m3; ++L5) { var S3 = p3[L5] && p3[L5].ast ? p3[L5].ast : p3[L5], I3 = Tt(S3); L5 === m3 - 1 && S3.type === "transaction" && (I3 = "".concat(I3, " ;")), y4.push(I3); } return y4.join(" ; "); } function g4(p3) { var y4 = p3.type; return y4 === "select" ? Tt(p3) : (y4 === "values" ? p3.values : p3).map((function(L5) { var m3 = $5(L5); return [R4(L5.prefix), "(".concat(m3, ")")].filter(P4).join(""); })).join(", "); } function T5(p3) { if (!p3) return ""; var y4 = ["PARTITION", "("]; if (Array.isArray(p3)) y4.push(p3.map((function(m3) { return yt2(m3); })).join(", ")); else { var L5 = p3.value; y4.push(L5.map($5).join(", ")); } return y4.push(")"), y4.filter(P4).join(""); } function x5(p3) { if (!p3) return ""; if (p3.type === "column") return "(".concat(p3.expr.map(fe4).join(", "), ")"); } function D4(p3) { var y4 = p3.expr, L5 = p3.keyword, m3 = y4.type, S3 = [R4(L5)]; switch (m3) { case "origin": S3.push(lt3(y4)); break; case "update": S3.push("UPDATE", tt3("SET", tn2, y4.set), tt3("WHERE", $5, y4.where)); } return S3.filter(P4).join(" "); } function V3(p3) { if (!p3) return ""; var y4 = p3.action; return [x5(p3.target), D4(y4)].filter(P4).join(" "); } function Y5(p3) { var y4 = p3.table, L5 = p3.type, m3 = p3.or, S3 = m3 === void 0 ? [] : m3, I3 = p3.prefix, N4 = I3 === void 0 ? "into" : I3, q4 = p3.columns, U4 = p3.conflict, H5 = p3.values, Z5 = p3.where, ut3 = p3.on_duplicate_update, pt2 = p3.partition, vt2 = p3.returning, wt2 = p3.set, Rt = ut3 || {}, mt3 = Rt.keyword, gt2 = Rt.set, Ct = [R4(L5), S3.map(lt3).join(" "), R4(N4), ne6(y4), T5(pt2)]; return Array.isArray(q4) && Ct.push("(".concat(q4.map(lt3).join(", "), ")")), Ct.push(tt3(H5 && H5.type === "values" ? "VALUES" : "", g4, H5)), Ct.push(tt3("ON CONFLICT", V3, U4)), Ct.push(tt3("SET", tn2, wt2)), Ct.push(tt3("WHERE", $5, Z5)), Ct.push(tt3(mt3, tn2, gt2)), Ct.push(gn2(vt2)), Ct.filter(P4).join(" "); } function et3(p3) { var y4 = p3.expr, L5 = p3.unit, m3 = p3.suffix; return ["INTERVAL", $5(y4), R4(L5), $5(m3)].filter(P4).join(" "); } function J5(p3) { return (function(y4) { if (Array.isArray(y4)) return nt3(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || (function(y4, L5) { if (y4) { if (typeof y4 == "string") return nt3(y4, L5); var m3 = {}.toString.call(y4).slice(8, -1); return m3 === "Object" && y4.constructor && (m3 = y4.constructor.name), m3 === "Map" || m3 === "Set" ? Array.from(y4) : m3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m3) ? nt3(y4, L5) : void 0; } })(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function nt3(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function jt(p3) { var y4 = p3.type, L5 = p3.as, m3 = p3.expr, S3 = p3.with_offset; return ["".concat(R4(y4), "(").concat(m3 && $5(m3) || "", ")"), tt3("AS", typeof L5 == "string" ? yt2 : $5, L5), tt3(R4(S3 && S3.keyword), yt2, S3 && S3.as)].filter(P4).join(" "); } function Ht2(p3) { if (p3) switch (p3.type) { case "pivot": case "unpivot": return (function(y4) { var L5 = y4.as, m3 = y4.column, S3 = y4.expr, I3 = y4.in_expr, N4 = y4.type, q4 = [$5(S3), "FOR", fe4(m3), ie5(I3)], U4 = ["".concat(R4(N4), "(").concat(q4.join(" "), ")")]; return L5 && U4.push("AS", yt2(L5)), U4.join(" "); })(p3); default: return ""; } } function kt(p3) { if (p3) { var y4 = p3.keyword, L5 = p3.expr, m3 = p3.index, S3 = p3.index_columns, I3 = p3.parentheses, N4 = p3.prefix, q4 = []; switch (y4.toLowerCase()) { case "forceseek": q4.push(R4(y4), "(".concat(yt2(m3)), "(".concat(S3.map($5).filter(P4).join(", "), "))")); break; case "spatial_window_max_cells": q4.push(R4(y4), "=", $5(L5)); break; case "index": q4.push(R4(N4), R4(y4), I3 ? "(".concat(L5.map((function(U4) { return yt2(U4); })).join(", "), ")") : "= ".concat(yt2(L5))); break; default: q4.push($5(L5)); } return q4.filter(P4).join(" "); } } function zt(p3, y4) { var L5 = p3.name, m3 = p3.symbol; return [R4(L5), m3, y4].filter(P4).join(" "); } function le3(p3) { var y4 = []; switch (p3.keyword) { case "as": y4.push("AS", "OF", $5(p3.of)); break; case "from_to": y4.push("FROM", $5(p3.from), "TO", $5(p3.to)); break; case "between_and": y4.push("BETWEEN", $5(p3.between), "AND", $5(p3.and)); break; case "contained": y4.push("CONTAINED", "IN", $5(p3.in)); } return y4.filter(P4).join(" "); } function Kt2(p3) { if (R4(p3.type) === "UNNEST") return jt(p3); var y4, L5, m3, S3, I3 = p3.table, N4 = p3.db, q4 = p3.as, U4 = p3.expr, H5 = p3.operator, Z5 = p3.prefix, ut3 = p3.schema, pt2 = p3.server, vt2 = p3.suffix, wt2 = p3.tablesample, Rt = p3.temporal_table, mt3 = p3.table_hint, gt2 = p3.surround, Ct = gt2 === void 0 ? {} : gt2, Ft2 = yt2(pt2, !1, Ct.server), qt2 = yt2(N4, !1, Ct.db), te5 = yt2(ut3, !1, Ct.schema), Gt2 = I3 && yt2(I3, !1, Ct.table); if (U4) switch (U4.type) { case "values": var se3 = U4.parentheses, Yt2 = U4.values, ae4 = U4.prefix, Ae4 = [se3 && "(", "", se3 && ")"], we4 = g4(Yt2); ae4 && (we4 = we4.split("(").slice(1).map((function(re3) { return "".concat(R4(ae4), "(").concat(re3); })).join("")), Ae4[1] = "VALUES ".concat(we4), Gt2 = Ae4.filter(P4).join(""); break; case "tumble": Gt2 = (function(re3) { if (!re3) return ""; var Ue4 = re3.data, qe4 = re3.timecol, Be4 = re3.offset, us = re3.size, gu = [yt2(Ue4.expr.db), yt2(Ue4.expr.schema), yt2(Ue4.expr.table)].filter(P4).join("."), _u = "DESCRIPTOR(".concat(fe4(qe4.expr), ")"), Cr = ["TABLE(TUMBLE(TABLE ".concat(zt(Ue4, gu)), zt(qe4, _u)], as = zt(us, et3(us.expr)); return Be4 && Be4.expr ? Cr.push(as, "".concat(zt(Be4, et3(Be4.expr)), "))")) : Cr.push("".concat(as, "))")), Cr.filter(P4).join(", "); })(U4); break; case "generator": L5 = (y4 = U4).keyword, m3 = y4.type, S3 = y4.generators.map((function(re3) { return ye4(re3).join(" "); })).join(", "), Gt2 = "".concat(R4(L5), "(").concat(R4(m3), "(").concat(S3, "))"); break; default: Gt2 = $5(U4); } var me4 = [[Ft2, qt2, te5, Gt2 = [R4(Z5), Gt2, R4(vt2)].filter(P4).join(" ")].filter(P4).join(".")]; if (wt2) { var uo = ["TABLESAMPLE", $5(wt2.expr), lt3(wt2.repeatable)].filter(P4).join(" "); me4.push(uo); } me4.push((function(re3) { if (re3) { var Ue4 = re3.keyword, qe4 = re3.expr; return [R4(Ue4), le3(qe4)].filter(P4).join(" "); } })(Rt), tt3("AS", typeof q4 == "string" ? yt2 : $5, q4), Ht2(H5)), mt3 && me4.push(R4(mt3.keyword), "(".concat(mt3.expr.map(kt).filter(P4).join(", "), ")")); var Jn2 = me4.filter(P4).join(" "); return p3.parentheses ? "(".concat(Jn2, ")") : Jn2; } function ne6(p3) { if (!p3) return ""; if (!Array.isArray(p3)) { var y4 = p3.expr, L5 = p3.parentheses, m3 = p3.joins, S3 = ne6(y4); if (L5) { for (var I3 = [], N4 = [], q4 = L5 === !0 ? 1 : L5.length, U4 = 0; U4++ < q4; ) I3.push("("), N4.push(")"); var H5 = m3 && m3.length > 0 ? ne6([""].concat(J5(m3))) : ""; return I3.join("") + S3 + N4.join("") + H5; } return S3; } var Z5 = p3[0], ut3 = []; if (Z5.type === "dual") return "DUAL"; ut3.push(Kt2(Z5)); for (var pt2 = 1; pt2 < p3.length; ++pt2) { var vt2 = p3[pt2], wt2 = vt2.on, Rt = vt2.using, mt3 = vt2.join, gt2 = [], Ct = Array.isArray(vt2) || Object.hasOwnProperty.call(vt2, "joins"); gt2.push(mt3 ? " ".concat(R4(mt3)) : ","), gt2.push(Ct ? ne6(vt2) : Kt2(vt2)), gt2.push(tt3("ON", $5, wt2)), Rt && gt2.push("USING (".concat(Rt.map(lt3).join(", "), ")")), ut3.push(gt2.filter(P4).join(" ")); } return ut3.filter(P4).join(""); } function Rn2(p3) { var y4 = p3.keyword, L5 = p3.symbol, m3 = p3.value, S3 = [y4.toUpperCase()]; L5 && S3.push(L5); var I3 = lt3(m3); switch (y4) { case "partition by": case "default collate": I3 = $5(m3); break; case "options": I3 = "(".concat(m3.map((function(N4) { return [N4.keyword, N4.symbol, $5(N4.value)].join(" "); })).join(", "), ")"); break; case "cluster by": I3 = m3.map($5).join(", "); } return S3.push(I3), S3.filter(P4).join(" "); } var vu = ["analyze", "attach", "select", "deallocate", "delete", "exec", "update", "insert", "drop", "rename", "truncate", "call", "desc", "describe", "use", "alter", "set", "create", "lock", "unlock", "declare", "show", "replace", "if", "grant", "revoke", "proc", "raise", "execute", "transaction", "explain", "comment", "load_data"]; function Yr(p3) { var y4 = p3 && p3.ast ? p3.ast : p3; if (!vu.includes(y4.type)) throw new Error("".concat(y4.type, " statements not supported at the moment")); } function $r(p3) { return Array.isArray(p3) ? (p3.forEach(Yr), ge4(p3)) : (Yr(p3), Tt(p3)); } function br(p3) { return p3.go === "go" ? (function y4(L5) { if (!L5 || L5.length === 0) return ""; var m3 = [$r(L5.ast)]; return L5.go_next && m3.push(L5.go.toUpperCase(), y4(L5.go_next)), m3.filter((function(S3) { return S3; })).join(" "); })(p3) : $r(p3); } function Uo(p3, y4) { var L5 = typeof Symbol < "u" && p3[Symbol.iterator] || p3["@@iterator"]; if (!L5) { if (Array.isArray(p3) || (L5 = Po(p3)) || y4 && p3 && typeof p3.length == "number") { L5 && (p3 = L5); var m3 = 0, S3 = function() { }; return { s: S3, n: function() { return m3 >= p3.length ? { done: !0 } : { done: !1, value: p3[m3++] }; }, e: function(U4) { throw U4; }, f: S3 }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var I3, N4 = !0, q4 = !1; return { s: function() { L5 = L5.call(p3); }, n: function() { var U4 = L5.next(); return N4 = U4.done, U4; }, e: function(U4) { q4 = !0, I3 = U4; }, f: function() { try { N4 || L5.return == null || L5.return(); } finally { if (q4) throw I3; } } }; } function Mo(p3) { return (function(y4) { if (Array.isArray(y4)) return Hr(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || Po(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function Po(p3, y4) { if (p3) { if (typeof p3 == "string") return Hr(p3, y4); var L5 = {}.toString.call(p3).slice(8, -1); return L5 === "Object" && p3.constructor && (L5 = p3.constructor.name), L5 === "Map" || L5 === "Set" ? Array.from(p3) : L5 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L5) ? Hr(p3, y4) : void 0; } } function Hr(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function Wr(p3) { var y4 = p3.type, L5 = p3.keyword, m3 = p3.name, S3 = p3.prefix, I3 = p3.suffix, N4 = [R4(y4), R4(L5), R4(S3)]; switch (L5) { case "table": N4.push(ne6(m3)); break; case "trigger": N4.push([m3[0].schema ? "".concat(yt2(m3[0].schema), ".") : "", yt2(m3[0].trigger)].filter(P4).join("")); break; case "database": case "schema": case "procedure": N4.push(yt2(m3)); break; case "view": N4.push(ne6(m3), p3.options && p3.options.map($5).filter(P4).join(" ")); break; case "index": N4.push.apply(N4, [fe4(m3)].concat(Mo(p3.table ? ["ON", Kt2(p3.table)] : []), [p3.options && p3.options.map($5).filter(P4).join(" ")])); break; case "type": N4.push(m3.map(fe4).join(", "), p3.options && p3.options.map($5).filter(P4).join(" ")); } return I3 && N4.push(I3.map($5).filter(P4).join(" ")), N4.filter(P4).join(" "); } function Vr(p3) { var y4 = p3.type, L5 = p3.table, m3 = R4(y4), S3 = typeof L5 == "string" ? yt2(L5) : Kt2(L5); return "".concat(m3, " ").concat(S3); } function Do(p3) { var y4 = p3.type, L5 = p3.keyword, m3 = p3.tables, S3 = [y4.toUpperCase(), R4(L5)]; if (y4.toUpperCase() === "UNLOCK") return S3.join(" "); var I3, N4 = [], q4 = Uo(m3); try { var U4 = function() { var H5 = I3.value, Z5 = H5.table, ut3 = H5.lock_type, pt2 = [Kt2(Z5)]; ut3 && pt2.push(["prefix", "type", "suffix"].map((function(vt2) { return R4(ut3[vt2]); })).filter(P4).join(" ")), N4.push(pt2.join(" ")); }; for (q4.s(); !(I3 = q4.n()).done; ) U4(); } catch (H5) { q4.e(H5); } finally { q4.f(); } return S3.push.apply(S3, [N4.join(", ")].concat(Mo((function(H5) { var Z5 = H5.lock_mode, ut3 = H5.nowait, pt2 = []; if (Z5) { var vt2 = Z5.mode; pt2.push(vt2.toUpperCase()); } return ut3 && pt2.push(ut3.toUpperCase()), pt2; })(p3)))), S3.filter(P4).join(" "); } function vr(p3) { var y4 = p3.name, L5 = p3.host, m3 = [lt3(y4)]; return L5 && m3.push("@", lt3(L5)), m3.join(""); } function qo(p3) { var y4 = p3.type, L5 = p3.grant_option_for, m3 = p3.keyword, S3 = p3.objects, I3 = p3.on, N4 = p3.to_from, q4 = p3.user_or_roles, U4 = p3.with, H5 = [R4(y4), lt3(L5)], Z5 = S3.map((function(ut3) { var pt2 = ut3.priv, vt2 = ut3.columns, wt2 = [$5(pt2)]; return vt2 && wt2.push("(".concat(vt2.map(fe4).join(", "), ")")), wt2.join(" "); })).join(", "); if (H5.push(Z5), I3) switch (H5.push("ON"), m3) { case "priv": H5.push(lt3(I3.object_type), I3.priv_level.map((function(ut3) { return [yt2(ut3.prefix), yt2(ut3.name)].filter(P4).join("."); })).join(", ")); break; case "proxy": H5.push(vr(I3)); } return H5.push(R4(N4), q4.map(vr).join(", ")), H5.push(lt3(U4)), H5.filter(P4).join(" "); } function Bo(p3) { return (function(y4) { if (Array.isArray(y4)) return zr(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || (function(y4, L5) { if (y4) { if (typeof y4 == "string") return zr(y4, L5); var m3 = {}.toString.call(y4).slice(8, -1); return m3 === "Object" && y4.constructor && (m3 = y4.constructor.name), m3 === "Map" || m3 === "Set" ? Array.from(y4) : m3 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m3) ? zr(y4, L5) : void 0; } })(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function zr(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function Kr(p3) { if (p3) { var y4 = p3.constraint, L5 = p3.constraint_type, m3 = p3.enforced, S3 = p3.index, I3 = p3.keyword, N4 = p3.reference_definition, q4 = p3.for, U4 = p3.with_values, H5 = [], Z5 = Mt().database; H5.push(R4(I3)), H5.push(yt2(y4)); var ut3 = R4(L5); return Z5.toLowerCase() === "sqlite" && ut3 === "UNIQUE KEY" && (ut3 = "UNIQUE"), H5.push(ut3), H5.push(Z5.toLowerCase() !== "sqlite" && yt2(S3)), H5.push.apply(H5, Bo(vn2(p3))), H5.push.apply(H5, Bo(ts(N4))), H5.push(R4(m3)), H5.push(tt3("FOR", yt2, q4)), H5.push(lt3(U4)), H5.filter(P4).join(" "); } } function Fo(p3) { if (p3) { var y4 = p3.type; return y4 === "rows" ? [R4(y4), $5(p3.expr)].filter(P4).join(" ") : $5(p3); } } function Xr(p3) { if (typeof p3 == "string") return p3; var y4 = p3.window_specification; return "(".concat((function(L5) { var m3 = L5.name, S3 = L5.partitionby, I3 = L5.orderby, N4 = L5.window_frame_clause; return [m3, Se4(S3, "partition by"), Se4(I3, "order by"), Fo(N4)].filter(P4).join(" "); })(y4), ")"); } function yu(p3) { var y4 = p3.name, L5 = p3.as_window_specification; return "".concat(y4, " AS ").concat(Xr(L5)); } function yr(p3) { if (p3) { var y4 = p3.as_window_specification, L5 = p3.expr, m3 = p3.keyword, S3 = p3.type, I3 = p3.parentheses, N4 = R4(S3); if (N4 === "WINDOW") return "OVER ".concat(Xr(y4)); if (N4 === "ON UPDATE") { var q4 = "".concat(R4(S3), " ").concat(R4(m3)), U4 = $5(L5) || []; return I3 && (q4 = "".concat(q4, "(").concat(U4.join(", "), ")")), q4; } if (p3.partitionby) return ["OVER", "(".concat(Se4(p3.partitionby, "partition by")), "".concat(Se4(p3.orderby, "order by"), ")")].filter(P4).join(" "); throw new Error("unknown over type"); } } function Go(p3) { if (!p3 || !p3.array) return ""; var y4 = p3.array.keyword; if (y4) return R4(y4); for (var L5 = p3.array, m3 = L5.dimension, S3 = L5.length, I3 = [], N4 = 0; N4 < m3; N4++) I3.push("["), S3 && S3[N4] && I3.push(lt3(S3[N4])), I3.push("]"); return I3.join(""); } function Yo(p3) { for (var y4 = p3.target, L5 = p3.expr, m3 = p3.keyword, S3 = p3.symbol, I3 = p3.as, N4 = p3.offset, q4 = p3.parentheses, U4 = p3.collate, H5 = Zo({ expr: L5, offset: N4 }), Z5 = [], ut3 = 0, pt2 = y4.length; ut3 < pt2; ++ut3) { var vt2 = y4[ut3], wt2 = vt2.angle_brackets, Rt = vt2.length, mt3 = vt2.dataType, gt2 = vt2.parentheses, Ct = vt2.quoted, Ft2 = vt2.scale, qt2 = vt2.suffix, te5 = vt2.expr, Gt2 = te5 ? $5(te5) : ""; Rt != null && (Gt2 = Ft2 ? "".concat(Rt, ", ").concat(Ft2) : Rt), gt2 && (Gt2 = "(".concat(Gt2, ")")), wt2 && (Gt2 = "<".concat(Gt2, ">")), qt2 && qt2.length && (Gt2 += " ".concat(qt2.map(lt3).join(" "))); var se3 = "::", Yt2 = "", ae4 = []; S3 === "as" && (ut3 === 0 && (H5 = "".concat(R4(m3), "(").concat(H5)), Yt2 = ")", se3 = " ".concat(S3.toUpperCase(), " ")), ut3 === 0 && ae4.push(H5); var Ae4 = Go(vt2); ae4.push(se3, Ct, mt3, Ct, Ae4, Gt2, Yt2), Z5.push(ae4.filter(P4).join("")); } var we4 = en2(U4); I3 && Z5.push(" AS ".concat(yt2(I3))); var me4 = [Z5.filter(P4).join(""), we4].filter(P4).join(" "); return q4 ? "(".concat(me4, ")") : me4; } function Qr(p3) { var y4 = p3.args, L5 = p3.array_index, m3 = p3.collate, S3 = p3.name, I3 = p3.args_parentheses, N4 = p3.parentheses, q4 = p3.within_group, U4 = p3.over, H5 = p3.suffix, Z5 = yr(U4), ut3 = (function(ae4) { if (!ae4) return ""; var Ae4 = ae4.type, we4 = ae4.keyword, me4 = ae4.orderby; return [R4(Ae4), R4(we4), "(".concat(Se4(me4, "order by"), ")")].filter(P4).join(" "); })(q4), pt2 = $5(H5), vt2 = en2(m3), wt2 = [lt3(S3.schema), S3.name.map(lt3).join(".")].filter(P4).join("."); if (!y4) return [wt2, vt2, ut3, Z5].filter(P4).join(" "); var Rt = p3.separator || ", ", mt3 = 0; if (R4(wt2) === "TRIM") for (var gt2 = 0, Ct = y4.value.length; gt2 < Ct; ++gt2) { var Ft2 = y4.value[gt2]; if (Ft2.type === "origin" && Ft2.value === "from") { mt3 = gt2; break; } } var qt2 = [wt2]; qt2.push(I3 === !1 ? " " : "("); var te5 = $5(y4); if (Array.isArray(Rt)) { for (var Gt2 = te5[0], se3 = 1, Yt2 = te5.length; se3 < Yt2; ++se3) Gt2 = [Gt2, te5[se3]].join(" ".concat($5(Rt[se3 - 1]), " ")); qt2.push(Gt2); } else R4(wt2) === "TRIM" && mt3 > 0 ? qt2.push([te5.slice(0, mt3 + 1).join(" "), te5.slice(mt3 + 1).join(", ")].join(" ")) : qt2.push(te5.join(Rt)); return I3 !== !1 && qt2.push(")"), qt2.push(oo(L5)), qt2 = [qt2.join(""), pt2, vt2].filter(P4).join(" "), [N4 ? "(".concat(qt2, ")") : qt2, ut3, Z5].filter(P4).join(" "); } function Zr(p3) { return (function(y4) { if (Array.isArray(y4)) return Jr(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || $o(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function $o(p3, y4) { if (p3) { if (typeof p3 == "string") return Jr(p3, y4); var L5 = {}.toString.call(p3).slice(8, -1); return L5 === "Object" && p3.constructor && (L5 = p3.constructor.name), L5 === "Map" || L5 === "Set" ? Array.from(p3) : L5 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L5) ? Jr(p3, y4) : void 0; } } function Jr(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function xn2(p3) { if (!p3) return []; var y4, L5, m3, S3, I3 = p3.resource; switch (I3) { case "column": return dr(p3); case "index": return L5 = [], m3 = (y4 = p3).keyword, S3 = y4.index, L5.push(R4(m3)), L5.push(S3), L5.push.apply(L5, In2(vn2(y4))), L5.filter(P4).join(" "); case "constraint": return Kr(p3); case "sequence": return [R4(p3.prefix), $5(p3.value)].filter(P4).join(" "); default: throw new Error("unknown resource = ".concat(I3, " type")); } } function du(p3) { var y4 = []; switch (p3.keyword) { case "from": y4.push("FROM", "(".concat(lt3(p3.from), ")"), "TO", "(".concat(lt3(p3.to), ")")); break; case "in": y4.push("IN", "(".concat($5(p3.in), ")")); break; case "with": y4.push("WITH", "(MODULUS ".concat(lt3(p3.modulus), ", REMAINDER ").concat(lt3(p3.remainder), ")")); } return y4.filter(P4).join(" "); } function hu(p3) { var y4 = p3.keyword, L5 = p3.table, m3 = p3.for_values, S3 = p3.tablespace, I3 = [R4(y4), Kt2(L5), R4(m3.keyword), du(m3.expr)]; return S3 && I3.push("TABLESPACE", lt3(S3)), I3.filter(P4).join(" "); } function wu(p3) { return p3.dataType ? Re4(p3) : [yt2(p3.db), yt2(p3.schema), yt2(p3.table)].filter(P4).join("."); } function Ho(p3) { var y4 = p3.type; switch (y4) { case "as": return [R4(y4), p3.symbol, Tt(p3.declare), R4(p3.begin), ge4(p3.expr), R4(p3.end), p3.symbol].filter(P4).join(" "); case "set": return [R4(y4), p3.parameter, R4(p3.value && p3.value.prefix), p3.value && p3.value.expr.map($5).join(", ")].filter(P4).join(" "); case "return": return [R4(y4), $5(p3.expr)].filter(P4).join(" "); default: return $5(p3); } } function mu(p3) { var y4 = p3.type, L5 = p3.symbol, m3 = p3.value, S3 = [R4(y4), L5]; switch (R4(y4)) { case "SFUNC": S3.push([yt2(m3.schema), m3.name].filter(P4).join(".")); break; case "STYPE": case "MSTYPE": S3.push(Re4(m3)); break; default: S3.push($5(m3)); } return S3.filter(P4).join(" "); } function Wo(p3, y4) { if (p3 === "add") { var L5 = y4.map((function(m3) { var S3 = m3.name, I3 = m3.value; return ["PARTITION", lt3(S3), "VALUES", R4(I3.type), "(".concat(lt3(I3.expr), ")")].join(" "); })).join(", "); return "(".concat(L5, ")"); } else return Ln2(y4); } function hn2(p3) { if (!p3) return ""; var y4 = p3.action, L5 = p3.create_definitions, m3 = p3.if_not_exists, S3 = p3.keyword, I3 = p3.if_exists, N4 = p3.old_column, q4 = p3.prefix, U4 = p3.resource, H5 = p3.symbol, Z5 = p3.suffix, ut3 = "", pt2 = []; switch (U4) { case "column": pt2 = [dr(p3)]; break; case "index": pt2 = vn2(p3), ut3 = p3[U4]; break; case "table": case "schema": ut3 = yt2(p3[U4]); break; case "aggregate": case "function": case "domain": case "type": ut3 = yt2(p3[U4]); break; case "algorithm": case "lock": case "table-option": ut3 = [H5, R4(p3[U4])].filter(P4).join(" "); break; case "constraint": ut3 = yt2(p3[U4]), pt2 = [xn2(L5)]; break; case "partition": pt2 = [Wo(y4, p3.partitions)]; break; case "key": ut3 = yt2(p3[U4]); break; default: ut3 = [H5, p3[U4]].filter((function(wt2) { return wt2 !== null; })).join(" "); } var vt2 = [R4(y4), R4(S3), R4(m3), R4(I3), N4 && fe4(N4), R4(q4), ut3 && ut3.trim(), pt2.filter(P4).join(" ")]; return Z5 && vt2.push(R4(Z5.keyword), Z5.expr && fe4(Z5.expr)), vt2.filter(P4).join(" "); } function jn2(p3) { var y4 = p3.default && [R4(p3.default.keyword), $5(p3.default.value)].join(" "); return [R4(p3.mode), p3.name, Re4(p3.type), y4].filter(P4).join(" "); } function Vo(p3) { return (Vo = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } function Lu(p3) { var y4 = p3.expr_list; switch (R4(p3.type)) { case "STRUCT": case "ROW": return "(".concat(Ln2(y4), ")"); case "ARRAY": return (function(L5) { var m3 = L5.array_path, S3 = L5.brackets, I3 = L5.expr_list, N4 = L5.parentheses; if (!I3) return "[".concat(Ln2(m3), "]"); var q4 = Array.isArray(I3) ? I3.map((function(U4) { return "(".concat(Ln2(U4), ")"); })).filter(P4).join(", ") : $5(I3); return S3 ? "[".concat(q4, "]") : N4 ? "(".concat(q4, ")") : q4; })(p3); default: return ""; } } function zo(p3) { var y4 = p3.definition, L5 = p3.keyword, m3 = p3.orderby, S3 = p3.limit, I3 = [R4(L5)]; return y4 && Vo(y4) === "object" && (I3.length = 0, I3.push(xe4(y4))), I3.push(Lu(p3), Se4(m3, "order by"), Qe3(S3)), I3.filter(P4).join(""); } function Ko(p3) { return (Ko = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } var wn2 = { alter: hn2, aggr_func: function(p3) { var y4 = p3.args, L5 = p3.filter, m3 = p3.over, S3 = p3.within_group_orderby, I3 = $5(y4.expr); I3 = Array.isArray(I3) ? I3.join(", ") : I3; var N4 = p3.name, q4 = yr(m3); y4.distinct && (I3 = ["DISTINCT", I3].join(" ")), y4.separator && y4.separator.delimiter && (I3 = [I3, lt3(y4.separator.delimiter)].join("".concat(y4.separator.symbol, " "))), y4.separator && y4.separator.expr && (I3 = [I3, $5(y4.separator.expr)].join(" ")), y4.orderby && (I3 = [I3, Se4(y4.orderby, "order by")].join(" ")), y4.separator && y4.separator.value && (I3 = [I3, R4(y4.separator.keyword), lt3(y4.separator.value)].filter(P4).join(" ")); var U4 = S3 ? "WITHIN GROUP (".concat(Se4(S3, "order by"), ")") : "", H5 = L5 ? "FILTER (WHERE ".concat($5(L5.where), ")") : ""; return ["".concat(N4, "(").concat(I3, ")"), U4, q4, H5].filter(P4).join(" "); }, any_value: function(p3) { var y4 = p3.args, L5 = p3.type, m3 = p3.over, S3 = y4.expr, I3 = y4.having, N4 = "".concat(R4(L5), "(").concat($5(S3)); return I3 && (N4 = "".concat(N4, " HAVING ").concat(R4(I3.prefix), " ").concat($5(I3.expr))), [N4 = "".concat(N4, ")"), yr(m3)].filter(P4).join(" "); }, window_func: function(p3) { var y4 = p3.over; return [(function(L5) { var m3 = L5.args, S3 = L5.name, I3 = L5.consider_nulls, N4 = I3 === void 0 ? "" : I3, q4 = L5.separator, U4 = q4 === void 0 ? ", " : q4; return [S3, "(", m3 ? $5(m3).join(U4) : "", ")", N4 && " ", N4].filter(P4).join(""); })(p3), yr(y4)].filter(P4).join(" "); }, array: zo, assign: zn2, binary_expr: ie5, case: function(p3) { var y4 = ["CASE"], L5 = p3.args, m3 = p3.expr, S3 = p3.parentheses; m3 && y4.push($5(m3)); for (var I3 = 0, N4 = L5.length; I3 < N4; ++I3) y4.push(L5[I3].type.toUpperCase()), L5[I3].cond && (y4.push($5(L5[I3].cond)), y4.push("THEN")), y4.push($5(L5[I3].result)); return y4.push("END"), S3 ? "(".concat(y4.join(" "), ")") : y4.join(" "); }, cast: Yo, collate: en2, column_ref: fe4, column_definition: dr, datatype: Re4, extract: function(p3) { var y4 = p3.args, L5 = p3.type, m3 = y4.field, S3 = y4.cast_type, I3 = y4.source, N4 = ["".concat(R4(L5), "(").concat(R4(m3)), "FROM", R4(S3), $5(I3)]; return "".concat(N4.filter(P4).join(" "), ")"); }, flatten: function(p3) { var y4 = p3.args, L5 = p3.type, m3 = ["input", "path", "outer", "recursive", "mode"].map((function(S3) { return (function(I3) { if (!I3) return ""; var N4 = I3.type, q4 = I3.symbol, U4 = I3.value; return [R4(N4), q4, $5(U4)].filter(P4).join(" "); })(y4[S3]); })).filter(P4).join(", "); return "".concat(R4(L5), "(").concat(m3, ")"); }, fulltext_search: function(p3) { var y4 = p3.against, L5 = p3.as, m3 = p3.columns, S3 = p3.match, I3 = p3.mode, N4 = [R4(S3), "(".concat(m3.map((function(U4) { return fe4(U4); })).join(", "), ")")].join(" "), q4 = [R4(y4), ["(", $5(p3.expr), I3 && " ".concat(lt3(I3)), ")"].filter(P4).join("")].join(" "); return [N4, q4, so(L5)].filter(P4).join(" "); }, function: Qr, lambda: function(p3) { var y4 = p3.args, L5 = p3.expr, m3 = y4.value, S3 = y4.parentheses, I3 = m3.map($5).join(", "); return [S3 ? "(".concat(I3, ")") : I3, "->", $5(L5)].join(" "); }, load_data: He4, insert: Tt, interval: et3, json: function(p3) { var y4 = p3.keyword, L5 = p3.expr_list; return [R4(y4), L5.map((function(m3) { return $5(m3); })).join(", ")].join(" "); }, json_object_arg: function(p3) { var y4 = p3.expr, L5 = y4.key, m3 = y4.value, S3 = y4.on, I3 = [$5(L5), "VALUE", $5(m3)]; return S3 && I3.push("ON", "NULL", $5(S3)), I3.filter(P4).join(" "); }, json_visitor: function(p3) { return [p3.symbol, $5(p3.expr)].join(""); }, func_arg: function(p3) { var y4 = p3.value; return [y4.name, y4.symbol, $5(y4.expr)].filter(P4).join(" "); }, show: Kn2, struct: zo, tablefunc: function(p3) { var y4 = p3.as, L5 = p3.name, m3 = p3.args, S3 = [lt3(L5.schema), L5.name.map(lt3).join(".")].filter(P4).join("."); return ["".concat(S3, "(").concat($5(m3).join(", "), ")"), "AS", Qr(y4)].join(" "); }, tables: ne6, unnest: jt, values: g4, window: function(p3) { return p3.expr.map(yu).join(", "); } }; function to(p3) { var y4 = p3.prefix, L5 = y4 === void 0 ? "@" : y4, m3 = p3.name, S3 = p3.members, I3 = p3.quoted, N4 = p3.suffix, q4 = [], U4 = S3 && S3.length > 0 ? "".concat(m3, ".").concat(S3.join(".")) : m3, H5 = "".concat(L5 || "").concat(U4); return N4 && (H5 += N4), q4.push(H5), [I3, q4.join(" "), I3].filter(P4).join(""); } function $5(p3) { if (p3) { var y4 = p3; if (p3.ast) { var L5 = y4.ast; Reflect.deleteProperty(y4, L5); for (var m3 = 0, S3 = Object.keys(L5); m3 < S3.length; m3++) { var I3 = S3[m3]; y4[I3] = L5[I3]; } } var N4 = y4.type; return N4 === "expr" ? $5(y4.expr) : wn2[N4] ? wn2[N4](y4) : lt3(y4); } } function eo(p3) { return p3 ? (Array.isArray(p3) || (p3 = [p3]), p3.map($5)) : []; } function Se4(p3, y4) { if (!Array.isArray(p3)) return ""; var L5 = [], m3 = R4(y4); return m3 === "ORDER BY" ? L5 = p3.map((function(S3) { return [$5(S3.expr), S3.type || "ASC", R4(S3.nulls)].filter(P4).join(" "); })) : L5 = p3.map((function(S3) { return $5(S3.expr); })), t2(m3, L5.join(", ")); } function en2(p3) { if (p3) { var y4 = p3.keyword, L5 = p3.collate, m3 = L5.name, S3 = L5.symbol, I3 = L5.value, N4 = [R4(y4)]; return I3 || N4.push(S3), N4.push(Array.isArray(m3) ? m3.map(lt3).join(".") : lt3(m3)), I3 && N4.push(S3), N4.push($5(I3)), N4.filter(P4).join(" "); } } function mn2(p3) { return (mn2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } function Xo(p3, y4) { var L5 = Object.keys(p3); if (Object.getOwnPropertySymbols) { var m3 = Object.getOwnPropertySymbols(p3); y4 && (m3 = m3.filter((function(S3) { return Object.getOwnPropertyDescriptor(p3, S3).enumerable; }))), L5.push.apply(L5, m3); } return L5; } function no(p3) { for (var y4 = 1; y4 < arguments.length; y4++) { var L5 = arguments[y4] != null ? arguments[y4] : {}; y4 % 2 ? Xo(Object(L5), !0).forEach((function(m3) { Cu(p3, m3, L5[m3]); })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(p3, Object.getOwnPropertyDescriptors(L5)) : Xo(Object(L5)).forEach((function(m3) { Object.defineProperty(p3, m3, Object.getOwnPropertyDescriptor(L5, m3)); })); } return p3; } function Cu(p3, y4, L5) { return (y4 = (function(m3) { var S3 = (function(I3, N4) { if (mn2(I3) != "object" || !I3) return I3; var q4 = I3[Symbol.toPrimitive]; if (q4 !== void 0) { var U4 = q4.call(I3, N4 || "default"); if (mn2(U4) != "object") return U4; throw new TypeError("@@toPrimitive must return a primitive value."); } return (N4 === "string" ? String : Number)(I3); })(m3, "string"); return mn2(S3) == "symbol" ? S3 : S3 + ""; })(y4)) in p3 ? Object.defineProperty(p3, y4, { value: L5, enumerable: !0, configurable: !0, writable: !0 }) : p3[y4] = L5, p3; } function kn2(p3) { return (function(y4) { if (Array.isArray(y4)) return ro(y4); })(p3) || (function(y4) { if (typeof Symbol < "u" && y4[Symbol.iterator] != null || y4["@@iterator"] != null) return Array.from(y4); })(p3) || Qo(p3) || (function() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); })(); } function Qo(p3, y4) { if (p3) { if (typeof p3 == "string") return ro(p3, y4); var L5 = {}.toString.call(p3).slice(8, -1); return L5 === "Object" && p3.constructor && (L5 = p3.constructor.name), L5 === "Map" || L5 === "Set" ? Array.from(p3) : L5 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L5) ? ro(p3, y4) : void 0; } } function ro(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function Zo(p3, y4) { if (typeof p3 == "string") return yt2(p3, y4); var L5 = p3.expr, m3 = p3.offset, S3 = p3.suffix, I3 = m3 && m3.map((function(N4) { return ["[", N4.name, "".concat(N4.name ? "(" : ""), lt3(N4.value), "".concat(N4.name ? ")" : ""), "]"].filter(P4).join(""); })).join(""); return [$5(L5), I3, S3].filter(P4).join(""); } function oo(p3) { if (!p3 || p3.length === 0) return ""; var y4, L5 = [], m3 = (function(N4, q4) { var U4 = typeof Symbol < "u" && N4[Symbol.iterator] || N4["@@iterator"]; if (!U4) { if (Array.isArray(N4) || (U4 = Qo(N4)) || q4 && N4 && typeof N4.length == "number") { U4 && (N4 = U4); var H5 = 0, Z5 = function() { }; return { s: Z5, n: function() { return H5 >= N4.length ? { done: !0 } : { done: !1, value: N4[H5++] }; }, e: function(wt2) { throw wt2; }, f: Z5 }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var ut3, pt2 = !0, vt2 = !1; return { s: function() { U4 = U4.call(N4); }, n: function() { var wt2 = U4.next(); return pt2 = wt2.done, wt2; }, e: function(wt2) { vt2 = !0, ut3 = wt2; }, f: function() { try { pt2 || U4.return == null || U4.return(); } finally { if (vt2) throw ut3; } } }; })(p3); try { for (m3.s(); !(y4 = m3.n()).done; ) { var S3 = y4.value, I3 = S3.brackets ? "[".concat($5(S3.index), "]") : "".concat(S3.notation).concat($5(S3.index)); S3.property && (I3 = "".concat(I3, ".").concat(lt3(S3.property))), L5.push(I3); } } catch (N4) { m3.e(N4); } finally { m3.f(); } return L5.join(""); } function fe4(p3) { var y4 = p3.array_index, L5 = p3.as, m3 = p3.column, S3 = p3.collate, I3 = p3.db, N4 = p3.isDual, q4 = p3.notations, U4 = q4 === void 0 ? [] : q4, H5 = p3.options, Z5 = p3.schema, ut3 = p3.table, pt2 = p3.parentheses, vt2 = p3.suffix, wt2 = p3.order_by, Rt = p3.subFields, mt3 = Rt === void 0 ? [] : Rt, gt2 = m3 === "*" ? "*" : Zo(m3, N4), Ct = [I3, Z5, ut3].filter(P4).map((function(se3) { return "".concat(typeof se3 == "string" ? yt2(se3) : $5(se3)); })), Ft2 = Ct[0]; if (Ft2) { for (var qt2 = 1; qt2 < Ct.length; ++qt2) Ft2 = "".concat(Ft2).concat(U4[qt2] || ".").concat(Ct[qt2]); gt2 = "".concat(Ft2).concat(U4[qt2] || ".").concat(gt2); } var te5 = [gt2 = ["".concat(gt2).concat(oo(y4))].concat(kn2(mt3)).join("."), en2(S3), $5(H5), tt3("AS", $5, L5)]; te5.push(typeof vt2 == "string" ? R4(vt2) : $5(vt2)), te5.push(R4(wt2)); var Gt2 = te5.filter(P4).join(" "); return pt2 ? "(".concat(Gt2, ")") : Gt2; } function Jo(p3) { if (p3) { var y4 = p3.schema, L5 = p3.dataType, m3 = p3.length, S3 = p3.suffix, I3 = p3.scale, N4 = p3.expr, q4 = Re4({ schema: y4, dataType: L5, length: m3, suffix: S3, scale: I3, parentheses: m3 != null }); if (N4 && (q4 += $5(N4)), p3.array) { var U4 = Go(p3); q4 += [/^\[.*\]$/.test(U4) ? "" : " ", U4].join(""); } return q4; } } function ts(p3) { var y4 = []; if (!p3) return y4; var L5 = p3.definition, m3 = p3.keyword, S3 = p3.match, I3 = p3.table, N4 = p3.on_action; return y4.push(R4(m3)), y4.push(ne6(I3)), y4.push(L5 && "(".concat(L5.map((function(q4) { return $5(q4); })).join(", "), ")")), y4.push(R4(S3)), N4.map((function(q4) { return y4.push(R4(q4.type), $5(q4.value)); })), y4.filter(P4); } function Eu(p3) { var y4 = [], L5 = p3.nullable, m3 = p3.character_set, S3 = p3.check, I3 = p3.comment, N4 = p3.constraint, q4 = p3.collate, U4 = p3.storage, H5 = p3.using, Z5 = p3.default_val, ut3 = p3.generated, pt2 = p3.auto_increment, vt2 = p3.unique, wt2 = p3.primary_key, Rt = p3.column_format, mt3 = p3.reference_definition, gt2 = p3.generated_by_default, Ct = [R4(L5 && L5.action), R4(L5 && L5.value)].filter(P4).join(" "); if (ut3 || y4.push(Ct), Z5) { var Ft2 = Z5.type, qt2 = Z5.value; y4.push(Ft2.toUpperCase(), $5(qt2)); } var te5 = Mt().database; return N4 && y4.push(R4(N4.keyword), lt3(N4.constraint)), y4.push(Kr(S3)), y4.push((function(Gt2) { if (Gt2) return [R4(Gt2.value), "(".concat($5(Gt2.expr), ")"), R4(Gt2.storage_type)].filter(P4).join(" "); })(ut3)), ut3 && y4.push(Ct), y4.push($n2(pt2), R4(wt2), R4(vt2), lt3(gt2), fn2(I3)), y4.push.apply(y4, kn2(ye4(m3))), te5.toLowerCase() !== "sqlite" && y4.push($5(q4)), y4.push.apply(y4, kn2(ye4(Rt))), y4.push.apply(y4, kn2(ye4(U4))), y4.push.apply(y4, kn2(ts(mt3))), y4.push(tt3("USING", $5, H5)), y4.filter(P4).join(" "); } function Au(p3) { var y4 = p3.order_by, L5 = p3.column, m3 = p3.collate, S3 = p3.nulls, I3 = p3.opclass, N4 = typeof L5 == "string" ? { type: "column_ref", table: p3.table, column: L5 } : no(no({}, p3), {}, { order_by: null }); return N4.collate = null, [$5(N4), $5(m3), I3, R4(y4), R4(S3)].filter(P4).join(" "); } function dr(p3) { var y4 = [], L5 = fe4(p3.column), m3 = Jo(p3.definition); return y4.push(L5), y4.push(m3), y4.push(Eu(p3)), y4.filter(P4).join(" "); } function so(p3) { return p3 ? mn2(p3) === "object" ? ["AS", $5(p3)].join(" ") : ["AS", /^(`?)[a-z_][0-9a-z_]*(`?)$/i.test(p3) ? yt2(p3) : Zt(p3)].join(" ") : ""; } function Un2(p3, y4) { var L5 = p3.expr, m3 = p3.type; if (m3 === "cast") return Yo(p3); y4 && (L5.isDual = y4); var S3 = $5(L5), I3 = p3.expr_list; if (I3) { var N4 = [S3], q4 = I3.map((function(U4) { return Un2(U4, y4); })).join(", "); return N4.push([R4(m3), m3 && "(", q4, m3 && ")"].filter(P4).join("")), N4.filter(P4).join(" "); } return L5.parentheses && Reflect.has(L5, "array_index") && L5.type !== "cast" && (S3 = "(".concat(S3, ")")), L5.array_index && L5.type !== "column_ref" && L5.type !== "function" && (S3 = "".concat(S3).concat(oo(L5.array_index))), [S3, so(p3.as)].filter(P4).join(" "); } function es(p3) { var y4 = Array.isArray(p3) && p3[0]; return !(!y4 || y4.type !== "dual"); } function Ln2(p3, y4) { if (!p3 || p3 === "*") return p3; var L5 = es(y4); return p3.map((function(m3) { return Un2(m3, L5); })).join(", "); } wn2.var = to, wn2.expr_list = function(p3) { var y4 = eo(p3.value), L5 = p3.parentheses, m3 = p3.separator; if (!L5 && !m3) return y4; var S3 = m3 || ", ", I3 = y4.join(S3); return L5 ? "(".concat(I3, ")") : I3; }, wn2.select = function(p3) { var y4 = Ko(p3._next) === "object" ? Tt(p3) : dn2(p3); return p3.parentheses ? "(".concat(y4, ")") : y4; }, wn2.unary_expr = function(p3) { var y4 = p3.operator, L5 = p3.parentheses, m3 = p3.expr, S3 = y4 === "-" || y4 === "+" || y4 === "~" || y4 === "!" ? "" : " ", I3 = "".concat(y4).concat(S3).concat($5(m3)); return L5 ? "(".concat(I3, ")") : I3; }, wn2.map_object = function(p3) { var y4 = p3.keyword, L5 = p3.expr.map((function(m3) { return [lt3(m3.key), lt3(m3.value)].join(", "); })).join(", "); return [R4(y4), "[".concat(L5, "]")].join(""); }; var Ee4 = ct3(0); function hr(p3) { return (hr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } var Xn2, Qn2, wr, ns = (Xn2 = {}, Qn2 = "mysql", wr = Ee4.parse, (Qn2 = (function(p3) { var y4 = (function(L5, m3) { if (hr(L5) != "object" || !L5) return L5; var S3 = L5[Symbol.toPrimitive]; if (S3 !== void 0) { var I3 = S3.call(L5, m3 || "default"); if (hr(I3) != "object") return I3; throw new TypeError("@@toPrimitive must return a primitive value."); } return (m3 === "string" ? String : Number)(L5); })(p3, "string"); return hr(y4) == "symbol" ? y4 : y4 + ""; })(Qn2)) in Xn2 ? Object.defineProperty(Xn2, Qn2, { value: wr, enumerable: !0, configurable: !0, writable: !0 }) : Xn2[Qn2] = wr, Xn2); function mr(p3) { return (mr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } function rs(p3, y4) { var L5 = typeof Symbol < "u" && p3[Symbol.iterator] || p3["@@iterator"]; if (!L5) { if (Array.isArray(p3) || (L5 = (function(U4, H5) { if (U4) { if (typeof U4 == "string") return os(U4, H5); var Z5 = {}.toString.call(U4).slice(8, -1); return Z5 === "Object" && U4.constructor && (Z5 = U4.constructor.name), Z5 === "Map" || Z5 === "Set" ? Array.from(U4) : Z5 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z5) ? os(U4, H5) : void 0; } })(p3)) || y4 && p3 && typeof p3.length == "number") { L5 && (p3 = L5); var m3 = 0, S3 = function() { }; return { s: S3, n: function() { return m3 >= p3.length ? { done: !0 } : { done: !1, value: p3[m3++] }; }, e: function(U4) { throw U4; }, f: S3 }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var I3, N4 = !0, q4 = !1; return { s: function() { L5 = L5.call(p3); }, n: function() { var U4 = L5.next(); return N4 = U4.done, U4; }, e: function(U4) { q4 = !0, I3 = U4; }, f: function() { try { N4 || L5.return == null || L5.return(); } finally { if (q4) throw I3; } } }; } function os(p3, y4) { (y4 == null || y4 > p3.length) && (y4 = p3.length); for (var L5 = 0, m3 = Array(y4); L5 < y4; L5++) m3[L5] = p3[L5]; return m3; } function Zn2(p3, y4) { for (var L5 = 0; L5 < y4.length; L5++) { var m3 = y4[L5]; m3.enumerable = m3.enumerable || !1, m3.configurable = !0, "value" in m3 && (m3.writable = !0), Object.defineProperty(p3, ss(m3.key), m3); } } function ss(p3) { var y4 = (function(L5, m3) { if (mr(L5) != "object" || !L5) return L5; var S3 = L5[Symbol.toPrimitive]; if (S3 !== void 0) { var I3 = S3.call(L5, m3 || "default"); if (mr(I3) != "object") return I3; throw new TypeError("@@toPrimitive must return a primitive value."); } return (m3 === "string" ? String : Number)(L5); })(p3, "string"); return mr(y4) == "symbol" ? y4 : y4 + ""; } var Lr = (function() { return (function(p3, y4, L5) { return y4 && Zn2(p3.prototype, y4), L5 && Zn2(p3, L5), Object.defineProperty(p3, "prototype", { writable: !1 }), p3; })((function p3() { (function(y4, L5) { if (!(y4 instanceof L5)) throw new TypeError("Cannot call a class as a function"); })(this, p3); }), [{ key: "astify", value: function(p3) { var y4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : i2, L5 = this.parse(p3, y4); return L5 && L5.ast; } }, { key: "sqlify", value: function(p3) { var y4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : i2; return oe5(y4), br(p3); } }, { key: "exprToSQL", value: function(p3) { var y4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : i2; return oe5(y4), $5(p3); } }, { key: "columnsToSQL", value: function(p3, y4) { var L5 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : i2; if (oe5(L5), !p3 || p3 === "*") return []; var m3 = es(y4); return p3.map((function(S3) { return Un2(S3, m3); })); } }, { key: "parse", value: function(p3) { var y4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : i2, L5 = y4.database, m3 = L5 === void 0 ? "mysql" : L5; oe5(y4); var S3 = m3.toLowerCase(); if (ns[S3]) return ns[S3](y4.trimQuery === !1 ? p3 : p3.trim(), y4.parseOptions || i2.parseOptions); throw new Error("".concat(m3, " is not supported currently")); } }, { key: "whiteListCheck", value: function(p3, y4) { var L5 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : i2; if (y4 && y4.length !== 0) { var m3 = L5.type, S3 = m3 === void 0 ? "table" : m3; if (!this["".concat(S3, "List")] || typeof this["".concat(S3, "List")] != "function") throw new Error("".concat(S3, " is not valid check mode")); var I3, N4 = this["".concat(S3, "List")].bind(this), q4 = N4(p3, L5), U4 = !0, H5 = "", Z5 = rs(q4); try { for (Z5.s(); !(I3 = Z5.n()).done; ) { var ut3, pt2 = I3.value, vt2 = !1, wt2 = rs(y4); try { for (wt2.s(); !(ut3 = wt2.n()).done; ) { var Rt = ut3.value, mt3 = new RegExp("^".concat(Rt, "$"), "i"); if (mt3.test(pt2)) { vt2 = !0; break; } } } catch (gt2) { wt2.e(gt2); } finally { wt2.f(); } if (!vt2) { H5 = pt2, U4 = !1; break; } } } catch (gt2) { Z5.e(gt2); } finally { Z5.f(); } if (!U4) throw new Error("authority = '".concat(H5, "' is required in ").concat(S3, " whiteList to execute SQL = '").concat(p3, "'")); } } }, { key: "tableList", value: function(p3, y4) { var L5 = this.parse(p3, y4); return L5 && L5.tableList; } }, { key: "columnList", value: function(p3, y4) { var L5 = this.parse(p3, y4); return L5 && L5.columnList; } }]); })(); function Mn2(p3) { return (Mn2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(y4) { return typeof y4; } : function(y4) { return y4 && typeof Symbol == "function" && y4.constructor === Symbol && y4 !== Symbol.prototype ? "symbol" : typeof y4; })(p3); } (typeof self > "u" ? "undefined" : Mn2(self)) === "object" && self && (self.NodeSQLParser = { Parser: Lr, util: X6 }), typeof global > "u" && (typeof window > "u" ? "undefined" : Mn2(window)) === "object" && window && (window.global = window), (typeof global > "u" ? "undefined" : Mn2(global)) === "object" && global && global.window && (global.window.NodeSQLParser = { Parser: Lr, util: X6 }); }])); }), ql = Jv(Il(), 1), jo = "1.0.0", ko = "0.1.1", lr = Object.freeze({ core: "0.1.1", shell: "0.1.1", python: "0.1.0", sqlite: "0.1.1", mysql: "0.1.2", redis: "0.1.1" }), ty = Object.freeze({ shell: "tree-sitter-bash@0.25.1", python: "tree-sitter-python@0.25.0", sqlite: "sqlite3-parser@0.7.1/sqlite-3.53.0", mysql: "node-sql-parser@5.4.0/mysql", redis: "redis-command-table@1" }), wy = Object.freeze({ schemaVersion: jo, policy: ko, rules: lr, parsers: ty }), Sl = Object.freeze({ allow: 0, review: 1, deny: 2 }); ny = Object.freeze({ maxInputBytes: 65536, maxAstNodes: 12e3, maxNestingDepth: 64, maxStatements: 512, maxWorkUnits: 1e5 }); Br = Object.freeze({ ANALYSIS_UNAVAILABLE: "policy.analysis_unavailable", INITIALIZATION_FAILED: "policy.initialization_failed", PARSE_FAILED: "policy.parse_failed", RESOURCE_LIMIT_EXCEEDED: "policy.resource_limit_exceeded", UNKNOWN_SEMANTICS: "policy.unknown_semantics", INVALID_DECISION: "policy.invalid_decision" }), ry = { "analysis-unavailable": "analysis is unavailable", "initialization-failed": "analyzer initialization failed", "parse-failed": "parsing failed", "resource-limit-exceeded": "an analysis resource limit was exceeded", "unknown-semantics": "semantics are unknown" }; sy = { "analysis-unavailable": Br.ANALYSIS_UNAVAILABLE, "initialization-failed": Br.INITIALIZATION_FAILED, "parse-failed": Br.PARSE_FAILED, "resource-limit-exceeded": Br.RESOURCE_LIMIT_EXCEEDED, "unknown-semantics": Br.UNKNOWN_SEMANTICS }; uy = /(?:^|[_-])(?:pass(?:word|wd)?|secret|token|api[_-]?key|private[_-]?key|credential|auth)(?:$|[_-])/i; xl = /* @__PURE__ */ new Set(["abs", "avg", "cast", "char", "coalesce", "concat", "count", "date", "datetime", "format", "glob", "group_concat", "hex", "if", "ifnull", "instr", "json", "json_array", "json_array_length", "json_extract", "json_object", "json_quote", "json_type", "julianday", "length", "like", "likely", "lower", "ltrim", "max", "min", "nullif", "printf", "quote", "random", "randomblob", "rank", "replace", "round", "row_number", "rtrim", "soundex", "strftime", "substr", "substring", "sum", "time", "total", "trim", "typeof", "unicode", "unixepoch", "unlikely", "upper", "zeroblob"]); ay = /* @__PURE__ */ new Set(["mysql", "performance_schema", "information_schema", "sys", "pg_catalog"]); cy = /* @__PURE__ */ new Set(["authentication_string", "password_hash", "ssl_cipher", "password"]); Ml = "node-sql-parser@5.4.0/mysql", fy = /\/\*!/, py = ql.default.Parser; } }); // node_modules/@at-series/command-policy/dist/redis.js var redis_exports = {}; __export(redis_exports, { createRedisPolicyEvaluator: () => ne4 }); function _3(e) { let i2 = 1, t2 = 0; for (let n = 0; n < e.length; n += 1) e.charCodeAt(n) === 10 && (i2 += 1, t2 = n + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: i2, column: e.length - t2 + 1 } }; } function P2(e, i2, t2, n) { let o = typeof i2.sourceText == "string" ? i2.sourceText : "", s = n.length > 0 ? n : [{ effectCode: `${e}.process.noop`, action: "allow", reasonCode: `${e}.read_only`, kind: "statement", summary: `${e} source has no external effect.` }], r2 = s[0]; for (let a2 of s.slice(1)) O3[a2.action] > O3[r2.action] && (r2 = a2); let l, I3 = () => l ??= _3(o), S3 = s.map((a2) => Object.freeze({ kind: a2.kind, location: a2.location ?? I3(), redacted: !0, summary: a2.summary })), c3 = s.map((a2, E4) => Object.freeze({ effectCode: a2.effectCode, action: a2.action, evidenceIndexes: Object.freeze([E4]) })); return Object.freeze({ schemaVersion: f2, action: r2.action, effects: Object.freeze(c3), reasonCode: r2.reasonCode, evidence: Object.freeze(S3), versions: Object.freeze({ policy: R2, rules: Object.freeze({ core: d.core, [e]: d[e] }), parsers: Object.freeze({ [e]: t2 }) }) }); } function A2(e) { let i2 = { ...v2, ...e }; for (let [t2, n] of Object.entries(i2)) if (!Number.isSafeInteger(n) || n < 1) throw new TypeError(`${t2} must be a positive safe integer`); return Object.freeze(i2); } function p2(e, i2) { return e.length * 3 <= i2.maxInputBytes ? !1 : Buffer.byteLength(e, "utf8") > i2.maxInputBytes; } function x3(e) { let i2 = 1, t2 = 0; for (let n = 0; n < e.length; n += 1) e.charCodeAt(n) === 10 && (i2 += 1, t2 = n + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: i2, column: e.length - t2 + 1 } }; } function L3(e, i2, t2) { return { kind: "unknown", location: x3(t2), redacted: !0, summary: `${e} source requires review because ${M2[i2]}.` }; } function m2({ domain: e, failure: i2, input: t2 }) { let n = typeof t2.sourceText == "string" ? t2.sourceText : ""; return { schemaVersion: f2, action: "review", effects: [{ effectCode: `${e}.analysis.unknown`, action: "review", evidenceIndexes: [0] }], reasonCode: k2[i2], evidence: [L3(e, i2, n)], versions: { policy: R2, rules: { core: d.core, [e]: d[e] }, parsers: { [e]: "unavailable" } } }; } function U2(e) { if (/[\0\r\n]/.test(e)) return { ok: !1, risky: !0 }; let i2 = [], t2 = "", n, o = !1; for (let s = 0; s < e.length; s += 1) { let r2 = e[s]; if (!n && /\s/.test(r2)) { o && (i2.push(t2), t2 = "", o = !1); continue; } if (r2 === n) { n = void 0, o = !0; continue; } if (!n && (r2 === "'" || r2 === '"')) { n = r2, o = !0; continue; } if (r2 === "\\" && n !== "'") { s += 1; let l = e[s]; if (l === void 0) return { ok: !1, risky: !0 }; t2 += l, o = !0; continue; } t2 += r2, o = !0; } return n ? { ok: !1, risky: !0 } : (o && i2.push(t2), i2.length > 0 ? { ok: !0, arguments: i2 } : { ok: !1, risky: !1 }); } function C3(e, i2) { for (let t2 = i2; t2 + 1 < e.length; t2 += 1) if (e[t2] === 13 && e[t2 + 1] === 10) return { line: new TextDecoder("utf-8", { fatal: !0 }).decode(e.subarray(i2, t2)), next: t2 + 2 }; } function b2(e, i2) { try { let t2 = new TextEncoder().encode(e), n = C3(t2, 0); if (!n || !n.line.startsWith("*")) return { ok: !1, risky: !0 }; let o = n.line.slice(1); if (!/^[1-9]\d*$/.test(o)) return { ok: !1, risky: !0 }; let s = Number(o); if (s > i2.maxAstNodes) return { ok: !1, risky: !1 }; let r2 = [], l = n.next, I3 = new TextDecoder("utf-8", { fatal: !0 }); for (let S3 = 0; S3 < s; S3 += 1) { let c3 = C3(t2, l); if (!c3 || !/^\$\d+$/.test(c3.line)) return { ok: !1, risky: !0 }; let a2 = Number(c3.line.slice(1)), E4 = c3.next + a2; if (!Number.isSafeInteger(a2) || a2 < 0 || E4 + 2 > t2.length || t2[E4] !== 13 || t2[E4 + 1] !== 10) return { ok: !1, risky: !0 }; r2.push(I3.decode(t2.subarray(c3.next, E4))), l = E4 + 2; } return l === t2.length ? { ok: !0, arguments: r2 } : { ok: !1, risky: !0 }; } catch { return { ok: !1, risky: !0 }; } } function F4(e, i2) { return e.startsWith("*") ? b2(e, i2) : U2(e); } function u2(e, i2, t2) { return { effectCode: `redis.command.${i2}`, action: e, reasonCode: `redis.${i2}`, kind: "command", summary: t2 }; } function G3(e) { return e.some((i2) => /(?:^|[:._-])(?:auth|credential|password|private[_-]?key|secret|session[:._-]token|token)(?:$|[:._-])/i.test(i2)); } function X4(e) { let i2 = e[0]?.toUpperCase(), t2 = e.slice(1); return i2 ? B3.has(i2) || (i2 === "XREAD" || i2 === "XREADGROUP") && t2.some((n) => n.toUpperCase() === "BLOCK") ? u2("deny", "blocking", "A Redis command may block the bounded execution channel.") : g3.has(i2) ? u2("review", "write", "A Redis command may modify data or control the server.") : h2.has(i2) ? G3(t2) ? u2("review", "sensitive_read", "A Redis command may read a sensitive key.") : u2("allow", "read", "A recognized Redis command has a non-blocking read-only contract.") : u2("review", "unknown", "Redis command semantics are not in the reviewed command table.") : u2("deny", "unsupported_protocol", "Redis protocol shape is unsupported."); } function T3(e = {}) { let i2 = A2(e.limits); return { async evaluate(t2) { let n = typeof t2.sourceText == "string" ? t2.sourceText : ""; if (n.trim().length === 0) return m2({ domain: "redis", failure: "parse-failed", input: t2 }); if (p2(n, i2)) return m2({ domain: "redis", failure: "resource-limit-exceeded", input: t2 }); let o = F4(n, i2); return o.ok ? P2("redis", t2, N2, [X4(o.arguments)]) : o.risky ? P2("redis", t2, N2, [u2("deny", "unsupported_protocol", "Redis protocol shape is malformed or unsupported.")]) : m2({ domain: "redis", failure: "resource-limit-exceeded", input: t2 }); } }; } function ne4(e = {}) { return T3(e); } var f2, R2, d, D3, H3, O3, v2, y3, M2, k2, N2, h2, B3, g3, init_redis = __esm({ "node_modules/@at-series/command-policy/dist/redis.js"() { f2 = "1.0.0", R2 = "0.1.1", d = Object.freeze({ core: "0.1.1", shell: "0.1.1", python: "0.1.0", sqlite: "0.1.1", mysql: "0.1.2", redis: "0.1.1" }), D3 = Object.freeze({ shell: "tree-sitter-bash@0.25.1", python: "tree-sitter-python@0.25.0", sqlite: "sqlite3-parser@0.7.1/sqlite-3.53.0", mysql: "node-sql-parser@5.4.0/mysql", redis: "redis-command-table@1" }), H3 = Object.freeze({ schemaVersion: f2, policy: R2, rules: d, parsers: D3 }), O3 = Object.freeze({ allow: 0, review: 1, deny: 2 }); v2 = Object.freeze({ maxInputBytes: 65536, maxAstNodes: 12e3, maxNestingDepth: 64, maxStatements: 512, maxWorkUnits: 1e5 }); y3 = Object.freeze({ ANALYSIS_UNAVAILABLE: "policy.analysis_unavailable", INITIALIZATION_FAILED: "policy.initialization_failed", PARSE_FAILED: "policy.parse_failed", RESOURCE_LIMIT_EXCEEDED: "policy.resource_limit_exceeded", UNKNOWN_SEMANTICS: "policy.unknown_semantics", INVALID_DECISION: "policy.invalid_decision" }), M2 = { "analysis-unavailable": "analysis is unavailable", "initialization-failed": "analyzer initialization failed", "parse-failed": "parsing failed", "resource-limit-exceeded": "an analysis resource limit was exceeded", "unknown-semantics": "semantics are unknown" }; k2 = { "analysis-unavailable": y3.ANALYSIS_UNAVAILABLE, "initialization-failed": y3.INITIALIZATION_FAILED, "parse-failed": y3.PARSE_FAILED, "resource-limit-exceeded": y3.RESOURCE_LIMIT_EXCEEDED, "unknown-semantics": y3.UNKNOWN_SEMANTICS }; N2 = "redis-command-table@1", h2 = /* @__PURE__ */ new Set(["BITCOUNT", "BITFIELD_RO", "BITPOS", "DBSIZE", "DUMP", "ECHO", "EXISTS", "GEODIST", "GEOHASH", "GEOPOS", "GEORADIUS_RO", "GEORADIUSBYMEMBER_RO", "GEOSEARCH", "GET", "GETBIT", "GETRANGE", "HELLO", "HEXISTS", "HGET", "HGETALL", "HKEYS", "HLEN", "HMGET", "HRANDFIELD", "HSCAN", "HSTRLEN", "HVALS", "INFO", "LASTSAVE", "LINDEX", "LLEN", "LOLWUT", "LPOS", "LRANGE", "MEMORY", "MGET", "OBJECT", "PFCOUNT", "PING", "PTTL", "RANDOMKEY", "SCAN", "SCARD", "SDIFF", "SINTER", "SINTERCARD", "SISMEMBER", "SMEMBERS", "SMISMEMBER", "SORT_RO", "SRANDMEMBER", "SSCAN", "STRLEN", "SUNION", "TIME", "TTL", "TYPE", "XINFO", "XLEN", "XPENDING", "XRANGE", "XREVRANGE", "ZCARD", "ZCOUNT", "ZDIFF", "ZINTER", "ZINTERCARD", "ZLEXCOUNT", "ZMSCORE", "ZRANDMEMBER", "ZRANGE", "ZRANGEBYLEX", "ZRANGEBYSCORE", "ZRANK", "ZREVRANGE", "ZREVRANGEBYLEX", "ZREVRANGEBYSCORE", "ZREVRANK", "ZSCAN", "ZSCORE", "ZUNION"]), B3 = /* @__PURE__ */ new Set(["BLMOVE", "BLMPOP", "BLPOP", "BRPOP", "BRPOPLPUSH", "BZMPOP", "BZPOPMAX", "BZPOPMIN", "KEYS", "MONITOR", "PSUBSCRIBE", "SSUBSCRIBE", "SUBSCRIBE", "WAIT", "WAITAOF"]), g3 = /* @__PURE__ */ new Set(["ACL", "APPEND", "AUTH", "BGREWRITEAOF", "BGSAVE", "BITFIELD", "BITOP", "CLIENT", "CLUSTER", "CONFIG", "COPY", "DECR", "DECRBY", "DEL", "DISCARD", "EVAL", "EVALSHA", "EXEC", "EXPIRE", "EXPIREAT", "FLUSHALL", "FLUSHDB", "FUNCTION", "GETDEL", "GETEX", "GETSET", "HDEL", "HINCRBY", "HINCRBYFLOAT", "HMSET", "HSET", "HSETNX", "INCR", "INCRBY", "INCRBYFLOAT", "LINSERT", "LMOVE", "LPOP", "LPUSH", "LPUSHX", "LREM", "LSET", "LTRIM", "MIGRATE", "MODULE", "MOVE", "MSET", "MSETNX", "MULTI", "PERSIST", "PEXPIRE", "PEXPIREAT", "PFADD", "PFMERGE", "PUBLISH", "RENAME", "RENAMENX", "RESTORE", "RPOP", "RPOPLPUSH", "RPUSH", "RPUSHX", "SADD", "SAVE", "SCRIPT", "SDIFFSTORE", "SET", "SETBIT", "SETEX", "SETNX", "SETRANGE", "SHUTDOWN", "SINTERSTORE", "SLAVEOF", "SLOWLOG", "SMOVE", "SPOP", "SREM", "SUNIONSTORE", "SWAPDB", "TOUCH", "UNLINK", "WATCH", "XACK", "XADD", "XAUTOCLAIM", "XCLAIM", "XDEL", "XGROUP", "XSETID", "XTRIM", "ZADD", "ZDIFFSTORE", "ZINCRBY", "ZINTERSTORE", "ZPOPMAX", "ZPOPMIN", "ZREM", "ZREMRANGEBYLEX", "ZREMRANGEBYRANK", "ZREMRANGEBYSCORE", "ZUNIONSTORE"]); } }); // src/platform/dsh/entry.ts import { randomUUID as randomUUID3 } from "node:crypto"; import { readdir } from "node:fs/promises"; // src/assets/AssetCommands.ts import { join as join2 } from "node:path"; // src/platform/current.ts var current; function setPlatform(value) { current = value; } function clearPlatform(expected) { expected !== void 0 && current !== expected || (current = void 0); } function platform() { if (current === void 0) throw new Error( "AT Terminal: platform not installed; extension activation must call setPlatform()" ); return current; } // src/assets/AssetCrypto.ts import { createCipheriv, createDecipheriv, randomBytes, scrypt as scryptCallback } from "node:crypto"; import { promisify } from "node:util"; // node_modules/zod/v3/external.js var external_exports = {}; __export(external_exports, { BRAND: () => BRAND, DIRTY: () => DIRTY, EMPTY_PATH: () => EMPTY_PATH, INVALID: () => INVALID, NEVER: () => NEVER, OK: () => OK, ParseStatus: () => ParseStatus, Schema: () => ZodType, ZodAny: () => ZodAny, ZodArray: () => ZodArray, ZodBigInt: () => ZodBigInt, ZodBoolean: () => ZodBoolean, ZodBranded: () => ZodBranded, ZodCatch: () => ZodCatch, ZodDate: () => ZodDate, ZodDefault: () => ZodDefault, ZodDiscriminatedUnion: () => ZodDiscriminatedUnion, ZodEffects: () => ZodEffects, ZodEnum: () => ZodEnum, ZodError: () => ZodError, ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind, ZodFunction: () => ZodFunction, ZodIntersection: () => ZodIntersection, ZodIssueCode: () => ZodIssueCode, ZodLazy: () => ZodLazy, ZodLiteral: () => ZodLiteral, ZodMap: () => ZodMap, ZodNaN: () => ZodNaN, ZodNativeEnum: () => ZodNativeEnum, ZodNever: () => ZodNever, ZodNull: () => ZodNull, ZodNullable: () => ZodNullable, ZodNumber: () => ZodNumber, ZodObject: () => ZodObject, ZodOptional: () => ZodOptional, ZodParsedType: () => ZodParsedType, ZodPipeline: () => ZodPipeline, ZodPromise: () => ZodPromise, ZodReadonly: () => ZodReadonly, ZodRecord: () => ZodRecord, ZodSchema: () => ZodType, ZodSet: () => ZodSet, ZodString: () => ZodString, ZodSymbol: () => ZodSymbol, ZodTransformer: () => ZodEffects, ZodTuple: () => ZodTuple, ZodType: () => ZodType, ZodUndefined: () => ZodUndefined, ZodUnion: () => ZodUnion, ZodUnknown: () => ZodUnknown, ZodVoid: () => ZodVoid, addIssueToContext: () => addIssueToContext, any: () => anyType, array: () => arrayType, bigint: () => bigIntType, boolean: () => booleanType, coerce: () => coerce, custom: () => custom, date: () => dateType, datetimeRegex: () => datetimeRegex, defaultErrorMap: () => en_default, discriminatedUnion: () => discriminatedUnionType, effect: () => effectsType, enum: () => enumType, function: () => functionType, getErrorMap: () => getErrorMap, getParsedType: () => getParsedType, instanceof: () => instanceOfType, intersection: () => intersectionType, isAborted: () => isAborted, isAsync: () => isAsync, isDirty: () => isDirty, isValid: () => isValid, late: () => late, lazy: () => lazyType, literal: () => literalType, makeIssue: () => makeIssue, map: () => mapType, nan: () => nanType, nativeEnum: () => nativeEnumType, never: () => neverType, null: () => nullType, nullable: () => nullableType, number: () => numberType, object: () => objectType, objectUtil: () => objectUtil, oboolean: () => oboolean, onumber: () => onumber, optional: () => optionalType, ostring: () => ostring, pipeline: () => pipelineType, preprocess: () => preprocessType, promise: () => promiseType, quotelessJson: () => quotelessJson, record: () => recordType, set: () => setType, setErrorMap: () => setErrorMap, strictObject: () => strictObjectType, string: () => stringType, symbol: () => symbolType, transformer: () => effectsType, tuple: () => tupleType, undefined: () => undefinedType, union: () => unionType, unknown: () => unknownType, util: () => util, void: () => voidType }); // node_modules/zod/v3/helpers/util.js var util; (function(util2) { util2.assertEqual = (_5) => { }; function assertIs(_arg) { } util2.assertIs = assertIs; function assertNever(_x) { throw new Error(); } util2.assertNever = assertNever, util2.arrayToEnum = (items) => { let obj = {}; for (let item of items) obj[item] = item; return obj; }, util2.getValidEnumValues = (obj) => { let validKeys = util2.objectKeys(obj).filter((k4) => typeof obj[obj[k4]] != "number"), filtered = {}; for (let k4 of validKeys) filtered[k4] = obj[k4]; return util2.objectValues(filtered); }, util2.objectValues = (obj) => util2.objectKeys(obj).map(function(e) { return obj[e]; }), util2.objectKeys = typeof Object.keys == "function" ? (obj) => Object.keys(obj) : (object) => { let keys = []; for (let key in object) Object.prototype.hasOwnProperty.call(object, key) && keys.push(key); return keys; }, util2.find = (arr, checker) => { for (let item of arr) if (checker(item)) return item; }, util2.isInteger = typeof Number.isInteger == "function" ? (val) => Number.isInteger(val) : (val) => typeof val == "number" && Number.isFinite(val) && Math.floor(val) === val; function joinValues(array, separator = " | ") { return array.map((val) => typeof val == "string" ? `'${val}'` : val).join(separator); } util2.joinValues = joinValues, util2.jsonStringifyReplacer = (_5, value) => typeof value == "bigint" ? value.toString() : value; })(util || (util = {})); var objectUtil; (function(objectUtil2) { objectUtil2.mergeShapes = (first, second) => ({ ...first, ...second // second overwrites first }); })(objectUtil || (objectUtil = {})); var ZodParsedType = util.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), getParsedType = (data) => { switch (typeof data) { case "undefined": return ZodParsedType.undefined; case "string": return ZodParsedType.string; case "number": return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; case "boolean": return ZodParsedType.boolean; case "function": return ZodParsedType.function; case "bigint": return ZodParsedType.bigint; case "symbol": return ZodParsedType.symbol; case "object": return Array.isArray(data) ? ZodParsedType.array : data === null ? ZodParsedType.null : data.then && typeof data.then == "function" && data.catch && typeof data.catch == "function" ? ZodParsedType.promise : typeof Map < "u" && data instanceof Map ? ZodParsedType.map : typeof Set < "u" && data instanceof Set ? ZodParsedType.set : typeof Date < "u" && data instanceof Date ? ZodParsedType.date : ZodParsedType.object; default: return ZodParsedType.unknown; } }; // node_modules/zod/v3/ZodError.js var ZodIssueCode = util.arrayToEnum([ "invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite" ]), quotelessJson = (obj) => JSON.stringify(obj, null, 2).replace(/"([^"]+)":/g, "$1:"), ZodError = class _ZodError extends Error { get errors() { return this.issues; } constructor(issues) { super(), this.issues = [], this.addIssue = (sub) => { this.issues = [...this.issues, sub]; }, this.addIssues = (subs = []) => { this.issues = [...this.issues, ...subs]; }; let actualProto = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, actualProto) : this.__proto__ = actualProto, this.name = "ZodError", this.issues = issues; } format(_mapper) { let mapper = _mapper || function(issue) { return issue.message; }, fieldErrors = { _errors: [] }, processError = (error) => { for (let issue of error.issues) if (issue.code === "invalid_union") issue.unionErrors.map(processError); else if (issue.code === "invalid_return_type") processError(issue.returnTypeError); else if (issue.code === "invalid_arguments") processError(issue.argumentsError); else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue)); else { let curr = fieldErrors, i2 = 0; for (; i2 < issue.path.length; ) { let el = issue.path[i2]; i2 === issue.path.length - 1 ? (curr[el] = curr[el] || { _errors: [] }, curr[el]._errors.push(mapper(issue))) : curr[el] = curr[el] || { _errors: [] }, curr = curr[el], i2++; } } }; return processError(this), fieldErrors; } static assert(value) { if (!(value instanceof _ZodError)) throw new Error(`Not a ZodError: ${value}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(mapper = (issue) => issue.message) { let fieldErrors = {}, formErrors = []; for (let sub of this.issues) if (sub.path.length > 0) { let firstEl = sub.path[0]; fieldErrors[firstEl] = fieldErrors[firstEl] || [], fieldErrors[firstEl].push(mapper(sub)); } else formErrors.push(mapper(sub)); return { formErrors, fieldErrors }; } get formErrors() { return this.flatten(); } }; ZodError.create = (issues) => new ZodError(issues); // node_modules/zod/v3/locales/en.js var errorMap = (issue, _ctx) => { let message; switch (issue.code) { case ZodIssueCode.invalid_type: issue.received === ZodParsedType.undefined ? message = "Required" : message = `Expected ${issue.expected}, received ${issue.received}`; break; case ZodIssueCode.invalid_literal: message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`; break; case ZodIssueCode.unrecognized_keys: message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`; break; case ZodIssueCode.invalid_union: message = "Invalid input"; break; case ZodIssueCode.invalid_union_discriminator: message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`; break; case ZodIssueCode.invalid_enum_value: message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`; break; case ZodIssueCode.invalid_arguments: message = "Invalid function arguments"; break; case ZodIssueCode.invalid_return_type: message = "Invalid function return type"; break; case ZodIssueCode.invalid_date: message = "Invalid date"; break; case ZodIssueCode.invalid_string: typeof issue.validation == "object" ? "includes" in issue.validation ? (message = `Invalid input: must include "${issue.validation.includes}"`, typeof issue.validation.position == "number" && (message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`)) : "startsWith" in issue.validation ? message = `Invalid input: must start with "${issue.validation.startsWith}"` : "endsWith" in issue.validation ? message = `Invalid input: must end with "${issue.validation.endsWith}"` : util.assertNever(issue.validation) : issue.validation !== "regex" ? message = `Invalid ${issue.validation}` : message = "Invalid"; break; case ZodIssueCode.too_small: issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"} ${issue.minimum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "over"} ${issue.minimum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "bigint" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(issue.minimum))}` : message = "Invalid input"; break; case ZodIssueCode.too_big: issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"} ${issue.maximum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "under"} ${issue.maximum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "bigint" ? message = `BigInt must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly" : issue.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(issue.maximum))}` : message = "Invalid input"; break; case ZodIssueCode.custom: message = "Invalid input"; break; case ZodIssueCode.invalid_intersection_types: message = "Intersection results could not be merged"; break; case ZodIssueCode.not_multiple_of: message = `Number must be a multiple of ${issue.multipleOf}`; break; case ZodIssueCode.not_finite: message = "Number must be finite"; break; default: message = _ctx.defaultError, util.assertNever(issue); } return { message }; }, en_default = errorMap; // node_modules/zod/v3/errors.js var overrideErrorMap = en_default; function setErrorMap(map) { overrideErrorMap = map; } function getErrorMap() { return overrideErrorMap; } // node_modules/zod/v3/helpers/parseUtil.js var makeIssue = (params) => { let { data, path, errorMaps, issueData } = params, fullPath = [...path, ...issueData.path || []], fullIssue = { ...issueData, path: fullPath }; if (issueData.message !== void 0) return { ...issueData, path: fullPath, message: issueData.message }; let errorMessage2 = "", maps = errorMaps.filter((m3) => !!m3).slice().reverse(); for (let map of maps) errorMessage2 = map(fullIssue, { data, defaultError: errorMessage2 }).message; return { ...issueData, path: fullPath, message: errorMessage2 }; }, EMPTY_PATH = []; function addIssueToContext(ctx, issueData) { let overrideMap = getErrorMap(), issue = makeIssue({ issueData, data: ctx.data, path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, // contextual error map is first priority ctx.schemaErrorMap, // then schema-bound map if available overrideMap, // then global override map overrideMap === en_default ? void 0 : en_default // then global default map ].filter((x5) => !!x5) }); ctx.common.issues.push(issue); } var ParseStatus = class _ParseStatus { constructor() { this.value = "valid"; } dirty() { this.value === "valid" && (this.value = "dirty"); } abort() { this.value !== "aborted" && (this.value = "aborted"); } static mergeArray(status, results) { let arrayValue = []; for (let s of results) { if (s.status === "aborted") return INVALID; s.status === "dirty" && status.dirty(), arrayValue.push(s.value); } return { status: status.value, value: arrayValue }; } static async mergeObjectAsync(status, pairs) { let syncPairs = []; for (let pair of pairs) { let key = await pair.key, value = await pair.value; syncPairs.push({ key, value }); } return _ParseStatus.mergeObjectSync(status, syncPairs); } static mergeObjectSync(status, pairs) { let finalObject = {}; for (let pair of pairs) { let { key, value } = pair; if (key.status === "aborted" || value.status === "aborted") return INVALID; key.status === "dirty" && status.dirty(), value.status === "dirty" && status.dirty(), key.value !== "__proto__" && (typeof value.value < "u" || pair.alwaysSet) && (finalObject[key.value] = value.value); } return { status: status.value, value: finalObject }; } }, INVALID = Object.freeze({ status: "aborted" }), DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x5) => x5.status === "aborted", isDirty = (x5) => x5.status === "dirty", isValid = (x5) => x5.status === "valid", isAsync = (x5) => typeof Promise < "u" && x5 instanceof Promise; // node_modules/zod/v3/helpers/errorUtil.js var errorUtil; (function(errorUtil2) { errorUtil2.errToObj = (message) => typeof message == "string" ? { message } : message || {}, errorUtil2.toString = (message) => typeof message == "string" ? message : message?.message; })(errorUtil || (errorUtil = {})); // node_modules/zod/v3/types.js var ParseInputLazyPath = class { constructor(parent, value, path, key) { this._cachedPath = [], this.parent = parent, this.data = value, this._path = path, this._key = key; } get path() { return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath; } }, handleResult = (ctx, result) => { if (isValid(result)) return { success: !0, data: result.value }; if (!ctx.common.issues.length) throw new Error("Validation failed but no issues detected."); return { success: !1, get error() { if (this._error) return this._error; let error = new ZodError(ctx.common.issues); return this._error = error, this._error; } }; }; function processCreateParams(params) { if (!params) return {}; let { errorMap: errorMap2, invalid_type_error, required_error, description } = params; if (errorMap2 && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); return errorMap2 ? { errorMap: errorMap2, description } : { errorMap: (iss, ctx) => { let { message } = params; return iss.code === "invalid_enum_value" ? { message: message ?? ctx.defaultError } : typeof ctx.data > "u" ? { message: message ?? required_error ?? ctx.defaultError } : iss.code !== "invalid_type" ? { message: ctx.defaultError } : { message: message ?? invalid_type_error ?? ctx.defaultError }; }, description }; } var ZodType = class { get description() { return this._def.description; } _getType(input) { return getParsedType(input.data); } _getOrReturnCtx(input, ctx) { return ctx || { common: input.parent.common, data: input.data, parsedType: getParsedType(input.data), schemaErrorMap: this._def.errorMap, path: input.path, parent: input.parent }; } _processInputParams(input) { return { status: new ParseStatus(), ctx: { common: input.parent.common, data: input.data, parsedType: getParsedType(input.data), schemaErrorMap: this._def.errorMap, path: input.path, parent: input.parent } }; } _parseSync(input) { let result = this._parse(input); if (isAsync(result)) throw new Error("Synchronous parse encountered promise."); return result; } _parseAsync(input) { let result = this._parse(input); return Promise.resolve(result); } parse(data, params) { let result = this.safeParse(data, params); if (result.success) return result.data; throw result.error; } safeParse(data, params) { let ctx = { common: { issues: [], async: params?.async ?? !1, contextualErrorMap: params?.errorMap }, path: params?.path || [], schemaErrorMap: this._def.errorMap, parent: null, data, parsedType: getParsedType(data) }, result = this._parseSync({ data, path: ctx.path, parent: ctx }); return handleResult(ctx, result); } "~validate"(data) { let ctx = { common: { issues: [], async: !!this["~standard"].async }, path: [], schemaErrorMap: this._def.errorMap, parent: null, data, parsedType: getParsedType(data) }; if (!this["~standard"].async) try { let result = this._parseSync({ data, path: [], parent: ctx }); return isValid(result) ? { value: result.value } : { issues: ctx.common.issues }; } catch (err2) { err2?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), ctx.common = { issues: [], async: !0 }; } return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? { value: result.value } : { issues: ctx.common.issues }); } async parseAsync(data, params) { let result = await this.safeParseAsync(data, params); if (result.success) return result.data; throw result.error; } async safeParseAsync(data, params) { let ctx = { common: { issues: [], contextualErrorMap: params?.errorMap, async: !0 }, path: params?.path || [], schemaErrorMap: this._def.errorMap, parent: null, data, parsedType: getParsedType(data) }, maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }), result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)); return handleResult(ctx, result); } refine(check, message) { let getIssueProperties = (val) => typeof message == "string" || typeof message > "u" ? { message } : typeof message == "function" ? message(val) : message; return this._refinement((val, ctx) => { let result = check(val), setError = () => ctx.addIssue({ code: ZodIssueCode.custom, ...getIssueProperties(val) }); return typeof Promise < "u" && result instanceof Promise ? result.then((data) => data ? !0 : (setError(), !1)) : result ? !0 : (setError(), !1); }); } refinement(check, refinementData) { return this._refinement((val, ctx) => check(val) ? !0 : (ctx.addIssue(typeof refinementData == "function" ? refinementData(val, ctx) : refinementData), !1)); } _refinement(refinement) { return new ZodEffects({ schema: this, typeName: ZodFirstPartyTypeKind.ZodEffects, effect: { type: "refinement", refinement } }); } superRefine(refinement) { return this._refinement(refinement); } constructor(def) { this.spa = this.safeParseAsync, this._def = def, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = { version: 1, vendor: "zod", validate: (data) => this["~validate"](data) }; } optional() { return ZodOptional.create(this, this._def); } nullable() { return ZodNullable.create(this, this._def); } nullish() { return this.nullable().optional(); } array() { return ZodArray.create(this); } promise() { return ZodPromise.create(this, this._def); } or(option) { return ZodUnion.create([this, option], this._def); } and(incoming) { return ZodIntersection.create(this, incoming, this._def); } transform(transform) { return new ZodEffects({ ...processCreateParams(this._def), schema: this, typeName: ZodFirstPartyTypeKind.ZodEffects, effect: { type: "transform", transform } }); } default(def) { let defaultValueFunc = typeof def == "function" ? def : () => def; return new ZodDefault({ ...processCreateParams(this._def), innerType: this, defaultValue: defaultValueFunc, typeName: ZodFirstPartyTypeKind.ZodDefault }); } brand() { return new ZodBranded({ typeName: ZodFirstPartyTypeKind.ZodBranded, type: this, ...processCreateParams(this._def) }); } catch(def) { let catchValueFunc = typeof def == "function" ? def : () => def; return new ZodCatch({ ...processCreateParams(this._def), innerType: this, catchValue: catchValueFunc, typeName: ZodFirstPartyTypeKind.ZodCatch }); } describe(description) { let This = this.constructor; return new This({ ...this._def, description }); } pipe(target2) { return ZodPipeline.create(this, target2); } readonly() { return ZodReadonly.create(this); } isOptional() { return this.safeParse(void 0).success; } isNullable() { return this.safeParse(null).success; } }, cuidRegex = /^c[^\s-]{8,}$/i, cuid2Regex = /^[0-9a-z]+$/, ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i, uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, nanoidRegex = /^[a-z0-9_-]{21}$/i, jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _emojiRegex = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", emojiRegex, ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dateRegexSource = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", dateRegex = new RegExp(`^${dateRegexSource}$`); function timeRegexSource(args2) { let secondsRegexSource = "[0-5]\\d"; args2.precision ? secondsRegexSource = `${secondsRegexSource}\\.\\d{${args2.precision}}` : args2.precision == null && (secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`); let secondsQuantifier = args2.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`; } function timeRegex(args2) { return new RegExp(`^${timeRegexSource(args2)}$`); } function datetimeRegex(args2) { let regex = `${dateRegexSource}T${timeRegexSource(args2)}`, opts = []; return opts.push(args2.local ? "Z?" : "Z"), args2.offset && opts.push("([+-]\\d{2}:?\\d{2})"), regex = `${regex}(${opts.join("|")})`, new RegExp(`^${regex}$`); } function isValidIP(ip, version) { return !!((version === "v4" || !version) && ipv4Regex.test(ip) || (version === "v6" || !version) && ipv6Regex.test(ip)); } function isValidJWT(jwt, alg) { if (!jwtRegex.test(jwt)) return !1; try { let [header] = jwt.split("."); if (!header) return !1; let base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "="), decoded = JSON.parse(atob(base64)); return !(typeof decoded != "object" || decoded === null || "typ" in decoded && decoded?.typ !== "JWT" || !decoded.alg || alg && decoded.alg !== alg); } catch { return !1; } } function isValidCidr(ip, version) { return !!((version === "v4" || !version) && ipv4CidrRegex.test(ip) || (version === "v6" || !version) && ipv6CidrRegex.test(ip)); } var ZodString = class _ZodString extends ZodType { _parse(input) { if (this._def.coerce && (input.data = String(input.data)), this._getType(input) !== ZodParsedType.string) { let ctx2 = this._getOrReturnCtx(input); return addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.string, received: ctx2.parsedType }), INVALID; } let status = new ParseStatus(), ctx; for (let check of this._def.checks) if (check.kind === "min") input.data.length < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "string", inclusive: !0, exact: !1, message: check.message }), status.dirty()); else if (check.kind === "max") input.data.length > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "string", inclusive: !0, exact: !1, message: check.message }), status.dirty()); else if (check.kind === "length") { let tooBig = input.data.length > check.value, tooSmall = input.data.length < check.value; (tooBig || tooSmall) && (ctx = this._getOrReturnCtx(input, ctx), tooBig ? addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "string", inclusive: !0, exact: !0, message: check.message }) : tooSmall && addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "string", inclusive: !0, exact: !0, message: check.message }), status.dirty()); } else if (check.kind === "email") emailRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "email", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "emoji") emojiRegex || (emojiRegex = new RegExp(_emojiRegex, "u")), emojiRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "emoji", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "uuid") uuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "uuid", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "nanoid") nanoidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "nanoid", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "cuid") cuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "cuid", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "cuid2") cuid2Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "cuid2", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "ulid") ulidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "ulid", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()); else if (check.kind === "url") try { new URL(input.data); } catch { ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "url", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty(); } else check.kind === "regex" ? (check.regex.lastIndex = 0, check.regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "regex", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty())) : check.kind === "trim" ? input.data = input.data.trim() : check.kind === "includes" ? input.data.includes(check.value, check.position) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { includes: check.value, position: check.position }, message: check.message }), status.dirty()) : check.kind === "toLowerCase" ? input.data = input.data.toLowerCase() : check.kind === "toUpperCase" ? input.data = input.data.toUpperCase() : check.kind === "startsWith" ? input.data.startsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { startsWith: check.value }, message: check.message }), status.dirty()) : check.kind === "endsWith" ? input.data.endsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { endsWith: check.value }, message: check.message }), status.dirty()) : check.kind === "datetime" ? datetimeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "datetime", message: check.message }), status.dirty()) : check.kind === "date" ? dateRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "date", message: check.message }), status.dirty()) : check.kind === "time" ? timeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "time", message: check.message }), status.dirty()) : check.kind === "duration" ? durationRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "duration", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : check.kind === "ip" ? isValidIP(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "ip", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : check.kind === "jwt" ? isValidJWT(input.data, check.alg) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "jwt", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : check.kind === "cidr" ? isValidCidr(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "cidr", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : check.kind === "base64" ? base64Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "base64", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : check.kind === "base64url" ? base64urlRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { validation: "base64url", code: ZodIssueCode.invalid_string, message: check.message }), status.dirty()) : util.assertNever(check); return { status: status.value, value: input.data }; } _regex(regex, validation, message) { return this.refinement((data) => regex.test(data), { validation, code: ZodIssueCode.invalid_string, ...errorUtil.errToObj(message) }); } _addCheck(check) { return new _ZodString({ ...this._def, checks: [...this._def.checks, check] }); } email(message) { return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) }); } url(message) { return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) }); } emoji(message) { return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); } uuid(message) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } nanoid(message) { return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); } cuid(message) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } cuid2(message) { return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); } ulid(message) { return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); } base64(message) { return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); } base64url(message) { return this._addCheck({ kind: "base64url", ...errorUtil.errToObj(message) }); } jwt(options) { return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) }); } ip(options) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); } cidr(options) { return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) }); } datetime(options) { return typeof options == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: !1, local: !1, message: options }) : this._addCheck({ kind: "datetime", precision: typeof options?.precision > "u" ? null : options?.precision, offset: options?.offset ?? !1, local: options?.local ?? !1, ...errorUtil.errToObj(options?.message) }); } date(message) { return this._addCheck({ kind: "date", message }); } time(options) { return typeof options == "string" ? this._addCheck({ kind: "time", precision: null, message: options }) : this._addCheck({ kind: "time", precision: typeof options?.precision > "u" ? null : options?.precision, ...errorUtil.errToObj(options?.message) }); } duration(message) { return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); } regex(regex, message) { return this._addCheck({ kind: "regex", regex, ...errorUtil.errToObj(message) }); } includes(value, options) { return this._addCheck({ kind: "includes", value, position: options?.position, ...errorUtil.errToObj(options?.message) }); } startsWith(value, message) { return this._addCheck({ kind: "startsWith", value, ...errorUtil.errToObj(message) }); } endsWith(value, message) { return this._addCheck({ kind: "endsWith", value, ...errorUtil.errToObj(message) }); } min(minLength, message) { return this._addCheck({ kind: "min", value: minLength, ...errorUtil.errToObj(message) }); } max(maxLength, message) { return this._addCheck({ kind: "max", value: maxLength, ...errorUtil.errToObj(message) }); } length(len, message) { return this._addCheck({ kind: "length", value: len, ...errorUtil.errToObj(message) }); } /** * Equivalent to `.min(1)` */ nonempty(message) { return this.min(1, errorUtil.errToObj(message)); } trim() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "trim" }] }); } toLowerCase() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "toLowerCase" }] }); } toUpperCase() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "toUpperCase" }] }); } get isDatetime() { return !!this._def.checks.find((ch) => ch.kind === "datetime"); } get isDate() { return !!this._def.checks.find((ch) => ch.kind === "date"); } get isTime() { return !!this._def.checks.find((ch) => ch.kind === "time"); } get isDuration() { return !!this._def.checks.find((ch) => ch.kind === "duration"); } get isEmail() { return !!this._def.checks.find((ch) => ch.kind === "email"); } get isURL() { return !!this._def.checks.find((ch) => ch.kind === "url"); } get isEmoji() { return !!this._def.checks.find((ch) => ch.kind === "emoji"); } get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } get isNANOID() { return !!this._def.checks.find((ch) => ch.kind === "nanoid"); } get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } get isCUID2() { return !!this._def.checks.find((ch) => ch.kind === "cuid2"); } get isULID() { return !!this._def.checks.find((ch) => ch.kind === "ulid"); } get isIP() { return !!this._def.checks.find((ch) => ch.kind === "ip"); } get isCIDR() { return !!this._def.checks.find((ch) => ch.kind === "cidr"); } get isBase64() { return !!this._def.checks.find((ch) => ch.kind === "base64"); } get isBase64url() { return !!this._def.checks.find((ch) => ch.kind === "base64url"); } get minLength() { let min = null; for (let ch of this._def.checks) ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value); return min; } get maxLength() { let max = null; for (let ch of this._def.checks) ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value); return max; } }; ZodString.create = (params) => new ZodString({ checks: [], typeName: ZodFirstPartyTypeKind.ZodString, coerce: params?.coerce ?? !1, ...processCreateParams(params) }); function floatSafeRemainder(val, step) { let valDecCount = (val.toString().split(".")[1] || "").length, stepDecCount = (step.toString().split(".")[1] || "").length, decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")), stepInt = Number.parseInt(step.toFixed(decCount).replace(".", "")); return valInt % stepInt / 10 ** decCount; } var ZodNumber = class _ZodNumber extends ZodType { constructor() { super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf; } _parse(input) { if (this._def.coerce && (input.data = Number(input.data)), this._getType(input) !== ZodParsedType.number) { let ctx2 = this._getOrReturnCtx(input); return addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.number, received: ctx2.parsedType }), INVALID; } let ctx, status = new ParseStatus(); for (let check of this._def.checks) check.kind === "int" ? util.isInteger(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: "integer", received: "float", message: check.message }), status.dirty()) : check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "number", inclusive: check.inclusive, exact: !1, message: check.message }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "number", inclusive: check.inclusive, exact: !1, message: check.message }), status.dirty()) : check.kind === "multipleOf" ? floatSafeRemainder(input.data, check.value) !== 0 && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check.value, message: check.message }), status.dirty()) : check.kind === "finite" ? Number.isFinite(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.not_finite, message: check.message }), status.dirty()) : util.assertNever(check); return { status: status.value, value: input.data }; } gte(value, message) { return this.setLimit("min", value, !0, errorUtil.toString(message)); } gt(value, message) { return this.setLimit("min", value, !1, errorUtil.toString(message)); } lte(value, message) { return this.setLimit("max", value, !0, errorUtil.toString(message)); } lt(value, message) { return this.setLimit("max", value, !1, errorUtil.toString(message)); } setLimit(kind, value, inclusive, message) { return new _ZodNumber({ ...this._def, checks: [ ...this._def.checks, { kind, value, inclusive, message: errorUtil.toString(message) } ] }); } _addCheck(check) { return new _ZodNumber({ ...this._def, checks: [...this._def.checks, check] }); } int(message) { return this._addCheck({ kind: "int", message: errorUtil.toString(message) }); } positive(message) { return this._addCheck({ kind: "min", value: 0, inclusive: !1, message: errorUtil.toString(message) }); } negative(message) { return this._addCheck({ kind: "max", value: 0, inclusive: !1, message: errorUtil.toString(message) }); } nonpositive(message) { return this._addCheck({ kind: "max", value: 0, inclusive: !0, message: errorUtil.toString(message) }); } nonnegative(message) { return this._addCheck({ kind: "min", value: 0, inclusive: !0, message: errorUtil.toString(message) }); } multipleOf(value, message) { return this._addCheck({ kind: "multipleOf", value, message: errorUtil.toString(message) }); } finite(message) { return this._addCheck({ kind: "finite", message: errorUtil.toString(message) }); } safe(message) { return this._addCheck({ kind: "min", inclusive: !0, value: Number.MIN_SAFE_INTEGER, message: errorUtil.toString(message) })._addCheck({ kind: "max", inclusive: !0, value: Number.MAX_SAFE_INTEGER, message: errorUtil.toString(message) }); } get minValue() { let min = null; for (let ch of this._def.checks) ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value); return min; } get maxValue() { let max = null; for (let ch of this._def.checks) ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value); return max; } get isInt() { return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value)); } get isFinite() { let max = null, min = null; for (let ch of this._def.checks) { if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") return !0; ch.kind === "min" ? (min === null || ch.value > min) && (min = ch.value) : ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value); } return Number.isFinite(min) && Number.isFinite(max); } }; ZodNumber.create = (params) => new ZodNumber({ checks: [], typeName: ZodFirstPartyTypeKind.ZodNumber, coerce: params?.coerce || !1, ...processCreateParams(params) }); var ZodBigInt = class _ZodBigInt extends ZodType { constructor() { super(...arguments), this.min = this.gte, this.max = this.lte; } _parse(input) { if (this._def.coerce) try { input.data = BigInt(input.data); } catch { return this._getInvalidInput(input); } if (this._getType(input) !== ZodParsedType.bigint) return this._getInvalidInput(input); let ctx, status = new ParseStatus(); for (let check of this._def.checks) check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_small, type: "bigint", minimum: check.value, inclusive: check.inclusive, message: check.message }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_big, type: "bigint", maximum: check.value, inclusive: check.inclusive, message: check.message }), status.dirty()) : check.kind === "multipleOf" ? input.data % check.value !== BigInt(0) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check.value, message: check.message }), status.dirty()) : util.assertNever(check); return { status: status.value, value: input.data }; } _getInvalidInput(input) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.bigint, received: ctx.parsedType }), INVALID; } gte(value, message) { return this.setLimit("min", value, !0, errorUtil.toString(message)); } gt(value, message) { return this.setLimit("min", value, !1, errorUtil.toString(message)); } lte(value, message) { return this.setLimit("max", value, !0, errorUtil.toString(message)); } lt(value, message) { return this.setLimit("max", value, !1, errorUtil.toString(message)); } setLimit(kind, value, inclusive, message) { return new _ZodBigInt({ ...this._def, checks: [ ...this._def.checks, { kind, value, inclusive, message: errorUtil.toString(message) } ] }); } _addCheck(check) { return new _ZodBigInt({ ...this._def, checks: [...this._def.checks, check] }); } positive(message) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !1, message: errorUtil.toString(message) }); } negative(message) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !1, message: errorUtil.toString(message) }); } nonpositive(message) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: !0, message: errorUtil.toString(message) }); } nonnegative(message) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: !0, message: errorUtil.toString(message) }); } multipleOf(value, message) { return this._addCheck({ kind: "multipleOf", value, message: errorUtil.toString(message) }); } get minValue() { let min = null; for (let ch of this._def.checks) ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value); return min; } get maxValue() { let max = null; for (let ch of this._def.checks) ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value); return max; } }; ZodBigInt.create = (params) => new ZodBigInt({ checks: [], typeName: ZodFirstPartyTypeKind.ZodBigInt, coerce: params?.coerce ?? !1, ...processCreateParams(params) }); var ZodBoolean = class extends ZodType { _parse(input) { if (this._def.coerce && (input.data = !!input.data), this._getType(input) !== ZodParsedType.boolean) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.boolean, received: ctx.parsedType }), INVALID; } return OK(input.data); } }; ZodBoolean.create = (params) => new ZodBoolean({ typeName: ZodFirstPartyTypeKind.ZodBoolean, coerce: params?.coerce || !1, ...processCreateParams(params) }); var ZodDate = class _ZodDate extends ZodType { _parse(input) { if (this._def.coerce && (input.data = new Date(input.data)), this._getType(input) !== ZodParsedType.date) { let ctx2 = this._getOrReturnCtx(input); return addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.date, received: ctx2.parsedType }), INVALID; } if (Number.isNaN(input.data.getTime())) { let ctx2 = this._getOrReturnCtx(input); return addIssueToContext(ctx2, { code: ZodIssueCode.invalid_date }), INVALID; } let status = new ParseStatus(), ctx; for (let check of this._def.checks) check.kind === "min" ? input.data.getTime() < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_small, message: check.message, inclusive: !0, exact: !1, minimum: check.value, type: "date" }), status.dirty()) : check.kind === "max" ? input.data.getTime() > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, { code: ZodIssueCode.too_big, message: check.message, inclusive: !0, exact: !1, maximum: check.value, type: "date" }), status.dirty()) : util.assertNever(check); return { status: status.value, value: new Date(input.data.getTime()) }; } _addCheck(check) { return new _ZodDate({ ...this._def, checks: [...this._def.checks, check] }); } min(minDate, message) { return this._addCheck({ kind: "min", value: minDate.getTime(), message: errorUtil.toString(message) }); } max(maxDate, message) { return this._addCheck({ kind: "max", value: maxDate.getTime(), message: errorUtil.toString(message) }); } get minDate() { let min = null; for (let ch of this._def.checks) ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value); return min != null ? new Date(min) : null; } get maxDate() { let max = null; for (let ch of this._def.checks) ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value); return max != null ? new Date(max) : null; } }; ZodDate.create = (params) => new ZodDate({ checks: [], coerce: params?.coerce || !1, typeName: ZodFirstPartyTypeKind.ZodDate, ...processCreateParams(params) }); var ZodSymbol = class extends ZodType { _parse(input) { if (this._getType(input) !== ZodParsedType.symbol) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.symbol, received: ctx.parsedType }), INVALID; } return OK(input.data); } }; ZodSymbol.create = (params) => new ZodSymbol({ typeName: ZodFirstPartyTypeKind.ZodSymbol, ...processCreateParams(params) }); var ZodUndefined = class extends ZodType { _parse(input) { if (this._getType(input) !== ZodParsedType.undefined) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.undefined, received: ctx.parsedType }), INVALID; } return OK(input.data); } }; ZodUndefined.create = (params) => new ZodUndefined({ typeName: ZodFirstPartyTypeKind.ZodUndefined, ...processCreateParams(params) }); var ZodNull = class extends ZodType { _parse(input) { if (this._getType(input) !== ZodParsedType.null) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.null, received: ctx.parsedType }), INVALID; } return OK(input.data); } }; ZodNull.create = (params) => new ZodNull({ typeName: ZodFirstPartyTypeKind.ZodNull, ...processCreateParams(params) }); var ZodAny = class extends ZodType { constructor() { super(...arguments), this._any = !0; } _parse(input) { return OK(input.data); } }; ZodAny.create = (params) => new ZodAny({ typeName: ZodFirstPartyTypeKind.ZodAny, ...processCreateParams(params) }); var ZodUnknown = class extends ZodType { constructor() { super(...arguments), this._unknown = !0; } _parse(input) { return OK(input.data); } }; ZodUnknown.create = (params) => new ZodUnknown({ typeName: ZodFirstPartyTypeKind.ZodUnknown, ...processCreateParams(params) }); var ZodNever = class extends ZodType { _parse(input) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.never, received: ctx.parsedType }), INVALID; } }; ZodNever.create = (params) => new ZodNever({ typeName: ZodFirstPartyTypeKind.ZodNever, ...processCreateParams(params) }); var ZodVoid = class extends ZodType { _parse(input) { if (this._getType(input) !== ZodParsedType.undefined) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.void, received: ctx.parsedType }), INVALID; } return OK(input.data); } }; ZodVoid.create = (params) => new ZodVoid({ typeName: ZodFirstPartyTypeKind.ZodVoid, ...processCreateParams(params) }); var ZodArray = class _ZodArray extends ZodType { _parse(input) { let { ctx, status } = this._processInputParams(input), def = this._def; if (ctx.parsedType !== ZodParsedType.array) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.array, received: ctx.parsedType }), INVALID; if (def.exactLength !== null) { let tooBig = ctx.data.length > def.exactLength.value, tooSmall = ctx.data.length < def.exactLength.value; (tooBig || tooSmall) && (addIssueToContext(ctx, { code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small, minimum: tooSmall ? def.exactLength.value : void 0, maximum: tooBig ? def.exactLength.value : void 0, type: "array", inclusive: !0, exact: !0, message: def.exactLength.message }), status.dirty()); } if (def.minLength !== null && ctx.data.length < def.minLength.value && (addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: def.minLength.value, type: "array", inclusive: !0, exact: !1, message: def.minLength.message }), status.dirty()), def.maxLength !== null && ctx.data.length > def.maxLength.value && (addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: def.maxLength.value, type: "array", inclusive: !0, exact: !1, message: def.maxLength.message }), status.dirty()), ctx.common.async) return Promise.all([...ctx.data].map((item, i2) => def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2)))).then((result2) => ParseStatus.mergeArray(status, result2)); let result = [...ctx.data].map((item, i2) => def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2))); return ParseStatus.mergeArray(status, result); } get element() { return this._def.type; } min(minLength, message) { return new _ZodArray({ ...this._def, minLength: { value: minLength, message: errorUtil.toString(message) } }); } max(maxLength, message) { return new _ZodArray({ ...this._def, maxLength: { value: maxLength, message: errorUtil.toString(message) } }); } length(len, message) { return new _ZodArray({ ...this._def, exactLength: { value: len, message: errorUtil.toString(message) } }); } nonempty(message) { return this.min(1, message); } }; ZodArray.create = (schema, params) => new ZodArray({ type: schema, minLength: null, maxLength: null, exactLength: null, typeName: ZodFirstPartyTypeKind.ZodArray, ...processCreateParams(params) }); function deepPartialify(schema) { if (schema instanceof ZodObject) { let newShape = {}; for (let key in schema.shape) { let fieldSchema = schema.shape[key]; newShape[key] = ZodOptional.create(deepPartialify(fieldSchema)); } return new ZodObject({ ...schema._def, shape: () => newShape }); } else return schema instanceof ZodArray ? new ZodArray({ ...schema._def, type: deepPartialify(schema.element) }) : schema instanceof ZodOptional ? ZodOptional.create(deepPartialify(schema.unwrap())) : schema instanceof ZodNullable ? ZodNullable.create(deepPartialify(schema.unwrap())) : schema instanceof ZodTuple ? ZodTuple.create(schema.items.map((item) => deepPartialify(item))) : schema; } var ZodObject = class _ZodObject extends ZodType { constructor() { super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend; } _getCached() { if (this._cached !== null) return this._cached; let shape = this._def.shape(), keys = util.objectKeys(shape); return this._cached = { shape, keys }, this._cached; } _parse(input) { if (this._getType(input) !== ZodParsedType.object) { let ctx2 = this._getOrReturnCtx(input); return addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx2.parsedType }), INVALID; } let { status, ctx } = this._processInputParams(input), { shape, keys: shapeKeys } = this._getCached(), extraKeys = []; if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) for (let key in ctx.data) shapeKeys.includes(key) || extraKeys.push(key); let pairs = []; for (let key of shapeKeys) { let keyValidator = shape[key], value = ctx.data[key]; pairs.push({ key: { status: "valid", value: key }, value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)), alwaysSet: key in ctx.data }); } if (this._def.catchall instanceof ZodNever) { let unknownKeys = this._def.unknownKeys; if (unknownKeys === "passthrough") for (let key of extraKeys) pairs.push({ key: { status: "valid", value: key }, value: { status: "valid", value: ctx.data[key] } }); else if (unknownKeys === "strict") extraKeys.length > 0 && (addIssueToContext(ctx, { code: ZodIssueCode.unrecognized_keys, keys: extraKeys }), status.dirty()); else if (unknownKeys !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value."); } else { let catchall = this._def.catchall; for (let key of extraKeys) { let value = ctx.data[key]; pairs.push({ key: { status: "valid", value: key }, value: catchall._parse( new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value) ), alwaysSet: key in ctx.data }); } } return ctx.common.async ? Promise.resolve().then(async () => { let syncPairs = []; for (let pair of pairs) { let key = await pair.key, value = await pair.value; syncPairs.push({ key, value, alwaysSet: pair.alwaysSet }); } return syncPairs; }).then((syncPairs) => ParseStatus.mergeObjectSync(status, syncPairs)) : ParseStatus.mergeObjectSync(status, pairs); } get shape() { return this._def.shape(); } strict(message) { return errorUtil.errToObj, new _ZodObject({ ...this._def, unknownKeys: "strict", ...message !== void 0 ? { errorMap: (issue, ctx) => { let defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError; return issue.code === "unrecognized_keys" ? { message: errorUtil.errToObj(message).message ?? defaultError } : { message: defaultError }; } } : {} }); } strip() { return new _ZodObject({ ...this._def, unknownKeys: "strip" }); } passthrough() { return new _ZodObject({ ...this._def, unknownKeys: "passthrough" }); } // const AugmentFactory = // (def: Def) => // ( // augmentation: Augmentation // ): ZodObject< // extendShape, Augmentation>, // Def["unknownKeys"], // Def["catchall"] // > => { // return new ZodObject({ // ...def, // shape: () => ({ // ...def.shape(), // ...augmentation, // }), // }) as any; // }; extend(augmentation) { return new _ZodObject({ ...this._def, shape: () => ({ ...this._def.shape(), ...augmentation }) }); } /** * Prior to zod@1.0.12 there was a bug in the * inferred type of merged objects. Please * upgrade if you are experiencing issues. */ merge(merging) { return new _ZodObject({ unknownKeys: merging._def.unknownKeys, catchall: merging._def.catchall, shape: () => ({ ...this._def.shape(), ...merging._def.shape() }), typeName: ZodFirstPartyTypeKind.ZodObject }); } // merge< // Incoming extends AnyZodObject, // Augmentation extends Incoming["shape"], // NewOutput extends { // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation // ? Augmentation[k]["_output"] // : k extends keyof Output // ? Output[k] // : never; // }, // NewInput extends { // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation // ? Augmentation[k]["_input"] // : k extends keyof Input // ? Input[k] // : never; // } // >( // merging: Incoming // ): ZodObject< // extendShape>, // Incoming["_def"]["unknownKeys"], // Incoming["_def"]["catchall"], // NewOutput, // NewInput // > { // const merged: any = new ZodObject({ // unknownKeys: merging._def.unknownKeys, // catchall: merging._def.catchall, // shape: () => // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), // typeName: ZodFirstPartyTypeKind.ZodObject, // }) as any; // return merged; // } setKey(key, schema) { return this.augment({ [key]: schema }); } // merge( // merging: Incoming // ): //ZodObject = (merging) => { // ZodObject< // extendShape>, // Incoming["_def"]["unknownKeys"], // Incoming["_def"]["catchall"] // > { // // const mergedShape = objectUtil.mergeShapes( // // this._def.shape(), // // merging._def.shape() // // ); // const merged: any = new ZodObject({ // unknownKeys: merging._def.unknownKeys, // catchall: merging._def.catchall, // shape: () => // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), // typeName: ZodFirstPartyTypeKind.ZodObject, // }) as any; // return merged; // } catchall(index) { return new _ZodObject({ ...this._def, catchall: index }); } pick(mask) { let shape = {}; for (let key of util.objectKeys(mask)) mask[key] && this.shape[key] && (shape[key] = this.shape[key]); return new _ZodObject({ ...this._def, shape: () => shape }); } omit(mask) { let shape = {}; for (let key of util.objectKeys(this.shape)) mask[key] || (shape[key] = this.shape[key]); return new _ZodObject({ ...this._def, shape: () => shape }); } /** * @deprecated */ deepPartial() { return deepPartialify(this); } partial(mask) { let newShape = {}; for (let key of util.objectKeys(this.shape)) { let fieldSchema = this.shape[key]; mask && !mask[key] ? newShape[key] = fieldSchema : newShape[key] = fieldSchema.optional(); } return new _ZodObject({ ...this._def, shape: () => newShape }); } required(mask) { let newShape = {}; for (let key of util.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key]; else { let newField = this.shape[key]; for (; newField instanceof ZodOptional; ) newField = newField._def.innerType; newShape[key] = newField; } return new _ZodObject({ ...this._def, shape: () => newShape }); } keyof() { return createZodEnum(util.objectKeys(this.shape)); } }; ZodObject.create = (shape, params) => new ZodObject({ shape: () => shape, unknownKeys: "strip", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); ZodObject.strictCreate = (shape, params) => new ZodObject({ shape: () => shape, unknownKeys: "strict", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); ZodObject.lazycreate = (shape, params) => new ZodObject({ shape, unknownKeys: "strip", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); var ZodUnion = class extends ZodType { _parse(input) { let { ctx } = this._processInputParams(input), options = this._def.options; function handleResults(results) { for (let result of results) if (result.result.status === "valid") return result.result; for (let result of results) if (result.result.status === "dirty") return ctx.common.issues.push(...result.ctx.common.issues), result.result; let unionErrors = results.map((result) => new ZodError(result.ctx.common.issues)); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_union, unionErrors }), INVALID; } if (ctx.common.async) return Promise.all(options.map(async (option) => { let childCtx = { ...ctx, common: { ...ctx.common, issues: [] }, parent: null }; return { result: await option._parseAsync({ data: ctx.data, path: ctx.path, parent: childCtx }), ctx: childCtx }; })).then(handleResults); { let dirty, issues = []; for (let option of options) { let childCtx = { ...ctx, common: { ...ctx.common, issues: [] }, parent: null }, result = option._parseSync({ data: ctx.data, path: ctx.path, parent: childCtx }); if (result.status === "valid") return result; result.status === "dirty" && !dirty && (dirty = { result, ctx: childCtx }), childCtx.common.issues.length && issues.push(childCtx.common.issues); } if (dirty) return ctx.common.issues.push(...dirty.ctx.common.issues), dirty.result; let unionErrors = issues.map((issues2) => new ZodError(issues2)); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_union, unionErrors }), INVALID; } } get options() { return this._def.options; } }; ZodUnion.create = (types, params) => new ZodUnion({ options: types, typeName: ZodFirstPartyTypeKind.ZodUnion, ...processCreateParams(params) }); var getDiscriminator = (type) => type instanceof ZodLazy ? getDiscriminator(type.schema) : type instanceof ZodEffects ? getDiscriminator(type.innerType()) : type instanceof ZodLiteral ? [type.value] : type instanceof ZodEnum ? type.options : type instanceof ZodNativeEnum ? util.objectValues(type.enum) : type instanceof ZodDefault ? getDiscriminator(type._def.innerType) : type instanceof ZodUndefined ? [void 0] : type instanceof ZodNull ? [null] : type instanceof ZodOptional ? [void 0, ...getDiscriminator(type.unwrap())] : type instanceof ZodNullable ? [null, ...getDiscriminator(type.unwrap())] : type instanceof ZodBranded || type instanceof ZodReadonly ? getDiscriminator(type.unwrap()) : type instanceof ZodCatch ? getDiscriminator(type._def.innerType) : [], ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { _parse(input) { let { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.object) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx.parsedType }), INVALID; let discriminator = this.discriminator, discriminatorValue = ctx.data[discriminator], option = this.optionsMap.get(discriminatorValue); return option ? ctx.common.async ? option._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }) : option._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }) : (addIssueToContext(ctx, { code: ZodIssueCode.invalid_union_discriminator, options: Array.from(this.optionsMap.keys()), path: [discriminator] }), INVALID); } get discriminator() { return this._def.discriminator; } get options() { return this._def.options; } get optionsMap() { return this._def.optionsMap; } /** * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. * However, it only allows a union of objects, all of which need to share a discriminator property. This property must * have a different value for each object in the union. * @param discriminator the name of the discriminator property * @param types an array of object schemas * @param params */ static create(discriminator, options, params) { let optionsMap = /* @__PURE__ */ new Map(); for (let type of options) { let discriminatorValues = getDiscriminator(type.shape[discriminator]); if (!discriminatorValues.length) throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); for (let value of discriminatorValues) { if (optionsMap.has(value)) throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`); optionsMap.set(value, type); } } return new _ZodDiscriminatedUnion({ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion, discriminator, options, optionsMap, ...processCreateParams(params) }); } }; function mergeValues(a2, b4) { let aType = getParsedType(a2), bType = getParsedType(b4); if (a2 === b4) return { valid: !0, data: a2 }; if (aType === ZodParsedType.object && bType === ZodParsedType.object) { let bKeys = util.objectKeys(b4), sharedKeys = util.objectKeys(a2).filter((key) => bKeys.indexOf(key) !== -1), newObj = { ...a2, ...b4 }; for (let key of sharedKeys) { let sharedValue = mergeValues(a2[key], b4[key]); if (!sharedValue.valid) return { valid: !1 }; newObj[key] = sharedValue.data; } return { valid: !0, data: newObj }; } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { if (a2.length !== b4.length) return { valid: !1 }; let newArray = []; for (let index = 0; index < a2.length; index++) { let itemA = a2[index], itemB = b4[index], sharedValue = mergeValues(itemA, itemB); if (!sharedValue.valid) return { valid: !1 }; newArray.push(sharedValue.data); } return { valid: !0, data: newArray }; } else return aType === ZodParsedType.date && bType === ZodParsedType.date && +a2 == +b4 ? { valid: !0, data: a2 } : { valid: !1 }; } var ZodIntersection = class extends ZodType { _parse(input) { let { status, ctx } = this._processInputParams(input), handleParsed = (parsedLeft, parsedRight) => { if (isAborted(parsedLeft) || isAborted(parsedRight)) return INVALID; let merged = mergeValues(parsedLeft.value, parsedRight.value); return merged.valid ? ((isDirty(parsedLeft) || isDirty(parsedRight)) && status.dirty(), { status: status.value, value: merged.data }) : (addIssueToContext(ctx, { code: ZodIssueCode.invalid_intersection_types }), INVALID); }; return ctx.common.async ? Promise.all([ this._def.left._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }), this._def.right._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }) ]).then(([left, right]) => handleParsed(left, right)) : handleParsed(this._def.left._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }), this._def.right._parseSync({ data: ctx.data, path: ctx.path, parent: ctx })); } }; ZodIntersection.create = (left, right, params) => new ZodIntersection({ left, right, typeName: ZodFirstPartyTypeKind.ZodIntersection, ...processCreateParams(params) }); var ZodTuple = class _ZodTuple extends ZodType { _parse(input) { let { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.array) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.array, received: ctx.parsedType }), INVALID; if (ctx.data.length < this._def.items.length) return addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: this._def.items.length, inclusive: !0, exact: !1, type: "array" }), INVALID; !this._def.rest && ctx.data.length > this._def.items.length && (addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: this._def.items.length, inclusive: !0, exact: !1, type: "array" }), status.dirty()); let items = [...ctx.data].map((item, itemIndex) => { let schema = this._def.items[itemIndex] || this._def.rest; return schema ? schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)) : null; }).filter((x5) => !!x5); return ctx.common.async ? Promise.all(items).then((results) => ParseStatus.mergeArray(status, results)) : ParseStatus.mergeArray(status, items); } get items() { return this._def.items; } rest(rest) { return new _ZodTuple({ ...this._def, rest }); } }; ZodTuple.create = (schemas, params) => { if (!Array.isArray(schemas)) throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); return new ZodTuple({ items: schemas, typeName: ZodFirstPartyTypeKind.ZodTuple, rest: null, ...processCreateParams(params) }); }; var ZodRecord = class _ZodRecord extends ZodType { get keySchema() { return this._def.keyType; } get valueSchema() { return this._def.valueType; } _parse(input) { let { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.object) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx.parsedType }), INVALID; let pairs = [], keyType = this._def.keyType, valueType = this._def.valueType; for (let key in ctx.data) pairs.push({ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)), alwaysSet: key in ctx.data }); return ctx.common.async ? ParseStatus.mergeObjectAsync(status, pairs) : ParseStatus.mergeObjectSync(status, pairs); } get element() { return this._def.valueType; } static create(first, second, third) { return second instanceof ZodType ? new _ZodRecord({ keyType: first, valueType: second, typeName: ZodFirstPartyTypeKind.ZodRecord, ...processCreateParams(third) }) : new _ZodRecord({ keyType: ZodString.create(), valueType: first, typeName: ZodFirstPartyTypeKind.ZodRecord, ...processCreateParams(second) }); } }, ZodMap = class extends ZodType { get keySchema() { return this._def.keyType; } get valueSchema() { return this._def.valueType; } _parse(input) { let { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.map) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.map, received: ctx.parsedType }), INVALID; let keyType = this._def.keyType, valueType = this._def.valueType, pairs = [...ctx.data.entries()].map(([key, value], index) => ({ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])), value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])) })); if (ctx.common.async) { let finalMap = /* @__PURE__ */ new Map(); return Promise.resolve().then(async () => { for (let pair of pairs) { let key = await pair.key, value = await pair.value; if (key.status === "aborted" || value.status === "aborted") return INVALID; (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value); } return { status: status.value, value: finalMap }; }); } else { let finalMap = /* @__PURE__ */ new Map(); for (let pair of pairs) { let key = pair.key, value = pair.value; if (key.status === "aborted" || value.status === "aborted") return INVALID; (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value); } return { status: status.value, value: finalMap }; } } }; ZodMap.create = (keyType, valueType, params) => new ZodMap({ valueType, keyType, typeName: ZodFirstPartyTypeKind.ZodMap, ...processCreateParams(params) }); var ZodSet = class _ZodSet extends ZodType { _parse(input) { let { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.set) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.set, received: ctx.parsedType }), INVALID; let def = this._def; def.minSize !== null && ctx.data.size < def.minSize.value && (addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: def.minSize.value, type: "set", inclusive: !0, exact: !1, message: def.minSize.message }), status.dirty()), def.maxSize !== null && ctx.data.size > def.maxSize.value && (addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: def.maxSize.value, type: "set", inclusive: !0, exact: !1, message: def.maxSize.message }), status.dirty()); let valueType = this._def.valueType; function finalizeSet(elements2) { let parsedSet = /* @__PURE__ */ new Set(); for (let element of elements2) { if (element.status === "aborted") return INVALID; element.status === "dirty" && status.dirty(), parsedSet.add(element.value); } return { status: status.value, value: parsedSet }; } let elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2))); return ctx.common.async ? Promise.all(elements).then((elements2) => finalizeSet(elements2)) : finalizeSet(elements); } min(minSize, message) { return new _ZodSet({ ...this._def, minSize: { value: minSize, message: errorUtil.toString(message) } }); } max(maxSize, message) { return new _ZodSet({ ...this._def, maxSize: { value: maxSize, message: errorUtil.toString(message) } }); } size(size, message) { return this.min(size, message).max(size, message); } nonempty(message) { return this.min(1, message); } }; ZodSet.create = (valueType, params) => new ZodSet({ valueType, minSize: null, maxSize: null, typeName: ZodFirstPartyTypeKind.ZodSet, ...processCreateParams(params) }); var ZodFunction = class _ZodFunction extends ZodType { constructor() { super(...arguments), this.validate = this.implement; } _parse(input) { let { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.function) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.function, received: ctx.parsedType }), INVALID; function makeArgsIssue(args2, error) { return makeIssue({ data: args2, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x5) => !!x5), issueData: { code: ZodIssueCode.invalid_arguments, argumentsError: error } }); } function makeReturnsIssue(returns, error) { return makeIssue({ data: returns, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x5) => !!x5), issueData: { code: ZodIssueCode.invalid_return_type, returnTypeError: error } }); } let params = { errorMap: ctx.common.contextualErrorMap }, fn2 = ctx.data; if (this._def.returns instanceof ZodPromise) { let me4 = this; return OK(async function(...args2) { let error = new ZodError([]), parsedArgs = await me4._def.args.parseAsync(args2, params).catch((e) => { throw error.addIssue(makeArgsIssue(args2, e)), error; }), result = await Reflect.apply(fn2, this, parsedArgs); return await me4._def.returns._def.type.parseAsync(result, params).catch((e) => { throw error.addIssue(makeReturnsIssue(result, e)), error; }); }); } else { let me4 = this; return OK(function(...args2) { let parsedArgs = me4._def.args.safeParse(args2, params); if (!parsedArgs.success) throw new ZodError([makeArgsIssue(args2, parsedArgs.error)]); let result = Reflect.apply(fn2, this, parsedArgs.data), parsedReturns = me4._def.returns.safeParse(result, params); if (!parsedReturns.success) throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]); return parsedReturns.data; }); } } parameters() { return this._def.args; } returnType() { return this._def.returns; } args(...items) { return new _ZodFunction({ ...this._def, args: ZodTuple.create(items).rest(ZodUnknown.create()) }); } returns(returnType) { return new _ZodFunction({ ...this._def, returns: returnType }); } implement(func2) { return this.parse(func2); } strictImplement(func2) { return this.parse(func2); } static create(args2, returns, params) { return new _ZodFunction({ args: args2 || ZodTuple.create([]).rest(ZodUnknown.create()), returns: returns || ZodUnknown.create(), typeName: ZodFirstPartyTypeKind.ZodFunction, ...processCreateParams(params) }); } }, ZodLazy = class extends ZodType { get schema() { return this._def.getter(); } _parse(input) { let { ctx } = this._processInputParams(input); return this._def.getter()._parse({ data: ctx.data, path: ctx.path, parent: ctx }); } }; ZodLazy.create = (getter, params) => new ZodLazy({ getter, typeName: ZodFirstPartyTypeKind.ZodLazy, ...processCreateParams(params) }); var ZodLiteral = class extends ZodType { _parse(input) { if (input.data !== this._def.value) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_literal, expected: this._def.value }), INVALID; } return { status: "valid", value: input.data }; } get value() { return this._def.value; } }; ZodLiteral.create = (value, params) => new ZodLiteral({ value, typeName: ZodFirstPartyTypeKind.ZodLiteral, ...processCreateParams(params) }); function createZodEnum(values, params) { return new ZodEnum({ values, typeName: ZodFirstPartyTypeKind.ZodEnum, ...processCreateParams(params) }); } var ZodEnum = class _ZodEnum extends ZodType { _parse(input) { if (typeof input.data != "string") { let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values; return addIssueToContext(ctx, { expected: util.joinValues(expectedValues), received: ctx.parsedType, code: ZodIssueCode.invalid_type }), INVALID; } if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(input.data)) { let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values; return addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_enum_value, options: expectedValues }), INVALID; } return OK(input.data); } get options() { return this._def.values; } get enum() { let enumValues = {}; for (let val of this._def.values) enumValues[val] = val; return enumValues; } get Values() { let enumValues = {}; for (let val of this._def.values) enumValues[val] = val; return enumValues; } get Enum() { let enumValues = {}; for (let val of this._def.values) enumValues[val] = val; return enumValues; } extract(values, newDef = this._def) { return _ZodEnum.create(values, { ...this._def, ...newDef }); } exclude(values, newDef = this._def) { return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { ...this._def, ...newDef }); } }; ZodEnum.create = createZodEnum; var ZodNativeEnum = class extends ZodType { _parse(input) { let nativeEnumValues = util.getValidEnumValues(this._def.values), ctx = this._getOrReturnCtx(input); if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) { let expectedValues = util.objectValues(nativeEnumValues); return addIssueToContext(ctx, { expected: util.joinValues(expectedValues), received: ctx.parsedType, code: ZodIssueCode.invalid_type }), INVALID; } if (this._cache || (this._cache = new Set(util.getValidEnumValues(this._def.values))), !this._cache.has(input.data)) { let expectedValues = util.objectValues(nativeEnumValues); return addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_enum_value, options: expectedValues }), INVALID; } return OK(input.data); } get enum() { return this._def.values; } }; ZodNativeEnum.create = (values, params) => new ZodNativeEnum({ values, typeName: ZodFirstPartyTypeKind.ZodNativeEnum, ...processCreateParams(params) }); var ZodPromise = class extends ZodType { unwrap() { return this._def.type; } _parse(input) { let { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === !1) return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.promise, received: ctx.parsedType }), INVALID; let promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data); return OK(promisified.then((data) => this._def.type.parseAsync(data, { path: ctx.path, errorMap: ctx.common.contextualErrorMap }))); } }; ZodPromise.create = (schema, params) => new ZodPromise({ type: schema, typeName: ZodFirstPartyTypeKind.ZodPromise, ...processCreateParams(params) }); var ZodEffects = class extends ZodType { innerType() { return this._def.schema; } sourceType() { return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema; } _parse(input) { let { status, ctx } = this._processInputParams(input), effect = this._def.effect || null, checkCtx = { addIssue: (arg) => { addIssueToContext(ctx, arg), arg.fatal ? status.abort() : status.dirty(); }, get path() { return ctx.path; } }; if (checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx), effect.type === "preprocess") { let processed = effect.transform(ctx.data, checkCtx); if (ctx.common.async) return Promise.resolve(processed).then(async (processed2) => { if (status.value === "aborted") return INVALID; let result = await this._def.schema._parseAsync({ data: processed2, path: ctx.path, parent: ctx }); return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result; }); { if (status.value === "aborted") return INVALID; let result = this._def.schema._parseSync({ data: processed, path: ctx.path, parent: ctx }); return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result; } } if (effect.type === "refinement") { let executeRefinement = (acc) => { let result = effect.refinement(acc, checkCtx); if (ctx.common.async) return Promise.resolve(result); if (result instanceof Promise) throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); return acc; }; if (ctx.common.async === !1) { let inner = this._def.schema._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); return inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value), { status: status.value, value: inner.value }); } else return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value).then(() => ({ status: status.value, value: inner.value })))); } if (effect.type === "transform") if (ctx.common.async === !1) { let base = this._def.schema._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); if (!isValid(base)) return INVALID; let result = effect.transform(base.value, checkCtx); if (result instanceof Promise) throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead."); return { status: status.value, value: result }; } else return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => isValid(base) ? Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result })) : INVALID); util.assertNever(effect); } }; ZodEffects.create = (schema, effect, params) => new ZodEffects({ schema, typeName: ZodFirstPartyTypeKind.ZodEffects, effect, ...processCreateParams(params) }); ZodEffects.createWithPreprocess = (preprocess, schema, params) => new ZodEffects({ schema, effect: { type: "preprocess", transform: preprocess }, typeName: ZodFirstPartyTypeKind.ZodEffects, ...processCreateParams(params) }); var ZodOptional = class extends ZodType { _parse(input) { return this._getType(input) === ZodParsedType.undefined ? OK(void 0) : this._def.innerType._parse(input); } unwrap() { return this._def.innerType; } }; ZodOptional.create = (type, params) => new ZodOptional({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodOptional, ...processCreateParams(params) }); var ZodNullable = class extends ZodType { _parse(input) { return this._getType(input) === ZodParsedType.null ? OK(null) : this._def.innerType._parse(input); } unwrap() { return this._def.innerType; } }; ZodNullable.create = (type, params) => new ZodNullable({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodNullable, ...processCreateParams(params) }); var ZodDefault = class extends ZodType { _parse(input) { let { ctx } = this._processInputParams(input), data = ctx.data; return ctx.parsedType === ZodParsedType.undefined && (data = this._def.defaultValue()), this._def.innerType._parse({ data, path: ctx.path, parent: ctx }); } removeDefault() { return this._def.innerType; } }; ZodDefault.create = (type, params) => new ZodDefault({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodDefault, defaultValue: typeof params.default == "function" ? params.default : () => params.default, ...processCreateParams(params) }); var ZodCatch = class extends ZodType { _parse(input) { let { ctx } = this._processInputParams(input), newCtx = { ...ctx, common: { ...ctx.common, issues: [] } }, result = this._def.innerType._parse({ data: newCtx.data, path: newCtx.path, parent: { ...newCtx } }); return isAsync(result) ? result.then((result2) => ({ status: "valid", value: result2.status === "valid" ? result2.value : this._def.catchValue({ get error() { return new ZodError(newCtx.common.issues); }, input: newCtx.data }) })) : { status: "valid", value: result.status === "valid" ? result.value : this._def.catchValue({ get error() { return new ZodError(newCtx.common.issues); }, input: newCtx.data }) }; } removeCatch() { return this._def.innerType; } }; ZodCatch.create = (type, params) => new ZodCatch({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodCatch, catchValue: typeof params.catch == "function" ? params.catch : () => params.catch, ...processCreateParams(params) }); var ZodNaN = class extends ZodType { _parse(input) { if (this._getType(input) !== ZodParsedType.nan) { let ctx = this._getOrReturnCtx(input); return addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.nan, received: ctx.parsedType }), INVALID; } return { status: "valid", value: input.data }; } }; ZodNaN.create = (params) => new ZodNaN({ typeName: ZodFirstPartyTypeKind.ZodNaN, ...processCreateParams(params) }); var BRAND = Symbol("zod_brand"), ZodBranded = class extends ZodType { _parse(input) { let { ctx } = this._processInputParams(input), data = ctx.data; return this._def.type._parse({ data, path: ctx.path, parent: ctx }); } unwrap() { return this._def.type; } }, ZodPipeline = class _ZodPipeline extends ZodType { _parse(input) { let { status, ctx } = this._processInputParams(input); if (ctx.common.async) return (async () => { let inResult = await this._def.in._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }); return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), DIRTY(inResult.value)) : this._def.out._parseAsync({ data: inResult.value, path: ctx.path, parent: ctx }); })(); { let inResult = this._def.in._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), { status: "dirty", value: inResult.value }) : this._def.out._parseSync({ data: inResult.value, path: ctx.path, parent: ctx }); } } static create(a2, b4) { return new _ZodPipeline({ in: a2, out: b4, typeName: ZodFirstPartyTypeKind.ZodPipeline }); } }, ZodReadonly = class extends ZodType { _parse(input) { let result = this._def.innerType._parse(input), freeze = (data) => (isValid(data) && (data.value = Object.freeze(data.value)), data); return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result); } unwrap() { return this._def.innerType; } }; ZodReadonly.create = (type, params) => new ZodReadonly({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodReadonly, ...processCreateParams(params) }); function cleanParams(params, data) { let p3 = typeof params == "function" ? params(data) : typeof params == "string" ? { message: params } : params; return typeof p3 == "string" ? { message: p3 } : p3; } function custom(check, _params = {}, fatal) { return check ? ZodAny.create().superRefine((data, ctx) => { let r2 = check(data); if (r2 instanceof Promise) return r2.then((r3) => { if (!r3) { let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0; ctx.addIssue({ code: "custom", ...params, fatal: _fatal }); } }); if (!r2) { let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0; ctx.addIssue({ code: "custom", ...params, fatal: _fatal }); } }) : ZodAny.create(); } var late = { object: ZodObject.lazycreate }, ZodFirstPartyTypeKind; (function(ZodFirstPartyTypeKind2) { ZodFirstPartyTypeKind2.ZodString = "ZodString", ZodFirstPartyTypeKind2.ZodNumber = "ZodNumber", ZodFirstPartyTypeKind2.ZodNaN = "ZodNaN", ZodFirstPartyTypeKind2.ZodBigInt = "ZodBigInt", ZodFirstPartyTypeKind2.ZodBoolean = "ZodBoolean", ZodFirstPartyTypeKind2.ZodDate = "ZodDate", ZodFirstPartyTypeKind2.ZodSymbol = "ZodSymbol", ZodFirstPartyTypeKind2.ZodUndefined = "ZodUndefined", ZodFirstPartyTypeKind2.ZodNull = "ZodNull", ZodFirstPartyTypeKind2.ZodAny = "ZodAny", ZodFirstPartyTypeKind2.ZodUnknown = "ZodUnknown", ZodFirstPartyTypeKind2.ZodNever = "ZodNever", ZodFirstPartyTypeKind2.ZodVoid = "ZodVoid", ZodFirstPartyTypeKind2.ZodArray = "ZodArray", ZodFirstPartyTypeKind2.ZodObject = "ZodObject", ZodFirstPartyTypeKind2.ZodUnion = "ZodUnion", ZodFirstPartyTypeKind2.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodFirstPartyTypeKind2.ZodIntersection = "ZodIntersection", ZodFirstPartyTypeKind2.ZodTuple = "ZodTuple", ZodFirstPartyTypeKind2.ZodRecord = "ZodRecord", ZodFirstPartyTypeKind2.ZodMap = "ZodMap", ZodFirstPartyTypeKind2.ZodSet = "ZodSet", ZodFirstPartyTypeKind2.ZodFunction = "ZodFunction", ZodFirstPartyTypeKind2.ZodLazy = "ZodLazy", ZodFirstPartyTypeKind2.ZodLiteral = "ZodLiteral", ZodFirstPartyTypeKind2.ZodEnum = "ZodEnum", ZodFirstPartyTypeKind2.ZodEffects = "ZodEffects", ZodFirstPartyTypeKind2.ZodNativeEnum = "ZodNativeEnum", ZodFirstPartyTypeKind2.ZodOptional = "ZodOptional", ZodFirstPartyTypeKind2.ZodNullable = "ZodNullable", ZodFirstPartyTypeKind2.ZodDefault = "ZodDefault", ZodFirstPartyTypeKind2.ZodCatch = "ZodCatch", ZodFirstPartyTypeKind2.ZodPromise = "ZodPromise", ZodFirstPartyTypeKind2.ZodBranded = "ZodBranded", ZodFirstPartyTypeKind2.ZodPipeline = "ZodPipeline", ZodFirstPartyTypeKind2.ZodReadonly = "ZodReadonly"; })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); var instanceOfType = (cls, params = { message: `Input not instance of ${cls.name}` }) => custom((data) => data instanceof cls, params), stringType = ZodString.create, numberType = ZodNumber.create, nanType = ZodNaN.create, bigIntType = ZodBigInt.create, booleanType = ZodBoolean.create, dateType = ZodDate.create, symbolType = ZodSymbol.create, undefinedType = ZodUndefined.create, nullType = ZodNull.create, anyType = ZodAny.create, unknownType = ZodUnknown.create, neverType = ZodNever.create, voidType = ZodVoid.create, arrayType = ZodArray.create, objectType = ZodObject.create, strictObjectType = ZodObject.strictCreate, unionType = ZodUnion.create, discriminatedUnionType = ZodDiscriminatedUnion.create, intersectionType = ZodIntersection.create, tupleType = ZodTuple.create, recordType = ZodRecord.create, mapType = ZodMap.create, setType = ZodSet.create, functionType = ZodFunction.create, lazyType = ZodLazy.create, literalType = ZodLiteral.create, enumType = ZodEnum.create, nativeEnumType = ZodNativeEnum.create, promiseType = ZodPromise.create, effectsType = ZodEffects.create, optionalType = ZodOptional.create, nullableType = ZodNullable.create, preprocessType = ZodEffects.createWithPreprocess, pipelineType = ZodPipeline.create, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce = { string: ((arg) => ZodString.create({ ...arg, coerce: !0 })), number: ((arg) => ZodNumber.create({ ...arg, coerce: !0 })), boolean: ((arg) => ZodBoolean.create({ ...arg, coerce: !0 })), bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: !0 })), date: ((arg) => ZodDate.create({ ...arg, coerce: !0 })) }; var NEVER = INVALID; // src/config/schema.ts var serverConfigSchema = external_exports.object({ id: external_exports.string().min(1), label: external_exports.string().min(1), group: external_exports.string().trim().optional(), host: external_exports.string().min(1), port: external_exports.number().int().min(1).max(65535), username: external_exports.string().min(1), authType: external_exports.enum(["password", "privateKey", "agent"]), privateKeyPath: external_exports.string().min(1).optional(), jumpHostId: external_exports.string().min(1).optional(), agentCommandTrust: external_exports.enum(["none", "policy", "full"]).optional(), agentCommandAutoApprove: external_exports.boolean().optional(), backgroundConnectionAllowed: external_exports.boolean().optional(), keepAliveInterval: external_exports.number().int().min(0), encoding: external_exports.enum(["utf-8", "gbk", "big5"]).default("utf-8"), createdAt: external_exports.number().int().nonnegative(), updatedAt: external_exports.number().int().nonnegative() }).strict().superRefine((value, ctx) => { value.authType === "privateKey" && !value.privateKeyPath && ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["privateKeyPath"], message: "privateKeyPath is required for privateKey auth" }); }), serverConfigListSchema = external_exports.array(serverConfigSchema), SERVER_CONFIG_KEYS = [ "id", "label", "group", "host", "port", "username", "authType", "privateKeyPath", "jumpHostId", "agentCommandTrust", "agentCommandAutoApprove", "backgroundConnectionAllowed", "keepAliveInterval", "encoding", "createdAt", "updatedAt" ], KNOWN_ENCODINGS = /* @__PURE__ */ new Set(["utf-8", "gbk", "big5"]), DEFAULT_KEEP_ALIVE_INTERVAL = 30; function migrateServerConfig(value) { if (typeof value != "object" || value === null || Array.isArray(value)) return; let record = value, candidate = {}; for (let key of SERVER_CONFIG_KEYS) record[key] !== void 0 && (candidate[key] = record[key]); KNOWN_ENCODINGS.has(candidate.encoding) || delete candidate.encoding, candidate.keepAliveInterval === void 0 && (candidate.keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL); let parsed = serverConfigSchema.safeParse(candidate); return parsed.success ? parsed.data : void 0; } function parseServerConfig(value) { return serverConfigSchema.parse(value); } function parseServerConfigList(value) { return Array.isArray(value) ? value.map((entry) => migrateServerConfig(entry)).filter((entry) => entry !== void 0) : []; } // src/assets/AssetPackage.ts var ASSET_PACKAGE_FORMAT = "at-terminal-assets", ASSET_PACKAGE_VERSION = 1, ASSET_PACKAGE_EXTENSION = ".at-terminal-assets", ASSET_PACKAGE_UNREADABLE_MESSAGE = "Asset package payload is from an unsupported or older format.", base64Schema = external_exports.string().min(1), assetPackageEnvelopeSchema = external_exports.object({ format: external_exports.literal(ASSET_PACKAGE_FORMAT), version: external_exports.literal(ASSET_PACKAGE_VERSION), kdf: external_exports.literal("scrypt"), cipher: external_exports.literal("aes-256-gcm"), salt: base64Schema, iv: base64Schema, authTag: base64Schema, ciphertext: base64Schema }).strict(), assetPackagePayloadSchema = external_exports.object({ format: external_exports.literal(ASSET_PACKAGE_FORMAT), version: external_exports.literal(ASSET_PACKAGE_VERSION), createdAt: external_exports.number().int().nonnegative(), source: external_exports.object({ extensionName: external_exports.string().min(1), extensionVersion: external_exports.string().min(1) }).strict(), options: external_exports.object({ includesPasswords: external_exports.boolean(), includesPrivateKeys: external_exports.boolean(), includesHostTrust: external_exports.literal(!1) }).strict(), servers: external_exports.array(serverConfigSchema), passwords: external_exports.record(external_exports.string().min(1), external_exports.string()), privateKeys: external_exports.array( external_exports.object({ serverId: external_exports.string().min(1), originalBasename: external_exports.string().min(1), contentBase64: base64Schema }).strict() ), omissions: external_exports.array( external_exports.object({ serverId: external_exports.string().min(1), kind: external_exports.enum(["password", "privateKey"]), reason: external_exports.string().min(1) }).strict() ) }).strict(); function parseAssetPackageEnvelope(value) { return assetPackageEnvelopeSchema.parse(value); } function parseAssetPackagePayload(value) { return assetPackagePayloadSchema.parse(migratePayloadServers(value)); } function migratePayloadServers(value) { if (typeof value != "object" || value === null || Array.isArray(value)) return value; let record = value; return Array.isArray(record.servers) ? { ...record, servers: record.servers.map((server) => migrateServerConfig(server)).filter((server) => server !== void 0) } : value; } // src/assets/AssetCrypto.ts var scrypt = promisify(scryptCallback), KEY_BYTES = 32, SALT_BYTES = 16, IV_BYTES = 12; async function encryptAssetPayload(payload, packagePassword) { let parsed = parseAssetPackagePayload(payload), salt = randomBytes(SALT_BYTES), iv = randomBytes(IV_BYTES), key = await scrypt(packagePassword, salt, KEY_BYTES), cipher = createCipheriv("aes-256-gcm", key, iv), ciphertext = Buffer.concat([cipher.update(JSON.stringify(parsed), "utf8"), cipher.final()]), authTag = cipher.getAuthTag(); return { format: ASSET_PACKAGE_FORMAT, version: ASSET_PACKAGE_VERSION, kdf: "scrypt", cipher: "aes-256-gcm", salt: salt.toString("base64"), iv: iv.toString("base64"), authTag: authTag.toString("base64"), ciphertext: ciphertext.toString("base64") }; } async function decryptAssetPayload(envelope, packagePassword) { let parsedEnvelope = parseAssetPackageEnvelope(envelope), plaintext; try { let salt = Buffer.from(parsedEnvelope.salt, "base64"), iv = Buffer.from(parsedEnvelope.iv, "base64"), authTag = Buffer.from(parsedEnvelope.authTag, "base64"), ciphertext = Buffer.from(parsedEnvelope.ciphertext, "base64"), key = await scrypt(packagePassword, salt, KEY_BYTES), decipher = createDecipheriv("aes-256-gcm", key, iv); decipher.setAuthTag(authTag), plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8"); } catch { throw new Error("Invalid package password or corrupted asset package."); } try { return parseAssetPackagePayload(JSON.parse(plaintext)); } catch { throw new Error(ASSET_PACKAGE_UNREADABLE_MESSAGE); } } // src/assets/AssetExportService.ts import { readFile } from "node:fs/promises"; import { basename } from "node:path"; async function createAssetExportPayload(options) { let passwords = {}, privateKeys = [], omissions = []; for (let server of options.servers) { if (options.includePasswords && server.authType === "password") { let password = await options.getPassword(server.id); password ? passwords[server.id] = password : omissions.push({ serverId: server.id, kind: "password", reason: "Password was not available in SecretStorage." }); } if (options.includePrivateKeys && server.authType === "privateKey" && server.privateKeyPath) try { let content = await readFile(server.privateKeyPath); privateKeys.push({ serverId: server.id, originalBasename: basename(server.privateKeyPath), contentBase64: content.toString("base64") }); } catch { omissions.push({ serverId: server.id, kind: "privateKey", reason: "Private key file could not be read." }); } } return { format: ASSET_PACKAGE_FORMAT, version: ASSET_PACKAGE_VERSION, createdAt: options.now?.() ?? Date.now(), source: { extensionName: options.extensionName, extensionVersion: options.extensionVersion }, options: { includesPasswords: options.includePasswords, includesPrivateKeys: options.includePrivateKeys, includesHostTrust: !1 }, servers: options.servers, passwords, privateKeys, omissions }; } // src/assets/AssetImportService.ts import { mkdir, writeFile } from "node:fs/promises"; import { join } from "node:path"; async function applyAssetImport(options) { let existing = await options.store.listServers(), summary = { imported: 0, skipped: 0, overwritten: 0, renamed: 0, privateKeysWritten: 0 }, idMap = /* @__PURE__ */ new Map(), privateKeys = new Map(options.payload.privateKeys.map((entry) => [entry.serverId, entry])), planned = []; for (let imported of options.payload.servers) { let conflict = findConflict(imported, existing); if (conflict && options.conflictStrategy === "skip") { summary.skipped += 1, idMap.set(imported.id, conflict.id); continue; } let server = { ...imported }; conflict && options.conflictStrategy === "overwrite" ? (server.id = conflict.id, summary.overwritten += 1) : conflict && options.conflictStrategy === "rename" ? (server = { ...server, id: options.generateId(), label: `${server.label} (imported)` }, summary.renamed += 1) : summary.imported += 1, idMap.set(imported.id, server.id); let keyRecord = privateKeys.get(imported.id); planned.push({ server, password: options.payload.passwords[imported.id], privateKeyContent: keyRecord ? Buffer.from(keyRecord.contentBase64, "base64") : void 0, privateKeyBasename: keyRecord?.originalBasename }); } await mkdir(options.privateKeyDirectory, { recursive: !0 }); for (let item of planned) { let remappedJumpHostId = item.server.jumpHostId ? idMap.get(item.server.jumpHostId) ?? item.server.jumpHostId : void 0, server = { ...item.server, jumpHostId: remappedJumpHostId }; if (item.privateKeyContent && item.privateKeyBasename) { let privateKeyPath = join(options.privateKeyDirectory, safePrivateKeyName(server.id, item.privateKeyBasename)); await writeFile(privateKeyPath, item.privateKeyContent, { mode: 384 }), server = { ...server, privateKeyPath }, summary.privateKeysWritten += 1; } await options.store.saveServer(server, item.password); } return summary; } function findConflict(imported, existing) { return existing.find((server) => server.id === imported.id) ?? existing.find( (server) => normalize(server.label) === normalize(imported.label) && normalize(server.host) === normalize(imported.host) && server.port === imported.port && normalize(server.username) === normalize(imported.username) ); } function normalize(value) { return value.trim().toLowerCase(); } function safePrivateKeyName(serverId, basename3) { let safeBase = basename3.replace(/[^a-zA-Z0-9._-]/g, "_"); return `${serverId}-${safeBase}`; } // src/i18n/t.ts function t(message, args2) { return args2 === void 0 ? platform().localization.t(message) : platform().localization.t(message, args2); } // src/assets/AssetCommands.ts function assetPrivateKeyDirectory(storageDir) { return join2(storageDir, "imported-private-keys"); } // src/config/ConfigManager.ts var SERVERS_KEY = "sshManager.servers", PASSWORD_PREFIX = "sshManager.password.", PASSPHRASE_PREFIX = "sshManager.passphrase.", ConfigManager = class { constructor(globalState, secrets) { this.globalState = globalState; this.secrets = secrets; } async listServers() { let raw = this.globalState.get(SERVERS_KEY, []), servers = parseServerConfigList(raw); return Array.isArray(raw) && servers.length === raw.length && JSON.stringify(servers) !== JSON.stringify(raw) && await this.globalState.update(SERVERS_KEY, servers), servers; } async getServer(id) { return (await this.listServers()).find((server) => server.id === id); } async findJumpHostReferences(id) { return (await this.listServers()).filter((server) => server.jumpHostId === id); } async saveServer(server, password, passphrase) { let parsed = parseServerConfig(server), next = [...(await this.listServers()).filter((entry) => entry.id !== parsed.id), parsed].sort( (a2, b4) => a2.label.localeCompare(b4.label) ); await this.globalState.update(SERVERS_KEY, next), password !== void 0 && await this.secrets.store(this.passwordKey(parsed.id), password), passphrase !== void 0 && await this.secrets.store(this.passphraseKey(parsed.id), passphrase); } async deleteServer(id) { let servers = await this.listServers(); await this.globalState.update( SERVERS_KEY, servers.filter((server) => server.id !== id) ), await this.secrets.delete(this.passwordKey(id)), await this.secrets.delete(this.passphraseKey(id)); } async getPassword(id) { return this.secrets.get(this.passwordKey(id)); } async getPassphrase(id) { return this.secrets.get(this.passphraseKey(id)); } passwordKey(id) { return `${PASSWORD_PREFIX}${id}`; } passphraseKey(id) { return `${PASSPHRASE_PREFIX}${id}`; } }; // src/platform/dsh/clipboard.ts function createDshClipboard({ logger }) { return { async writeText(text) { logger.info("AT Terminal: clipboard write requested \u2014 %s", text); } }; } // src/platform/dsh/config.ts var SUPPORTED_CONFIG_SECTION = "sshManager"; function createDshConfigReader(settings) { return { getSection(section) { if (section !== SUPPORTED_CONFIG_SECTION) throw new Error( `AT Terminal on dsh: unsupported configuration section "${section}". This platform exposes only "${SUPPORTED_CONFIG_SECTION}" (the dsh settings schema is flat and drops the "${SUPPORTED_CONFIG_SECTION}." prefix, so the section name here is not a namespace to look up but the single section that exists).` ); return { /** * `settings[key]` is re-indexed on every call rather than destructured once, * because the record is the seam: the tests (and, in principle, a future * hot-reload) mutate it in place after the reader is built, and the port's * contract is "read the configuration now". */ get(key, defaultValue) { let value = settings[key]?.get(); return value === void 0 ? defaultValue : value; } }; } }; } // src/platform/dsh/host.ts var NOOP_DSH_LOGGER = { info: () => { }, warn: () => { }, error: () => { } }, AT_TERMINAL_CREDENTIAL_NAMESPACE = "AT_TERMINAL"; function isCredentialRefName(value) { return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value); } function serverSecretRefName(kind, serverId) { let prefix = `${AT_TERMINAL_CREDENTIAL_NAMESPACE}_${kind.toUpperCase()}`; if (/^[a-z0-9-]+$/.test(serverId)) { let name2 = `${prefix}_S_${serverId.toUpperCase().replace(/-/g, "_")}`; if (isCredentialRefName(name2)) return name2; } return `${prefix}_X_${Buffer.from(serverId, "utf8").toString("hex").toUpperCase()}`; } // src/platform/dsh/credentials.ts var PASSWORD_PREFIX2 = "sshManager.password.", PASSPHRASE_PREFIX2 = "sshManager.passphrase."; function parseSecretKey(key) { for (let [prefix, kind] of [ [PASSWORD_PREFIX2, "password"], [PASSPHRASE_PREFIX2, "passphrase"] ]) if (key.startsWith(prefix)) return { kind, serverId: key.slice(prefix.length) }; } function refFor(key) { let parsed = parseSecretKey(key); if (parsed === void 0) throw new Error( `AT Terminal on dsh: "${key}" is not a credential key this plugin owns (expected a "${PASSWORD_PREFIX2}" or "${PASSPHRASE_PREFIX2}" prefix)` ); return serverSecretRefName(parsed.kind, parsed.serverId); } function createDshSecretStore({ credentials, logger }) { return { async get(key) { let ref = refFor(key), resolved = await credentials.resolve(ref); if (!(resolved === void 0 || resolved.value.length === 0)) return logger.info('AT Terminal: resolved SSH secret from the "%s" layer.', resolved.source), resolved.value; }, async store(key, value) { let ref = refFor(key); await credentials.set(ref, value); }, async delete(key) { let ref = refFor(key); await credentials.unset(ref); } }; } // src/platform/dsh/environment.ts function createDshHostEnvironment(facts) { return { appName: facts.appName, appRoot: facts.appRoot, uriScheme: facts.uriScheme, // `context.extensionUri.fsPath`'s counterpart: the bundle directory that holds the // packaged webview/hub assets. extensionPath: facts.bundlePath, // `context.globalStorageUri.fsPath`'s counterpart: the `$DSH_HOME`-based directory // that survives a bundle reinstall. storageDir: facts.storageDir, workspaceFolders: void 0 }; } // src/platform/dsh/localization.ts function createDshLocalization(messages = {}) { return { t(message, args2) { let template = Object.prototype.hasOwnProperty.call(messages, message) ? messages[message] : message; return args2 === void 0 ? template : template.replace( /\{(\w+)\}/g, (placeholder, key) => Object.prototype.hasOwnProperty.call(args2, key) ? String(args2[key]) : placeholder ); } }; } // src/core/disposable.ts var noopDisposable = { dispose: () => { } }; function toDisposable(dispose) { return { dispose }; } // src/core/cancellation.ts var cancellationTokenNone = Object.freeze({ isCancellationRequested: !1, onCancellationRequested: () => noopDisposable }); // src/platform/dsh/notifier.ts function logAt(logger, kind, format, ...args2) { kind === "info" ? logger.info(format, ...args2) : kind === "warning" ? logger.warn(format, ...args2) : logger.error(format, ...args2); } function splitTrailing(rest) { let [head, ...tail] = rest, hasOptions = typeof head == "object" && head !== null; return { options: hasOptions ? head : void 0, actions: hasOptions ? tail : rest }; } function createDshNotifier({ logger, respond }) { async function dispatch(kind, message, rest) { let { options, actions } = splitTrailing(rest), suffix = actions.length > 0 ? ` [${actions.join(" | ")}]` : ""; if (logAt(logger, kind, `AT Terminal: %s${suffix}`, message), !(respond === void 0 || actions.length === 0)) return await respond({ kind, message, options, actions }); } return { async showInformationMessage(message, ...rest) { return await dispatch("info", message, rest); }, async showWarningMessage(message, ...rest) { return await dispatch("warning", message, rest); }, async showErrorMessage(message, ...rest) { return await dispatch("error", message, rest); }, async withProgress(options, task) { return logger.info("AT Terminal: progress \u2014 %s", options.title ?? "(untitled)"), await task({ report(value) { value.message !== void 0 ? logger.info("AT Terminal: progress \u2014 %s", value.message) : value.increment !== void 0 ? logger.info("AT Terminal: progress \u2014 +%s", value.increment) : logger.info("AT Terminal: progress \u2014 tick"); } }, cancellationTokenNone); } }; } // src/platform/dsh/prompter.ts function createDshPrompter({ logger, respond }) { async function showQuickPick(items, options, _token) { let multi = options?.canPickMany === !0; logger.info( "AT Terminal: quick pick requested (%s) \u2014 %s", options?.title ?? "(untitled)", items.join(" | ") ); let answer = await respond?.quickPick?.({ items, options }, multi); if (answer !== void 0) return multi ? Array.isArray(answer) ? answer : [answer] : Array.isArray(answer) ? answer[0] : answer; } return { showQuickPick, async showInputBox(options, _token) { return logger.info("AT Terminal: input requested \u2014 %s", options?.prompt ?? options?.title ?? "(untitled)"), await respond?.inputBox?.({ options }); }, async showOpenDialog(options) { return logger.info("AT Terminal: open dialog requested \u2014 %s", options.title ?? "(untitled)"), await respond?.openDialog?.({ options }); }, async showSaveDialog(options) { return logger.info("AT Terminal: save dialog requested \u2014 %s", options.title ?? "(untitled)"), await respond?.saveDialog?.({ options }); } }; } // src/platform/dsh/state.ts var AT_TERMINAL_STATE_DOMAIN = "at_terminal_state", AT_TERMINAL_STATE_TABLE = "kv", AT_TERMINAL_STATE_VERSION = 1; function parseJsonRecord(value) { if (value === void 0) throw new TypeError( "AT Terminal: a state record cannot be undefined \u2014 call update(key, undefined) to delete it" ); let text; try { text = JSON.stringify(value); } catch (error) { throw new TypeError(`AT Terminal: a state record must be JSON-serializable (${String(error)})`); } if (text === void 0) throw new TypeError("AT Terminal: a state record must be JSON-serializable (JSON.stringify produced no text)"); return JSON.parse(text); } function createStateDomainSpec() { return { name: AT_TERMINAL_STATE_DOMAIN, version: AT_TERMINAL_STATE_VERSION, tables: { [AT_TERMINAL_STATE_TABLE]: { valueSchema: { parse: parseJsonRecord } } } }; } async function openDshStateStore({ storageDomain, logger = NOOP_DSH_LOGGER }) { let domain = await storageDomain.open(createStateDomainSpec()); if (domain.name !== AT_TERMINAL_STATE_DOMAIN) throw await domain.close(), new Error( `AT Terminal: storageDomain.open() returned domain "${domain.name}" instead of "${AT_TERMINAL_STATE_DOMAIN}"` ); let table = domain.table(AT_TERMINAL_STATE_TABLE); return logger.info('AT Terminal: state domain "%s" opened.', AT_TERMINAL_STATE_DOMAIN), { state: { get(key, defaultValue) { let stored = table.get(key); return stored === void 0 ? defaultValue : stored; }, async update(key, value) { if (value === void 0) { await table.delete(key); return; } await table.put(key, parseJsonRecord(value)); } }, close: () => domain.close() }; } // src/utils/notifications.ts var TIMED_NOTIFICATION_MS = 3e3, FAILED_NOTIFICATION_MS = 8e3; function showTimedNotification(message, kind = "info", durationMs = TIMED_NOTIFICATION_MS) { let icon = kind === "error" ? "$(error)" : kind === "warning" ? "$(warning)" : "$(info)"; try { platform().notifier.withProgress( { location: "notification", title: `${icon} ${message}`, cancellable: !1 }, async () => { await delay(durationMs); } ).then(void 0, () => { }); } catch { } } function delay(durationMs) { return new Promise((resolve) => setTimeout(resolve, durationMs)); } // src/platform/dsh/transfers.ts function createDshTransferReporter(notifier) { return { async withProgress(label, job) { return await notifier.withProgress( // `cancellable: false` mirrors the VS Code reporter: an SFTP byte transfer is not // interrupted from the progress surface, so offering a cancel affordance that the // adapter cannot honour would be a lie on either host. { location: "notification", title: label, cancellable: !1 }, async (progress) => await job({ report: ({ transferredBytes, totalBytes }) => { progress.report({ message: `${transferredBytes} / ${totalBytes}` }); } }) ); }, async notifySuccess(message) { showTimedNotification(message, "info", TIMED_NOTIFICATION_MS); }, async notifyFailure(message) { showTimedNotification(message, "error", FAILED_NOTIFICATION_MS); } }; } // src/platform/dsh/uris.ts import { join as joinFsPath } from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; var DshUri = class { constructor(scheme, fsPath, authority, query, fragment) { this.scheme = scheme; this.fsPath = fsPath; this.authority = authority; this.query = query; this.fragment = fragment; } /** * `file:` URIs go through `pathToFileURL` so the result is a URL a browser or an * `import()` can actually consume: it percent-encodes what a raw * `file://${fsPath}` concatenation would corrupt (spaces, `#`, `?`, non-ASCII) and * supplies the third slash for an absolute POSIX path. A non-`file` scheme has no * such encoder, so it is reassembled from its parts. * * Query and fragment are appended for both. That is not decoration: the SFTP * preview encodes the *local* backing file into `query` and keys its document map * by `uri.toString()` (`src/sftp/SftpPreview.ts:12-20`), so dropping the query here * would make two previews collide on one map entry. */ toString() { let result = this.scheme === "file" ? pathToFileURL(this.fsPath).toString() : `${this.scheme}:${this.authority === void 0 ? "" : `//${this.authority}`}${this.fsPath}`; return this.query !== void 0 && (result += `?${this.query}`), this.fragment !== void 0 && (result += `#${this.fragment}`), result; } }, SCHEME_PREFIX = /^([A-Za-z][A-Za-z0-9+.-]*):/; function splitNonFileParts(rest) { let hashIndex = rest.indexOf("#"), fragment = hashIndex < 0 ? void 0 : rest.slice(hashIndex + 1), withoutFragment = hashIndex < 0 ? rest : rest.slice(0, hashIndex), queryIndex = withoutFragment.indexOf("?"), query = queryIndex < 0 ? void 0 : withoutFragment.slice(queryIndex + 1), path = queryIndex < 0 ? withoutFragment : withoutFragment.slice(0, queryIndex), authority; if (path.startsWith("//")) { let slashIndex = path.indexOf("/", 2); authority = slashIndex < 0 ? path.slice(2) : path.slice(2, slashIndex), path = slashIndex < 0 ? "" : path.slice(slashIndex); } return { path, authority, query, fragment }; } function createDshUriService() { return { /** `Uri.file`: a local filesystem path in the `file` scheme, never a remote one. */ file: (fsPath) => new DshUri("file", fsPath), joinPath: (base, ...segments) => segments.length === 0 ? base : new DshUri(base.scheme, joinFsPath(base.fsPath, ...segments)), parse: (value) => { let scheme = SCHEME_PREFIX.exec(value); if (scheme === null) return new DshUri("file", value); let rest = value.slice(scheme[0].length); if (scheme[1] === "file") try { return new DshUri("file", fileURLToPath(value)); } catch { return new DshUri("file", rest); } let parts2 = splitNonFileParts(rest); return new DshUri(scheme[1], parts2.path, parts2.authority, parts2.query, parts2.fragment); }, /** * `authority` / `query` / `fragment` are part of the port's `UriComponents`, so * they are carried instead of dropped: silently discarding a field the caller * filled in is the kind of "looks fine, is wrong" behaviour this codebase bans. * They are not exposed on `UriLike`, only folded into `toString()`. */ from: (components) => new DshUri( components.scheme, components.path ?? "", components.authority, components.query, components.fragment ), /** * A genuine narrowing: only objects this module built are accepted. The check is * deliberately *not* structural (`'scheme' in value && 'fsPath' in value`), * because the port's other consumer of it is `SftpEditSessionManager`'s * "is this a URI I own" test, and a random `{scheme, fsPath}` bag from somewhere * else is not one. */ isUri: (value) => value instanceof DshUri }; } // src/platform/dsh/index.ts async function createDshPlatform(deps) { let logger = deps.logger ?? NOOP_DSH_LOGGER, state = await openDshStateStore({ storageDomain: deps.storageDomain, logger }), notifier = createDshNotifier({ logger }), platform2 = { notifier, prompter: createDshPrompter({ logger }), uris: createDshUriService(), config: createDshConfigReader(deps.settings), secrets: createDshSecretStore({ credentials: deps.credentials, logger }), state: state.state, transfers: createDshTransferReporter(notifier), keyboardInteractive: async () => { }, localization: createDshLocalization(deps.messages ?? {}), clipboard: createDshClipboard({ logger }), environment: createDshHostEnvironment(deps.facts) }; return setPlatform(platform2), { platform: platform2, async close() { clearPlatform(platform2), await state.close(); } }; } // src/ssh/HostKeyStore.ts var HOST_KEYS_KEY = "sshManager.trustedHostKeys"; function formatFingerprint(fingerprint) { let trimmed = fingerprint.trim(); return /^(sha256|md5):/i.test(trimmed) ? trimmed : `SHA256:${trimmed}`; } var HostKeyStore = class { constructor(globalState) { this.globalState = globalState; } async check(host, port, fingerprint) { let existing = this.read()[this.key(host, port)]; return existing ? existing.fingerprint === fingerprint ? "trusted" : "changed" : "unknown"; } async trust(host, port, fingerprint, algorithm) { let keys = this.read(); keys[this.key(host, port)] = { host, port, fingerprint, algorithm, trustedAt: Date.now() }, await this.globalState.update(HOST_KEYS_KEY, keys); } getTrusted(host, port) { return this.read()[this.key(host, port)]; } async forget(host, port) { let keys = this.read(); delete keys[this.key(host, port)], await this.globalState.update(HOST_KEYS_KEY, keys); } /** * One-line human summary of the trusted key for a host, or undefined when none is * stored. Command handlers (View fingerprint / Forget) render this directly. */ describe(host, port) { let entry = this.getTrusted(host, port); if (!entry) return; let algorithm = entry.algorithm ? ` (${entry.algorithm})` : ""; return `${entry.host}:${entry.port} ${formatFingerprint(entry.fingerprint)}${algorithm}, trusted ${new Date(entry.trustedAt).toISOString()}`; } read() { return this.globalState.get(HOST_KEYS_KEY, {}); } key(host, port) { return `${host}:${port}`; } }; // src/sftp/RemotePath.ts function joinRemotePath(parent, child) { return `${parent === "/" ? "" : parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}` || "/"; } function dirname(path) { let normalized = path.replace(/\/+$/, ""), index = normalized.lastIndexOf("/"); return index <= 0 ? "/" : normalized.slice(0, index); } function quotePosixShellPath(path) { return `'${path.replaceAll("'", `'"'"'`)}'`; } function safePreviewName(remotePath) { return (remotePath.split("/").filter(Boolean).pop() || "remote-file").replace(/[<>:"\\|?*\x00-\x1f]/g, "_"); } // src/sftp/SftpErrors.ts var SftpConflictError = class extends Error { constructor(path) { super(t("Remote path already exists: {path}", { path })); this.path = path; } name = "SftpConflictError"; }; function isSftpConflictError(error) { return error instanceof SftpConflictError ? !0 : typeof error == "object" && error !== null && error.name === "SftpConflictError" && typeof error.path == "string"; } // src/sftp/TransferService.ts var noopProgress = { report: () => { } }, TransferService = class { constructor(reporter) { this.reporter = reporter; } async requireConnected(connected) { if (!connected) throw new Error("No connected SSH terminal is active."); } run(label, job, options) { return this.runWithReporter(label, job, options?.notification ?? "full"); } async runWithReporter(label, job, notification) { try { let result = this.reporter && notification === "full" ? await this.reporter.withProgress(label, job) : await job(noopProgress); return notification === "full" && this.reporter?.notifySuccess(`${label} completed.`), result; } catch (error) { throw isSftpConflictError(error) || this.reporter?.notifyFailure(`${label} failed.`), error; } } }; // src/sftp/SftpManager.ts var LISTING_CACHE_TTL_MS = 2e4, LISTING_CACHE_KEY_SEPARATOR = "\0", QUIET = { notification: "quiet" }; function listingCacheKey(terminalId, path) { return `${terminalId}${LISTING_CACHE_KEY_SEPARATOR}${path}`; } var SftpManager = class { constructor(options) { this.options = options; this.transfers = new TransferService(options.reporter); } activeTerminalId; connections = /* @__PURE__ */ new Map(); transfers; /** Keyed by `terminalId\u0000path`; see {@link LISTING_CACHE_TTL_MS}. */ listingCache = /* @__PURE__ */ new Map(); setTerminalContext(context) { if (!context) { this.activeTerminalId = void 0; return; } this.syncTerminalContext(context), this.activeTerminalId = context.terminalId; } syncTerminalContext(context) { let existing = this.connections.get(context.terminalId); if (!existing) { this.connections.set(context.terminalId, this.createManagedConnection(context)), this.adoptAsActiveIfViewEmpty(context); return; } let serverChanged = existing.context.server.id !== context.server.id, reconnected = !existing.context.connected && context.connected, disconnected = existing.context.connected && !context.connected; (serverChanged || disconnected) && this.disposeManagedConnection(existing), existing.context = context, (serverChanged || reconnected) && (existing.rootPath = void 0, existing.snapshot = void 0, this.clearListingsForTerminal(context.terminalId)), context.connected || this.disposeManagedConnection(existing), this.adoptAsActiveIfViewEmpty(context); } /** * A connected context that only ever reaches SFTP through syncTerminalContext (the * onDidChangeContext path) must still become visible: with activeTerminalId unset the * view renders "No active SSH terminal" forever even though a terminal is live. * Adoption is limited to the cases where the view has nothing to show, so an explicit * setTerminalContext choice is never overridden by a background context update. */ adoptAsActiveIfViewEmpty(context) { context.connected && (!this.activeTerminalId || this.getState().kind === "none") && (this.activeTerminalId = context.terminalId); } removeTerminalContext(terminalId) { let connection = this.connections.get(terminalId); connection && (this.disposeManagedConnection(connection), this.connections.delete(terminalId)), this.activeTerminalId === terminalId && (this.activeTerminalId = void 0); } dispose() { for (let connection of this.connections.values()) this.disposeManagedConnection(connection); this.connections.clear(), this.listingCache.clear(), this.activeTerminalId = void 0; } getState() { let connection = this.getActiveConnection(); return connection ? connection.context.connected ? { kind: "active", rootPath: connection.rootPath ?? "." } : connection.snapshot ? { kind: "disconnected", rootPath: connection.snapshot.rootPath, entries: connection.snapshot.entries } : { kind: "none" } : { kind: "none" }; } getActiveServerId() { let connection = this.getActiveConnection(); return connection?.context.connected ? connection.context.server.id : void 0; } /** * Snapshot of what the SFTP tree currently renders. `extension.ts` compares the descriptor * before and after an active-context change with `shouldRefreshOnContextChange` to skip * redundant full-tree refreshes when the user switches back to the same terminal. */ getActiveViewDescriptor() { let connection = this.getActiveConnection(); if (connection) return { terminalId: connection.context.terminalId, rootPath: connection.rootPath, connected: connection.context.connected }; } async ensureRoot() { let connection = this.requireConnection(), session = await this.ensureSession(connection); return connection.rootPath = await session.realpath("."), connection.rootPath; } async listDirectory(path) { let connection = this.requireConnection(), root = connection.rootPath ?? await this.ensureRoot(), targetPath = path ?? root, cacheKey = listingCacheKey(connection.context.terminalId, targetPath), cached3 = this.listingCache.get(cacheKey); if (cached3 && cached3.expiresAt > Date.now()) return targetPath === root && this.setSnapshot(root, cached3.entries), cached3.entries; this.listingCache.delete(cacheKey); let entries = await (await this.ensureSession(connection)).listDirectory(targetPath); return this.listingCache.set(cacheKey, { entries, expiresAt: Date.now() + LISTING_CACHE_TTL_MS }), targetPath === root && this.setSnapshot(root, entries), entries; } async changeDirectory(path) { let connection = this.requireConnection(), session = await this.ensureSession(connection); return connection.rootPath = await session.realpath(path), connection.rootPath; } async changeToParentDirectory() { let currentRoot = this.requireConnection().rootPath ?? await this.ensureRoot(); return this.changeDirectory(dirname(currentRoot)); } async mkdir(path) { try { await this.runConnected("new folder", async (session) => session.mkdir(path), void 0, QUIET); } finally { this.invalidateListings(path); } } async rename(oldPath, newPath) { try { await this.runConnected("rename", async (session) => session.rename(oldPath, newPath), void 0, QUIET); } finally { this.invalidateListings(oldPath), this.invalidateListings(newPath); } } async deleteEntry(entry) { try { await this.runConnected( "delete", async (session) => { if (entry.type === "directory") { await session.deleteDirectory(entry.path); return; } await session.deleteFile(entry.path); }, void 0, QUIET ); } finally { this.invalidateListings(entry.path); } } /** * Dry run for a recursive directory delete: how many entries would be removed (the * directory itself included), so the UI can confirm with a concrete number. */ async countDeletableEntries(path, serverId) { let connection = this.requireConnection(serverId); return await (await this.ensureSession(connection)).countDeletableEntries(path); } async uploadFile(localPath, remotePath, serverId, options) { try { await this.runConnected( t("Upload {path}", { path: remotePath }), async (session, progress) => session.uploadFile(localPath, remotePath, progress, options), serverId ); } finally { this.invalidateListings(remotePath); } } async downloadFile(remotePath, localPath, serverId) { await this.runConnected( t("Download {path}", { path: remotePath }), async (session, progress) => session.downloadFile(remotePath, localPath, progress), serverId ); } async uploadDirectory(localDir, remoteDir, serverId, options) { try { await this.runConnected( t("Upload {path}", { path: remoteDir }), async (session, progress) => session.uploadDirectory(localDir, remoteDir, progress, options), serverId ); } finally { this.invalidateListings(remoteDir); } } async downloadDirectory(remoteDir, localDir, serverId) { await this.runConnected( t("Download {path}", { path: remoteDir }), async (session, progress) => session.downloadDirectory(remoteDir, localDir, progress), serverId ); } async readFile(remotePath, maxBytes, serverId, offset = 0) { let connection = this.requireConnection(serverId); return await (await this.ensureSession(connection)).readFile(remotePath, maxBytes, offset); } /** * Replace one remote file's **contents**. * * The peer of {@link readFile}, and the only mutator here that takes bytes rather than a * local path: `uploadFile` streams a file the user already has on disk, while this one * exists for a caller that *holds* the bytes — the dsh panel receives an edit or an * upload through an RPC body, so there is no local path to hand over. Writing the payload * to a temporary file first just to satisfy `uploadFile`'s signature would add a * filesystem side effect and a cleanup path for no gain. * * Invalidated like every other mutator, so the next read of the parent directory reaches * the server instead of the 20-second TTL cache. */ async writeFile(path, content, serverId) { try { await this.runConnected( t("Write {path}", { path }), async (session) => session.writeFile(path, content), serverId, QUIET ); } finally { this.invalidateListings(path); } } async createFile(path) { try { await this.runConnected(t("New file {path}", { path }), async (session) => session.createFile(path), void 0, QUIET); } finally { this.invalidateListings(path); } } async stat(path, serverId) { let connection = this.requireConnection(serverId); return await (await this.ensureSession(connection)).stat(path); } setSnapshot(rootPath, entries) { let connection = this.getActiveConnection(); connection && (connection.snapshot = { rootPath, entries }); } async ensureSession(connection) { let context = connection.context; if (!context.connected) throw new Error(t("No connected SSH terminal is active.")); if (connection.session) return connection.session; if (connection.connectingSessionPromise) return await connection.connectingSessionPromise; let generation = connection.generation, terminalId = context.terminalId, session = this.options.createSession(context); connection.connectingSession = session; let invalidation = this.createConnectionInvalidation(); connection.connectingSessionInvalidation = invalidation; let promise = Promise.race([Promise.resolve().then(() => session.connect()), invalidation.promise]).then(() => { if (generation !== connection.generation || connection.context.terminalId !== terminalId || !connection.context.connected) throw new Error(t("SFTP connection was superseded by another active terminal.")); return connection.session = session, session; }).catch((error) => { throw session.dispose(), connection.session === session && (connection.session = void 0), error; }).finally(() => { connection.connectingSession === session && (connection.connectingSession = void 0), connection.connectingSessionPromise === promise && (connection.connectingSessionPromise = void 0), connection.connectingSessionInvalidation === invalidation && (connection.connectingSessionInvalidation = void 0); }); return connection.connectingSessionPromise = promise, await promise; } createConnectionInvalidation() { let reject; return { promise: new Promise((_5, promiseReject) => { reject = promiseReject; }), reject }; } invalidateConnectingSession(connection) { let invalidation = connection.connectingSessionInvalidation; invalidation && (connection.connectingSessionInvalidation = void 0, invalidation.reject(new Error(t("SFTP connection was superseded by another active terminal.")))); } async runConnected(label, job, serverId, options) { let connection = this.resolveConnection(serverId); return await this.transfers.requireConnected(!!connection?.context.connected), await this.transfers.run( label, async (progress) => await job(await this.ensureSession(connection), progress), options ); } createManagedConnection(context) { return { context, session: void 0, connectingSession: void 0, connectingSessionPromise: void 0, connectingSessionInvalidation: void 0, generation: 0, rootPath: void 0, snapshot: void 0 }; } disposeManagedConnection(connection) { connection.generation++, this.invalidateConnectingSession(connection), connection.connectingSession?.dispose(), connection.session?.dispose(), connection.connectingSession = void 0, connection.connectingSessionPromise = void 0, connection.session = void 0, this.clearListingsForTerminal(connection.context.terminalId); } /** * Drops every cached listing so the next read hits the server. An explicit user * refresh exists to see changes made outside this extension (another SSH session, * cron); serving it from the TTL cache would make the refresh button a no-op for up * to {@link LISTING_CACHE_TTL_MS}. Wire this into the `sshManager.sftp.refresh` * command before the tree refresh. */ invalidateAllListings() { this.listingCache.clear(); } /** * Drops cached listings for the mutated path, its parent (whose listing names it), and any * cached descendants. Keys are matched across every terminal because two terminals on the * same server see the same filesystem; over-invalidating an unrelated terminal only costs a * cache miss. */ invalidateListings(path) { let parent = dirname(path), prefix = path.endsWith("/") ? path : `${path}/`; for (let key of Array.from(this.listingCache.keys())) { let keyPath = key.slice(key.indexOf(LISTING_CACHE_KEY_SEPARATOR) + 1); (keyPath === path || keyPath === parent || keyPath.startsWith(prefix)) && this.listingCache.delete(key); } } clearListingsForTerminal(terminalId) { let prefix = `${terminalId}${LISTING_CACHE_KEY_SEPARATOR}`; for (let key of Array.from(this.listingCache.keys())) key.startsWith(prefix) && this.listingCache.delete(key); } getActiveConnection() { return this.activeTerminalId ? this.connections.get(this.activeTerminalId) : void 0; } requireConnection(serverId) { let connection = this.resolveConnection(serverId); if (!connection?.context.connected) throw new Error(t("No connected SSH terminal is active.")); return connection; } resolveConnection(serverId) { if (!serverId) return this.getActiveConnection(); let activeConnection = this.getActiveConnection(); return activeConnection?.context.connected && activeConnection.context.server.id === serverId ? activeConnection : Array.from(this.connections.values()).reverse().find((connection) => connection.context.connected && connection.context.server.id === serverId); } }; // src/sftp/SftpSession.ts import { randomUUID } from "node:crypto"; import { mkdir as mkdirLocal, readdir as readdirLocal, stat as statLocal } from "node:fs/promises"; import { join as joinLocalPath } from "node:path"; // src/ssh/KeyboardInteractive.ts function attachKeyboardInteractive(client, prompt, onAbort) { client.on?.("keyboard-interactive", (name2, instructions, _lang, prompts, finish) => { let abort2 = (error) => { onAbort(error), client.end(); }; if (!prompt) { abort2( new Error( "The server requested keyboard-interactive authentication, but no interactive prompt is available in this context." ) ); return; } let request = { name: name2, instructions, prompts: prompts.map((entry) => ({ prompt: entry.prompt, echo: !!entry.echo })) }; prompt(request).then( (responses) => { if (!responses) { abort2(new Error("Keyboard-interactive authentication was cancelled.")); return; } finish(responses); }, (error) => { abort2(error instanceof Error ? error : new Error(String(error))); } ); }); } // src/ssh/SshConnectionConfig.ts import { readFile as readFile2 } from "node:fs/promises"; // src/ssh/ssh2Loader.ts var cached; function getSsh2() { return cached ??= import("ssh2"), cached; } process.env.VITEST && getSsh2(); // src/ssh/SshConnectionConfig.ts var WINDOWS_OPENSSH_AGENT_PIPE = "\\\\.\\pipe\\openssh-ssh-agent"; function requireHostKeyVerifier(hostKeyVerifier) { if (!hostKeyVerifier) throw new Error( "A host key verifier is required. Refusing to open an SSH connection that would accept any host key." ); return hostKeyVerifier; } function resolveAgentSocket(platform2 = process.platform, env = process.env) { if (env.SSH_AUTH_SOCK) return env.SSH_AUTH_SOCK; if (platform2 === "win32") return WINDOWS_OPENSSH_AGENT_PIPE; throw new Error( "Missing SSH agent socket. Set the SSH_AUTH_SOCK environment variable or start an SSH agent." ); } async function buildSshConnectConfig(server, passwordProvider, hostKeyVerifier) { let base = { host: server.host, port: server.port, username: server.username, keepaliveInterval: server.keepAliveInterval * 1e3, // 2FA-style prompts arrive as keyboard-interactive requests. Opting in is harmless // for servers that never send one, and every connect path attaches // attachKeyboardInteractive so an unanswerable request fails fast instead of hanging. tryKeyboard: !0, hostHash: "sha256", hostVerifier: createHostVerifier(server, requireHostKeyVerifier(hostKeyVerifier)) }; if (server.authType === "password") { let password = await passwordProvider.getPassword(server.id); if (!password) throw Object.assign( new Error("Missing password. Edit the server configuration and enter a password."), { code: "password-missing" } ); return { ...base, password }; } if (server.authType === "agent") return { ...base, agent: resolveAgentSocket() }; if (!server.privateKeyPath) throw Object.assign(new Error("Missing private key path."), { code: "private-key-path-missing" }); let passphrase = await passwordProvider.getPassphrase?.(server.id); return { ...base, privateKey: await readFile2(server.privateKeyPath, "utf8"), ...passphrase === void 0 ? {} : { passphrase } }; } async function buildSshConnectionHandle(server, provider, hostKeyVerifier, options = {}) { if (requireHostKeyVerifier(hostKeyVerifier), !server.jumpHostId) return { config: await buildSshConnectConfig(server, provider, hostKeyVerifier), dispose: () => { } }; if (!provider.getServer) throw new Error("Jump host lookup is not available."); let jumpHost = await provider.getServer(server.jumpHostId); if (!jumpHost) throw new Error(`Jump host "${server.jumpHostId}" was not found.`); let { Client } = await getSsh2(), jumpClient = new Client(); jumpClient.on("error", () => { }); try { let jumpConfig = await buildSshConnectConfig({ ...jumpHost, jumpHostId: void 0 }, provider, hostKeyVerifier); await new Promise((resolve, reject) => { jumpClient.once("ready", resolve), jumpClient.once("error", reject), attachKeyboardInteractive(jumpClient, options.keyboardInteractivePrompt, reject), jumpClient.connect(jumpConfig); }); let sock = await new Promise((resolve, reject) => { jumpClient.forwardOut("127.0.0.1", 0, server.host, server.port, (error, channel) => { if (error) { reject(error); return; } resolve(channel); }); }); return { config: { ...await buildSshConnectConfig(server, provider, hostKeyVerifier), sock }, dispose: () => { jumpClient.end(); } }; } catch (error) { throw jumpClient.end(), error; } } function createHostVerifier(server, hostKeyVerifier) { return (fingerprint, verify) => { hostKeyVerifier.verify(server.host, server.port, fingerprint).then( verify, () => verify(!1) ); }; } // src/sftp/concurrency.ts async function runWithConcurrency(items, limit, task) { if (items.length === 0) return; let nextIndex = 0, failed = !1, firstError, workers = Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, async () => { for (; !failed && nextIndex < items.length; ) { let index = nextIndex; nextIndex += 1; try { await task(items[index], index); } catch (error) { failed || (failed = !0, firstError = error); } } }); if (await Promise.all(workers), failed) throw firstError; } // src/sftp/SftpSession.ts var SFTP_WRITE_STEP_TIMEOUT_MS = 55e3, REMOTE_TEMP_CLEANUP_TIMEOUT_MS = 2e3, DIRECTORY_TRANSFER_CONCURRENCY = 4, SFTP_CHUNK_BYTES = 32768, SFTP_PIPELINE_DEPTH = 8, SftpSession = class { constructor(server, passwords, hostKeyVerifier, options) { this.server = server; this.passwords = passwords; this.hostKeyVerifier = hostKeyVerifier; this.options = options; } client; sftp; connectionHandle; async connect() { let client = new (await getSsh2()).Client(); this.client = client; let handle2 = await buildSshConnectionHandle(this.server, this.passwords, this.hostKeyVerifier); this.connectionHandle = handle2; try { await new Promise((resolve, reject) => { client.once("ready", resolve), client.once("error", reject), attachKeyboardInteractive(client, void 0, reject), client.connect(handle2.config); }), this.sftp = await new Promise((resolve, reject) => { client.sftp((error, sftp) => { if (error) { reject(error); return; } resolve(sftp); }); }); } catch (error) { throw client.end(), handle2.dispose(), this.connectionHandle = void 0, error; } } isConnected() { return !!(this.client && this.sftp); } async realpath(path = ".") { let sftp = this.requireSftp(); return await new Promise((resolve, reject) => { sftp.realpath(path, (error, resolved) => { if (error) { reject(error); return; } resolve(resolved); }); }); } async listDirectory(path) { let entries = await this.readEntries(path), symlinks = entries.filter((entry) => entry.type === "symlink"); return await runWithConcurrency(symlinks, DIRECTORY_TRANSFER_CONCURRENCY, async (entry) => { let stats = await this.statOrUndefined(entry.path); stats && (entry.targetType = isDirectoryStats(stats) ? "directory" : "file", entry.size = stats.size, entry.modifiedAt = stats.mtime); }), entries; } async readEntries(path) { let sftp = this.requireSftp(); return (await new Promise((resolve, reject) => { sftp.readdir(path, (error, list) => { if (error) { reject(error); return; } resolve(list); }); })).map((row) => ({ name: row.filename, path: appendRemoteChild(path, row.filename), type: entryType(row), size: row.attrs.size, modifiedAt: row.attrs.mtime })); } async stat(path) { let attrs = await this.statRaw(path); return { size: attrs.size, modifiedAt: attrs.mtime, // `Stats.isDirectory()` is ssh2's own predicate. Guarded on the method rather than // called outright because it arrives from the protocol layer: a stub (or a future // ssh2 that renames it) must degrade to "a file", which is the answer a read can // still act on, instead of throwing where a stat was expected to succeed. type: typeof attrs.isDirectory == "function" && attrs.isDirectory() ? "directory" : "file" }; } async statRaw(path) { let sftp = this.requireSftp(); return await new Promise((resolve, reject) => { sftp.stat(path, (error, stat) => { if (error) { reject(error); return; } resolve(stat); }); }); } /** * stat that treats every failure as "not there". Conflict checks must not turn a * permission-restricted stat into a hard error: the subsequent write surfaces the real * problem with a far better message. */ async statOrUndefined(path) { try { return await this.statRaw(path); } catch { return; } } async mkdir(path) { let sftp = this.requireSftp(); await new Promise((resolve, reject) => { sftp.mkdir(path, (error) => error ? reject(error) : resolve()); }); } async createFile(path) { let sftp = this.requireSftp(); try { await createEmptyFile(sftp, path); } catch (error) { if (!isPermissionDeniedError(error)) throw error; await this.writeFile(path, Buffer.alloc(0)); } } async rename(oldPath, newPath) { let sftp = this.requireSftp(); await new Promise((resolve, reject) => { sftp.rename(oldPath, newPath, (error) => error ? reject(error) : resolve()); }); } async deleteFile(path) { let sftp = this.requireSftp(); await new Promise((resolve, reject) => { sftp.unlink(path, (error) => error ? reject(error) : resolve()); }); } /** * Recursive delete: children first (symlinks are unlinked, never followed), then the * directory itself. Non-empty directories therefore no longer fail with a bare rmdir error. */ async deleteDirectory(path) { let entries = await this.readEntries(path); for (let entry of entries) entry.type === "directory" ? await this.deleteDirectory(entry.path) : await this.deleteFile(entry.path); await this.rmdir(path); } /** * Dry run for {@link deleteDirectory}: how many filesystem entries the delete would remove, * including the directory itself (an empty directory counts 1). The UI uses this for the * "N entries" confirmation before a recursive delete. */ async countDeletableEntries(path) { let entries = await this.readEntries(path), count = 1; for (let entry of entries) count += entry.type === "directory" ? await this.countDeletableEntries(entry.path) : 1; return count; } async rmdir(path) { let sftp = this.requireSftp(); await new Promise((resolve, reject) => { sftp.rmdir(path, (error) => error ? reject(error) : resolve()); }); } async uploadFile(localPath, remotePath, progress, options) { let sftp = this.requireSftp(); if (!options?.overwrite && await this.statOrUndefined(remotePath)) throw new SftpConflictError(remotePath); try { await this.fastPut(sftp, localPath, remotePath, progress); } catch (error) { if (!isPermissionDeniedError(error)) throw error; if (!this.options.allowSudoFallback) throw new Error(escalationDisabledMessage("upload", remotePath, error)); await this.uploadFileWithSudo(localPath, remotePath, progress, error); } } /** * Recursively uploads a local directory. Remote directories are created parents-first, then * files transfer with {@link DIRECTORY_TRANSFER_CONCURRENCY} in flight; `progress` receives * byte totals aggregated across the whole tree. Local symlinks and special files are * skipped. Uploading over an existing remote directory raises {@link SftpConflictError} * unless `overwrite` is set; a denied write fails outright (no per-file sudo fallback). */ async uploadDirectory(localDir, remoteDir, progress, options) { let sftp = this.requireSftp(); if (!options?.overwrite && await this.statOrUndefined(remoteDir)) throw new SftpConflictError(remoteDir); let plan = await walkLocalDirectory(localDir); await this.ensureRemoteDirectory(remoteDir); for (let relativeDir of plan.directories) await this.ensureRemoteDirectory(joinRemotePath(remoteDir, relativeDir)); let totalBytes = plan.files.reduce((sum, file) => sum + file.size, 0), aggregate = createAggregatedProgress(totalBytes, progress); await runWithConcurrency(plan.files, DIRECTORY_TRANSFER_CONCURRENCY, async (file) => { let item = aggregate.beginItem(file.size); await this.fastPut(sftp, file.localPath, joinRemotePath(remoteDir, file.relativePath), item.progress), item.complete(); }); } /** * Recursively downloads a remote directory. Files transfer with * {@link DIRECTORY_TRANSFER_CONCURRENCY} in flight and `progress` aggregates bytes across * the tree. Symlinks to files are followed (downloaded as their target); symlinked * directories are not descended into, because a link at an ancestor would recurse forever. */ async downloadDirectory(remoteDir, localDir, progress) { let sftp = this.requireSftp(); await mkdirLocal(localDir, { recursive: !0 }); let files = [], queue = [{ remote: remoteDir, local: localDir }]; for (; queue.length > 0; ) { let current2 = queue.shift(), entries = await this.listDirectory(current2.remote); for (let entry of entries) { let localPath = joinLocalPath(current2.local, entry.name); entry.type === "directory" ? (await mkdirLocal(localPath, { recursive: !0 }), queue.push({ remote: entry.path, local: localPath })) : (entry.type === "file" || entry.targetType === "file") && files.push({ remotePath: entry.path, localPath, size: entry.size ?? 0 }); } } let totalBytes = files.reduce((sum, file) => sum + file.size, 0), aggregate = createAggregatedProgress(totalBytes, progress); await runWithConcurrency(files, DIRECTORY_TRANSFER_CONCURRENCY, async (file) => { let item = aggregate.beginItem(file.size); await this.fastGet(sftp, file.remotePath, file.localPath, item.progress), item.complete(); }); } async ensureRemoteDirectory(path) { try { await this.mkdir(path); } catch (error) { let stats = await this.statOrUndefined(path); if (!stats || !isDirectoryStats(stats)) throw error; } } async fastPut(sftp, localPath, remotePath, progress) { await new Promise((resolve, reject) => { sftp.fastPut( localPath, remotePath, { step: (transferredBytes, _chunkBytes, totalBytes) => progress?.report({ transferredBytes, totalBytes }) }, (error) => error ? reject(error) : resolve() ); }); } async uploadFileWithSudo(localPath, remotePath, progress, permissionError) { let sftp = this.requireSftp(), tempPath = `/tmp/at-terminal-upload-${randomUUID()}-${safePreviewName(remotePath)}`; try { await this.fastPut(sftp, localPath, tempPath, progress), await this.execSudoOverwrite(tempPath, remotePath); } catch (sudoError) { throw await tryRemoveRemoteTempFile(sftp, tempPath), new Error( `SFTP upload to ${remotePath} failed with permission denied, and sudo fallback failed: ${errorMessage(sudoError)}. Original error: ${errorMessage(permissionError)}` ); } } async execSudoOverwrite(tempPath, remotePath) { let client = this.requireClient(), script = `set -e; cat ${quotePosixShellPath(tempPath)} > ${quotePosixShellPath(remotePath)}; rm -f ${quotePosixShellPath(tempPath)}`, command = `sudo -n sh -c ${quotePosixShellPath(script)}`; await withTimeout( new Promise((resolve, reject) => { client.exec(command, (error, stream) => { if (error) { reject(error); return; } collectExecResult(stream, resolve, reject); }); }), SFTP_WRITE_STEP_TIMEOUT_MS, `SFTP sudo fallback timed out after ${SFTP_WRITE_STEP_TIMEOUT_MS}ms while writing ${remotePath}.` ); } async downloadFile(remotePath, localPath, progress) { let sftp = this.requireSftp(); await this.fastGet(sftp, remotePath, localPath, progress); } async fastGet(sftp, remotePath, localPath, progress) { await new Promise((resolve, reject) => { sftp.fastGet( remotePath, localPath, { step: (transferredBytes, _chunkBytes, totalBytes) => progress?.report({ transferredBytes, totalBytes }) }, (error) => error ? reject(error) : resolve() ); }); } /** * Reads up to `maxBytes` starting at `offset`; a negative offset counts back from the end * of the file (tail). Chunks are requested through a sliding window of * {@link SFTP_PIPELINE_DEPTH} in-flight 32KiB reads so throughput is no longer bounded by * one round trip per chunk. */ async readFile(path, maxBytes, offset = 0) { let sftp = this.requireSftp(), handle2 = await new Promise((resolve, reject) => { sftp.open(path, "r", (error, fileHandle) => error ? reject(error) : resolve(fileHandle)); }); try { let size = await fstatSize(sftp, handle2), start2 = offset >= 0 ? offset : Math.max(0, size + offset), end = Math.min(size, start2 + Math.max(0, maxBytes)); if (end <= start2) return Buffer.alloc(0); let result = Buffer.alloc(end - start2), chunks = []; for (let position = start2; position < end; position += SFTP_CHUNK_BYTES) chunks.push({ position, length: Math.min(SFTP_CHUNK_BYTES, end - position) }); let shortReadEnd = end; return await runWithConcurrency(chunks, SFTP_PIPELINE_DEPTH, async (chunk) => { let filled = 0; for (; filled < chunk.length; ) { let bytesRead = await new Promise((resolve, reject) => { sftp.read( handle2, result, chunk.position - start2 + filled, chunk.length - filled, chunk.position + filled, (error, read) => error ? reject(error) : resolve(read) ); }); if (bytesRead <= 0) { shortReadEnd = Math.min(shortReadEnd, chunk.position + filled); return; } filled += bytesRead; } }), shortReadEnd >= end ? result : result.subarray(0, Math.max(0, shortReadEnd - start2)); } finally { await closeRemoteHandle(sftp, handle2).catch(() => { }); } } async writeFile(path, content) { let sftp = this.requireSftp(); try { await writeBuffer(sftp, path, content); } catch (error) { if (!isPermissionDeniedError(error)) throw error; if (!this.options.allowSudoFallback) throw new Error(escalationDisabledMessage("write", path, error)); let tempPath = `/tmp/at-terminal-write-${randomUUID()}-${safePreviewName(path)}`; try { await writeBuffer(sftp, tempPath, content), await this.execSudoOverwrite(tempPath, path); } catch (sudoError) { throw await tryRemoveRemoteTempFile(sftp, tempPath), new Error( `SFTP write to ${path} failed with permission denied, and sudo fallback failed: ${errorMessage(sudoError)}. Original error: ${errorMessage(error)}` ); } } } dispose() { this.sftp = void 0, this.client?.end(), this.connectionHandle?.dispose(), this.client = void 0, this.connectionHandle = void 0; } requireSftp() { if (!this.sftp) throw new Error("SFTP connection is not available."); return this.sftp; } requireClient() { if (!this.client) throw new Error("SSH connection is not available."); return this.client; } }; function collectExecResult(stream, resolve, reject) { let stderrChunks = []; stream.stderr.on("data", (data) => stderrChunks.push(data)), stream.once("error", reject), stream.once("close", (code) => { let stderr = Buffer.concat(stderrChunks).toString("utf8"); if (code && code !== 0) { reject(new Error(stderr.trim() || `sudo fallback exited with code ${code}`)); return; } resolve(stderr); }); } function escalationDisabledMessage(operation, remotePath, error) { return `SFTP ${operation} to ${remotePath} failed with permission denied. Privilege escalation is disabled for agent SFTP sessions. Use the AT Terminal SFTP view if this really has to be written as root. Original error: ${errorMessage(error)}`; } function isPermissionDeniedError(error) { if (!error || typeof error != "object") return !1; let candidate = error; return candidate.code === 3 || typeof candidate.message == "string" && /permission denied|eacces/i.test(candidate.message); } function errorMessage(error) { if (error instanceof Error) return error.message; if (typeof error == "object" && error !== null && "message" in error) { let message = error.message; return typeof message == "string" ? message : String(error); } return String(error); } async function removeRemoteTempFile(sftp, tempPath) { await new Promise((resolve) => { sftp.unlink(tempPath, () => resolve()); }); } async function tryRemoveRemoteTempFile(sftp, tempPath) { await withTimeout( removeRemoteTempFile(sftp, tempPath), REMOTE_TEMP_CLEANUP_TIMEOUT_MS, `Timed out removing remote temp file ${tempPath}.` ).catch(() => { }); } async function withTimeout(promise, timeoutMs, message) { let timer; try { return await Promise.race([ promise, new Promise((_resolve, reject) => { timer = setTimeout(() => reject(new Error(message)), timeoutMs); }) ]); } finally { timer && clearTimeout(timer); } } async function writeBuffer(sftp, path, content) { let handle2 = await withTimeout( new Promise((resolve, reject) => { sftp.open(path, "w", (error, fileHandle) => error ? reject(error) : resolve(fileHandle)); }), SFTP_WRITE_STEP_TIMEOUT_MS, `SFTP open timed out after ${SFTP_WRITE_STEP_TIMEOUT_MS}ms while writing ${path}.` ), failed = !1; try { let chunks = []; for (let position = 0; position < content.byteLength; position += SFTP_CHUNK_BYTES) chunks.push({ position, length: Math.min(SFTP_CHUNK_BYTES, content.byteLength - position) }); await runWithConcurrency(chunks, SFTP_PIPELINE_DEPTH, async (chunk) => { await withTimeout( new Promise((resolve, reject) => { sftp.write( handle2, content, chunk.position, chunk.length, chunk.position, (error) => error ? reject(error) : resolve() ); }), SFTP_WRITE_STEP_TIMEOUT_MS, `SFTP write timed out after ${SFTP_WRITE_STEP_TIMEOUT_MS}ms while writing ${path} at offset ${chunk.position}.` ); }); } catch (error) { throw failed = !0, error; } finally { failed ? closeRemoteHandle(sftp, handle2).catch(() => { }) : await withTimeout( closeRemoteHandle(sftp, handle2), SFTP_WRITE_STEP_TIMEOUT_MS, `SFTP close timed out after ${SFTP_WRITE_STEP_TIMEOUT_MS}ms while writing ${path}.` ); } } async function closeRemoteHandle(sftp, handle2) { await new Promise((resolve, reject) => { sftp.close(handle2, (error) => error ? reject(error) : resolve()); }); } async function createEmptyFile(sftp, path) { let handle2 = await new Promise((resolve, reject) => { sftp.open(path, "wx", (error, fileHandle) => { if (error) { reject(error); return; } resolve(fileHandle); }); }); await new Promise((resolve, reject) => { sftp.close(handle2, (error) => error ? reject(error) : resolve()); }); } function appendRemoteChild(parent, child) { return `${parent === "/" ? "" : parent.replace(/\/+$/, "")}/${child}`; } function entryType(row) { return row.attrs.isDirectory() ? "directory" : row.attrs.isSymbolicLink() ? "symlink" : "file"; } function isDirectoryStats(stats) { return typeof stats.isDirectory == "function" && stats.isDirectory(); } async function fstatSize(sftp, handle2) { return (await new Promise((resolve, reject) => { sftp.fstat(handle2, (error, result) => error ? reject(error) : resolve(result)); })).size; } async function walkLocalDirectory(localDir) { let directories = [], files = [], queue = [{ local: localDir, relative: "" }]; for (; queue.length > 0; ) { let current2 = queue.shift(), entries = await readdirLocal(current2.local, { withFileTypes: !0 }); for (let entry of entries) { let localPath = joinLocalPath(current2.local, entry.name), relativePath = current2.relative ? `${current2.relative}/${entry.name}` : entry.name; if (entry.isDirectory()) directories.push(relativePath), queue.push({ local: localPath, relative: relativePath }); else if (entry.isFile()) { let { size } = await statLocal(localPath); files.push({ localPath, relativePath, size }); } } } return { directories, files }; } function createAggregatedProgress(totalBytes, target2) { let completedBytes = 0, inFlightBytes = /* @__PURE__ */ new Map(), report = () => { if (!target2) return; let transferredBytes = completedBytes; for (let bytes of inFlightBytes.values()) transferredBytes += bytes; target2.report({ transferredBytes, totalBytes }); }; return { beginItem(sizeBytes) { let key = {}; return inFlightBytes.set(key, 0), { progress: { report: ({ transferredBytes }) => { inFlightBytes.set(key, Math.min(transferredBytes, sizeBytes)), report(); } }, complete() { inFlightBytes.delete(key), completedBytes += sizeBytes, report(); } }; } }; } // src/platform/dsh/sshFailure.ts var TRANSPORT_CODES = /* @__PURE__ */ new Set(["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND", "EAI_AGAIN", "ENOENT", "EHOSTUNREACH", "ENETUNREACH"]); function target(context) { return context.host === void 0 ? "the server" : context.port === void 0 ? context.host : `${context.host}:${context.port}`; } function classifySshFailure(error, context = {}) { let candidate = error ?? void 0, message = error instanceof Error ? error.message : String(error), code = typeof candidate?.code == "string" ? candidate.code : void 0, level = typeof candidate?.level == "string" ? candidate.level : void 0, where = target(context); return level === "client-authentication" ? { code: "authentication-failed", message: `${where} rejected every authentication method this connection offered (${message}).` } : level === "client-timeout" ? { code: "connection-timeout", message: `Timed out connecting to ${where}.` } : code !== void 0 && TRANSPORT_CODES.has(code) ? code === "ECONNREFUSED" ? { code: "connection-refused", message: `Nothing is listening on ${where}.` } : code === "ENOTFOUND" || code === "EAI_AGAIN" ? { code: "host-unresolved", message: `${where} could not be resolved.` } : code === "ENOENT" ? { code: "private-key-unreadable", message: `The private key for ${where} could not be read: ${message}` } : code === "EHOSTUNREACH" || code === "ENETUNREACH" ? { code: "host-unreachable", message: `${where} is unreachable.` } : { code: "connection-timeout", message: `Connecting to ${where} timed out.` } : code !== void 0 ? { code, message } : { code: "connect-failed", message }; } // src/platform/dsh/sftp.ts var SFTP_TEXT_MAX_BYTES = 2 * 1024 * 1024, BINARY_SAMPLE_BYTES = 8192, SFTP_TRANSFER_MAX_BYTES = 256 * 1024 * 1024, SFTP_ERROR_NO_ACTIVE_TERMINAL = "no-active-terminal", SFTP_ERROR_DISCONNECTED = "sftp-disconnected", SFTP_ERROR_READ_FAILED = "sftp-read-failed", SFTP_ERROR_NO_SUCH_FILE = "sftp-no-such-file", SFTP_ERROR_PERMISSION_DENIED = "sftp-permission-denied", SFTP_ERROR_WRITE_FAILED = "sftp-write-failed", SFTP_ERROR_NOT_A_FILE = "sftp-not-a-file", SFTP_ERROR_FILE_TOO_LARGE = "sftp-file-too-large", SFTP_ERROR_BINARY_FILE = "sftp-binary-file", SFTP_ERROR_CONFLICT = "sftp-conflict", SFTP_ERROR_BAD_PARAMS = "sftp-bad-params", SFTP_ERROR_PREFIX = "sftp-", SFTP_STATUS_NO_SUCH_FILE = 2, SFTP_STATUS_PERMISSION_DENIED = 3; function coded(code, message, fingerprint) { return Object.assign(new Error(message), fingerprint === void 0 ? { code } : { code, fingerprint }); } function isConnectFailure(error) { let candidate = error ?? void 0; return typeof candidate?.level == "string" || typeof candidate?.code == "string"; } function createDshSftpApi({ platform: platform2, createSession }) { let configManager = new ConfigManager(platform2.state, platform2.secrets), hostKeyStore = new HostKeyStore(platform2.state), refusal, verifier = { async verify(host, port, fingerprint) { let status = await hostKeyStore.check(host, port, fingerprint); return status === "trusted" ? !0 : (refusal = { code: status === "changed" ? "host-key-changed" : "host-key-unknown", fingerprint }, !1); } }, manager = new SftpManager({ createSession: (terminal) => (createSession ?? ((context, trust) => ( // `allowSudoFallback: false`: this surface reads directories and nothing else, and // the flag only widens *writes* to `sudo -n`. Enabling it now would pre-authorise // an escalation no code path here can reach. new SftpSession(context.server, configManager, trust, { allowSudoFallback: !1 }) )))( terminal, verifier ), reporter: platform2.transfers }), tracked = /* @__PURE__ */ new Map(), followedId; function liveTerminal() { let newest; for (let entry of tracked.values()) entry.connected && (newest = entry.presence); return newest; } function followed() { return followedId === void 0 ? void 0 : tracked.get(followedId); } function followTerminal(requestedId) { let target2 = (typeof requestedId == "string" && requestedId !== "" ? tracked.get(requestedId) : void 0) ?? (() => { let newest = liveTerminal(); return newest === void 0 ? void 0 : tracked.get(newest.terminalId); })(); target2 !== void 0 && target2.presence.terminalId !== followedId && (followedId = target2.presence.terminalId, manager.setTerminalContext(contextOf(target2.presence, target2.connected))); } function contextOf(presence, connected = !0) { return { terminalId: presence.terminalId, server: presence.server, connected, // Read by nothing on the SFTP path (`SftpManager` only reads `terminalId`, // `connected` and `server`), but it is the session's own writer rather than a stub: // inventing a no-op here would be the fake adapter the port layer refuses. write: (data) => presence.write(data) }; } function label() { let entry = followed(); return entry === void 0 ? { serverId: null, serverLabel: null } : { serverId: entry.presence.server.id, serverLabel: entry.presence.server.label }; } function listing(kind, rootPath, path, entries) { return { kind, rootPath, path, entries, ...label() }; } function translate(error, server, path, verb = "read") { let recorded = refusal; if (refusal = void 0, recorded !== void 0) { let where = server === void 0 ? "the server" : `${server.host}:${server.port}`; return coded( recorded.code, recorded.code === "host-key-changed" ? `The host key for ${where} does not match the one recorded earlier.` : `${where} is not a known host. Trust the host key from the terminal page, then reload.`, recorded.fingerprint ); } let own = (error ?? void 0).code; if (typeof own == "string" && own.startsWith(SFTP_ERROR_PREFIX)) return error; let message = error instanceof Error ? error.message : String(error); if (isConnectFailure(error)) { let failure = classifySshFailure(error, server === void 0 ? {} : { host: server.host, port: server.port }); return coded(failure.code, failure.message); } let status = own, at3 = path === void 0 ? "" : ` ${path}`; return status === SFTP_STATUS_NO_SUCH_FILE ? coded(SFTP_ERROR_NO_SUCH_FILE, `No such file or directory:${at3}`.trim() + ".") : status === SFTP_STATUS_PERMISSION_DENIED ? coded( SFTP_ERROR_PERMISSION_DENIED, verb === "write" ? `Permission denied writing${at3}. The SFTP panel never escalates privileges, so check the file's mode or use an account that owns it.` : `Permission denied reading${at3}.` ) : coded( verb === "write" ? SFTP_ERROR_WRITE_FAILED : SFTP_ERROR_READ_FAILED, path === void 0 ? message : `${message} (${verb === "write" ? "writing" : "reading"} ${path})` ); } async function readDirectory(path) { refusal = void 0; let presence = followed(); try { return await manager.listDirectory(path); } catch (error) { throw translate(error, presence?.presence.server, path); } } async function ensureRoot() { if (manager.getActiveViewDescriptor()?.rootPath !== void 0) return; refusal = void 0; let presence = followed(); try { await manager.ensureRoot(); } catch (error) { throw translate(error, presence?.presence.server); } } function requireLiveTerminal(requestedId) { followTerminal(requestedId); let entry = followed(), state = manager.getState(); if (state.kind === "active" && entry !== void 0 && entry.connected) return entry.presence; throw state.kind === "disconnected" ? coded( SFTP_ERROR_DISCONNECTED, "The SSH terminal for this tree is no longer connected, so a file cannot be read or written." ) : coded(SFTP_ERROR_NO_ACTIVE_TERMINAL, "No connected SSH terminal is active."); } function requiredRemotePath(value) { if (typeof value != "string" || value.trim() === "") throw coded(SFTP_ERROR_BAD_PARAMS, "a non-empty remote path is required"); return value; } async function statIfPresent(path) { try { return await manager.stat(path); } catch (error) { if ((error ?? void 0).code === SFTP_STATUS_NO_SUCH_FILE) return; throw error; } } function looksBinary2(bytes) { let sample = Math.min(bytes.length, BINARY_SAMPLE_BYTES); for (let index = 0; index < sample; index += 1) if (bytes[index] === 0) return !0; return !1; } function detectEol(bytes) { let crlf = 0, lf = 0; for (let index = 0; index < bytes.length; index += 1) bytes[index] === 10 && (index > 0 && bytes[index - 1] === 13 ? crlf += 1 : lf += 1); return crlf > 0 && crlf >= lf ? "crlf" : "lf"; } function clampTextLimit(value) { return Number.isFinite(Number(value)) ? Math.max(1, Math.min(SFTP_TEXT_MAX_BYTES, Math.floor(Number(value)))) : SFTP_TEXT_MAX_BYTES; } async function runTransfer(requestedId, verb, path, job) { let presence = requireLiveTerminal(requestedId); refusal = void 0; try { return await job(presence); } catch (error) { throw translate(error, presence.server, path, verb); } } return { /* ------------------------- DshTerminalObserver ------------------------- */ opened(presence) { tracked.set(presence.terminalId, { presence, connected: !0 }); }, closed(terminalId) { let entry = tracked.get(terminalId); entry !== void 0 && (entry.connected = !1, manager.syncTerminalContext(contextOf(entry.presence, !1))); }, /* -------------------------------- reads -------------------------------- */ async list(request = {}) { followTerminal(request.terminalId); let requested = typeof request.path == "string" && request.path !== "" ? request.path : void 0, state = manager.getState(); if (state.kind === "none") return listing("none", null, null, []); if (state.kind === "disconnected") { if (requested !== void 0 && requested !== state.rootPath) throw coded( SFTP_ERROR_DISCONNECTED, `The SSH terminal for this tree is no longer connected, so ${requested} cannot be read.` ); return listing("disconnected", state.rootPath, state.rootPath, state.entries); } await ensureRoot(); let resolved = manager.getState(); if (resolved.kind !== "active") return resolved.kind === "disconnected" ? listing("disconnected", resolved.rootPath, resolved.rootPath, resolved.entries) : listing("none", null, null, []); let path = requested ?? resolved.rootPath, entries = await readDirectory(path); return listing("active", resolved.rootPath, path, entries); }, async goUp(request = {}) { followTerminal(request.terminalId), manager.getState().kind === "active" && manager.getActiveViewDescriptor()?.rootPath === void 0 && await ensureRoot(); let state = manager.getState(), presence = followed(); if (state.kind !== "active" || presence === void 0) throw coded(SFTP_ERROR_NO_ACTIVE_TERMINAL, "No connected SSH terminal is active."); refusal = void 0; let rootPath; try { rootPath = await manager.changeToParentDirectory(); } catch (error) { throw translate(error, presence.presence.server); } let entries = await readDirectory(rootPath); return listing("active", rootPath, rootPath, entries); }, async refresh(request = {}) { return followTerminal(request.terminalId), manager.invalidateAllListings(), { refreshed: !0 }; }, /* ------------------------------ transfer ops ------------------------------ */ async readFile(request) { let path = requiredRemotePath(request?.path), limit = clampTextLimit(request?.maxBytes); return await runTransfer(request?.terminalId, "read", path, async () => { let stat = await manager.stat(path); if (stat.type === "directory") throw coded(SFTP_ERROR_NOT_A_FILE, `${path} is a directory, not a file.`); let truncated = stat.size > limit, bytes = await manager.readFile(path, truncated ? limit : stat.size); if (looksBinary2(bytes)) throw coded( SFTP_ERROR_BINARY_FILE, `${path} is not a text file, so it cannot be shown or edited here. Download it instead, or read it from the Terminal page.` ); return { path, // NUL-stripped of its `\r`s so the wire text is LF-only and the editor cannot be // tricked by a `\r` it will not reproduce (see `DshSftpFileText.text`). text: bytes.toString("utf8").replace(/\r\n/g, ` `), eol: detectEol(bytes), size: stat.size, modifiedAt: stat.modifiedAt, truncated }; }); }, async writeFile(request) { let path = requiredRemotePath(request?.path); if (typeof request?.text != "string") throw coded(SFTP_ERROR_BAD_PARAMS, "the text to write is required"); let lfText = request.text.replace(/\r\n/g, ` `), encoded = request.eol === "crlf" ? lfText.replace(/\n/g, `\r `) : lfText, content = Buffer.from(encoded, "utf8"); if (content.length > SFTP_TEXT_MAX_BYTES) throw coded( SFTP_ERROR_FILE_TOO_LARGE, `The edited text is ${content.length} bytes, over the ${SFTP_TEXT_MAX_BYTES}-byte limit for an in-panel edit.` ); let expected = Number.isFinite(Number(request.expectedSize)) && Number.isFinite(Number(request.expectedModifiedAt)) ? { size: Number(request.expectedSize), modifiedAt: Number(request.expectedModifiedAt) } : void 0; return await runTransfer(request?.terminalId, "write", path, async () => { let current2 = await manager.stat(path); if (current2.type === "directory") throw coded(SFTP_ERROR_NOT_A_FILE, `${path} is a directory, not a file.`); if (request.overwrite !== !0 && expected !== void 0 && (current2.size !== expected.size || current2.modifiedAt !== expected.modifiedAt)) throw coded( SFTP_ERROR_CONFLICT, `${path} changed on the server since it was opened (${expected.size} bytes / ${expected.modifiedAt} then, ${current2.size} bytes / ${current2.modifiedAt} now). Overwrite it, or reload and redo the edit.` ); await manager.writeFile(path, content); let after = await manager.stat(path); return { path, size: after.size, modifiedAt: after.modifiedAt }; }); }, async download(request) { let path = requiredRemotePath(request?.path); return await runTransfer(request?.terminalId, "read", path, async () => { let stat = await manager.stat(path); if (stat.type === "directory") throw coded( SFTP_ERROR_NOT_A_FILE, `${path} is a directory. Recursive download is not available in this panel yet \u2014 use the Terminal page (tar over ssh, or scp -r).` ); if (stat.size > SFTP_TRANSFER_MAX_BYTES) throw coded( SFTP_ERROR_FILE_TOO_LARGE, `${path} is ${stat.size} bytes, over the ${SFTP_TRANSFER_MAX_BYTES}-byte transfer limit. Use the Terminal page (scp or rsync) for a file this large.` ); let bytes = await manager.readFile(path, SFTP_TRANSFER_MAX_BYTES); return { path, // The domain's own sanitiser, so a filename with a `:` or a newline cannot become // an invalid local name — the same rule the VS Code preview path follows. name: safePreviewName(path), size: bytes.length, modifiedAt: stat.modifiedAt, // Base64 for the same reason the PTY stream uses it: a JSON string cannot carry // arbitrary bytes, and a split multi-byte sequence is the obvious casualty. base64: bytes.toString("base64") }; }); }, async upload(request) { let path = requiredRemotePath(request?.path); if (typeof request?.base64 != "string" || request.base64 === "") throw coded(SFTP_ERROR_BAD_PARAMS, "the file content is required"); if (request.base64.length > Math.ceil(SFTP_TRANSFER_MAX_BYTES / 3) * 4 + 8) throw coded( SFTP_ERROR_FILE_TOO_LARGE, `The upload is larger than the ${SFTP_TRANSFER_MAX_BYTES}-byte limit for this panel. Use the Terminal page (scp or rsync) instead.` ); let content = Buffer.from(request.base64, "base64"); if (content.length > SFTP_TRANSFER_MAX_BYTES) throw coded( SFTP_ERROR_FILE_TOO_LARGE, `The upload is ${content.length} bytes, over the ${SFTP_TRANSFER_MAX_BYTES}-byte limit for this panel.` ); return await runTransfer(request?.terminalId, "write", path, async () => { if (request.overwrite !== !0) { let existing = await statIfPresent(path); if (existing !== void 0 && existing.type === "directory") throw coded(SFTP_ERROR_NOT_A_FILE, `${path} is a directory, so a file cannot be written over it.`); if (existing !== void 0) throw coded( SFTP_ERROR_CONFLICT, `${path} already exists on the server. Overwrite it, or upload under a different name.` ); } await manager.writeFile(path, content); let after = await manager.stat(path); return { path, size: after.size, modifiedAt: after.modifiedAt }; }); }, async createFile(request) { let path = requiredRemotePath(request?.path); return await runTransfer(request?.terminalId, "write", path, async () => { if (await statIfPresent(path) !== void 0) throw coded( SFTP_ERROR_CONFLICT, `${path} already exists on the server.` ); return await manager.createFile(path), { created: !0, path }; }); }, async delete(request) { let path = requiredRemotePath(request?.path); return await runTransfer(request?.terminalId, "write", path, async () => { let existing = await statIfPresent(path); if (existing === void 0) throw coded(SFTP_ERROR_NO_SUCH_FILE, `No such file or directory: ${path}`); let name2 = path.split("/").filter(Boolean).pop() || ""; return await manager.deleteEntry({ path, type: existing.type ?? "file", name: name2 }), { deleted: !0, path }; }); }, dispose() { manager.dispose(), tracked.clear(), followedId = void 0; } }; } // src/platform/dsh/services.ts import { randomUUID as randomUUID2 } from "node:crypto"; import { basename as basename2 } from "node:path"; // src/ssh/SshSession.ts var SshSession = class { constructor(server, configManager, events, hostKeyVerifier, keyboardInteractivePrompt) { this.server = server; this.configManager = configManager; this.events = events; this.hostKeyVerifier = hostKeyVerifier; this.keyboardInteractivePrompt = keyboardInteractivePrompt; } client; shell; rows = 24; cols = 80; connected = !1; connectionHandle; /** * Keep a **permanent** `error` listener on an ssh2 client for its whole life. * * `client.once('error', reject)` below looks like it covers errors, but `once` is consumed * by the *first* error. ssh2 emits `'error'` again whenever the socket closes before the * handshake finished — `makeError('Connection lost before handshake', 'protocol', true)` at * `ssh2/lib/client.js:753`, which is `fatal: true` — and a Node `EventEmitter` **throws** * on an `'error'` nobody listens for. That escaped as an uncaught exception and killed the * whole dsh host process: * * ```text * ~/Library/Logs/DeepSeek Harness/crash-2026-10-07T05-30-05-568Z-host.log * dsh: fatal uncaught exception: Error: Connection lost before handshake * at makeError (ssh2/lib/protocol/utils.js:142:15) * ``` * * The bastion path is where this bites hardest: a forwarded channel that the jump host * closes mid-handshake produces exactly that sequence, and taking the entire IDE down over * one flaky bastion link is not an acceptable failure mode. * * Reporting is deliberately not suppressed: a post-connect failure is still a real event * the user should see, so it goes to `events.error`. Only the pre-connect case is left to * the connect promise, which already has the *first* error — the one that matters. */ guardFatalErrors(client) { client.on("error", (error) => { this.connected && this.events.error(error); }); } async connect() { this.events.status({ state: "connecting", text: t("Connecting to {host}:{port}...", { host: this.server.host, port: this.server.port }) }); let handle2 = await this.buildConnectionHandle(); this.connectionHandle = handle2; let { Client } = await getSsh2(), client = new Client(); this.client = client, this.guardFatalErrors(client); try { await new Promise((resolve, reject) => { client.once("ready", resolve), client.once("error", reject), attachKeyboardInteractive(client, this.keyboardInteractivePrompt, reject), client.connect(handle2.config); }), this.shell = await new Promise((resolve, reject) => { client.shell(this.getShellOptions(), { env: this.getShellEnvironment() }, (error, stream) => { if (error) { reject(error); return; } resolve(stream); }); }); } catch (error) { throw client.end(), handle2.dispose(), this.connectionHandle = void 0, error; } this.shell.on("data", (data) => { this.events.output(data); }), this.shell.on("close", () => { this.connected = !1, this.events.status({ state: "disconnected", text: t("Disconnected") }); }), this.connected = !0, this.events.status({ state: "connected", text: t("Connected") }); } async reconnect() { this.dispose(), await this.connect(); } write(data) { this.shell?.write(data); } /** * Flow-control hooks for the terminal host's high-water mark: pausing the shell * channel makes the SSH window fill so the remote side stops sending. Both are * no-ops while no shell is open, so callers may invoke them at any point. */ pauseOutput() { this.shell?.pause(); } resumeOutput() { this.shell?.resume(); } resize(rows, cols) { rows > 0 && cols > 0 && (this.rows = rows, this.cols = cols, this.shell?.setWindow(rows, cols, 0, 0)); } getShellOptions() { return { term: "xterm-256color", rows: this.rows, cols: this.cols }; } getShellEnvironment() { return { TERM: "xterm-256color", COLORTERM: "truecolor", CLICOLOR: "1", FORCE_COLOR: "1" }; } isConnected() { return this.connected; } dispose() { this.shell?.end(), this.client?.end(), this.connectionHandle?.dispose(), this.shell = void 0, this.client = void 0, this.connectionHandle = void 0, this.connected = !1; } async buildConnectionHandle() { return buildSshConnectionHandle(this.server, this.configManager, this.hostKeyVerifier, { keyboardInteractivePrompt: this.keyboardInteractivePrompt }); } }; // src/platform/dsh/services.ts function toView(server, hasPassword) { return { id: server.id, label: server.label, ...server.group === void 0 ? {} : { group: server.group }, host: server.host, port: server.port, username: server.username, authType: server.authType, hasPassword, ...server.privateKeyPath === void 0 ? {} : { privateKeyPath: server.privateKeyPath, privateKeyFileName: basename2(server.privateKeyPath) }, ...server.jumpHostId === void 0 ? {} : { jumpHostId: server.jumpHostId }, encoding: server.encoding, keepAliveInterval: server.keepAliveInterval, ...server.agentCommandTrust === void 0 ? {} : { agentCommandTrust: server.agentCommandTrust }, ...server.backgroundConnectionAllowed === void 0 ? {} : { backgroundConnectionAllowed: server.backgroundConnectionAllowed } }; } function buildServerConfig(input, existing, now) { let candidate = { id: existing?.id ?? input.id ?? randomUUID2(), label: input.label, host: input.host, port: input.port, username: input.username, authType: input.authType, encoding: input.encoding ?? existing?.encoding ?? "utf-8", keepAliveInterval: input.keepAliveInterval ?? existing?.keepAliveInterval ?? 30, createdAt: existing?.createdAt ?? now, updatedAt: now }, optional = [ ["group", "group"], ["privateKeyPath", "privateKeyPath"], ["jumpHostId", "jumpHostId"], ["agentCommandTrust", "agentCommandTrust"], ["backgroundConnectionAllowed", "backgroundConnectionAllowed"] ]; for (let [from, to] of optional) { let value = input[from]; value !== void 0 && value !== "" && (candidate[to] = value); } return parseServerConfig(candidate); } function createDshServerApi({ platform: platform2, privateKeyDirectory }) { let configManager = new ConfigManager(platform2.state, platform2.secrets); return { async list() { let servers = await configManager.listServers(), views = []; for (let server of servers) { let hasPassword = server.authType === "password" && await configManager.getPassword(server.id) !== void 0; views.push(toView(server, hasPassword)); } let groups = [...new Set(views.map((view) => view.group).filter((group) => group !== void 0))]; return { servers: views, groups: groups.sort((a2, b4) => a2.localeCompare(b4)), privateKeyDirectory }; }, async save(input) { let existing = input.id === void 0 ? void 0 : await configManager.getServer(input.id), server = buildServerConfig(input, existing, Date.now()), password = input.password === void 0 || input.password === "" ? void 0 : input.password; await configManager.saveServer(server, password); let hasPassword = server.authType === "password" && await configManager.getPassword(server.id) !== void 0; return toView(server, hasPassword); }, async remove(id) { return await configManager.getServer(id) === void 0 ? { removed: !1 } : (await configManager.deleteServer(id), { removed: !0 }); } }; } function createVerifier(store, emit) { return { async verify(host, port, fingerprint) { let status = await store.check(host, port, fingerprint); return status === "trusted" ? !0 : (emit({ type: "error", code: status === "changed" ? "host-key-changed" : "host-key-unknown", message: status === "changed" ? `The host key for ${host}:${port} does not match the one recorded earlier.` : `${host}:${port} is not a known host.`, fingerprint, // Which host refused, so the panel's trust button records the acceptance against // this host rather than against the server the user happened to pick. With a jump // host these differ, and recording the jump host's key under the target's address // is what made "trust, then reconnect" fail forever. host, port }), !1); } }; } function createDshTerminalApi({ platform: platform2, observer }) { let configManager = new ConfigManager(platform2.state, platform2.secrets), hostKeyStore = new HostKeyStore(platform2.state), live = /* @__PURE__ */ new Set(); async function resolveHost(serverId, requestedHost, requestedPort) { let server = await configManager.getServer(serverId); if (server === void 0) throw Object.assign(new Error(`no server with id "${serverId}"`), { code: "no-such-server" }); let reachable = /* @__PURE__ */ new Set([`${server.host}:${server.port}`]), seen = /* @__PURE__ */ new Set(); for (let id = server.jumpHostId; id !== void 0 && !seen.has(id); ) { seen.add(id); let jump = await configManager.getServer(id); if (jump === void 0) break; reachable.add(`${jump.host}:${jump.port}`), id = jump.jumpHostId; } let asked = typeof requestedHost == "string" && requestedHost !== "" ? `${requestedHost}:${typeof requestedPort == "number" ? requestedPort : ""}` : void 0, useServer = asked === void 0 || !reachable.has(asked); return { server, host: useServer ? server.host : requestedHost, port: useServer ? server.port : requestedPort }; } return { async open(options) { let server = await configManager.getServer(options.serverId); if (server === void 0) throw Object.assign(new Error(`no server with id "${options.serverId}"`), { code: "no-such-server" }); let emit = options.emit, session = new SshSession( server, configManager, { output(data) { emit({ type: "output", data: data.toString("base64") }); }, status(status) { emit({ type: "status", state: status.state, text: status.text }); }, error(error) { let failure = classifySshFailure(error, { host: server.host, port: server.port }); emit({ type: "error", code: failure.code, message: failure.message }); } }, createVerifier(hostKeyStore, emit), // Keyboard-interactive authentication needs a prompt, and this host has no dialog. // Leaving it undefined makes such an attempt fail cleanly instead of hanging on a // prompt nobody can see — the same choice the platform's port makes. void 0 ); live.add(session); try { session.resize(options.rows, options.cols), await session.connect(); } catch (error) { live.delete(session), session.dispose(); let failure = classifySshFailure(error, { host: server.host, port: server.port }); throw Object.assign(new Error(failure.message), { code: failure.code }); } let closed = !1, terminalId = randomUUID2(); return observer?.opened({ terminalId, server, write: (data) => session.write(data) }), { terminalId, write(data) { session.write(data); }, resize(rows, cols) { session.resize(rows, cols); }, setPaused(paused) { paused ? session.pauseOutput() : session.resumeOutput(); }, close() { closed || (closed = !0, live.delete(session), session.dispose(), observer?.closed(terminalId), emit({ type: "closed", reason: "requested" })); } }; }, async trustHost(request) { let { host, port } = await resolveHost(request.serverId, request.host, request.port); return await hostKeyStore.trust(host, port, request.fingerprint), { trusted: !0, host, port }; }, async forgetHost(request) { let { host, port } = await resolveHost(request.serverId, request.host, request.port), forgot = hostKeyStore.getTrusted(host, port) !== void 0; return forgot && await hostKeyStore.forget(host, port), { forgot, host, port }; } }; } // src/platform/dsh/agent.ts import { existsSync } from "node:fs"; import { createRequire as createRequire2 } from "node:module"; import { dirname as dirname2, join as join5 } from "node:path"; import { fileURLToPath as fileURLToPath2 } from "node:url"; // src/agent/destructiveCommandHint.ts function looksDestructive(command) { return /\b(rm\s+-[^\n]*r|mkfs|shutdown|reboot|poweroff|dd\s+if=)/i.test(command); } // src/agent/loadRemoteCommandPolicy.ts import { join as join3 } from "node:path"; import { createRequire } from "node:module"; var INITIALIZATION_FAILED = Object.freeze({ action: "review", reasonCode: "policy.initialization_failed", evidence: Object.freeze([]) }); function createUnavailableEvaluator() { return { async evaluate() { return INITIALIZATION_FAILED; } }; } var testLoader, cached2; function loadBundledPolicyRuntime() { try { let require2 = createRequire(__filename), runtimePath = join3(__dirname, "policy-runtime.js"), runtime = require2(runtimePath); return typeof runtime.createTerminalPolicyRuntime != "function" ? createUnavailableEvaluator() : runtime.createTerminalPolicyRuntime({ assetDirectory: join3(__dirname, "policy-assets") }); } catch { return createUnavailableEvaluator(); } } async function loadRemoteCommandPolicyEvaluator() { cached2 ??= (async () => testLoader ? await testLoader() : loadBundledPolicyRuntime())(); try { return await cached2; } catch { return cached2 = void 0, createUnavailableEvaluator(); } } // src/agent/remoteCommandAuthorization.ts function unavailableDecision() { return { action: "review", reasonCode: "policy.initialization_failed", evidence: [] }; } function isPolicyAction(value) { return value === "allow" || value === "review" || value === "deny"; } async function authorizeRemoteCommand(options) { let destructive = looksDestructive(options.command), trust = resolveAgentCommandTrust(options.server); if (trust === "full") return { autoApprove: !0, destructive, riskSummaries: [] }; if (trust !== "policy") return { autoApprove: !1, destructive, riskSummaries: [] }; let decision; try { decision = await (options.evaluator ?? await loadRemoteCommandPolicyEvaluator()).evaluate({ sourceText: options.command, cwd: options.cwd }); } catch { decision = unavailableDecision(); } return isPolicyAction(decision.action) || (decision = unavailableDecision()), { autoApprove: decision.action === "allow", destructive, riskSummaries: decision.evidence.map((item) => item.summary).filter((summary) => summary.length > 0), reasonCode: decision.reasonCode, action: decision.action }; } // src/agent/agentCommandTrust.ts function resolveAgentCommandTrust(server) { return server.agentCommandTrust ? server.agentCommandTrust : server.agentCommandAutoApprove === !0 ? "policy" : "none"; } function shouldAutoApproveSftpWrite(server) { return resolveAgentCommandTrust(server) === "full"; } // src/agent/AgentToolService.ts var AgentToolService = class { constructor(dependencies) { this.dependencies = dependencies; } async listServers() { let servers = await this.dependencies.configManager.listServers(), connectedServerIds = new Set( this.dependencies.terminalContext.getSnapshot().connectedTerminals.map((terminal) => terminal.serverId) ); return { servers: servers.filter( (server) => server.backgroundConnectionAllowed === !0 || connectedServerIds.has(server.id) ).map((server) => ({ id: server.id, label: server.label, host: server.host, port: server.port, username: server.username, authType: server.authType, connected: connectedServerIds.has(server.id), agentCommandTrust: resolveAgentCommandTrust(server), agentCommandAutoApprove: resolveAgentCommandTrust(server) !== "none" })) }; } async getTerminalContext() { return this.dependencies.terminalContext.getSnapshot(); } async runRemoteCommand(input) { let command = input.command?.trim(); if (!command) throw new Error("Remote command cannot be empty."); let started = Date.now(), reasonCode = "auto_approved"; try { let server = await this.resolveServer(input.serverId), authorization = await authorizeRemoteCommand({ server, command, cwd: input.cwd, evaluator: this.dependencies.policyEvaluator }); if (!authorization.autoApprove) { if (!this.dependencies.confirmation) throw new Error("Command requires human confirmation, but no confirmation channel is available."); if (!await this.dependencies.confirmation.confirmCommand({ serverLabel: server.label, host: server.host, command, destructive: authorization.destructive, riskSummaries: authorization.riskSummaries, signal: input.signal })) throw reasonCode = "user_cancelled", new Error("Remote command was cancelled."); reasonCode = "user_approved"; } let result = await this.dependencies.executor.execute(server, { command, cwd: input.cwd, timeoutMs: input.timeoutMs, maxOutputBytes: input.maxOutputBytes, signal: input.signal }); return this.dependencies.audit?.record({ tool: "run_remote_command", serverId: result.serverId, command, reasonCode: result.timedOut ? "command_timeout" : reasonCode, exitCode: result.exitCode, durationMs: result.durationMs, truncated: result.truncated }), result; } catch (error) { throw this.dependencies.audit?.record({ tool: "run_remote_command", serverId: input.serverId, command, reasonCode: auditReasonForError(error, reasonCode), durationMs: Date.now() - started }), error; } } async sftpListDirectory(input) { return await this.requireSftp().listDirectory(input); } async sftpStatPath(input) { return await this.requireSftp().statPath(input); } async sftpReadFile(input) { return await this.requireSftp().readFile(input); } async sftpWriteFile(input) { return await this.requireSftp().writeFile(input); } async sftpCreateFile(input) { return await this.requireSftp().createFile(input); } async sftpCreateDirectory(input) { return await this.requireSftp().createDirectory(input); } async sftpRename(input) { return await this.requireSftp().rename(input); } async sftpDelete(input) { return await this.requireSftp().deleteFile(input); } async resolveServer(serverId) { if (serverId === "active" || !serverId) { let connected = this.dependencies.terminalContext.getConnectedTerminal(); if (connected) { let latest = await this.dependencies.configManager.getServer(connected.server.id); return latest ? (this.dependencies.terminalContext.updateServer(latest), latest) : connected.server; } if (serverId === "active") throw new Error("No connected active SSH terminal is available."); } if (serverId && serverId !== "active") { let connectedByServer = this.dependencies.terminalContext.getConnectedTerminalByServerId(serverId); if (connectedByServer) { let latest = await this.dependencies.configManager.getServer(connectedByServer.server.id); return latest ? (this.dependencies.terminalContext.updateServer(latest), latest) : connectedByServer.server; } } if (!serverId) throw new Error("serverId is required when there is no connected active SSH terminal."); let server = await this.dependencies.configManager.getServer(serverId); if (!server) throw new Error(`SSH server "${serverId}" was not found.`); return this.requireBackgroundConnectionAllowed(server); } requireBackgroundConnectionAllowed(server) { if (server.backgroundConnectionAllowed !== !0) throw new Error( `SSH server "${server.id}" does not allow background connections. Ask the user to enable "Allow background connections" on the AT Terminal server edit form, or connect an AT Terminal session to that server.` ); return server; } requireSftp() { if (!this.dependencies.sftp) throw new Error("AT Terminal SFTP agent service is not available."); return this.dependencies.sftp; } }; function auditReasonForError(error, fallback) { let message = error instanceof Error ? error.message : String(error); return message.includes("was cancelled") || message.includes("was aborted") ? "user_cancelled" : message.startsWith("Confirmation timed out") ? "confirmation_timeout" : message.includes("does not allow background connections") ? "background_denied" : fallback === "user_approved" || fallback === "auto_approved" ? "error" : fallback; } // src/agent/RemoteCommandExecutor.ts var DEFAULT_TIMEOUT_MS = 3e4, MAX_TIMEOUT_MS = 12e4, DEFAULT_MAX_OUTPUT_BYTES = 64e3, MAX_OUTPUT_BYTES = 256e3, IDLE_CONNECTION_TTL_MS = 5 * 6e4, PooledConnection = class { /** Resolves once the connection is authenticated; rejects if it never got there. */ ready; client; handle; /** Commands currently holding a channel on this connection. */ inFlight = 0; idleTimer; closed = !1; constructor(open) { this.ready = open(this); } }, RemoteCommandExecutor = class { constructor(configManager, hostKeyVerifier) { this.configManager = configManager; this.hostKeyVerifier = hostKeyVerifier; } pool = /* @__PURE__ */ new Map(); disposed = !1; async execute(server, request) { let command = request.command.trim(); if (!command) throw new Error("Remote command cannot be empty."); let timeoutMs = clampPositiveInteger(request.timeoutMs, DEFAULT_TIMEOUT_MS, MAX_TIMEOUT_MS), maxOutputBytes = clampPositiveInteger(request.maxOutputBytes, DEFAULT_MAX_OUTPUT_BYTES, MAX_OUTPUT_BYTES), started = Date.now(), execCommand = wrapCommand(command, request.cwd), stream, settled = !1, timedOut = !1; return new Promise((resolve, reject) => { let stdout = new OutputBuffer(maxOutputBytes), stderr = new OutputBuffer(maxOutputBytes), lease, abortListener, timeout = setTimeout(() => { timedOut = !0, stream?.close(), finish(null); }, timeoutMs), onConnectionLost = (error) => { rejectOnce(error ?? new Error("SSH connection closed before the command finished.")); }, detach = () => { clearTimeout(timeout), abortListener && request.signal && request.signal.removeEventListener("abort", abortListener), lease && (lease.client.off("error", onConnectionLost), lease.client.off("close", onConnectionLost), lease.release()); }; if (request.signal) { if (request.signal.aborted) { timedOut = !1, rejectOnce(new Error("Remote command was aborted.")); return; } abortListener = () => { stream?.close(), rejectOnce(new Error("Remote command was aborted.")); }, request.signal.addEventListener("abort", abortListener, { once: !0 }); } function finish(exitCode, signal) { settled || (settled = !0, detach(), resolve({ serverId: server.id, serverLabel: server.label, host: server.host, command, cwd: request.cwd, exitCode, signal, stdout: stdout.text(), // A timeout appends its notice instead of replacing stderr: whatever the // command managed to print before it overran is usually the diagnosis. stderr: timedOut ? appendTimeoutNotice(stderr.text(), timeoutMs) : stderr.text(), durationMs: Date.now() - started, timedOut, truncated: stdout.truncated || stderr.truncated })); } function rejectOnce(error) { settled || (settled = !0, detach(), reject(error)); } this.acquire(server).then((acquired) => { if (settled) { acquired.release(); return; } lease = acquired, acquired.client.once("error", onConnectionLost), acquired.client.once("close", onConnectionLost), acquired.client.exec(execCommand, (error, execStream) => { if (error) { rejectOnce(error); return; } stream = execStream, execStream.on("data", (data) => stdout.append(data)), execStream.stderr.on("data", (data) => stderr.append(data)), execStream.once("close", (code, signalName) => { finish(code, signalName); }); }); }, rejectOnce); }); } /** Closes every pooled connection. Must run on extension deactivate. */ dispose() { this.disposed = !0; for (let [serverId, connection] of [...this.pool]) this.evict(serverId, connection); this.pool.clear(); } async acquire(server) { if (this.disposed) throw new Error("The remote command executor has been disposed."); let connection = this.pool.get(server.id); (!connection || connection.closed) && (connection = this.open(server), this.pool.set(server.id, connection)), connection.inFlight += 1, connection.idleTimer && (clearTimeout(connection.idleTimer), connection.idleTimer = void 0); let held = connection; try { return { client: await held.ready, release: () => this.release(server.id, held) }; } catch (error) { throw this.release(server.id, held), error; } } open(server) { let connection = new PooledConnection(async (self2) => { let handle2 = await buildSshConnectionHandle(server, this.configManager, this.hostKeyVerifier); self2.handle = handle2; let client = new (await getSsh2()).Client(); client.setMaxListeners(64), self2.client = client; let drop = () => this.evict(server.id, self2); return client.on("error", drop), client.on("close", drop), client.on("end", drop), await new Promise((resolve, reject) => { client.once("ready", resolve), client.once("error", reject), attachKeyboardInteractive(client, void 0, reject), client.connect(handle2.config); }), client; }); return connection.ready.catch(() => this.evict(server.id, connection)), connection; } release(serverId, connection) { connection.inFlight = Math.max(0, connection.inFlight - 1), !(connection.inFlight > 0 || connection.closed || connection.idleTimer) && (connection.idleTimer = setTimeout(() => this.evict(serverId, connection), IDLE_CONNECTION_TTL_MS), connection.idleTimer.unref?.()); } evict(serverId, connection) { connection.closed || (connection.closed = !0, connection.idleTimer && (clearTimeout(connection.idleTimer), connection.idleTimer = void 0), this.pool.get(serverId) === connection && this.pool.delete(serverId), connection.client?.end(), connection.handle?.dispose()); } }; function appendTimeoutNotice(capturedStderr, timeoutMs) { let notice = `Command timed out after ${timeoutMs}ms.`; return capturedStderr ? capturedStderr.endsWith(` `) ? `${capturedStderr}${notice}` : `${capturedStderr} ${notice}` : notice; } function wrapCommand(command, cwd) { let trimmedCwd = cwd?.trim(); return trimmedCwd ? `cd ${quotePosixShellPath(trimmedCwd)} && ${command}` : command; } function clampPositiveInteger(value, fallback, max) { return typeof value != "number" || !Number.isInteger(value) || value <= 0 ? fallback : Math.min(value, max); } var OutputBuffer = class { constructor(maxBytes) { this.maxBytes = maxBytes; } chunks = []; size = 0; truncated = !1; append(data) { if (this.size >= this.maxBytes) { this.truncated = !0; return; } let remaining = this.maxBytes - this.size; if (data.length > remaining) { this.chunks.push(data.subarray(0, remaining)), this.size = this.maxBytes, this.truncated = !0; return; } this.chunks.push(data), this.size += data.length; } text() { return Buffer.concat(this.chunks).toString("utf8"); } }; // src/agent/SftpAgentService.ts var DEFAULT_READ_BYTES = 64 * 1024, MAX_READ_BYTES = 256 * 1024, DEFAULT_MAX_ENTRIES = 500, MAX_ENTRIES = 5e3, WRITE_TIMEOUT_MS = 6e4, BACKGROUND_IDLE_TTL_MS = 5 * 6e4, SftpAgentService = class { constructor(options) { this.options = options; } /** One session per connected UI terminal; lives until the terminal closes. */ terminalSessions = /* @__PURE__ */ new Map(); /** One session per background server, reaped after BACKGROUND_IDLE_TTL_MS idle. */ backgroundSessions = /* @__PURE__ */ new Map(); roots = /* @__PURE__ */ new Map(); async listDirectory(input) { return await this.withAudit("sftp_list_directory", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let path = await this.resolvePath(lease, input.path), entries = await lease.session.listDirectory(path), maxEntries = clampMaxEntries(input.maxEntries), offset = clampListOffset(input.offset), page = entries.slice(offset, offset + maxEntries); return { terminalId: target2.terminalId, serverId: target2.server.id, path, entries: page, truncated: offset + page.length < entries.length, offset, total: entries.length }; } finally { lease.release(); } }); } async statPath(input) { return await this.withAudit("sftp_stat_path", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let path = await this.resolvePath(lease, input.path); return { terminalId: target2.terminalId, serverId: target2.server.id, path, ...await lease.session.stat(path) }; } finally { lease.release(); } }); } async readFile(input) { return await this.withAudit("sftp_read_file", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let path = await this.resolvePath(lease, input.path), stat = await lease.session.stat(path), maxBytes = clampReadBytes(input.maxBytes), start2 = resolveReadStart(input.offset, stat.size), window2 = Math.min(Math.max(stat.size - start2, 0), maxBytes), buffer = window2 === 0 ? Buffer.alloc(0) : (await lease.session.readFile(path, window2, start2)).subarray(0, window2); if (looksBinary(buffer)) throw new Error("Remote file appears to be binary."); return { terminalId: target2.terminalId, serverId: target2.server.id, path, content: buffer.toString("utf8"), truncated: start2 + buffer.length < stat.size, offset: start2, size: stat.size, modifiedAt: stat.modifiedAt }; } finally { lease.release(); } }); } async writeFile(input) { return await this.withAudit("sftp_write_file", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let { path, workspaceRoot } = await this.resolveWritablePath(lease, input.path), exists = await pathExists(lease.session, path); if (exists && !input.overwrite) throw new Error("Remote file already exists. Pass overwrite: true to replace it."); await withTimeout2( this.options.authorizer.requireWrite(target2.server, { operation: "write_file", path, overwrite: !!exists, workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP write authorization for ${path}.` ); let content = Buffer.from(input.content, "utf8"); return await withTimeout2( lease.session.writeFile(path, content), WRITE_TIMEOUT_MS, `Timed out writing remote file ${path}.` ), { terminalId: target2.terminalId, serverId: target2.server.id, path, bytesWritten: content.length, overwritten: exists }; } finally { lease.release(); } }); } async createFile(input) { return await this.withAudit("sftp_create_file", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let { path, workspaceRoot } = await this.resolveWritablePath(lease, input.path); if (await pathExists(lease.session, path)) throw new Error("Remote file already exists."); return await withTimeout2( this.options.authorizer.requireWrite(target2.server, { operation: "create_file", path, overwrite: !1, workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP create authorization for ${path}.` ), input.content === void 0 ? await withTimeout2( lease.session.createFile(path), WRITE_TIMEOUT_MS, `Timed out creating remote file ${path}.` ) : await withTimeout2( lease.session.writeFile(path, Buffer.from(input.content, "utf8")), WRITE_TIMEOUT_MS, `Timed out writing remote file ${path}.` ), { terminalId: target2.terminalId, serverId: target2.server.id, path }; } finally { lease.release(); } }); } async createDirectory(input) { return await this.withAudit("sftp_create_directory", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let { path, workspaceRoot } = await this.resolveWritablePath(lease, input.path); return await withTimeout2( this.options.authorizer.requireWrite(target2.server, { operation: "create_directory", path, overwrite: !1, workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP create directory authorization for ${path}.` ), await withTimeout2( lease.session.mkdir(path), WRITE_TIMEOUT_MS, `Timed out creating remote directory ${path}.` ), { terminalId: target2.terminalId, serverId: target2.server.id, path }; } finally { lease.release(); } }); } async rename(input) { return await this.withAudit("sftp_rename", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let source = await this.resolveWritablePath(lease, input.path), destination = await this.resolveWritablePath(lease, input.newPath); if (!await pathExists(lease.session, source.path)) throw new Error("Remote source path was not found."); if (await pathExists(lease.session, destination.path)) throw new Error("Remote destination already exists."); return await withTimeout2( this.options.authorizer.requireWrite(target2.server, { operation: "rename", path: source.path, overwrite: !1, workspaceRoot: source.workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP rename authorization for ${source.path}.` ), await withTimeout2( this.options.authorizer.requireWrite(target2.server, { operation: "rename", path: destination.path, overwrite: !1, workspaceRoot: destination.workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP rename authorization for ${destination.path}.` ), await withTimeout2( lease.session.rename(source.path, destination.path), WRITE_TIMEOUT_MS, `Timed out renaming remote path ${source.path}.` ), { terminalId: target2.terminalId, serverId: target2.server.id, path: source.path, newPath: destination.path }; } finally { lease.release(); } }); } async deleteFile(input) { return await this.withAudit("sftp_delete", input, async () => { let target2 = await this.resolveTarget(input), lease = await this.leaseFor(target2); try { let { path, workspaceRoot } = await this.resolveWritablePath(lease, input.path), entryType2 = await remoteEntryType(lease.session, path); if (entryType2 === void 0) throw new Error("Remote file was not found."); if (entryType2 === "directory") throw new Error("sftp_delete removes single files only; directories are refused."); return await withTimeout2( this.options.authorizer.requireDelete(target2.server, { operation: "delete_file", path, overwrite: !1, workspaceRoot }), WRITE_TIMEOUT_MS, `Timed out waiting for SFTP delete confirmation for ${path}.` ), await withTimeout2( lease.session.deleteFile(path), WRITE_TIMEOUT_MS, `Timed out deleting remote file ${path}.` ), { terminalId: target2.terminalId, serverId: target2.server.id, path, deleted: !0 }; } finally { lease.release(); } }); } /** Drops the pooled session bound to a closed terminal. Wire to `onDidRemoveContext`. */ disposeTerminal(terminalId) { let entry = this.terminalSessions.get(terminalId); entry && (this.terminalSessions.delete(terminalId), entry.promise.then( (session) => session.dispose(), () => { } )), this.roots.delete(`terminal:${terminalId}`); } /** Drops every pooled session for a server, e.g. after the server is deleted or edited. */ disposeServer(serverId) { let background = this.backgroundSessions.get(serverId); background && this.evictBackgroundSession(serverId, background); for (let [terminalId, entry] of [...this.terminalSessions]) entry.serverId === serverId && this.disposeTerminal(terminalId); this.roots.delete(`server:${serverId}`); } dispose() { for (let [serverId, entry] of [...this.backgroundSessions]) this.evictBackgroundSession(serverId, entry); this.backgroundSessions.clear(); for (let entry of this.terminalSessions.values()) entry.promise.then( (session) => session.dispose(), () => { } ); this.terminalSessions.clear(), this.roots.clear(); } async resolveTarget(input) { let context = this.options.terminalContext.getConnectedTerminalById(input.terminalId) ?? this.options.terminalContext.getConnectedTerminalByServerId(input.serverId) ?? (!input.terminalId && !input.serverId ? this.options.terminalContext.getConnectedTerminal() : void 0); if (context) return { terminalId: context.terminalId, server: context.server, context }; if (input.serverId && this.options.resolveBackgroundServer) { let server = await this.options.resolveBackgroundServer(input.serverId); if (!server) throw new Error(`SSH server "${input.serverId}" was not found.`); if (server.backgroundConnectionAllowed !== !0) throw new Error( `SSH server "${server.id}" does not allow background connections. Ask the user to enable "Allow background connections" on the AT Terminal server edit form, or connect an AT Terminal session to that server.` ); return { server }; } throw new Error( "No matching connected AT Terminal SSH session is available. Connect an AT Terminal session first." ); } async leaseFor(target2) { return target2.context ? { session: await this.ensureTerminalSession(target2.context), rootKey: `terminal:${target2.context.terminalId}`, release: () => { } } : await this.leaseBackgroundSession(target2.server); } async ensureTerminalSession(context) { let existing = this.terminalSessions.get(context.terminalId); if (existing) return await existing.promise; let session = this.options.createSession({ server: context.server }), promise = Promise.resolve().then(async () => (await session.connect(), session)).catch((error) => { throw session.dispose(), this.terminalSessions.delete(context.terminalId), error; }); return this.terminalSessions.set(context.terminalId, { serverId: context.server.id, promise }), await promise; } async leaseBackgroundSession(server) { let entry = this.backgroundSessions.get(server.id); (!entry || entry.closed) && (entry = this.openBackgroundSession(server), this.backgroundSessions.set(server.id, entry)), entry.inFlight += 1, entry.idleTimer && (clearTimeout(entry.idleTimer), entry.idleTimer = void 0); let held = entry; try { return { session: await held.ready, rootKey: `server:${server.id}`, release: () => this.releaseBackgroundSession(server.id, held) }; } catch (error) { throw this.releaseBackgroundSession(server.id, held), error; } } openBackgroundSession(server) { let session = this.options.createSession({ server }), entry = { session, inFlight: 0, idleTimer: void 0, closed: !1, ready: Promise.resolve().then(async () => (await session.connect(), session)) }; return entry.ready.catch(() => this.evictBackgroundSession(server.id, entry)), entry; } releaseBackgroundSession(serverId, entry) { entry.inFlight = Math.max(0, entry.inFlight - 1), !(entry.inFlight > 0 || entry.closed || entry.idleTimer) && (entry.idleTimer = setTimeout(() => this.evictBackgroundSession(serverId, entry), BACKGROUND_IDLE_TTL_MS), entry.idleTimer.unref?.()); } evictBackgroundSession(serverId, entry) { entry.closed || (entry.closed = !0, entry.idleTimer && (clearTimeout(entry.idleTimer), entry.idleTimer = void 0), this.backgroundSessions.get(serverId) === entry && (this.backgroundSessions.delete(serverId), this.roots.delete(`server:${serverId}`)), entry.session.dispose()); } async withAudit(tool, input, fn2) { let started = Date.now(); try { let result = await fn2(); return this.options.audit?.record({ tool, serverId: result.serverId ?? input.serverId, terminalId: result.terminalId ?? input.terminalId, path: result.path ?? input.path, reasonCode: "ok", durationMs: Date.now() - started, ...result.truncated === void 0 ? {} : { truncated: result.truncated } }), result; } catch (error) { throw this.options.audit?.record({ tool, serverId: input.serverId, terminalId: input.terminalId, path: input.path, reasonCode: auditReasonForError2(error), durationMs: Date.now() - started }), error; } } async resolvePath(lease, path) { let root = await this.rootFor(lease); return !path || path === "." ? root : path.startsWith("/") ? await lease.session.realpath(path) : await lease.session.realpath(`${root}/${path}`); } async resolveWritablePath(lease, path) { if (!path.trim()) throw new Error("Remote path cannot be empty."); let workspaceRoot = await this.rootFor(lease), normalized = (path.startsWith("/") ? path : joinRemotePath(workspaceRoot, path)).replace(/\/+$/, "") || "/"; if (normalized === "/") throw new Error("Remote root path cannot be modified."); let parent = await lease.session.realpath(dirname(normalized)), resolved = joinRemotePath(parent, basenameRemotePath(normalized)); if (resolved === "/") throw new Error("Remote root path cannot be modified."); return { path: resolved, workspaceRoot }; } async rootFor(lease) { let existing = this.roots.get(lease.rootKey); if (existing) return existing; let root = await lease.session.realpath("."); return this.roots.set(lease.rootKey, root), root; } }; async function pathExists(session, path) { try { return await session.stat(path), !0; } catch (error) { if (isMissingPathError(error)) return !1; throw error; } } async function remoteEntryType(session, path) { let entries = await session.listDirectory(dirname(path)), name2 = basenameRemotePath(path); return entries.find((entry) => entry.name === name2)?.type; } function isMissingPathError(error) { if (!error || typeof error != "object") return !1; let code = error.code; return code === 2 || code === "ENOENT"; } function basenameRemotePath(path) { let normalized = path.replace(/\/+$/, ""), index = normalized.lastIndexOf("/"); return index < 0 ? normalized : normalized.slice(index + 1); } function clampReadBytes(value) { return !Number.isInteger(value) || value === void 0 || value <= 0 ? DEFAULT_READ_BYTES : Math.min(value, MAX_READ_BYTES); } function clampMaxEntries(value) { return !Number.isInteger(value) || value === void 0 || value <= 0 ? DEFAULT_MAX_ENTRIES : Math.min(value, MAX_ENTRIES); } function clampListOffset(value) { return value === void 0 || !Number.isInteger(value) || value <= 0 ? 0 : value; } function resolveReadStart(offset, size) { return offset === void 0 || !Number.isInteger(offset) || offset === 0 ? 0 : offset < 0 ? Math.max(0, size + offset) : Math.min(offset, size); } function looksBinary(buffer) { return buffer.includes(0); } function auditReasonForError2(error) { let message = error instanceof Error ? error.message : String(error); return message.includes("was cancelled") ? "user_cancelled" : message.includes("does not allow background connections") ? "background_denied" : message.includes("Timed out waiting for SFTP") ? "confirmation_timeout" : "error"; } async function withTimeout2(promise, timeoutMs, message) { let timer; try { return await Promise.race([ promise, new Promise((_resolve, reject) => { timer = setTimeout(() => reject(new Error(message)), timeoutMs); }) ]); } finally { timer && clearTimeout(timer); } } // src/agent/remoteWritePolicy.ts function normalizeRemoteDirectory(path) { return path.replace(/\/{2,}/g, "/").replace(/\/+$/, "") || "/"; } function isWithinRemoteDirectory(root, path) { let normalizedRoot = normalizeRemoteDirectory(root), normalizedPath = normalizeRemoteDirectory(path); if (normalizedPath === normalizedRoot) return !0; let prefix = normalizedRoot === "/" ? "/" : `${normalizedRoot}/`; return normalizedPath.startsWith(prefix); } var SENSITIVE_PREFIXES = [ "/etc", "/usr", "/bin", "/sbin", "/lib", "/lib64", "/boot", "/root", "/dev", "/proc", "/sys", "/var/spool/cron" ], SENSITIVE_SEGMENTS = /* @__PURE__ */ new Set([".ssh"]), SENSITIVE_BASENAMES = /* @__PURE__ */ new Set([ "authorized_keys", "authorized_keys2", "crontab", ".bashrc", ".bash_profile", ".bash_login", ".profile", ".zshrc" ]), SENSITIVE_BASENAME_PREFIXES = ["sudoers"], SENSITIVE_BASENAME_SUFFIXES = [".service", ".timer"]; function isSensitiveRemotePath(path) { let normalized = normalizeRemoteDirectory(path), segments = normalized.split("/").filter(Boolean), basename3 = segments.at(-1) ?? ""; return SENSITIVE_PREFIXES.some((prefix) => normalized === prefix || normalized.startsWith(`${prefix}/`)) || segments.some((segment) => SENSITIVE_SEGMENTS.has(segment)) || SENSITIVE_BASENAMES.has(basename3) || SENSITIVE_BASENAME_PREFIXES.some((prefix) => basename3.startsWith(prefix)) ? !0 : SENSITIVE_BASENAME_SUFFIXES.some((suffix) => basename3.endsWith(suffix)); } // src/agent/SftpWriteAuthorizer.ts var DIRECTORY_GRANT_TTL_MS = 900 * 1e3, SftpWriteAuthorizer = class { /** grant key -> expiry timestamp; Infinity for session-lifetime grants. */ grants = /* @__PURE__ */ new Map(); confirm; now; constructor(options = {}) { this.confirm = options.confirm ?? defaultNoConfirmation, this.now = options.now ?? Date.now; } async requireWrite(server, request) { if (shouldAutoApproveSftpWrite(server)) return; let parentDirectory = normalizeRemoteDirectory(dirname(request.path)), sensitive = isSensitiveRemotePath(request.path), outsideWorkspace = !isWithinRemoteDirectory(request.workspaceRoot, request.path), grantKey = `${server.id} ${parentDirectory}`; if (!sensitive && this.hasLiveGrant(grantKey)) return; let allowedScopes = resolveAllowedScopes(sensitive, outsideWorkspace), base = { server, request, parentDirectory, workspaceRoot: normalizeRemoteDirectory(request.workspaceRoot), outsideWorkspace, sensitive }, scope = await this.confirm({ ...base, allowedScopes, stage: "primary" }); if (!scope || !allowedScopes.includes(scope)) throw new Error("SFTP write was cancelled."); if (sensitive) { if (await this.confirm({ ...base, allowedScopes: ["once"], stage: "sensitive-double-check" }) !== "once") throw new Error("SFTP write was cancelled."); return; } scope === "directory" ? this.grants.set(grantKey, this.now() + DIRECTORY_GRANT_TTL_MS) : scope === "session" && this.grants.set(grantKey, Number.POSITIVE_INFINITY); } /** * Deletion is never auto-approved and never remembered: full trust covers write * prompts but not deletes, and no directory or session grant may ever cover a * delete. Every call asks the user; sensitive paths ask twice. */ async requireDelete(server, request) { let parentDirectory = normalizeRemoteDirectory(dirname(request.path)), sensitive = isSensitiveRemotePath(request.path), outsideWorkspace = !isWithinRemoteDirectory(request.workspaceRoot, request.path), base = { server, request, parentDirectory, workspaceRoot: normalizeRemoteDirectory(request.workspaceRoot), outsideWorkspace, sensitive }; if (await this.confirm({ ...base, allowedScopes: ["once"], stage: "primary" }) !== "once") throw new Error("SFTP delete was cancelled."); if (sensitive && await this.confirm({ ...base, allowedScopes: ["once"], stage: "sensitive-double-check" }) !== "once") throw new Error("SFTP delete was cancelled."); } hasLiveGrant(grantKey) { let expiresAt = this.grants.get(grantKey); return expiresAt === void 0 ? !1 : expiresAt <= this.now() ? (this.grants.delete(grantKey), !1) : !0; } }; function resolveAllowedScopes(sensitive, outsideWorkspace) { return sensitive ? ["once"] : outsideWorkspace ? ["once", "directory"] : ["once", "directory", "session"]; } function defaultNoConfirmation() { return Promise.reject( new Error("SFTP write requires human confirmation, but no confirmation channel is available.") ); } // src/policy-runtime/index.ts import { readFile as readFile3 } from "node:fs/promises"; import { join as join4 } from "node:path"; // node_modules/@at-series/command-policy/dist/shell.js init_tree_sitter_runtime(); var C4 = "1.0.0", k3 = "0.1.1", v3 = Object.freeze({ core: "0.1.1", shell: "0.1.1", python: "0.1.0", sqlite: "0.1.1", mysql: "0.1.2", redis: "0.1.1" }), oe4 = Object.freeze({ shell: "tree-sitter-bash@0.25.1", python: "tree-sitter-python@0.25.0", sqlite: "sqlite3-parser@0.7.1/sqlite-3.53.0", mysql: "node-sql-parser@5.4.0/mysql", redis: "redis-command-table@1" }), At = Object.freeze({ schemaVersion: C4, policy: k3, rules: v3, parsers: oe4 }), Y4 = Object.freeze({ allow: 0, review: 1, deny: 2 }); function ae3(e) { let t2 = 1, n = 0; for (let r2 = 0; r2 < e.length; r2 += 1) e.charCodeAt(r2) === 10 && (t2 += 1, n = r2 + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: t2, column: e.length - n + 1 } }; } function U3(e, t2, n, r2) { let s = typeof t2.sourceText == "string" ? t2.sourceText : "", i2 = r2.length > 0 ? r2 : [{ effectCode: `${e}.process.noop`, action: "allow", reasonCode: `${e}.read_only`, kind: "statement", summary: `${e} source has no external effect.` }], l = i2[0]; for (let m3 of i2.slice(1)) Y4[m3.action] > Y4[l.action] && (l = m3); let a2, o = () => a2 ??= ae3(s), c3 = i2.map((m3) => Object.freeze({ kind: m3.kind, location: m3.location ?? o(), redacted: !0, summary: m3.summary })), y4 = i2.map((m3, p3) => Object.freeze({ effectCode: m3.effectCode, action: m3.action, evidenceIndexes: Object.freeze([p3]) })); return Object.freeze({ schemaVersion: C4, action: l.action, effects: Object.freeze(y4), reasonCode: l.reasonCode, evidence: Object.freeze(c3), versions: Object.freeze({ policy: k3, rules: Object.freeze({ core: v3.core, [e]: v3[e] }), parsers: Object.freeze({ [e]: n }) }) }); } var le2 = Object.freeze({ maxInputBytes: 65536, maxAstNodes: 12e3, maxNestingDepth: 64, maxStatements: 512, maxWorkUnits: 1e5 }); function B4(e) { let t2 = { ...le2, ...e }; for (let [n, r2] of Object.entries(t2)) if (!Number.isSafeInteger(r2) || r2 < 1) throw new TypeError(`${n} must be a positive safe integer`); return Object.freeze(t2); } function q3(e, t2) { return e.length * 3 <= t2.maxInputBytes ? !1 : Buffer.byteLength(e, "utf8") > t2.maxInputBytes; } var R3 = class { #e; #t = 0; constructor(t2) { this.#e = t2; } consume(t2 = 1) { return this.#t += t2, this.#t <= this.#e; } }, de3 = /(?:^|[_-])(?:pass(?:word|wd)?|secret|token|api[_-]?key|private[_-]?key|credential|auth)(?:$|[_-])/i, ce3 = /* @__PURE__ */ new Set([".ssh", ".aws", ".azure", ".kube", ".gnupg", ".docker", "credentials", "secrets", "serviceaccount", "service-account"]), ue3 = /^\/proc\/(?:self|\d+)\/(?:environ|cmdline|maps|mem)$/; function w3(e) { let t2 = e.replaceAll("\\", "/").toLowerCase(), n = t2.split("/").filter(Boolean), r2 = n.at(-1) ?? ""; return t2 === "/etc/shadow" || t2 === "/etc/gshadow" || ue3.test(t2) || n.some((s) => ce3.has(s)) || n.some((s, i2) => s === ".config" && n[i2 + 1] === "gcloud") ? !0 : r2 === ".env" || r2.startsWith(".env.") || r2 === ".netrc" || r2 === ".npmrc" || r2 === ".pypirc" || r2 === ".bash_history" || r2 === ".zsh_history" || r2 === "credentials" || r2 === "known_hosts" || /^id_(?:rsa|dsa|ecdsa|ed25519)$/.test(r2) || /\.(?:pem|p12|pfx|key)$/.test(r2) || de3.test(r2); } function G4(e) { let t2 = e.slice(0, Math.max(0, e.indexOf(":"))).trim(); return /^(?:authorization|proxy-authorization|cookie|set-cookie|x-api-key)$/i.test(t2); } function K3(e) { try { let t2 = new URL(e); return t2.username.length > 0 || t2.password.length > 0; } catch { return !0; } } var P3 = Object.freeze({ ANALYSIS_UNAVAILABLE: "policy.analysis_unavailable", INITIALIZATION_FAILED: "policy.initialization_failed", PARSE_FAILED: "policy.parse_failed", RESOURCE_LIMIT_EXCEEDED: "policy.resource_limit_exceeded", UNKNOWN_SEMANTICS: "policy.unknown_semantics", INVALID_DECISION: "policy.invalid_decision" }), fe3 = { "analysis-unavailable": "analysis is unavailable", "initialization-failed": "analyzer initialization failed", "parse-failed": "parsing failed", "resource-limit-exceeded": "an analysis resource limit was exceeded", "unknown-semantics": "semantics are unknown" }; function me3(e) { let t2 = 1, n = 0; for (let r2 = 0; r2 < e.length; r2 += 1) e.charCodeAt(r2) === 10 && (t2 += 1, n = r2 + 1); return { start: { offset: 0, line: 1, column: 1 }, end: { offset: e.length, line: t2, column: e.length - n + 1 } }; } function Z4(e, t2, n) { return { kind: "unknown", location: me3(n), redacted: !0, summary: `${e} source requires review because ${fe3[t2]}.` }; } var ye3 = { "analysis-unavailable": P3.ANALYSIS_UNAVAILABLE, "initialization-failed": P3.INITIALIZATION_FAILED, "parse-failed": P3.PARSE_FAILED, "resource-limit-exceeded": P3.RESOURCE_LIMIT_EXCEEDED, "unknown-semantics": P3.UNKNOWN_SEMANTICS }; function x4({ domain: e, failure: t2, input: n }) { let r2 = typeof n.sourceText == "string" ? n.sourceText : ""; return { schemaVersion: C4, action: "review", effects: [{ effectCode: `${e}.analysis.unknown`, action: "review", evidenceIndexes: [0] }], reasonCode: ye3[t2], evidence: [Z4(e, t2, r2)], versions: { policy: k3, rules: { core: v3.core, [e]: v3[e] }, parsers: { [e]: "unavailable" } } }; } function z4(e, t2, n = {}) { return t2.map((r2) => ({ name: r2, defaultEffect: e, ...n })); } var pe2 = [":", "[", "echo", "false", "groups", "id", "nproc", "printenv", "printf", "pwd", "test", "true", "uname", "uptime", "users", "who", "whoami"], he3 = ["blkid", "df", "dig", "free", "getconf", "getenforce", "host", "iostat", "ipcs", "last", "lastb", "logread", "lscpu", "lsblk", "lsof", "mpstat", "netstat", "nslookup", "pgrep", "pidof", "ps", "top", "vmstat", "w", "whereis", "which"], Ee3 = ["base32", "base64", "cat", "cksum", "cut", "du", "expand", "file", "fold", "hexdump", "ls", "lsattr", "md5sum", "namei", "nl", "od", "readlink", "realpath", "sha1sum", "sha256sum", "sha512sum", "stat", "strings", "tr", "tree", "unexpand", "uniq", "wc", "xxd"], ge3 = ["chattr", "chgrp", "chmod", "chown", "cp", "dd", "install", "kill", "killall", "ln", "mkdir", "mkfifo", "mknod", "mv", "pkill", "reboot", "rename", "rm", "rmdir", "rsync", "shutdown", "sudoedit", "tee", "touch", "truncate", "unlink", "useradd", "userdel", "usermod"], X5 = new Map([...z4("processLocal", pe2), ...z4("read", he3), ...z4("read", Ee3, { operandsAreFiles: !0 }), ...z4("read", ["jq"], { operandsAreFiles: !0, skipFirstOperand: !0 }), ...z4("write", ge3)].map((e) => [e.name, e])), Se3 = ["/bin/", "/sbin/", "/usr/bin/", "/usr/sbin/", "/usr/local/bin/", "/usr/local/sbin/", "/opt/homebrew/bin/", "/opt/homebrew/sbin/"]; function I2(e, t2, n, r2, s = "command") { return { effectCode: e, action: t2, reasonCode: n, summary: r2, kind: s }; } var f3 = () => I2("shell.command.read", "allow", "shell.read_only", "A recognized command has an ordinary read-only contract."), b3 = () => I2("shell.process.local", "allow", "shell.read_only", "A recognized command has only process-local effects."), u3 = () => I2("shell.command.write", "review", "shell.write", "A recognized command may modify state."), d2 = () => I2("shell.command.unknown", "review", "shell.unknown_semantics", "Command semantics are not statically established."), F5 = () => I2("shell.filesystem.sensitive_read", "review", "shell.sensitive_read", "A command may read a sensitive filesystem resource.", "path"); function _4(e) { if (!(!e || e.includes("\0"))) return e.includes("/") ? Se3.some((t2) => e.startsWith(t2) && !e.slice(t2.length).includes("/")) ? e.slice(e.lastIndexOf("/") + 1) : void 0 : /^[a-z0-9][a-z0-9._+-]*$/i.test(e) ? e : void 0; } function S2(e) { return e.some((t2) => t2 === void 0) ? d2() : e.some((t2) => t2 !== void 0 && w3(t2)) ? F5() : f3(); } function L4(e) { let t2 = !1, n = []; for (let r2 of e) r2 === "--" ? t2 = !0 : (r2 === void 0 || t2 || !r2.startsWith("-") || r2 === "-") && n.push(r2); return n; } function ve3(e, t2) { if (e.defaultEffect === "write") return u3(); if (e.defaultEffect === "processLocal") return b3(); if (e.defaultEffect === "unknown") return d2(); if (!e.operandsAreFiles) return f3(); let n = L4(t2); return e.skipFirstOperand ? n.length <= 1 ? f3() : S2(n.slice(1)) : S2(n); } function Q4(e) { return e.length > 0 && e.every((t2) => t2 === "--version" || t2 === "-V" || t2 === "--help" || t2 === "-h"); } function be3(e) { let t2 = L4(e); return t2.length <= 1 ? f3() : S2(t2.slice(1)); } function we3(e) { let t2 = L4(e).filter((n) => n === void 0 || !/^\+?-?\d+$/.test(n)); return S2(t2); } function Pe3(e) { return e.some((t2) => t2 === "-o" || t2 === "--output" || t2?.startsWith("--output=")) ? u3() : S2(L4(e)); } function xe3(e) { let t2 = 0, n = (s) => { for (; t2 < e.length; ) { let i2 = e[t2]; if (i2 === "\\") { t2 += 2; continue; } if (t2 += 1, i2 === s) return !0; if (i2 === ` `) return !1; } return !1; }, r2 = () => { for (; t2 < e.length && e[t2] !== ` `; ) t2 += 1; }; for (; t2 < e.length; ) { let s = e[t2]; if (/[\s;,!$~+]/.test(s)) { t2 += 1; continue; } if (/\d/.test(s)) { t2 += 1; continue; } if (s === "/") { if (t2 += 1, !n("/")) return !0; for (; t2 < e.length && /[IM]/.test(e[t2]); ) t2 += 1; continue; } if (s === "\\") { let i2 = e[t2 + 1]; if (i2 === void 0 || (t2 += 2, !n(i2))) return !0; continue; } if (s === "{" || s === "}") { t2 += 1; continue; } if (s === "#") { r2(); continue; } if (s === "w" || s === "W" || s === "e") return !0; if (s === "s" || s === "y") { let i2 = e[t2 + 1]; if (i2 === void 0 || i2 === ` ` || (t2 += 2, !n(i2) || !n(i2))) return !0; if (s === "s") for (; t2 < e.length && !/[;\n]/.test(e[t2]); ) { let l = e[t2]; if (l === "w" || l === "e" || !/[\dgimpIM\s]/.test(l)) return !0; t2 += 1; } continue; } if (s === "a" || s === "i" || s === "c") { for (t2 += 1; t2 < e.length; ) { if (e[t2] === "\\") { t2 += 2; continue; } if (e[t2] === ` `) break; t2 += 1; } continue; } if (/[btT:]/.test(s)) { for (t2 += 1; t2 < e.length && !/[;\n]/.test(e[t2]); ) t2 += 1; continue; } if (s === "r" || s === "R") { t2 += 1, r2(); continue; } if (/[pPdDgGhHxnNlq=zF]/.test(s) || s === "Q") { t2 += 1; continue; } return !0; } return !1; } var Ae3 = /* @__PURE__ */ new Set(["n", "r", "E", "s", "z", "u"]); function Ce3(e) { let t2 = [], n = [], r2 = !1, s = !1; for (let a2 = 0; a2 < e.length; a2 += 1) { let o = e[a2]; if (o === void 0) return d2(); if (s || !o.startsWith("-") || o === "-") { n.push(o); continue; } if (o === "--") { s = !0; continue; } if (o.startsWith("--")) { if (o === "--in-place" || o.startsWith("--in-place=")) return u3(); if (o === "--file" || o.startsWith("--file=")) return d2(); if (o === "--expression") { r2 = !0, t2.push(e[a2 + 1]), a2 += 1; continue; } if (o.startsWith("--expression=")) { r2 = !0, t2.push(o.slice(13)); continue; } continue; } for (let c3 = 1; c3 < o.length; c3 += 1) { let y4 = o[c3]; if (y4 === "i") return u3(); if (y4 === "f") return d2(); if (y4 === "e") { r2 = !0; let m3 = o.slice(c3 + 1); m3.length > 0 ? t2.push(m3) : (t2.push(e[a2 + 1]), a2 += 1); break; } if (!Ae3.has(y4)) return d2(); } } let i2 = r2 ? t2 : n.slice(0, 1), l = r2 ? n : n.slice(1); return i2.some((a2) => a2 === void 0) ? d2() : i2.some((a2) => a2 !== void 0 && xe3(a2)) ? u3() : S2(l); } function ke3(e) { if (e.some((r2) => r2 !== void 0 && (/^-f/.test(r2) || /^--(?:exec|file|include|load|source)(?:=|$)/.test(r2) || r2 === "-E" || r2 === "-i" || r2 === "-l"))) return d2(); let t2 = J4(e, /* @__PURE__ */ new Set(["-F", "-v", "-W", "--assign", "--field-separator"])), n = t2[0]; return n === void 0 || /\bsystem\s*\(|\|\s*getline\b|\|&|(?:^|[;{])\s*(?:print|printf)\b[^}\n]*[>|]/.test(n) ? d2() : t2.length <= 1 ? f3() : S2(t2.slice(1)); } var ze3 = /* @__PURE__ */ new Set(["cat", "get-default", "help", "is-active", "is-enabled", "is-failed", "is-system-running", "list-dependencies", "list-jobs", "list-machines", "list-sockets", "list-timers", "list-unit-files", "list-units", "show", "show-environment", "status"]); function Ie4(e) { let t2 = e.find((n) => n !== void 0 && !n.startsWith("-")); return !t2 && e.some((n) => ["--all", "--failed", "--state", "--type"].some((r2) => n === r2 || n?.startsWith(`${r2}=`))) || t2 && ze3.has(t2) ? f3() : u3(); } var _e3 = /* @__PURE__ */ new Set(["get", "help", "list", "lst", "save", "show"]); function Le3(e) { if (e.some((n) => n === void 0)) return d2(); let t2 = e.filter((n) => n !== void 0 && !n.startsWith("-")); return t2.length < 2 || _e3.has(t2[1]) ? f3() : u3(); } function Oe3(e) { if (e.some((n) => n === void 0)) return d2(); let t2 = e.filter((n) => n !== void 0 && !n.startsWith("-")); return t2.includes("show") || t2.includes("list") ? f3() : u3(); } var Re3 = /* @__PURE__ */ new Set(["-delete", "-exec", "-execdir", "-fls", "-fprintf", "-fprint", "-fprint0", "-ok", "-okdir"]); function Ne3(e) { if (e.some((n) => Re3.has(n ?? ""))) return u3(); if (e.some((n) => n === void 0)) return d2(); let t2 = []; for (let n of e) { if (n?.startsWith("-")) break; n !== void 0 && t2.push(n); } return S2(t2); } function De3(e) { if (e.some((r2) => r2 === void 0)) return d2(); let t2 = ["--append", "--delete", "--delete-chain", "--flush", "--insert", "--new-chain", "--policy", "--rename-chain", "--replace", "--zero"], n = !1; for (let r2 of e) if (r2) { if (t2.some((s) => r2 === s || r2.startsWith(`${s}=`)) || /^-[^-]/.test(r2) && /[AIDRXPZFNE]/.test(r2.slice(1))) return u3(); (["--check", "--list", "--list-rules"].some((s) => r2 === s || r2.startsWith(`${s}=`)) || /^-[^-]/.test(r2) && /[LSC]/.test(r2.slice(1))) && (n = !0); } return n ? f3() : d2(); } function qe3(e) { return e.some((n) => n === void 0) ? d2() : e.find((n) => n !== void 0 && !n.startsWith("-")) === "list" ? f3() : u3(); } function J4(e, t2) { let n = [], r2 = !1; for (let s = 0; s < e.length; s += 1) { let i2 = e[s]; !r2 && i2 === "--" ? r2 = !0 : !r2 && i2 && t2.has(i2) ? s += 1 : (i2 === void 0 || r2 || !i2.startsWith("-")) && n.push(i2); } return n; } var Te3 = /* @__PURE__ */ new Set(["-d", "--date", "-r", "--reference", "-f", "--file"]); function Fe3(e) { for (let t2 = 0; t2 < e.length; t2 += 1) { let n = e[t2]; if (n === void 0) return d2(); if (n === "-s" || n === "--set" || n.startsWith("--set=")) return u3(); if (!n.startsWith("+")) { if (Te3.has(n)) { t2 += 1; continue; } if (!n.startsWith("-")) return u3(); } } return b3(); } var We3 = /* @__PURE__ */ new Set(["-C", "-c", "--git-dir", "--work-tree", "--namespace", "--exec-path", "--super-prefix"]), je3 = /* @__PURE__ */ new Set(["blame", "cat-file", "describe", "diff", "grep", "help", "log", "ls-files", "ls-remote", "ls-tree", "rev-parse", "show", "status", "version"]); function $e3(e) { for (let t2 = 0; t2 < e.length; t2 += 1) { let n = e[t2]; if (n === void 0) return d2(); if (We3.has(n)) { t2 += 1; continue; } if (!n.startsWith("-")) return je3.has(n) ? f3() : u3(); } return u3(); } function Ve3(e) { let t2 = !1; for (let n = 0; n < e.length; n += 1) { let r2 = e[n]; if (r2 === void 0) return d2(); if (r2 === "-l") { t2 = !0; continue; } if (r2 === "-u") { n += 1; continue; } return u3(); } return t2 ? f3() : u3(); } var He3 = /* @__PURE__ */ new Set(["--config", "--context", "-H", "--host", "-l", "--log-level"]), Me3 = /* @__PURE__ */ new Set(["df", "diff", "events", "history", "images", "info", "inspect", "logs", "port", "ps", "search", "stats", "top", "version"]), Ye3 = { compose: /* @__PURE__ */ new Set(["config", "images", "logs", "ps", "top", "version"]), container: /* @__PURE__ */ new Set(["diff", "inspect", "logs", "ls", "port", "stats", "top"]), image: /* @__PURE__ */ new Set(["history", "inspect", "ls"]), network: /* @__PURE__ */ new Set(["inspect", "ls"]), volume: /* @__PURE__ */ new Set(["inspect", "ls"]) }; function Ue3(e) { let t2 = J4(e, He3); if (t2.some((s) => s === void 0)) return d2(); let n = t2, r2 = n[0]; return r2 && Me3.has(r2) || r2 && n[1] && Ye3[r2]?.has(n[1]) ? f3() : u3(); } function A3(e, t2) { if (e.some((r2) => r2 === void 0)) return d2(); let n = e.find((r2) => r2 !== void 0 && !r2.startsWith("-")); return n && t2.has(n) ? f3() : u3(); } var Be3 = /* @__PURE__ */ new Set(["--anyauth", "--aws-sigv4", "--basic", "--config", "--cookie", "--cookie-jar", "--data", "--data-ascii", "--data-binary", "--data-raw", "--digest", "--form", "--json", "--negotiate", "--netrc", "--netrc-file", "--oauth2-bearer", "--output", "--proxy-header", "--proxy-user", "--request-target", "--upload-file", "--user", "-F", "-T", "-b", "-c", "-d", "-n", "-o", "-u"]), Ge3 = /* @__PURE__ */ new Set(["--compressed", "--fail", "--fail-with-body", "--location", "--no-progress-meter", "--silent", "--show-error", "--verbose"]); function Ke4(e) { let t2 = "GET", n = !1, r2, s = (i2) => e[i2 + 1]; for (let i2 = 0; i2 < e.length; i2 += 1) { let l = e[i2]; if (l === void 0) return d2(); if (n || !l.startsWith("-") || l === "-") { if (r2 !== void 0) return d2(); r2 = l; continue; } if (l === "--") { n = !0; continue; } let [a2, o] = l.startsWith("--") ? l.split(/=(.*)/s, 2) : [l, void 0]; if (a2 === "-I" || a2 === "--head") { t2 = "HEAD"; continue; } if (a2 === "-G" || a2 === "--get") { t2 = "GET"; continue; } if (a2 === "-X" || a2 === "--request") { let c3 = o ?? s(i2); if (o === void 0 && (i2 += 1), !c3) return d2(); t2 = c3.toUpperCase(); continue; } if (a2 === "--url") { let c3 = o ?? s(i2); if (o === void 0 && (i2 += 1), !c3 || r2 !== void 0) return d2(); r2 = c3; continue; } if (a2 === "-H" || a2 === "--header") { let c3 = o ?? s(i2); if (o === void 0 && (i2 += 1), !c3 || G4(c3)) return { ...F5(), effectCode: "shell.http.sensitive", summary: "An HTTP request may expose sensitive authentication data." }; continue; } if (Be3.has(a2) || /^-[^-]*[FTbcCdDkKnoOu]/.test(a2)) return u3(); if (a2.startsWith("--") && !Ge3.has(a2) || a2.startsWith("-") && !/^-[fLsSv]+$/.test(a2)) return d2(); } if (!r2 || t2 !== "GET" && t2 !== "HEAD") return u3(); if (K3(r2) || /(?:^|[?&])(?:access_token|api[_-]?key|auth|password|secret|token)=/i.test(r2) || /^(?:https?:\/\/)?169\.254\.169\.254(?:\/|$)/i.test(r2)) return { ...F5(), effectCode: "shell.http.sensitive", summary: "An HTTP request may access or expose a sensitive resource." }; try { let i2 = new URL(r2); if (i2.protocol !== "http:" && i2.protocol !== "https:") return d2(); } catch { return d2(); } return { ...f3(), effectCode: "shell.http.read", summary: "A static HTTP GET or HEAD request has a read-only contract." }; } function T4(e, t2) { let n = 0, r2 = /* @__PURE__ */ new Set(); if (t2 === "sudo") for (let i2 of ["-C", "-D", "-R", "-T", "-g", "-h", "-p", "-u"]) r2.add(i2); else if (t2 === "nice") r2.add("-n"), r2.add("--adjustment"); else if (t2 === "ionice") for (let i2 of ["-c", "-n", "-t"]) r2.add(i2); else if (t2 === "timeout") for (let i2 of ["-k", "--kill-after", "-s", "--signal"]) r2.add(i2); else if (t2 === "stdbuf") for (let i2 of ["-e", "-i", "-o"]) r2.add(i2); else t2 === "watch" && (r2.add("-n"), r2.add("--interval")); if (t2 === "env") for (; n < e.length; ) { let i2 = e[n]; if (i2 === void 0) return; if (i2 === "--") { n += 1; break; } if (i2 === "-u" || i2 === "--unset") { n += 2; continue; } if (i2 === "-i" || i2 === "--ignore-environment" || i2.startsWith("--unset=")) { n += 1; continue; } if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(i2)) { if (/^(?:BASH_ENV|ENV|LD_|PATH=|PYTHONPATH=|SHELLOPTS=)/.test(i2)) return; n += 1; continue; } break; } else for (; n < e.length; ) { let i2 = e[n]; if (i2 === void 0) return; if (i2 === "--") { n += 1; break; } if (t2 === "time" && (i2 === "-o" || i2 === "-a" || i2 === "--output" || i2.startsWith("--output=") || i2 === "--append")) return; if (t2 === "timeout" && !i2.startsWith("-")) { n += 1; break; } if (r2.has(i2)) { n += 2; continue; } if (i2.startsWith("-") && !/^-\d+$/.test(i2) && !i2.includes("=")) { n += 1; continue; } if (i2.startsWith("--") || t2 === "nice" && /^-\d+$/.test(i2)) { n += 1; continue; } break; } let s = e[n]; if (s) return { name: s, arguments: e.slice(n + 1) }; } var Ze2 = /* @__PURE__ */ new Set(["api-resources", "api-versions", "cluster-info", "describe", "explain", "get", "logs", "top", "version"]), Xe3 = /* @__PURE__ */ new Set(["capabilities", "dominfo", "domstate", "domstats", "dumpxml", "list", "nodeinfo", "nodememstats", "version"]), Qe2 = /* @__PURE__ */ new Set(["status", "show", "list-timezones", "list-locales", "list-keymaps", "help"]), Je2 = /* @__PURE__ */ new Set(["changelog", "depends", "list", "policy", "search", "show"]), et2 = /* @__PURE__ */ new Set(["info", "list", "search"]), tt2 = /* @__PURE__ */ new Set(["list", "ls", "outdated", "ping", "show", "view"]); async function W3(e, t2, n = 0, r2 = _4(e.name)) { let s = r2; if (!s) return [d2()]; let i2 = e.arguments; if (n > 16) return [d2()]; let l = async (o) => o ? await t2?.analyzeEmbedded?.(o) ?? W3(o, t2, n + 1) : [d2()]; if (/^mkfs(?:\.|$)/.test(s)) return [u3()]; let a2 = X5.get(s); if (a2) return [ve3(a2, i2)]; switch (s) { case "grep": case "egrep": case "fgrep": case "rg": return [be3(i2)]; case "head": case "tail": return [we3(i2)]; case "sort": return [Pe3(i2)]; case "sed": return [Ce3(i2)]; case "awk": case "gawk": case "mawk": case "nawk": return [ke3(i2)]; case "find": return [Ne3(i2)]; case "systemctl": return [Ie4(i2)]; case "ip": return [Le3(i2)]; case "tc": return [Oe3(i2)]; case "iptables": case "ip6tables": return [De3(i2)]; case "nft": return [qe3(i2)]; case "docker": case "nerdctl": case "podman": return [Ue3(i2)]; case "kubectl": return [A3(i2, Ze2)]; case "virsh": return [A3(i2, Xe3)]; case "curl": return [Ke4(i2)]; case "ss": return [i2.some((o) => o === void 0) ? d2() : i2.some((o) => o === "--kill" || /^-[^-]*K/.test(o ?? "")) ? u3() : f3()]; case "hostname": return [i2.some((o) => o === void 0) ? d2() : i2.some((o) => o !== void 0 && (!o.startsWith("-") || o === "-F" || o === "--file" || o === "-b")) ? u3() : b3()]; case "date": return [Fe3(i2)]; case "git": return [$e3(i2)]; case "crontab": return [Ve3(i2)]; case "hostnamectl": case "timedatectl": case "localectl": return [A3(i2, Qe2)]; case "sysctl": return [i2.some((o) => o === void 0) ? d2() : i2.some((o) => o === "-w" || o === "--write" || o === "-p" || o === "--load" || o === "--system" || o?.includes("=")) ? u3() : f3()]; case "busybox": { let o = i2[0]; return o ? l({ name: o, arguments: i2.slice(1) }) : [d2()]; } case "command": return i2.some((o) => o === "-v" || o === "-V") && !i2.some((o) => o === void 0) ? [b3()] : l(T4(i2, s)); case "builtin": case "ionice": case "nice": case "nohup": case "setsid": case "stdbuf": case "sudo": case "time": case "timeout": case "watch": return l(T4(i2, s)); case "env": { let o = T4(i2, s); return o ? l(o) : [i2.every((c3) => c3 !== void 0 && !/^(?:BASH_ENV|ENV|LD_|PATH=|PYTHONPATH=|SHELLOPTS=)/.test(c3)) ? b3() : d2()]; } case "bash": case "sh": { let o = i2.findIndex((y4) => y4 !== void 0 && /^-[A-Za-z]*c[A-Za-z]*$/.test(y4)), c3 = o >= 0 ? i2[o + 1] : void 0; return c3 && t2 ? t2.analyzeNestedShell(c3, n + 1) : [d2()]; } case "eval": case "exec": case "source": case ".": return [d2()]; case "journalctl": return [i2.some((o) => ["--flush", "--relinquish-var", "--rotate", "--setup-keys", "--smart-relinquish-var", "--sync", "--update-catalog", "--vacuum-files", "--vacuum-size", "--vacuum-time"].some((c3) => o === c3 || o?.startsWith(`${c3}=`))) ? u3() : f3()]; case "dmesg": return [i2.some((o) => o === "--clear" || o === "--read-clear" || /^-[^-]*[CcDEn]/.test(o ?? "")) ? u3() : f3()]; case "apt": return [A3(i2, Je2)]; case "apt-get": return [i2.some((o) => o === "-s" || o === "--simulate" || o === "--dry-run") ? f3() : u3()]; case "yum": return [A3(i2, et2)]; case "npm": return [A3(i2, tt2)]; case "openssl": return [L4(i2)[0] === "version" || Q4(i2) ? b3() : d2()]; default: return [Q4(i2) ? b3() : d2()]; } } function E3(e) { return [{ effectCode: `shell.embedded.${e}.unknown`, action: "review", reasonCode: "shell.unknown_semantics", kind: "argument", summary: "An embedded-language payload is not statically established." }]; } function j4(e) { return [{ effectCode: `shell.embedded.${e}.sensitive_resource`, action: "review", reasonCode: "shell.sensitive_read", kind: "path", summary: "An embedded-language client may access a sensitive resource." }]; } async function N3(e, t2, n) { try { let r2 = await (await n()).evaluate({ sourceText: t2 }); return [{ effectCode: `shell.embedded.${e}`, action: r2.action, reasonCode: `shell.embedded_${e}_${r2.action}`, kind: "argument", summary: `A static ${e} payload was analyzed by its domain policy.` }]; } catch { return E3(e); } } function nt2(e, t2) { return e.startsWith(`${t2}=`) ? e.slice(t2.length + 1) : void 0; } async function it3(e, t2) { let n = e.arguments.findIndex((s) => s === "-c"); if (n < 0) return E3("python"); let r2 = e.arguments[n + 1]; return r2 ? N3("python", r2, t2.python) : E3("python"); } async function rt2(e, t2) { let n = [], r2 = /* @__PURE__ */ new Set(["-cmd", "-init", "-separator"]); for (let a2 = 0; a2 < e.arguments.length; a2 += 1) { let o = e.arguments[a2]; if (!o || r2.has(o)) return E3("sqlite"); if (o === "--") { n.push(...e.arguments.slice(a2 + 1)); break; } o.startsWith("-") || n.push(o); } let [s, i2] = n; if (!s || !i2 || n.length !== 2) return E3("sqlite"); if (s !== ":memory:" && w3(s)) return j4("sqlite"); let l = ot3(i2); return l === "read" ? [{ effectCode: "shell.embedded.sqlite.meta_read", action: "allow", reasonCode: "shell.read_only", kind: "argument", summary: "A sqlite3 meta-command has a read-only contract." }] : l === "write" ? [{ effectCode: "shell.embedded.sqlite.meta_write", action: "review", reasonCode: "shell.write", kind: "argument", summary: "A sqlite3 meta-command may modify state." }] : N3("sqlite", i2, t2.sqlite); } var st2 = /* @__PURE__ */ new Set(["databases", "dump", "fullschema", "help", "indexes", "indices", "schema", "tables", "version"]); function ot3(e) { let t2 = /^\s*\.([A-Za-z]+)(?:\s|$)/.exec(e); if (!t2) return; let n = t2[1]?.toLowerCase(); if (n) return st2.has(n) ? "read" : "write"; } async function at2(e, t2) { let n, r2 = ["--defaults-extra-file", "--defaults-file", "--login-path", "--password", "--ssl-cert", "--ssl-key", "-p"], s = /* @__PURE__ */ new Set(["--database", "--host", "--port", "--protocol", "--socket", "--user", "-D", "-h", "-P", "-S", "-u"]); for (let i2 = 0; i2 < e.arguments.length; i2 += 1) { let l = e.arguments[i2]; if (!l) return E3("mysql"); if (r2.some((o) => l === o || l.startsWith(`${o}=`)) || /^-p.+/.test(l)) return j4("mysql"); if (l === "-e" || l === "--execute") { n = e.arguments[i2 + 1], i2 += 1; continue; } let a2 = nt2(l, "--execute"); if (a2 !== void 0) { n = a2; continue; } s.has(l) && (i2 += 1); } return n ? N3("mysql", n, t2.mysql) : E3("mysql"); } var lt2 = new TextEncoder(); function dt(e) { return [`*${e.length}\r `, ...e.flatMap((t2) => [`$${lt2.encode(t2).byteLength}\r `, `${t2}\r `])].join(""); } var ct2 = /* @__PURE__ */ new Set(["--no-raw", "--raw", "--quoted-input"]); async function ut2(e, t2) { let n = [], r2 = /* @__PURE__ */ new Set(["--dbnum", "--host", "--port", "--socket", "-h", "-n", "-p", "-s"]), s = /* @__PURE__ */ new Set(["--askpass", "--pass", "--user", "-a"]), i2 = !1; for (let l = 0; l < e.arguments.length; l += 1) { let a2 = e.arguments[l]; if (!a2) return E3("redis"); if (!i2 && s.has(a2)) return j4("redis"); if (!i2 && r2.has(a2)) { l += 1; continue; } !i2 && ct2.has(a2) || (i2 = !0, n.push(a2)); } return n.length > 0 ? N3("redis", dt(n), t2.redis) : E3("redis"); } function ft2(e) { return e.length > 0 && e.every((t2) => t2 === "--version" || t2 === "-V" || t2 === "--help" || t2 === "-h"); } var mt2 = /^python3?(?:\.\d+)*$/; function $4(e) { if (e) { if (mt2.test(e)) return "python"; if (e === "sqlite3") return "sqlite"; if (e === "mysql") return "mysql"; if (e === "redis-cli") return "redis"; } } async function V2(e, t2, n = _4(e.name)) { let r2 = $4(n); if (r2 === "python") return ft2(e.arguments) ? void 0 : it3(e, t2); if (r2 === "sqlite") return rt2(e, t2); if (r2 === "mysql") return at2(e, t2); if (r2 === "redis") return ut2(e, t2); } var yt = /* @__PURE__ */ new Set(["process_substitution", "heredoc_redirect", "herestring_redirect", "function_definition", "coproc", "select_statement"]), pt = /* @__PURE__ */ new Set(["arithmetic_expansion", "brace_expansion", "command_substitution", "expansion", "process_substitution", "simple_expansion", "special_variable_name", "variable_expansion"]); function ht(e) { let t2 = [e]; for (; t2.length > 0; ) { let n = t2.pop(); if (n !== e && pt.has(n.type)) return !0; t2.push(...n.namedChildren); } return !1; } function Et(e) { if (e.includes("\0")) return; let t2 = "", n; for (let r2 = 0; r2 < e.length; r2 += 1) { let s = e[r2]; if (!n && (s === "'" || s === '"')) { n = s; continue; } if (n === s) { n = void 0; continue; } if (s === "\\" && n !== "'") { r2 += 1; let i2 = e[r2]; if (i2 === void 0) return; t2 += i2; continue; } t2 += s; } if (!(n || t2.includes("`"))) return t2; } function H4(e) { if (!(!e || ht(e))) return Et(e.text); } function ee4(e) { return { start: { offset: e.startIndex, line: e.startPosition.row + 1, column: e.startPosition.column + 1 }, end: { offset: e.endIndex, line: e.endPosition.row + 1, column: e.endPosition.column + 1 } }; } function gt(e) { return { name: H4(e.childForFieldName("name")), arguments: e.childrenForFieldName("argument").map((t2) => H4(t2)), location: ee4(e) }; } function St(e) { let t2 = H4(e.childForFieldName("destination")), n = e.text, r2 = t2 === "/dev/null" || t2 === "/dev/stdout" || t2 === "/dev/stderr" || />\s*&(?:1|2|-)\s*$/.test(n), s = "unknown"; return /<>/.test(n) ? s = "read-write" : /(?:^|[^<])>>?|&>/.test(n) ? s = "output" : /<(?![<(])/.test(n) && (s = "input"), { direction: s, target: t2, harmless: r2, location: ee4(e) }; } function M3(e, t2, n) { let r2 = e.parse(t2); if (!r2) return { ok: !1, failure: "resource-limit-exceeded" }; try { if (r2.rootNode.hasError) return { ok: !1, failure: "parse-failed" }; let s = [], i2 = [], l = new R3(n.maxWorkUnits), a2 = [r2.rootNode], o = [1], c3 = 0, y4 = !1, m3 = !1; for (; a2.length > 0; ) { let p3 = a2.pop(), O4 = o.pop(); if (c3 += 1, c3 > n.maxAstNodes || O4 > n.maxNestingDepth || !l.consume()) return { ok: !1, failure: "resource-limit-exceeded" }; if (p3.isError || p3.isMissing) return { ok: !1, failure: "parse-failed" }; let h3 = p3.type; if (yt.has(h3) && (y4 = !0), h3 === "command") { if (s.push(gt(p3)), s.length > n.maxStatements) return { ok: !1, failure: "resource-limit-exceeded" }; } else h3 === "file_redirect" && i2.push(St(p3)); let g4 = O4 + 1; for (let D4 of p3.children) D4.type === "&" && (m3 = !0), a2.push(D4), o.push(g4); } return { ok: !0, ir: { commands: s, redirects: i2, unsupported: y4, background: m3 } }; } finally { r2.delete(); } } var bt = "tree-sitter-bash@0.25.1"; function wt(e) { return e.harmless ? { effectCode: "shell.process.redirect", action: "allow", reasonCode: "shell.read_only", kind: "path", summary: "A file descriptor redirect has only process-local effects." } : e.direction === "input" ? e.target ? w3(e.target) ? { effectCode: "shell.filesystem.sensitive_read", action: "review", reasonCode: "shell.sensitive_read", kind: "path", summary: "An input redirect may read a sensitive filesystem resource." } : { effectCode: "shell.filesystem.read", action: "allow", reasonCode: "shell.read_only", kind: "path", summary: "An input redirect reads an ordinary filesystem resource." } : { effectCode: "shell.filesystem.unknown_read", action: "review", reasonCode: "shell.unknown_semantics", kind: "path", summary: "An input redirect target is not statically established." } : e.direction === "output" || e.direction === "read-write" ? { effectCode: "shell.filesystem.write", action: "review", reasonCode: "shell.write", kind: "path", summary: "An output redirect may modify a filesystem resource." } : { effectCode: "shell.redirect.unknown", action: "review", reasonCode: "shell.unknown_semantics", kind: "path", summary: "Redirect semantics are not statically established." }; } function Pt() { return { effectCode: "shell.syntax.unsupported", action: "review", reasonCode: "shell.unknown_semantics", kind: "statement", summary: "The script contains unsupported shell syntax." }; } function te4() { return { effectCode: "shell.nested.unknown", action: "review", reasonCode: "shell.unknown_semantics", kind: "statement", summary: "A nested shell payload could not be completely analyzed." }; } function ne5(e, t2) { return t2 ? e.map((n) => ({ ...n, location: t2 })) : e; } function ie4(e) { let t2 = B4(e.limits), n, r2 = () => (n ??= it("tree-sitter-bash", e.assetResolver), n); return { async evaluate(s) { let i2 = typeof s.sourceText == "string" ? s.sourceText : ""; if (i2.trim().length === 0) return x4({ domain: "shell", failure: "parse-failed", input: s }); if (q3(i2, t2)) return x4({ domain: "shell", failure: "resource-limit-exceeded", input: s }); let l; try { l = await r2(); } catch { return x4({ domain: "shell", failure: "initialization-failed", input: s }); } let a2; try { a2 = M3(l, i2, t2); } catch { return x4({ domain: "shell", failure: "parse-failed", input: s }); } if (!a2.ok) return x4({ domain: "shell", failure: a2.failure, input: s }); let o = async (y4, m3) => { let p3 = [], O4 = async (h3) => { if (m3 >= t2.maxNestingDepth || q3(h3, t2)) return [te4()]; let g4 = M3(l, h3, t2); return g4.ok ? await o(g4.ir, m3 + 1) : [te4()]; }; for (let h3 of y4.commands) { let g4 = _4(h3.name), re3 = ($4(g4) ? await V2(h3, e.embeddedEvaluators, g4) : void 0) ?? await W3(h3, { analyzeNestedShell: O4, analyzeEmbedded: (se3) => V2(se3, e.embeddedEvaluators) }, 0, g4); p3.push(...ne5(re3, h3.location)); } for (let h3 of y4.redirects) p3.push(...ne5([wt(h3)], h3.location)); return y4.unsupported && p3.push(Pt()), y4.background && p3.push({ effectCode: "shell.process.detached", action: "review", reasonCode: "shell.background_execution", kind: "statement", summary: "The script may start detached background execution." }), p3; }, c3 = await o(a2.ir, 0); return U3("shell", s, bt, c3); } }; } function sn2(e = {}) { let t2, n, r2, s; return ie4({ ...e, embeddedEvaluators: { python() { return t2 ??= Promise.resolve().then(() => (init_python(), python_exports)).then(({ createPythonPolicyEvaluator: i2 }) => i2(e)), t2; }, sqlite() { return n ??= Promise.resolve().then(() => (init_sqlite(), sqlite_exports)).then(({ createSqlitePolicyEvaluator: i2 }) => i2(e.limits ? { limits: e.limits } : {})), n; }, mysql() { return r2 ??= Promise.resolve().then(() => (init_mysql(), mysql_exports)).then(({ createMysqlPolicyEvaluator: i2 }) => i2(e.limits ? { limits: e.limits } : {})), r2; }, redis() { return s ??= Promise.resolve().then(() => (init_redis(), redis_exports)).then(({ createRedisPolicyEvaluator: i2 }) => i2(e.limits ? { limits: e.limits } : {})), s; } } }); } // src/policy-runtime/index.ts function createTerminalPolicyRuntime(options = {}) { let assetDirectory = options.assetDirectory, assetResolver = assetDirectory ? async (asset) => readFile3(join4(assetDirectory, asset.fileName)) : void 0; return sn2(assetResolver ? { assetResolver } : {}); } // src/core/emitter.ts function defaultListenerErrorHandler(error) { console.error("[at-terminal] event listener threw", error); } var Emitter = class { listeners = []; onListenerError; constructor(options = {}) { this.onListenerError = options.onListenerError ?? defaultListenerErrorHandler; } /** * Same as VS Code: returns the same function instance, so it is safe to take/compare * repeatedly. */ event = (listener, thisArgs, disposables) => { let listeners = this.listeners; if (listeners === void 0) return noopDisposable; let entry = { listener, thisArgs }; listeners.push(entry); let subscription = toDisposable(() => { let current2 = this.listeners; if (current2 === void 0) return; let index = current2.indexOf(entry); index >= 0 && current2.splice(index, 1); }); return disposables && disposables.push(subscription), subscription; }; fire(event) { let listeners = this.listeners; if (!(listeners === void 0 || listeners.length === 0)) { for (let entry of listeners.slice()) if (!(listeners.indexOf(entry) < 0)) try { entry.listener.call(entry.thisArgs, event); } catch (error) { this.onListenerError(error); } } } dispose() { this.listeners !== void 0 && (this.listeners = void 0); } }; // src/terminal/TerminalContext.ts var TerminalContextRegistry = class { onDidChangeActiveContextEmitter = new Emitter(); onDidChangeContextEmitter = new Emitter(); onDidRemoveContextEmitter = new Emitter(); onDidChangeActiveContext = this.onDidChangeActiveContextEmitter.event; onDidChangeContext = this.onDidChangeContextEmitter.event; onDidRemoveContext = this.onDidRemoveContextEmitter.event; active; contexts = /* @__PURE__ */ new Map(); lastConnectedTerminalId; getActive() { return this.active; } getConnectedTerminal() { if (this.active?.connected) return this.active; let lastConnected = this.lastConnectedTerminalId ? this.contexts.get(this.lastConnectedTerminalId) : void 0; return lastConnected?.connected ? lastConnected : this.findMostRecentConnected(); } getConnectedTerminalById(terminalId) { if (!terminalId) return; let context = this.contexts.get(terminalId); return context?.connected ? context : void 0; } getConnectedTerminalByServerId(serverId) { if (serverId) return Array.from(this.contexts.values()).reverse().find((context) => context.connected && context.server.id === serverId); } getSnapshot() { let defaultConnected = this.getConnectedTerminal(), knownTerminals = Array.from(this.contexts.values()).map( (context) => this.toSummary(context, defaultConnected) ); return { focusedTerminal: this.active ? this.toSummary(this.active, defaultConnected) : void 0, defaultConnectedTerminal: defaultConnected ? this.toSummary(defaultConnected, defaultConnected) : void 0, connectedTerminals: knownTerminals.filter((terminal) => terminal.connected), knownTerminals }; } setActive(context) { if (this.contexts.set(context.terminalId, context), context.connected ? this.lastConnectedTerminalId = context.terminalId : this.lastConnectedTerminalId === context.terminalId && (this.lastConnectedTerminalId = this.findMostRecentConnected()?.terminalId), this.active?.terminalId === context.terminalId && this.active.connected === context.connected && this.active.server.id === context.server.id) { this.active = context, this.onDidChangeContextEmitter.fire(context); return; } this.active = context, this.onDidChangeContextEmitter.fire(context), this.onDidChangeActiveContextEmitter.fire(context); } markConnected(terminalId) { this.updateConnectionState(terminalId, !0); } markDisconnected(terminalId) { this.updateConnectionState(terminalId, !1); } updateServer(server) { let activeUpdated = !1; for (let [terminalId, context] of this.contexts) if (context.server.id === server.id) { let updated = { ...context, server }; this.contexts.set(terminalId, updated), this.onDidChangeContextEmitter.fire(updated), this.active?.terminalId === terminalId && (this.active = updated, activeUpdated = !0); } activeUpdated && this.active && this.onDidChangeActiveContextEmitter.fire(this.active); } clearIfActive(terminalId) { this.contexts.delete(terminalId) && this.onDidRemoveContextEmitter.fire(terminalId), this.lastConnectedTerminalId === terminalId && (this.lastConnectedTerminalId = this.findMostRecentConnected()?.terminalId), this.active?.terminalId === terminalId && (this.active = void 0, this.onDidChangeActiveContextEmitter.fire(void 0)); } updateConnectionState(terminalId, connected) { let existing = this.contexts.get(terminalId); if (!existing) return; let updated = { ...existing, connected }; this.contexts.set(terminalId, updated), connected ? this.lastConnectedTerminalId = terminalId : this.lastConnectedTerminalId === terminalId && (this.lastConnectedTerminalId = this.findMostRecentConnected()?.terminalId), this.onDidChangeContextEmitter.fire(updated), this.active?.terminalId === terminalId && (this.active = updated, this.onDidChangeActiveContextEmitter.fire(updated)); } findMostRecentConnected() { return Array.from(this.contexts.values()).reverse().find((context) => context.connected); } toSummary(context, defaultConnected) { return { terminalId: context.terminalId, serverId: context.server.id, label: context.server.label, host: context.server.host, port: context.server.port, username: context.server.username, connected: context.connected, focused: this.active?.terminalId === context.terminalId, default: defaultConnected?.terminalId === context.terminalId }; } }; // src/utils/commandPreview.ts function truncateCommandPreview(command, maxLines = 20, maxChars = 800) { let totalChars = command.length, totalLines = command.length === 0 ? 0 : command.split(` `).length, preview = command, lines = command.split(` `); return lines.length > maxLines && (preview = lines.slice(0, maxLines).join(` `)), preview.length > maxChars && (preview = preview.slice(0, maxChars)), preview !== command ? `${preview} \u2026 (truncated, ${totalChars} chars, ${totalLines} lines)` : command; } function formatRemoteCommandConfirmMessage(options) { let preview = truncateCommandPreview(options.command), warning = options.destructive ? ` Warning: this command appears destructive.` : "", uniqueSummaries = [...new Set((options.riskSummaries ?? []).filter((summary) => summary.length > 0))], risks = uniqueSummaries.length === 0 ? "" : ` ${uniqueSummaries.map((summary) => `- ${summary}`).join(` `)}`; return `Run remote command on ${options.serverLabel} (${options.host})? ${preview}${warning}${risks}`; } // src/platform/dsh/confirmation.ts var DshAgentConfirmation = class { constructor(options) { this.options = options; } async confirmCommand(request) { if (request.signal?.aborted) return !1; let approval = this.options.resolveApproval(), callCtx = this.options.getCurrentCallContext(); if (callCtx?.signal?.aborted) return !1; if (!approval || !callCtx?.agent) throw new Error( `Command "${request.command}" requires approval, but no human approval channel is available.` ); let reason = request.destructive ? `\u26A0\uFE0F Destructive command warning: ${request.command}` : `Remote command requires confirmation: ${request.command}`, baseMessage = formatRemoteCommandConfirmMessage({ serverLabel: request.serverLabel, host: request.host, command: request.command, destructive: request.destructive, riskSummaries: request.riskSummaries }), displayReason = request.destructive ? `\u26A0\uFE0F Destructive command warning: this command appears destructive! ${baseMessage}` : baseMessage; return await approval.request({ agent: callCtx.agent, toolName: "run_remote_command", callId: callCtx.callId, reason, displayReason, signal: request.signal ?? callCtx.signal }) === "allowed-once"; } async confirmSftpWrite(confirmation) { let approval = this.options.resolveApproval(), callCtx = this.options.getCurrentCallContext(); if (callCtx?.signal?.aborted) return; if (!approval || !callCtx?.agent) throw new Error( `SFTP write to "${confirmation.request.path}" requires approval, but no approval channel is available.` ); let reason = confirmation.stage === "sensitive-double-check" ? `Double confirmation required for sensitive path: ${confirmation.request.path}` : `SFTP write requested: ${confirmation.request.path}`, displayReason = formatSftpWriteConfirmMessage(confirmation); return await approval.request({ agent: callCtx.agent, toolName: confirmation.request.operation, callId: callCtx.callId, reason, displayReason, signal: callCtx.signal }) === "allowed-once" ? "once" : void 0; } }; function formatSftpWriteConfirmMessage(confirmation) { let { server, request } = confirmation, isDelete = request.operation === "delete_file", warnings = []; return confirmation.outsideWorkspace && warnings.push( `WARNING: outside the working directory ${confirmation.workspaceRoot} that this session was opened in.` ), confirmation.sensitive && warnings.push("WARNING: sensitive system path (SSH keys, service units, cron, or system configuration)."), confirmation.stage === "sensitive-double-check" ? [ `Double confirmation required: ${request.path} is a sensitive system path on ${server.label} (${server.host}).`, "", isDelete ? "Deleting here can break logins, services, or scheduled jobs on the server." : "Writing here can grant persistent access: authorized keys, sudo rules, cron entries and service units survive without you.", "", "Confirm to allow this single operation." ].join(` `) : [ `Allow AT Terminal agent SFTP ${isDelete ? "deletion" : "write"} on ${server.label} (${server.host})?`, "", `Operation: ${request.operation}`, `Path: ${request.path}`, `Folder: ${confirmation.parentDirectory}`, ...request.overwrite !== void 0 ? [`Overwrite: ${request.overwrite ? "yes" : "no"}`] : [], ...warnings.length > 0 ? ["", ...warnings] : [] ].join(` `); } // src/platform/dsh/agent.ts function resolveDshPolicyAssetDirectory() { try { let here = typeof __filename < "u" ? dirname2(__filename) : dirname2(fileURLToPath2(import.meta.url)), localAssets = join5(here, "policy-assets"); if (existsSync(localAssets)) return localAssets; let distAssets = join5(here, "..", "dist", "policy-assets"); if (existsSync(distAssets)) return distAssets; } catch { } try { let pkg = (typeof __filename < "u" ? createRequire2(__filename) : createRequire2(import.meta.url)).resolve("@at-series/command-policy/package.json"), moduleAssets = join5(dirname2(pkg), "dist", "assets"); if (existsSync(moduleAssets)) return moduleAssets; } catch { } } function createDshPolicyEvaluator() { let assetDirectory = resolveDshPolicyAssetDirectory(); return createTerminalPolicyRuntime(assetDirectory ? { assetDirectory } : {}); } function createDshAgentToolService(options) { let { platform: platform2 } = options, configManager = new ConfigManager(platform2.state, platform2.secrets), hostKeyStore = new HostKeyStore(platform2.state), hostKeyVerifier = { async verify(host, port, fingerprint) { return await hostKeyStore.check(host, port, fingerprint) === "trusted"; } }, terminalContext = options.terminalContext ?? new TerminalContextRegistry(), confirmation = new DshAgentConfirmation({ resolveApproval: options.resolveApproval, getCurrentCallContext: options.getCurrentCallContext }), executor = new RemoteCommandExecutor(configManager, hostKeyVerifier), writeAuthorizer = new SftpWriteAuthorizer({ confirm: (req) => confirmation.confirmSftpWrite(req) }), sftp = new SftpAgentService({ terminalContext, createSession: (target2) => new SftpSession(target2.server, configManager, hostKeyVerifier, { allowSudoFallback: !1 }), authorizer: writeAuthorizer, resolveBackgroundServer: (serverId) => configManager.getServer(serverId) }), policyEvaluator = options.policyEvaluator ?? createDshPolicyEvaluator(); return new AgentToolService({ configManager, terminalContext, executor, sftp, confirmation, policyEvaluator }); } // src/platform/dsh/entry.ts function importedPrivateKeyDirectory(platform2) { return assetPrivateKeyDirectory(platform2.environment.storageDir); } var ASSET_ERROR_WRONG_PASSWORD = "wrong-password", ASSET_ERROR_UNREADABLE_PACKAGE = "unreadable-package"; function createDshAssetApi(options) { let { platform: platform2 } = options, configManager = new ConfigManager(platform2.state, platform2.secrets), privateKeyDirectory = assetPrivateKeyDirectory(platform2.environment.storageDir), generateId = options.generateId ?? (() => randomUUID3()); async function listPrivateKeyFiles() { try { return await readdir(privateKeyDirectory); } catch { return []; } } return { async summary() { let servers = await configManager.listServers(), passwords = 0; for (let server of servers) server.authType === "password" && await configManager.getPassword(server.id) !== void 0 && (passwords += 1); let files = await listPrivateKeyFiles(); return { servers: servers.length, passwords, privateKeyFiles: files.length, privateKeyDirectory }; }, async export(request) { if (typeof request?.packagePassword != "string" || request.packagePassword.length === 0) throw Object.assign(new Error("a package password is required"), { code: "bad-params" }); let payload = await createAssetExportPayload({ servers: await configManager.listServers(), includePasswords: request.includePasswords === !0, includePrivateKeys: request.includePrivateKeys === !0, extensionName: options.hostName, extensionVersion: options.hostVersion, getPassword: (id) => configManager.getPassword(id) }); return { // Same default name as the VS Code command, so a user comparing the two sees // the same file rather than wondering whether they are different formats. filename: `at-terminal-assets${ASSET_PACKAGE_EXTENSION}`, envelope: await encryptAssetPayload(payload, request.packagePassword), omissions: payload.omissions.length }; }, async importPackage(request) { if (typeof request?.packagePassword != "string" || request.packagePassword.length === 0) throw Object.assign(new Error("the package password is required"), { code: "bad-params" }); let strategy = request.strategy ?? "skip"; if (strategy !== "skip" && strategy !== "overwrite" && strategy !== "rename") throw Object.assign(new Error(`unknown conflict strategy "${String(request.strategy)}"`), { code: "bad-params" }); let envelope; if (typeof request.envelope == "string") try { envelope = JSON.parse(request.envelope); } catch { throw Object.assign( new Error("the chosen file is not an AT Terminal asset package: its contents are not JSON"), { code: ASSET_ERROR_UNREADABLE_PACKAGE } ); } else envelope = request.envelope; if (envelope === null || typeof envelope != "object") throw Object.assign(new Error("the chosen file is not an AT Terminal asset package"), { code: ASSET_ERROR_UNREADABLE_PACKAGE }); try { parseAssetPackageEnvelope(envelope); } catch { throw Object.assign( new Error("the chosen file is not an AT Terminal asset package: its header is missing or from another format"), { code: ASSET_ERROR_UNREADABLE_PACKAGE } ); } let payload; try { payload = await decryptAssetPayload(envelope, request.packagePassword); } catch (error) { let message = error instanceof Error ? error.message : String(error); throw Object.assign(new Error(message), { code: message === ASSET_PACKAGE_UNREADABLE_MESSAGE ? ASSET_ERROR_UNREADABLE_PACKAGE : ASSET_ERROR_WRONG_PASSWORD }); } return { summary: await applyAssetImport({ payload, conflictStrategy: strategy, privateKeyDirectory, // `ConfigManager.saveServer(server, password)` is the same two-method store the // VS Code variant passes, so an import here and an import there leave the same // state behind: records in the keyed store, passwords in the credential store, // key files in the directory above. store: configManager, generateId }) }; } }; } export { ASSET_ERROR_UNREADABLE_PACKAGE, ASSET_ERROR_WRONG_PASSWORD, AT_TERMINAL_STATE_DOMAIN, AT_TERMINAL_STATE_TABLE, DshAgentConfirmation, SFTP_ERROR_BAD_PARAMS, SFTP_ERROR_BINARY_FILE, SFTP_ERROR_CONFLICT, SFTP_ERROR_DISCONNECTED, SFTP_ERROR_FILE_TOO_LARGE, SFTP_ERROR_NOT_A_FILE, SFTP_ERROR_NO_ACTIVE_TERMINAL, SFTP_ERROR_NO_SUCH_FILE, SFTP_ERROR_PERMISSION_DENIED, SFTP_ERROR_READ_FAILED, SFTP_ERROR_WRITE_FAILED, SFTP_TEXT_MAX_BYTES, SFTP_TRANSFER_MAX_BYTES, TerminalContextRegistry, createDshAgentToolService, createDshAssetApi, createDshPlatform, createDshPolicyEvaluator, createDshServerApi, createDshSftpApi, createDshTerminalApi, formatSftpWriteConfirmMessage, importedPrivateKeyDirectory, resolveDshPolicyAssetDirectory };