module.exports=[845824,e=>{"use strict";let T=`
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA temp_store = MEMORY;
PRAGMA mmap_size = 30000000;
PRAGMA cache_size = -64000;
PRAGMA foreign_keys = ON;
PRAGMA busy_timeout = 5000;
`;e.s(["PRAGMA_SQL",0,T,"TABLES",0,{_meta:{columns:{key:"TEXT PRIMARY KEY",value:"TEXT NOT NULL"}},settings:{columns:{id:"INTEGER PRIMARY KEY CHECK (id = 1)",data:"TEXT NOT NULL"}},providerConnections:{columns:{id:"TEXT PRIMARY KEY",provider:"TEXT NOT NULL",authType:"TEXT NOT NULL",name:"TEXT",email:"TEXT",priority:"INTEGER",isActive:"INTEGER DEFAULT 1",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pc_provider ON providerConnections(provider)","CREATE INDEX IF NOT EXISTS idx_pc_provider_active ON providerConnections(provider, isActive)","CREATE INDEX IF NOT EXISTS idx_pc_priority ON providerConnections(provider, priority)"]},providerNodes:{columns:{id:"TEXT PRIMARY KEY",type:"TEXT",name:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pn_type ON providerNodes(type)"]},proxyPools:{columns:{id:"TEXT PRIMARY KEY",isActive:"INTEGER DEFAULT 1",testStatus:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pp_active ON proxyPools(isActive)","CREATE INDEX IF NOT EXISTS idx_pp_status ON proxyPools(testStatus)"]},apiKeys:{columns:{id:"TEXT PRIMARY KEY",key:"TEXT UNIQUE NOT NULL",name:"TEXT",machineId:"TEXT",isActive:"INTEGER DEFAULT 1",createdAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},combos:{columns:{id:"TEXT PRIMARY KEY",name:"TEXT UNIQUE NOT NULL",kind:"TEXT",models:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_combo_name ON combos(name)"]},kv:{columns:{scope:"TEXT NOT NULL",key:"TEXT NOT NULL",value:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (scope, key)",indexes:["CREATE INDEX IF NOT EXISTS idx_kv_scope ON kv(scope)"]},usageHistory:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_uh_ts ON usageHistory(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_uh_provider ON usageHistory(provider)","CREATE INDEX IF NOT EXISTS idx_uh_model ON usageHistory(model)","CREATE INDEX IF NOT EXISTS idx_uh_conn ON usageHistory(connectionId)"]},usageDaily:{columns:{dateKey:"TEXT PRIMARY KEY",data:"TEXT NOT NULL"}},requestDetails:{columns:{id:"TEXT PRIMARY KEY",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",status:"TEXT",data:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_rd_ts ON requestDetails(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_rd_provider ON requestDetails(provider)","CREATE INDEX IF NOT EXISTS idx_rd_model ON requestDetails(model)","CREATE INDEX IF NOT EXISTS idx_rd_conn ON requestDetails(connectionId)"]}},"buildCreateTableSql",0,function(e,T){let t=Object.entries(T.columns).map(([e,T])=>`${e} ${T}`);return T.primaryKey&&t.push(T.primaryKey),`CREATE TABLE IF NOT EXISTS ${e} (${t.join(", ")})`}])},525302,(e,T,t)=>{T.exports=e.x("sql.js-59d66b30daa0a8d2",()=>require("sql.js-59d66b30daa0a8d2"))},344805,e=>{"use strict";var T=e.i(902157),t=e.i(525302),E=e.i(845824);let i=null;async function r(){return i||(i=await (0,t.default)())}async function s(e){let t=await r(),i=T.default.existsSync(e)?T.default.readFileSync(e):null,s=new t.Database(i);s.exec(E.PRAGMA_SQL);let o=!1,n=null;function N(){let t=s.export();T.default.writeFileSync(e,Buffer.from(t)),o=!1}function a(){o=!0,n&&clearTimeout(n),n=setTimeout(()=>{if(n=null,o)try{N()}catch(e){console.error("[sqljs] save failed:",e)}},100)}function d(e){if(!(!e||Array.isArray(e)&&0===e.length))return e}let c=()=>{if(o)try{N()}catch{}};return process.on("beforeExit",c),process.on("SIGINT",c),process.on("SIGTERM",c),{driver:"sql.js",run:function(e,T=[]){let t=s.prepare(e);try{t.bind(d(T)),t.step();let e=s.getRowsModified(),E=s.exec("SELECT last_insert_rowid() as id")[0]?.values?.[0]?.[0]??null;return a(),{changes:e,lastInsertRowid:E}}finally{t.free()}},get:function(e,T=[]){let t=s.prepare(e);try{if(t.bind(d(T)),t.step())return t.getAsObject();return}finally{t.free()}},all:function(e,T=[]){let t=s.prepare(e);try{t.bind(d(T));let e=[];for(;t.step();)e.push(t.getAsObject());return e}finally{t.free()}},exec:function(e){s.exec(e),a()},transaction:function(e){let T=`sp_${Math.random().toString(36).slice(2)}`;s.exec(`SAVEPOINT ${T}`);try{let t=e();return s.exec(`RELEASE ${T}`),a(),t}catch(e){try{s.exec(`ROLLBACK TO ${T}`),s.exec(`RELEASE ${T}`)}catch{}throw e}},close:function(){n&&clearTimeout(n),o&&N(),s.close()},raw:s}}e.s(["createSqlJsAdapter",0,s])}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0~p~am2._.js.map