211 lines
610 KiB
JavaScript
211 lines
610 KiB
JavaScript
|
|
"use strict";var FD=Object.create;var Oi=Object.defineProperty;var xD=Object.getOwnPropertyDescriptor;var LD=Object.getOwnPropertyNames;var UD=Object.getPrototypeOf,TD=Object.prototype.hasOwnProperty;var Dd=e=>{throw TypeError(e)};var MD=(e,A,t)=>A in e?Oi(e,A,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[A]=t;var Q=(e,A)=>()=>(A||e((A={exports:{}}).exports,A),A.exports),Hi=(e,A)=>{for(var t in A)Oi(e,t,{get:A[t],enumerable:!0})},bd=(e,A,t,r)=>{if(A&&typeof A=="object"||typeof A=="function")for(let n of LD(A))!TD.call(e,n)&&n!==t&&Oi(e,n,{get:()=>A[n],enumerable:!(r=xD(A,n))||r.enumerable});return e};var Z=(e,A,t)=>(t=e!=null?FD(UD(e)):{},bd(A||!e||!e.__esModule?Oi(t,"default",{value:e,enumerable:!0}):t,e)),vD=e=>bd(Oi({},"__esModule",{value:!0}),e);var kd=(e,A,t)=>MD(e,typeof A!="symbol"?A+"":A,t),Wg=(e,A,t)=>A.has(e)||Dd("Cannot "+t);var f=(e,A,t)=>(Wg(e,A,"read from private field"),t?t.call(e):A.get(e)),Fe=(e,A,t)=>A.has(e)?Dd("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(e):A.set(e,t),Ae=(e,A,t,r)=>(Wg(e,A,"write to private field"),r?r.call(e,t):A.set(e,t),t),vA=(e,A,t)=>(Wg(e,A,"access private method"),t);var $d=Q((MV,zd)=>{"use strict";zd.exports=Xd;Xd.sync=wb;var Kd=require("fs");function yb(e,A){var t=A.pathExt!==void 0?A.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var r=0;r<t.length;r++){var n=t[r].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Zd(e,A,t){return!e.isSymbolicLink()&&!e.isFile()?!1:yb(A,t)}function Xd(e,A,t){Kd.stat(e,function(r,n){t(r,r?!1:Zd(n,e,A))})}function wb(e,A){return Zd(Kd.statSync(e),e,A)}});var nQ=Q((vV,rQ)=>{"use strict";rQ.exports=AQ;AQ.sync=Rb;var eQ=require("fs");function AQ(e,A,t){eQ.stat(e,function(r,n){t(r,r?!1:tQ(n,A))})}function Rb(e,A){return tQ(eQ.statSync(e),A)}function tQ(e,A){return e.isFile()&&Db(e,A)}function Db(e,A){var t=e.mode,r=e.uid,n=e.gid,i=A.uid!==void 0?A.uid:process.getuid&&process.getuid(),s=A.gid!==void 0?A.gid:process.getgid&&process.getgid(),o=parseInt("100",8),a=parseInt("010",8),c=parseInt("001",8),g=o|a,l=t&c||t&a&&n===s||t&o&&r===i||t&g&&i===0;return l}});var sQ=Q((GV,iQ)=>{"use strict";var PV=require("fs"),_o;process.platform==="win32"||global.TESTING_WINDOWS?_o=$d():_o=nQ();iQ.exports=nl;nl.sync=bb;function nl(e,A,t){if(typeof A=="function"&&(t=A,A={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,n){nl(e,A||{},function(i,s){i?n(i):r(s)})})}_o(e,A||{},function(r,n){r&&(r.code==="EACCES"||A&&A.ignoreErrors)&&(r=null,n=!1),t(r,n)})}function bb(e,A){try{return _o.sync(e,A||{})}catch(t){if(A&&A.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var EQ=Q((YV,uQ)=>{"use strict";var Cn=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",oQ=require("path"),kb=Cn?";":":",aQ=sQ(),cQ=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),gQ=(e,A)=>{let t=A.colon||kb,r=e.match(/\//)||Cn&&e.match(/\\/)?[""]:[...Cn?[process.cwd()]:[],...(A.path||process.env.PATH||"").split(t)],n=Cn?A.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=Cn?n.split(t):[""];return Cn&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:r,pathExt:i,pathExtExe:n}},lQ=(e,A,t)=>{typeof A=="function"&&(t=A,A={}),A||(A={});let{pathEnv:r,pathExt:n,pathExtExe:i}=gQ(e,A),s=[],o=c=>new Promise((g,l)=>{if(c===r.length)return A.all&&s.length?g(s):l(cQ(e));let u=r[c],E=/^".*"$/.test(u)?u.slice(1,-1):u,h=oQ.join(E,e),d=!E&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;g(a(d,c,0))}),a=(c,g,l)=>new Promise((u,E)=>{if(l===n.length)return u(o(g+1));let h=n[l];aQ(c+h,{pathExt:i},(d,C)=>{if(!d&&C)if(A.all)s.push(c+h);else return u(c+h);return u(a(c,g,l+1))})});return t?o(0).then(c=>t(null,c),t):o(0)},Sb=(e,A)=>{A=A||{};let{pathEnv:t,pathExt:r,pathExtExe:n}=gQ(e,A),i=[];for(let s=0;s<t.length;s++){let o=t[s],a=/^".*"$/.test(o)?o.slice(1,-1):o,c=oQ.join(a,e),g=!a&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let l=0;l<r.length;l++){let u=g+r[l];try{if(aQ.sync(u,{pathExt:n}))if(A.all)i.p
|
||
|
|
`:10,t=typeof e=="string"?"\r":13;return e[e.length-1]===A&&(e=e.slice(0,e.length-1)),e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e}});var YQ=Q((XV,Xi)=>{"use strict";var Zi=require("path"),PQ=sl(),GQ=e=>{e={cwd:process.cwd(),path:process.env[PQ()],execPath:process.execPath,...e};let A,t=Zi.resolve(e.cwd),r=[];for(;A!==t;)r.push(Zi.join(t,"node_modules/.bin")),A=t,t=Zi.resolve(t,"..");let n=Zi.resolve(e.cwd,e.execPath,"..");return r.push(n),r.concat(e.path).join(Zi.delimiter)};Xi.exports=GQ;Xi.exports.default=GQ;Xi.exports.env=e=>{e={env:process.env,...e};let A={...e.env},t=PQ({env:A});return e.path=A[t],A[t]=Xi.exports(e),A}});var VQ=Q((zV,hl)=>{"use strict";var JQ=(e,A)=>{for(let t of Reflect.ownKeys(A))Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(A,t));return e};hl.exports=JQ;hl.exports.default=JQ});var OQ=Q(($V,Ko)=>{"use strict";var Kb=VQ(),jo=new WeakMap,qQ=(e,A={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let t,r=0,n=e.displayName||e.name||"<anonymous>",i=function(...s){if(jo.set(i,++r),r===1)t=e.apply(this,s),e=null;else if(A.throw===!0)throw new Error(`Function \`${n}\` can only be called once`);return t};return Kb(i,e),jo.set(i,r),i};Ko.exports=qQ;Ko.exports.default=qQ;Ko.exports.callCount=e=>{if(!jo.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return jo.get(e)}});var HQ=Q(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.SIGNALS=void 0;var Zb=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",descrip
|
||
|
|
${r.message}`:d,p=[I,A,e].filter(Boolean).join(`
|
||
|
|
`);return C?(r.originalMessage=r.message,r.message=p):r=new Error(p),r.shortMessage=I,r.command=s,r.escapedCommand=o,r.exitCode=i,r.signal=n,r.signalDescription=u,r.stdout=e,r.stderr=A,t!==void 0&&(r.all=t),"bufferedData"in r&&delete r.bufferedData,r.failed=!0,r.timedOut=!!a,r.isCanceled=c,r.killed=g&&!a,r};XQ.exports=dk});var eC=Q((iq,Ql)=>{"use strict";var zo=["stdin","stdout","stderr"],Qk=e=>zo.some(A=>e[A]!==void 0),$Q=e=>{if(!e)return;let{stdio:A}=e;if(A===void 0)return zo.map(r=>e[r]);if(Qk(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${zo.map(r=>`\`${r}\``).join(", ")}`);if(typeof A=="string")return A;if(!Array.isArray(A))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof A}\``);let t=Math.max(A.length,zo.length);return Array.from({length:t},(r,n)=>A[n])};Ql.exports=$Q;Ql.exports.node=e=>{let A=$Q(e);return A==="ipc"?"ipc":A===void 0||typeof A=="string"?[A,A,A,"ipc"]:A.includes("ipc")?A:[...A,"ipc"]}});var AC=Q((sq,$o)=>{"use strict";$o.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&$o.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&$o.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var sC=Q((oq,yn)=>{"use strict";var we=global.process,Mr=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};Mr(we)?(tC=require("assert"),pn=AC(),rC=/^win/i.test(we.platform),zi=require("events"),typeof zi!="function"&&(zi=zi.EventEmitter),we.__signal_exit_emitter__?Ve=we.__signal_exit_emitter__:(Ve=we.__signal_exit_emitter__=new zi,Ve.count=0,Ve.emitted={}),Ve.infinite||(Ve.setMaxListeners(1/0),Ve.infinite=!0),yn.exports=function(e,A){if(!Mr(global.process))return function(){};tC.equal(typeof e,"function","a callback must be provided for exit handler"),mn===!1&&Cl();var t="exit";A&&A.alwaysLast&&(t="afterexit");var r=function(){Ve.removeListener(t,e),Ve.listeners("exit").length===0&&Ve.listeners("afterexit").length===0&&ea()};return Ve.on(t,e),r},ea=function(){!mn||!Mr(global.process)||(mn=!1,pn.forEach(function(A){try{we.removeListener(A,Aa[A])}catch{}}),we.emit=ta,we.reallyExit=fl,Ve.count-=1)},yn.exports.unload=ea,vr=function(A,t,r){Ve.emitted[A]||(Ve.emitted[A]=!0,Ve.emit(A,t,r))},Aa={},pn.forEach(function(e){Aa[e]=function(){if(Mr(global.process)){var t=we.listeners(e);t.length===Ve.count&&(ea(),vr("exit",null,e),vr("afterexit",null,e),rC&&e==="SIGHUP"&&(e="SIGINT"),we.kill(we.pid,e))}}}),yn.exports.signals=function(){return pn},mn=!1,Cl=function(){mn||!Mr(global.process)||(mn=!0,Ve.count+=1,pn=pn.filter(function(A){try{return we.on(A,Aa[A]),!0}catch{return!1}}),we.emit=iC,we.reallyExit=nC)},yn.exports.load=Cl,fl=we.reallyExit,nC=function(A){Mr(global.process)&&(we.exitCode=A||0,vr("exit",we.exitCode,null),vr("afterexit",we.exitCode,null),fl.call(we,we.exitCode))},ta=we.emit,iC=function(A,t){if(A==="exit"&&Mr(global.process)){t!==void 0&&(we.exitCode=t);var r=ta.apply(this,arguments);return vr("exit",we.exitCode,null),vr("afterexit",we.exitCode,null),r}else return ta.apply(this,arguments)}):yn.exports=function(){return function(){}};var tC,pn,rC,zi,Ve,ea,vr,Aa,mn,Cl,fl,nC,ta,iC});var aC=Q((aq,oC)=>{"use strict";var Ck=require("os"),fk=sC(),Ik=1e3*5,Bk=(e,A="SIGTERM",t={})=>{let r=e(A);return pk(e,A,t,r),r},pk=(e,A,t,r)=>{if(!mk(A,t,r))return;let n=wk(t),i=setTimeout(()=>{e("SIGKILL")},n);i.unref&&i.unref()},mk=(e,{forceKillAfterTimeout:A},t)=>yk(e)&&A!==!1&&t,yk=e=>e===Ck.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",wk=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return Ik;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Rk=(e,A)=>{e.kill()&&(A.isCanceled=!0)},Dk=(e,A,t)=>{e.kill(A),t(
|
||
|
|
`);let r;for(;(r=kS.exec(t))!=null;){let n=r[1],i=r[2]||"";i=i.trim();let s=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(i=i.replace(/\\n/g,`
|
||
|
|
`),i=i.replace(/\\r/g,"\r")),A[n]=i}return A}function NS(e){let A=qC(e),t=Me.configDotenv({path:A});if(!t.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${A} for an unknown reason`);throw s.code="MISSING_DATA",s}let r=VC(e).split(","),n=r.length,i;for(let s=0;s<n;s++)try{let o=r[s].trim(),a=LS(t,o);i=Me.decrypt(a.ciphertext,a.key);break}catch(o){if(s+1>=n)throw o}return Me.parse(i)}function FS(e){console.log(`[dotenv@${Nl}][INFO] ${e}`)}function xS(e){console.log(`[dotenv@${Nl}][WARN] ${e}`)}function ca(e){console.log(`[dotenv@${Nl}][DEBUG] ${e}`)}function VC(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function LS(e,A){let t;try{t=new URL(A)}catch(o){if(o.code==="ERR_INVALID_URL"){let a=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw a.code="INVALID_DOTENV_KEY",a}throw o}let r=t.password;if(!r){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let n=t.searchParams.get("environment");if(!n){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let i=`DOTENV_VAULT_${n.toUpperCase()}`,s=e.parsed[i];if(!s){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:s,key:r}}function qC(e){let A=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let t of e.path)kl.existsSync(t)&&(A=t.endsWith(".vault")?t:`${t}.vault`);else A=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else A=Sl.resolve(process.cwd(),".env.vault");return kl.existsSync(A)?A:null}function JC(e){return e[0]==="~"?Sl.join(RS.homedir(),e.slice(1)):e}function US(e){FS("Loading env from encrypted .env.vault");let A=Me._parseVault(e),t=process.env;return e&&e.processEnv!=null&&(t=e.processEnv),Me.populate(t,A,e),{parsed:A}}function TS(e){let A=Sl.resolve(process.cwd(),".env"),t="utf8",r=!!(e&&e.debug);e&&e.encoding?t=e.encoding:r&&ca("No encoding is specified. UTF-8 is used by default");let n=[A];if(e&&e.path)if(!Array.isArray(e.path))n=[JC(e.path)];else{n=[];for(let a of e.path)n.push(JC(a))}let i,s={};for(let a of n)try{let c=Me.parse(kl.readFileSync(a,{encoding:t}));Me.populate(s,c,e)}catch(c){r&&ca(`Failed to load ${a} ${c.message}`),i=c}let o=process.env;return e&&e.processEnv!=null&&(o=e.processEnv),Me.populate(o,s,e),i?{parsed:s,error:i}:{parsed:s}}function MS(e){if(VC(e).length===0)return Me.configDotenv(e);let A=qC(e);return A?Me._configVault(e):(xS(`You set DOTENV_KEY but you are missing a .env.vault file at ${A}. Did you forget to build it?`),Me.configDotenv(e))}function vS(e,A){let t=Buffer.from(A.slice(-64),"hex"),r=Buffer.from(e,"base64"),n=r.subarray(0,12),i=r.subarray(-16);r=r.subarray(12,-16);try{let s=DS.createDecipheriv("aes-256-gcm",t,n);return s.setAuthTag(i),`${s.update(r)}${s.final()}`}catch(s){let o=s instanceof RangeError,a=s.message==="Invalid key length",c=s.message==="Unsupported state or unable to authenticate data";if(o||a){let g=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw g.code="INVALID_DOTENV_KEY",g}else if(c){let g=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw g.code="DECRYPTION_FAILED",g}else throw s}}function PS(e,A,t={}){let r=!!(t&&t.debug),n=!!(t&&t.override);if(typeof A!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(A))Object.prototype.hasOwnProperty.call(e,i)?(n===!0&&(e[i]=A[i]),r&&ca(n===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):e[i]=A[i]}var Me={configDotenv:TS,_configVault:US,_parseVault:NS,config:MS,decrypt:vS,parse:SS,populate:PS};Pt.exports.configDotenv=Me.configDotenv;Pt.exports._configVault=Me._configVault;Pt.exports._parseVault=Me._parseVault;Pt.exports.confi
|
||
|
|
\r
|
||
|
|
`),BL=/\r\n/g,pL=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function Wn(e){BB.call(this),e=e||{};let A=this;this.nread=0,this.maxed=!1,this.npairs=0,this.maxHeaderPairs=IB(e,"maxHeaderPairs",2e3),this.maxHeaderSize=IB(e,"maxHeaderSize",80*1024),this.buffer="",this.header={},this.finished=!1,this.ss=new fL(IL),this.ss.on("info",function(t,r,n,i){r&&!A.maxed&&(A.nread+i-n>=A.maxHeaderSize?(i=A.maxHeaderSize-A.nread+n,A.nread=A.maxHeaderSize,A.maxed=!0):A.nread+=i-n,A.buffer+=r.toString("binary",n,i)),t&&A._finish()})}CL(Wn,BB);Wn.prototype.push=function(e){let A=this.ss.push(e);if(this.finished)return A};Wn.prototype.reset=function(){this.finished=!1,this.buffer="",this.header={},this.ss.reset()};Wn.prototype._finish=function(){this.buffer&&this._parseHeader(),this.ss.matches=this.ss.maxMatches;let e=this.header;this.header={},this.buffer="",this.finished=!0,this.nread=this.npairs=0,this.maxed=!1,this.emit("header",e)};Wn.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs)return;let e=this.buffer.split(BL),A=e.length,t,r;for(var n=0;n<A;++n){if(e[n].length===0)continue;if((e[n][0]===" "||e[n][0]===" ")&&r){this.header[r][this.header[r].length-1]+=e[n];continue}let i=e[n].indexOf(":");if(i===-1||i===0)return;if(t=pL.exec(e[n]),r=t[1].toLowerCase(),this.header[r]=this.header[r]||[],this.header[r].push(t[2]||""),++this.npairs===this.maxHeaderPairs)break}};pB.exports=Wn});var qu=Q((Z4,wB)=>{"use strict";var Vu=require("node:stream").Writable,mL=require("node:util").inherits,yL=Yu(),yB=CB(),wL=mB(),RL=45,DL=Buffer.from("-"),bL=Buffer.from(`\r
|
||
|
|
`),kL=function(){};function $A(e){if(!(this instanceof $A))return new $A(e);if(Vu.call(this,e),!e||!e.headerFirst&&typeof e.boundary!="string")throw new TypeError("Boundary required");typeof e.boundary=="string"?this.setBoundary(e.boundary):this._bparser=void 0,this._headerFirst=e.headerFirst,this._dashes=0,this._parts=0,this._finished=!1,this._realFinish=!1,this._isPreamble=!0,this._justMatched=!1,this._firstWrite=!0,this._inHeader=!0,this._part=void 0,this._cb=void 0,this._ignoreData=!1,this._partOpts={highWaterMark:e.partHwm},this._pause=!1;let A=this;this._hparser=new wL(e),this._hparser.on("header",function(t){A._inHeader=!1,A._part.emit("header",t)})}mL($A,Vu);$A.prototype.emit=function(e){if(e==="finish"&&!this._realFinish){if(!this._finished){let A=this;process.nextTick(function(){if(A.emit("error",new Error("Unexpected end of multipart data")),A._part&&!A._ignoreData){let t=A._isPreamble?"Preamble":"Part";A._part.emit("error",new Error(t+" terminated early due to unexpected end of multipart data")),A._part.push(null),process.nextTick(function(){A._realFinish=!0,A.emit("finish"),A._realFinish=!1});return}A._realFinish=!0,A.emit("finish"),A._realFinish=!1})}}else Vu.prototype.emit.apply(this,arguments)};$A.prototype._write=function(e,A,t){if(!this._hparser&&!this._bparser)return t();if(this._headerFirst&&this._isPreamble){this._part||(this._part=new yB(this._partOpts),this._events.preamble?this.emit("preamble",this._part):this._ignore());let r=this._hparser.push(e);if(!this._inHeader&&r!==void 0&&r<e.length)e=e.slice(r);else return t()}this._firstWrite&&(this._bparser.push(bL),this._firstWrite=!1),this._bparser.push(e),this._pause?this._cb=t:t()};$A.prototype.reset=function(){this._part=void 0,this._bparser=void 0,this._hparser=void 0};$A.prototype.setBoundary=function(e){let A=this;this._bparser=new yL(`\r
|
||
|
|
--`+e),this._bparser.on("info",function(t,r,n,i){A._oninfo(t,r,n,i)})};$A.prototype._ignore=function(){this._part&&!this._ignoreData&&(this._ignoreData=!0,this._part.on("error",kL),this._part.resume())};$A.prototype._oninfo=function(e,A,t,r){let n,i=this,s=0,o,a=!0;if(!this._part&&this._justMatched&&A){for(;this._dashes<2&&t+s<r;)if(A[t+s]===RL)++s,++this._dashes;else{this._dashes&&(n=DL),this._dashes=0;break}if(this._dashes===2&&(t+s<r&&this._events.trailer&&this.emit("trailer",A.slice(t+s,r)),this.reset(),this._finished=!0,i._parts===0&&(i._realFinish=!0,i.emit("finish"),i._realFinish=!1)),this._dashes)return}this._justMatched&&(this._justMatched=!1),this._part||(this._part=new yB(this._partOpts),this._part._read=function(c){i._unpause()},this._isPreamble&&this._events.preamble?this.emit("preamble",this._part):this._isPreamble!==!0&&this._events.part?this.emit("part",this._part):this._ignore(),this._isPreamble||(this._inHeader=!0)),A&&t<r&&!this._ignoreData&&(this._isPreamble||!this._inHeader?(n&&(a=this._part.push(n)),a=this._part.push(A.slice(t,r)),a||(this._pause=!0)):!this._isPreamble&&this._inHeader&&(n&&this._hparser.push(n),o=this._hparser.push(A.slice(t,r)),!this._inHeader&&o!==void 0&&o<r&&this._oninfo(!1,A,t+o,r))),e&&(this._hparser.reset(),this._isPreamble?this._isPreamble=!1:t!==r&&(++this._parts,this._part.on("end",function(){--i._parts===0&&(i._finished?(i._realFinish=!0,i.emit("finish"),i._realFinish=!1):i._unpause())})),this._part.push(null),this._part=void 0,this._ignoreData=!1,this._justMatched=!0,this._dashes=0)};$A.prototype._unpause=function(){if(this._pause&&(this._pause=!1,this._cb)){let e=this._cb;this._cb=void 0,e()}};wB.exports=$A});var za=Q((X4,DB)=>{"use strict";var RB=new TextDecoder("utf-8"),Xa=new Map([["utf-8",RB],["utf8",RB]]);function SL(e,A,t){if(e)if(Xa.has(t))try{return Xa.get(t).decode(Buffer.from(e,A))}catch{}else try{return Xa.set(t,new TextDecoder(t)),Xa.get(t).decode(Buffer.from(e,A))}catch{}return e}DB.exports=SL});var Ou=Q((z4,SB)=>{"use strict";var $a=za(),bB=/%([a-fA-F0-9]{2})/g;function kB(e,A){return String.fromCharCode(parseInt(A,16))}function NL(e){let A=[],t="key",r="",n=!1,i=!1,s=0,o="";for(var a=0,c=e.length;a<c;++a){let g=e[a];if(g==="\\"&&n)if(i)i=!1;else{i=!0;continue}else if(g==='"')if(i)i=!1;else{n?(n=!1,t="key"):n=!0;continue}else if(i&&n&&(o+="\\"),i=!1,(t==="charset"||t==="lang")&&g==="'"){t==="charset"?(t="lang",r=o.substring(1)):t="value",o="";continue}else if(t==="key"&&(g==="*"||g==="=")&&A.length){g==="*"?t="charset":t="value",A[s]=[o,void 0],o="";continue}else if(!n&&g===";"){t="key",r?(o.length&&(o=$a(o.replace(bB,kB),"binary",r)),r=""):o.length&&(o=$a(o,"binary","utf8")),A[s]===void 0?A[s]=o:A[s][1]=o,o="",++s;continue}else if(!n&&(g===" "||g===" "))continue;o+=g}return r&&o.length?o=$a(o.replace(bB,kB),"binary",r):o&&(o=$a(o,"binary","utf8")),A[s]===void 0?o&&(A[s]=o):A[s][1]=o,A}SB.exports=NL});var FB=Q(($4,NB)=>{"use strict";NB.exports=function(A){if(typeof A!="string")return"";for(var t=A.length-1;t>=0;--t)switch(A.charCodeAt(t)){case 47:case 92:return A=A.slice(t+1),A===".."||A==="."?"":A}return A===".."||A==="."?"":A}});var TB=Q((ej,UB)=>{"use strict";var{Readable:LB}=require("node:stream"),{inherits:FL}=require("node:util"),xL=qu(),xB=Ou(),LL=za(),UL=FB(),qr=Za(),TL=/^boundary$/i,ML=/^form-data$/i,vL=/^charset$/i,PL=/^filename$/i,GL=/^name$/i;ec.detect=/^multipart\/form-data/i;function ec(e,A){let t,r,n=this,i,s=A.limits,o=A.isPartAFile||((ee,J,ce)=>J==="application/octet-stream"||ce!==void 0),a=A.parsedConType||[],c=A.defCharset||"utf8",g=A.preservePath,l={highWaterMark:A.fileHwm};for(t=0,r=a.length;t<r;++t)if(Array.isArray(a[t])&&TL.test(a[t][0])){i=a[t][1];break}function u(){H===0&&ae&&!e._done&&(ae=!1,n.end())}if(typeof i!="string")throw new Error("Multipart: Boundary not found");let E=qr(s,"fieldSize",1*1024*1024),h=qr(s,"fileSize",1/0),d=qr(s,"files",1/0),C=qr(s,"fields",1/0),I=qr(s,"parts",1/0),p=qr(s,"headerPairs",2e3),w=qr(s,"headerSize",80*1024),m=0,K=0,H=0,ne,q,ae=!1;this._needDrain=!1,this._pause=!1,this._cb=void 0,this._nparts=0,t
|
||
|
|
`))}function kU(e,A){let{headersList:t}=A,r=(t.get("referrer-policy")??"").split(","),n="";if(r.length>0)for(let i=r.length;i!==0;i--){let s=r[i-1].trim();if(hU.has(s)){n=s;break}}n!==""&&(e.referrerPolicy=n)}function SU(){return"allowed"}function NU(){return"success"}function FU(){return"success"}function xU(e){let A=null;A=e.mode,e.headersList.set("sec-fetch-mode",A)}function LU(e){let A=e.origin;if(e.responseTainting==="cors"||e.mode==="websocket")A&&e.headersList.append("origin",A);else if(e.method!=="GET"&&e.method!=="HEAD"){switch(e.referrerPolicy){case"no-referrer":A=null;break;case"no-referrer-when-downgrade":case"strict-origin":case"strict-origin-when-cross-origin":e.origin&&zu(e.origin)&&!zu(Fs(e))&&(A=null);break;case"same-origin":rc(e,Fs(e))||(A=null);break;default:}A&&e.headersList.append("origin",A)}}function UU(e){return CU.now()}function TU(e){return{startTime:e.startTime??0,redirectStartTime:0,redirectEndTime:0,postRedirectStartTime:e.startTime??0,finalServiceWorkerStartTime:0,finalNetworkResponseStartTime:0,finalNetworkRequestStartTime:0,endTime:0,encodedBodySize:0,decodedBodySize:0,finalConnectionTimingInfo:null}}function MU(){return{referrerPolicy:"strict-origin-when-cross-origin"}}function vU(e){return{referrerPolicy:e.referrerPolicy}}function PU(e){let A=e.referrerPolicy;Xn(A);let t=null;if(e.referrer==="client"){let o=QU();if(!o||o.origin==="null")return"no-referrer";t=new URL(o)}else e.referrer instanceof URL&&(t=e.referrer);let r=Zu(t),n=Zu(t,!0);r.toString().length>4096&&(r=n);let i=rc(e,r),s=Ns(r)&&!Ns(e.url);switch(A){case"origin":return n??Zu(t,!0);case"unsafe-url":return r;case"same-origin":return i?n:"no-referrer";case"origin-when-cross-origin":return i?r:n;case"strict-origin-when-cross-origin":{let o=Fs(e);return rc(r,o)?r:Ns(r)&&!Ns(o)?"no-referrer":n}case"strict-origin":case"no-referrer-when-downgrade":default:return s?"no-referrer":n}}function Zu(e,A){return Xn(e instanceof URL),e.protocol==="file:"||e.protocol==="about:"||e.protocol==="blank:"?"no-referrer":(e.username="",e.password="",e.hash="",A&&(e.pathname="",e.search=""),e)}function Ns(e){if(!(e instanceof URL))return!1;if(e.href==="about:blank"||e.href==="about:srcdoc"||e.protocol==="data:"||e.protocol==="file:")return!0;return A(e.origin);function A(t){if(t==null||t==="null")return!1;let r=new URL(t);return!!(r.protocol==="https:"||r.protocol==="wss:"||/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(r.hostname)||r.hostname==="localhost"||r.hostname.includes("localhost.")||r.hostname.endsWith(".localhost"))}}function GU(e,A){if(tc===void 0)return!0;let t=tp(A);if(t==="no metadata"||t.length===0)return!0;let r=JU(t),n=VU(t,r);for(let i of n){let s=i.algo,o=i.hash,a=tc.createHash(s).update(e).digest("base64");if(a[a.length-1]==="="&&(a[a.length-2]==="="?a=a.slice(0,-2):a=a.slice(0,-1)),qU(a,o))return!0}return!1}var YU=/(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i;function tp(e){let A=[],t=!0;for(let r of e.split(" ")){t=!1;let n=YU.exec(r);if(n===null||n.groups===void 0||n.groups.algo===void 0)continue;let i=n.groups.algo.toLowerCase();zB.includes(i)&&A.push(n.groups)}return t===!0?"no metadata":A}function JU(e){let A=e[0].algo;if(A[3]==="5")return A;for(let t=1;t<e.length;++t){let r=e[t];if(r.algo[3]==="5"){A="sha512";break}else{if(A[3]==="3")continue;r.algo[3]==="3"&&(A="sha384")}}return A}function VU(e,A){if(e.length===1)return e;let t=0;for(let r=0;r<e.length;++r)e[r].algo===A&&(e[t++]=e[r]);return e.length=t,e}function qU(e,A){if(e.length!==A.length)return!1;for(let t=0;t<e.length;++t)if(e[t]!==A[t]){if(e[t]==="+"&&A[t]==="-"||e[t]==="/"&&A[t]==="_")continue;return!1}return!0}function OU(e){}function rc(e,A){return e.origin===A.origin&&e.origin==="null"||e.protocol===A.protocol&&e.hostname===A.hostname&&e.port===A.port}function HU(){let e,A;return{promise:new Promise((r,n)=>{e=r,A=n}),resolve:e,reject:A}}function WU(e){return e.controller.state==="aborted"}function _U(e){return e.controller.state==="aborted"||e.controller.state==="terminated"}var $u={delete:"DEL
|
||
|
|
`||e===" "||e===" "}function eE(e,A=!0,t=!0){let r=0,n=e.length-1;if(A)for(;r<e.length&&cp(e[r]);r++);if(t)for(;n>0&&cp(e[n]);n--);return e.slice(r,n+1)}function gp(e){return e==="\r"||e===`
|
||
|
|
`||e===" "||e==="\f"||e===" "}function CT(e,A=!0,t=!0){let r=0,n=e.length-1;if(A)for(;r<e.length&&gp(e[r]);r++);if(t)for(;n>0&&gp(e[n]);n--);return e.slice(r,n+1)}hp.exports={dataURLProcessor:ET,URLSerializer:lp,collectASequenceOfCodePoints:sc,collectASequenceOfCodePointsFast:zn,stringPercentDecode:up,parseMIMEType:AE,collectAnHTTPQuotedString:Ep,serializeAMimeType:QT}});var oc=Q((gj,Ip)=>{"use strict";var{Blob:Cp,File:dp}=require("buffer"),{types:tE}=require("util"),{kState:bA}=qt(),{isBlobLike:fp}=VA(),{webidl:te}=sA(),{parseMIMEType:fT,serializeAMimeType:IT}=et(),{kEnumerableProperty:Qp}=W(),BT=new TextEncoder,xs=class e extends Cp{constructor(A,t,r={}){te.argumentLengthCheck(arguments,2,{header:"File constructor"}),A=te.converters["sequence<BlobPart>"](A),t=te.converters.USVString(t),r=te.converters.FilePropertyBag(r);let n=t,i=r.type,s;e:{if(i){if(i=fT(i),i==="failure"){i="";break e}i=IT(i).toLowerCase()}s=r.lastModified}super(pT(A,r),{type:i}),this[bA]={name:n,lastModified:s,type:i}}get name(){return te.brandCheck(this,e),this[bA].name}get lastModified(){return te.brandCheck(this,e),this[bA].lastModified}get type(){return te.brandCheck(this,e),this[bA].type}},rE=class e{constructor(A,t,r={}){let n=t,i=r.type,s=r.lastModified??Date.now();this[bA]={blobLike:A,name:n,type:i,lastModified:s}}stream(...A){return te.brandCheck(this,e),this[bA].blobLike.stream(...A)}arrayBuffer(...A){return te.brandCheck(this,e),this[bA].blobLike.arrayBuffer(...A)}slice(...A){return te.brandCheck(this,e),this[bA].blobLike.slice(...A)}text(...A){return te.brandCheck(this,e),this[bA].blobLike.text(...A)}get size(){return te.brandCheck(this,e),this[bA].blobLike.size}get type(){return te.brandCheck(this,e),this[bA].blobLike.type}get name(){return te.brandCheck(this,e),this[bA].name}get lastModified(){return te.brandCheck(this,e),this[bA].lastModified}get[Symbol.toStringTag](){return"File"}};Object.defineProperties(xs.prototype,{[Symbol.toStringTag]:{value:"File",configurable:!0},name:Qp,lastModified:Qp});te.converters.Blob=te.interfaceConverter(Cp);te.converters.BlobPart=function(e,A){if(te.util.Type(e)==="Object"){if(fp(e))return te.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||tE.isAnyArrayBuffer(e))return te.converters.BufferSource(e,A)}return te.converters.USVString(e,A)};te.converters["sequence<BlobPart>"]=te.sequenceConverter(te.converters.BlobPart);te.converters.FilePropertyBag=te.dictionaryConverter([{key:"lastModified",converter:te.converters["long long"],get defaultValue(){return Date.now()}},{key:"type",converter:te.converters.DOMString,defaultValue:""},{key:"endings",converter:e=>(e=te.converters.DOMString(e),e=e.toLowerCase(),e!=="native"&&(e="transparent"),e),defaultValue:"transparent"}]);function pT(e,A){let t=[];for(let r of e)if(typeof r=="string"){let n=r;A.endings==="native"&&(n=mT(n)),t.push(BT.encode(n))}else tE.isAnyArrayBuffer(r)||tE.isTypedArray(r)?r.buffer?t.push(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)):t.push(new Uint8Array(r)):fp(r)&&t.push(r);return t}function mT(e){let A=`
|
||
|
|
`;return process.platform==="win32"&&(A=`\r
|
||
|
|
`),e.replace(/\r?\n/g,A)}function yT(e){return dp&&e instanceof dp||e instanceof xs||e&&(typeof e.stream=="function"||typeof e.arrayBuffer=="function")&&e[Symbol.toStringTag]==="File"}Ip.exports={File:xs,FileLike:rE,isFileLike:yT}});var cc=Q((lj,wp)=>{"use strict";var{isBlobLike:ac,toUSVString:wT,makeIterator:nE}=VA(),{kState:eA}=qt(),{File:yp,FileLike:Bp,isFileLike:RT}=oc(),{webidl:re}=sA(),{Blob:DT,File:iE}=require("buffer"),pp=iE??yp,$n=class e{constructor(A){if(A!==void 0)throw re.errors.conversionFailed({prefix:"FormData constructor",argument:"Argument 1",types:["undefined"]});this[eA]=[]}append(A,t,r=void 0){if(re.brandCheck(this,e),re.argumentLengthCheck(arguments,2,{header:"FormData.append"}),arguments.length===3&&!ac(t))throw new TypeError("Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'");A=re.converters.USVString(A),t=ac(t)?re.converters.Blob(t,{strict:!1}):re.converters.USVString(t),r=arguments.length===3?re.converters.USVString(r):void 0;let n=mp(A,t,r);this[eA].push(n)}delete(A){re.brandCheck(this,e),re.argumentLengthCheck(arguments,1,{header:"FormData.delete"}),A=re.converters.USVString(A),this[eA]=this[eA].filter(t=>t.name!==A)}get(A){re.brandCheck(this,e),re.argumentLengthCheck(arguments,1,{header:"FormData.get"}),A=re.converters.USVString(A);let t=this[eA].findIndex(r=>r.name===A);return t===-1?null:this[eA][t].value}getAll(A){return re.brandCheck(this,e),re.argumentLengthCheck(arguments,1,{header:"FormData.getAll"}),A=re.converters.USVString(A),this[eA].filter(t=>t.name===A).map(t=>t.value)}has(A){return re.brandCheck(this,e),re.argumentLengthCheck(arguments,1,{header:"FormData.has"}),A=re.converters.USVString(A),this[eA].findIndex(t=>t.name===A)!==-1}set(A,t,r=void 0){if(re.brandCheck(this,e),re.argumentLengthCheck(arguments,2,{header:"FormData.set"}),arguments.length===3&&!ac(t))throw new TypeError("Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'");A=re.converters.USVString(A),t=ac(t)?re.converters.Blob(t,{strict:!1}):re.converters.USVString(t),r=arguments.length===3?wT(r):void 0;let n=mp(A,t,r),i=this[eA].findIndex(s=>s.name===A);i!==-1?this[eA]=[...this[eA].slice(0,i),n,...this[eA].slice(i+1).filter(s=>s.name!==A)]:this[eA].push(n)}entries(){return re.brandCheck(this,e),nE(()=>this[eA].map(A=>[A.name,A.value]),"FormData","key+value")}keys(){return re.brandCheck(this,e),nE(()=>this[eA].map(A=>[A.name,A.value]),"FormData","key")}values(){return re.brandCheck(this,e),nE(()=>this[eA].map(A=>[A.name,A.value]),"FormData","value")}forEach(A,t=globalThis){if(re.brandCheck(this,e),re.argumentLengthCheck(arguments,1,{header:"FormData.forEach"}),typeof A!="function")throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");for(let[r,n]of this)A.apply(t,[n,r,this])}};$n.prototype[Symbol.iterator]=$n.prototype.entries;Object.defineProperties($n.prototype,{[Symbol.toStringTag]:{value:"FormData",configurable:!0}});function mp(e,A,t){if(e=Buffer.from(e).toString("utf8"),typeof A=="string")A=Buffer.from(A).toString("utf8");else if(RT(A)||(A=A instanceof DT?new pp([A],"blob",{type:A.type}):new Bp(A,"blob",{type:A.type})),t!==void 0){let r={type:A.type,lastModified:A.lastModified};A=iE&&A instanceof iE||A instanceof yp?new pp([A],t,r):new Bp(A,t,r)}return{name:e,value:A}}wp.exports={FormData:$n}});var Ls=Q((uj,Lp)=>{"use strict";var bT=VB(),ei=W(),{ReadableStreamFrom:kT,isBlobLike:Rp,isReadableStreamLike:ST,readableStreamClose:NT,createDeferredPromise:FT,fullyReadBody:xT}=VA(),{FormData:Dp}=cc(),{kState:Ht}=qt(),{webidl:sE}=sA(),{DOMException:Sp,structuredClone:LT}=pr(),{Blob:UT,File:TT}=require("buffer"),{kBodyUsed:MT}=de(),oE=require("assert"),{isErrored:vT}=W(),{isUint8Array:Np,isArrayBuffer:PT}=require("util/types"),{File:GT}=oc(),{parseMIMEType:YT,serializeAMimeType:JT}=et(),Ot=globalThis.ReadableStream,bp=TT??GT,gc=new TextEncoder,VT=new TextDecoder;function Fp(e,A=!1){Ot||(Ot=require("stream/web").ReadableStream);let t=null;e instanceof Ot?t=e:Rp(e)?t=e.stream():t=new Ot({async pull(a){a.enqueue(typeof n=="stri
|
||
|
|
Content-Disposition: form-data`;let g=C=>C.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),l=C=>C.replace(/\r?\n|\r/g,`\r
|
||
|
|
`),u=[],E=new Uint8Array([13,10]);i=0;let h=!1;for(let[C,I]of e)if(typeof I=="string"){let p=gc.encode(c+`; name="${g(l(C))}"\r
|
||
|
|
\r
|
||
|
|
${l(I)}\r
|
||
|
|
`);u.push(p),i+=p.byteLength}else{let p=gc.encode(`${c}; name="${g(l(C))}"`+(I.name?`; filename="${g(I.name)}"`:"")+`\r
|
||
|
|
Content-Type: ${I.type||"application/octet-stream"}\r
|
||
|
|
\r
|
||
|
|
`);u.push(p,I,E),typeof I.size=="number"?i+=p.byteLength+I.size+E.byteLength:h=!0}let d=gc.encode(`--${a}--`);u.push(d),i+=d.byteLength,h&&(i=null),n=e,r=async function*(){for(let C of u)C.stream?yield*C.stream():yield C},s="multipart/form-data; boundary="+a}else if(Rp(e))n=e,i=e.size,e.type&&(s=e.type);else if(typeof e[Symbol.asyncIterator]=="function"){if(A)throw new TypeError("keepalive");if(ei.isDisturbed(e)||e.locked)throw new TypeError("Response body object should not be disturbed or locked");t=e instanceof Ot?e:kT(e)}if((typeof n=="string"||ei.isBuffer(n))&&(i=Buffer.byteLength(n)),r!=null){let a;t=new Ot({async start(){a=r(e)[Symbol.asyncIterator]()},async pull(c){let{value:g,done:l}=await a.next();return l?queueMicrotask(()=>{c.close()}):vT(t)||c.enqueue(new Uint8Array(g)),c.desiredSize>0},async cancel(c){await a.return()},type:void 0})}return[{stream:t,source:n,length:i},s]}function qT(e,A=!1){return Ot||(Ot=require("stream/web").ReadableStream),e instanceof Ot&&(oE(!ei.isDisturbed(e),"The body has already been consumed."),oE(!e.locked,"The stream is locked.")),Fp(e,A)}function OT(e){let[A,t]=e.stream.tee(),r=LT(t,{transfer:[t]}),[,n]=r.tee();return e.stream=A,{stream:n,length:e.length,source:e.source}}async function*kp(e){if(e)if(Np(e))yield e;else{let A=e.stream;if(ei.isDisturbed(A))throw new TypeError("The body has already been consumed.");if(A.locked)throw new TypeError("The stream is locked.");A[MT]=!0,yield*A}}function aE(e){if(e.aborted)throw new Sp("The operation was aborted.","AbortError")}function HT(e){return{blob(){return lc(this,t=>{let r=KT(this);return r==="failure"?r="":r&&(r=JT(r)),new UT([t],{type:r})},e)},arrayBuffer(){return lc(this,t=>new Uint8Array(t).buffer,e)},text(){return lc(this,xp,e)},json(){return lc(this,jT,e)},async formData(){sE.brandCheck(this,e),aE(this[Ht]);let t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){let r={};for(let[o,a]of this.headers)r[o.toLowerCase()]=a;let n=new Dp,i;try{i=new bT({headers:r,preservePath:!0})}catch(o){throw new Sp(`${o}`,"AbortError")}i.on("field",(o,a)=>{n.append(o,a)}),i.on("file",(o,a,c,g,l)=>{let u=[];if(g==="base64"||g.toLowerCase()==="base64"){let E="";a.on("data",h=>{E+=h.toString().replace(/[\r\n]/gm,"");let d=E.length-E.length%4;u.push(Buffer.from(E.slice(0,d),"base64")),E=E.slice(d)}),a.on("end",()=>{u.push(Buffer.from(E,"base64")),n.append(o,new bp(u,c,{type:l}))})}else a.on("data",E=>{u.push(E)}),a.on("end",()=>{n.append(o,new bp(u,c,{type:l}))})});let s=new Promise((o,a)=>{i.on("finish",o),i.on("error",c=>a(new TypeError(c)))});if(this.body!==null)for await(let o of kp(this[Ht].body))i.write(o);return i.end(),await s,n}else if(/application\/x-www-form-urlencoded/.test(t)){let r;try{let i="",s=new TextDecoder("utf-8",{ignoreBOM:!0});for await(let o of kp(this[Ht].body)){if(!Np(o))throw new TypeError("Expected Uint8Array chunk");i+=s.decode(o,{stream:!0})}i+=s.decode(),r=new URLSearchParams(i)}catch(i){throw Object.assign(new TypeError,{cause:i})}let n=new Dp;for(let[i,s]of r)n.append(i,s);return n}else throw await Promise.resolve(),aE(this[Ht]),sE.errors.exception({header:`${e.name}.formData`,message:"Could not parse content as FormData."})}}}function WT(e){Object.assign(e.prototype,HT(e))}async function lc(e,A,t){if(sE.brandCheck(e,t),aE(e[Ht]),_T(e[Ht].body))throw new TypeError("Body is unusable");let r=FT(),n=s=>r.reject(s),i=s=>{try{r.resolve(A(s))}catch(o){n(o)}};return e[Ht].body==null?(i(new Uint8Array),r.promise):(await xT(e[Ht].body,i,n),r.promise)}function _T(e){return e!=null&&(e.stream.locked||ei.isDisturbed(e.stream))}function xp(e){return e.length===0?"":(e[0]===239&&e[1]===187&&e[2]===191&&(e=e.subarray(3)),VT.decode(e))}function jT(e){return JSON.parse(xp(e))}function KT(e){let{headersList:A}=e[Ht],t=A.get("content-type");return t===null?"failure":YT(t)}Lp.exports={extractBody:Fp,safelyExtractBody:qT,cloneBody:OT,mixinBody:WT}});var vp=Q((Ej,Mp)=>{"use strict";var{InvalidArgumentError:Qe,NotSupportedError:ZT}=le(),Wt=require("assert"),{kHTTP2BuildRequest:XT,kHTTP2CopyHeaders:zT,kHTTP1BuildRequest:$
|
||
|
|
`),this.body=C.stream,this.contentLength=C.length}else CA.isBlobLike(n)&&this.contentType==null&&n.type&&(this.contentType=n.type,this.headers+=`content-type: ${n.type}\r
|
||
|
|
`);CA.validateHandler(d,r,c),this.servername=CA.getServerName(this.host),this[At]=d,Ue.create.hasSubscribers&&Ue.create.publish({request:this})}onBodySent(A){if(this[At].onBodySent)try{return this[At].onBodySent(A)}catch(t){this.abort(t)}}onRequestSent(){if(Ue.bodySent.hasSubscribers&&Ue.bodySent.publish({request:this}),this[At].onRequestSent)try{return this[At].onRequestSent()}catch(A){this.abort(A)}}onConnect(A){if(Wt(!this.aborted),Wt(!this.completed),this.error)A(this.error);else return this.abort=A,this[At].onConnect(A)}onHeaders(A,t,r,n){Wt(!this.aborted),Wt(!this.completed),Ue.headers.hasSubscribers&&Ue.headers.publish({request:this,response:{statusCode:A,headers:t,statusText:n}});try{return this[At].onHeaders(A,t,r,n)}catch(i){this.abort(i)}}onData(A){Wt(!this.aborted),Wt(!this.completed);try{return this[At].onData(A)}catch(t){return this.abort(t),!1}}onUpgrade(A,t,r){return Wt(!this.aborted),Wt(!this.completed),this[At].onUpgrade(A,t,r)}onComplete(A){this.onFinally(),Wt(!this.aborted),this.completed=!0,Ue.trailers.hasSubscribers&&Ue.trailers.publish({request:this,trailers:A});try{return this[At].onComplete(A)}catch(t){this.onError(t)}}onError(A){if(this.onFinally(),Ue.error.hasSubscribers&&Ue.error.publish({request:this,error:A}),!this.aborted)return this.aborted=!0,this[At].onError(A)}onFinally(){this.errorHandler&&(this.body.off("error",this.errorHandler),this.errorHandler=null),this.endHandler&&(this.body.off("end",this.endHandler),this.endHandler=null)}addHeader(A,t){return Us(this,A,t),this}static[$T](A,t,r){return new e(A,t,r)}static[XT](A,t,r){let n=t.headers;t={...t,headers:null};let i=new e(A,t,r);if(i.headers={},Array.isArray(n)){if(n.length%2!==0)throw new Qe("headers array must be even");for(let s=0;s<n.length;s+=2)Us(i,n[s],n[s+1],!0)}else if(n&&typeof n=="object"){let s=Object.keys(n);for(let o=0;o<s.length;o++){let a=s[o];Us(i,a,n[a],!0)}}else if(n!=null)throw new Qe("headers must be an object or an array");return i}static[zT](A){let t=A.split(`\r
|
||
|
|
`),r={};for(let n of t){let[i,s]=n.split(": ");s==null||s.length===0||(r[i]?r[i]+=`,${s}`:r[i]=s)}return r}};function Or(e,A,t){if(A&&typeof A=="object")throw new Qe(`invalid ${e} header`);if(A=A!=null?`${A}`:"",Tp.exec(A)!==null)throw new Qe(`invalid ${e} header`);return t?A:`${e}: ${A}\r
|
||
|
|
`}function Us(e,A,t,r=!1){if(t&&typeof t=="object"&&!Array.isArray(t))throw new Qe(`invalid ${A} header`);if(t===void 0)return;if(e.host===null&&A.length===4&&A.toLowerCase()==="host"){if(Tp.exec(t)!==null)throw new Qe(`invalid ${A} header`);e.host=t}else if(e.contentLength===null&&A.length===14&&A.toLowerCase()==="content-length"){if(e.contentLength=parseInt(t,10),!Number.isFinite(e.contentLength))throw new Qe("invalid content-length header")}else if(e.contentType===null&&A.length===12&&A.toLowerCase()==="content-type")e.contentType=t,r?e.headers[A]=Or(A,t,r):e.headers+=Or(A,t);else{if(A.length===17&&A.toLowerCase()==="transfer-encoding")throw new Qe("invalid transfer-encoding header");if(A.length===10&&A.toLowerCase()==="connection"){let n=typeof t=="string"?t.toLowerCase():null;if(n!=="close"&&n!=="keep-alive")throw new Qe("invalid connection header");n==="close"&&(e.reset=!0)}else{if(A.length===10&&A.toLowerCase()==="keep-alive")throw new Qe("invalid keep-alive header");if(A.length===7&&A.toLowerCase()==="upgrade")throw new Qe("invalid upgrade header");if(A.length===6&&A.toLowerCase()==="expect")throw new ZT("expect header not supported");if(Up.exec(A)===null)throw new Qe("invalid header key");if(Array.isArray(t))for(let n=0;n<t.length;n++)r?e.headers[A]?e.headers[A]+=`,${Or(A,t[n],r)}`:e.headers[A]=Or(A,t[n],r):e.headers+=Or(A,t[n]);else r?e.headers[A]=Or(A,t,r):e.headers+=Or(A,t)}}}Mp.exports=gE});var uc=Q((hj,Pp)=>{"use strict";var AM=require("events"),lE=class extends AM{dispatch(){throw new Error("not implemented")}close(){throw new Error("not implemented")}destroy(){throw new Error("not implemented")}};Pp.exports=lE});var Ms=Q((dj,Gp)=>{"use strict";var tM=uc(),{ClientDestroyedError:uE,ClientClosedError:rM,InvalidArgumentError:Ai}=le(),{kDestroy:nM,kClose:iM,kDispatch:EE,kInterceptors:Hr}=de(),ti=Symbol("destroyed"),Ts=Symbol("closed"),_t=Symbol("onDestroyed"),ri=Symbol("onClosed"),Ec=Symbol("Intercepted Dispatch"),hE=class extends tM{constructor(){super(),this[ti]=!1,this[_t]=null,this[Ts]=!1,this[ri]=[]}get destroyed(){return this[ti]}get closed(){return this[Ts]}get interceptors(){return this[Hr]}set interceptors(A){if(A){for(let t=A.length-1;t>=0;t--)if(typeof this[Hr][t]!="function")throw new Ai("interceptor must be an function")}this[Hr]=A}close(A){if(A===void 0)return new Promise((r,n)=>{this.close((i,s)=>i?n(i):r(s))});if(typeof A!="function")throw new Ai("invalid callback");if(this[ti]){queueMicrotask(()=>A(new uE,null));return}if(this[Ts]){this[ri]?this[ri].push(A):queueMicrotask(()=>A(null,null));return}this[Ts]=!0,this[ri].push(A);let t=()=>{let r=this[ri];this[ri]=null;for(let n=0;n<r.length;n++)r[n](null,null)};this[iM]().then(()=>this.destroy()).then(()=>{queueMicrotask(t)})}destroy(A,t){if(typeof A=="function"&&(t=A,A=null),t===void 0)return new Promise((n,i)=>{this.destroy(A,(s,o)=>s?i(s):n(o))});if(typeof t!="function")throw new Ai("invalid callback");if(this[ti]){this[_t]?this[_t].push(t):queueMicrotask(()=>t(null,null));return}A||(A=new uE),this[ti]=!0,this[_t]=this[_t]||[],this[_t].push(t);let r=()=>{let n=this[_t];this[_t]=null;for(let i=0;i<n.length;i++)n[i](null,null)};this[nM](A).then(()=>{queueMicrotask(r)})}[Ec](A,t){if(!this[Hr]||this[Hr].length===0)return this[Ec]=this[EE],this[EE](A,t);let r=this[EE].bind(this);for(let n=this[Hr].length-1;n>=0;n--)r=this[Hr][n](r);return this[Ec]=r,r(A,t)}dispatch(A,t){if(!t||typeof t!="object")throw new Ai("handler must be an object");try{if(!A||typeof A!="object")throw new Ai("opts must be an object.");if(this[ti]||this[_t])throw new uE;if(this[Ts])throw new rM;return this[Ec](A,t)}catch(r){if(typeof t.onError!="function")throw new Ai("invalid onError method");return t.onError(r),!1}}};Gp.exports=hE});var vs=Q((fj,Vp)=>{"use strict";var sM=require("net"),Yp=require("assert"),Jp=W(),{InvalidArgumentError:oM,ConnectTimeoutError:aM}=le(),dE,QE;global.FinalizationRegistry&&!process.env.NODE_V8_COVERAGE?QE=class{constructor(A){this._maxCachedSessions=A,this._sessionCache=new Map,this._sessionRegistry=new global.FinalizationRegistry(t=>{if(this._sessi
|
||
|
|
`,this[im]=a??3e5,this[nm]=n??3e5,this[qs]=p??!0,this[GM]=m,this[Os]=H,this[yr]=null,this[om]=q>-1?q:-1,this[Dt]="h1",this[SA]=null,this[pc]=ee?{openStreams:0,maxConcurrentStreams:J??100}:null,this[am]=`${this[Ke].hostname}${this[Ke].port?`:${this[Ke].port}`:""}`,this[Ie]=[],this[Be]=0,this[kA]=0}get pipelining(){return this[Rr]}set pipelining(A){this[Rr]=A,NA(this,!0)}get[jr](){return this[Ie].length-this[kA]}get[be](){return this[kA]-this[Be]}get[_r](){return this[Ie].length-this[Be]}get[PM](){return!!this[Ne]&&!this[ii]&&!this[Ne].destroyed}get[wE](){let A=this[Ne];return A&&(A[oA]||A[Zt]||A[oi])||this[_r]>=(this[Rr]||1)||this[jr]>0}[vM](A){um(this),this.once("connect",A)}[VM](A,t){let r=A.origin||this[Ke].origin,n=this[Dt]==="h2"?yE[OM](r,A,t):yE[WM](r,A,t);return this[Ie].push(n),this[Wr]||(k.bodyLength(n.body)==null&&k.isIterable(n.body)?(this[Wr]=1,process.nextTick(NA,this)):NA(this,!0)),this[Wr]&&this[wr]!==2&&this[wE]&&(this[wr]=2),this[wr]<2}async[YM](){return new Promise(A=>{this[_r]?this[yr]=A:A(null)})}async[JM](A){return new Promise(t=>{let r=this[Ie].splice(this[kA]);for(let i=0;i<r.length;i++){let s=r[i];aA(this,s,A)}let n=()=>{this[yr]&&(this[yr](),this[yr]=null),t()};this[SA]!=null&&(k.destroy(this[SA],A),this[SA]=null,this[pc]=null),this[Ne]?k.destroy(this[Ne].on("close",n),A):queueMicrotask(n),NA(this)})}};function ev(e){D(e.code!=="ERR_TLS_CERT_ALTNAME_INVALID"),this[Ne][Ze]=e,Rc(this[Rt],e)}function Av(e,A,t){let r=new wt(`HTTP/2: "frameError" received - type ${e}, code ${A}`);t===0&&(this[Ne][Ze]=r,Rc(this[Rt],r))}function tv(){k.destroy(this,new si("other side closed")),k.destroy(this[Ne],new si("other side closed"))}function rv(e){let A=this[Rt],t=new wt(`HTTP/2: "GOAWAY" frame received with code ${e}`);if(A[Ne]=null,A[SA]=null,A.destroyed){D(this[jr]===0);let r=A[Ie].splice(A[Be]);for(let n=0;n<r.length;n++){let i=r[n];aA(this,i,t)}}else if(A[be]>0){let r=A[Ie][A[Be]];A[Ie][A[Be]++]=null,aA(A,r,t)}A[kA]=A[Be],D(A[be]===0),A.emit("disconnect",A[Ke],[A],t),NA(A)}var pt=Op(),nv=Qc(),iv=Buffer.alloc(0);async function sv(){let e=process.env.JEST_WORKER_ID?BE():void 0,A;try{A=await WebAssembly.compile(Buffer.from(Xp(),"base64"))}catch{A=await WebAssembly.compile(Buffer.from(e||BE(),"base64"))}return await WebAssembly.instantiate(A,{env:{wasm_on_url:(t,r,n)=>0,wasm_on_status:(t,r,n)=>{D.strictEqual(Ge.ptr,t);let i=r-yt+mt.byteOffset;return Ge.onStatus(new Cc(mt.buffer,i,n))||0},wasm_on_message_begin:t=>(D.strictEqual(Ge.ptr,t),Ge.onMessageBegin()||0),wasm_on_header_field:(t,r,n)=>{D.strictEqual(Ge.ptr,t);let i=r-yt+mt.byteOffset;return Ge.onHeaderField(new Cc(mt.buffer,i,n))||0},wasm_on_header_value:(t,r,n)=>{D.strictEqual(Ge.ptr,t);let i=r-yt+mt.byteOffset;return Ge.onHeaderValue(new Cc(mt.buffer,i,n))||0},wasm_on_headers_complete:(t,r,n,i)=>(D.strictEqual(Ge.ptr,t),Ge.onHeadersComplete(r,!!n,!!i)||0),wasm_on_body:(t,r,n)=>{D.strictEqual(Ge.ptr,t);let i=r-yt+mt.byteOffset;return Ge.onBody(new Cc(mt.buffer,i,n))||0},wasm_on_message_complete:t=>(D.strictEqual(Ge.ptr,t),Ge.onMessageComplete()||0)}})}var mE=null,bE=sv();bE.catch();var Ge=null,mt=null,fc=0,yt=null,ai=1,Bc=2,kE=3,SE=class{constructor(A,t,{exports:r}){D(Number.isFinite(A[Ic])&&A[Ic]>0),this.llhttp=r,this.ptr=this.llhttp.llhttp_alloc(pt.TYPE.RESPONSE),this.client=A,this.socket=t,this.timeout=null,this.timeoutValue=null,this.timeoutType=null,this.statusCode=null,this.statusText="",this.upgrade=!1,this.headers=[],this.headersSize=0,this.headersMaxSize=A[Ic],this.shouldKeepAlive=!1,this.paused=!1,this.resume=this.resume.bind(this),this.bytesRead=0,this.keepAlive="",this.contentLength="",this.connection="",this.maxResponseSize=A[om]}setTimeout(A,t){this.timeoutType=t,A!==this.timeoutValue?(pE.clearTimeout(this.timeout),A?(this.timeout=pE.setTimeout(ov,A,this),this.timeout.unref&&this.timeout.unref()):this.timeout=null,this.timeoutValue=A):this.timeout&&this.timeout.refresh&&this.timeout.refresh()}resume(){this.socket.destroyed||!this.paused||(D(this.ptr!=null),D(Ge==null),this.llhttp.llhttp_resume(this.ptr),D(this.timeoutType===Bc),this.timeout&
|
||
|
|
`;return typeof i=="string"?h+=`host: ${i}\r
|
||
|
|
`:h+=e[Am],s?h+=`connection: upgrade\r
|
||
|
|
upgrade: ${s}\r
|
||
|
|
`:e[Rr]&&!E[oA]?h+=`connection: keep-alive\r
|
||
|
|
`:h+=`connection: close\r
|
||
|
|
`,o&&(h+=o),AA.sendHeaders.hasSubscribers&&AA.sendHeaders.publish({request:A,headers:h,socket:E}),!t||l===0?(u===0?E.write(`${h}content-length: 0\r
|
||
|
|
\r
|
||
|
|
`,"latin1"):(D(u===null,"no body must not have content length"),E.write(`${h}\r
|
||
|
|
`,"latin1")),A.onRequestSent()):k.isBuffer(t)?(D(u===t.byteLength,"buffer body must have content length"),E.cork(),E.write(`${h}content-length: ${u}\r
|
||
|
|
\r
|
||
|
|
`,"latin1"),E.write(t),E.uncork(),A.onBodySent(t),A.onRequestSent(),g||(E[oA]=!0)):k.isBlobLike(t)?typeof t.stream=="function"?yc({body:t.stream(),client:e,request:A,socket:E,contentLength:u,header:h,expectsPayload:g}):dm({body:t,client:e,request:A,socket:E,contentLength:u,header:h,expectsPayload:g}):k.isStream(t)?hm({body:t,client:e,request:A,socket:E,contentLength:u,header:h,expectsPayload:g}):k.isIterable(t)?yc({body:t,client:e,request:A,socket:E,contentLength:u,header:h,expectsPayload:g}):D(!1),!0}function gv(e,A,t){let{body:r,method:n,path:i,host:s,upgrade:o,expectContinue:a,signal:c,headers:g}=t,l;if(typeof g=="string"?l=yE[HM](g.trim()):l=g,o)return aA(e,t,new Error("Upgrade not supported for H2")),!1;try{t.onConnect(p=>{t.aborted||t.completed||aA(e,t,p||new FE)})}catch(p){aA(e,t,p)}if(t.aborted)return!1;let u,E=e[pc];if(l[_M]=s||e[am],l[jM]=n,n==="CONNECT")return A.ref(),u=A.request(l,{endStream:!1,signal:c}),u.id&&!u.pending?(t.onUpgrade(null,null,u),++E.openStreams):u.once("ready",()=>{t.onUpgrade(null,null,u),++E.openStreams}),u.once("close",()=>{E.openStreams-=1,E.openStreams===0&&A.unref()}),!0;l[KM]=i,l[ZM]="https";let h=n==="PUT"||n==="POST"||n==="PATCH";r&&typeof r.read=="function"&&r.read(0);let d=k.bodyLength(r);if(d==null&&(d=t.contentLength),(d===0||!h)&&(d=null),Em(n)&&d>0&&t.contentLength!=null&&t.contentLength!==d){if(e[qs])return aA(e,t,new Kt),!1;process.emitWarning(new Kt)}d!=null&&(D(r,"no body must not have content length"),l[XM]=`${d}`),A.ref();let C=n==="GET"||n==="HEAD";return a?(l[zM]="100-continue",u=A.request(l,{endStream:C,signal:c}),u.once("continue",I)):(u=A.request(l,{endStream:C,signal:c}),I()),++E.openStreams,u.once("response",p=>{let{[$M]:w,...m}=p;t.onHeaders(Number(w),m,u.resume.bind(u),"")===!1&&u.pause()}),u.once("end",()=>{t.onComplete([])}),u.on("data",p=>{t.onData(p)===!1&&u.pause()}),u.once("close",()=>{E.openStreams-=1,E.openStreams===0&&A.unref()}),u.once("error",function(p){e[SA]&&!e[SA].destroyed&&!this.closed&&!this.destroyed&&(E.streams-=1,k.destroy(u,p))}),u.once("frameError",(p,w)=>{let m=new wt(`HTTP/2: "frameError" received - type ${p}, code ${w}`);aA(e,t,m),e[SA]&&!e[SA].destroyed&&!this.closed&&!this.destroyed&&(E.streams-=1,k.destroy(u,m))}),!0;function I(){r?k.isBuffer(r)?(D(d===r.byteLength,"buffer body must have content length"),u.cork(),u.write(r),u.uncork(),u.end(),t.onBodySent(r),t.onRequestSent()):k.isBlobLike(r)?typeof r.stream=="function"?yc({client:e,request:t,contentLength:d,h2stream:u,expectsPayload:h,body:r.stream(),socket:e[Ne],header:""}):dm({body:r,client:e,request:t,contentLength:d,expectsPayload:h,h2stream:u,header:"",socket:e[Ne]}):k.isStream(r)?hm({body:r,client:e,request:t,contentLength:d,expectsPayload:h,socket:e[Ne],h2stream:u,header:""}):k.isIterable(r)?yc({body:r,client:e,request:t,contentLength:d,expectsPayload:h,header:"",h2stream:u,socket:e[Ne]}):D(!1):t.onRequestSent()}}function hm({h2stream:e,body:A,client:t,request:r,socket:n,contentLength:i,header:s,expectsPayload:o}){if(D(i!==0||t[be]===0,"stream body cannot be pipelined"),t[Dt]==="h2"){let d=function(C){r.onBodySent(C)},h=bM(A,e,C=>{C?(k.destroy(A,C),k.destroy(e,C)):r.onRequestSent()});h.on("data",d),h.once("end",()=>{h.removeListener("data",d),k.destroy(h)});return}let a=!1,c=new wc({socket:n,request:r,contentLength:i,client:t,expectsPayload:o,header:s}),g=function(h){if(!a)try{!c.write(h)&&this.pause&&this.pause()}catch(d){k.destroy(this,d)}},l=function(){a||A.resume&&A.resume()},u=function(){if(a)return;let h=new FE;queueMicrotask(()=>E(h))},E=function(h){if(!a){if(a=!0,D(n.destroyed||n[Zt]&&t[be]<=1),n.off("drain",l).off("error",E),A.removeListener("data",g).removeListener("end",E).removeListener("error",E).removeListener("close",u),!h)try{c.end()}catch(d){h=d}c.destroy(h),h&&(h.code!=="UND_ERR_INFO"||h.message!=="reset")?k.destroy(A,h):k.destroy(A)}};A.on("data",g).on("end",E).on("error",E).on("close",u),A.resume&&A.resume(),n.on("drain",l).on("error",E)}async function dm({h2stream:e,body:A,client:t,request:r,socket:n,contentLength:i,header:s,expectsPayload:o}){D(i===A.s
|
||
|
|
\r
|
||
|
|
`,"latin1"),n.write(c),n.uncork()),r.onBodySent(c),r.onRequestSent(),o||(n[oA]=!0),NA(t)}catch(c){k.destroy(a?e:n,c)}}async function yc({h2stream:e,body:A,client:t,request:r,socket:n,contentLength:i,header:s,expectsPayload:o}){D(i!==0||t[be]===0,"iterator body cannot be pipelined");let a=null;function c(){if(a){let u=a;a=null,u()}}let g=()=>new Promise((u,E)=>{D(a===null),n[Ze]?E(n[Ze]):a=u});if(t[Dt]==="h2"){e.on("close",c).on("drain",c);try{for await(let u of A){if(n[Ze])throw n[Ze];let E=e.write(u);r.onBodySent(u),E||await g()}}catch(u){e.destroy(u)}finally{r.onRequestSent(),e.end(),e.off("close",c).off("drain",c)}return}n.on("close",c).on("drain",c);let l=new wc({socket:n,request:r,contentLength:i,client:t,expectsPayload:o,header:s});try{for await(let u of A){if(n[Ze])throw n[Ze];l.write(u)||await g()}l.end()}catch(u){l.destroy(u)}finally{n.off("close",c).off("drain",c)}}var wc=class{constructor({socket:A,request:t,contentLength:r,client:n,expectsPayload:i,header:s}){this.socket=A,this.request=t,this.contentLength=r,this.client=n,this.bytesWritten=0,this.expectsPayload=i,this.header=s,A[Zt]=!0}write(A){let{socket:t,request:r,contentLength:n,client:i,bytesWritten:s,expectsPayload:o,header:a}=this;if(t[Ze])throw t[Ze];if(t.destroyed)return!1;let c=Buffer.byteLength(A);if(!c)return!0;if(n!==null&&s+c>n){if(i[qs])throw new Kt;process.emitWarning(new Kt)}t.cork(),s===0&&(o||(t[oA]=!0),n===null?t.write(`${a}transfer-encoding: chunked\r
|
||
|
|
`,"latin1"):t.write(`${a}content-length: ${n}\r
|
||
|
|
\r
|
||
|
|
`,"latin1")),n===null&&t.write(`\r
|
||
|
|
${c.toString(16)}\r
|
||
|
|
`,"latin1"),this.bytesWritten+=c;let g=t.write(A);return t.uncork(),r.onBodySent(A),g||t[Se].timeout&&t[Se].timeoutType===ai&&t[Se].timeout.refresh&&t[Se].timeout.refresh(),g}end(){let{socket:A,contentLength:t,client:r,bytesWritten:n,expectsPayload:i,header:s,request:o}=this;if(o.onRequestSent(),A[Zt]=!1,A[Ze])throw A[Ze];if(!A.destroyed){if(n===0?i?A.write(`${s}content-length: 0\r
|
||
|
|
\r
|
||
|
|
`,"latin1"):A.write(`${s}\r
|
||
|
|
`,"latin1"):t===null&&A.write(`\r
|
||
|
|
0\r
|
||
|
|
\r
|
||
|
|
`,"latin1"),t!==null&&n!==t){if(r[qs])throw new Kt;process.emitWarning(new Kt)}A[Se].timeout&&A[Se].timeoutType===ai&&A[Se].timeout.refresh&&A[Se].timeout.refresh(),NA(r)}}destroy(A){let{socket:t,client:r}=this;t[Zt]=!1,A&&(D(r[be]<=1,"pipeline should only contain this request"),k.destroy(t,A))}};function aA(e,A,t){try{A.onError(t),D(A.aborted)}catch(r){e.emit("error",r)}}Qm.exports=DE});var fm=Q((bj,Cm)=>{"use strict";var Dc=class{constructor(){this.bottom=0,this.top=0,this.list=new Array(2048),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(A){this.list[this.top]=A,this.top=this.top+1&2047}shift(){let A=this.list[this.bottom];return A===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&2047,A)}};Cm.exports=class{constructor(){this.head=this.tail=new Dc}isEmpty(){return this.head.isEmpty()}push(A){this.head.isFull()&&(this.head=this.head.next=new Dc),this.head.push(A)}shift(){let A=this.tail,t=A.shift();return A.isEmpty()&&A.next!==null&&(this.tail=A.next),t}}});var Bm=Q((kj,Im)=>{"use strict";var{kFree:lv,kConnected:uv,kPending:Ev,kQueued:hv,kRunning:dv,kSize:Qv}=de(),Kr=Symbol("pool"),xE=class{constructor(A){this[Kr]=A}get connected(){return this[Kr][uv]}get free(){return this[Kr][lv]}get pending(){return this[Kr][Ev]}get queued(){return this[Kr][hv]}get running(){return this[Kr][dv]}get size(){return this[Kr][Qv]}};Im.exports=xE});var PE=Q((Sj,Nm)=>{"use strict";var Cv=Ms(),fv=fm(),{kConnected:LE,kSize:pm,kRunning:mm,kPending:ym,kQueued:Ws,kBusy:Iv,kFree:Bv,kUrl:pv,kClose:mv,kDestroy:yv,kDispatch:wv}=de(),Rv=Bm(),fA=Symbol("clients"),cA=Symbol("needDrain"),_s=Symbol("queue"),UE=Symbol("closed resolve"),TE=Symbol("onDrain"),wm=Symbol("onConnect"),Rm=Symbol("onDisconnect"),Dm=Symbol("onConnectionError"),ME=Symbol("get dispatcher"),km=Symbol("add client"),Sm=Symbol("remove client"),bm=Symbol("stats"),vE=class extends Cv{constructor(){super(),this[_s]=new fv,this[fA]=[],this[Ws]=0;let A=this;this[TE]=function(r,n){let i=A[_s],s=!1;for(;!s;){let o=i.shift();if(!o)break;A[Ws]--,s=!this.dispatch(o.opts,o.handler)}this[cA]=s,!this[cA]&&A[cA]&&(A[cA]=!1,A.emit("drain",r,[A,...n])),A[UE]&&i.isEmpty()&&Promise.all(A[fA].map(o=>o.close())).then(A[UE])},this[wm]=(t,r)=>{A.emit("connect",t,[A,...r])},this[Rm]=(t,r,n)=>{A.emit("disconnect",t,[A,...r],n)},this[Dm]=(t,r,n)=>{A.emit("connectionError",t,[A,...r],n)},this[bm]=new Rv(this)}get[Iv](){return this[cA]}get[LE](){return this[fA].filter(A=>A[LE]).length}get[Bv](){return this[fA].filter(A=>A[LE]&&!A[cA]).length}get[ym](){let A=this[Ws];for(let{[ym]:t}of this[fA])A+=t;return A}get[mm](){let A=0;for(let{[mm]:t}of this[fA])A+=t;return A}get[pm](){let A=this[Ws];for(let{[pm]:t}of this[fA])A+=t;return A}get stats(){return this[bm]}async[mv](){return this[_s].isEmpty()?Promise.all(this[fA].map(A=>A.close())):new Promise(A=>{this[UE]=A})}async[yv](A){for(;;){let t=this[_s].shift();if(!t)break;t.handler.onError(A)}return Promise.all(this[fA].map(t=>t.destroy(A)))}[wv](A,t){let r=this[ME]();return r?r.dispatch(A,t)||(r[cA]=!0,this[cA]=!this[ME]()):(this[cA]=!0,this[_s].push({opts:A,handler:t}),this[Ws]++),!this[cA]}[km](A){return A.on("drain",this[TE]).on("connect",this[wm]).on("disconnect",this[Rm]).on("connectionError",this[Dm]),this[fA].push(A),this[cA]&&process.nextTick(()=>{this[cA]&&this[TE](A[pv],[this,A])}),this}[Sm](A){A.close(()=>{let t=this[fA].indexOf(A);t!==-1&&this[fA].splice(t,1)}),this[cA]=this[fA].some(t=>!t[cA]&&t.closed!==!0&&t.destroyed!==!0)}};Nm.exports={PoolBase:vE,kClients:fA,kNeedDrain:cA,kAddClient:km,kRemoveClient:Sm,kGetDispatcher:ME}});var ci=Q((Nj,Um)=>{"use strict";var{PoolBase:Dv,kClients:Fm,kNeedDrain:bv,kAddClient:kv,kGetDispatcher:Sv}=PE(),Nv=Hs(),{InvalidArgumentError:GE}=le(),YE=W(),{kUrl:xm,kInterceptors:Fv}=de(),xv=vs(),JE=Symbol("options"),VE=Symbol("connections"),Lm=Symbol("factory");function Lv(e,A){return new Nv(e,A)}var qE=class extends Dv{constructor(A,{connections:t,factory:r=Lv,connect:n,connectTimeout:i,tls:s,maxCachedSessions:o,socketPath:a,autoSelectFamily:c,a
|
||
|
|
${r.count} ${r.noun} ${r.is} pending:
|
||
|
|
|
||
|
|
${A.format(t)}
|
||
|
|
`.trim())}};uw.exports=bh});var Iw=Q((A8,fw)=>{"use strict";var{kProxy:U2,kClose:T2,kDestroy:M2,kInterceptors:v2}=de(),{URL:hw}=require("url"),dw=Ks(),P2=ci(),G2=Ms(),{InvalidArgumentError:eo,RequestAbortedError:Y2}=le(),Qw=vs(),zs=Symbol("proxy agent"),_c=Symbol("proxy client"),$s=Symbol("proxy headers"),kh=Symbol("request tls settings"),J2=Symbol("proxy tls settings"),Cw=Symbol("connect endpoint function");function V2(e){return e==="https:"?443:80}function q2(e){if(typeof e=="string"&&(e={uri:e}),!e||!e.uri)throw new eo("Proxy opts.uri is mandatory");return{uri:e.uri,protocol:e.protocol||"https"}}function O2(e,A){return new P2(e,A)}var Sh=class extends G2{constructor(A){if(super(A),this[U2]=q2(A),this[zs]=new dw(A),this[v2]=A.interceptors&&A.interceptors.ProxyAgent&&Array.isArray(A.interceptors.ProxyAgent)?A.interceptors.ProxyAgent:[],typeof A=="string"&&(A={uri:A}),!A||!A.uri)throw new eo("Proxy opts.uri is mandatory");let{clientFactory:t=O2}=A;if(typeof t!="function")throw new eo("Proxy opts.clientFactory must be a function.");this[kh]=A.requestTls,this[J2]=A.proxyTls,this[$s]=A.headers||{};let r=new hw(A.uri),{origin:n,port:i,host:s,username:o,password:a}=r;if(A.auth&&A.token)throw new eo("opts.auth cannot be used in combination with opts.token");A.auth?this[$s]["proxy-authorization"]=`Basic ${A.auth}`:A.token?this[$s]["proxy-authorization"]=A.token:o&&a&&(this[$s]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(o)}:${decodeURIComponent(a)}`).toString("base64")}`);let c=Qw({...A.proxyTls});this[Cw]=Qw({...A.requestTls}),this[_c]=t(r,{connect:c}),this[zs]=new dw({...A,connect:async(g,l)=>{let u=g.host;g.port||(u+=`:${V2(g.protocol)}`);try{let{socket:E,statusCode:h}=await this[_c].connect({origin:n,port:i,path:u,signal:g.signal,headers:{...this[$s],host:s}});if(h!==200&&(E.on("error",()=>{}).destroy(),l(new Y2(`Proxy response (${h}) !== 200 when HTTP Tunneling`))),g.protocol!=="https:"){l(null,E);return}let d;this[kh]?d=this[kh].servername:d=g.servername,this[Cw]({...g,servername:d,httpSocket:E},l)}catch(E){l(E)}}})}dispatch(A,t){let{host:r}=new hw(A.origin),n=H2(A.headers);return W2(n),this[zs].dispatch({...A,headers:{...n,host:r}},t)}async[T2](){await this[zs].close(),await this[_c].close()}async[M2](){await this[zs].destroy(),await this[_c].destroy()}};function H2(e){if(Array.isArray(e)){let A={};for(let t=0;t<e.length;t+=2)A[e[t]]=e[t+1];return A}return e}function W2(e){if(e&&Object.keys(e).find(t=>t.toLowerCase()==="proxy-authorization"))throw new eo("Proxy-Authorization should be sent in ProxyAgent constructor")}fw.exports=Sh});var ww=Q((t8,yw)=>{"use strict";var An=require("assert"),{kRetryHandlerDefaultRetry:Bw}=de(),{RequestRetryError:jc}=le(),{isDisturbed:pw,parseHeaders:_2,parseRangeHeader:mw}=W();function j2(e){let A=Date.now();return new Date(e).getTime()-A}var Nh=class e{constructor(A,t){let{retryOptions:r,...n}=A,{retry:i,maxRetries:s,maxTimeout:o,minTimeout:a,timeoutFactor:c,methods:g,errorCodes:l,retryAfter:u,statusCodes:E}=r??{};this.dispatch=t.dispatch,this.handler=t.handler,this.opts=n,this.abort=null,this.aborted=!1,this.retryOpts={retry:i??e[Bw],retryAfter:u??!0,maxTimeout:o??30*1e3,timeout:a??500,timeoutFactor:c??2,maxRetries:s??5,methods:g??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:E??[500,502,503,504,429],errorCodes:l??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE"]},this.retryCount=0,this.start=0,this.end=null,this.etag=null,this.resume=null,this.handler.onConnect(h=>{this.aborted=!0,this.abort?this.abort(h):this.reason=h})}onRequestSent(){this.handler.onRequestSent&&this.handler.onRequestSent()}onUpgrade(A,t,r){this.handler.onUpgrade&&this.handler.onUpgrade(A,t,r)}onConnect(A){this.aborted?A(this.reason):this.abort=A}onBodySent(A){if(this.handler.onBodySent)return this.handler.onBodySent(A)}static[Bw](A,{state:t,opts:r},n){let{statusCode:i,code:s,headers:o}=A,{method:a,retryOptions:c}=r,{maxRetries:g,timeout:l,maxTimeout:u,timeoutFactor:E,statusCodes:h,errorCodes:d,methods:C}=c,{counter:I,currentTimeou
|
||
|
|
`);return A.length<e?A:A.slice(-e)}function Yd(){_i.length=0}var ie=Xg;var zg=["darwin","darwin-arm64","debian-openssl-1.0.x","debian-openssl-1.1.x","debian-openssl-3.0.x","rhel-openssl-1.0.x","rhel-openssl-1.1.x","rhel-openssl-3.0.x","linux-arm64-openssl-1.1.x","linux-arm64-openssl-1.0.x","linux-arm64-openssl-3.0.x","linux-arm-openssl-1.1.x","linux-arm-openssl-1.0.x","linux-arm-openssl-3.0.x","linux-musl","linux-musl-openssl-3.0.x","linux-musl-arm64-openssl-1.1.x","linux-musl-arm64-openssl-3.0.x","linux-nixos","linux-static-x64","linux-static-arm64","windows","freebsd11","freebsd12","freebsd13","freebsd14","freebsd15","openbsd","netbsd","arm"];var Po="libquery_engine";function Go(e,A){let t=A==="url";return e.includes("windows")?t?"query_engine.dll.node":`query_engine-${e}.dll.node`:e.includes("darwin")?t?`${Po}.dylib.node`:`${Po}-${e}.dylib.node`:t?`${Po}.so.node`:`${Po}-${e}.so.node`}var Od=Z(require("child_process")),rl=Z(require("fs/promises")),Ho=Z(require("os"));var vt=Symbol.for("@ts-pattern/matcher"),ib=Symbol.for("@ts-pattern/isVariadic"),Jo="@ts-pattern/anonymous-select-key",$g=e=>!!(e&&typeof e=="object"),Yo=e=>e&&!!e[vt],gt=(e,A,t)=>{if(Yo(e)){let r=e[vt](),{matched:n,selections:i}=r.match(A);return n&&i&&Object.keys(i).forEach(s=>t(s,i[s])),n}if($g(e)){if(!$g(A))return!1;if(Array.isArray(e)){if(!Array.isArray(A))return!1;let r=[],n=[],i=[];for(let s of e.keys()){let o=e[s];Yo(o)&&o[ib]?i.push(o):i.length?n.push(o):r.push(o)}if(i.length){if(i.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(A.length<r.length+n.length)return!1;let s=A.slice(0,r.length),o=n.length===0?[]:A.slice(-n.length),a=A.slice(r.length,n.length===0?1/0:-n.length);return r.every((c,g)=>gt(c,s[g],t))&&n.every((c,g)=>gt(c,o[g],t))&&(i.length===0||gt(i[0],a,t))}return e.length===A.length&&e.every((s,o)=>gt(s,A[o],t))}return Reflect.ownKeys(e).every(r=>{let n=e[r];return(r in A||Yo(i=n)&&i[vt]().matcherType==="optional")&>(n,A[r],t);var i})}return Object.is(A,e)},cr=e=>{var A,t,r;return $g(e)?Yo(e)?(A=(t=(r=e[vt]()).getSelectionKeys)==null?void 0:t.call(r))!=null?A:[]:Array.isArray(e)?Ki(e,cr):Ki(Object.values(e),cr):[]},Ki=(e,A)=>e.reduce((t,r)=>t.concat(A(r)),[]);function GA(e){return Object.assign(e,{optional:()=>sb(e),and:A=>ye(e,A),or:A=>ob(e,A),select:A=>A===void 0?Jd(e):Jd(A,e)})}function sb(e){return GA({[vt]:()=>({match:A=>{let t={},r=(n,i)=>{t[n]=i};return A===void 0?(cr(e).forEach(n=>r(n,void 0)),{matched:!0,selections:t}):{matched:gt(e,A,r),selections:t}},getSelectionKeys:()=>cr(e),matcherType:"optional"})})}function ye(...e){return GA({[vt]:()=>({match:A=>{let t={},r=(n,i)=>{t[n]=i};return{matched:e.every(n=>gt(n,A,r)),selections:t}},getSelectionKeys:()=>Ki(e,cr),matcherType:"and"})})}function ob(...e){return GA({[vt]:()=>({match:A=>{let t={},r=(n,i)=>{t[n]=i};return Ki(e,cr).forEach(n=>r(n,void 0)),{matched:e.some(n=>gt(n,A,r)),selections:t}},getSelectionKeys:()=>Ki(e,cr),matcherType:"or"})})}function X(e){return{[vt]:()=>({match:A=>({matched:!!e(A)})})}}function Jd(...e){let A=typeof e[0]=="string"?e[0]:void 0,t=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return GA({[vt]:()=>({match:r=>{let n={[A??Jo]:r};return{matched:t===void 0||gt(t,r,(i,s)=>{n[i]=s}),selections:n}},getSelectionKeys:()=>[A??Jo].concat(t===void 0?[]:cr(t))})})}function at(e){return typeof e=="number"}function ir(e){return typeof e=="string"}function sr(e){return typeof e=="bigint"}var pV=GA(X(function(e){return!0}));var or=e=>Object.assign(GA(e),{startsWith:A=>{return or(ye(e,(t=A,X(r=>ir(r)&&r.startsWith(t)))));var t},endsWith:A=>{return or(ye(e,(t=A,X(r=>ir(r)&&r.endsWith(t)))));var t},minLength:A=>or(ye(e,(t=>X(r=>ir(r)&&r.length>=t))(A))),length:A=>or(ye(e,(t=>X(r=>ir(r)&&r.length===t))(A))),maxLength:A=>or(ye(e,(t=>X(r=>ir(r)&&r.length<=t))(A))),includes:A=>{return or(ye(e,(t=A,X(r=>ir(r)&&r.includes(t)))));var t},regex:A=>{return or(ye(e,(t=A,X(r=>ir(r)&&!!r.match(t)))));var t}}),mV=or(X(ir)),ct=e=>Object.assign(GA(e),{between:(A,t)=>ct(ye(e,((r,n)=>X(i=>at(i)&&r<=i&&n>=i)
|
||
|
|
${JSON.stringify(o,null,2)}`),o}async function Eb(){let e="/etc/os-release";try{let A=await rl.default.readFile(e,{encoding:"utf-8"});return ub(A)}catch{return{targetDistro:void 0,familyDistro:void 0,originalDistro:void 0}}}function hb(e){let A=/^OpenSSL\s(\d+\.\d+)\.\d+/.exec(e);if(A){let t=`${A[1]}.x`;return _d(t)}}function Vd(e){let A=/libssl\.so\.(\d)(\.\d)?/.exec(e);if(A){let t=`${A[1]}${A[2]??".0"}.x`;return _d(t)}}function _d(e){let A=(()=>{if(jd(e))return e;let t=e.split(".");return t[1]="0",t.join(".")})();if(lb.includes(A))return A}function db(e){return Vo(e).with({familyDistro:"musl"},()=>(nA('Trying platform-specific paths for "alpine"'),["/lib","/usr/lib"])).with({familyDistro:"debian"},({archFromUname:A})=>(nA('Trying platform-specific paths for "debian" (and "ubuntu")'),[`/usr/lib/${A}-linux-gnu`,`/lib/${A}-linux-gnu`])).with({familyDistro:"rhel"},()=>(nA('Trying platform-specific paths for "rhel"'),["/lib64","/usr/lib64"])).otherwise(({familyDistro:A,arch:t,archFromUname:r})=>(nA(`Don't know any platform-specific paths for "${A}" on ${t} (${r})`),[]))}async function Qb(e){let A='grep -v "libssl.so.0"',t=await qd(e);if(t){nA(`Found libssl.so file using platform-specific paths: ${t}`);let i=Vd(t);if(nA(`The parsed libssl version is: ${i}`),i)return{libssl:i,strategy:"libssl-specific-path"}}nA('Falling back to "ldconfig" and other generic paths');let r=await Wo(`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${A}`);if(r||(r=await qd(["/lib64","/usr/lib64","/lib","/usr/lib"])),r){nA(`Found libssl.so file using "ldconfig" or other generic paths: ${r}`);let i=Vd(r);if(nA(`The parsed libssl version is: ${i}`),i)return{libssl:i,strategy:"ldconfig"}}let n=await Wo("openssl version -v");if(n){nA(`Found openssl binary with version: ${n}`);let i=hb(n);if(nA(`The parsed openssl version is: ${i}`),i)return{libssl:i,strategy:"openssl-binary"}}return nA("Couldn't find any version of libssl or OpenSSL in the system"),{}}async function qd(e){for(let A of e){let t=await Cb(A);if(t)return t}}async function Cb(e){try{return(await rl.default.readdir(e)).find(t=>t.startsWith("libssl.so.")&&!t.startsWith("libssl.so.0"))}catch(A){if(A.code==="ENOENT")return;throw A}}async function Tr(){let{binaryTarget:e}=await Ib();return e}function fb(e){return e.binaryTarget!==void 0}var Oo={};async function Ib(){if(fb(Oo))return Promise.resolve({...Oo,memoized:!0});let e=await Wd(),A=Bb(e);return Oo={...e,binaryTarget:A},{...Oo,memoized:!1}}function Bb(e){let{platform:A,arch:t,archFromUname:r,libssl:n,targetDistro:i,familyDistro:s,originalDistro:o}=e;A==="linux"&&!["x64","arm64"].includes(t)&&qo(`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${t}" instead). If you are using your own custom Prisma engines, you can ignore this warning, as long as you've compiled the engines for your system architecture "${r}".`);let a="1.1.x";if(A==="linux"&&n===void 0){let g=Vo({familyDistro:s}).with({familyDistro:"debian"},()=>"Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.").otherwise(()=>"Please manually install OpenSSL and try installing Prisma again.");qo(`Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-${a}".
|
||
|
|
${g}`)}let c="debian";if(A==="linux"&&i===void 0&&nA(`Distro is "${o}". Falling back to Prisma engines built for "${c}".`),A==="darwin"&&t==="arm64")return"darwin-arm64";if(A==="darwin")return"darwin";if(A==="win32")return"windows";if(A==="freebsd")return i;if(A==="openbsd")return"openbsd";if(A==="netbsd")return"netbsd";if(A==="linux"&&i==="nixos")return"linux-nixos";if(A==="linux"&&t==="arm64")return`${i==="musl"?"linux-musl-arm64":"linux-arm64"}-openssl-${n||a}`;if(A==="linux"&&t==="arm")return`linux-arm-openssl-${n||a}`;if(A==="linux"&&i==="musl"){let g="linux-musl";return!n||jd(n)?g:`${g}-openssl-${n}`}return A==="linux"&&i&&n?`${i}-openssl-${n}`:(A!=="linux"&&qo(`Prisma detected unknown OS "${A}" and may not work as expected. Defaulting to "linux".`),n?`${c}-openssl-${n}`:i?`${i}-openssl-${a}`:`${c}-openssl-${a}`)}async function pb(e){try{return await e()}catch{return}}function Wo(e){return pb(async()=>{let A=await gb(e);return nA(`Command "${e}" successfully returned "${A.stdout}"`),A.stdout})}async function mb(){return typeof Ho.default.machine=="function"?Ho.default.machine():(await Wo("uname -m"))?.trim()}function jd(e){return e.startsWith("1.")}var mS=Z(Rl());var he=Z(require("path")),yS=Z(Rl()),vq=ie("prisma:engines");function PC(){return he.default.join(__dirname,"../")}var Pq="libquery-engine";he.default.join(__dirname,"../query-engine-darwin");he.default.join(__dirname,"../query-engine-darwin-arm64");he.default.join(__dirname,"../query-engine-debian-openssl-1.0.x");he.default.join(__dirname,"../query-engine-debian-openssl-1.1.x");he.default.join(__dirname,"../query-engine-debian-openssl-3.0.x");he.default.join(__dirname,"../query-engine-linux-static-x64");he.default.join(__dirname,"../query-engine-linux-static-arm64");he.default.join(__dirname,"../query-engine-rhel-openssl-1.0.x");he.default.join(__dirname,"../query-engine-rhel-openssl-1.1.x");he.default.join(__dirname,"../query-engine-rhel-openssl-3.0.x");he.default.join(__dirname,"../libquery_engine-darwin.dylib.node");he.default.join(__dirname,"../libquery_engine-darwin-arm64.dylib.node");he.default.join(__dirname,"../libquery_engine-debian-openssl-1.0.x.so.node");he.default.join(__dirname,"../libquery_engine-debian-openssl-1.1.x.so.node");he.default.join(__dirname,"../libquery_engine-debian-openssl-3.0.x.so.node");he.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.0.x.so.node");he.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.1.x.so.node");he.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-3.0.x.so.node");he.default.join(__dirname,"../libquery_engine-linux-musl.so.node");he.default.join(__dirname,"../libquery_engine-linux-musl-openssl-3.0.x.so.node");he.default.join(__dirname,"../libquery_engine-rhel-openssl-1.0.x.so.node");he.default.join(__dirname,"../libquery_engine-rhel-openssl-1.1.x.so.node");he.default.join(__dirname,"../libquery_engine-rhel-openssl-3.0.x.so.node");he.default.join(__dirname,"../query_engine-windows.dll.node");var Dl=Z(require("fs")),GC=ie("chmodPlusX");function bl(e){if(process.platform==="win32")return;let A=Dl.default.statSync(e),t=A.mode|64|8|1;if(A.mode===t){GC(`Execution permissions of ${e} are fine`);return}let r=t.toString(8).slice(-3);GC(`Have to call chmodPlusX on ${e}`),Dl.default.chmodSync(e,r)}var xl=Z(OC()),ga=Z(require("fs"));var Rn=Z(require("path"));function HC(e){let A=e.ignoreProcessEnv?{}:process.env,t=r=>r.match(/(.?\${(?:[a-zA-Z0-9_]+)?})/g)?.reduce(function(i,s){let o=/(.?)\${([a-zA-Z0-9_]+)?}/g.exec(s);if(!o)return i;let a=o[1],c,g;if(a==="\\")g=o[0],c=g.replace("\\$","$");else{let l=o[2];g=o[0].substring(a.length),c=Object.hasOwnProperty.call(A,l)?A[l]:e.parsed[l]||"",c=t(c)}return i.replace(g,c)},r)??r;for(let r in e.parsed){let n=Object.hasOwnProperty.call(A,r)?A[r]:e.parsed[r];e.parsed[r]=t(n)}for(let r in e.parsed)A[r]=e.parsed[r];return e}var Fl=ie("prisma:tryLoadEnv");function As({rootEnvPath:e,schemaEnvPath:A},t={conflictCheck:"none"}){let r=WC(e);t.conflictCheck!=="none"&&GS(r,A,t.conflictCheck);let n=null;return _C(r?.path,A)||(n=WC(A)),!r&&!n&&Fl
|
||
|
|
`),parsed:{...r?.dotenvResult?.parsed,...n?.dotenvResult?.parsed}}}function GS(e,A,t){let r=e?.dotenvResult.parsed,n=!_C(e?.path,A);if(r&&A&&n&&ga.default.existsSync(A)){let i=xl.default.parse(ga.default.readFileSync(A)),s=[];for(let o in i)r[o]===i[o]&&s.push(o);if(s.length>0){let o=Rn.default.relative(process.cwd(),e.path),a=Rn.default.relative(process.cwd(),A);if(t==="error"){let c=`There is a conflict between env var${s.length>1?"s":""} in ${hA(o)} and ${hA(a)}
|
||
|
|
Conflicting env vars:
|
||
|
|
${s.map(g=>` ${He(g)}`).join(`
|
||
|
|
`)}
|
||
|
|
|
||
|
|
We suggest to move the contents of ${hA(a)} to ${hA(o)} to consolidate your env vars.
|
||
|
|
`;throw new Error(c)}else if(t==="warn"){let c=`Conflict for env var${s.length>1?"s":""} ${s.map(g=>He(g)).join(", ")} in ${hA(o)} and ${hA(a)}
|
||
|
|
Env vars from ${hA(a)} overwrite the ones from ${hA(o)}
|
||
|
|
`;console.warn(`${Tt("warn(prisma)")} ${c}`)}}}}function WC(e){if(YS(e)){Fl(`Environment variables loaded from ${e}`);let A=xl.default.config({path:e,debug:process.env.DOTENV_CONFIG_DEBUG?!0:void 0});return{dotenvResult:HC(A),message:Lr(`Environment variables loaded from ${Rn.default.relative(process.cwd(),e)}`),path:e}}else Fl(`Environment variables not found at ${e}`);return null}function _C(e,A){return e&&A&&Rn.default.resolve(e)===Rn.default.resolve(A)}function YS(e){return!!(e&&ga.default.existsSync(e))}var jC="library";function ts(e){let A=JS();return A||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":jC)}function JS(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":void 0}var rs;(A=>{let e;(m=>(m.findUnique="findUnique",m.findUniqueOrThrow="findUniqueOrThrow",m.findFirst="findFirst",m.findFirstOrThrow="findFirstOrThrow",m.findMany="findMany",m.create="create",m.createMany="createMany",m.createManyAndReturn="createManyAndReturn",m.update="update",m.updateMany="updateMany",m.upsert="upsert",m.delete="delete",m.deleteMany="deleteMany",m.groupBy="groupBy",m.count="count",m.aggregate="aggregate",m.findRaw="findRaw",m.aggregateRaw="aggregateRaw"))(e=A.ModelAction||={})})(rs||={});var ns=Z(require("path"));function Ll(e){return ns.default.sep===ns.default.posix.sep?e:e.split(ns.default.sep).join(ns.default.posix.sep)}var ef=Z(Ul());function Ml(e){return String(new Tl(e))}var Tl=class{constructor(A){this.config=A}toString(){let{config:A}=this,t=A.provider.fromEnvVar?`env("${A.provider.fromEnvVar}")`:A.provider.value,r=JSON.parse(JSON.stringify({provider:t,binaryTargets:qS(A.binaryTargets)}));return`generator ${A.name} {
|
||
|
|
${(0,ef.default)(OS(r),2)}
|
||
|
|
}`}};function qS(e){let A;if(e.length>0){let t=e.find(r=>r.fromEnvVar!==null);t?A=`env("${t.fromEnvVar}")`:A=e.map(r=>r.native?"native":r.value)}else A=void 0;return A}function OS(e){let A=Object.keys(e).reduce((t,r)=>Math.max(t,r.length),0);return Object.entries(e).map(([t,r])=>`${t.padEnd(A)} = ${HS(r)}`).join(`
|
||
|
|
`)}function HS(e){return JSON.parse(JSON.stringify(e,(A,t)=>Array.isArray(t)?`[${t.map(r=>JSON.stringify(r)).join(", ")}]`:JSON.stringify(t)))}var ss={};Hi(ss,{error:()=>jS,info:()=>_S,log:()=>WS,query:()=>KS,should:()=>Af,tags:()=>is,warn:()=>vl});var is={error:PA("prisma:error"),warn:Tt("prisma:warn"),info:Mt("prisma:info"),query:Ur("prisma:query")},Af={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function WS(...e){console.log(...e)}function vl(e,...A){Af.warn()&&console.warn(`${is.warn} ${e}`,...A)}function _S(e,...A){console.info(`${is.info} ${e}`,...A)}function jS(e,...A){console.error(`${is.error} ${e}`,...A)}function KS(e,...A){console.log(`${is.query} ${e}`,...A)}function Gt(e,A){throw new Error(A)}var la=Z(require("stream")),sf=Z(require("util"));function os(e,A){return XS(e,A)}function XS(e,A){return e?zS(e,A):new Gr(A)}function zS(e,A){if(!e)throw new Error("expected readStream");if(!e.readable)throw new Error("readStream must be readable");let t=new Gr(A);return e.pipe(t),t}function Gr(e){la.default.Transform.call(this,e),e=e||{},this._readableState.objectMode=!0,this._lineBuffer=[],this._keepEmptyLines=e.keepEmptyLines||!1,this._lastChunkEndedWithCR=!1,this.on("pipe",function(A){this.encoding||A instanceof la.default.Readable&&(this.encoding=A._readableState.encoding)})}sf.default.inherits(Gr,la.default.Transform);Gr.prototype._transform=function(e,A,t){A=A||"utf8",Buffer.isBuffer(e)&&(A=="buffer"?(e=e.toString(),A="utf8"):e=e.toString(A)),this._chunkEncoding=A;let r=e.split(/\r\n|\r|\n/g);this._lastChunkEndedWithCR&&e[0]==`
|
||
|
|
`&&r.shift(),this._lineBuffer.length>0&&(this._lineBuffer[this._lineBuffer.length-1]+=r[0],r.shift()),this._lastChunkEndedWithCR=e[e.length-1]=="\r",this._lineBuffer=this._lineBuffer.concat(r),this._pushBuffer(A,1,t)};Gr.prototype._pushBuffer=function(e,A,t){for(;this._lineBuffer.length>A;){let r=this._lineBuffer.shift();if((this._keepEmptyLines||r.length>0)&&!this.push(this._reencode(r,e))){let n=this;setImmediate(function(){n._pushBuffer(e,A,t)});return}}t()};Gr.prototype._flush=function(e){this._pushBuffer(this._chunkEncoding,0,e)};Gr.prototype._reencode=function(e,A){return this.encoding&&this.encoding!=A?Buffer.from(e,A).toString(this.encoding):this.encoding?e:Buffer.from(e,A)};function Gl(e,A){return Object.prototype.hasOwnProperty.call(e,A)}var Yl=(e,A)=>e.reduce((t,r)=>(t[A(r)]=r,t),{});function Dn(e,A){let t={};for(let r of Object.keys(e))t[r]=A(e[r],r);return t}function Jl(e,A){if(e.length===0)return;let t=e[0];for(let r=1;r<e.length;r++)A(t,e[r])<0&&(t=e[r]);return t}function U(e,A){Object.defineProperty(e,"name",{value:A,configurable:!0})}var af=new Set,as=(e,A,...t)=>{af.has(e)||(af.add(e),vl(A,...t))};var z=class e extends Error{constructor(A,t,r){super(A),this.name="PrismaClientInitializationError",this.clientVersion=t,this.errorCode=r,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};U(z,"PrismaClientInitializationError");var We=class extends Error{constructor(A,{code:t,clientVersion:r,meta:n,batchRequestIdx:i}){super(A),this.name="PrismaClientKnownRequestError",this.code=t,this.clientVersion=r,this.meta=n,Object.defineProperty(this,"batchRequestIdx",{value:i,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};U(We,"PrismaClientKnownRequestError");var JA=class extends Error{constructor(A,t){super(A),this.name="PrismaClientRustPanicError",this.clientVersion=t}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};U(JA,"PrismaClientRustPanicError");var ve=class extends Error{constructor(A,{clientVersion:t,batchRequestIdx:r}){super(A),this.name="PrismaClientUnknownRequestError",this.clientVersion=t,Object.defineProperty(this,"batchRequestIdx",{value:r,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};U(ve,"PrismaClientUnknownRequestError");var ze=class extends Error{constructor(t,{clientVersion:r}){super(t);this.name="PrismaClientValidationError";this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};U(ze,"PrismaClientValidationError");var bn=9e15,Er=1e9,Vl="0123456789abcdef",da="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Qa="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744
|
||
|
|
`);return new e(A,Df(r).split(`
|
||
|
|
`))}highlight(){let A=wf(this.toString());return new e(this.firstLineNumber,A.split(`
|
||
|
|
`))}toString(){return this.lines.join(`
|
||
|
|
`)}};var zN={red:PA,gray:Wi,dim:Lr,bold:He,underline:hA,highlightSource:e=>e.highlight()},$N={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function eF({message:e,originalMethod:A,isPanic:t,callArguments:r}){return{functionName:`prisma.${A}()`,message:e,isPanic:t??!1,callArguments:r}}function AF({callsite:e,message:A,originalMethod:t,isPanic:r,callArguments:n},i){let s=eF({message:A,originalMethod:t,isPanic:r,callArguments:n});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let o=e.getLocation();if(!o||!o.lineNumber||!o.columnNumber)return s;let a=Math.max(1,o.lineNumber-3),c=ya.read(o.fileName)?.slice(a,o.lineNumber),g=c?.lineAt(o.lineNumber);if(c&&g){let l=rF(g),u=tF(g);if(!u)return s;s.functionName=`${u.code})`,s.location=o,r||(c=c.mapLineAt(o.lineNumber,h=>h.slice(0,u.openingBraceIndex))),c=i.highlightSource(c);let E=String(c.lastLineNumber).length;if(s.contextLines=c.mapLines((h,d)=>i.gray(String(d).padStart(E))+" "+h).mapLines(h=>i.dim(h)).prependSymbolAt(o.lineNumber,i.bold(i.red("\u2192"))),n){let h=l+E+1;h+=2,s.callArguments=(0,kf.default)(n,h).slice(h)}}return s}function tF(e){let A=Object.keys(rs.ModelAction).join("|"),r=new RegExp(String.raw`\.(${A})\(`).exec(e);if(r){let n=r.index+r[0].length,i=e.lastIndexOf(" ",r.index)+1;return{code:e.slice(i,n),openingBraceIndex:n}}return null}function rF(e){let A=0;for(let t=0;t<e.length;t++){if(e.charAt(t)!==" ")return A;A++}return A}function nF({functionName:e,location:A,message:t,isPanic:r,contextLines:n,callArguments:i},s){let o=[""],a=A?" in":":";if(r?(o.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),o.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${a}`))):o.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${a}`)),A&&o.push(s.underline(iF(A))),n){o.push("");let c=[n.toString()];i&&(c.push(i),c.push(s.dim(")"))),o.push(c.join("")),i&&o.push("")}else o.push(""),i&&o.push(i),o.push("");return o.push(t),o.join(`
|
||
|
|
`)}function iF(e){let A=[e.fileName];return e.lineNumber&&A.push(String(e.lineNumber)),e.columnNumber&&A.push(String(e.columnNumber)),A.join(":")}function wa(e){let A=e.showColors?zN:$N,t;return t=AF(e,A),nF(t,A)}var Tf=Z(jl());function xf(e,A,t){let r=Lf(e),n=sF(r),i=aF(n);i?Ra(i,A,t):A.addErrorMessage(()=>"Unknown error")}function Lf(e){return e.errors.flatMap(A=>A.kind==="Union"?Lf(A):[A])}function sF(e){let A=new Map,t=[];for(let r of e){if(r.kind!=="InvalidArgumentType"){t.push(r);continue}let n=`${r.selectionPath.join(".")}:${r.argumentPath.join(".")}`,i=A.get(n);i?A.set(n,{...r,argument:{...r.argument,typeNames:oF(i.argument.typeNames,r.argument.typeNames)}}):A.set(n,r)}return t.push(...A.values()),t}function oF(e,A){return[...new Set(e.concat(A))]}function aF(e){return Jl(e,(A,t)=>{let r=Nf(A),n=Nf(t);return r!==n?r-n:Ff(A)-Ff(t)})}function Nf(e){let A=0;return Array.isArray(e.selectionPath)&&(A+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(A+=e.argumentPath.length),A}function Ff(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var DA=class{constructor(A,t){this.name=A;this.value=t;this.isRequired=!1}makeRequired(){return this.isRequired=!0,this}write(A){let{colors:{green:t}}=A.context;A.addMarginSymbol(t(this.isRequired?"+":"?")),A.write(t(this.name)),this.isRequired||A.write(t("?")),A.write(t(": ")),typeof this.value=="string"?A.write(t(this.value)):A.write(this.value)}};var Ln=class{constructor(A=0,t){this.context=t;this.lines=[];this.currentLine="";this.currentIndent=0;this.currentIndent=A}write(A){return typeof A=="string"?this.currentLine+=A:A.write(this),this}writeJoined(A,t,r=(n,i)=>i.write(n)){let n=t.length-1;for(let i=0;i<t.length;i++)r(t[i],this),i!==n&&this.write(A);return this}writeLine(A){return this.write(A).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let A=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,A?.(),this}withIndent(A){return this.indent(),A(this),this.unindent(),this}afterNextNewline(A){return this.afterNextNewLineCallback=A,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(A){return this.marginSymbol=A,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
|
||
|
|
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let A=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+A.slice(1):A}};var Da=class{constructor(A){this.value=A}write(A){A.write(this.value)}markAsError(){this.value.markAsError()}};var ba=e=>e,ka={bold:ba,red:ba,green:ba,dim:ba,enabled:!1},Uf={bold:He,red:PA,green:nr,dim:Lr,enabled:!0},Un={write(e){e.writeLine(",")}};var ht=class{constructor(A){this.contents=A;this.isUnderlined=!1;this.color=A=>A}underline(){return this.isUnderlined=!0,this}setColor(A){return this.color=A,this}write(A){let t=A.getCurrentLineLength();A.write(this.color(this.contents)),this.isUnderlined&&A.afterNextNewline(()=>{A.write(" ".repeat(t)).writeLine(this.color("~".repeat(this.contents.length)))})}};var hr=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var Tn=class extends hr{constructor(){super(...arguments);this.items=[]}addItem(t){return this.items.push(new Da(t)),this}getField(t){return this.items[t]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(r=>r.value.getPrintWidth()))+2}write(t){if(this.items.length===0){this.writeEmpty(t);return}this.writeWithItems(t)}writeEmpty(t){let r=new ht("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(Un,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Mn=class e extends hr{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(t){this.fields[t.name]=t}addSuggestion(t){this.suggestions.push(t)}getField(t){return this.fields[t]}getDeepField(t){let[r,...n]=t,i=this.getField(r);if(!i)return;let s=i;for(let o of n){let a;if(s.value instanceof e?a=s.value.getField(o):s.value instanceof Tn&&(a=s.value.getField(Number(o))),!a)return;s=a}return s}getDeepFieldValue(t){return t.length===0?this:this.getDeepField(t)?.value}hasField(t){return!!this.getField(t)}removeAllFields(){this.fields={}}removeField(t){delete this.fields[t]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(t){return this.getField(t)?.value}getDeepSubSelectionValue(t){let r=this;for(let n of t){if(!(r instanceof e))return;let i=r.getSubSelectionValue(n);if(!i)return;r=i}return r}getDeepSelectionParent(t){let r=this.getSelectionParent();if(!r)return;let n=r;for(let i of t){let s=n.value.getFieldValue(i);if(!s||!(s instanceof e))return;let o=s.getSelectionParent();if(!o)return;n=o}return n}getSelectionParent(){let t=this.getField("select")?.value.asObject();if(t)return{kind:"select",value:t};let r=this.getField("include")?.value.asObject();if(r)return{kind:"include",value:r}}getSubSelectionValue(t){return this.getSelectionParent()?.value.fields[t].value}getPrintWidth(){let t=Object.values(this.fields);return t.length==0?2:Math.max(...t.map(n=>n.getPrintWidth()))+2}write(t){let r=Object.values(this.fields);if(r.length===0&&this.suggestions.length===0){this.writeEmpty(t);return}this.writeWithContents(t,r)}asObject(){return this}writeEmpty(t){let r=new ht("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(Un,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};var qe=class extends hr{constructor(t){super();this.text=t}getPrintWidth(){return this.text.length}write(t){let r=new ht(this.text);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r)}asObject(){}};var gs=class{constructor(){this.fields=[]}addField(A,t){return this.fields.push({write(r){let{green:n,dim:i}=r.context.colors;r.write(n(i(`${A}: ${t}`))).addMarginSymbol(n(i("+")))}}),this}write(A){let{colors:{green:t}}=A.context;A.writeLine(t("{")).withIndent(()=>{A.writeJoined(Un,this.fields).newLine(
|
||
|
|
Note that ${s.bold("include")} statements only accept relation fields.`,o})}function uF(e,A,t){let r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(r){let n=r.getField("omit")?.value.asObject();if(n){EF(e,A,n);return}if(r.hasField("select")){hF(e,A);return}}if(t?.[Nn(e.outputType.name)]){dF(e,A);return}A.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function EF(e,A,t){t.removeAllFields();for(let r of e.outputType.fields)t.addSuggestion(new DA(r.name,"false"));A.addErrorMessage(r=>`The ${r.red("omit")} statement includes every field of the model ${r.bold(e.outputType.name)}. At least one field must be included in the result`)}function hF(e,A){let t=e.outputType,r=A.arguments.getDeepSelectionParent(e.selectionPath)?.value,n=r?.isEmpty()??!1;r&&(r.removeAllFields(),Pf(r,t)),A.addErrorMessage(i=>n?`The ${i.red("`select`")} statement for type ${i.bold(t.name)} must not be empty. ${us(i)}`:`The ${i.red("`select`")} statement for type ${i.bold(t.name)} needs ${i.bold("at least one truthy value")}.`)}function dF(e,A){let t=new gs;for(let n of e.outputType.fields)n.isRelation||t.addField(n.name,"false");let r=new DA("omit",t).makeRequired();if(e.selectionPath.length===0)A.arguments.addSuggestion(r);else{let[n,i]=ls(e.selectionPath),o=A.arguments.getDeepSelectionParent(n)?.value.asObject()?.getField(i);if(o){let a=o?.value.asObject()??new Mn;a.addSuggestion(r),o.value=a}}A.addErrorMessage(n=>`The global ${n.red("omit")} configuration excludes every field of the model ${n.bold(e.outputType.name)}. At least one field must be included in the result`)}function QF(e,A){let t=Gf(e.selectionPath,A);if(t.parentKind!=="unknown"){t.field.markAsError();let r=t.parent;switch(t.parentKind){case"select":Pf(r,e.outputType);break;case"include":DF(r,e.outputType);break;case"omit":bF(r,e.outputType);break}}A.addErrorMessage(r=>{let n=[`Unknown field ${r.red(`\`${t.fieldName}\``)}`];return t.parentKind!=="unknown"&&n.push(`for ${r.bold(t.parentKind)} statement`),n.push(`on model ${r.bold(`\`${e.outputType.name}\``)}.`),n.push(us(r)),n.join(" ")})}function CF(e,A){let t=Gf(e.selectionPath,A);t.parentKind!=="unknown"&&t.field.value.markAsError(),A.addErrorMessage(r=>`Invalid value for selection field \`${r.red(t.fieldName)}\`: ${e.underlyingError}`)}function fF(e,A){let t=e.argumentPath[0],r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&(r.getField(t)?.markAsError(),kF(r,e.arguments)),A.addErrorMessage(n=>Mf(n,t,e.arguments.map(i=>i.name)))}function IF(e,A){let[t,r]=ls(e.argumentPath),n=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){n.getDeepField(e.argumentPath)?.markAsError();let i=n.getDeepFieldValue(t)?.asObject();i&&Yf(i,e.inputType)}A.addErrorMessage(i=>Mf(i,r,e.inputType.fields.map(s=>s.name)))}function Mf(e,A,t){let r=[`Unknown argument \`${e.red(A)}\`.`],n=NF(A,t);return n&&r.push(`Did you mean \`${e.green(n)}\`?`),t.length>0&&r.push(us(e)),r.join(" ")}function BF(e,A){let t;A.addErrorMessage(a=>t?.value instanceof qe&&t.value.text==="null"?`Argument \`${a.green(i)}\` must not be ${a.red("null")}.`:`Argument \`${a.green(i)}\` is missing.`);let r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!r)return;let[n,i]=ls(e.argumentPath),s=new gs,o=r.getDeepFieldValue(n)?.asObject();if(o)if(t=o.getField(i),t&&o.removeField(i),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let a of e.inputTypes[0].fields)s.addField(a.name,a.typeNames.join(" | "));o.addSuggestion(new DA(i,s).makeRequired())}else{let a=e.inputTypes.map(vf).join(" | ");o.addSuggestion(new DA(i,a).makeRequired())}}function vf(e){return e.kind==="list"?`${vf(e.elementType)}[]`:e.name}function pF(e,A){let t=e.argument.name,r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&r.getDeepFieldValue(e.argumentPath)?.markAsError(),A.addErrorMessage(n=>{let i=Sa("or",e.argument.typeNames.map(s=>n.green(s)));return`Argument \`${n.bold(t)}\`: Invalid value provided. Expected ${i}, provided ${n.red(e.inferredType)}.`})}function mF(e,A){let t=e
|
||
|
|
`)}};function Pn(e){return new Xl(qf(e))}function qf(e){let A=new Mn;for(let[t,r]of Object.entries(e)){let n=new xa(t,Of(r));A.addField(n)}return A}function Of(e){if(typeof e=="string")return new qe(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new qe(String(e));if(typeof e=="bigint")return new qe(`${e}n`);if(e===null)return new qe("null");if(e===void 0)return new qe("undefined");if(xn(e))return new qe(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new qe(`Buffer.alloc(${e.byteLength})`):new qe(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let A=pa(e)?e.toISOString():"Invalid Date";return new qe(`new Date("${A}")`)}return e instanceof Jt?new qe(`Prisma.${e._getName()}`):vn(e)?new qe(`prisma.${Jf(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?FF(e):typeof e=="object"?qf(e):new qe(Object.prototype.toString.call(e))}function FF(e){let A=new Tn;for(let t of e)A.addItem(Of(t));return A}function La(e,A){let t=A==="pretty"?Uf:ka,r=e.renderAllMessages(t),n=new Ln(0,{colors:t}).write(e).toString();return{message:r,args:n}}function Ua({args:e,errors:A,errorFormat:t,callsite:r,originalMethod:n,clientVersion:i,globalOmit:s}){let o=Pn(e);for(let l of A)Ra(l,o,s);let{message:a,args:c}=La(o,t),g=wa({message:a,callsite:r,originalMethod:n,showColors:t==="pretty",callArguments:c});throw new ze(g,{clientVersion:i})}var dt=class{constructor(){this._map=new Map}get(A){return this._map.get(A)?.value}set(A,t){this._map.set(A,{value:t})}getOrCreate(A,t){let r=this._map.get(A);if(r)return r.value;let n=t();return this.set(A,n),n}};function fs(e){let A;return{get(){return A||(A={value:e()}),A.value}}}function Qt(e){return e.replace(/^./,A=>A.toLowerCase())}function Wf(e,A,t){let r=Qt(t);return!A.result||!(A.result.$allModels||A.result[r])?e:xF({...e,...Hf(A.name,e,A.result.$allModels),...Hf(A.name,e,A.result[r])})}function xF(e){let A=new dt,t=(r,n)=>A.getOrCreate(r,()=>n.has(r)?[r]:(n.add(r),e[r]?e[r].needs.flatMap(i=>t(i,n)):[r]));return Dn(e,r=>({...r,needs:t(r.name,new Set)}))}function Hf(e,A,t){return t?Dn(t,({needs:r,compute:n},i)=>({name:i,needs:r?Object.keys(r).filter(s=>r[s]):[],compute:LF(A,i,n)})):{}}function LF(e,A,t){let r=e?.[A]?.compute;return r?n=>t({...n,[A]:r(n)}):t}function _f(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(e[r.name])for(let n of r.needs)t[n]=!0;return t}function jf(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(!e[r.name])for(let n of r.needs)delete t[n];return t}var Ta=class{constructor(A,t){this.extension=A;this.previous=t;this.computedFieldsCache=new dt;this.modelExtensionsCache=new dt;this.queryCallbacksCache=new dt;this.clientExtensions=fs(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=fs(()=>{let A=this.previous?.getAllBatchQueryCallbacks()??[],t=this.extension.query?.$__internalBatch;return t?A.concat(t):A})}getAllComputedFields(A){return this.computedFieldsCache.getOrCreate(A,()=>Wf(this.previous?.getAllComputedFields(A),this.extension,A))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(A){return this.modelExtensionsCache.getOrCreate(A,()=>{let t=Qt(A);return!this.extension.model||!(this.extension.model[t]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(A):{...this.previous?.getAllModelExtensions(A),...this.extension.model.$allModels,...this.extension.model[t]}})}getAllQueryCallbacks(A,t){return this.queryCallbacksCache.getOrCreate(`${A}:${t}`,()=>{let r=this.previous?.getAllQueryCallbacks(A,t)??[],n=[],i=this.extension.query;return!i||!(i[A]||i.$allModels||i[t]||i.$allOperations)?r:(i[A]!==void 0&&(i[A][t]!==void 0&&n.push(i[A][t]),i[A].$allOperations!==void 0&&n.push(i[A].$allOperations)),A!=="$none"&&i.$allModels!==void 0&&(i.$allModels[t]!==void 0&&n.push(i.$allModels[t]),i.$allModels.$allOperations!==void 0&&n.push(i.$allModels.$allOperations)),i[t]!==void 0&&n.push(i[t]),i.$allOperations!==void 0&&n.push(i.$allOp
|
||
|
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),t}var ys="<unknown>";function aI(e){var A=e.split(`
|
||
|
|
`);return A.reduce(function(t,r){var n=zF(r)||ex(r)||rx(r)||ox(r)||ix(r);return n&&t.push(n),t},[])}var ZF=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,XF=/\((\S*)(?::(\d+))(?::(\d+))\)/;function zF(e){var A=ZF.exec(e);if(!A)return null;var t=A[2]&&A[2].indexOf("native")===0,r=A[2]&&A[2].indexOf("eval")===0,n=XF.exec(A[2]);return r&&n!=null&&(A[2]=n[1],A[3]=n[2],A[4]=n[3]),{file:t?null:A[2],methodName:A[1]||ys,arguments:t?[A[2]]:[],lineNumber:A[3]?+A[3]:null,column:A[4]?+A[4]:null}}var $F=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function ex(e){var A=$F.exec(e);return A?{file:A[2],methodName:A[1]||ys,arguments:[],lineNumber:+A[3],column:A[4]?+A[4]:null}:null}var Ax=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,tx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function rx(e){var A=Ax.exec(e);if(!A)return null;var t=A[3]&&A[3].indexOf(" > eval")>-1,r=tx.exec(A[3]);return t&&r!=null&&(A[3]=r[1],A[4]=r[2],A[5]=null),{file:A[3],methodName:A[1]||ys,arguments:A[2]?A[2].split(","):[],lineNumber:A[4]?+A[4]:null,column:A[5]?+A[5]:null}}var nx=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function ix(e){var A=nx.exec(e);return A?{file:A[3],methodName:A[1]||ys,arguments:[],lineNumber:+A[4],column:A[5]?+A[5]:null}:null}var sx=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function ox(e){var A=sx.exec(e);return A?{file:A[2],methodName:A[1]||ys,arguments:[],lineNumber:+A[3],column:A[4]?+A[4]:null}:null}var au=class{getLocation(){return null}},cu=class{constructor(){this._error=new Error}getLocation(){let A=this._error.stack;if(!A)return null;let r=aI(A).find(n=>{if(!n.file)return!1;let i=Ll(n.file);return i!=="<anonymous>"&&!i.includes("@prisma")&&!i.includes("/packages/client/src/runtime/")&&!i.endsWith("/runtime/binary.js")&&!i.endsWith("/runtime/library.js")&&!i.endsWith("/runtime/edge.js")&&!i.endsWith("/runtime/edge-esm.js")&&!i.startsWith("internal/")&&!n.methodName.includes("new ")&&!n.methodName.includes("getCallSite")&&!n.methodName.includes("Proxy.")&&n.methodName.split(".").length<4});return!r||!r.file?null:{fileName:r.file,lineNumber:r.lineNumber,columnNumber:r.column}}};function Qr(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new au:new cu}var cI={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function qn(e={}){let A=cx(e);return Object.entries(A).reduce((r,[n,i])=>(cI[n]!==void 0?r.select[n]={select:i}:r[n]=i,r),{select:{}})}function cx(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Ja(e={}){return A=>(typeof e._count=="boolean"&&(A._count=A._count._all),A)}function gI(e,A){let t=Ja(e);return A({action:"aggregate",unpacker:t,argsMapper:qn})(e)}function gx(e={}){let{select:A,...t}=e;return typeof A=="object"?qn({...t,_count:A}):qn({...t,_count:{_all:!0}})}function lx(e={}){return typeof e.select=="object"?A=>Ja(e)(A)._count:A=>Ja(e)(A)._count._all}function lI(e,A){return A({action:"count",unpacker:lx(e),argsMapper:gx})(e)}function ux(e={}){let A=qn(e);if(Array.isArray(A.by))for(let t of A.by)typeof t=="string"&&(A.select[t]=!0);else typeof A.by=="string"&&(A.select[A.by]=!0);return A}function Ex(e={}){return A=>(typeof e?._count=="boolean"&&A.forEach(t=>{t._count=t._count._all}),A)}function uI(e,A){return A({action:"groupBy",unpacker:Ex(e),argsMapper:ux})(e)}function EI(e,A,t){if(A==="aggregate")return r=>gI(r,t);if(A==="count")return r=>lI(r,t);if(A==="groupBy")return r=>uI(r,t)}function hI(e,A){let t=A.fields.filter(n=>!n.relationName),r=Yl(t,n=>n.name);return new Proxy({},{get(n,i){if(i in n||typeof i=="symbol")return n[i];let s=r[i];if(s)return new Es(e,i,s.type,s.isList,s.kind==="enum")},...Ya(Object.keys(r))})}var dI=e=>Array.isArray(e)?e:e.split("."),gu=(e,A)=>dI(A).reduce((t,r)=>t&&t[r],e),QI=(e,A,t)=>dI(A).reduceRight((r,n,
|
||
|
|
|
||
|
|
Learn how: https://pris.ly/d/${FI[A]}-build`;throw console.error(r),new z(r,t)}}function LI(e,A){return e?e.datasources?e.datasources:e.datasourceUrl?{[A[0]]:{url:e.datasourceUrl}}:{}:{}}var Dx="Cloudflare-Workers",bx="node";function UI(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Dx?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===bx?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var kx={node:"Node.js",workerd:"Cloudflare Workers",deno:"Deno and Deno Deploy",netlify:"Netlify Edge Functions","edge-light":"Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)"};function TI(){let e=UI();return{id:e,prettyName:kx[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}var vR=require("child_process"),PR=Z(NC()),Tg=Z(require("fs"));var GR=Z(vC());function On(e){return typeof e=="string"?e:e.message}function MI(e){if(e.fields?.message){let A=e.fields?.message;return e.fields?.file&&(A+=` in ${e.fields.file}`,e.fields?.line&&(A+=`:${e.fields.line}`),e.fields?.column&&(A+=`:${e.fields.column}`)),e.fields?.reason&&(A+=`
|
||
|
|
${e.fields?.reason}`),A}return"Unknown error"}function vI(e){return e.fields?.message==="PANIC"}function Sx(e){return e.timestamp&&typeof e.level=="string"&&typeof e.target=="string"}function hu(e){return Sx(e)&&(e.level==="error"||e.fields?.message?.includes("fatal error"))}function PI(e){let t=Nx(e.fields)?"query":e.level.toLowerCase();return{...e,level:t,timestamp:new Date(e.timestamp)}}function Nx(e){return!!e.query}var Ds=class extends Error{constructor({clientVersion:A,error:t}){let r=MI(t);super(r??"Unknown error"),this._isPanic=vI(t),this.clientVersion=A}get[Symbol.toStringTag](){return"PrismaClientRustError"}isPanic(){return this._isPanic}};U(Ds,"PrismaClientRustError");var qI=Z(require("fs")),bs=Z(require("path"));function qa(e){let{runtimeBinaryTarget:A}=e;return`Add "${A}" to \`binaryTargets\` in the "schema.prisma" file and run \`prisma generate\` after saving it:
|
||
|
|
|
||
|
|
${Fx(e)}`}function Fx(e){let{generator:A,generatorBinaryTargets:t,runtimeBinaryTarget:r}=e,n={fromEnvVar:null,value:r},i=[...t,n];return Ml({...A,binaryTargets:i})}function Cr(e){let{runtimeBinaryTarget:A}=e;return`Prisma Client could not locate the Query Engine for runtime "${A}".`}function fr(e){let{searchedLocations:A}=e;return`The following locations have been searched:
|
||
|
|
${[...new Set(A)].map(n=>` ${n}`).join(`
|
||
|
|
`)}`}function GI(e){let{runtimeBinaryTarget:A}=e;return`${Cr(e)}
|
||
|
|
|
||
|
|
This happened because \`binaryTargets\` have been pinned, but the actual deployment also required "${A}".
|
||
|
|
${qa(e)}
|
||
|
|
|
||
|
|
${fr(e)}`}function Oa(e){return`We would appreciate if you could take the time to share some information with us.
|
||
|
|
Please help us by answering a few questions: https://pris.ly/${e}`}function Ha(e){let{errorStack:A}=e;return A?.match(/\/\.next|\/next@|\/next\//)?`
|
||
|
|
|
||
|
|
We detected that you are using Next.js, learn how to fix this: https://pris.ly/d/engine-not-found-nextjs.`:""}function YI(e){let{queryEngineName:A}=e;return`${Cr(e)}${Ha(e)}
|
||
|
|
|
||
|
|
This is likely caused by a bundler that has not copied "${A}" next to the resulting bundle.
|
||
|
|
Ensure that "${A}" has been copied next to the bundle or in "${e.expectedLocation}".
|
||
|
|
|
||
|
|
${Oa("engine-not-found-bundler-investigation")}
|
||
|
|
|
||
|
|
${fr(e)}`}function JI(e){let{runtimeBinaryTarget:A,generatorBinaryTargets:t}=e,r=t.find(n=>n.native);return`${Cr(e)}
|
||
|
|
|
||
|
|
This happened because Prisma Client was generated for "${r?.value??"unknown"}", but the actual deployment required "${A}".
|
||
|
|
${qa(e)}
|
||
|
|
|
||
|
|
${fr(e)}`}function VI(e){let{queryEngineName:A}=e;return`${Cr(e)}${Ha(e)}
|
||
|
|
|
||
|
|
This is likely caused by tooling that has not copied "${A}" to the deployment folder.
|
||
|
|
Ensure that you ran \`prisma generate\` and that "${A}" has been copied to "${e.expectedLocation}".
|
||
|
|
|
||
|
|
${Oa("engine-not-found-tooling-investigation")}
|
||
|
|
|
||
|
|
${fr(e)}`}var xx=ie("prisma:client:engines:resolveEnginePath"),Lx=()=>new RegExp("runtime[\\\\/]binary\\.m?js$");async function du(e,A){let t={binary:process.env.PRISMA_QUERY_ENGINE_BINARY,library:process.env.PRISMA_QUERY_ENGINE_LIBRARY}[e]??A.prismaPath;if(t!==void 0)return t;let{enginePath:r,searchedLocations:n}=await Ux(e,A);if(xx("enginePath",r),r!==void 0&&e==="binary"&&bl(r),r!==void 0)return A.prismaPath=r;let i=await Tr(),s=A.generator?.binaryTargets??[],o=s.some(u=>u.native),a=!s.some(u=>u.value===i),c=__filename.match(Lx())===null,g={searchedLocations:n,generatorBinaryTargets:s,generator:A.generator,runtimeBinaryTarget:i,queryEngineName:OI(e,i),expectedLocation:bs.default.relative(process.cwd(),A.dirname),errorStack:new Error().stack},l;throw o&&a?l=JI(g):a?l=GI(g):c?l=YI(g):l=VI(g),new z(l,A.clientVersion)}async function Ux(engineType,config){let binaryTarget=await Tr(),searchedLocations=[],dirname=eval("__dirname"),searchLocations=[config.dirname,bs.default.resolve(dirname,".."),config.generator?.output?.value??dirname,bs.default.resolve(dirname,"../../../.prisma/client"),"/tmp/prisma-engines",config.cwd];__filename.includes("resolveEnginePath")&&searchLocations.push(PC());for(let e of searchLocations){let A=OI(engineType,binaryTarget),t=bs.default.join(e,A);if(searchedLocations.push(e),qI.default.existsSync(t))return{enginePath:t,searchedLocations}}return{enginePath:void 0,searchedLocations}}function OI(e,A){return e==="library"?Go(A,"fs"):`query-engine-${A}${A==="windows"?".exe":""}`}var Qu=Z(Pl());function HI(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,A=>`${A[0]}5`):""}function WI(e){return e.split(`
|
||
|
|
`).map(A=>A.replace(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)\s*/,"").replace(/\+\d+\s*ms$/,"")).join(`
|
||
|
|
`)}var _I=Z(of());function jI({title:e,user:A="prisma",repo:t="prisma",template:r="bug_report.yml",body:n}){return(0,_I.default)({user:A,repo:t,template:r,title:e,body:n})}function KI({version:e,binaryTarget:A,title:t,description:r,engineVersion:n,database:i,query:s}){let o=Gd(6e3-(s?.length??0)),a=WI((0,Qu.default)(o)),c=r?`# Description
|
||
|
|
\`\`\`
|
||
|
|
${r}
|
||
|
|
\`\`\``:"",g=(0,Qu.default)(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
|
||
|
|
## Versions
|
||
|
|
|
||
|
|
| Name | Version |
|
||
|
|
|-----------------|--------------------|
|
||
|
|
| Node | ${process.version?.padEnd(19)}|
|
||
|
|
| OS | ${A?.padEnd(19)}|
|
||
|
|
| Prisma Client | ${e?.padEnd(19)}|
|
||
|
|
| Query Engine | ${n?.padEnd(19)}|
|
||
|
|
| Database | ${i?.padEnd(19)}|
|
||
|
|
|
||
|
|
${c}
|
||
|
|
|
||
|
|
## Logs
|
||
|
|
\`\`\`
|
||
|
|
${a}
|
||
|
|
\`\`\`
|
||
|
|
|
||
|
|
## Client Snippet
|
||
|
|
\`\`\`ts
|
||
|
|
// PLEASE FILL YOUR CODE SNIPPET HERE
|
||
|
|
\`\`\`
|
||
|
|
|
||
|
|
## Schema
|
||
|
|
\`\`\`prisma
|
||
|
|
// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE
|
||
|
|
\`\`\`
|
||
|
|
|
||
|
|
## Prisma Engine Query
|
||
|
|
\`\`\`
|
||
|
|
${s?HI(s):""}
|
||
|
|
\`\`\`
|
||
|
|
`),l=jI({title:t,body:g});return`${t}
|
||
|
|
|
||
|
|
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
|
||
|
|
|
||
|
|
${hA(l)}
|
||
|
|
|
||
|
|
If you want the Prisma team to look into it, please open the link above \u{1F64F}
|
||
|
|
To increase the chance of success, please post your schema and a snippet of
|
||
|
|
how you used Prisma Client in the issue.
|
||
|
|
`}var xR=Z(Bl()),FJ=()=>FR();function xJ(e){if(e===void 0)throw new Error("Connection has not been opened")}var Lt=class{constructor(){}static async onHttpError(A,t){let r=await A;return r.statusCode>=400?t(r):r}open(A,t){this._pool||(this._pool=new(FJ()).Pool(A,{connections:1e3,keepAliveMaxTimeout:6e5,headersTimeout:0,bodyTimeout:0,...t}))}async raw(A,t,r,n,i=!0){xJ(this._pool);let s=await this._pool.request({path:t,method:A,headers:{"Content-Type":"application/json",...r},body:n}),o=await(0,xR.default)(s.body);return{statusCode:s.statusCode,headers:s.headers,data:i?JSON.parse(o):o}}post(A,t,r,n){return this.raw("POST",A,r,t,n)}get(A,t){return this.raw("GET",A,t)}close(){this._pool&&this._pool.close(()=>{}),this._pool=void 0}};var rA=ie("prisma:engine"),fo=(...e)=>{},LR=[...zg,"native"],Mg=[],UR=process.env.PRISMA_CLIENT_NO_RETRY?1:2,TR=process.env.PRISMA_CLIENT_NO_RETRY?1:2,Bo=class{constructor(A){this.name="BinaryEngine";this.startCount=0;this.previewFeatures=[];this.stderrLogs="";this.handleRequestError=async A=>{rA({error:A}),this.startPromise&&await this.startPromise;let t=["ECONNRESET","ECONNREFUSED","UND_ERR_CLOSED","UND_ERR_SOCKET","UND_ERR_DESTROYED","UND_ERR_ABORTED"].includes(A.code);if(A instanceof We)return{error:A,shouldRetry:!1};try{if(this.throwAsyncErrorIfExists(),this.currentRequestPromise?.isCanceled)this.throwAsyncErrorIfExists();else if(t){if(this.globalKillSignalReceived&&!this.child?.connected)throw new ve(`The Node.js process already received a ${this.globalKillSignalReceived} signal, therefore the Prisma query engine exited
|
||
|
|
and your request can't be processed.
|
||
|
|
You probably have some open handle that prevents your process from exiting.
|
||
|
|
It could be an open http server or stream that didn't close yet.
|
||
|
|
We recommend using the \`wtfnode\` package to debug open handles.`,{clientVersion:this.clientVersion});if(this.throwAsyncErrorIfExists(),this.startCount>UR){for(let r=0;r<5;r++)await new Promise(n=>setTimeout(n,50)),this.throwAsyncErrorIfExists(!0);throw new Error(`Query engine is trying to restart, but can't.
|
||
|
|
Please look into the logs or turn on the env var DEBUG=* to debug the constantly restarting query engine.`)}}throw this.throwAsyncErrorIfExists(!0),A}catch(r){return{error:r,shouldRetry:t}}};this.config=A,this.env=A.env,this.cwd=this.resolveCwd(A.cwd),this.enableDebugLogs=A.enableDebugLogs??!1,this.allowTriggerPanic=A.allowTriggerPanic??!1,this.datamodelPath=A.datamodelPath,this.tracingHelper=A.tracingHelper,this.logEmitter=A.logEmitter,this.showColors=A.showColors??!1,this.logQueries=A.logQueries??!1,this.clientVersion=A.clientVersion,this.flags=A.flags??[],this.previewFeatures=A.previewFeatures??[],this.activeProvider=A.activeProvider,this.connection=new Lt;let t=Object.keys(A.overrideDatasources)[0],r=A.overrideDatasources[t]?.url;if(t!==void 0&&r!==void 0&&(this.datasourceOverrides=[{name:t,url:r}]),LJ(),this.engineEndpoint=A.engineEndpoint,this.binaryTarget){if(!LR.includes(this.binaryTarget)&&!Tg.default.existsSync(this.binaryTarget))throw new z(`Unknown ${PA("PRISMA_QUERY_ENGINE_BINARY")} ${PA(He(this.binaryTarget))}. Possible binaryTargets: ${nr(LR.join(", "))} or a path to the query engine binary.
|
||
|
|
You may have to run ${nr("prisma generate")} for your changes to take effect.`,this.clientVersion)}else this.getCurrentBinaryTarget();this.enableDebugLogs&&ie.enable("*"),Mg.push(this)}setError(A){hu(A)&&(this.lastError=new Ds({clientVersion:this.clientVersion,error:A}),this.lastError.isPanic()&&(this.child&&(this.stopPromise=UJ(this.child)),this.currentRequestPromise?.cancel&&this.currentRequestPromise.cancel()))}resolveCwd(A){return Tg.default.existsSync(A)&&Tg.default.lstatSync(A).isDirectory()?A:process.cwd()}onBeforeExit(A){this.beforeExitListener=A}async emitExit(){if(this.beforeExitListener)try{await this.beforeExitListener()}catch(A){console.error(A)}}async getCurrentBinaryTarget(){return this.binaryTargetPromise?this.binaryTargetPromise:(this.binaryTargetPromise=this.tracingHelper.runInChildSpan("detect_platform",()=>Tr()),this.binaryTargetPromise)}printDatasources(){return this.datasourceOverrides?JSON.stringify(this.datasourceOverrides):"[]"}async start(){this.stopPromise&&await this.stopPromise;let A={times:10},t=async()=>{try{await this.tracingHelper.runInChildSpan("start_engine",()=>this.startAndFetchBootSpans())}catch(n){throw n.retryable===!0&&A.times>0&&(A.times--,await t()),n}},r=async()=>{if(this.startPromise||(this.startCount++,this.startPromise=t()),await this.startPromise,!this.child&&!this.engineEndpoint)throw new ve("Can't perform request, as the Engine has already been stopped",{clientVersion:this.clientVersion})};return this.startPromise?r():this.tracingHelper.runInChildSpan("connect",r)}getEngineEnvVars(){let A={PRISMA_DML_PATH:this.datamodelPath};return this.logQueries&&(A.LOG_QUERIES="true"),this.datasourceOverrides&&(A.OVERWRITE_DATASOURCES=this.printDatasources()),!process.env.NO_COLOR&&this.showColors&&(A.CLICOLOR_FORCE="1"),{...this.env,...process.env,...A,RUST_BACKTRACE:process.env.RUST_BACKTRACE??"1",RUST_LOG:process.env.RUST_LOG??"info"}}async startAndFetchBootSpans(){await this.internalStart();let A=await Lt.onHttpError(this.connection.get("/boot_trace"),t=>this.httpErrorHandler(t));this.tracingHelper.dispatchEngineSpans(A.data.spans)}internalStart(){return new Promise(async(A,t)=>{if(await new Promise(r=>process.nextTick(r)),this.stopPromise&&await this.stopPromise,this.engineEndpoint){try{this.connection.open(this.engineEndpoint),await(0,GR.default)(()=>this.connection.get("/status"),{retries:10})}catch(r){return t(r)}return A()}try{(this.child?.connected||this.child&&!this.child?.killed)&&rA("There is a child that still runs and we want to start again"),this.lastError=void 0,fo("startin & resettin"),this.globalKillSignalReceived=void 0,rA({cwd:this.cwd});let r=await du("binary",this.config),n=this.allowTriggerPanic?["--debug"]:[],i=["--enable-raw-queries","--enable-metrics","--enable-open-telemetry",...this.flags,...n];i.push("--port","0"),i.push("--engine-protocol","json"),rA({flags:i});let s=this.getEngineEnvVars();if(this.child=(0,vR.spawn)(r,i,{env:s,cwd:this.cwd,windowsHide:!0,stdio:["ignore","pipe","pipe"]}),os(this.child.stderr).on("data",o=>{let a=String(o);rA("stderr",a);try{let c=JSON.parse(a);if(typeof c.is_panic<"u"&&(rA(c),this.setError(c),this.engineStartDeferred)){let g=new z(c.message,this.clientVersion,c.error_code);this.engineStartDeferred.reject(g)}}catch{!a.includes("Printing to stderr")&&!a.includes("Listening on ")&&(this.stderrLogs+=`
|
||
|
|
`+a)}}),os(this.child.stdout).on("data",o=>{let a=String(o);try{let c=JSON.parse(a);if(rA("stdout",On(c)),this.engineStartDeferred&&c.level==="INFO"&&c.target==="query_engine::server"&&c.fields?.message?.startsWith("Started query engine http server")){let g=c.fields.ip,l=c.fields.port;if(g===void 0||l===void 0){this.engineStartDeferred.reject(new z('This version of Query Engine is not compatible with Prisma Client: "ip" and "port" fields are missing in the startup log entry',this.clientVersion));return}this.connection.open(`http://${g}:${l}`),this.engineStartDeferred.resolve(),this.engineStartDeferred=void 0}if(typeof c.is_panic>"u"){let g=PI(c);hu(g)?this.setError(g):g.level==="query"?this.logEmitter.emit(g.level,{timestamp:g.timestamp,query:g.fields.query,params:g.fields.params,duration:g.fields.duration_ms,target:g.target}):this.logEmitter.emit(g.level,{timestamp:g.timestamp,message:g.fields.message,target:g.target})}else this.setError(c)}catch(c){rA(c,a)}}),this.child.on("exit",o=>{if(fo("removing startPromise"),this.startPromise=void 0,this.engineStopDeferred){this.engineStopDeferred.resolve(o);return}if(this.connection.close(),o!==0&&this.engineStartDeferred&&this.startCount===1){let a,c=this.stderrLogs;this.lastError&&(c=On(this.lastError)),o!==null?(a=new z(`Query engine exited with code ${o}
|
||
|
|
`+c,this.clientVersion),a.retryable=!0):this.child?.signalCode?(a=new z(`Query engine process killed with signal ${this.child.signalCode} for unknown reason.
|
||
|
|
Make sure that the engine binary at ${r} is not corrupt.
|
||
|
|
`+c,this.clientVersion),a.retryable=!0):a=new z(c,this.clientVersion),this.engineStartDeferred.reject(a)}this.child&&(this.lastError||o===126&&this.setError({timestamp:new Date,target:"binary engine process exit",level:"error",fields:{message:`Couldn't start query engine as it's not executable on this operating system.
|
||
|
|
You very likely have the wrong "binaryTarget" defined in the schema.prisma file.`}}))}),this.child.on("error",o=>{this.setError({timestamp:new Date,target:"binary engine process error",level:"error",fields:{message:`Couldn't start query engine: ${o}`}}),t(o)}),this.child.on("close",(o,a)=>{this.connection.close();let c;o===null&&a==="SIGABRT"&&this.child?c=new JA(this.getErrorMessageWithLink("Panic in Query Engine with SIGABRT signal"),this.clientVersion):o===255&&a===null&&this.lastError&&(c=this.lastError),c&&this.logEmitter.emit("error",{message:c.message,timestamp:new Date,target:"binary engine process close"})}),this.lastError)return t(new z(On(this.lastError),this.clientVersion));try{await new Promise((o,a)=>{this.engineStartDeferred={resolve:o,reject:a}})}catch(o){throw this.child?.kill(),o}(async()=>{try{let o=await this.version(!0);rA(`Client Version: ${this.clientVersion}`),rA(`Engine Version: ${o}`),rA(`Active provider: ${this.activeProvider}`)}catch(o){rA(o)}})(),this.stopPromise=void 0,A()}catch(r){t(r)}})}async stop(){let A=async()=>(this.stopPromise||(this.stopPromise=this._stop()),this.stopPromise);return this.tracingHelper.runInChildSpan("disconnect",A)}async _stop(){if(this.startPromise&&await this.startPromise,await new Promise(t=>process.nextTick(t)),this.currentRequestPromise)try{await this.currentRequestPromise}catch{}let A;this.child&&(rA("Stopping Prisma engine"),this.startPromise&&(rA("Waiting for start promise"),await this.startPromise),rA("Done waiting for start promise"),this.child.exitCode===null?A=new Promise((t,r)=>{this.engineStopDeferred={resolve:t,reject:r}}):rA("Child already exited with code",this.child.exitCode),this.connection.close(),this.child.kill(),this.child=void 0),A&&await A,await new Promise(t=>process.nextTick(t)),this.startPromise=void 0,this.engineStopDeferred=void 0}kill(A){this.globalKillSignalReceived=A,this.child?.kill(),this.connection.close()}async version(A=!1){return this.versionPromise&&!A?this.versionPromise:(this.versionPromise=this.internalVersion(),this.versionPromise)}async internalVersion(){let A=await du("binary",this.config),t=await(0,PR.default)(A,["--version"]);return this.lastVersion=t.stdout,this.lastVersion}async request(A,{traceparent:t,numTry:r=1,isWrite:n,interactiveTransaction:i}){await this.start();let s={};t&&(s.traceparent=t),i&&(s["X-transaction-id"]=i.id);let o=JSON.stringify(A);this.currentRequestPromise=Lt.onHttpError(this.connection.post("/",o,s),a=>this.httpErrorHandler(a)),this.lastQuery=o;try{let{data:a}=await this.currentRequestPromise;if(a.extensions?.traces&&this.tracingHelper.dispatchEngineSpans(a.extensions.traces),a.errors)throw a.errors.length===1?dr(a.errors[0],this.clientVersion,this.config.activeProvider):new ve(JSON.stringify(a.errors),{clientVersion:this.clientVersion});return this.startCount>0&&(this.startCount=0),this.currentRequestPromise=void 0,{data:a}}catch(a){fo("req - e",a);let{error:c,shouldRetry:g}=await this.handleRequestError(a);if(r<=TR&&g&&!n)return fo("trying a retry now"),this.request(A,{traceparent:t,numTry:r+1,isWrite:n,interactiveTransaction:i});throw c}}async requestBatch(A,{traceparent:t,transaction:r,numTry:n=1,containsWrite:i}){await this.start();let s={};t&&(s.traceparent=t);let o=r?.kind==="itx"?r.options:void 0;o&&(s["X-transaction-id"]=o.id);let a=Vn(A,r);return this.lastQuery=JSON.stringify(a),this.currentRequestPromise=Lt.onHttpError(this.connection.post("/",this.lastQuery,s),c=>this.httpErrorHandler(c)),this.currentRequestPromise.then(({data:c})=>{c.extensions?.traces&&this.tracingHelper.dispatchEngineSpans(c.extensions.traces);let{batchResult:g}=c;if(Array.isArray(g))return g.map(l=>(l.extensions?.traces&&this.tracingHelper.dispatchEngineSpans(l.extensions.traces),l.errors&&l.errors.length>0?dr(l.errors[0],this.clientVersion,this.config.activeProvider):{data:l}));throw dr(c.errors[0],this.clientVersion,this.config.activeProvider)}).catch(async c=>{let{error:g,shouldRetry:l}=await this.handleRequestError(c);if(l&&!i&&n<=TR)return this.requestBatch(A,{traceparent:t,transaction:r,numTry:n+1,conta
|
||
|
|
${t}`,j(r,!0));this.name="RequestError";this.code="P5010"}};U(xo,"RequestError");async function dn(e,A,t=r=>r){let{clientVersion:r,...n}=A,i=t(fetch);try{return await i(e,n)}catch(s){let o=s.message??"Unknown error";throw new xo(o,{clientVersion:r,cause:s})}}var YJ=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,OR=ie("prisma:client:dataproxyEngine");async function JJ(e,A){let t=qR["@prisma/engines-version"],r=A.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&r!=="0.0.0"&&r!=="in-memory")return r;let[n,i]=r?.split("-")??[];if(i===void 0&&YJ.test(n))return n;if(i!==void 0||r==="0.0.0"||r==="in-memory"){if(e.startsWith("localhost")||e.startsWith("127.0.0.1"))return"0.0.0";let[s]=t.split("-")??[],[o,a,c]=s.split("."),g=VJ(`<=${o}.${a}.${c}`),l=await dn(g,{clientVersion:r});if(!l.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${l.status} ${l.statusText}, response body: ${await l.text()||"<empty body>"}`);let u=await l.text();OR("length of body fetched from unpkg.com",u.length);let E;try{E=JSON.parse(u)}catch(h){throw console.error("JSON.parse error: body fetched from unpkg.com: ",u),h}return E.version}throw new En("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:r})}async function HR(e,A){let t=await JJ(e,A);return OR("version",t),t}function VJ(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var WR=3,Pg=ie("prisma:client:dataproxyEngine"),Id=class{constructor({apiKey:A,tracingHelper:t,logLevel:r,logQueries:n,engineHash:i}){this.apiKey=A,this.tracingHelper=t,this.logLevel=r,this.logQueries=n,this.engineHash=i}build({traceparent:A,interactiveTransaction:t}={}){let r={Authorization:`Bearer ${this.apiKey}`,"Prisma-Engine-Hash":this.engineHash};this.tracingHelper.isEnabled()&&(r.traceparent=A??this.tracingHelper.getTraceParent()),t&&(r["X-transaction-id"]=t.id);let n=this.buildCaptureSettings();return n.length>0&&(r["X-capture-telemetry"]=n.join(", ")),r}buildCaptureSettings(){let A=[];return this.tracingHelper.isEnabled()&&A.push("tracing"),this.logLevel&&A.push(this.logLevel),this.logQueries&&A.push("query"),A}},Lo=class{constructor(A){this.name="DataProxyEngine";VR(A),this.config=A,this.env={...A.env,...typeof process<"u"?process.env:{}},this.inlineSchema=JR(A.inlineSchema),this.inlineDatasources=A.inlineDatasources,this.inlineSchemaHash=A.inlineSchemaHash,this.clientVersion=A.clientVersion,this.engineHash=A.engineVersion,this.logEmitter=A.logEmitter,this.tracingHelper=A.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let[A,t]=this.extractHostAndApiKey();this.host=A,this.headerBuilder=new Id({apiKey:t,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel,logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await HR(A,this.config),Pg("host",this.host)})(),await this.startPromise}async stop(){}propagateResponseExtensions(A){A?.logs?.length&&A.logs.forEach(t=>{switch(t.level){case"debug":case"trace":Pg(t);break;case"error":case"warn":case"info":{this.logEmitter.emit(t.level,{timestamp:fd(t.timestamp),message:t.attributes.message??"",target:t.target});break}case"query":{this.logEmitter.emit("query",{query:t.attributes.query??"",timestamp:fd(t.timestamp),duration:t.attributes.duration_ms??0,params:t.attributes.params??"",target:t.target});break}default:t.level}}),A?.traces?.length&&this.tracingHelper.dispatchEngineSpans(A.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(A){return await this.start(),`https://${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${A}`}async uploadSchema(){let A={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(A,async()=>{let t=await dn(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersi
|
||
|
|
`),{clientVersion:A.clientVersion})}if(i)return new Lo(A);if(a)return new Bo(A);throw new ze("Invalid client engine type, please use `library` or `binary`",{clientVersion:A.clientVersion})}function Gg({generator:e}){return e?.previewFeatures??[]}var jR=e=>({command:e});var KR=e=>e.strings.reduce((A,t,r)=>`${A}@P${r}${t}`);function Yi(e){try{return ZR(e,"fast")}catch{return ZR(e,"slow")}}function ZR(e,A){return JSON.stringify(e.map(t=>zR(t,A)))}function zR(e,A){if(Array.isArray(e))return e.map(t=>zR(t,A));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(Fn(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(Et.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(qJ(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(t,r,n).toString("base64")}}return typeof e=="object"&&A==="slow"?$R(e):e}function qJ(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function $R(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(XR);let A={};for(let t of Object.keys(e))A[t]=XR(e[t]);return A}function XR(e){return typeof e=="bigint"?e.toString():$R(e)}var OJ=["$connect","$disconnect","$on","$transaction","$use","$extends"],eD=OJ;var HJ=/^(\s*alter\s)/i,AD=ie("prisma:client");function Bd(e,A,t,r){if(!(e!=="postgresql"&&e!=="cockroachdb")&&t.length>0&&HJ.exec(A))throw new Error(`Running ALTER using ${r} is not supported
|
||
|
|
Using the example below you can still execute your query with Prisma, but please note that it is vulnerable to SQL injection attacks and requires you to take care of input sanitization.
|
||
|
|
|
||
|
|
Example:
|
||
|
|
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
|
||
|
|
|
||
|
|
More Information: https://pris.ly/d/execute-raw
|
||
|
|
`)}var pd=({clientMethod:e,activeProvider:A})=>t=>{let r="",n;if(tI(t))r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};else if(Array.isArray(t)){let[i,...s]=t;r=i,n={values:Yi(s||[]),__prismaRawParameters__:!0}}else switch(A){case"sqlite":case"mysql":{r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{r=t.text,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"sqlserver":{r=KR(t),n={values:Yi(t.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${A} provider does not support ${e}`)}return n?.values?AD(`prisma.${e}(${r}, ${n.values})`):AD(`prisma.${e}(${r})`),{query:r,parameters:n}},tD={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[A,...t]=e;return new QA(A,t)}},rD={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function md(e){return function(t){let r,n=(i=e)=>{try{return i===void 0||i?.kind==="itx"?r??=nD(t(i)):nD(t(i))}catch(s){return Promise.reject(s)}};return{then(i,s){return n().then(i,s)},catch(i){return n().catch(i)},finally(i){return n().finally(i)},requestTransaction(i){let s=n(i);return s.requestTransaction?s.requestTransaction(i):s},[Symbol.toStringTag]:"PrismaPromise"}}}function nD(e){return typeof e.then=="function"?e:Promise.resolve(e)}var WJ={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,A){return A()}},yd=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(A){return this.getGlobalTracingHelper().getTraceParent(A)}dispatchEngineSpans(A){return this.getGlobalTracingHelper().dispatchEngineSpans(A)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(A,t){return this.getGlobalTracingHelper().runInChildSpan(A,t)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??WJ}};function iD(){return new yd}function sD(e,A=()=>{}){let t,r=new Promise(n=>t=n);return{then(n){return--e===0&&t(A()),n?.(r)}}}function oD(e){return typeof e=="string"?e:e.reduce((A,t)=>{let r=typeof t=="string"?t:t.level;return r==="query"?A:A&&(t==="info"||A==="info")?"info":r},void 0)}var Yg=class{constructor(){this._middlewares=[]}use(A){this._middlewares.push(A)}get(A){return this._middlewares[A]}has(A){return!!this._middlewares[A]}length(){return this._middlewares.length}};var gD=Z(Pl());function Jg(e){return typeof e.batchRequestIdx=="number"}function aD(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let A=[];return e.modelName&&A.push(e.modelName),e.query.arguments&&A.push(wd(e.query.arguments)),A.push(wd(e.query.selection)),A.join("")}function wd(e){return`(${Object.keys(e).sort().map(t=>{let r=e[t];return typeof r=="object"&&r!==null?`(${t} ${wd(r)})`:t}).join(" ")})`}var _J={aggregate:!1,aggregateRaw:!1,createMany:!0,createManyAndReturn:!0,createOne:!0,deleteMany:!0,deleteOne:!0,executeRaw:!0,findFirst:!1,findFirstOrThrow:!1,findMany:!1,findRaw:!1,findUnique:!1,findUniqueOrThrow:!1,groupBy:!1,queryRaw:!1,runCommandRaw:!0,updateMany:!0,updateOne:!0,upsertOne:!0};function Rd(e){return _J[e]}var Vg=class{constructor(A){this.options=A;this.tickActive=!1;this.batches={}}request(A){let t=this.options.batchBy(A);return t?(this.batches[t]||(this.batches[t]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((r,n)=>{this.batches[t].push({request:A,resolve:r,reject:n})})):this.options.singleLoader(A)}dispatchBatches(){for(let A in this.batches){let t=this.batches[A];delete this.batches[A],t.length===1?this.options.singleLoader(t[0].request).then(r=>{r instanceof Error?t[0].reject(r):t[0].resolve(r)}).catch(r=>{t[0].reject(r)}):(t.sort((r,n)=>this.options.batchOrder(r.request,n.request)),this.options.batchLoader(t.map(r=>r.request)).then(r=>{if(r instanceof Error)for(let n=0;n<t.length;n++)t[n].reject(r);else for(let n=0;n<t.length;n++){let i=r[n];i instanceof Error?t[n].reject(i):t[n].resolve(i)}}).ca
|
||
|
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};U(oe,"PrismaClientConstructorValidationError");var dD=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],QD=["pretty","colorless","minimal"],CD=["info","query","warn","error"],eV={datasources:(e,{datasourceNames:A})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new oe(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[t,r]of Object.entries(e)){if(!A.includes(t)){let n=Ji(t,A)||` Available datasources: ${A.join(", ")}`;throw new oe(`Unknown datasource ${t} provided to PrismaClient constructor.${n}`)}if(typeof r!="object"||Array.isArray(r))throw new oe(`Invalid value ${JSON.stringify(e)} for datasource "${t}" provided to PrismaClient constructor.
|
||
|
|
It should have this form: { url: "CONNECTION_STRING" }`);if(r&&typeof r=="object")for(let[n,i]of Object.entries(r)){if(n!=="url")throw new oe(`Invalid value ${JSON.stringify(e)} for datasource "${t}" provided to PrismaClient constructor.
|
||
|
|
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof i!="string")throw new oe(`Invalid value ${JSON.stringify(i)} for datasource "${t}" provided to PrismaClient constructor.
|
||
|
|
It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,A)=>{if(e===null)return;if(e===void 0)throw new oe('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!Gg(A).includes("driverAdapters"))throw new oe('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(ts()==="binary")throw new oe('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new oe(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
|
||
|
|
Expected string or undefined.`)},errorFormat:e=>{if(e){if(typeof e!="string")throw new oe(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!QD.includes(e)){let A=Ji(e,QD);throw new oe(`Invalid errorFormat ${e} provided to PrismaClient constructor.${A}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new oe(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function A(t){if(typeof t=="string"&&!CD.includes(t)){let r=Ji(t,CD);throw new oe(`Invalid log level "${t}" provided to PrismaClient constructor.${r}`)}}for(let t of e){A(t);let r={level:A,emit:n=>{let i=["stdout","event"];if(!i.includes(n)){let s=Ji(n,i);throw new oe(`Invalid value ${JSON.stringify(n)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(t&&typeof t=="object")for(let[n,i]of Object.entries(t))if(r[n])r[n](i);else throw new oe(`Invalid property ${n} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let A=e.maxWait;if(A!=null&&A<=0)throw new oe(`Invalid value ${A} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let t=e.timeout;if(t!=null&&t<=0)throw new oe(`Invalid value ${t} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,A)=>{if(typeof e!="object")throw new oe('"omit" option is expected to be an object.');if(e===null)throw new oe('"omit" option can not be `null`');let t=[];for(let[r,n]of Object.entries(e)){let i=tV(r,A.runtimeDataModel);if(!i){t.push({kind:"UnknownModel",modelKey:r});continue}for(let[s,o]of Object.entries(n)){let a=i.fields.find(c=>c.name===s);if(!a){t.push({kind:"UnknownField",modelKey:r,fieldName:s});continue}if(a.relationName){t.push({kind:"RelationInOmit",modelKey:r,fieldName:s});continue}typeof o!="boolean"&&t.push({kind:"InvalidFieldValue",modelKey:r,fieldName:s})}}if(t.length>0)throw new oe(rV(e,t))},__internal:e=>{if(!e)return;let A=["debug","engine","configOverride"];if(typeof e!="object")throw new oe(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[t]of Object.entries(e))if(!A.includes(t)){let r=Ji(t,A);throw new oe(`Invalid property ${JSON.stringify(t)} for "__internal" provided to PrismaClient constructor.${r}`)}}};function BD(e,A){for(let[t,r]of Object.entries(e)){if(!dD.includes(t)){let n=Ji(t,dD);throw new oe(`Unknown property ${t} provided to PrismaClient constructor.${n}`)}eV[t](r,A)}if(e.datasourceUrl&&e.datasources)throw new oe('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function Ji(e,A){if(A.length===0||typeof e!="string")return"";let t=AV(e,A);return t?` Did you mean "${t}"?`:""}function AV(e,A){if(A.length===0)return null;let t=A.map(n=>({value:n,distance:(0,ID.default)(e,n)}));t.sort((n,i)=>n.distance<i.distance?-1:1);let r=t[0];return r.distance<3?r.value:null}function tV(e,A){return fD(A.models,e)??fD(A.types,e)}function fD(e,A){let t=Object.keys(e).find(r=>Nn(r)===A);if(t)return e[t]}function rV(e,A){let t=Pn(e);for(let i of A)switch(i.kind){case"UnknownModel":t.arguments.getField(i.modelKey)?.markAsError(),t.addErrorMessage(()=>`Unknown model name: ${i.modelKey}.`);break;case"UnknownField":t.arguments.getDeepField([i.modelKey,i.fieldName])?.markAsError(),t.addErrorMessage(()=>`Model "${i.modelKey}" does not have a field named "${i.fieldName}".`);break;case"RelationInOmit":t.arguments.getDeepField([i.modelKey,i.fieldName])?.markAsError(),t.addErrorMessage(()=>'Relations are already excluded by default and can not be specified in "omit".');break;case"InvalidFieldValue":t.arguments.getDeepFieldValue([i.modelKey,i.fieldName])?.markAsError(),t.addErrorMessage(()=>"Omit field option value must be a boolean.");break}let{message:r,args:n}=La(t,"colorless");return`Error validating "omit" option:
|
||
|
|
|
||
|
|
${n}
|
||
|
|
|
||
|
|
${r}`}function pD(e){return e.length===0?Promise.resolve([]):new Promise((A,t)=>{let r=new Array(e.length),n=null,i=!1,s=0,o=()=>{i||(s++,s===e.length&&(i=!0,n?t(n):A(r)))},a=c=>{i||(i=!0,t(c))};for(let c=0;c<e.length;c++)e[c].then(g=>{r[c]=g,o()},g=>{if(!Jg(g)){a(g);return}g.batchRequestIdx===c?a(g):(n||(n=g),o())})})}var xr=ie("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var nV={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},iV=Symbol.for("prisma.client.transaction.id"),sV={id:0,nextId(){return++this.id}};function bD(e){class A{constructor(r){this._originalClient=this;this._middlewares=new Yg;this._createPrismaPromise=md();this.$extends=II;e=r?.__internal?.configOverride?.(e)??e,xI(e),r&&BD(r,e);let n=new RD.EventEmitter().on("error",()=>{});this._extensions=Gn.empty(),this._previewFeatures=Gg(e),this._clientVersion=e.clientVersion??hD,this._activeProvider=e.activeProvider,this._globalOmit=r?.omit,this._tracingHelper=iD();let i={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&Uo.default.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&Uo.default.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(r?.adapter){s=iu(r.adapter);let a=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==a)throw new z(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${a}\` specified in the Prisma schema.`,this._clientVersion);if(r.datasources||r.datasourceUrl!==void 0)throw new z("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let o=!s&&As(i,{conflictCheck:"none"})||e.injectableEdgeEnv?.();try{let a=r??{},c=a.__internal??{},g=c.debug===!0;g&&ie.enable("prisma:client");let l=Uo.default.resolve(e.dirname,e.relativePath);DD.default.existsSync(l)||(l=e.dirname),xr("dirname",e.dirname),xr("relativePath",e.relativePath),xr("cwd",l);let u=c.engine||{};if(a.errorFormat?this._errorFormat=a.errorFormat:process.env.NODE_ENV==="production"?this._errorFormat="minimal":process.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:l,dirname:e.dirname,enableDebugLogs:g,allowTriggerPanic:u.allowTriggerPanic,datamodelPath:Uo.default.join(e.dirname,e.filename??"schema.prisma"),prismaPath:u.binaryPath??void 0,engineEndpoint:u.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:a.log&&oD(a.log),logQueries:a.log&&!!(typeof a.log=="string"?a.log==="query":a.log.find(E=>typeof E=="string"?E==="query":E.level==="query")),env:o?.parsed??{},flags:[],engineWasm:e.engineWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:LI(a,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:a.transactionOptions?.maxWait??2e3,timeout:a.transactionOptions?.timeout??5e3,isolationLevel:a.transactionOptions?.isolationLevel},logEmitter:n,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:Mi,getBatchRequestPayload:Vn,prismaGraphQLToJSError:dr,PrismaClientUnknownRequestError:ve,PrismaClientInitializationError:z,PrismaClientKnownRequestError:We,debug:ie("prisma:client:accelerateEngine"),engineVersion:yD.version,clientVersion:e.clientVersion}},xr("clientVersion",e.clientVersion),this._engine=_R(e,this._engineConfig),this._requestHandler=new qg(this,n),a.log)for(let E of a.log){let h=typeof E=="string"?E:E.emit==="stdout"?E.level:null;h&&this.$on(h,d=>{ss.log(`${ss.tags[h]??""}`,d.message||d.query)})}this._metrics=new Yn(this._engine)}catch(a){throw a.clientVersion=this._clientVersion,a}return this._appliedParent=ws(this)}get[Symbol.toStringTag](){return"PrismaC
|
||
|
|
`)),g?.kind==="batch"&&await g.lock,this._requestHandler.request({protocolQuery:d,modelName:a,action:o,clientMethod:n,dataPath:i,callsite:s,args:r,extensions:this._extensions,transaction:g,unpacker:l,otelParentCtx:u,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:E})}catch(h){throw h.clientVersion=this._clientVersion,h}}get $metrics(){if(!this._hasPreviewFlag("metrics"))throw new ze("`metrics` preview feature must be enabled in order to access metrics API",{clientVersion:this._clientVersion});return this._metrics}_hasPreviewFlag(r){return!!this._engineConfig.previewFeatures?.includes(r)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}}return A}function mD(e,A){return oV(e)?[new QA(e,A),tD]:[e,rD]}function oV(e){return Array.isArray(e)&&Array.isArray(e.raw)}var aV=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function kD(e){return new Proxy(e,{get(A,t){if(t in A)return A[t];if(!aV.has(t))throw new TypeError(`Invalid enum value: ${String(t)}`)}})}function SD(e){As(e,{conflictCheck:"warn"})}0&&(module.exports={Debug,Decimal,Extensions,MetricsClient,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,defineDmmfProperty,deserializeJsonResponse,dmmfToRuntimeDataModel,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,serializeJsonQuery,skip,sqltag,warnEnvConflicts,warnOnce});
|
||
|
|
/*! Bundled license information:
|
||
|
|
|
||
|
|
undici/lib/fetch/body.js:
|
||
|
|
(*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
|
||
|
|
|
||
|
|
undici/lib/websocket/frame.js:
|
||
|
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
||
|
|
|
||
|
|
decimal.js/decimal.mjs:
|
||
|
|
(*!
|
||
|
|
* decimal.js v10.4.3
|
||
|
|
* An arbitrary-precision Decimal type for JavaScript.
|
||
|
|
* https://github.com/MikeMcl/decimal.js
|
||
|
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
||
|
|
* MIT Licence
|
||
|
|
*)
|
||
|
|
*/
|
||
|
|
//# sourceMappingURL=binary.js.map
|