{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.writeJsonObject = exports.ObjectWriter = void 0;\nclass ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n } else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexports.ObjectWriter = ObjectWriter;\nfunction writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}\nexports.writeJsonObject = writeJsonObject;","map":{"version":3,"names":["Object","defineProperty","exports","value","writeJsonObject","ObjectWriter","output","isFirst","constructor","begin","push","end","key","#key","name","string","JSON","stringify","stringRaw","number","boolean","object","valueFun","arrayObjects","values","i","length","fun","writer","join"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/encoding/json/encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.writeJsonObject = exports.ObjectWriter = void 0;\nclass ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n }\n else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexports.ObjectWriter = ObjectWriter;\nfunction writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}\nexports.writeJsonObject = writeJsonObject;\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,eAAe,GAAGF,OAAO,CAACG,YAAY,GAAG,KAAK,CAAC;AACvD,MAAMA,YAAY,CAAC;EACf,CAACC,MAAM;EACP,CAACC,OAAO;EACRC,WAAWA,CAACF,MAAM,EAAE;IAChB,IAAI,CAAC,CAACA,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACC,OAAO,GAAG,KAAK;EACzB;EACAE,KAAK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