{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Batch = exports.Stmt = void 0;\nconst util_js_1 = require(\"../util.js\");\nfunction Stmt(w, msg) {\n if (msg.sql !== undefined) {\n w.string(1, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(2, msg.sqlId);\n }\n for (const arg of msg.args) {\n w.message(3, arg, Value);\n }\n for (const arg of msg.namedArgs) {\n w.message(4, arg, NamedArg);\n }\n w.bool(5, msg.wantRows);\n}\nexports.Stmt = Stmt;\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nfunction Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\nexports.Batch = Batch;\nfunction BatchStep(w, msg) {\n if (msg.condition !== undefined) {\n w.message(1, msg.condition, BatchCond);\n }\n w.message(2, msg.stmt, Stmt);\n}\nfunction BatchCond(w, msg) {\n if (msg.type === \"ok\") {\n w.uint32(1, msg.step);\n } else if (msg.type === \"error\") {\n w.uint32(2, msg.step);\n } else if (msg.type === \"not\") {\n w.message(3, msg.cond, BatchCond);\n } else if (msg.type === \"and\") {\n w.message(4, msg.conds, BatchCondList);\n } else if (msg.type === \"or\") {\n w.message(5, msg.conds, BatchCondList);\n } else if (msg.type === \"is_autocommit\") {\n w.message(6, undefined, Empty);\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of BatchCond\");\n }\n}\nfunction BatchCondList(w, msg) {\n for (const cond of msg) {\n w.message(1, cond, BatchCond);\n }\n}\nfunction Value(w, msg) {\n if (msg === null) {\n w.message(1, undefined, Empty);\n } else if (typeof msg === \"bigint\") {\n w.sint64(2, msg);\n } else if (typeof msg === \"number\") {\n w.double(3, msg);\n } else if (typeof msg === \"string\") {\n w.string(4, msg);\n } else if (msg instanceof Uint8Array) {\n w.bytes(5, msg);\n } else if (msg === undefined) {\n // do nothing\n } else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of Value\");\n }\n}\nfunction Empty(_w, _msg) {\n // do nothing\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","Batch","Stmt","util_js_1","require","w","msg","sql","undefined","string","sqlId","int32","arg","args","message","Value","namedArgs","NamedArg","bool","wantRows","name","step","steps","BatchStep","condition","BatchCond","stmt","type","uint32","cond","conds","BatchCondList","Empty","impossible","sint64","double","Uint8Array","bytes","_w","_msg"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/shared/protobuf_encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Batch = exports.Stmt = void 0;\nconst util_js_1 = require(\"../util.js\");\nfunction Stmt(w, msg) {\n if (msg.sql !== undefined) {\n w.string(1, msg.sql);\n }\n if (msg.sqlId !== undefined) {\n w.int32(2, msg.sqlId);\n }\n for (const arg of msg.args) {\n w.message(3, arg, Value);\n }\n for (const arg of msg.namedArgs) {\n w.message(4, arg, NamedArg);\n }\n w.bool(5, msg.wantRows);\n}\nexports.Stmt = Stmt;\nfunction NamedArg(w, msg) {\n w.string(1, msg.name);\n w.message(2, msg.value, Value);\n}\nfunction Batch(w, msg) {\n for (const step of msg.steps) {\n w.message(1, step, BatchStep);\n }\n}\nexports.Batch = Batch;\nfunction BatchStep(w, msg) {\n if (msg.condition !== undefined) {\n w.message(1, msg.condition, BatchCond);\n }\n w.message(2, msg.stmt, Stmt);\n}\nfunction BatchCond(w, msg) {\n if (msg.type === \"ok\") {\n w.uint32(1, msg.step);\n }\n else if (msg.type === \"error\") {\n w.uint32(2, msg.step);\n }\n else if (msg.type === \"not\") {\n w.message(3, msg.cond, BatchCond);\n }\n else if (msg.type === \"and\") {\n w.message(4, msg.conds, BatchCondList);\n }\n else if (msg.type === \"or\") {\n w.message(5, msg.conds, BatchCondList);\n }\n else if (msg.type === \"is_autocommit\") {\n w.message(6, undefined, Empty);\n }\n else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of BatchCond\");\n }\n}\nfunction BatchCondList(w, msg) {\n for (const cond of msg) {\n w.message(1, cond, BatchCond);\n }\n}\nfunction Value(w, msg) {\n if (msg === null) {\n w.message(1, undefined, Empty);\n }\n else if (typeof msg === \"bigint\") {\n w.sint64(2, msg);\n }\n else if (typeof msg === \"number\") {\n w.double(3, msg);\n }\n else if (typeof msg === \"string\") {\n w.string(4, msg);\n }\n else if (msg instanceof Uint8Array) {\n w.bytes(5, msg);\n }\n else if (msg === undefined) {\n // do nothing\n }\n else {\n throw (0, util_js_1.impossible)(msg, \"Impossible type of Value\");\n }\n}\nfunction Empty(_w, _msg) {\n // do nothing\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,KAAK,GAAGF,OAAO,CAACG,IAAI,GAAG,KAAK,CAAC;AACrC,MAAMC,SAAS,GAAGC,OAAO,CAAC,YAAY,CAAC;AACvC,SAASF,IAAIA,CAACG,CAAC,EAAEC,GAAG,EAAE;EAClB,IAAIA,GAAG,CAACC,GAAG,KAAKC,SAAS,EAAE;IACvBH,CAAC,CAACI,MAAM,CAAC,CAAC,EAAEH,GAAG,CAACC,GAAG,CAAC;EACxB;EACA,IAAID,GAAG,CAACI,KAAK,KAAKF,SAAS,EAAE;IACzBH,CAAC,CAACM,KAAK,CAAC,CAAC,EAAEL,GAAG,CAACI,KAAK,CAAC;EACzB;EACA,KAAK,MAAME,GAAG,IAAIN,GAAG,CAACO,IAAI,EAAE;IACxBR,CAAC,CAACS,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEG,KAAK,CAAC;EAC5B;EACA,KAAK,MAAMH,GAAG,IAAIN,GAAG,CAACU,SAAS,EAAE;IAC7BX,CAAC,CAACS,OAAO,CAAC,CAAC,EAAEF,GAAG,EAAEK,QAAQ,CAAC;EAC/B;EACAZ,CAAC,CAACa,IAAI,CAAC,CAAC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