import{a as u,h as y,j as c}from"./chunk-2B24BK54.js";import{j as f}from"./chunk-QY3QWFKW.js";f();async function v(s,e,r,n){if(!r||r.length===0)return e;n=n??s;let t=[];try{await s.execProtocol(c.parse({text:e}),{syncToFs:!1}),t.push(...(await s.execProtocol(c.describe({type:"S"}),{syncToFs:!1})).messages)}finally{t.push(...(await s.execProtocol(c.sync(),{syncToFs:!1})).messages)}let a=y(t),i=e.replace(/\$([0-9]+)/g,(d,l)=>"%"+l+"L");return(await n.query(`SELECT format($1, ${r.map((d,l)=>`$${l+2}`).join(", ")}) as query`,[i,...r],{paramTypes:[u,...a]})).rows[0].query}function x(s){let e,r=!1,n=async()=>{if(!e){r=!1;return}r=!0;let{args:t,resolve:a,reject:i}=e;e=void 0;try{let o=await s(...t);a(o)}catch(o){i(o)}finally{n()}};return async(...t)=>{e&&e.resolve(void 0);let a=new Promise((i,o)=>{e={args:t,resolve:i,reject:o}});return r||n(),a}}export{v as a,x as b};
//# sourceMappingURL=chunk-QY575LMP.js.map