{"ast":null,"code":"\"use strict\";\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = {\n enumerable: true,\n get: function () {\n return m[k];\n }\n };\n }\n Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Sqlite3Transaction = exports.Sqlite3Client = exports._createClient = exports.createClient = void 0;\nconst libsql_1 = __importDefault(require(\"libsql\"));\nconst node_buffer_1 = require(\"node:buffer\");\nconst api_1 = require(\"@libsql/core/api\");\nconst config_1 = require(\"@libsql/core/config\");\nconst util_1 = require(\"@libsql/core/util\");\n__exportStar(require(\"@libsql/core/api\"), exports);\nfunction createClient(config) {\n return _createClient((0, config_1.expandConfig)(config, true));\n}\nexports.createClient = createClient;\n/** @private */\nfunction _createClient(config) {\n if (config.scheme !== \"file\") {\n throw new api_1.LibsqlError(`URL scheme ${JSON.stringify(config.scheme + \":\")} is not supported by the local sqlite3 client. ` + `For more information, please read ${util_1.supportedUrlLink}`, \"URL_SCHEME_NOT_SUPPORTED\");\n }\n const authority = config.authority;\n if (authority !== undefined) {\n const host = authority.host.toLowerCase();\n if (host !== \"\" && host !== \"localhost\") {\n throw new api_1.LibsqlError(`Invalid host in file URL: ${JSON.stringify(authority.host)}. ` + 'A \"file:\" URL with an absolute path should start with one slash (\"file:/absolute/path.db\") ' + 'or with three slashes (\"file:///absolute/path.db\"). ' + `For more information, please read ${util_1.supportedUrlLink}`, \"URL_INVALID\");\n }\n if (authority.port !== undefined) {\n throw new api_1.LibsqlError(\"File URL cannot have a port\", \"URL_INVALID\");\n }\n if (authority.userinfo !== undefined) {\n throw new api_1.LibsqlError(\"File URL cannot have username and password\", \"URL_INVALID\");\n }\n }\n let isInMemory = (0, config_1.isInMemoryConfig)(config);\n if (isInMemory && config.syncUrl) {\n throw new api_1.LibsqlError(`Embedded replica must use file for local db but URI with in-memory mode were provided instead: ${config.path}`, \"URL_INVALID\");\n }\n let path = config.path;\n if (isInMemory) {\n // note: we should prepend file scheme in order for SQLite3 to recognize :memory: connection query parameters\n path = `${config.scheme}:${config.path}`;\n }\n const options = {\n authToken: config.authToken,\n encryptionKey: config.encryptionKey,\n syncUrl: config.syncUrl,\n syncPeriod: config.syncInterval\n };\n const db = new libsql_1.default(path, options);\n executeStmt(db, \"SELECT 1 AS checkThatTheDatabaseCanBeOpened\", config.intMode);\n return new Sqlite3Client(path, options, db, config.intMode);\n}\nexports._createClient = _createClient;\nclass Sqlite3Client {\n #path;\n #options;\n #db;\n #intMode;\n closed;\n protocol;\n /** @private */\n constructor(path, options, db, intMode) {\n this.#path = path;\n this.#options = options;\n this.#db = db;\n this.#intMode = intMode;\n this.closed = false;\n this.protocol = \"file\";\n }\n async execute(stmtOrSql, args) {\n let stmt;\n if (typeof stmtOrSql === \"string\") {\n stmt = {\n sql: stmtOrSql,\n args: args || []\n };\n } else {\n stmt = stmtOrSql;\n }\n this.#checkNotClosed();\n return executeStmt(this.#getDb(), stmt, this.#intMode);\n }\n async batch(stmts, mode = \"deferred\") {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n executeStmt(db, (0, util_1.transactionModeToBegin)(mode), this.#intMode);\n const resultSets = stmts.map(stmt => {\n if (!db.inTransaction) {\n throw new api_1.LibsqlError(\"The transaction has been rolled back\", \"TRANSACTION_CLOSED\");\n }\n return executeStmt(db, stmt, this.#intMode);\n });\n executeStmt(db, \"COMMIT\", this.#intMode);\n return resultSets;\n } finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n }\n }\n async migrate(stmts) {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n executeStmt(db, \"PRAGMA foreign_keys=off\", this.#intMode);\n executeStmt(db, (0, util_1.transactionModeToBegin)(\"deferred\"), this.#intMode);\n const resultSets = stmts.map(stmt => {\n if (!db.inTransaction) {\n throw new api_1.LibsqlError(\"The transaction has been rolled back\", \"TRANSACTION_CLOSED\");\n }\n return executeStmt(db, stmt, this.#intMode);\n });\n executeStmt(db, \"COMMIT\", this.#intMode);\n return resultSets;\n } finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n executeStmt(db, \"PRAGMA foreign_keys=on\", this.#intMode);\n }\n }\n async transaction(mode = \"write\") {\n const db = this.#getDb();\n executeStmt(db, (0, util_1.transactionModeToBegin)(mode), this.#intMode);\n this.#db = null; // A new connection will be lazily created on next use\n return new Sqlite3Transaction(db, this.#intMode);\n }\n async executeMultiple(sql) {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n return executeMultiple(db, sql);\n } finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n }\n }\n async sync() {\n this.#checkNotClosed();\n const rep = await this.#getDb().sync();\n return {\n frames_synced: rep.frames_synced,\n frame_no: rep.frame_no\n };\n }\n close() {\n this.closed = true;\n if (this.#db !== null) {\n this.#db.close();\n }\n }\n #checkNotClosed() {\n if (this.closed) {\n throw new api_1.LibsqlError(\"The client is closed\", \"CLIENT_CLOSED\");\n }\n }\n // Lazily creates the database connection and returns it\n #getDb() {\n if (this.#db === null) {\n this.#db = new libsql_1.default(this.#path, this.#options);\n }\n return this.#db;\n }\n}\nexports.Sqlite3Client = Sqlite3Client;\nclass Sqlite3Transaction {\n #database;\n #intMode;\n /** @private */\n constructor(database, intMode) {\n this.#database = database;\n this.#intMode = intMode;\n }\n async execute(stmtOrSql, args) {\n let stmt;\n if (typeof stmtOrSql === \"string\") {\n stmt = {\n sql: stmtOrSql,\n args: args || []\n };\n } else {\n stmt = stmtOrSql;\n }\n this.#checkNotClosed();\n return executeStmt(this.#database, stmt, this.#intMode);\n }\n async batch(stmts) {\n return stmts.map(stmt => {\n this.#checkNotClosed();\n return executeStmt(this.#database, stmt, this.#intMode);\n });\n }\n async executeMultiple(sql) {\n this.#checkNotClosed();\n return executeMultiple(this.#database, sql);\n }\n async rollback() {\n if (!this.#database.open) {\n return;\n }\n this.#checkNotClosed();\n executeStmt(this.#database, \"ROLLBACK\", this.#intMode);\n }\n async commit() {\n this.#checkNotClosed();\n executeStmt(this.#database, \"COMMIT\", this.#intMode);\n }\n close() {\n if (this.#database.inTransaction) {\n executeStmt(this.#database, \"ROLLBACK\", this.#intMode);\n }\n }\n get closed() {\n return !this.#database.inTransaction;\n }\n #checkNotClosed() {\n if (this.closed) {\n throw new api_1.LibsqlError(\"The transaction is closed\", \"TRANSACTION_CLOSED\");\n }\n }\n}\nexports.Sqlite3Transaction = Sqlite3Transaction;\nfunction executeStmt(db, stmt, intMode) {\n let sql;\n let args;\n if (typeof stmt === \"string\") {\n sql = stmt;\n args = [];\n } else {\n sql = stmt.sql;\n if (Array.isArray(stmt.args)) {\n args = stmt.args.map(value => valueToSql(value, intMode));\n } else {\n args = {};\n for (const name in stmt.args) {\n const argName = name[0] === \"@\" || name[0] === \"$\" || name[0] === \":\" ? name.substring(1) : name;\n args[argName] = valueToSql(stmt.args[name], intMode);\n }\n }\n }\n try {\n const sqlStmt = db.prepare(sql);\n sqlStmt.safeIntegers(true);\n let returnsData = true;\n try {\n sqlStmt.raw(true);\n } catch {\n // raw() throws an exception if the statement does not return data\n returnsData = false;\n }\n if (returnsData) {\n const columns = Array.from(sqlStmt.columns().map(col => col.name));\n const columnTypes = Array.from(sqlStmt.columns().map(col => col.type ?? \"\"));\n const rows = sqlStmt.all(args).map(sqlRow => {\n return rowFromSql(sqlRow, columns, intMode);\n });\n // TODO: can we get this info from better-sqlite3?\n const rowsAffected = 0;\n const lastInsertRowid = undefined;\n return new util_1.ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid);\n } else {\n const info = sqlStmt.run(args);\n const rowsAffected = info.changes;\n const lastInsertRowid = BigInt(info.lastInsertRowid);\n return new util_1.ResultSetImpl([], [], [], rowsAffected, lastInsertRowid);\n }\n } catch (e) {\n throw mapSqliteError(e);\n }\n}\nfunction rowFromSql(sqlRow, columns, intMode) {\n const row = {};\n // make sure that the \"length\" property is not enumerable\n Object.defineProperty(row, \"length\", {\n value: sqlRow.length\n });\n for (let i = 0; i < sqlRow.length; ++i) {\n const value = valueFromSql(sqlRow[i], intMode);\n Object.defineProperty(row, i, {\n value\n });\n const column = columns[i];\n if (!Object.hasOwn(row, column)) {\n Object.defineProperty(row, column, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n }\n }\n return row;\n}\nfunction valueFromSql(sqlValue, intMode) {\n if (typeof sqlValue === \"bigint\") {\n if (intMode === \"number\") {\n if (sqlValue < minSafeBigint || sqlValue > maxSafeBigint) {\n throw new RangeError(\"Received integer which cannot be safely represented as a JavaScript number\");\n }\n return Number(sqlValue);\n } else if (intMode === \"bigint\") {\n return sqlValue;\n } else if (intMode === \"string\") {\n return \"\" + sqlValue;\n } else {\n throw new Error(\"Invalid value for IntMode\");\n }\n } else if (sqlValue instanceof node_buffer_1.Buffer) {\n return sqlValue.buffer;\n }\n return sqlValue;\n}\nconst minSafeBigint = -9007199254740991n;\nconst maxSafeBigint = 9007199254740991n;\nfunction valueToSql(value, intMode) {\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new RangeError(\"Only finite numbers (not Infinity or NaN) can be passed as arguments\");\n }\n return value;\n } else if (typeof value === \"bigint\") {\n if (value < minInteger || value > maxInteger) {\n throw new RangeError(\"bigint is too large to be represented as a 64-bit integer and passed as argument\");\n }\n return value;\n } else if (typeof value === \"boolean\") {\n switch (intMode) {\n case \"bigint\":\n return value ? 1n : 0n;\n case \"string\":\n return value ? \"1\" : \"0\";\n default:\n return value ? 1 : 0;\n }\n } else if (value instanceof ArrayBuffer) {\n return node_buffer_1.Buffer.from(value);\n } else if (value instanceof Date) {\n return value.valueOf();\n } else if (value === undefined) {\n throw new TypeError(\"undefined cannot be passed as argument to the database\");\n } else {\n return value;\n }\n}\nconst minInteger = -9223372036854775808n;\nconst maxInteger = 9223372036854775807n;\nfunction executeMultiple(db, sql) {\n try {\n db.exec(sql);\n } catch (e) {\n throw mapSqliteError(e);\n }\n}\nfunction mapSqliteError(e) {\n if (e instanceof libsql_1.default.SqliteError) {\n return new api_1.LibsqlError(e.message, e.code, e.rawCode, e);\n }\n return e;\n}","map":{"version":3,"names":["__createBinding","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__exportStar","exports","p","prototype","hasOwnProperty","call","__importDefault","mod","value","Sqlite3Transaction","Sqlite3Client","_createClient","createClient","libsql_1","require","node_buffer_1","api_1","config_1","util_1","config","expandConfig","scheme","LibsqlError","JSON","stringify","supportedUrlLink","authority","host","toLowerCase","port","userinfo","isInMemory","isInMemoryConfig","syncUrl","path","options","authToken","encryptionKey","syncPeriod","syncInterval","db","default","executeStmt","intMode","closed","protocol","constructor","execute","stmtOrSql","args","stmt","sql","checkNotClosed","getDb","batch","stmts","mode","transactionModeToBegin","resultSets","map","inTransaction","migrate","transaction","executeMultiple","sync","rep","frames_synced","frame_no","close","#checkNotClosed","#getDb","database","rollback","open","commit","Array","isArray","valueToSql","name","argName","substring","sqlStmt","prepare","safeIntegers","returnsData","raw","columns","from","col","columnTypes","type","rows","all","sqlRow","rowFromSql","rowsAffected","lastInsertRowid","ResultSetImpl","info","run","changes","BigInt","e","mapSqliteError","row","length","i","valueFromSql","column","hasOwn","sqlValue","minSafeBigint","maxSafeBigint","RangeError","Number","Error","Buffer","buffer","isFinite","minInteger","maxInteger","ArrayBuffer","Date","valueOf","TypeError","exec","SqliteError","message","code","rawCode"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/client/lib-cjs/sqlite3.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Sqlite3Transaction = exports.Sqlite3Client = exports._createClient = exports.createClient = void 0;\nconst libsql_1 = __importDefault(require(\"libsql\"));\nconst node_buffer_1 = require(\"node:buffer\");\nconst api_1 = require(\"@libsql/core/api\");\nconst config_1 = require(\"@libsql/core/config\");\nconst util_1 = require(\"@libsql/core/util\");\n__exportStar(require(\"@libsql/core/api\"), exports);\nfunction createClient(config) {\n return _createClient((0, config_1.expandConfig)(config, true));\n}\nexports.createClient = createClient;\n/** @private */\nfunction _createClient(config) {\n if (config.scheme !== \"file\") {\n throw new api_1.LibsqlError(`URL scheme ${JSON.stringify(config.scheme + \":\")} is not supported by the local sqlite3 client. ` +\n `For more information, please read ${util_1.supportedUrlLink}`, \"URL_SCHEME_NOT_SUPPORTED\");\n }\n const authority = config.authority;\n if (authority !== undefined) {\n const host = authority.host.toLowerCase();\n if (host !== \"\" && host !== \"localhost\") {\n throw new api_1.LibsqlError(`Invalid host in file URL: ${JSON.stringify(authority.host)}. ` +\n 'A \"file:\" URL with an absolute path should start with one slash (\"file:/absolute/path.db\") ' +\n 'or with three slashes (\"file:///absolute/path.db\"). ' +\n `For more information, please read ${util_1.supportedUrlLink}`, \"URL_INVALID\");\n }\n if (authority.port !== undefined) {\n throw new api_1.LibsqlError(\"File URL cannot have a port\", \"URL_INVALID\");\n }\n if (authority.userinfo !== undefined) {\n throw new api_1.LibsqlError(\"File URL cannot have username and password\", \"URL_INVALID\");\n }\n }\n let isInMemory = (0, config_1.isInMemoryConfig)(config);\n if (isInMemory && config.syncUrl) {\n throw new api_1.LibsqlError(`Embedded replica must use file for local db but URI with in-memory mode were provided instead: ${config.path}`, \"URL_INVALID\");\n }\n let path = config.path;\n if (isInMemory) {\n // note: we should prepend file scheme in order for SQLite3 to recognize :memory: connection query parameters\n path = `${config.scheme}:${config.path}`;\n }\n const options = {\n authToken: config.authToken,\n encryptionKey: config.encryptionKey,\n syncUrl: config.syncUrl,\n syncPeriod: config.syncInterval,\n };\n const db = new libsql_1.default(path, options);\n executeStmt(db, \"SELECT 1 AS checkThatTheDatabaseCanBeOpened\", config.intMode);\n return new Sqlite3Client(path, options, db, config.intMode);\n}\nexports._createClient = _createClient;\nclass Sqlite3Client {\n #path;\n #options;\n #db;\n #intMode;\n closed;\n protocol;\n /** @private */\n constructor(path, options, db, intMode) {\n this.#path = path;\n this.#options = options;\n this.#db = db;\n this.#intMode = intMode;\n this.closed = false;\n this.protocol = \"file\";\n }\n async execute(stmtOrSql, args) {\n let stmt;\n if (typeof stmtOrSql === \"string\") {\n stmt = {\n sql: stmtOrSql,\n args: args || [],\n };\n }\n else {\n stmt = stmtOrSql;\n }\n this.#checkNotClosed();\n return executeStmt(this.#getDb(), stmt, this.#intMode);\n }\n async batch(stmts, mode = \"deferred\") {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n executeStmt(db, (0, util_1.transactionModeToBegin)(mode), this.#intMode);\n const resultSets = stmts.map((stmt) => {\n if (!db.inTransaction) {\n throw new api_1.LibsqlError(\"The transaction has been rolled back\", \"TRANSACTION_CLOSED\");\n }\n return executeStmt(db, stmt, this.#intMode);\n });\n executeStmt(db, \"COMMIT\", this.#intMode);\n return resultSets;\n }\n finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n }\n }\n async migrate(stmts) {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n executeStmt(db, \"PRAGMA foreign_keys=off\", this.#intMode);\n executeStmt(db, (0, util_1.transactionModeToBegin)(\"deferred\"), this.#intMode);\n const resultSets = stmts.map((stmt) => {\n if (!db.inTransaction) {\n throw new api_1.LibsqlError(\"The transaction has been rolled back\", \"TRANSACTION_CLOSED\");\n }\n return executeStmt(db, stmt, this.#intMode);\n });\n executeStmt(db, \"COMMIT\", this.#intMode);\n return resultSets;\n }\n finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n executeStmt(db, \"PRAGMA foreign_keys=on\", this.#intMode);\n }\n }\n async transaction(mode = \"write\") {\n const db = this.#getDb();\n executeStmt(db, (0, util_1.transactionModeToBegin)(mode), this.#intMode);\n this.#db = null; // A new connection will be lazily created on next use\n return new Sqlite3Transaction(db, this.#intMode);\n }\n async executeMultiple(sql) {\n this.#checkNotClosed();\n const db = this.#getDb();\n try {\n return executeMultiple(db, sql);\n }\n finally {\n if (db.inTransaction) {\n executeStmt(db, \"ROLLBACK\", this.#intMode);\n }\n }\n }\n async sync() {\n this.#checkNotClosed();\n const rep = await this.#getDb().sync();\n return {\n frames_synced: rep.frames_synced,\n frame_no: rep.frame_no,\n };\n }\n close() {\n this.closed = true;\n if (this.#db !== null) {\n this.#db.close();\n }\n }\n #checkNotClosed() {\n if (this.closed) {\n throw new api_1.LibsqlError(\"The client is closed\", \"CLIENT_CLOSED\");\n }\n }\n // Lazily creates the database connection and returns it\n #getDb() {\n if (this.#db === null) {\n this.#db = new libsql_1.default(this.#path, this.#options);\n }\n return this.#db;\n }\n}\nexports.Sqlite3Client = Sqlite3Client;\nclass Sqlite3Transaction {\n #database;\n #intMode;\n /** @private */\n constructor(database, intMode) {\n this.#database = database;\n this.#intMode = intMode;\n }\n async execute(stmtOrSql, args) {\n let stmt;\n if (typeof stmtOrSql === \"string\") {\n stmt = {\n sql: stmtOrSql,\n args: args || [],\n };\n }\n else {\n stmt = stmtOrSql;\n }\n this.#checkNotClosed();\n return executeStmt(this.#database, stmt, this.#intMode);\n }\n async batch(stmts) {\n return stmts.map((stmt) => {\n this.#checkNotClosed();\n return executeStmt(this.#database, stmt, this.#intMode);\n });\n }\n async executeMultiple(sql) {\n this.#checkNotClosed();\n return executeMultiple(this.#database, sql);\n }\n async rollback() {\n if (!this.#database.open) {\n return;\n }\n this.#checkNotClosed();\n executeStmt(this.#database, \"ROLLBACK\", this.#intMode);\n }\n async commit() {\n this.#checkNotClosed();\n executeStmt(this.#database, \"COMMIT\", this.#intMode);\n }\n close() {\n if (this.#database.inTransaction) {\n executeStmt(this.#database, \"ROLLBACK\", this.#intMode);\n }\n }\n get closed() {\n return !this.#database.inTransaction;\n }\n #checkNotClosed() {\n if (this.closed) {\n throw new api_1.LibsqlError(\"The transaction is closed\", \"TRANSACTION_CLOSED\");\n }\n }\n}\nexports.Sqlite3Transaction = Sqlite3Transaction;\nfunction executeStmt(db, stmt, intMode) {\n let sql;\n let args;\n if (typeof stmt === \"string\") {\n sql = stmt;\n args = [];\n }\n else {\n sql = stmt.sql;\n if (Array.isArray(stmt.args)) {\n args = stmt.args.map((value) => valueToSql(value, intMode));\n }\n else {\n args = {};\n for (const name in stmt.args) {\n const argName = name[0] === \"@\" || name[0] === \"$\" || name[0] === \":\"\n ? name.substring(1)\n : name;\n args[argName] = valueToSql(stmt.args[name], intMode);\n }\n }\n }\n try {\n const sqlStmt = db.prepare(sql);\n sqlStmt.safeIntegers(true);\n let returnsData = true;\n try {\n sqlStmt.raw(true);\n }\n catch {\n // raw() throws an exception if the statement does not return data\n returnsData = false;\n }\n if (returnsData) {\n const columns = Array.from(sqlStmt.columns().map((col) => col.name));\n const columnTypes = Array.from(sqlStmt.columns().map((col) => col.type ?? \"\"));\n const rows = sqlStmt.all(args).map((sqlRow) => {\n return rowFromSql(sqlRow, columns, intMode);\n });\n // TODO: can we get this info from better-sqlite3?\n const rowsAffected = 0;\n const lastInsertRowid = undefined;\n return new util_1.ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid);\n }\n else {\n const info = sqlStmt.run(args);\n const rowsAffected = info.changes;\n const lastInsertRowid = BigInt(info.lastInsertRowid);\n return new util_1.ResultSetImpl([], [], [], rowsAffected, lastInsertRowid);\n }\n }\n catch (e) {\n throw mapSqliteError(e);\n }\n}\nfunction rowFromSql(sqlRow, columns, intMode) {\n const row = {};\n // make sure that the \"length\" property is not enumerable\n Object.defineProperty(row, \"length\", { value: sqlRow.length });\n for (let i = 0; i < sqlRow.length; ++i) {\n const value = valueFromSql(sqlRow[i], intMode);\n Object.defineProperty(row, i, { value });\n const column = columns[i];\n if (!Object.hasOwn(row, column)) {\n Object.defineProperty(row, column, {\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n }\n return row;\n}\nfunction valueFromSql(sqlValue, intMode) {\n if (typeof sqlValue === \"bigint\") {\n if (intMode === \"number\") {\n if (sqlValue < minSafeBigint || sqlValue > maxSafeBigint) {\n throw new RangeError(\"Received integer which cannot be safely represented as a JavaScript number\");\n }\n return Number(sqlValue);\n }\n else if (intMode === \"bigint\") {\n return sqlValue;\n }\n else if (intMode === \"string\") {\n return \"\" + sqlValue;\n }\n else {\n throw new Error(\"Invalid value for IntMode\");\n }\n }\n else if (sqlValue instanceof node_buffer_1.Buffer) {\n return sqlValue.buffer;\n }\n return sqlValue;\n}\nconst minSafeBigint = -9007199254740991n;\nconst maxSafeBigint = 9007199254740991n;\nfunction valueToSql(value, intMode) {\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new RangeError(\"Only finite numbers (not Infinity or NaN) can be passed as arguments\");\n }\n return value;\n }\n else if (typeof value === \"bigint\") {\n if (value < minInteger || value > maxInteger) {\n throw new RangeError(\"bigint is too large to be represented as a 64-bit integer and passed as argument\");\n }\n return value;\n }\n else if (typeof value === \"boolean\") {\n switch (intMode) {\n case \"bigint\":\n return value ? 1n : 0n;\n case \"string\":\n return value ? \"1\" : \"0\";\n default:\n return value ? 1 : 0;\n }\n }\n else if (value instanceof ArrayBuffer) {\n return node_buffer_1.Buffer.from(value);\n }\n else if (value instanceof Date) {\n return value.valueOf();\n }\n else if (value === undefined) {\n throw new TypeError(\"undefined cannot be passed as argument to the database\");\n }\n else {\n return value;\n }\n}\nconst minInteger = -9223372036854775808n;\nconst maxInteger = 9223372036854775807n;\nfunction executeMultiple(db, sql) {\n try {\n db.exec(sql);\n }\n catch (e) {\n throw mapSqliteError(e);\n }\n}\nfunction mapSqliteError(e) {\n if (e instanceof libsql_1.default.SqliteError) {\n return new api_1.LibsqlError(e.message, e.code, e.rawCode, e);\n }\n return e;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,eAAe,GAAI,IAAI,IAAI,IAAI,CAACA,eAAe,KAAMC,MAAM,CAACC,MAAM,GAAI,UAASC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;EAC5F,IAAIA,EAAE,KAAKC,SAAS,EAAED,EAAE,GAAGD,CAAC;EAC5B,IAAIG,IAAI,GAAGP,MAAM,CAACQ,wBAAwB,CAACL,CAAC,EAAEC,CAAC,CAAC;EAChD,IAAI,CAACG,IAAI,KAAK,KAAK,IAAIA,IAAI,GAAG,CAACJ,CAAC,CAACM,UAAU,GAAGF,IAAI,CAACG,QAAQ,IAAIH,IAAI,CAACI,YAAY,CAAC,EAAE;IACjFJ,IAAI,GAAG;MAAEK,UAAU,EAAE,IAAI;MAAEC,GAAG,EAAE,SAAAA,CAAA,EAAW;QAAE,OAAOV,CAAC,CAACC,CAAC,CAAC;MAAE;IAAE,CAAC;EAC/D;EACAJ,MAAM,CAACc,cAAc,CAACZ,CAAC,EAAEG,EAAE,EAAEE,IAAI,CA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