{"ast":null,"code":"import { WebSocket } from \"@libsql/isomorphic-ws\";\nimport { subprotocolsV2, subprotocolsV3 } from \"./ws/client.js\";\nimport { WebSocketUnsupportedError } from \"./errors.js\";\nimport { HttpClient } from \"./http/client.js\";\nimport { WsClient } from \"./ws/client.js\";\nexport { WebSocket } from \"@libsql/isomorphic-ws\";\nexport { fetch, Request, Headers } from \"@libsql/isomorphic-fetch\";\nexport { Client } from \"./client.js\";\nexport * from \"./errors.js\";\nexport { Batch, BatchStep, BatchCond } from \"./batch.js\";\nexport { parseLibsqlUrl } from \"./libsql_url.js\";\nexport { Sql } from \"./sql.js\";\nexport { Stmt } from \"./stmt.js\";\nexport { Stream } from \"./stream.js\";\nexport { HttpClient } from \"./http/client.js\";\nexport { HttpStream } from \"./http/stream.js\";\nexport { WsClient } from \"./ws/client.js\";\nexport { WsStream } from \"./ws/stream.js\";\n/** Open a Hrana client over WebSocket connected to the given `url`. */\nexport function openWs(url, jwt, protocolVersion = 2) {\n if (typeof WebSocket === \"undefined\") {\n throw new WebSocketUnsupportedError(\"WebSockets are not supported in this environment\");\n }\n var subprotocols = undefined;\n if (protocolVersion == 3) {\n subprotocols = Array.from(subprotocolsV3.keys());\n } else {\n subprotocols = Array.from(subprotocolsV2.keys());\n }\n const socket = new WebSocket(url, subprotocols);\n return new WsClient(socket, jwt);\n}\n/** Open a Hrana client over HTTP connected to the given `url`.\n *\n * If the `customFetch` argument is passed and not `undefined`, it is used in place of the `fetch` function\n * from `@libsql/isomorphic-fetch`. This function is always called with a `Request` object from\n * `@libsql/isomorphic-fetch`.\n */\nexport function openHttp(url, jwt, customFetch, protocolVersion = 2) {\n return new HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, protocolVersion);\n}","map":{"version":3,"names":["WebSocket","subprotocolsV2","subprotocolsV3","WebSocketUnsupportedError","HttpClient","WsClient","fetch","Request","Headers","Client","Batch","BatchStep","BatchCond","parseLibsqlUrl","Sql","Stmt","Stream","HttpStream","WsStream","openWs","url","jwt","protocolVersion","subprotocols","undefined","Array","from","keys","socket","openHttp","customFetch","URL"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/index.js"],"sourcesContent":["import { WebSocket } from \"@libsql/isomorphic-ws\";\nimport { subprotocolsV2, subprotocolsV3 } from \"./ws/client.js\";\nimport { WebSocketUnsupportedError } from \"./errors.js\";\nimport { HttpClient } from \"./http/client.js\";\nimport { WsClient } from \"./ws/client.js\";\nexport { WebSocket } from \"@libsql/isomorphic-ws\";\nexport { fetch, Request, Headers } from \"@libsql/isomorphic-fetch\";\nexport { Client } from \"./client.js\";\nexport * from \"./errors.js\";\nexport { Batch, BatchStep, BatchCond } from \"./batch.js\";\nexport { parseLibsqlUrl } from \"./libsql_url.js\";\nexport { Sql } from \"./sql.js\";\nexport { Stmt } from \"./stmt.js\";\nexport { Stream } from \"./stream.js\";\nexport { HttpClient } from \"./http/client.js\";\nexport { HttpStream } from \"./http/stream.js\";\nexport { WsClient } from \"./ws/client.js\";\nexport { WsStream } from \"./ws/stream.js\";\n/** Open a Hrana client over WebSocket connected to the given `url`. */\nexport function openWs(url, jwt, protocolVersion = 2) {\n if (typeof WebSocket === \"undefined\") {\n throw new WebSocketUnsupportedError(\"WebSockets are not supported in this environment\");\n }\n var subprotocols = undefined;\n if (protocolVersion == 3) {\n subprotocols = Array.from(subprotocolsV3.keys());\n }\n else {\n subprotocols = Array.from(subprotocolsV2.keys());\n }\n const socket = new WebSocket(url, subprotocols);\n return new WsClient(socket, jwt);\n}\n/** Open a Hrana client over HTTP connected to the given `url`.\n *\n * If the `customFetch` argument is passed and not `undefined`, it is used in place of the `fetch` function\n * from `@libsql/isomorphic-fetch`. This function is always called with a `Request` object from\n * `@libsql/isomorphic-fetch`.\n */\nexport function openHttp(url, jwt, customFetch, protocolVersion = 2) {\n return new HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, protocolVersion);\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,uBAAuB;AAC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