@uibot/connection-pg 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Zi=Object.create;var{getPrototypeOf:Ji,defineProperty:Br,getOwnPropertyNames:es}=Object;var jr=Object.prototype.hasOwnProperty;function ts(e){return this[e]}var rs,ns,os=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?rs??=new WeakMap:ns??=new WeakMap,i=o.get(e);if(i)return i}r=e!=null?Zi(Ji(e)):{};let s=t||!e||!e.__esModule||!jr.call(e,"default")?Br(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let c of es(e))if(!jr.call(s,c))Br(s,c,{get:ts.bind(e,c),enumerable:!0})}if(n)o.set(e,s);return s};var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var He=S(function(Yu,cn){var $s=Number.MAX_SAFE_INTEGER||9007199254740991,Ms=["major","premajor","minor","preminor","patch","prepatch","prerelease"];cn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:$s,RELEASE_TYPES:Ms,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var nt=S(function(Xu,ln){var Bs=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};ln.exports=Bs});var ze=S(function(we,un){var{MAX_SAFE_COMPONENT_LENGTH:pr,MAX_SAFE_BUILD_LENGTH:js,MAX_LENGTH:Us}=He(),Vs=nt();we=un.exports={};var qs=we.re=[],Hs=we.safeRe=[],b=we.src=[],zs=we.safeSrc=[],C=we.t={},Gs=0,gr="[a-zA-Z0-9-]",Ws=[["\\s",1],["\\d",Us],[gr,js]],Ks=(e)=>{for(let[t,r]of Ws)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=Ks(t),o=Gs++;Vs(e,o,t),C[e]=o,b[o]=t,zs[o]=n,qs[o]=new RegExp(t,r?"g":void 0),Hs[o]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gr}*`);E("MAINVERSION",`(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${b[C.PRERELEASEIDENTIFIER]}(?:\\.${b[C.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${b[C.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[C.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${gr}+`);E("BUILD",`(?:\\+(${b[C.BUILDIDENTIFIER]}(?:\\.${b[C.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${b[C.MAINVERSION]}${b[C.PRERELEASE]}?${b[C.BUILD]}?`);E("FULL",`^${b[C.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${b[C.MAINVERSIONLOOSE]}${b[C.PRERELEASELOOSE]}?${b[C.BUILD]}?`);E("LOOSE",`^${b[C.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${b[C.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${b[C.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:${b[C.PRERELEASE]})?${b[C.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:${b[C.PRERELEASELOOSE]})?${b[C.BUILD]}?)?)?`);E("XRANGE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${pr}})(?:\\.(\\d{1,${pr}}))?(?:\\.(\\d{1,${pr}}))?`);E("COERCE",`${b[C.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",b[C.COERCEPLAIN]+`(?:${b[C.PRERELEASE]})?(?:${b[C.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",b[C.COERCE],!0);E("COERCERTLFULL",b[C.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${b[C.LONETILDE]}\\s+`,!0);we.tildeTrimReplace="$1~";E("TILDE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${b[C.LONECARET]}\\s+`,!0);we.caretTrimReplace="$1^";E("CARET",`^${b[C.LONECARET]}${b[C.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${b[C.LONECARET]}${b[C.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${b[C.GTLT]}\\s*(${b[C.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]}|${b[C.XRANGEPLAIN]})`,!0);we.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${b[C.XRANGEPLAIN]})\\s+-\\s+(${b[C.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${b[C.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[C.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var At=S(function(Qu,dn){var Ys=Object.freeze({loose:!0}),Xs=Object.freeze({}),Qs=(e)=>{if(!e)return Xs;if(typeof e!=="object")return Ys;return e};dn.exports=Qs});var fr=S(function(Zu,fn){var pn=/^[0-9]+$/,gn=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=pn.test(e),n=pn.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Zs=(e,t)=>gn(t,e);fn.exports={compareIdentifiers:gn,rcompareIdentifiers:Zs}});var J=S(function(Ju,yn){var vt=nt(),{MAX_LENGTH:mn,MAX_SAFE_INTEGER:Tt}=He(),{safeRe:Dt,t:Ot}=ze(),Js=At(),{compareIdentifiers:mr}=fr(),ea=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(mr(e[n],r[n])!==0)return!1;return!0};class Ce{constructor(e,t){if(t=Js(t),e instanceof Ce)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>mn)throw TypeError(`version is longer than ${mn} characters`);vt("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Dt[Ot.LOOSE]:Dt[Ot.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Tt||this.major<0)throw TypeError("Invalid major version");if(this.minor>Tt||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Tt||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<Tt)return o}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(vt("SemVer.compare",this.version,this.options,e),!(e instanceof Ce)){if(typeof e==="string"&&e===this.version)return 0;e=new Ce(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Ce))e=new Ce(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Ce))e=new Ce(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(vt("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return mr(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Ce))e=new Ce(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(vt("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return mr(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Dt[Ot.PRERELEASELOOSE]:Dt[Ot.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let o=this.prerelease.length;while(--o>=0)if(typeof this.prerelease[o]==="number")this.prerelease[o]++,o=-2;if(o===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let o=[t,n];if(r===!1)o=[t];if(ea(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=o}else this.prerelease=o}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}yn.exports=Ce});var De=S(function(ed,bn){var hn=J(),ta=(e,t,r=!1)=>{if(e instanceof hn)return e;try{return new hn(e,t)}catch(n){if(!r)return null;throw n}};bn.exports=ta});var Rn=S(function(td,Cn){var ra=De(),na=(e,t)=>{let r=ra(e,t);return r?r.version:null};Cn.exports=na});var wn=S(function(rd,In){var oa=De(),ia=(e,t)=>{let r=oa(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};In.exports=ia});var Sn=S(function(nd,xn){var Pn=J(),sa=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new Pn(e instanceof Pn?e.version:e,r).inc(t,n,o).version}catch(i){return null}};xn.exports=sa});var An=S(function(od,kn){var En=De(),aa=(e,t)=>{let r=En(e,null,!0),n=En(t,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,c=i?n:r,u=!!s.prerelease.length;if(!!c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(c.compareMain(s)===0){if(c.minor&&!c.patch)return"minor";return"patch"}}let f=u?"pre":"";if(r.major!==n.major)return f+"major";if(r.minor!==n.minor)return f+"minor";if(r.patch!==n.patch)return f+"patch";return"prerelease"};kn.exports=aa});var Tn=S(function(id,vn){var ca=J(),la=(e,t)=>new ca(e,t).major;vn.exports=la});var On=S(function(sd,Dn){var ua=J(),da=(e,t)=>new ua(e,t).minor;Dn.exports=da});var _n=S(function(ad,Nn){var pa=J(),ga=(e,t)=>new pa(e,t).patch;Nn.exports=ga});var Fn=S(function(cd,Ln){var fa=De(),ma=(e,t)=>{let r=fa(e,t);return r&&r.prerelease.length?r.prerelease:null};Ln.exports=ma});var he=S(function(ld,Mn){var $n=J(),ya=(e,t,r)=>new $n(e,r).compare(new $n(t,r));Mn.exports=ya});var jn=S(function(ud,Bn){var ha=he(),ba=(e,t,r)=>ha(t,e,r);Bn.exports=ba});var Vn=S(function(dd,Un){var Ca=he(),Ra=(e,t)=>Ca(e,t,!0);Un.exports=Ra});var Nt=S(function(pd,Hn){var qn=J(),Ia=(e,t,r)=>{let n=new qn(e,r),o=new qn(t,r);return n.compare(o)||n.compareBuild(o)};Hn.exports=Ia});var Gn=S(function(gd,zn){var wa=Nt(),Pa=(e,t)=>e.sort((r,n)=>wa(r,n,t));zn.exports=Pa});var Kn=S(function(fd,Wn){var xa=Nt(),Sa=(e,t)=>e.sort((r,n)=>xa(n,r,t));Wn.exports=Sa});var ot=S(function(md,Yn){var Ea=he(),ka=(e,t,r)=>Ea(e,t,r)>0;Yn.exports=ka});var _t=S(function(yd,Xn){var Aa=he(),va=(e,t,r)=>Aa(e,t,r)<0;Xn.exports=va});var yr=S(function(hd,Qn){var Ta=he(),Da=(e,t,r)=>Ta(e,t,r)===0;Qn.exports=Da});var hr=S(function(bd,Zn){var Oa=he(),Na=(e,t,r)=>Oa(e,t,r)!==0;Zn.exports=Na});var Lt=S(function(Cd,Jn){var _a=he(),La=(e,t,r)=>_a(e,t,r)>=0;Jn.exports=La});var Ft=S(function(Rd,eo){var Fa=he(),$a=(e,t,r)=>Fa(e,t,r)<=0;eo.exports=$a});var br=S(function(Id,to){var Ma=yr(),Ba=hr(),ja=ot(),Ua=Lt(),Va=_t(),qa=Ft(),Ha=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Ma(e,r,n);case"!=":return Ba(e,r,n);case">":return ja(e,r,n);case">=":return Ua(e,r,n);case"<":return Va(e,r,n);case"<=":return qa(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};to.exports=Ha});var no=S(function(wd,ro){var za=J(),Ga=De(),{safeRe:$t,t:Mt}=ze(),Wa=(e,t)=>{if(e instanceof za)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?$t[Mt.COERCEFULL]:$t[Mt.COERCE]);else{let u=t.includePrerelease?$t[Mt.COERCERTLFULL]:$t[Mt.COERCERTL],p;while((p=u.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||p.index+p[0].length!==r.index+r[0].length)r=p;u.lastIndex=p.index+p[1].length+p[2].length}u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",c=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Ga(`${n}.${o}.${i}${s}${c}`,t)};ro.exports=Wa});var so=S(function(Pd,io){var Ka=De(),oo=He(),Ya=J(),Xa=(e,t,r)=>{if(!oo.RELEASE_TYPES.includes(t))return null;let n=Qa(e,r);return n&&Za(n,t)},Qa=(e,t)=>{let r=e instanceof Ya?e.version:e;return Ka(r,t)},Za=(e,t)=>{if(Ja(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Ja=(e)=>e.startsWith("pre");io.exports=Xa});var lo=S(function(xd,co){class ao{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}co.exports=ao});var be=S(function(Sd,fo){var ec=/\s+/g;class it{constructor(e,t){if(t=rc(t),e instanceof it)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new it(e.raw,t);if(e instanceof Bt)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(ec," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!po(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&dc(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(uc,"");let r=((this.options.includePrerelease&&cc)|(this.options.loose&&lc))+":"+e,n=uo.get(r);if(n)return n;let o=this.options.loose,i=o?le[ee.HYPHENRANGELOOSE]:le[ee.HYPHENRANGE];e=e.replace(i,wc(this.options.includePrerelease)),U("hyphen replace",e),e=e.replace(le[ee.COMPARATORTRIM],ic),U("comparator trim",e),e=e.replace(le[ee.TILDETRIM],sc),U("tilde trim",e),e=e.replace(le[ee.CARETTRIM],ac),U("caret trim",e);let s=e.split(" ").map((f)=>pc(f,this.options)).join(" ").split(/\s+/).map((f)=>Ic(f,this.options));if(o)s=s.filter((f)=>(U("loose invalid filter",f,this.options),!!f.match(le[ee.COMPARATORLOOSE])));U("range list",s);let c=new Map,u=s.map((f)=>new Bt(f,this.options));for(let f of u){if(po(f))return[f];c.set(f.value,f)}if(c.size>1&&c.has(""))c.delete("");let p=[...c.values()];return uo.set(r,p),p}intersects(e,t){if(!(e instanceof it))throw TypeError("a Range is required");return this.set.some((r)=>go(r,t)&&e.set.some((n)=>go(n,t)&&r.every((o)=>n.every((i)=>o.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new nc(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Pc(this.set[t],e,this.options))return!0;return!1}}fo.exports=it;var tc=lo(),uo=new tc,rc=At(),Bt=st(),U=nt(),nc=J(),{safeRe:le,src:oc,t:ee,comparatorTrimReplace:ic,tildeTrimReplace:sc,caretTrimReplace:ac}=ze(),{FLAG_INCLUDE_PRERELEASE:cc,FLAG_LOOSE:lc}=He(),uc=new RegExp(oc[ee.BUILD],"g"),po=(e)=>e.value==="<0.0.0-0",dc=(e)=>e.value==="",go=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();while(r&&n.length)r=n.every((i)=>o.intersects(i,t)),o=n.pop();return r},pc=(e,t)=>(e=e.replace(le[ee.BUILD],""),U("comp",e,t),e=yc(e,t),U("caret",e),e=fc(e,t),U("tildes",e),e=bc(e,t),U("xrange",e),e=Rc(e,t),U("stars",e),e),Q=(e)=>!e||e.toLowerCase()==="x"||e==="*",gc=(e,t,r)=>Q(e)&&!Q(t)||Q(t)&&r&&!Q(r),fc=(e,t)=>e.trim().split(/\s+/).map((r)=>mc(r,t)).join(" "),mc=(e,t)=>{let r=t.loose?le[ee.TILDELOOSE]:le[ee.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,c,u)=>{U("tilde",e,o,i,s,c,u);let p;if(Q(i))p="";else if(Q(s))p=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(Q(c))p=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else if(u)U("replaceTilde pr",u),p=`>=${i}.${s}.${c}-${u} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c} <${i}.${+s+1}.0-0`;return U("tilde return",p),p})},yc=(e,t)=>e.trim().split(/\s+/).map((r)=>hc(r,t)).join(" "),hc=(e,t)=>{U("caret",e,t);let r=t.loose?le[ee.CARETLOOSE]:le[ee.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,c,u)=>{U("caret",e,o,i,s,c,u);let p;if(Q(i))p="";else if(Q(s))p=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(Q(c))if(i==="0")p=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`;else if(u)if(U("replaceCaret pr",u),i==="0")if(s==="0")p=`>=${i}.${s}.${c}-${u} <${i}.${s}.${+c+1}-0`;else p=`>=${i}.${s}.${c}-${u} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c}-${u} <${+i+1}.0.0-0`;else if(U("no pr"),i==="0")if(s==="0")p=`>=${i}.${s}.${c} <${i}.${s}.${+c+1}-0`;else p=`>=${i}.${s}.${c} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c} <${+i+1}.0.0-0`;return U("caret return",p),p})},bc=(e,t)=>(U("replaceXRanges",e,t),e.split(/\s+/).map((r)=>Cc(r,t)).join(" ")),Cc=(e,t)=>{e=e.trim();let r=t.loose?le[ee.XRANGELOOSE]:le[ee.XRANGE];return e.replace(r,(n,o,i,s,c,u)=>{if(U("xRange",e,n,o,i,s,c,u),gc(i,s,c))return e;let p=Q(i),f=p||Q(s),m=f||Q(c),R=m;if(o==="="&&R)o="";if(u=t.includePrerelease?"-0":"",p)if(o===">"||o==="<")n="<0.0.0-0";else n="*";else if(o&&R){if(f)s=0;if(c=0,o===">")if(o=">=",f)i=+i+1,s=0,c=0;else s=+s+1,c=0;else if(o==="<=")if(o="<",f)i=+i+1;else s=+s+1;if(o==="<")u="-0";n=`${o+i}.${s}.${c}${u}`}else if(f)n=`>=${i}.0.0${u} <${+i+1}.0.0-0`;else if(m)n=`>=${i}.${s}.0${u} <${i}.${+s+1}.0-0`;return U("xRange return",n),n})},Rc=(e,t)=>(U("replaceStars",e,t),e.trim().replace(le[ee.STAR],"")),Ic=(e,t)=>(U("replaceGTE0",e,t),e.trim().replace(le[t.includePrerelease?ee.GTE0PRE:ee.GTE0],"")),wc=(e)=>(t,r,n,o,i,s,c,u,p,f,m,R)=>{if(Q(n))r="";else if(Q(o))r=`>=${n}.0.0${e?"-0":""}`;else if(Q(i))r=`>=${n}.${o}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(Q(p))u="";else if(Q(f))u=`<${+p+1}.0.0-0`;else if(Q(m))u=`<${p}.${+f+1}.0-0`;else if(R)u=`<=${p}.${f}.${m}-${R}`;else if(e)u=`<${p}.${f}.${+m+1}-0`;else u=`<=${u}`;return`${r} ${u}`.trim()},Pc=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(U(e[n].semver),e[n].semver===Bt.ANY)continue;if(e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}}return!1}return!0}});var st=S(function(Ed,Ro){var at=Symbol("SemVer ANY");class jt{static get ANY(){return at}constructor(e,t){if(t=mo(t),e instanceof jt)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Rr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===at)this.value="";else this.value=this.operator+this.semver.version;Rr("comp",this)}parse(e){let t=this.options.loose?yo[ho.COMPARATORLOOSE]:yo[ho.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=at;else this.semver=new bo(r[2],this.options.loose)}toString(){return this.value}test(e){if(Rr("Comparator.test",e,this.options.loose),this.semver===at||e===at)return!0;if(typeof e==="string")try{e=new bo(e,this.options)}catch(t){return!1}return Cr(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof jt))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Co(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new Co(this.value,t).test(e.semver)}if(t=mo(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Cr(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Cr(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Ro.exports=jt;var mo=At(),{safeRe:yo,t:ho}=ze(),Cr=br(),Rr=nt(),bo=J(),Co=be()});var ct=S(function(kd,Io){var xc=be(),Sc=(e,t,r)=>{try{t=new xc(t,r)}catch(n){return!1}return t.test(e)};Io.exports=Sc});var Po=S(function(Ad,wo){var Ec=be(),kc=(e,t)=>new Ec(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));wo.exports=kc});var So=S(function(vd,xo){var Ac=J(),vc=be(),Tc=(e,t,r)=>{let n=null,o=null,i=null;try{i=new vc(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===-1)n=s,o=new Ac(n,r)}}),n};xo.exports=Tc});var ko=S(function(Td,Eo){var Dc=J(),Oc=be(),Nc=(e,t,r)=>{let n=null,o=null,i=null;try{i=new Oc(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===1)n=s,o=new Dc(n,r)}}),n};Eo.exports=Nc});var To=S(function(Dd,vo){var Ir=J(),_c=be(),Ao=ot(),Lc=(e,t)=>{e=new _c(e,t);let r=new Ir("0.0.0");if(e.test(r))return r;if(r=new Ir("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let o=e.set[n],i=null;if(o.forEach((s)=>{let c=new Ir(s.semver.version);switch(s.operator){case">":if(c.prerelease.length===0)c.patch++;else c.prerelease.push(0);c.raw=c.format();case"":case">=":if(!i||Ao(c,i))i=c;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||Ao(r,i)))r=i}if(r&&e.test(r))return r;return null};vo.exports=Lc});var Oo=S(function(Od,Do){var Fc=be(),$c=(e,t)=>{try{return new Fc(e,t).range||"*"}catch(r){return null}};Do.exports=$c});var Ut=S(function(Nd,Fo){var Mc=J(),Lo=st(),{ANY:Bc}=Lo,jc=be(),Uc=ct(),No=ot(),_o=_t(),Vc=Ft(),qc=Lt(),Hc=(e,t,r,n)=>{e=new Mc(e,n),t=new jc(t,n);let o,i,s,c,u;switch(r){case">":o=No,i=Vc,s=_o,c=">",u=">=";break;case"<":o=_o,i=qc,s=No,c="<",u="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Uc(e,t,n))return!1;for(let p=0;p<t.set.length;++p){let f=t.set[p],m=null,R=null;if(f.forEach((g)=>{if(g.semver===Bc)g=new Lo(">=0.0.0");if(m=m||g,R=R||g,o(g.semver,m.semver,n))m=g;else if(s(g.semver,R.semver,n))R=g}),m.operator===c||m.operator===u)return!1;if((!R.operator||R.operator===c)&&i(e,R.semver))return!1;else if(R.operator===u&&s(e,R.semver))return!1}return!0};Fo.exports=Hc});var Mo=S(function(_d,$o){var zc=Ut(),Gc=(e,t,r)=>zc(e,t,">",r);$o.exports=Gc});var jo=S(function(Ld,Bo){var Wc=Ut(),Kc=(e,t,r)=>Wc(e,t,"<",r);Bo.exports=Kc});var qo=S(function(Fd,Vo){var Uo=be(),Yc=(e,t,r)=>(e=new Uo(e,r),t=new Uo(t,r),e.intersects(t,r));Vo.exports=Yc});var zo=S(function($d,Ho){var Xc=ct(),Qc=he();Ho.exports=(e,t,r)=>{let n=[],o=null,i=null,s=e.sort((f,m)=>Qc(f,m,r));for(let f of s)if(Xc(f,t,r)){if(i=f,!o)o=f}else{if(i)n.push([o,i]);i=null,o=null}if(o)n.push([o,null]);let c=[];for(let[f,m]of n)if(f===m)c.push(f);else if(!m&&f===s[0])c.push("*");else if(!m)c.push(`>=${f}`);else if(f===s[0])c.push(`<=${m}`);else c.push(`${f} - ${m}`);let u=c.join(" || "),p=typeof t.raw==="string"?t.raw:String(t);return u.length<p.length?u:t}});var Qo=S(function(Md,Xo){var Go=be(),xr=st(),{ANY:wr}=xr,Pr=ct(),Sr=he(),Zc=(e,t,r={})=>{if(e===t)return!0;e=new Go(e,r),t=new Go(t,r);let n=!1;e:for(let o of e.set){for(let i of t.set){let s=el(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Jc=[new xr(">=0.0.0-0")],Wo=[new xr(">=0.0.0")],el=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===wr)if(t.length===1&&t[0].semver===wr)return!0;else if(r.includePrerelease)e=Jc;else e=Wo;if(t.length===1&&t[0].semver===wr)if(r.includePrerelease)return!0;else t=Wo;let n=new Set,o,i;for(let g of e)if(g.operator===">"||g.operator===">=")o=Ko(o,g,r);else if(g.operator==="<"||g.operator==="<=")i=Yo(i,g,r);else n.add(g.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Sr(o.semver,i.semver,r),s>0)return null;else if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let g of n){if(o&&!Pr(g,String(o),r))return null;if(i&&!Pr(g,String(i),r))return null;for(let L of t)if(!Pr(g,String(L),r))return!1;return!0}let c,u,p,f,m=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,R=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;if(m&&m.prerelease.length===1&&i.operator==="<"&&m.prerelease[0]===0)m=!1;for(let g of t){if(f=f||g.operator===">"||g.operator===">=",p=p||g.operator==="<"||g.operator==="<=",o){if(R){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===R.major&&g.semver.minor===R.minor&&g.semver.patch===R.patch)R=!1}if(g.operator===">"||g.operator===">="){if(c=Ko(o,g,r),c===g&&c!==o)return!1}else if(o.operator===">="&&!g.test(o.semver))return!1}if(i){if(m){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===m.major&&g.semver.minor===m.minor&&g.semver.patch===m.patch)m=!1}if(g.operator==="<"||g.operator==="<="){if(u=Yo(i,g,r),u===g&&u!==i)return!1}else if(i.operator==="<="&&!g.test(i.semver))return!1}if(!g.operator&&(i||o)&&s!==0)return!1}if(o&&p&&!i&&s!==0)return!1;if(i&&f&&!o&&s!==0)return!1;if(R||m)return!1;return!0},Ko=(e,t,r)=>{if(!e)return t;let n=Sr(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Yo=(e,t,r)=>{if(!e)return t;let n=Sr(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Xo.exports=Zc});var Jo=S(function(Bd,Zo){var Ge=ze(),Vt=He(),tl=J(),qt=fr(),rl=De(),nl=Rn(),ol=wn(),il=Sn(),sl=An(),al=Tn(),cl=On(),ll=_n(),ul=Fn(),dl=he(),pl=jn(),gl=Vn(),fl=Nt(),ml=Gn(),yl=Kn(),hl=ot(),bl=_t(),Cl=yr(),Rl=hr(),Il=Lt(),wl=Ft(),Pl=br(),xl=no(),Sl=so(),El=st(),kl=be(),Al=ct(),vl=Po(),Tl=So(),Dl=ko(),Ol=To(),Nl=Oo(),_l=Ut(),Ll=Mo(),Fl=jo(),$l=qo(),Ml=zo(),Bl=Qo();Zo.exports={parse:rl,valid:nl,clean:ol,inc:il,diff:sl,major:al,minor:cl,patch:ll,prerelease:ul,compare:dl,rcompare:pl,compareLoose:gl,compareBuild:fl,sort:ml,rsort:yl,gt:hl,lt:bl,eq:Cl,neq:Rl,gte:Il,lte:wl,cmp:Pl,coerce:xl,truncate:Sl,Comparator:El,Range:kl,satisfies:Al,toComparators:vl,maxSatisfying:Tl,minSatisfying:Dl,minVersion:Ol,validRange:Nl,outside:_l,gtr:Ll,ltr:Fl,intersects:$l,simplifyRange:Ml,subset:Bl,SemVer:tl,re:Ge.re,src:Ge.src,tokens:Ge.t,SEMVER_SPEC_VERSION:Vt.SEMVER_SPEC_VERSION,RELEASE_TYPES:Vt.RELEASE_TYPES,compareIdentifiers:qt.compareIdentifiers,rcompareIdentifiers:qt.rcompareIdentifiers}});import As from"os";import vs from"fs";var mt=new Map,Yt=new Map,Xt=Symbol("OriginError"),Ue={};class ye extends Promise{constructor(e,t,r,n,o={}){let i,s;super((c,u)=>{i=c,s=u});this.tagged=Array.isArray(e.raw),this.strings=e,this.args=t,this.handler=r,this.canceller=n,this.options=o,this.state=null,this.statement=null,this.resolve=(c)=>(this.active=!1,i(c)),this.reject=(c)=>(this.active=!1,s(c)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[Xt]=this.handler.debug?Error():this.tagged&&is(this.strings)}get origin(){return(this.handler.debug?this[Xt].stack:this.tagged&&Yt.has(this.strings)?Yt.get(this.strings):Yt.set(this.strings,this[Xt].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(e=1,t){if(this.options.simple=!1,typeof e==="function")t=e,e=1;if(this.cursorRows=e,typeof t==="function")return this.cursorFn=t,this;let r;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};r&&r();let n=new Promise((o,i)=>{this.cursorFn=(s)=>(o({value:s,done:!1}),new Promise((c)=>r=c)),this.resolve=()=>(this.active=!1,o({done:!0})),this.reject=(s)=>(this.active=!1,i(s))});return this.execute(),n},return(){return r&&r(Ue),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw Error(".stream has been renamed to .forEach")}forEach(e){return this.forEachFn=e,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function is(e){if(mt.has(e))return mt.get(e);let t=Error.stackTraceLimit;return Error.stackTraceLimit=4,mt.set(e,Error()),Error.stackTraceLimit=t,mt.get(e)}class Ve extends Error{constructor(e){super(e.message);this.name=this.constructor.name,Object.assign(this,e)}}var K={connection:Ur,postgres:Vr,generic:qr,notSupported:Hr};function Ur(e,t,r){let{host:n,port:o}=r||t,i=Object.assign(Error("write "+e+" "+(t.path||n+":"+o)),{code:e,errno:e,address:t.path||n},t.path?{}:{port:o});return Error.captureStackTrace(i,Ur),i}function Vr(e){let t=new Ve(e);return Error.captureStackTrace(t,Vr),t}function qr(e,t){let r=Object.assign(Error(e+": "+t),{code:e});return Error.captureStackTrace(r,qr),r}function Hr(e){let t=Object.assign(Error(e+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:e});return Error.captureStackTrace(t,Hr),t}var ss={string:{to:25,from:null,serialize:(e)=>""+e},number:{to:0,from:[21,23,26,700,701],serialize:(e)=>""+e,parse:(e)=>+e},json:{to:114,from:[114,3802],serialize:(e)=>JSON.stringify(e),parse:(e)=>JSON.parse(e)},boolean:{to:16,from:16,serialize:(e)=>e===!0?"t":"f",parse:(e)=>e==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(e)=>(e instanceof Date?e:new Date(e)).toISOString(),parse:(e)=>new Date(e)},bytea:{to:17,from:17,serialize:(e)=>"\\x"+Buffer.from(e).toString("hex"),parse:(e)=>Buffer.from(e.slice(2),"hex")}};class bt{then(){Qt()}catch(){Qt()}finally(){Qt()}}class tt extends bt{constructor(e){super();this.value=It(e)}}class Ie extends bt{constructor(e,t,r){super();this.value=e,this.type=t,this.array=r}}class Ct extends bt{constructor(e,t){super();this.first=e,this.rest=t}build(e,t,r,n){let o=as.map(([i,s])=>({fn:s,i:e.search(i)})).sort((i,s)=>i.i-s.i).pop();return o.i===-1?rr(this.first,n):o.fn(this.first,this.rest,t,r,n)}}function Rt(e,t,r,n){let o=e instanceof Ie?e.value:e;if(o===void 0){if(e instanceof Ie?e.value=n.transform.undefined:o=e=n.transform.undefined,o===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+r.push(e instanceof Ie?(t.push(e.value),e.array?e.array[e.type||ht(e.value)]||e.type||Kr(e.value):e.type):(t.push(e),ht(e)))}var Gr=Xr(ss);function er(e,t,r,n,o,i){for(let s=1;s<e.strings.length;s++)t+=tr(t,r,n,o,i)+e.strings[s],r=e.args[s];return t}function tr(e,t,r,n,o){return t instanceof Ct?t.build(e,r,n,o):t instanceof ye?Jt(t,r,n,o):t instanceof tt?t.value:t&&t[0]instanceof ye?t.reduce((i,s)=>i+" "+Jt(s,r,n,o),""):Rt(t,r,n,o)}function Jt(e,t,r,n){return e.fragment=!0,er(e,e.strings[0],e.args[0],t,r,n)}function Wr(e,t,r,n,o){return e.map((i)=>"("+n.map((s)=>tr("values",i[s],t,r,o)).join(",")+")").join(",")}function zr(e,t,r,n,o){let i=Array.isArray(e[0]),s=t.length?t.flat():Object.keys(i?e[0]:e);return Wr(i?e:[e],r,n,s,o)}function yt(e,t,r,n,o){if(typeof e==="string"&&(e=[e].concat(t)),Array.isArray(e))return rr(e,o);let i;return(t.length?t.flat():Object.keys(e)).map((c)=>(i=e[c],(i instanceof ye?Jt(i,r,n,o):i instanceof tt?i.value:Rt(i,r,n,o))+" as "+It(o.transform.column.to?o.transform.column.to(c):c))).join(",")}var as=Object.entries({values:zr,in:(...e)=>{let t=zr(...e);return t==="()"?"(null)":t},select:yt,as:yt,returning:yt,"\\(":yt,update(e,t,r,n,o){return(t.length?t.flat():Object.keys(e)).map((i)=>It(o.transform.column.to?o.transform.column.to(i):i)+"="+tr("values",e[i],r,n,o))},insert(e,t,r,n,o){let i=t.length?t.flat():Object.keys(Array.isArray(e)?e[0]:e);return"("+rr(i,o)+")values"+Wr(Array.isArray(e)?e:[e],r,n,i,o)}}).map(([e,t])=>[new RegExp("((?:^|[\\s(])"+e+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),t]);function Qt(){throw K.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:cs,parsers:ls}=Gr;function Kr(e){if(Array.isArray(e))return Kr(e[0]);return typeof e==="string"?1009:0}var Yr=function(e){let t=Xr(e||{});return{serializers:Object.assign({},cs,t.serializers),parsers:Object.assign({},ls,t.parsers)}};function Xr(e){return Object.keys(e).reduce((t,r)=>{if(e[r].from&&[].concat(e[r].from).forEach((n)=>t.parsers[n]=e[r].parse),e[r].serialize)t.serializers[e[r].to]=e[r].serialize,e[r].from&&[].concat(e[r].from).forEach((n)=>t.serializers[n]=e[r].serialize);return t},{parsers:{},serializers:{}})}function rr(e,{transform:{column:t}}){return e.map((r)=>It(t.to?t.to(r):r)).join(",")}var It=function(t){return'"'+t.replace(/"/g,'""').replace(/\./g,'"."')+'"'},ht=function e(t){return t instanceof Ie?t.type:t instanceof Date?1184:t instanceof Uint8Array?17:t===!0||t===!1?16:typeof t==="bigint"?20:Array.isArray(t)?e(t[0]):0},us=/\\/g,ds=/"/g;function ps(e){return e.replace(us,"\\\\").replace(ds,"\\\"")}var Qr=function e(t,r,n,o){if(Array.isArray(t)===!1)return t;if(!t.length)return"{}";let i=t[0],s=o===1020?";":",";if(Array.isArray(i)&&!i.type)return"{"+t.map((c)=>e(c,r,n,o)).join(s)+"}";return"{"+t.map((c)=>{if(c===void 0){if(c=n.transform.undefined,c===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return c===null?"null":'"'+ps(r?r(c.type?c.value:c):""+c)+'"'}).join(s)+"}"},Zt={i:0,char:null,str:"",quoted:!1,last:0},Zr=function(t,r,n){return Zt.i=Zt.last=0,Jr(Zt,t,r,n)};function Jr(e,t,r,n){let o=[],i=n===1020?";":",";for(;e.i<t.length;e.i++){if(e.char=t[e.i],e.quoted)if(e.char==="\\")e.str+=t[++e.i];else if(e.char==='"')o.push(r?r(e.str):e.str),e.str="",e.quoted=t[e.i+1]==='"',e.last=e.i+2;else e.str+=e.char;else if(e.char==='"')e.quoted=!0;else if(e.char==="{")e.last=++e.i,o.push(Jr(e,t,r,n));else if(e.char==="}"){e.quoted=!1,e.last<e.i&&o.push(r?r(t.slice(e.last,e.i)):t.slice(e.last,e.i)),e.last=e.i+1;break}else if(e.char===i&&e.p!=="}"&&e.p!=='"')o.push(r?r(t.slice(e.last,e.i)):t.slice(e.last,e.i)),e.last=e.i+1;e.p=e.char}return e.last<e.i&&o.push(r?r(t.slice(e.last,e.i+1)):t.slice(e.last,e.i+1)),o}var Ne=(e)=>{let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},_e=(e)=>{let t=e[0].toUpperCase();for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},Le=(e)=>e.replace(/_/g,"-"),Ze=(e)=>e.replace(/([A-Z])/g,"_$1").toLowerCase(),Je=(e)=>(e.slice(0,1)+e.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),et=(e)=>e.replace(/-/g,"_");function nr(e){return function t(r,n){return typeof r==="object"&&r!==null&&(n.type===114||n.type===3802)?Array.isArray(r)?r.map((o)=>t(o,n)):Object.entries(r).reduce((o,[i,s])=>Object.assign(o,{[e(i)]:t(s,n)}),{}):r}}Ne.column={from:Ne};Ne.value={from:nr(Ne)};Ze.column={to:Ze};var or={...Ne};or.column.to=Ze;_e.column={from:_e};_e.value={from:nr(_e)};Je.column={to:Je};var ir={..._e};ir.column.to=Je;Le.column={from:Le};Le.value={from:nr(Le)};et.column={to:et};var sr={...Le};sr.column.to=et;import en from"net";import ys from"tls";import rt from"crypto";import ar from"stream";import{performance as tn}from"perf_hooks";class Fe extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var fe=gs;function gs(e=[]){let t=e.slice(),r=0;return{get length(){return t.length-r},remove:(n)=>{let o=t.indexOf(n);return o===-1?null:(t.splice(o,1),n)},push:(n)=>(t.push(n),n),shift:()=>{let n=t[r++];if(r===t.length)r=0,t=[];else t[r-1]=void 0;return n}}}var ie=Buffer.allocUnsafe(256),fs="BCcDdEFfHPpQSX".split("").reduce((e,t)=>{let r=t.charCodeAt(0);return e[t]=()=>(ie[0]=r,F.i=5,F),e},{}),F=Object.assign(ms,fs,{N:String.fromCharCode(0),i:0,inc(e){return F.i+=e,F},str(e){let t=Buffer.byteLength(e);return wt(t),F.i+=ie.write(e,F.i,t,"utf8"),F},i16(e){return wt(2),ie.writeUInt16BE(e,F.i),F.i+=2,F},i32(e,t){if(t||t===0)return ie.writeUInt32BE(e,t),F;return wt(4),ie.writeUInt32BE(e,F.i),F.i+=4,F},z(e){return wt(e),ie.fill(0,F.i,F.i+e),F.i+=e,F},raw(e){return ie=Buffer.concat([ie.subarray(0,F.i),e]),F.i=ie.length,F},end(e=1){ie.writeUInt32BE(F.i-e,e);let t=ie.subarray(0,F.i);return F.i=0,ie=Buffer.allocUnsafe(256),t}}),w=F;function wt(e){if(ie.length-F.i<e){let t=ie,r=t.length;ie=Buffer.allocUnsafe(r+(r>>1)+e),t.copy(ie)}}function ms(){return F.i=0,F}var lr=on,hs=1,Te=w().S().end(),rn=w().H().end(),bs=w().i32(8).i32(80877103).end(8),Cs=Buffer.concat([w().E().str(w.N).i32(0).end(),Te]),Rs=w().D().str("S").str(w.N).end(),qe=()=>{},Is=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),ws={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function on(e,t={},{onopen:r=qe,onend:n=qe,onclose:o=qe}={}){let{sslnegotiation:i,ssl:s,max:c,user:u,host:p,port:f,database:m,parsers:R,transform:g,onnotice:L,onnotify:I,onparameter:A,max_pipeline:O,keep_alive:te,backoff:de,target_session_attrs:pe}=e,T=fe(),ke=hs++,Pe={pid:null,secret:null},$e=cr(Wt,e.idle_timeout),Oe=cr(Wt,e.max_lifetime),D=cr(di,e.connect_timeout),h=null,xe,ue=null,N=new Fe,se=Buffer.alloc(0),Me=e.fetch_types,Se={},d={},x=Math.random().toString(36).slice(2),j=1,Y=0,G=0,k=0,_=0,q=0,H=0,X=0,ae=null,M=null,Ee=!1,Re=null,Ae=null,re=null,V=null,B=null,ge=null,gt=null,zt=null,y=null,Ke=null,ne={queue:t.closed,idleTimer:$e,connect(a){re=a,_r()},terminate:Qe,execute:Ye,cancel:ai,end:Wt,count:0,id:ke};return t.closed&&t.closed.push(ne),ne;async function si(){let a;try{a=e.socket?await Promise.resolve(e.socket(e)):new en.Socket}catch(l){je(l);return}return a.on("error",je),a.on("close",Lr),a.on("drain",Or),a}async function ai({pid:a,secret:l},P,v){try{xe=w().i32(16).i32(80877102).i32(a).i32(l).end(16),await Nr(),h.once("error",v),h.once("close",P)}catch(W){v(W)}}function Ye(a){if(Ee)return Xe(a,K.connection("CONNECTION_DESTROYED",e));if(B)return Xe(a,K.generic("COPY_IN_PROGRESS","You cannot execute queries during copy"));if(a.cancelled)return;try{return a.state=Pe,y?T.push(a):(y=a,y.active=!0),ui(a),Z(ci(a))&&!a.describeFirst&&!a.cursorFn&&T.length<O&&(!a.options.onexecute||a.options.onexecute(ne))}catch(l){return T.length===0&&Z(Te),me(l),!0}}function ci(a){if(a.parameters.length>=65534)throw K.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return a.options.simple?w().Q().str(a.statement.string+w.N).end():a.describeFirst?Buffer.concat([vr(a),rn]):a.prepare?a.prepared?ft(a):Buffer.concat([vr(a),ft(a)]):li(a)}function vr(a){return Buffer.concat([$r(a.statement.string,a.parameters,a.statement.types,a.statement.name),Yi("S",a.statement.name)])}function ft(a){return Buffer.concat([Ki(a.parameters,a.statement.types,a.statement.name,a.cursorName),a.cursorFn?Mr("",a.cursorRows):Cs])}function li(a){return Buffer.concat([$r(a.statement.string,a.parameters,a.statement.types),Rs,ft(a)])}function ui(a){let l=[],P=[],v=er(a,a.strings[0],a.args[0],l,P,e);!a.tagged&&a.args.forEach((W)=>Rt(W,l,P,e)),a.prepare=e.prepare&&("prepare"in a.options?a.options.prepare:!0),a.string=v,a.signature=a.prepare&&P+v,a.onlyDescribe&&delete d[a.signature],a.parameters=a.parameters||l,a.prepared=a.prepare&&a.signature in d,a.describeFirst=a.onlyDescribe||l.length&&!a.prepared,a.statement=a.prepared?d[a.signature]:{string:v,types:P,name:a.prepare?x+j++:""},typeof e.debug==="function"&&e.debug(ke,v,l,P)}function Z(a,l){if(ge=ge?Buffer.concat([ge,a]):Buffer.from(a),l||ge.length>=1024)return Tr(l);return M===null&&(M=setImmediate(Tr)),!0}function Tr(a){let l=h.write(ge,a);return M!==null&&clearImmediate(M),ge=M=null,l}function di(){me(K.connection("CONNECT_TIMEOUT",e,h)),h.destroy()}async function Dr(){if(i!=="direct"){if(Z(bs),!await new Promise((P)=>h.once("data",(v)=>P(v[0]===83)))&&s==="prefer")return Be()}let a={socket:h,servername:en.isIP(h.host)?void 0:h.host};if(i==="direct")a.ALPNProtocols=["postgresql"];if(s==="require"||s==="allow"||s==="prefer")a.rejectUnauthorized=!1;else if(typeof s==="object")Object.assign(a,s);h.removeAllListeners(),h=ys.connect(a),h.on("secureConnect",Be),h.on("error",je),h.on("close",Lr),h.on("drain",Or)}function Or(){!y&&r(ne)}function Gt(a){if(Re){if(Re.push(a),G-=a.length,G>0)return}se=Re?Buffer.concat(Re,q-G):se.length===0?a:Buffer.concat([se,a],se.length+a.length);while(se.length>4){if(q=se.readUInt32BE(1),q>=se.length){G=q-se.length,Re=[se];break}try{pi(se.subarray(0,q+1))}catch(l){y&&(y.cursorFn||y.describeFirst)&&Z(Te),me(l)}se=se.subarray(q+1),G=0,Re=null}}async function Nr(){if(Ee=!1,Se={},h||(h=await si()),!h)return;if(D.start(),e.socket)return s?Dr():Be();if(h.on("connect",s?Dr:Be),e.path)return h.connect(e.path);h.ssl=s,h.connect(f[k],p[k]),h.host=p[k],h.port=f[k],k=(k+1)%f.length}function _r(){setTimeout(Nr,Y?Math.max(0,Y+H-tn.now()):0)}function Be(){try{d={},Me=e.fetch_types,x=Math.random().toString(36).slice(2),j=1,Oe.start(),h.on("data",Gt),te&&h.setKeepAlive&&h.setKeepAlive(!0,1000*te);let a=Qi();Z(a)}catch(a){je(a)}}function je(a){if(ne.queue===t.connecting&&e.host[_+1])return;me(a);while(T.length)Xe(T.shift(),a)}function me(a){B&&(B.destroy(a),B=null),y&&Xe(y,a),re&&(Xe(re,a),re=null)}function Xe(a,l){if(a.reserve)return a.reject(l);if(!l||typeof l!=="object")l=Error(l);"query"in l||"parameters"in l||Object.defineProperties(l,{stack:{value:l.stack+a.origin.replace(/.*\n/,`
|
|
2
|
+
var Zi=Object.create;var{getPrototypeOf:Ji,defineProperty:Br,getOwnPropertyNames:es}=Object;var jr=Object.prototype.hasOwnProperty;function ts(e){return this[e]}var rs,ns,os=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?rs??=new WeakMap:ns??=new WeakMap,i=o.get(e);if(i)return i}r=e!=null?Zi(Ji(e)):{};let s=t||!e||!e.__esModule||!jr.call(e,"default")?Br(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let c of es(e))if(!jr.call(s,c))Br(s,c,{get:ts.bind(e,c),enumerable:!0})}if(n)o.set(e,s);return s};var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var He=S(function(Xu,cn){var $s=Number.MAX_SAFE_INTEGER||9007199254740991,Ms=["major","premajor","minor","preminor","patch","prepatch","prerelease"];cn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:$s,RELEASE_TYPES:Ms,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var nt=S(function(Qu,ln){var Bs=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};ln.exports=Bs});var ze=S(function(we,un){var{MAX_SAFE_COMPONENT_LENGTH:pr,MAX_SAFE_BUILD_LENGTH:js,MAX_LENGTH:Us}=He(),Vs=nt();we=un.exports={};var qs=we.re=[],Hs=we.safeRe=[],b=we.src=[],zs=we.safeSrc=[],C=we.t={},Gs=0,gr="[a-zA-Z0-9-]",Ws=[["\\s",1],["\\d",Us],[gr,js]],Ks=(e)=>{for(let[t,r]of Ws)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},E=(e,t,r)=>{let n=Ks(t),o=Gs++;Vs(e,o,t),C[e]=o,b[o]=t,zs[o]=n,qs[o]=new RegExp(t,r?"g":void 0),Hs[o]=new RegExp(n,r?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gr}*`);E("MAINVERSION",`(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})\\.(${b[C.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})\\.(${b[C.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${b[C.NONNUMERICIDENTIFIER]}|${b[C.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASE",`(?:-(${b[C.PRERELEASEIDENTIFIER]}(?:\\.${b[C.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${b[C.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[C.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${gr}+`);E("BUILD",`(?:\\+(${b[C.BUILDIDENTIFIER]}(?:\\.${b[C.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${b[C.MAINVERSION]}${b[C.PRERELEASE]}?${b[C.BUILD]}?`);E("FULL",`^${b[C.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${b[C.MAINVERSIONLOOSE]}${b[C.PRERELEASELOOSE]}?${b[C.BUILD]}?`);E("LOOSE",`^${b[C.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${b[C.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${b[C.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:\\.(${b[C.XRANGEIDENTIFIER]})(?:${b[C.PRERELEASE]})?${b[C.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[C.XRANGEIDENTIFIERLOOSE]})(?:${b[C.PRERELEASELOOSE]})?${b[C.BUILD]}?)?)?`);E("XRANGE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${b[C.GTLT]}\\s*${b[C.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${pr}})(?:\\.(\\d{1,${pr}}))?(?:\\.(\\d{1,${pr}}))?`);E("COERCE",`${b[C.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",b[C.COERCEPLAIN]+`(?:${b[C.PRERELEASE]})?(?:${b[C.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",b[C.COERCE],!0);E("COERCERTLFULL",b[C.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${b[C.LONETILDE]}\\s+`,!0);we.tildeTrimReplace="$1~";E("TILDE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${b[C.LONETILDE]}${b[C.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${b[C.LONECARET]}\\s+`,!0);we.caretTrimReplace="$1^";E("CARET",`^${b[C.LONECARET]}${b[C.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${b[C.LONECARET]}${b[C.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${b[C.GTLT]}\\s*(${b[C.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${b[C.GTLT]}\\s*(${b[C.LOOSEPLAIN]}|${b[C.XRANGEPLAIN]})`,!0);we.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${b[C.XRANGEPLAIN]})\\s+-\\s+(${b[C.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${b[C.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[C.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var At=S(function(Zu,dn){var Ys=Object.freeze({loose:!0}),Xs=Object.freeze({}),Qs=(e)=>{if(!e)return Xs;if(typeof e!=="object")return Ys;return e};dn.exports=Qs});var fr=S(function(Ju,fn){var pn=/^[0-9]+$/,gn=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=pn.test(e),n=pn.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Zs=(e,t)=>gn(t,e);fn.exports={compareIdentifiers:gn,rcompareIdentifiers:Zs}});var J=S(function(ed,yn){var vt=nt(),{MAX_LENGTH:mn,MAX_SAFE_INTEGER:Tt}=He(),{safeRe:Dt,t:Ot}=ze(),Js=At(),{compareIdentifiers:mr}=fr(),ea=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(mr(e[n],r[n])!==0)return!1;return!0};class Ce{constructor(e,t){if(t=Js(t),e instanceof Ce)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>mn)throw TypeError(`version is longer than ${mn} characters`);vt("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Dt[Ot.LOOSE]:Dt[Ot.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Tt||this.major<0)throw TypeError("Invalid major version");if(this.minor>Tt||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Tt||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<Tt)return o}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(vt("SemVer.compare",this.version,this.options,e),!(e instanceof Ce)){if(typeof e==="string"&&e===this.version)return 0;e=new Ce(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Ce))e=new Ce(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Ce))e=new Ce(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(vt("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return mr(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Ce))e=new Ce(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(vt("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return mr(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Dt[Ot.PRERELEASELOOSE]:Dt[Ot.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let o=this.prerelease.length;while(--o>=0)if(typeof this.prerelease[o]==="number")this.prerelease[o]++,o=-2;if(o===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let o=[t,n];if(r===!1)o=[t];if(ea(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=o}else this.prerelease=o}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}yn.exports=Ce});var De=S(function(td,bn){var hn=J(),ta=(e,t,r=!1)=>{if(e instanceof hn)return e;try{return new hn(e,t)}catch(n){if(!r)return null;throw n}};bn.exports=ta});var Rn=S(function(rd,Cn){var ra=De(),na=(e,t)=>{let r=ra(e,t);return r?r.version:null};Cn.exports=na});var wn=S(function(nd,In){var oa=De(),ia=(e,t)=>{let r=oa(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};In.exports=ia});var Sn=S(function(od,xn){var Pn=J(),sa=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new Pn(e instanceof Pn?e.version:e,r).inc(t,n,o).version}catch(i){return null}};xn.exports=sa});var An=S(function(id,kn){var En=De(),aa=(e,t)=>{let r=En(e,null,!0),n=En(t,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,c=i?n:r,u=!!s.prerelease.length;if(!!c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(c.compareMain(s)===0){if(c.minor&&!c.patch)return"minor";return"patch"}}let f=u?"pre":"";if(r.major!==n.major)return f+"major";if(r.minor!==n.minor)return f+"minor";if(r.patch!==n.patch)return f+"patch";return"prerelease"};kn.exports=aa});var Tn=S(function(sd,vn){var ca=J(),la=(e,t)=>new ca(e,t).major;vn.exports=la});var On=S(function(ad,Dn){var ua=J(),da=(e,t)=>new ua(e,t).minor;Dn.exports=da});var _n=S(function(cd,Nn){var pa=J(),ga=(e,t)=>new pa(e,t).patch;Nn.exports=ga});var Fn=S(function(ld,Ln){var fa=De(),ma=(e,t)=>{let r=fa(e,t);return r&&r.prerelease.length?r.prerelease:null};Ln.exports=ma});var he=S(function(ud,Mn){var $n=J(),ya=(e,t,r)=>new $n(e,r).compare(new $n(t,r));Mn.exports=ya});var jn=S(function(dd,Bn){var ha=he(),ba=(e,t,r)=>ha(t,e,r);Bn.exports=ba});var Vn=S(function(pd,Un){var Ca=he(),Ra=(e,t)=>Ca(e,t,!0);Un.exports=Ra});var Nt=S(function(gd,Hn){var qn=J(),Ia=(e,t,r)=>{let n=new qn(e,r),o=new qn(t,r);return n.compare(o)||n.compareBuild(o)};Hn.exports=Ia});var Gn=S(function(fd,zn){var wa=Nt(),Pa=(e,t)=>e.sort((r,n)=>wa(r,n,t));zn.exports=Pa});var Kn=S(function(md,Wn){var xa=Nt(),Sa=(e,t)=>e.sort((r,n)=>xa(n,r,t));Wn.exports=Sa});var ot=S(function(yd,Yn){var Ea=he(),ka=(e,t,r)=>Ea(e,t,r)>0;Yn.exports=ka});var _t=S(function(hd,Xn){var Aa=he(),va=(e,t,r)=>Aa(e,t,r)<0;Xn.exports=va});var yr=S(function(bd,Qn){var Ta=he(),Da=(e,t,r)=>Ta(e,t,r)===0;Qn.exports=Da});var hr=S(function(Cd,Zn){var Oa=he(),Na=(e,t,r)=>Oa(e,t,r)!==0;Zn.exports=Na});var Lt=S(function(Rd,Jn){var _a=he(),La=(e,t,r)=>_a(e,t,r)>=0;Jn.exports=La});var Ft=S(function(Id,eo){var Fa=he(),$a=(e,t,r)=>Fa(e,t,r)<=0;eo.exports=$a});var br=S(function(wd,to){var Ma=yr(),Ba=hr(),ja=ot(),Ua=Lt(),Va=_t(),qa=Ft(),Ha=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Ma(e,r,n);case"!=":return Ba(e,r,n);case">":return ja(e,r,n);case">=":return Ua(e,r,n);case"<":return Va(e,r,n);case"<=":return qa(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};to.exports=Ha});var no=S(function(Pd,ro){var za=J(),Ga=De(),{safeRe:$t,t:Mt}=ze(),Wa=(e,t)=>{if(e instanceof za)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?$t[Mt.COERCEFULL]:$t[Mt.COERCE]);else{let u=t.includePrerelease?$t[Mt.COERCERTLFULL]:$t[Mt.COERCERTL],p;while((p=u.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||p.index+p[0].length!==r.index+r[0].length)r=p;u.lastIndex=p.index+p[1].length+p[2].length}u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",c=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Ga(`${n}.${o}.${i}${s}${c}`,t)};ro.exports=Wa});var so=S(function(xd,io){var Ka=De(),oo=He(),Ya=J(),Xa=(e,t,r)=>{if(!oo.RELEASE_TYPES.includes(t))return null;let n=Qa(e,r);return n&&Za(n,t)},Qa=(e,t)=>{let r=e instanceof Ya?e.version:e;return Ka(r,t)},Za=(e,t)=>{if(Ja(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Ja=(e)=>e.startsWith("pre");io.exports=Xa});var lo=S(function(Sd,co){class ao{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}co.exports=ao});var be=S(function(Ed,fo){var ec=/\s+/g;class it{constructor(e,t){if(t=rc(t),e instanceof it)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new it(e.raw,t);if(e instanceof Bt)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(ec," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!po(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&dc(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(uc,"");let r=((this.options.includePrerelease&&cc)|(this.options.loose&&lc))+":"+e,n=uo.get(r);if(n)return n;let o=this.options.loose,i=o?le[ee.HYPHENRANGELOOSE]:le[ee.HYPHENRANGE];e=e.replace(i,wc(this.options.includePrerelease)),U("hyphen replace",e),e=e.replace(le[ee.COMPARATORTRIM],ic),U("comparator trim",e),e=e.replace(le[ee.TILDETRIM],sc),U("tilde trim",e),e=e.replace(le[ee.CARETTRIM],ac),U("caret trim",e);let s=e.split(" ").map((f)=>pc(f,this.options)).join(" ").split(/\s+/).map((f)=>Ic(f,this.options));if(o)s=s.filter((f)=>(U("loose invalid filter",f,this.options),!!f.match(le[ee.COMPARATORLOOSE])));U("range list",s);let c=new Map,u=s.map((f)=>new Bt(f,this.options));for(let f of u){if(po(f))return[f];c.set(f.value,f)}if(c.size>1&&c.has(""))c.delete("");let p=[...c.values()];return uo.set(r,p),p}intersects(e,t){if(!(e instanceof it))throw TypeError("a Range is required");return this.set.some((r)=>go(r,t)&&e.set.some((n)=>go(n,t)&&r.every((o)=>n.every((i)=>o.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new nc(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Pc(this.set[t],e,this.options))return!0;return!1}}fo.exports=it;var tc=lo(),uo=new tc,rc=At(),Bt=st(),U=nt(),nc=J(),{safeRe:le,src:oc,t:ee,comparatorTrimReplace:ic,tildeTrimReplace:sc,caretTrimReplace:ac}=ze(),{FLAG_INCLUDE_PRERELEASE:cc,FLAG_LOOSE:lc}=He(),uc=new RegExp(oc[ee.BUILD],"g"),po=(e)=>e.value==="<0.0.0-0",dc=(e)=>e.value==="",go=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();while(r&&n.length)r=n.every((i)=>o.intersects(i,t)),o=n.pop();return r},pc=(e,t)=>(e=e.replace(le[ee.BUILD],""),U("comp",e,t),e=yc(e,t),U("caret",e),e=fc(e,t),U("tildes",e),e=bc(e,t),U("xrange",e),e=Rc(e,t),U("stars",e),e),Q=(e)=>!e||e.toLowerCase()==="x"||e==="*",gc=(e,t,r)=>Q(e)&&!Q(t)||Q(t)&&r&&!Q(r),fc=(e,t)=>e.trim().split(/\s+/).map((r)=>mc(r,t)).join(" "),mc=(e,t)=>{let r=t.loose?le[ee.TILDELOOSE]:le[ee.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,c,u)=>{U("tilde",e,o,i,s,c,u);let p;if(Q(i))p="";else if(Q(s))p=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(Q(c))p=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else if(u)U("replaceTilde pr",u),p=`>=${i}.${s}.${c}-${u} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c} <${i}.${+s+1}.0-0`;return U("tilde return",p),p})},yc=(e,t)=>e.trim().split(/\s+/).map((r)=>hc(r,t)).join(" "),hc=(e,t)=>{U("caret",e,t);let r=t.loose?le[ee.CARETLOOSE]:le[ee.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,i,s,c,u)=>{U("caret",e,o,i,s,c,u);let p;if(Q(i))p="";else if(Q(s))p=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(Q(c))if(i==="0")p=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`;else if(u)if(U("replaceCaret pr",u),i==="0")if(s==="0")p=`>=${i}.${s}.${c}-${u} <${i}.${s}.${+c+1}-0`;else p=`>=${i}.${s}.${c}-${u} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c}-${u} <${+i+1}.0.0-0`;else if(U("no pr"),i==="0")if(s==="0")p=`>=${i}.${s}.${c} <${i}.${s}.${+c+1}-0`;else p=`>=${i}.${s}.${c} <${i}.${+s+1}.0-0`;else p=`>=${i}.${s}.${c} <${+i+1}.0.0-0`;return U("caret return",p),p})},bc=(e,t)=>(U("replaceXRanges",e,t),e.split(/\s+/).map((r)=>Cc(r,t)).join(" ")),Cc=(e,t)=>{e=e.trim();let r=t.loose?le[ee.XRANGELOOSE]:le[ee.XRANGE];return e.replace(r,(n,o,i,s,c,u)=>{if(U("xRange",e,n,o,i,s,c,u),gc(i,s,c))return e;let p=Q(i),f=p||Q(s),m=f||Q(c),R=m;if(o==="="&&R)o="";if(u=t.includePrerelease?"-0":"",p)if(o===">"||o==="<")n="<0.0.0-0";else n="*";else if(o&&R){if(f)s=0;if(c=0,o===">")if(o=">=",f)i=+i+1,s=0,c=0;else s=+s+1,c=0;else if(o==="<=")if(o="<",f)i=+i+1;else s=+s+1;if(o==="<")u="-0";n=`${o+i}.${s}.${c}${u}`}else if(f)n=`>=${i}.0.0${u} <${+i+1}.0.0-0`;else if(m)n=`>=${i}.${s}.0${u} <${i}.${+s+1}.0-0`;return U("xRange return",n),n})},Rc=(e,t)=>(U("replaceStars",e,t),e.trim().replace(le[ee.STAR],"")),Ic=(e,t)=>(U("replaceGTE0",e,t),e.trim().replace(le[t.includePrerelease?ee.GTE0PRE:ee.GTE0],"")),wc=(e)=>(t,r,n,o,i,s,c,u,p,f,m,R)=>{if(Q(n))r="";else if(Q(o))r=`>=${n}.0.0${e?"-0":""}`;else if(Q(i))r=`>=${n}.${o}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(Q(p))u="";else if(Q(f))u=`<${+p+1}.0.0-0`;else if(Q(m))u=`<${p}.${+f+1}.0-0`;else if(R)u=`<=${p}.${f}.${m}-${R}`;else if(e)u=`<${p}.${f}.${+m+1}-0`;else u=`<=${u}`;return`${r} ${u}`.trim()},Pc=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(U(e[n].semver),e[n].semver===Bt.ANY)continue;if(e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}}return!1}return!0}});var st=S(function(kd,Ro){var at=Symbol("SemVer ANY");class jt{static get ANY(){return at}constructor(e,t){if(t=mo(t),e instanceof jt)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Rr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===at)this.value="";else this.value=this.operator+this.semver.version;Rr("comp",this)}parse(e){let t=this.options.loose?yo[ho.COMPARATORLOOSE]:yo[ho.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=at;else this.semver=new bo(r[2],this.options.loose)}toString(){return this.value}test(e){if(Rr("Comparator.test",e,this.options.loose),this.semver===at||e===at)return!0;if(typeof e==="string")try{e=new bo(e,this.options)}catch(t){return!1}return Cr(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof jt))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Co(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new Co(this.value,t).test(e.semver)}if(t=mo(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Cr(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Cr(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Ro.exports=jt;var mo=At(),{safeRe:yo,t:ho}=ze(),Cr=br(),Rr=nt(),bo=J(),Co=be()});var ct=S(function(Ad,Io){var xc=be(),Sc=(e,t,r)=>{try{t=new xc(t,r)}catch(n){return!1}return t.test(e)};Io.exports=Sc});var Po=S(function(vd,wo){var Ec=be(),kc=(e,t)=>new Ec(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));wo.exports=kc});var So=S(function(Td,xo){var Ac=J(),vc=be(),Tc=(e,t,r)=>{let n=null,o=null,i=null;try{i=new vc(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===-1)n=s,o=new Ac(n,r)}}),n};xo.exports=Tc});var ko=S(function(Dd,Eo){var Dc=J(),Oc=be(),Nc=(e,t,r)=>{let n=null,o=null,i=null;try{i=new Oc(t,r)}catch(s){return null}return e.forEach((s)=>{if(i.test(s)){if(!n||o.compare(s)===1)n=s,o=new Dc(n,r)}}),n};Eo.exports=Nc});var To=S(function(Od,vo){var Ir=J(),_c=be(),Ao=ot(),Lc=(e,t)=>{e=new _c(e,t);let r=new Ir("0.0.0");if(e.test(r))return r;if(r=new Ir("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let o=e.set[n],i=null;if(o.forEach((s)=>{let c=new Ir(s.semver.version);switch(s.operator){case">":if(c.prerelease.length===0)c.patch++;else c.prerelease.push(0);c.raw=c.format();case"":case">=":if(!i||Ao(c,i))i=c;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||Ao(r,i)))r=i}if(r&&e.test(r))return r;return null};vo.exports=Lc});var Oo=S(function(Nd,Do){var Fc=be(),$c=(e,t)=>{try{return new Fc(e,t).range||"*"}catch(r){return null}};Do.exports=$c});var Ut=S(function(_d,Fo){var Mc=J(),Lo=st(),{ANY:Bc}=Lo,jc=be(),Uc=ct(),No=ot(),_o=_t(),Vc=Ft(),qc=Lt(),Hc=(e,t,r,n)=>{e=new Mc(e,n),t=new jc(t,n);let o,i,s,c,u;switch(r){case">":o=No,i=Vc,s=_o,c=">",u=">=";break;case"<":o=_o,i=qc,s=No,c="<",u="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Uc(e,t,n))return!1;for(let p=0;p<t.set.length;++p){let f=t.set[p],m=null,R=null;if(f.forEach((g)=>{if(g.semver===Bc)g=new Lo(">=0.0.0");if(m=m||g,R=R||g,o(g.semver,m.semver,n))m=g;else if(s(g.semver,R.semver,n))R=g}),m.operator===c||m.operator===u)return!1;if((!R.operator||R.operator===c)&&i(e,R.semver))return!1;else if(R.operator===u&&s(e,R.semver))return!1}return!0};Fo.exports=Hc});var Mo=S(function(Ld,$o){var zc=Ut(),Gc=(e,t,r)=>zc(e,t,">",r);$o.exports=Gc});var jo=S(function(Fd,Bo){var Wc=Ut(),Kc=(e,t,r)=>Wc(e,t,"<",r);Bo.exports=Kc});var qo=S(function($d,Vo){var Uo=be(),Yc=(e,t,r)=>(e=new Uo(e,r),t=new Uo(t,r),e.intersects(t,r));Vo.exports=Yc});var zo=S(function(Md,Ho){var Xc=ct(),Qc=he();Ho.exports=(e,t,r)=>{let n=[],o=null,i=null,s=e.sort((f,m)=>Qc(f,m,r));for(let f of s)if(Xc(f,t,r)){if(i=f,!o)o=f}else{if(i)n.push([o,i]);i=null,o=null}if(o)n.push([o,null]);let c=[];for(let[f,m]of n)if(f===m)c.push(f);else if(!m&&f===s[0])c.push("*");else if(!m)c.push(`>=${f}`);else if(f===s[0])c.push(`<=${m}`);else c.push(`${f} - ${m}`);let u=c.join(" || "),p=typeof t.raw==="string"?t.raw:String(t);return u.length<p.length?u:t}});var Qo=S(function(Bd,Xo){var Go=be(),xr=st(),{ANY:wr}=xr,Pr=ct(),Sr=he(),Zc=(e,t,r={})=>{if(e===t)return!0;e=new Go(e,r),t=new Go(t,r);let n=!1;e:for(let o of e.set){for(let i of t.set){let s=el(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Jc=[new xr(">=0.0.0-0")],Wo=[new xr(">=0.0.0")],el=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===wr)if(t.length===1&&t[0].semver===wr)return!0;else if(r.includePrerelease)e=Jc;else e=Wo;if(t.length===1&&t[0].semver===wr)if(r.includePrerelease)return!0;else t=Wo;let n=new Set,o,i;for(let g of e)if(g.operator===">"||g.operator===">=")o=Ko(o,g,r);else if(g.operator==="<"||g.operator==="<=")i=Yo(i,g,r);else n.add(g.semver);if(n.size>1)return null;let s;if(o&&i){if(s=Sr(o.semver,i.semver,r),s>0)return null;else if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let g of n){if(o&&!Pr(g,String(o),r))return null;if(i&&!Pr(g,String(i),r))return null;for(let L of t)if(!Pr(g,String(L),r))return!1;return!0}let c,u,p,f,m=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,R=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;if(m&&m.prerelease.length===1&&i.operator==="<"&&m.prerelease[0]===0)m=!1;for(let g of t){if(f=f||g.operator===">"||g.operator===">=",p=p||g.operator==="<"||g.operator==="<=",o){if(R){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===R.major&&g.semver.minor===R.minor&&g.semver.patch===R.patch)R=!1}if(g.operator===">"||g.operator===">="){if(c=Ko(o,g,r),c===g&&c!==o)return!1}else if(o.operator===">="&&!g.test(o.semver))return!1}if(i){if(m){if(g.semver.prerelease&&g.semver.prerelease.length&&g.semver.major===m.major&&g.semver.minor===m.minor&&g.semver.patch===m.patch)m=!1}if(g.operator==="<"||g.operator==="<="){if(u=Yo(i,g,r),u===g&&u!==i)return!1}else if(i.operator==="<="&&!g.test(i.semver))return!1}if(!g.operator&&(i||o)&&s!==0)return!1}if(o&&p&&!i&&s!==0)return!1;if(i&&f&&!o&&s!==0)return!1;if(R||m)return!1;return!0},Ko=(e,t,r)=>{if(!e)return t;let n=Sr(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Yo=(e,t,r)=>{if(!e)return t;let n=Sr(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Xo.exports=Zc});var Jo=S(function(jd,Zo){var Ge=ze(),Vt=He(),tl=J(),qt=fr(),rl=De(),nl=Rn(),ol=wn(),il=Sn(),sl=An(),al=Tn(),cl=On(),ll=_n(),ul=Fn(),dl=he(),pl=jn(),gl=Vn(),fl=Nt(),ml=Gn(),yl=Kn(),hl=ot(),bl=_t(),Cl=yr(),Rl=hr(),Il=Lt(),wl=Ft(),Pl=br(),xl=no(),Sl=so(),El=st(),kl=be(),Al=ct(),vl=Po(),Tl=So(),Dl=ko(),Ol=To(),Nl=Oo(),_l=Ut(),Ll=Mo(),Fl=jo(),$l=qo(),Ml=zo(),Bl=Qo();Zo.exports={parse:rl,valid:nl,clean:ol,inc:il,diff:sl,major:al,minor:cl,patch:ll,prerelease:ul,compare:dl,rcompare:pl,compareLoose:gl,compareBuild:fl,sort:ml,rsort:yl,gt:hl,lt:bl,eq:Cl,neq:Rl,gte:Il,lte:wl,cmp:Pl,coerce:xl,truncate:Sl,Comparator:El,Range:kl,satisfies:Al,toComparators:vl,maxSatisfying:Tl,minSatisfying:Dl,minVersion:Ol,validRange:Nl,outside:_l,gtr:Ll,ltr:Fl,intersects:$l,simplifyRange:Ml,subset:Bl,SemVer:tl,re:Ge.re,src:Ge.src,tokens:Ge.t,SEMVER_SPEC_VERSION:Vt.SEMVER_SPEC_VERSION,RELEASE_TYPES:Vt.RELEASE_TYPES,compareIdentifiers:qt.compareIdentifiers,rcompareIdentifiers:qt.rcompareIdentifiers}});import As from"os";import vs from"fs";var mt=new Map,Yt=new Map,Xt=Symbol("OriginError"),Ue={};class ye extends Promise{constructor(e,t,r,n,o={}){let i,s;super((c,u)=>{i=c,s=u});this.tagged=Array.isArray(e.raw),this.strings=e,this.args=t,this.handler=r,this.canceller=n,this.options=o,this.state=null,this.statement=null,this.resolve=(c)=>(this.active=!1,i(c)),this.reject=(c)=>(this.active=!1,s(c)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[Xt]=this.handler.debug?Error():this.tagged&&is(this.strings)}get origin(){return(this.handler.debug?this[Xt].stack:this.tagged&&Yt.has(this.strings)?Yt.get(this.strings):Yt.set(this.strings,this[Xt].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(e=1,t){if(this.options.simple=!1,typeof e==="function")t=e,e=1;if(this.cursorRows=e,typeof t==="function")return this.cursorFn=t,this;let r;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};r&&r();let n=new Promise((o,i)=>{this.cursorFn=(s)=>(o({value:s,done:!1}),new Promise((c)=>r=c)),this.resolve=()=>(this.active=!1,o({done:!0})),this.reject=(s)=>(this.active=!1,i(s))});return this.execute(),n},return(){return r&&r(Ue),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw Error(".stream has been renamed to .forEach")}forEach(e){return this.forEachFn=e,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function is(e){if(mt.has(e))return mt.get(e);let t=Error.stackTraceLimit;return Error.stackTraceLimit=4,mt.set(e,Error()),Error.stackTraceLimit=t,mt.get(e)}class Ve extends Error{constructor(e){super(e.message);this.name=this.constructor.name,Object.assign(this,e)}}var K={connection:Ur,postgres:Vr,generic:qr,notSupported:Hr};function Ur(e,t,r){let{host:n,port:o}=r||t,i=Object.assign(Error("write "+e+" "+(t.path||n+":"+o)),{code:e,errno:e,address:t.path||n},t.path?{}:{port:o});return Error.captureStackTrace(i,Ur),i}function Vr(e){let t=new Ve(e);return Error.captureStackTrace(t,Vr),t}function qr(e,t){let r=Object.assign(Error(e+": "+t),{code:e});return Error.captureStackTrace(r,qr),r}function Hr(e){let t=Object.assign(Error(e+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:e});return Error.captureStackTrace(t,Hr),t}var ss={string:{to:25,from:null,serialize:(e)=>""+e},number:{to:0,from:[21,23,26,700,701],serialize:(e)=>""+e,parse:(e)=>+e},json:{to:114,from:[114,3802],serialize:(e)=>JSON.stringify(e),parse:(e)=>JSON.parse(e)},boolean:{to:16,from:16,serialize:(e)=>e===!0?"t":"f",parse:(e)=>e==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(e)=>(e instanceof Date?e:new Date(e)).toISOString(),parse:(e)=>new Date(e)},bytea:{to:17,from:17,serialize:(e)=>"\\x"+Buffer.from(e).toString("hex"),parse:(e)=>Buffer.from(e.slice(2),"hex")}};class bt{then(){Qt()}catch(){Qt()}finally(){Qt()}}class tt extends bt{constructor(e){super();this.value=It(e)}}class Ie extends bt{constructor(e,t,r){super();this.value=e,this.type=t,this.array=r}}class Ct extends bt{constructor(e,t){super();this.first=e,this.rest=t}build(e,t,r,n){let o=as.map(([i,s])=>({fn:s,i:e.search(i)})).sort((i,s)=>i.i-s.i).pop();return o.i===-1?rr(this.first,n):o.fn(this.first,this.rest,t,r,n)}}function Rt(e,t,r,n){let o=e instanceof Ie?e.value:e;if(o===void 0){if(e instanceof Ie?e.value=n.transform.undefined:o=e=n.transform.undefined,o===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+r.push(e instanceof Ie?(t.push(e.value),e.array?e.array[e.type||ht(e.value)]||e.type||Kr(e.value):e.type):(t.push(e),ht(e)))}var Gr=Xr(ss);function er(e,t,r,n,o,i){for(let s=1;s<e.strings.length;s++)t+=tr(t,r,n,o,i)+e.strings[s],r=e.args[s];return t}function tr(e,t,r,n,o){return t instanceof Ct?t.build(e,r,n,o):t instanceof ye?Jt(t,r,n,o):t instanceof tt?t.value:t&&t[0]instanceof ye?t.reduce((i,s)=>i+" "+Jt(s,r,n,o),""):Rt(t,r,n,o)}function Jt(e,t,r,n){return e.fragment=!0,er(e,e.strings[0],e.args[0],t,r,n)}function Wr(e,t,r,n,o){return e.map((i)=>"("+n.map((s)=>tr("values",i[s],t,r,o)).join(",")+")").join(",")}function zr(e,t,r,n,o){let i=Array.isArray(e[0]),s=t.length?t.flat():Object.keys(i?e[0]:e);return Wr(i?e:[e],r,n,s,o)}function yt(e,t,r,n,o){if(typeof e==="string"&&(e=[e].concat(t)),Array.isArray(e))return rr(e,o);let i;return(t.length?t.flat():Object.keys(e)).map((c)=>(i=e[c],(i instanceof ye?Jt(i,r,n,o):i instanceof tt?i.value:Rt(i,r,n,o))+" as "+It(o.transform.column.to?o.transform.column.to(c):c))).join(",")}var as=Object.entries({values:zr,in:(...e)=>{let t=zr(...e);return t==="()"?"(null)":t},select:yt,as:yt,returning:yt,"\\(":yt,update(e,t,r,n,o){return(t.length?t.flat():Object.keys(e)).map((i)=>It(o.transform.column.to?o.transform.column.to(i):i)+"="+tr("values",e[i],r,n,o))},insert(e,t,r,n,o){let i=t.length?t.flat():Object.keys(Array.isArray(e)?e[0]:e);return"("+rr(i,o)+")values"+Wr(Array.isArray(e)?e:[e],r,n,i,o)}}).map(([e,t])=>[new RegExp("((?:^|[\\s(])"+e+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),t]);function Qt(){throw K.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:cs,parsers:ls}=Gr;function Kr(e){if(Array.isArray(e))return Kr(e[0]);return typeof e==="string"?1009:0}var Yr=function(e){let t=Xr(e||{});return{serializers:Object.assign({},cs,t.serializers),parsers:Object.assign({},ls,t.parsers)}};function Xr(e){return Object.keys(e).reduce((t,r)=>{if(e[r].from&&[].concat(e[r].from).forEach((n)=>t.parsers[n]=e[r].parse),e[r].serialize)t.serializers[e[r].to]=e[r].serialize,e[r].from&&[].concat(e[r].from).forEach((n)=>t.serializers[n]=e[r].serialize);return t},{parsers:{},serializers:{}})}function rr(e,{transform:{column:t}}){return e.map((r)=>It(t.to?t.to(r):r)).join(",")}var It=function(t){return'"'+t.replace(/"/g,'""').replace(/\./g,'"."')+'"'},ht=function e(t){return t instanceof Ie?t.type:t instanceof Date?1184:t instanceof Uint8Array?17:t===!0||t===!1?16:typeof t==="bigint"?20:Array.isArray(t)?e(t[0]):0},us=/\\/g,ds=/"/g;function ps(e){return e.replace(us,"\\\\").replace(ds,"\\\"")}var Qr=function e(t,r,n,o){if(Array.isArray(t)===!1)return t;if(!t.length)return"{}";let i=t[0],s=o===1020?";":",";if(Array.isArray(i)&&!i.type)return"{"+t.map((c)=>e(c,r,n,o)).join(s)+"}";return"{"+t.map((c)=>{if(c===void 0){if(c=n.transform.undefined,c===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return c===null?"null":'"'+ps(r?r(c.type?c.value:c):""+c)+'"'}).join(s)+"}"},Zt={i:0,char:null,str:"",quoted:!1,last:0},Zr=function(t,r,n){return Zt.i=Zt.last=0,Jr(Zt,t,r,n)};function Jr(e,t,r,n){let o=[],i=n===1020?";":",";for(;e.i<t.length;e.i++){if(e.char=t[e.i],e.quoted)if(e.char==="\\")e.str+=t[++e.i];else if(e.char==='"')o.push(r?r(e.str):e.str),e.str="",e.quoted=t[e.i+1]==='"',e.last=e.i+2;else e.str+=e.char;else if(e.char==='"')e.quoted=!0;else if(e.char==="{")e.last=++e.i,o.push(Jr(e,t,r,n));else if(e.char==="}"){e.quoted=!1,e.last<e.i&&o.push(r?r(t.slice(e.last,e.i)):t.slice(e.last,e.i)),e.last=e.i+1;break}else if(e.char===i&&e.p!=="}"&&e.p!=='"')o.push(r?r(t.slice(e.last,e.i)):t.slice(e.last,e.i)),e.last=e.i+1;e.p=e.char}return e.last<e.i&&o.push(r?r(t.slice(e.last,e.i+1)):t.slice(e.last,e.i+1)),o}var Ne=(e)=>{let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},_e=(e)=>{let t=e[0].toUpperCase();for(let r=1;r<e.length;r++)t+=e[r]==="_"?e[++r].toUpperCase():e[r];return t},Le=(e)=>e.replace(/_/g,"-"),Ze=(e)=>e.replace(/([A-Z])/g,"_$1").toLowerCase(),Je=(e)=>(e.slice(0,1)+e.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),et=(e)=>e.replace(/-/g,"_");function nr(e){return function t(r,n){return typeof r==="object"&&r!==null&&(n.type===114||n.type===3802)?Array.isArray(r)?r.map((o)=>t(o,n)):Object.entries(r).reduce((o,[i,s])=>Object.assign(o,{[e(i)]:t(s,n)}),{}):r}}Ne.column={from:Ne};Ne.value={from:nr(Ne)};Ze.column={to:Ze};var or={...Ne};or.column.to=Ze;_e.column={from:_e};_e.value={from:nr(_e)};Je.column={to:Je};var ir={..._e};ir.column.to=Je;Le.column={from:Le};Le.value={from:nr(Le)};et.column={to:et};var sr={...Le};sr.column.to=et;import en from"net";import ys from"tls";import rt from"crypto";import ar from"stream";import{performance as tn}from"perf_hooks";class Fe extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var fe=gs;function gs(e=[]){let t=e.slice(),r=0;return{get length(){return t.length-r},remove:(n)=>{let o=t.indexOf(n);return o===-1?null:(t.splice(o,1),n)},push:(n)=>(t.push(n),n),shift:()=>{let n=t[r++];if(r===t.length)r=0,t=[];else t[r-1]=void 0;return n}}}var ie=Buffer.allocUnsafe(256),fs="BCcDdEFfHPpQSX".split("").reduce((e,t)=>{let r=t.charCodeAt(0);return e[t]=()=>(ie[0]=r,F.i=5,F),e},{}),F=Object.assign(ms,fs,{N:String.fromCharCode(0),i:0,inc(e){return F.i+=e,F},str(e){let t=Buffer.byteLength(e);return wt(t),F.i+=ie.write(e,F.i,t,"utf8"),F},i16(e){return wt(2),ie.writeUInt16BE(e,F.i),F.i+=2,F},i32(e,t){if(t||t===0)return ie.writeUInt32BE(e,t),F;return wt(4),ie.writeUInt32BE(e,F.i),F.i+=4,F},z(e){return wt(e),ie.fill(0,F.i,F.i+e),F.i+=e,F},raw(e){return ie=Buffer.concat([ie.subarray(0,F.i),e]),F.i=ie.length,F},end(e=1){ie.writeUInt32BE(F.i-e,e);let t=ie.subarray(0,F.i);return F.i=0,ie=Buffer.allocUnsafe(256),t}}),w=F;function wt(e){if(ie.length-F.i<e){let t=ie,r=t.length;ie=Buffer.allocUnsafe(r+(r>>1)+e),t.copy(ie)}}function ms(){return F.i=0,F}var lr=on,hs=1,Te=w().S().end(),rn=w().H().end(),bs=w().i32(8).i32(80877103).end(8),Cs=Buffer.concat([w().E().str(w.N).i32(0).end(),Te]),Rs=w().D().str("S").str(w.N).end(),qe=()=>{},Is=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),ws={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function on(e,t={},{onopen:r=qe,onend:n=qe,onclose:o=qe}={}){let{sslnegotiation:i,ssl:s,max:c,user:u,host:p,port:f,database:m,parsers:R,transform:g,onnotice:L,onnotify:I,onparameter:A,max_pipeline:O,keep_alive:te,backoff:de,target_session_attrs:pe}=e,T=fe(),ke=hs++,Pe={pid:null,secret:null},$e=cr(Wt,e.idle_timeout),Oe=cr(Wt,e.max_lifetime),D=cr(di,e.connect_timeout),h=null,xe,ue=null,N=new Fe,se=Buffer.alloc(0),Me=e.fetch_types,Se={},d={},x=Math.random().toString(36).slice(2),j=1,Y=0,G=0,k=0,_=0,q=0,H=0,X=0,ae=null,M=null,Ee=!1,Re=null,Ae=null,re=null,V=null,B=null,ge=null,gt=null,zt=null,y=null,Ke=null,ne={queue:t.closed,idleTimer:$e,connect(a){re=a,_r()},terminate:Qe,execute:Ye,cancel:ai,end:Wt,count:0,id:ke};return t.closed&&t.closed.push(ne),ne;async function si(){let a;try{a=e.socket?await Promise.resolve(e.socket(e)):new en.Socket}catch(l){je(l);return}return a.on("error",je),a.on("close",Lr),a.on("drain",Or),a}async function ai({pid:a,secret:l},P,v){try{xe=w().i32(16).i32(80877102).i32(a).i32(l).end(16),await Nr(),h.once("error",v),h.once("close",P)}catch(W){v(W)}}function Ye(a){if(Ee)return Xe(a,K.connection("CONNECTION_DESTROYED",e));if(B)return Xe(a,K.generic("COPY_IN_PROGRESS","You cannot execute queries during copy"));if(a.cancelled)return;try{return a.state=Pe,y?T.push(a):(y=a,y.active=!0),ui(a),Z(ci(a))&&!a.describeFirst&&!a.cursorFn&&T.length<O&&(!a.options.onexecute||a.options.onexecute(ne))}catch(l){return T.length===0&&Z(Te),me(l),!0}}function ci(a){if(a.parameters.length>=65534)throw K.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return a.options.simple?w().Q().str(a.statement.string+w.N).end():a.describeFirst?Buffer.concat([vr(a),rn]):a.prepare?a.prepared?ft(a):Buffer.concat([vr(a),ft(a)]):li(a)}function vr(a){return Buffer.concat([$r(a.statement.string,a.parameters,a.statement.types,a.statement.name),Yi("S",a.statement.name)])}function ft(a){return Buffer.concat([Ki(a.parameters,a.statement.types,a.statement.name,a.cursorName),a.cursorFn?Mr("",a.cursorRows):Cs])}function li(a){return Buffer.concat([$r(a.statement.string,a.parameters,a.statement.types),Rs,ft(a)])}function ui(a){let l=[],P=[],v=er(a,a.strings[0],a.args[0],l,P,e);!a.tagged&&a.args.forEach((W)=>Rt(W,l,P,e)),a.prepare=e.prepare&&("prepare"in a.options?a.options.prepare:!0),a.string=v,a.signature=a.prepare&&P+v,a.onlyDescribe&&delete d[a.signature],a.parameters=a.parameters||l,a.prepared=a.prepare&&a.signature in d,a.describeFirst=a.onlyDescribe||l.length&&!a.prepared,a.statement=a.prepared?d[a.signature]:{string:v,types:P,name:a.prepare?x+j++:""},typeof e.debug==="function"&&e.debug(ke,v,l,P)}function Z(a,l){if(ge=ge?Buffer.concat([ge,a]):Buffer.from(a),l||ge.length>=1024)return Tr(l);return M===null&&(M=setImmediate(Tr)),!0}function Tr(a){let l=h.write(ge,a);return M!==null&&clearImmediate(M),ge=M=null,l}function di(){me(K.connection("CONNECT_TIMEOUT",e,h)),h.destroy()}async function Dr(){if(i!=="direct"){if(Z(bs),!await new Promise((P)=>h.once("data",(v)=>P(v[0]===83)))&&s==="prefer")return Be()}let a={socket:h,servername:en.isIP(h.host)?void 0:h.host};if(i==="direct")a.ALPNProtocols=["postgresql"];if(s==="require"||s==="allow"||s==="prefer")a.rejectUnauthorized=!1;else if(typeof s==="object")Object.assign(a,s);h.removeAllListeners(),h=ys.connect(a),h.on("secureConnect",Be),h.on("error",je),h.on("close",Lr),h.on("drain",Or)}function Or(){!y&&r(ne)}function Gt(a){if(Re){if(Re.push(a),G-=a.length,G>0)return}se=Re?Buffer.concat(Re,q-G):se.length===0?a:Buffer.concat([se,a],se.length+a.length);while(se.length>4){if(q=se.readUInt32BE(1),q>=se.length){G=q-se.length,Re=[se];break}try{pi(se.subarray(0,q+1))}catch(l){y&&(y.cursorFn||y.describeFirst)&&Z(Te),me(l)}se=se.subarray(q+1),G=0,Re=null}}async function Nr(){if(Ee=!1,Se={},h||(h=await si()),!h)return;if(D.start(),e.socket)return s?Dr():Be();if(h.on("connect",s?Dr:Be),e.path)return h.connect(e.path);h.ssl=s,h.connect(f[k],p[k]),h.host=p[k],h.port=f[k],k=(k+1)%f.length}function _r(){setTimeout(Nr,Y?Math.max(0,Y+H-tn.now()):0)}function Be(){try{d={},Me=e.fetch_types,x=Math.random().toString(36).slice(2),j=1,Oe.start(),h.on("data",Gt),te&&h.setKeepAlive&&h.setKeepAlive(!0,1000*te);let a=Qi();Z(a)}catch(a){je(a)}}function je(a){if(ne.queue===t.connecting&&e.host[_+1])return;me(a);while(T.length)Xe(T.shift(),a)}function me(a){B&&(B.destroy(a),B=null),y&&Xe(y,a),re&&(Xe(re,a),re=null)}function Xe(a,l){if(a.reserve)return a.reject(l);if(!l||typeof l!=="object")l=Error(l);"query"in l||"parameters"in l||Object.defineProperties(l,{stack:{value:l.stack+a.origin.replace(/.*\n/,`
|
|
3
3
|
`),enumerable:e.debug},query:{value:a.string,enumerable:e.debug},parameters:{value:a.parameters,enumerable:e.debug},args:{value:a.args,enumerable:e.debug},types:{value:a.statement&&a.statement.types,enumerable:e.debug}}),a.reject(l)}function Wt(){return V||(!ne.reserved&&n(ne),!ne.reserved&&!re&&!y&&T.length===0?(Qe(),new Promise((a)=>h&&h.readyState!=="closed"?h.once("close",a):a())):V=new Promise((a)=>gt=a))}function Qe(){if(Ee=!0,B||y||re||T.length)je(K.connection("CONNECTION_DESTROYED",e));if(clearImmediate(M),h)h.removeListener("data",Gt),h.removeListener("connect",Be),h.readyState==="open"&&h.end(w().X().end());gt&&(gt(),V=gt=null)}async function Lr(a){if(se=Buffer.alloc(0),G=0,Re=null,clearImmediate(M),h.removeListener("data",Gt),h.removeListener("connect",Be),$e.cancel(),Oe.cancel(),D.cancel(),h.removeAllListeners(),h=null,re)return _r();!a&&(y||T.length)&&je(K.connection("CONNECTION_CLOSED",e,h)),Y=tn.now(),a&&e.shared.retries++,H=(typeof de==="function"?de(e.shared.retries):de)*1000,o(ne,K.connection("CONNECTION_CLOSED",e,h))}function pi(a,l=a[0]){(l===68?gi:l===100?ji:l===65?_i:l===83?fi:l===90?mi:l===67?yi:l===50?Fr:l===49?hi:l===116?bi:l===84?Ci:l===82?Ri:l===110?Ei:l===75?ki:l===69?Oi:l===115?Li:l===51?Fi:l===71?$i:l===78?Vi:l===72?Mi:l===99?Ui:l===73?qi:l===86?Hi:l===118?zi:l===87?Bi:Gi)(a)}function gi(a){let l=7,P,v,W,oe=y.isRaw?Array(y.statement.columns.length):{};for(let ce=0;ce<y.statement.columns.length;ce++)v=y.statement.columns[ce],P=a.readInt32BE(l),l+=4,W=P===-1?null:y.isRaw===!0?a.subarray(l,l+=P):v.parser===void 0?a.toString("utf8",l,l+=P):v.parser.array===!0?v.parser(a.toString("utf8",l+1,l+=P)):v.parser(a.toString("utf8",l,l+=P)),y.isRaw?oe[ce]=y.isRaw===!0?W:g.value.from?g.value.from(W,v):W:oe[v.name]=g.value.from?g.value.from(W,v):W;y.forEachFn?y.forEachFn(g.row.from?g.row.from(oe):oe,N):N[X++]=g.row.from?g.row.from(oe):oe}function fi(a){let[l,P]=a.toString("utf8",5,a.length-1).split(w.N);if(Se[l]=P,e.parameters[l]!==P)e.parameters[l]=P,A&&A(l,P)}function mi(a){if(y)if(ue)y.retried?me(y.retried):y.prepared&&Is.has(ue.routine)?Ni(y,ue):me(ue);else y.resolve(Ae||N);else if(ue)me(ue);if(y=Ae=ue=null,N=new Fe,D.cancel(),re){if(pe){if(!Se.in_hot_standby||!Se.default_transaction_read_only)return Di();else if(Ti(pe,Se))return Qe()}if(Me)return re.reserve&&(re=null),Ai();re&&!re.reserve&&Ye(re),e.shared.retries=_=0,re=null;return}while(T.length&&(y=T.shift())&&(y.active=!0,y.cancelled))on(e).cancel(y.state,y.cancelled.resolve,y.cancelled.reject);if(y)return;ne.reserved?!ne.reserved.release&&a[5]===73?V?Qe():(ne.reserved=null,r(ne)):ne.reserved():V?Qe():r(ne)}function yi(a){X=0;for(let l=a.length-1;l>0;l--){if(a[l]===32&&a[l+1]<58&&N.count===null)N.count=+a.toString("utf8",l+1,a.length-1);if(a[l-1]>=65){N.command=a.toString("utf8",5,l),N.state=Pe;break}}if(Ke&&(Ke(),Ke=null),N.command==="BEGIN"&&c!==1&&!ne.reserved)return me(K.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(y.options.simple)return Fr();if(y.cursorFn)N.count&&y.cursorFn(N),Z(Te)}function hi(){y.parsing=!1}function Fr(){!N.statement&&(N.statement=y.statement),N.columns=y.statement.columns}function bi(a){let l=a.readUInt16BE(5);for(let P=0;P<l;++P)!y.statement.types[P]&&(y.statement.types[P]=a.readUInt32BE(7+P*4));y.prepare&&(d[y.signature]=y.statement),y.describeFirst&&!y.onlyDescribe&&(Z(ft(y)),y.describeFirst=!1)}function Ci(a){if(N.command)Ae=Ae||[N],Ae.push(N=new Fe),N.count=null,y.statement.columns=null;let l=a.readUInt16BE(5),P=7,v;y.statement.columns=Array(l);for(let W=0;W<l;++W){v=P;while(a[P++]!==0);let oe=a.readUInt32BE(P),ce=a.readUInt16BE(P+4),ve=a.readUInt32BE(P+6);y.statement.columns[W]={name:g.column.from?g.column.from(a.toString("utf8",v,P-1)):a.toString("utf8",v,P-1),parser:R[ve],table:oe,number:ce,type:ve},P+=18}if(N.statement=y.statement,y.onlyDescribe)return y.resolve(y.statement),Z(Te)}async function Ri(a,l=a.readUInt32BE(5)){(l===3?Ii:l===5?wi:l===10?Pi:l===11?xi:l===12?Si:l!==0?Wi:qe)(a,l)}async function Ii(){let a=await Kt();Z(w().p().str(a).z(1).end())}async function wi(a){let l="md5"+await nn(Buffer.concat([Buffer.from(await nn(await Kt()+u)),a.subarray(9)]));Z(w().p().str(l).z(1).end())}async function Pi(){zt=(await rt.randomBytes(18)).toString("base64"),w().p().str("SCRAM-SHA-256"+w.N);let a=w.i;Z(w.inc(4).str("n,,n=*,r="+zt).i32(w.i-a-4,a).end())}async function xi(a){let l=a.toString("utf8",9).split(",").reduce((ce,ve)=>(ce[ve[0]]=ve.slice(2),ce),{}),P=await rt.pbkdf2Sync(await Kt(),Buffer.from(l.s,"base64"),parseInt(l.i),32,"sha256"),v=await xt(P,"Client Key"),W="n=*,r="+zt+",r="+l.r+",s="+l.s+",i="+l.i+",c=biws,r="+l.r;ae=(await xt(await xt(P,"Server Key"),W)).toString("base64");let oe="c=biws,r="+l.r+",p="+xs(v,Buffer.from(await xt(await Ps(v),W))).toString("base64");Z(w().p().str(oe).end())}function Si(a){if(a.toString("utf8",9).split(w.N,1)[0].slice(2)===ae)return;me(K.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),h.destroy()}function Kt(){return Promise.resolve(typeof e.pass==="function"?e.pass():e.pass)}function Ei(){if(N.statement=y.statement,N.statement.columns=[],y.onlyDescribe)return y.resolve(y.statement),Z(Te)}function ki(a){Pe.pid=a.readUInt32BE(5),Pe.secret=a.readUInt32BE(9)}async function Ai(){Me=!1,(await new ye([`
|
|
4
4
|
select b.oid, b.typarray
|
|
5
5
|
from pg_catalog.pg_type a
|
|
@@ -20,30 +20,30 @@ var Zi=Object.create;var{getPrototypeOf:Ji,defineProperty:Br,getOwnPropertyNames
|
|
|
20
20
|
tell.location
|
|
21
21
|
from (select lo_tell64($1) as location) tell
|
|
22
22
|
) seek
|
|
23
|
-
`};return n(u),new Promise(async(m)=>s=m);async function p({highWaterMark:m=16384,start:R=0,end:g=1/0}={}){let L=g-R;return R&&await u.seek(R),new an.Readable({highWaterMark:m,async read(I){let A=I>L?I-L:I;L-=I;let[{data:O}]=await u.read(A);if(this.push(O),O.length<I)this.push(null)}})}async function f({highWaterMark:m=16384,start:R=0}={}){return R&&await u.seek(R),new an.Writable({highWaterMark:m,write(g,L,I){u.write(g).then(()=>I(),I)}})}}).catch(o)})}Object.assign(Et,{PostgresError:Ve,toPascal:_e,pascal:ir,toCamel:Ne,camel:or,toKebab:Le,kebab:sr,fromPascal:Je,fromCamel:Ze,fromKebab:et,BigInt:{to:20,from:[20],parse:(e)=>BigInt(e),serialize:(e)=>e.toString()}});var kt=Et;function Et(e,t){let r=Ts(e,t),n=r.no_subscribe||ur(Et,{...r}),o=!1,i=fe(),s=fe(),c=fe(),u=fe(),p=fe(),f=fe(),m=fe(),R=fe(),g={connecting:s,reserved:c,closed:u,ended:p,open:f,busy:m,full:R},L=[...Array(r.max)].map(()=>lr(r,g,{onopen:Me,onend:se,onclose:Se})),I=A($e);return Object.assign(I,{get parameters(){return r.parameters},largeObject:dr.bind(null,I),subscribe:n,CLOSE:Ue,END:Ue,PostgresError:Ve,options:r,reserve:de,listen:O,begin:pe,close:xe,end:h}),I;function A(d){return d.debug=r.debug,Object.entries(r.types).reduce((k,[_,q])=>(k[_]=(H)=>new Ie(H,q.to),k),x),Object.assign(j,{types:x,typed:x,unsafe:Y,notify:te,array:Pe,json:ke,file:G}),j;function x(k,_){return new Ie(k,_)}function j(k,..._){return k&&Array.isArray(k.raw)?new ye(k,_,d,D):typeof k==="string"&&!_.length?new tt(r.transform.column.to?r.transform.column.to(k):k):new Ct(k,_)}function Y(k,_=[],q={}){return arguments.length===2&&!Array.isArray(_)&&(q=_,_=[]),new ye([k],_,d,D,{prepare:!1,...q,simple:"simple"in q?q.simple:_.length===0})}function G(k,_=[],q={}){return arguments.length===2&&!Array.isArray(_)&&(q=_,_=[]),new ye([],_,(X)=>{vs.readFile(k,"utf8",(ae,M)=>{if(ae)return X.reject(ae);X.strings=[M],d(X)})},D,{...q,simple:"simple"in q?q.simple:_.length===0})}}async function O(d,x,j){let Y={fn:x,onlisten:j},G=O.sql||(O.sql=Et({...r,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(O.channels).forEach(([X,{listeners:ae}])=>{delete O.channels[X],Promise.all(ae.map((M)=>O(X,M.fn,M.onlisten).catch(()=>{})))})},onnotify(X,ae){X in O.channels&&O.channels[X].listeners.forEach((M)=>M.fn(ae))}})),k=O.channels||(O.channels={});if(d in k){k[d].listeners.push(Y);let X=await k[d].result;return Y.onlisten&&Y.onlisten(),{state:X.state,unlisten:H}}k[d]={result:G`listen ${G.unsafe('"'+d.replace(/"/g,'""')+'"')}`,listeners:[Y]};let q=await k[d].result;return Y.onlisten&&Y.onlisten(),{state:q.state,unlisten:H};async function H(){if(d in k===!1)return;if(k[d].listeners=k[d].listeners.filter((X)=>X!==Y),k[d].listeners.length)return;return delete k[d],G`unlisten ${G.unsafe('"'+d.replace(/"/g,'""')+'"')}`}}async function te(d,x){return await I`select pg_notify(${d}, ${""+x})`}async function de(){let d=fe(),x=f.length?f.shift():await new Promise((G,k)=>{let _={reserve:G,reject:k};i.push(_),u.length&&N(u.shift(),_)});T(x,c),x.reserved=()=>d.length?x.execute(d.shift()):T(x,c),x.reserved.release=!0;let j=A(Y);return j.release=()=>{x.reserved=null,Me(x)},j;function Y(G){x.queue===R?d.push(G):x.execute(G)||T(x,R)}}async function pe(d,x){!x&&(x=d,d="");let j=fe(),Y=0,G,k=null;try{return await I.unsafe("begin "+d.replace(/[^a-z ]/ig,""),[],{onexecute:q}).execute(),await Promise.race([_(G,x),new Promise((H,X)=>G.onclose=X)])}catch(H){throw H}async function _(H,X,ae){let M=A(re);M.savepoint=Ae,M.prepare=(V)=>k=V.replace(/[^a-z0-9$-_. ]/gi);let Ee,Re;ae&&await M`savepoint ${M(ae)}`;try{if(Re=await new Promise((V,B)=>{let ge=X(M);Promise.resolve(Array.isArray(ge)?Promise.all(ge):ge).then(V,B)}),Ee)throw Ee}catch(V){throw await(ae?M`rollback to ${M(ae)}`:M`rollback`),V instanceof Ve&&V.code==="25P02"&&Ee||V}if(!ae)k?await M`prepare transaction '${M.unsafe(k)}'`:await M`commit`;return Re;function Ae(V,B){if(V&&Array.isArray(V.raw))return Ae((ge)=>ge.apply(ge,arguments));return arguments.length===1&&(B=V,V=null),_(H,B,"s"+Y+++(V?"_"+V:""))}function re(V){V.catch((B)=>Ee||(Ee=B)),H.queue===R?j.push(V):H.execute(V)||T(H,R)}}function q(H){G=H,T(H,c),H.reserved=()=>j.length?H.execute(j.shift()):T(H,c)}}function T(d,x){return d.queue.remove(d),x.push(d),d.queue=x,x===f?d.idleTimer.start():d.idleTimer.cancel(),d}function ke(d){return new Ie(d,3802)}function Pe(d,x){if(!Array.isArray(d))return Pe(Array.from(arguments));return new Ie(d,x||(d.length?ht(d)||25:0),r.shared.typeArrayMap)}function $e(d){if(o)return d.reject(K.connection("CONNECTION_ENDED",r,r));if(f.length)return Oe(f.shift(),d);if(u.length)return N(u.shift(),d);m.length?Oe(m.shift(),d):i.push(d)}function Oe(d,x){return d.execute(x)?T(d,m):T(d,R)}function D(d){return new Promise((x,j)=>{d.state?d.active?lr(r).cancel(d.state,x,j):d.cancelled={resolve:x,reject:j}:(i.remove(d),d.cancelled=!0,d.reject(K.generic("57014","canceling statement due to user request")),x())})}async function h({timeout:d=null}={}){if(o)return o;await 1;let x;return o=Promise.race([new Promise((j)=>d!==null&&(x=setTimeout(ue,d*1000,j))),Promise.all(L.map((j)=>j.end()).concat(O.sql?O.sql.end({timeout:0}):[],n.sql?n.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(x))}async function xe(){await Promise.all(L.map((d)=>d.end()))}async function ue(d){await Promise.all(L.map((x)=>x.terminate()));while(i.length)i.shift().reject(K.connection("CONNECTION_DESTROYED",r));d()}function N(d,x){return T(d,s),d.connect(x),d}function se(d){T(d,p)}function Me(d){if(i.length===0)return T(d,f);let x=Math.ceil(i.length/(s.length+1)),j=!0;while(j&&i.length&&x-- >0){let Y=i.shift();if(Y.reserve)return Y.reserve(d);j=d.execute(Y)}j?T(d,m):T(d,R)}function Se(d,x){T(d,u),d.reserved=null,d.onclose&&(d.onclose(x),d.onclose=null),r.onclose&&r.onclose(d.id),i.length&&N(d,i.shift())}}function Ts(e,t){if(e&&e.shared)return e;let r=process.env,n=(!e||typeof e==="string"?t:e)||{},{url:o,multihost:i}=Ls(e),s=[...o.searchParams].reduce((R,[g,L])=>(R[g]=L,R),{}),c=n.hostname||n.host||i||o.hostname||r.PGHOST||"localhost",u=n.port||o.port||r.PGPORT||5432,p=n.user||n.username||o.username||r.PGUSERNAME||r.PGUSER||Fs();n.no_prepare&&(n.prepare=!1),s.sslmode&&(s.ssl=s.sslmode,delete s.sslmode),"timeout"in n&&(console.log("The timeout option is deprecated, use idle_timeout instead"),n.idle_timeout=n.timeout),s.sslrootcert==="system"&&(s.ssl="verify-full");let f=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],m={max:globalThis.Cloudflare?3:10,ssl:!1,sslnegotiation:null,idle_timeout:null,connect_timeout:30,max_lifetime:Ns,max_pipeline:100,backoff:Os,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(c)?c:c.split(",").map((R)=>R.split(":")[0]),port:Array.isArray(u)?u:c.split(",").map((R)=>parseInt(R.split(":")[1]||u)),path:n.path||c.indexOf("/")>-1&&c+"/.s.PGSQL."+u,database:n.database||n.db||(o.pathname||"").slice(1)||r.PGDATABASE||p,user:p,pass:n.pass||n.password||o.password||r.PGPASSWORD||"",...Object.entries(m).reduce((R,[g,L])=>{let I=g in n?n[g]:(g in s)?s[g]==="disable"||s[g]==="false"?!1:s[g]:r["PG"+g.toUpperCase()]||L;return R[g]=typeof I==="string"&&f.includes(g)?+I:I,R},{}),connection:{application_name:r.PGAPPNAME||"postgres.js",...n.connection,...Object.entries(s).reduce((R,[g,L])=>((g in m)||(R[g]=L),R),{})},types:n.types||{},target_session_attrs:Ds(n,o,r),onnotice:n.onnotice,onnotify:n.onnotify,onclose:n.onclose,onparameter:n.onparameter,socket:n.socket,transform:_s(n.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...Yr(n.types)}}function Ds(e,t,r){let n=e.target_session_attrs||t.searchParams.get("target_session_attrs")||r.PGTARGETSESSIONATTRS;if(!n||["read-write","read-only","primary","standby","prefer-standby"].includes(n))return n;throw Error("target_session_attrs "+n+" is not supported")}function Os(e){return(0.5+Math.random()/2)*Math.min(3**e/100,20)}function Ns(){return 60*(30+Math.random()*30)}function _s(e){return{undefined:e.undefined,column:{from:typeof e.column==="function"?e.column:e.column&&e.column.from,to:e.column&&e.column.to},value:{from:typeof e.value==="function"?e.value:e.value&&e.value.from,to:e.value&&e.value.to},row:{from:typeof e.row==="function"?e.row:e.row&&e.row.from,to:e.row&&e.row.to}}}function Ls(e){if(!e||typeof e!=="string")return{url:{searchParams:new Map}};let t=e;t=t.slice(t.indexOf("://")+3).split(/[?/]/)[0],t=decodeURIComponent(t.slice(t.indexOf("@")+1));let r=new URL(e.replace(t,t.split(",")[0]));return{url:{username:decodeURIComponent(r.username),password:decodeURIComponent(r.password),host:r.host,hostname:r.hostname,port:r.port,pathname:r.pathname,searchParams:r.searchParams},multihost:t.indexOf(",")>-1&&t}}function Fs(){try{return As.userInfo().username}catch(e){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}var jl=os(Jo(),1);function ei(e){return e}function ti(e){return e}function Ul(e){return e}function ri(e){return Ul({id:`connection:driver:${e.type}`,type:"connection:driver",description:`Connection driver for type "${e.type}"`,contribution:e})}function Hl(e){return e.trim().toLowerCase().replace(/\s*\(.*\)$/,"")}function Er(e){let t=Hl(e);switch(t){case"integer":case"int":case"int2":case"int4":case"int8":case"smallint":case"bigint":case"numeric":case"decimal":case"real":case"double precision":case"float4":case"float8":case"serial":case"bigserial":return{ok:!0,type:"number"};case"date":case"timestamp":case"timestamptz":case"timestamp without time zone":case"timestamp with time zone":return{ok:!0,type:"date"};case"boolean":case"bool":return{ok:!0,type:"checkbox"};case"text":case"varchar":case"character varying":case"character":case"char":case"uuid":return{ok:!0,type:"singleLineText"};default:return{ok:!1,errorCode:"unsupported-pg-type",sourceType:t}}}var zl={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},Np=Array.from(new Set(Object.values(zl).flat()));var Fp=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([...[["function","functions"],["scenario","scenarios"],["unit","units"],["industry","industries"]].map(([e,t])=>Object.freeze({name:e,property:t,type:"string",multiple:!0,cliEncoding:"comma-separated"})),Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels and fixed snapshot identity/closure without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var Gl=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],Bp=[...Gl,"radius","font-display","font-body","font-mono"];var Wl=/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$/;function z(e,t){if(!Wl.test(e))throw Error(`${t} "${e}" contains unsafe characters. Only [A-Za-z0-9_] allowed.`)}function Ht(e,t="table"){return z(e,t),e.split(".").map((r)=>`"${r}"`).join(".")}import{createHash as Kl}from"crypto";function lt(e){let t=e.ssl===!0?"true":e.ssl===!1?"false":e.ssl,r=[e.host,String(e.port),e.database,e.user,e.password,t].join("\x00");return Kl("sha256").update(r,"utf8").digest("hex")}function kr(e){return{host:e.host??process.env.PGHOST??"localhost",port:e.port??Number(process.env.PGPORT??5432),database:e.database??process.env.PGDATABASE??"postgres",user:e.user??process.env.PGUSER??"postgres",password:e.password??process.env.PGPASSWORD??"",ssl:e.ssl??(process.env.PGSSLMODE==="require"?"require":!1)}}var We=new Map;function Ar(e){let t=lt(e);if(!We.has(t))We.set(t,kt({host:e.host,port:e.port,database:e.database,user:e.user,password:e.password,ssl:e.ssl,max:3,idle_timeout:20,connect_timeout:10}));return We.get(t)}async function Yl(){let e=Array.from(We.values()).map((t)=>t.end());await Promise.all(e),We.clear()}function ut(e,t){let r=Object.entries(t).filter(([,i])=>i!==void 0);if(r.length===0)return e``;let n=r.map(([i,s])=>(z(i,"filter column"),s===null?e`${e(i)} IS NULL`:e`${e(i)} = ${s}`)),o=e`WHERE ${n[0]}`;for(let i=1;i<n.length;i++)o=e`${o} AND ${n[i]}`;return o}async function Xl(e,t,r){if(z(t,"table"),r.length===0)throw Error("ensureTable: columns must not be empty");let n=kr(e),o=Ar(n),i=r.map((s)=>{z(s.name,"column");let c=s.nullable===!1||s.primaryKey?"NOT NULL":"",u=s.primaryKey?"PRIMARY KEY":"",p=s.default!=null?`DEFAULT ${s.default}`:"";return` "${s.name}" ${s.type.toUpperCase()} ${c} ${p} ${u}`.trimEnd()}).join(`,
|
|
23
|
+
`};return n(u),new Promise(async(m)=>s=m);async function p({highWaterMark:m=16384,start:R=0,end:g=1/0}={}){let L=g-R;return R&&await u.seek(R),new an.Readable({highWaterMark:m,async read(I){let A=I>L?I-L:I;L-=I;let[{data:O}]=await u.read(A);if(this.push(O),O.length<I)this.push(null)}})}async function f({highWaterMark:m=16384,start:R=0}={}){return R&&await u.seek(R),new an.Writable({highWaterMark:m,write(g,L,I){u.write(g).then(()=>I(),I)}})}}).catch(o)})}Object.assign(Et,{PostgresError:Ve,toPascal:_e,pascal:ir,toCamel:Ne,camel:or,toKebab:Le,kebab:sr,fromPascal:Je,fromCamel:Ze,fromKebab:et,BigInt:{to:20,from:[20],parse:(e)=>BigInt(e),serialize:(e)=>e.toString()}});var kt=Et;function Et(e,t){let r=Ts(e,t),n=r.no_subscribe||ur(Et,{...r}),o=!1,i=fe(),s=fe(),c=fe(),u=fe(),p=fe(),f=fe(),m=fe(),R=fe(),g={connecting:s,reserved:c,closed:u,ended:p,open:f,busy:m,full:R},L=[...Array(r.max)].map(()=>lr(r,g,{onopen:Me,onend:se,onclose:Se})),I=A($e);return Object.assign(I,{get parameters(){return r.parameters},largeObject:dr.bind(null,I),subscribe:n,CLOSE:Ue,END:Ue,PostgresError:Ve,options:r,reserve:de,listen:O,begin:pe,close:xe,end:h}),I;function A(d){return d.debug=r.debug,Object.entries(r.types).reduce((k,[_,q])=>(k[_]=(H)=>new Ie(H,q.to),k),x),Object.assign(j,{types:x,typed:x,unsafe:Y,notify:te,array:Pe,json:ke,file:G}),j;function x(k,_){return new Ie(k,_)}function j(k,..._){return k&&Array.isArray(k.raw)?new ye(k,_,d,D):typeof k==="string"&&!_.length?new tt(r.transform.column.to?r.transform.column.to(k):k):new Ct(k,_)}function Y(k,_=[],q={}){return arguments.length===2&&!Array.isArray(_)&&(q=_,_=[]),new ye([k],_,d,D,{prepare:!1,...q,simple:"simple"in q?q.simple:_.length===0})}function G(k,_=[],q={}){return arguments.length===2&&!Array.isArray(_)&&(q=_,_=[]),new ye([],_,(X)=>{vs.readFile(k,"utf8",(ae,M)=>{if(ae)return X.reject(ae);X.strings=[M],d(X)})},D,{...q,simple:"simple"in q?q.simple:_.length===0})}}async function O(d,x,j){let Y={fn:x,onlisten:j},G=O.sql||(O.sql=Et({...r,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(O.channels).forEach(([X,{listeners:ae}])=>{delete O.channels[X],Promise.all(ae.map((M)=>O(X,M.fn,M.onlisten).catch(()=>{})))})},onnotify(X,ae){X in O.channels&&O.channels[X].listeners.forEach((M)=>M.fn(ae))}})),k=O.channels||(O.channels={});if(d in k){k[d].listeners.push(Y);let X=await k[d].result;return Y.onlisten&&Y.onlisten(),{state:X.state,unlisten:H}}k[d]={result:G`listen ${G.unsafe('"'+d.replace(/"/g,'""')+'"')}`,listeners:[Y]};let q=await k[d].result;return Y.onlisten&&Y.onlisten(),{state:q.state,unlisten:H};async function H(){if(d in k===!1)return;if(k[d].listeners=k[d].listeners.filter((X)=>X!==Y),k[d].listeners.length)return;return delete k[d],G`unlisten ${G.unsafe('"'+d.replace(/"/g,'""')+'"')}`}}async function te(d,x){return await I`select pg_notify(${d}, ${""+x})`}async function de(){let d=fe(),x=f.length?f.shift():await new Promise((G,k)=>{let _={reserve:G,reject:k};i.push(_),u.length&&N(u.shift(),_)});T(x,c),x.reserved=()=>d.length?x.execute(d.shift()):T(x,c),x.reserved.release=!0;let j=A(Y);return j.release=()=>{x.reserved=null,Me(x)},j;function Y(G){x.queue===R?d.push(G):x.execute(G)||T(x,R)}}async function pe(d,x){!x&&(x=d,d="");let j=fe(),Y=0,G,k=null;try{return await I.unsafe("begin "+d.replace(/[^a-z ]/ig,""),[],{onexecute:q}).execute(),await Promise.race([_(G,x),new Promise((H,X)=>G.onclose=X)])}catch(H){throw H}async function _(H,X,ae){let M=A(re);M.savepoint=Ae,M.prepare=(V)=>k=V.replace(/[^a-z0-9$-_. ]/gi);let Ee,Re;ae&&await M`savepoint ${M(ae)}`;try{if(Re=await new Promise((V,B)=>{let ge=X(M);Promise.resolve(Array.isArray(ge)?Promise.all(ge):ge).then(V,B)}),Ee)throw Ee}catch(V){throw await(ae?M`rollback to ${M(ae)}`:M`rollback`),V instanceof Ve&&V.code==="25P02"&&Ee||V}if(!ae)k?await M`prepare transaction '${M.unsafe(k)}'`:await M`commit`;return Re;function Ae(V,B){if(V&&Array.isArray(V.raw))return Ae((ge)=>ge.apply(ge,arguments));return arguments.length===1&&(B=V,V=null),_(H,B,"s"+Y+++(V?"_"+V:""))}function re(V){V.catch((B)=>Ee||(Ee=B)),H.queue===R?j.push(V):H.execute(V)||T(H,R)}}function q(H){G=H,T(H,c),H.reserved=()=>j.length?H.execute(j.shift()):T(H,c)}}function T(d,x){return d.queue.remove(d),x.push(d),d.queue=x,x===f?d.idleTimer.start():d.idleTimer.cancel(),d}function ke(d){return new Ie(d,3802)}function Pe(d,x){if(!Array.isArray(d))return Pe(Array.from(arguments));return new Ie(d,x||(d.length?ht(d)||25:0),r.shared.typeArrayMap)}function $e(d){if(o)return d.reject(K.connection("CONNECTION_ENDED",r,r));if(f.length)return Oe(f.shift(),d);if(u.length)return N(u.shift(),d);m.length?Oe(m.shift(),d):i.push(d)}function Oe(d,x){return d.execute(x)?T(d,m):T(d,R)}function D(d){return new Promise((x,j)=>{d.state?d.active?lr(r).cancel(d.state,x,j):d.cancelled={resolve:x,reject:j}:(i.remove(d),d.cancelled=!0,d.reject(K.generic("57014","canceling statement due to user request")),x())})}async function h({timeout:d=null}={}){if(o)return o;await 1;let x;return o=Promise.race([new Promise((j)=>d!==null&&(x=setTimeout(ue,d*1000,j))),Promise.all(L.map((j)=>j.end()).concat(O.sql?O.sql.end({timeout:0}):[],n.sql?n.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(x))}async function xe(){await Promise.all(L.map((d)=>d.end()))}async function ue(d){await Promise.all(L.map((x)=>x.terminate()));while(i.length)i.shift().reject(K.connection("CONNECTION_DESTROYED",r));d()}function N(d,x){return T(d,s),d.connect(x),d}function se(d){T(d,p)}function Me(d){if(i.length===0)return T(d,f);let x=Math.ceil(i.length/(s.length+1)),j=!0;while(j&&i.length&&x-- >0){let Y=i.shift();if(Y.reserve)return Y.reserve(d);j=d.execute(Y)}j?T(d,m):T(d,R)}function Se(d,x){T(d,u),d.reserved=null,d.onclose&&(d.onclose(x),d.onclose=null),r.onclose&&r.onclose(d.id),i.length&&N(d,i.shift())}}function Ts(e,t){if(e&&e.shared)return e;let r=process.env,n=(!e||typeof e==="string"?t:e)||{},{url:o,multihost:i}=Ls(e),s=[...o.searchParams].reduce((R,[g,L])=>(R[g]=L,R),{}),c=n.hostname||n.host||i||o.hostname||r.PGHOST||"localhost",u=n.port||o.port||r.PGPORT||5432,p=n.user||n.username||o.username||r.PGUSERNAME||r.PGUSER||Fs();n.no_prepare&&(n.prepare=!1),s.sslmode&&(s.ssl=s.sslmode,delete s.sslmode),"timeout"in n&&(console.log("The timeout option is deprecated, use idle_timeout instead"),n.idle_timeout=n.timeout),s.sslrootcert==="system"&&(s.ssl="verify-full");let f=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],m={max:globalThis.Cloudflare?3:10,ssl:!1,sslnegotiation:null,idle_timeout:null,connect_timeout:30,max_lifetime:Ns,max_pipeline:100,backoff:Os,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(c)?c:c.split(",").map((R)=>R.split(":")[0]),port:Array.isArray(u)?u:c.split(",").map((R)=>parseInt(R.split(":")[1]||u)),path:n.path||c.indexOf("/")>-1&&c+"/.s.PGSQL."+u,database:n.database||n.db||(o.pathname||"").slice(1)||r.PGDATABASE||p,user:p,pass:n.pass||n.password||o.password||r.PGPASSWORD||"",...Object.entries(m).reduce((R,[g,L])=>{let I=g in n?n[g]:(g in s)?s[g]==="disable"||s[g]==="false"?!1:s[g]:r["PG"+g.toUpperCase()]||L;return R[g]=typeof I==="string"&&f.includes(g)?+I:I,R},{}),connection:{application_name:r.PGAPPNAME||"postgres.js",...n.connection,...Object.entries(s).reduce((R,[g,L])=>((g in m)||(R[g]=L),R),{})},types:n.types||{},target_session_attrs:Ds(n,o,r),onnotice:n.onnotice,onnotify:n.onnotify,onclose:n.onclose,onparameter:n.onparameter,socket:n.socket,transform:_s(n.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...Yr(n.types)}}function Ds(e,t,r){let n=e.target_session_attrs||t.searchParams.get("target_session_attrs")||r.PGTARGETSESSIONATTRS;if(!n||["read-write","read-only","primary","standby","prefer-standby"].includes(n))return n;throw Error("target_session_attrs "+n+" is not supported")}function Os(e){return(0.5+Math.random()/2)*Math.min(3**e/100,20)}function Ns(){return 60*(30+Math.random()*30)}function _s(e){return{undefined:e.undefined,column:{from:typeof e.column==="function"?e.column:e.column&&e.column.from,to:e.column&&e.column.to},value:{from:typeof e.value==="function"?e.value:e.value&&e.value.from,to:e.value&&e.value.to},row:{from:typeof e.row==="function"?e.row:e.row&&e.row.from,to:e.row&&e.row.to}}}function Ls(e){if(!e||typeof e!=="string")return{url:{searchParams:new Map}};let t=e;t=t.slice(t.indexOf("://")+3).split(/[?/]/)[0],t=decodeURIComponent(t.slice(t.indexOf("@")+1));let r=new URL(e.replace(t,t.split(",")[0]));return{url:{username:decodeURIComponent(r.username),password:decodeURIComponent(r.password),host:r.host,hostname:r.hostname,port:r.port,pathname:r.pathname,searchParams:r.searchParams},multihost:t.indexOf(",")>-1&&t}}function Fs(){try{return As.userInfo().username}catch(e){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}var jl=os(Jo(),1);function ei(e){return e}function ti(e){return e}function Ul(e){return e}function ri(e){return Ul({id:`connection:driver:${e.type}`,type:"connection:driver",description:`Connection driver for type "${e.type}"`,contribution:e})}function Hl(e){return e.trim().toLowerCase().replace(/\s*\(.*\)$/,"")}function Er(e){let t=Hl(e);switch(t){case"integer":case"int":case"int2":case"int4":case"int8":case"smallint":case"bigint":case"numeric":case"decimal":case"real":case"double precision":case"float4":case"float8":case"serial":case"bigserial":return{ok:!0,type:"number"};case"date":case"timestamp":case"timestamptz":case"timestamp without time zone":case"timestamp with time zone":return{ok:!0,type:"date"};case"boolean":case"bool":return{ok:!0,type:"checkbox"};case"text":case"varchar":case"character varying":case"character":case"char":case"uuid":return{ok:!0,type:"singleLineText"};default:return{ok:!1,errorCode:"unsupported-pg-type",sourceType:t}}}var zl={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},_p=Array.from(new Set(Object.values(zl).flat()));var $p=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([...[["function","functions"],["scenario","scenarios"],["unit","units"],["industry","industries"]].map(([e,t])=>Object.freeze({name:e,property:t,type:"string",multiple:!0,cliEncoding:"comma-separated"})),Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels and fixed snapshot identity/closure without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var Gl=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],jp=[...Gl,"radius","font-display","font-body","font-mono"];var Kl=/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$/;function z(e,t){if(!Kl.test(e))throw Error(`${t} "${e}" contains unsafe characters. Only [A-Za-z0-9_] allowed.`)}function Ht(e,t="table"){return z(e,t),e.split(".").map((r)=>`"${r}"`).join(".")}import{createHash as Yl}from"crypto";function lt(e){let t=e.ssl===!0?"true":e.ssl===!1?"false":e.ssl,r=[e.host,String(e.port),e.database,e.user,e.password,t].join("\x00");return Yl("sha256").update(r,"utf8").digest("hex")}function kr(e){return{host:e.host??process.env.PGHOST??"localhost",port:e.port??Number(process.env.PGPORT??5432),database:e.database??process.env.PGDATABASE??"postgres",user:e.user??process.env.PGUSER??"postgres",password:e.password??process.env.PGPASSWORD??"",ssl:e.ssl??(process.env.PGSSLMODE==="require"?"require":!1)}}var We=new Map;function Ar(e){let t=lt(e);if(!We.has(t))We.set(t,kt({host:e.host,port:e.port,database:e.database,user:e.user,password:e.password,ssl:e.ssl,max:3,idle_timeout:20,connect_timeout:10}));return We.get(t)}async function Xl(){let e=Array.from(We.values()).map((t)=>t.end());await Promise.all(e),We.clear()}function ut(e,t){let r=Object.entries(t).filter(([,i])=>i!==void 0);if(r.length===0)return e``;let n=r.map(([i,s])=>(z(i,"filter column"),s===null?e`${e(i)} IS NULL`:e`${e(i)} = ${s}`)),o=e`WHERE ${n[0]}`;for(let i=1;i<n.length;i++)o=e`${o} AND ${n[i]}`;return o}async function Ql(e,t,r){if(z(t,"table"),r.length===0)throw Error("ensureTable: columns must not be empty");let n=kr(e),o=Ar(n),i=r.map((s)=>{z(s.name,"column");let c=s.nullable===!1||s.primaryKey?"NOT NULL":"",u=s.primaryKey?"PRIMARY KEY":"",p=s.default!=null?`DEFAULT ${s.default}`:"";return` "${s.name}" ${s.type.toUpperCase()} ${c} ${p} ${u}`.trimEnd()}).join(`,
|
|
24
24
|
`);await o.unsafe(`CREATE TABLE IF NOT EXISTS ${Ht(t)} (
|
|
25
25
|
${i}
|
|
26
|
-
)`)}async function
|
|
26
|
+
)`)}async function Zl(e,t,r){if(r.length===0)return;z(t,"table");let n=kr(e),o=Ar(n),i=await o.unsafe(`SELECT COUNT(*)::text AS count FROM ${Ht(t)}`);if(Number(i[0]?.count??0)>0)return;let c=Object.keys(r[0]);for(let u of c)z(u,"seed column");await o`INSERT INTO ${o(t)} ${o(r)}`}function Jl(e){let t=kr(e),r=Ar(t);return{async find(n,o={},i){z(n,"table");let s=ut(r,o),c=i!=null?r`LIMIT ${i}`:r``;return await r`SELECT * FROM ${r(n)} ${s} ${c}`},async findOne(n,o){z(n,"table");let i=ut(r,o);return(await r`SELECT * FROM ${r(n)} ${i} LIMIT 1`)[0]??null},async insertOne(n,o){z(n,"table");for(let s of Object.keys(o))z(s,"column");let i=await r`INSERT INTO ${r(n)} ${r(o)} RETURNING *`;if(!i[0])throw Error(`insertOne into ${n} returned no row`);return i[0]},async updateOne(n,o,i){z(n,"table");for(let u of Object.keys(i))z(u,"column");let s=ut(r,o);return(await r`UPDATE ${r(n)} SET ${r(i)} ${s} RETURNING *`)[0]??null},async deleteOne(n,o){if(z(n,"table"),Object.keys(o).length===0)throw Error("deleteOne: filter must not be empty");let i=ut(r,o);return(await r`
|
|
27
27
|
DELETE FROM ${r(n)}
|
|
28
28
|
WHERE ctid = (SELECT ctid FROM ${r(n)} ${i} LIMIT 1)
|
|
29
29
|
RETURNING id
|
|
30
|
-
`).count>0},async count(n,o={}){z(n,"table");let i=ut(r,o);return(await r`SELECT COUNT(*)::int AS count FROM ${r(n)} ${i}`)[0]?.count??0},async close(){await r.end(),We.delete(`${t.user}@${t.host}:${t.port}/${t.database}`)}}}function
|
|
30
|
+
`).count>0},async count(n,o={}){z(n,"table");let i=ut(r,o);return(await r`SELECT COUNT(*)::int AS count FROM ${r(n)} ${i}`)[0]?.count??0},async close(){await r.end(),We.delete(`${t.user}@${t.host}:${t.port}/${t.database}`)}}}function eu(e){let t=e.schema??"public",r=async(o,i={})=>{let s=await e.driver.execute({id:`pg-${o.toLowerCase()}`,connectionId:e.ctx.connectionId,payload:{operation:o,table:e.table,...i},properties:{schema:t}},e.ctx);if(s.status<200||s.status>=300)throw Error(`${o} failed (status ${s.status})`);return s},n=(o)=>{let i=String(o.id??""),s={...o};return{id:i,values:s}};return{async describe(){return(await r("Describe")).data},async rows(o){return(await r("Find",o?{filterTree:o}:{})).data.map(n)},async write(o){let i=await this.rows(),s=new Set(o.records.map((u)=>u.id));for(let u of i)if(!s.has(u.id))await r("DeleteOne",{filter:{id:u.id}});let c=new Set(i.map((u)=>u.id));for(let u of o.records){let p={id:u.id,...u.values};if(c.has(u.id))await r("UpdateOne",{filter:{id:u.id},data:u.values});else await r("InsertOne",{data:p})}}}}function tu(e){return e.replace(/[-_]db$/i,"")}var dt=new Map;function ru(e){return lt(e)}function nu(e){let t=ru(e);if(!dt.has(t))dt.set(t,kt({host:e.host,port:e.port,database:e.database,user:e.user,password:e.password,ssl:e.ssl,max:10,idle_timeout:30,connect_timeout:10,transform:{row:(r)=>({...r})}}));return dt.get(t)}async function Af(){let e=Array.from(dt.values()).map((t)=>t.end());await Promise.all(e),dt.clear()}function ou(e,t){let r=t.id;if(!Object.hasOwn(t,"id")||!(typeof r==="string"&&r.length>0||typeof r==="number"&&Number.isFinite(r)))throw Error(`${e} requires an explicit non-empty string or finite number filter.id.`)}class oi{defaults;type="Pg.Collection";constructor(e){this.defaults=e}async execute(e,t){let r=e.payload??{},n=e.properties??{},o=await this.resolveString(n.user,t)??this.defaults.user??process.env.PGUSER??"postgres",i=await this.resolveString(n.password,t)??this.defaults.password??process.env.PGPASSWORD??"",s={host:n.host??this.defaults.host??process.env.PGHOST??"localhost",port:Number(n.port??this.defaults.port??process.env.PGPORT??5432),database:n.database??this.defaults.database??process.env.PGDATABASE??"postgres",user:o,password:i,ssl:n.ssl??this.defaults.ssl??process.env.PGSSLMODE??!1},c=r.table??n.table??tu(t.connectionId),u=n.schema??"public";z(u,"schema"),z(c,"table");let p=`${u}.${c}`,f=r.operation??"Find",m=r.filter??{},{data:R,limit:g,offset:L}=r;if(f==="UpdateOne"||f==="DeleteOne")ou(f,m);let I=nu(s);try{switch(f){case"Find":{let A=r.filterTree;if(A!==void 0){let te=ii(I,A);if(!te.ok)return{data:{errorCode:te.errorCode,fieldId:te.fieldId},status:400};return{data:await iu(I,p,te.fragment,g,L),status:200}}return{data:await su(I,p,m,g,L),status:200}}case"FindOne":{let A=await lu(I,p,m);return{data:A??null,status:A?200:404}}case"InsertOne":{if(!R)throw Error("InsertOne requires payload.data");return{data:await uu(I,p,R),status:201}}case"UpdateOne":{if(!R)throw Error("UpdateOne requires payload.data");let A=await du(I,p,m,R);return{data:A??null,status:A?200:404}}case"DeleteOne":{let A=await pu(I,p,m);return{data:{deleted:A},status:A?200:404}}case"Count":return{data:{count:await gu(I,p,m)},status:200};case"Describe":return fu(I,u,c);default:throw Error(`Unknown Pg.Collection operation: ${String(f)}`)}}catch(A){let O=A instanceof Error?A.message:String(A);if(O.includes("connect")||O.includes("Connection"))throw Error(`Pg.Collection: cannot connect to ${s.host}:${s.port}/${s.database} \u2014 ${O}`);throw A}}async resolveString(e,t){if(typeof e==="string")return e;if(typeof e==="object"&&e!==null&&"_secret"in e){let r=e._secret;return typeof r==="string"?await t.resolveSecret(r):void 0}return}}function pt(e,t){let r=Object.entries(t).filter(([,i])=>i!==void 0);if(r.length===0)return e``;let n=r.map(([i,s])=>(z(i,"filter column"),s===null?e`${e(i)} IS NULL`:e`${e(i)} = ${s}`)),o=e`WHERE ${n[0]}`;for(let i=1;i<n.length;i++)o=e`${o} AND ${n[i]}`;return o}async function iu(e,t,r,n,o){let i=n!=null?e`LIMIT ${n}`:e``,s=o!=null?e`OFFSET ${o}`:e``;return await e`
|
|
31
31
|
SELECT * FROM ${e(t)} WHERE ${r} ${i} ${s}
|
|
32
|
-
`}async function
|
|
32
|
+
`}async function su(e,t,r,n,o){let i=pt(e,r),s=n!=null?e`LIMIT ${n}`:e``,c=o!=null?e`OFFSET ${o}`:e``;return await e`
|
|
33
33
|
SELECT * FROM ${e(t)} ${i} ${s} ${c}
|
|
34
|
-
`}function ni(e){return!!e&&typeof e==="object"&&"conjunction"in e&&"filterSet"in e}function
|
|
34
|
+
`}function ni(e){return!!e&&typeof e==="object"&&"conjunction"in e&&"filterSet"in e}function au(e){return!!e&&typeof e==="object"&&"fieldId"in e&&"operator"in e}function cu(e,t){try{z(t.fieldId,"filter column")}catch{return{ok:!1,errorCode:"illegal-column",fieldId:t.fieldId}}let r=e(t.fieldId);switch(t.operator){case"isEmpty":return{ok:!0,fragment:e`(${r} IS NULL OR ${r}::text = '')`};case"contains":return{ok:!0,fragment:e`strpos(lower(${r}::text), lower(${String(t.value??"")})) > 0`};case"isNot":return{ok:!0,fragment:e`${r} IS DISTINCT FROM ${t.value}`};case"is":return{ok:!0,fragment:e`${r} = ${t.value}`};default:return{ok:!1,errorCode:"illegal-operator",fieldId:t.fieldId}}}function ii(e,t){if(!ni(t))return{ok:!1,errorCode:"illegal-filter"};let r=[];for(let i of t.filterSet){let s=ni(i)?ii(e,i):au(i)?cu(e,i):{ok:!1,errorCode:"illegal-filter"};if(!s.ok)return s;r.push(s.fragment)}let n=r[0];if(!n)return{ok:!0,fragment:t.conjunction==="or"?e`FALSE`:e`TRUE`};let o=e`(${n})`;for(let i=1;i<r.length;i++){let s=r[i];if(!s)continue;o=t.conjunction==="or"?e`${o} OR (${s})`:e`${o} AND (${s})`}return{ok:!0,fragment:o}}async function lu(e,t,r){let n=pt(e,r);return(await e`SELECT * FROM ${e(t)} ${n} LIMIT 1`)[0]??void 0}async function uu(e,t,r){for(let o of Object.keys(r))z(o,"insert column");let n=await e`
|
|
35
35
|
INSERT INTO ${e(t)} ${e(r)} RETURNING *
|
|
36
|
-
`;if(!n[0])throw Error(`InsertOne into ${t} returned no row`);return n[0]}async function
|
|
36
|
+
`;if(!n[0])throw Error(`InsertOne into ${t} returned no row`);return n[0]}async function du(e,t,r,n){for(let s of Object.keys(n))z(s,"update column");let o=pt(e,r);return(await e`
|
|
37
37
|
UPDATE ${e(t)} SET ${e(n)} ${o} RETURNING *
|
|
38
|
-
`)[0]??void 0}async function
|
|
38
|
+
`)[0]??void 0}async function pu(e,t,r){let n=pt(e,r);return(await e`
|
|
39
39
|
DELETE FROM ${e(t)}
|
|
40
40
|
WHERE ctid = (
|
|
41
41
|
SELECT ctid FROM ${e(t)} ${n} LIMIT 1
|
|
42
42
|
)
|
|
43
43
|
RETURNING id
|
|
44
|
-
`).count>0}async function
|
|
44
|
+
`).count>0}async function gu(e,t,r){let n=pt(e,r);return(await e`SELECT COUNT(*)::int AS count FROM ${e(t)} ${n}`)[0]?.count??0}async function fu(e,t,r){let n=await e`
|
|
45
45
|
SELECT column_name, data_type, udt_name, is_nullable
|
|
46
46
|
FROM information_schema.columns
|
|
47
47
|
WHERE table_schema = ${t} AND table_name = ${r}
|
|
48
48
|
ORDER BY ordinal_position
|
|
49
|
-
`,o=[];for(let s of n){let c=String(s.column_name??"");z(c,"column");let u=String(s.data_type??""),p=String(s.udt_name??""),f=Er(u),m=f.ok?f:Er(p);if(!m.ok)return{data:{errorCode:m.errorCode,sourceType:m.sourceType},status:400};o.push({id:c,name:c,type:m.type,required:String(s.is_nullable??"YES")==="NO"})}return{data:{id:`${t}.${r}`,name:r,version:1,fields:o,views:[{id:"default",name:"Default",kind:"table"}]},status:200}}function
|
|
49
|
+
`,o=[];for(let s of n){let c=String(s.column_name??"");z(c,"column");let u=String(s.data_type??""),p=String(s.udt_name??""),f=Er(u),m=f.ok?f:Er(p);if(!m.ok)return{data:{errorCode:m.errorCode,sourceType:m.sourceType},status:400};o.push({id:c,name:c,type:m.type,required:String(s.is_nullable??"YES")==="NO"})}return{data:{id:`${t}.${r}`,name:r,version:1,fields:o,views:[{id:"default",name:"Default",kind:"table"}]},status:200}}function mu(e={}){let t=new oi(e);return ti({manifest:ei({pluginId:"uibot.connection-pg",version:"0.1.0",displayName:"UIBot Connection PostgreSQL",description:"PostgreSQL connection driver using postgres.js. Supports Find/FindOne/InsertOne/UpdateOne/DeleteOne/Count/Describe operations.",sdkRange:"^0.1.0",engineRange:"^0.1.0",capabilities:[{id:"uibot.connection-pg.driver",type:"connection:driver",description:"Pg.Collection driver \u2014 safe parameterized SQL via postgres.js"}],permissions:[]}),register(r){r.addCapability(ri(t))}})}var vf=mu();export{oi as PgCollectionDriver,vf as UIBotConnectionPgPlugin,Xl as closeInitPools,Af as closePgPools,eu as createPgCollectionSdk,Jl as createPgDataAccess,mu as createUIBotConnectionPgPlugin,Ql as ensureTable,lt as fingerprintPoolIdentity,Ht as quoteQualifiedIdentifier,Zl as seedIfEmpty};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uibot/connection-pg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@uibot/contracts": "^0.
|
|
31
|
-
"@uibot/plugin-sdk": "^0.
|
|
30
|
+
"@uibot/contracts": "^0.20.0",
|
|
31
|
+
"@uibot/plugin-sdk": "^0.20.0",
|
|
32
32
|
"postgres": "3.4.9"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|