@prisma/client 7.10.0-dev.21 → 7.10.0-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -34
- package/runtime/client.d.mts +140 -120
- package/runtime/client.d.ts +140 -120
- package/runtime/client.js +24 -24
- package/runtime/client.js.map +3 -3
- package/runtime/client.mjs +24 -24
- package/runtime/client.mjs.map +3 -3
- package/runtime/wasm-compiler-edge.js +20 -20
- package/runtime/wasm-compiler-edge.js.map +4 -4
- package/runtime/wasm-compiler-edge.mjs +20 -20
- package/runtime/wasm-compiler-edge.mjs.map +4 -4
- package/scripts/default-index.js +1 -1
package/runtime/client.mjs
CHANGED
|
@@ -5,22 +5,22 @@ import * as __banner_node_url from "node:url";
|
|
|
5
5
|
const __filename = __banner_node_url.fileURLToPath(import.meta.url);
|
|
6
6
|
globalThis['__dirname'] = __banner_node_path.dirname(__filename);
|
|
7
7
|
const require = __banner_node_module.createRequire(import.meta.url);
|
|
8
|
-
var Fl=Object.create;var Br=Object.defineProperty;var _l=Object.getOwnPropertyDescriptor;var $l=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Vl=Object.prototype.hasOwnProperty;var ql=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var yi=(e,t)=>()=>(e&&(t=e(e=0)),t);var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tt=(e,t)=>{for(var r in t)Br(e,r,{get:t[r],enumerable:!0})},jl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $l(t))!Vl.call(e,i)&&i!==r&&Br(e,i,{get:()=>t[i],enumerable:!(n=_l(t,i))||n.enumerable});return e};var ge=(e,t,r)=>(r=e!=null?Fl(Ll(e)):{},jl(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e));var Ni=L((Vf,cu)=>{cu.exports={name:"@prisma/engines-version",version:"7.9.0-1.e922089b7d7502aff4249d5da3420f6fa55fc6ad",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"e922089b7d7502aff4249d5da3420f6fa55fc6ad"},repository:{type:"git",url:"https://github.com/prisma/engines-wrapper.git",directory:"packages/engines-version"},devDependencies:{"@types/node":"18.19.76",typescript:"4.9.5"},files:["index.js","index.d.ts"],scripts:{build:"tsc -d"}}});var Di=L(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.enginesVersion=void 0;jt.enginesVersion=Ni().prisma.enginesVersion});var Fi=L((jf,Mi)=>{"use strict";Mi.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var qi=L((Qf,Vi)=>{"use strict";Vi.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var Ui=L((Zf,Qt)=>{"use strict";Qt.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};Qt.exports.default=Qt.exports});var en=L((Qg,Wi)=>{"use strict";Wi.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,d,h,m,x,R,v,w,b,D=[];for(l=0;l<i;l++)D.push(l+1),D.push(t.charCodeAt(s+l));for(var te=D.length-1;a<o-3;)for(R=r.charCodeAt(s+(u=a)),v=r.charCodeAt(s+(c=a+1)),w=r.charCodeAt(s+(p=a+2)),b=r.charCodeAt(s+(d=a+3)),h=a+=4,l=0;l<te;l+=2)m=D[l],x=D[l+1],u=e(m,u,c,R,x),c=e(u,c,p,v,x),p=e(c,p,d,w,x),h=e(p,d,h,b,x),D[l]=h,d=p,p=c,c=u,u=m;for(;a<o;)for(R=r.charCodeAt(s+(u=a)),h=++a,l=0;l<te;l+=2)m=D[l],D[l]=h=e(m,u,h,R,D[l+1]),u=m;return h}}()});var eo=yi(()=>{"use strict"});var to=yi(()=>{"use strict"});var vn=L(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.anumber=Sn;xe.abytes=ms;xe.ahash=kp;xe.aexists=Ip;xe.aoutput=Op;function Sn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Rp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ms(e,...t){if(!Rp(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function kp(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Sn(e.outputLen),Sn(e.blockLen)}function Ip(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Op(e,t){ms(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}});var Fs=L(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.add5L=g.add5H=g.add4H=g.add4L=g.add3H=g.add3L=g.rotlBL=g.rotlBH=g.rotlSL=g.rotlSH=g.rotr32L=g.rotr32H=g.rotrBL=g.rotrBH=g.rotrSL=g.rotrSH=g.shrSL=g.shrSH=g.toBig=void 0;g.fromBig=Cn;g.split=fs;g.add=Rs;var wr=BigInt(2**32-1),An=BigInt(32);function Cn(e,t=!1){return t?{h:Number(e&wr),l:Number(e>>An&wr)}:{h:Number(e>>An&wr)|0,l:Number(e&wr)|0}}function fs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:s}=Cn(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}var gs=(e,t)=>BigInt(e>>>0)<<An|BigInt(t>>>0);g.toBig=gs;var ys=(e,t,r)=>e>>>r;g.shrSH=ys;var hs=(e,t,r)=>e<<32-r|t>>>r;g.shrSL=hs;var ws=(e,t,r)=>e>>>r|t<<32-r;g.rotrSH=ws;var bs=(e,t,r)=>e<<32-r|t>>>r;g.rotrSL=bs;var xs=(e,t,r)=>e<<64-r|t>>>r-32;g.rotrBH=xs;var Ps=(e,t,r)=>e>>>r-32|t<<64-r;g.rotrBL=Ps;var Es=(e,t)=>t;g.rotr32H=Es;var Ts=(e,t)=>e;g.rotr32L=Ts;var Ss=(e,t,r)=>e<<r|t>>>32-r;g.rotlSH=Ss;var vs=(e,t,r)=>t<<r|e>>>32-r;g.rotlSL=vs;var As=(e,t,r)=>t<<r-32|e>>>64-r;g.rotlBH=As;var Cs=(e,t,r)=>e<<r-32|t>>>64-r;g.rotlBL=Cs;function Rs(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var ks=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);g.add3L=ks;var Is=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;g.add3H=Is;var Os=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);g.add4L=Os;var Ns=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;g.add4H=Ns;var Ds=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);g.add5L=Ds;var Ms=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;g.add5H=Ms;var Np={fromBig:Cn,split:fs,toBig:gs,shrSH:ys,shrSL:hs,rotrSH:ws,rotrSL:bs,rotrBH:xs,rotrBL:Ps,rotr32H:Es,rotr32L:Ts,rotlSH:Ss,rotlSL:vs,rotlBH:As,rotlBL:Cs,add:Rs,add3L:ks,add3H:Is,add4L:Os,add4H:Ns,add5H:Ms,add5L:Ds};g.default=Np});var _s=L(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.crypto=void 0;var pe=ql("node:crypto");br.crypto=pe&&typeof pe=="object"&&"webcrypto"in pe?pe.webcrypto:pe&&typeof pe=="object"&&"randomBytes"in pe?pe:void 0});var Vs=L(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.Hash=P.nextTick=P.byteSwapIfBE=P.isLE=void 0;P.isBytes=Dp;P.u8=Mp;P.u32=Fp;P.createView=_p;P.rotr=$p;P.rotl=Lp;P.byteSwap=In;P.byteSwap32=Vp;P.bytesToHex=jp;P.hexToBytes=Up;P.asyncLoop=Qp;P.utf8ToBytes=Ls;P.toBytes=xr;P.concatBytes=Jp;P.checkOpts=Hp;P.wrapConstructor=Gp;P.wrapConstructorWithOpts=zp;P.wrapXOFConstructorWithOpts=Wp;P.randomBytes=Kp;var Je=_s(),kn=vn();function Dp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Mp(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Fp(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function _p(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function $p(e,t){return e<<32-t|e>>>t}function Lp(e,t){return e<<t|e>>>32-t>>>0}P.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function In(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}P.byteSwapIfBE=P.isLE?e=>e:e=>In(e);function Vp(e){for(let t=0;t<e.length;t++)e[t]=In(e[t])}var qp=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jp(e){(0,kn.abytes)(e);let t="";for(let r=0;r<e.length;r++)t+=qp[e[r]];return t}var ie={_0:48,_9:57,A:65,F:70,a:97,f:102};function $s(e){if(e>=ie._0&&e<=ie._9)return e-ie._0;if(e>=ie.A&&e<=ie.F)return e-(ie.A-10);if(e>=ie.a&&e<=ie.f)return e-(ie.a-10)}function Up(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=$s(e.charCodeAt(o)),a=$s(e.charCodeAt(o+1));if(s===void 0||a===void 0){let l=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+o)}n[i]=s*16+a}return n}var Bp=async()=>{};P.nextTick=Bp;async function Qp(e,t,r){let n=Date.now();for(let i=0;i<e;i++){r(i);let o=Date.now()-n;o>=0&&o<t||(await(0,P.nextTick)(),n+=o)}}function Ls(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function xr(e){return typeof e=="string"&&(e=Ls(e)),(0,kn.abytes)(e),e}function Jp(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];(0,kn.abytes)(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}var Rn=class{clone(){return this._cloneInto()}};P.Hash=Rn;function Hp(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function Gp(e){let t=n=>e().update(xr(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function zp(e){let t=(n,i)=>e(i).update(xr(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function Wp(e){let t=(n,i)=>e(i).update(xr(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function Kp(e=32){if(Je.crypto&&typeof Je.crypto.getRandomValues=="function")return Je.crypto.getRandomValues(new Uint8Array(e));if(Je.crypto&&typeof Je.crypto.randomBytes=="function")return Je.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}});var Gs=L(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.shake256=C.shake128=C.keccak_512=C.keccak_384=C.keccak_256=C.keccak_224=C.sha3_512=C.sha3_384=C.sha3_256=C.sha3_224=C.Keccak=void 0;C.keccakP=Js;var He=vn(),vt=Fs(),oe=Vs(),Us=[],Bs=[],Qs=[],Zp=BigInt(0),St=BigInt(1),Xp=BigInt(2),Yp=BigInt(7),ed=BigInt(256),td=BigInt(113);for(let e=0,t=St,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Us.push(2*(5*n+r)),Bs.push((e+1)*(e+2)/2%64);let i=Zp;for(let o=0;o<7;o++)t=(t<<St^(t>>Yp)*td)%ed,t&Xp&&(i^=St<<(St<<BigInt(o))-St);Qs.push(i)}var[rd,nd]=(0,vt.split)(Qs,!0),qs=(e,t,r)=>r>32?(0,vt.rotlBH)(e,t,r):(0,vt.rotlSH)(e,t,r),js=(e,t,r)=>r>32?(0,vt.rotlBL)(e,t,r):(0,vt.rotlSL)(e,t,r);function Js(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],c=r[l+1],p=qs(u,c,1)^r[a],d=js(u,c,1)^r[a+1];for(let h=0;h<50;h+=10)e[s+h]^=p,e[s+h+1]^=d}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=Bs[s],l=qs(i,o,a),u=js(i,o,a),c=Us[s];i=e[c],o=e[c+1],e[c]=l,e[c+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=rd[n],e[1]^=nd[n]}r.fill(0)}var At=class e extends oe.Hash{constructor(t,r,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,He.anumber)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,oe.u32)(this.state)}keccak(){oe.isLE||(0,oe.byteSwap32)(this.state32),Js(this.state32,this.rounds),oe.isLE||(0,oe.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,He.aexists)(this);let{blockLen:r,state:n}=this;t=(0,oe.toBytes)(t);let i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);for(let a=0;a<s;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,He.aexists)(this,!1),(0,He.abytes)(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);t.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,He.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,He.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new e(r,n,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}};C.Keccak=At;var de=(e,t,r)=>(0,oe.wrapConstructor)(()=>new At(t,e,r));C.sha3_224=de(6,144,224/8);C.sha3_256=de(6,136,256/8);C.sha3_384=de(6,104,384/8);C.sha3_512=de(6,72,512/8);C.keccak_224=de(1,144,224/8);C.keccak_256=de(1,136,256/8);C.keccak_384=de(1,104,384/8);C.keccak_512=de(1,72,512/8);var Hs=(e,t,r)=>(0,oe.wrapXOFConstructorWithOpts)((n={})=>new At(t,e,n.dkLen===void 0?r:n.dkLen,!0));C.shake128=Hs(31,168,128/8);C.shake256=Hs(31,136,256/8)});var ta=L((Ux,me)=>{"use strict";var{sha3_512:id}=Gs(),Ws=24,Ct=32,On=(e=4,t=Math.random)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function Ks(e){let t=8n,r=0n;for(let n of e.values()){let i=BigInt(n);r=(r<<t)+i}return r}var Zs=(e="")=>Ks(id(e)).toString(36).slice(1),zs=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),od=e=>zs[Math.floor(e()*zs.length)],Xs=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let r=Object.keys(e).toString(),n=r.length?r+On(Ct,t):On(Ct,t);return Zs(n).substring(0,Ct)},Ys=e=>()=>e++,sd=476782367,ea=({random:e=Math.random,counter:t=Ys(Math.floor(e()*sd)),length:r=Ws,fingerprint:n=Xs({random:e})}={})=>function(){let o=od(e),s=Date.now().toString(36),a=t().toString(36),l=On(r,e),u=`${s+l+a+n}`;return`${o+Zs(u).substring(1,r)}`},ad=ea(),ld=(e,{minLength:t=2,maxLength:r=Ct}={})=>{let n=e.length,i=/^[0-9a-z]+$/;try{if(typeof e=="string"&&n>=t&&n<=r&&i.test(e))return!0}finally{}return!1};me.exports.getConstants=()=>({defaultLength:Ws,bigLength:Ct});me.exports.init=ea;me.exports.createId=ad;me.exports.bufToBigInt=Ks;me.exports.createCounter=Ys;me.exports.createFingerprint=Xs;me.exports.isCuid=ld});var ra=L((Bx,Rt)=>{"use strict";var{createId:ud,init:cd,getConstants:pd,isCuid:dd}=ta();Rt.exports.createId=ud;Rt.exports.init=cd;Rt.exports.getConstants=pd;Rt.exports.isCuid=dd});var bi={};tt(bi,{defineExtension:()=>hi,getExtensionContext:()=>wi});function hi(e){return typeof e=="function"?e:t=>t.$extends(e)}function wi(e){return e}var Pi={};tt(Pi,{validator:()=>xi});function xi(...e){return t=>t}var G=class{_map=new Map;get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};function le(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function Ei(e,t){let r={};for(let n of e){let i=n[t];r[i]=n}return r}function rt(e){let t;return{get(){return t||(t={value:e()}),t.value}}}function Ul(e){return{models:Qr(e.models),enums:Qr(e.enums),types:Qr(e.types)}}function Qr(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}import{isObjectEnumValue as ac}from"@prisma/client-runtime-utils";var qt={};tt(qt,{$:()=>Ci,bgBlack:()=>Xl,bgBlue:()=>ru,bgCyan:()=>iu,bgGreen:()=>eu,bgMagenta:()=>nu,bgRed:()=>Yl,bgWhite:()=>ou,bgYellow:()=>tu,black:()=>zl,blue:()=>he,bold:()=>B,cyan:()=>re,dim:()=>nt,gray:()=>at,green:()=>ot,grey:()=>Zl,hidden:()=>Hl,inverse:()=>Jl,italic:()=>Ql,magenta:()=>Wl,red:()=>ye,reset:()=>Bl,strikethrough:()=>Gl,underline:()=>it,white:()=>Kl,yellow:()=>st});var Jr,Ti,Si,vi,Ai=!0;typeof process<"u"&&({FORCE_COLOR:Jr,NODE_DISABLE_COLORS:Ti,NO_COLOR:Si,TERM:vi}=process.env||{},Ai=process.stdout&&process.stdout.isTTY);var Ci={enabled:!Ti&&Si==null&&vi!=="dumb"&&(Jr!=null&&Jr!=="0"||Ai)};function S(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Ci.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var Bl=S(0,0),B=S(1,22),nt=S(2,22),Ql=S(3,23),it=S(4,24),Jl=S(7,27),Hl=S(8,28),Gl=S(9,29),zl=S(30,39),ye=S(31,39),ot=S(32,39),st=S(33,39),he=S(34,39),Wl=S(35,39),re=S(36,39),Kl=S(37,39),at=S(90,39),Zl=S(90,39),Xl=S(40,49),Yl=S(41,49),eu=S(42,49),tu=S(43,49),ru=S(44,49),nu=S(45,49),iu=S(46,49),ou=S(47,49);var su=100,Ri=["green","yellow","blue","magenta","cyan","red"],lt=[],ki=Date.now(),au=0,Hr=typeof process<"u"?process.env:{};globalThis.DEBUG??=Hr.DEBUG??"";globalThis.DEBUG_COLORS??=Hr.DEBUG_COLORS?Hr.DEBUG_COLORS==="true":!0;var ut={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function lu(e){let t={color:Ri[au++%Ri.length],enabled:ut.enabled(e),namespace:e,log:ut.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&<.push([o,...n]),lt.length>su&<.shift(),ut.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:uu(c)),u=`+${Date.now()-ki}ms`;ki=Date.now(),globalThis.DEBUG_COLORS?a(qt[s](B(o)),...l,qt[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var M=new Proxy(lu,{get:(e,t)=>ut[t],set:(e,t,r)=>ut[t]=r});function uu(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function Ii(e=7500){let t=lt.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
|
|
9
|
-
`);return t.length<e?t:t.slice(-e)}function Oi(){lt.length=0}function ne(e,t){throw new Error(t)}var _i=ge(Fi(),1);function Gr(e){let t=(0,_i.default)(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}var $i="prisma+postgres",Ut=`${$i}:`;function Li(e){return e?.toString().startsWith(`${Ut}//`)??!1}function zr(e){if(!Li(e))return!1;let{host:t}=new URL(e);return t.includes("localhost")||t.includes("127.0.0.1")||t.includes("[::1]")}var pt={};tt(pt,{error:()=>mu,info:()=>du,log:()=>pu,query:()=>fu,should:()=>ji,tags:()=>ct,warn:()=>Wr});var ct={error:ye("prisma:error"),warn:st("prisma:warn"),info:re("prisma:info"),query:he("prisma:query")},ji={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function pu(...e){console.log(...e)}function Wr(e,...t){ji.warn()&&console.warn(`${ct.warn} ${e}`,...t)}function du(e,...t){console.info(`${ct.info} ${e}`,...t)}function mu(e,...t){console.error(`${ct.error} ${e}`,...t)}function fu(e,...t){console.log(`${ct.query} ${e}`,...t)}function Kr({onlyFirst:e=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")}var gu=Kr();function Re(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(gu,"")}import Bt from"node:path";function Zr(e){return Bt.sep===Bt.posix.sep?e:e.split(Bt.sep).join(Bt.posix.sep)}function Xr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Jt(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function Yr(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}function dt(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var Bi=new Set,Qi=(e,t,...r)=>{Bi.has(e)||(Bi.add(e),Wr(t,...r))};function ke(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Ie(e){return e.toString()!=="Invalid Date"}import{Decimal as yu}from"@prisma/client-runtime-utils";function Oe(e){return yu.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}import{PrismaClientValidationError as nc}from"@prisma/client-runtime-utils";var Ht={};tt(Ht,{ModelAction:()=>Ne,datamodelEnumToSchemaEnum:()=>hu});function hu(e){return{name:e.name,values:e.values.map(t=>t.name)}}var Ne=(b=>(b.findUnique="findUnique",b.findUniqueOrThrow="findUniqueOrThrow",b.findFirst="findFirst",b.findFirstOrThrow="findFirstOrThrow",b.findMany="findMany",b.create="create",b.createMany="createMany",b.createManyAndReturn="createManyAndReturn",b.update="update",b.updateMany="updateMany",b.updateManyAndReturn="updateManyAndReturn",b.upsert="upsert",b.delete="delete",b.deleteMany="deleteMany",b.groupBy="groupBy",b.count="count",b.aggregate="aggregate",b.findRaw="findRaw",b.aggregateRaw="aggregateRaw",b))(Ne||{});var zi=ge(qi());import Eu from"node:fs";var Ji={keyword:re,entity:re,value:e=>B(he(e)),punctuation:he,directive:re,function:re,variable:e=>B(he(e)),string:e=>B(ot(e)),boolean:st,number:re,comment:at};var wu=e=>e,Gt={},bu=0,y={manual:Gt.Prism&&Gt.Prism.manual,disableWorkerMessageHandler:Gt.Prism&&Gt.Prism.disableWorkerMessageHandler,util:{encode:function(e){if(e instanceof Q){let t=e;return new Q(t.type,y.util.encode(t.content),t.alias)}else return Array.isArray(e)?e.map(y.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++bu}),e.__id},clone:function e(t,r){let n,i,o=y.util.type(t);switch(r=r||{},o){case"Object":if(i=y.util.objId(t),r[i])return r[i];n={},r[i]=n;for(let s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return i=y.util.objId(t),r[i]?r[i]:(n=[],r[i]=n,t.forEach(function(s,a){n[a]=e(s,r)}),n);default:return t}}},languages:{extend:function(e,t){let r=y.util.clone(y.languages[e]);for(let n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){n=n||y.languages;let i=n[e],o={};for(let a in i)if(i.hasOwnProperty(a)){if(a==t)for(let l in r)r.hasOwnProperty(l)&&(o[l]=r[l]);r.hasOwnProperty(a)||(o[a]=i[a])}let s=n[e];return n[e]=o,y.languages.DFS(y.languages,function(a,l){l===s&&a!=e&&(this[a]=o)}),o},DFS:function e(t,r,n,i){i=i||{};let o=y.util.objId;for(let s in t)if(t.hasOwnProperty(s)){r.call(t,s,t[s],n||s);let a=t[s],l=y.util.type(a);l==="Object"&&!i[o(a)]?(i[o(a)]=!0,e(a,r,null,i)):l==="Array"&&!i[o(a)]&&(i[o(a)]=!0,e(a,r,s,i))}}},plugins:{},highlight:function(e,t,r){let n={code:e,grammar:t,language:r};return y.hooks.run("before-tokenize",n),n.tokens=y.tokenize(n.code,n.grammar),y.hooks.run("after-tokenize",n),Q.stringify(y.util.encode(n.tokens),n.language)},matchGrammar:function(e,t,r,n,i,o,s){for(let x in r){if(!r.hasOwnProperty(x)||!r[x])continue;if(x==s)return;let R=r[x];R=y.util.type(R)==="Array"?R:[R];for(let v=0;v<R.length;++v){let w=R[v],b=w.inside,D=!!w.lookbehind,te=!!w.greedy,Ur=0,Nl=w.alias;if(te&&!w.pattern.global){let _=w.pattern.toString().match(/[imuy]*$/)[0];w.pattern=RegExp(w.pattern.source,_+"g")}w=w.pattern||w;for(let _=n,ae=i;_<t.length;ae+=t[_].length,++_){let et=t[_];if(t.length>e.length)return;if(et instanceof Q)continue;if(te&&_!=t.length-1){w.lastIndex=ae;var p=w.exec(e);if(!p)break;var c=p.index+(D?p[1].length:0),d=p.index+p[0].length,a=_,l=ae;for(let Ml=t.length;a<Ml&&(l<d||!t[a].type&&!t[a-1].greedy);++a)l+=t[a].length,c>=l&&(++_,ae=l);if(t[_]instanceof Q)continue;u=a-_,et=e.slice(ae,l),p.index-=ae}else{w.lastIndex=0;var p=w.exec(et),u=1}if(!p){if(o)break;continue}D&&(Ur=p[1]?p[1].length:0);var c=p.index+Ur,p=p[0].slice(Ur),d=c+p.length,h=et.slice(0,c),m=et.slice(d);let Vt=[_,u];h&&(++_,ae+=h.length,Vt.push(h));let Dl=new Q(x,b?y.tokenize(p,b):p,Nl,p,te);if(Vt.push(Dl),m&&Vt.push(m),Array.prototype.splice.apply(t,Vt),u!=1&&y.matchGrammar(e,t,r,_,ae,!0,x),o)break}}}},tokenize:function(e,t){let r=[e],n=t.rest;if(n){for(let i in n)t[i]=n[i];delete t.rest}return y.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){let r=y.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){let r=y.hooks.all[e];if(!(!r||!r.length))for(var n=0,i;i=r[n++];)i(t)}},Token:Q};y.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};y.languages.javascript=y.languages.extend("clike",{"class-name":[y.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});y.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;y.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:y.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:y.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:y.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:y.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});y.languages.markup&&y.languages.markup.tag.addInlined("script","javascript");y.languages.js=y.languages.javascript;y.languages.typescript=y.languages.extend("javascript",{keyword:/\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/});y.languages.ts=y.languages.typescript;function Q(e,t,r,n,i){this.type=e,this.content=t,this.alias=r,this.length=(n||"").length|0,this.greedy=!!i}Q.stringify=function(e,t){return typeof e=="string"?e:Array.isArray(e)?e.map(function(r){return Q.stringify(r,t)}).join(""):xu(e.type)(e.content)};function xu(e){return Ji[e]||wu}function Hi(e){return Pu(e,y.languages.javascript)}function Pu(e,t){return y.tokenize(e,t).map(n=>Q.stringify(n)).join("")}function Gi(e){return Gr(e)}var zt=class e{firstLineNumber;lines;static read(t){let r;try{r=Eu.readFileSync(t,"utf-8")}catch{return null}return e.fromContent(r)}static fromContent(t){let r=t.split(/\r?\n/);return new e(1,r)}constructor(t,r){this.firstLineNumber=t,this.lines=r}get lastLineNumber(){return this.firstLineNumber+this.lines.length-1}mapLineAt(t,r){if(t<this.firstLineNumber||t>this.lastLineNumber)return this;let n=t-this.firstLineNumber,i=[...this.lines];return i[n]=r(i[n]),new e(this.firstLineNumber,i)}mapLines(t){return new e(this.firstLineNumber,this.lines.map((r,n)=>t(r,this.firstLineNumber+n)))}lineAt(t){return this.lines[t-this.firstLineNumber]}prependSymbolAt(t,r){return this.mapLines((n,i)=>i===t?`${r} ${n}`:` ${n}`)}slice(t,r){let n=Math.max(t,this.firstLineNumber),i=Math.min(r,this.lastLineNumber);if(n>i)return new e(t,[]);let o=this.lines.slice(n-this.firstLineNumber,i-this.firstLineNumber+1).join(`
|
|
10
|
-
`);return new e(n,
|
|
11
|
-
`))}highlight(){let t=
|
|
8
|
+
var ql=Object.create;var zr=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Ul=Object.getOwnPropertyNames;var Bl=Object.getPrototypeOf,Ql=Object.prototype.hasOwnProperty;var Jl=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ti=(e,t)=>()=>(e&&(t=e(e=0)),t);var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nt=(e,t)=>{for(var r in t)zr(e,r,{get:t[r],enumerable:!0})},Hl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ul(t))!Ql.call(e,i)&&i!==r&&zr(e,i,{get:()=>t[i],enumerable:!(n=jl(t,i))||n.enumerable});return e};var ye=(e,t,r)=>(r=e!=null?ql(Bl(e)):{},Hl(t||!e||!e.__esModule?zr(r,"default",{value:e,enumerable:!0}):r,e));var Vi=L((Uf,gu)=>{gu.exports={name:"@prisma/engines-version",version:"7.9.0-1.e922089b7d7502aff4249d5da3420f6fa55fc6ad",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"e922089b7d7502aff4249d5da3420f6fa55fc6ad"},repository:{type:"git",url:"https://github.com/prisma/engines-wrapper.git",directory:"packages/engines-version"},devDependencies:{"@types/node":"18.19.76",typescript:"4.9.5"},files:["index.js","index.d.ts"],scripts:{build:"tsc -d"}}});var qi=L(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.enginesVersion=void 0;Jt.enginesVersion=Vi().prisma.enginesVersion});var Ui=L((Qf,ji)=>{"use strict";ji.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var Gi=L((Gf,Hi)=>{"use strict";Hi.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var Wi=L((eg,zt)=>{"use strict";zt.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};zt.exports.default=zt.exports});var sn=L((Gg,ro)=>{"use strict";ro.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,d,h,m,x,C,S,w,b,D=[];for(l=0;l<i;l++)D.push(l+1),D.push(t.charCodeAt(s+l));for(var te=D.length-1;a<o-3;)for(C=r.charCodeAt(s+(u=a)),S=r.charCodeAt(s+(c=a+1)),w=r.charCodeAt(s+(p=a+2)),b=r.charCodeAt(s+(d=a+3)),h=a+=4,l=0;l<te;l+=2)m=D[l],x=D[l+1],u=e(m,u,c,C,x),c=e(u,c,p,S,x),p=e(c,p,d,w,x),h=e(p,d,h,b,x),D[l]=h,d=p,p=c,c=u,u=m;for(;a<o;)for(C=r.charCodeAt(s+(u=a)),h=++a,l=0;l<te;l+=2)m=D[l],D[l]=h=e(m,u,h,C,D[l+1]),u=m;return h}}()});var ao=Ti(()=>{"use strict"});var lo=Ti(()=>{"use strict"});var On=L(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.anumber=kn;Pe.abytes=bs;Pe.ahash=Mp;Pe.aexists=Fp;Pe.aoutput=_p;function kn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Dp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function bs(e,...t){if(!Dp(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Mp(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");kn(e.outputLen),kn(e.blockLen)}function Fp(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _p(e,t){bs(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}});var js=L(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.add5L=g.add5H=g.add4H=g.add4L=g.add3H=g.add3L=g.rotlBL=g.rotlBH=g.rotlSL=g.rotlSH=g.rotr32L=g.rotr32H=g.rotrBL=g.rotrBH=g.rotrSL=g.rotrSH=g.shrSL=g.shrSH=g.toBig=void 0;g.fromBig=Dn;g.split=xs;g.add=Ms;var Er=BigInt(2**32-1),Nn=BigInt(32);function Dn(e,t=!1){return t?{h:Number(e&Er),l:Number(e>>Nn&Er)}:{h:Number(e>>Nn&Er)|0,l:Number(e&Er)|0}}function xs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:s}=Dn(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}var Ps=(e,t)=>BigInt(e>>>0)<<Nn|BigInt(t>>>0);g.toBig=Ps;var Es=(e,t,r)=>e>>>r;g.shrSH=Es;var Ts=(e,t,r)=>e<<32-r|t>>>r;g.shrSL=Ts;var vs=(e,t,r)=>e>>>r|t<<32-r;g.rotrSH=vs;var Ss=(e,t,r)=>e<<32-r|t>>>r;g.rotrSL=Ss;var As=(e,t,r)=>e<<64-r|t>>>r-32;g.rotrBH=As;var Rs=(e,t,r)=>e>>>r-32|t<<64-r;g.rotrBL=Rs;var Cs=(e,t)=>t;g.rotr32H=Cs;var Is=(e,t)=>e;g.rotr32L=Is;var ks=(e,t,r)=>e<<r|t>>>32-r;g.rotlSH=ks;var Os=(e,t,r)=>t<<r|e>>>32-r;g.rotlSL=Os;var Ns=(e,t,r)=>t<<r-32|e>>>64-r;g.rotlBH=Ns;var Ds=(e,t,r)=>e<<r-32|t>>>64-r;g.rotlBL=Ds;function Ms(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var Fs=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);g.add3L=Fs;var _s=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;g.add3H=_s;var $s=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);g.add4L=$s;var Ls=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;g.add4H=Ls;var Vs=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);g.add5L=Vs;var qs=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;g.add5H=qs;var $p={fromBig:Dn,split:xs,toBig:Ps,shrSH:Es,shrSL:Ts,rotrSH:vs,rotrSL:Ss,rotrBH:As,rotrBL:Rs,rotr32H:Cs,rotr32L:Is,rotlSH:ks,rotlSL:Os,rotlBH:Ns,rotlBL:Ds,add:Ms,add3L:Fs,add3H:_s,add4L:$s,add4H:Ls,add5H:qs,add5L:Vs};g.default=$p});var Us=L(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.crypto=void 0;var de=Jl("node:crypto");Tr.crypto=de&&typeof de=="object"&&"webcrypto"in de?de.webcrypto:de&&typeof de=="object"&&"randomBytes"in de?de:void 0});var Js=L(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.Hash=P.nextTick=P.byteSwapIfBE=P.isLE=void 0;P.isBytes=Lp;P.u8=Vp;P.u32=qp;P.createView=jp;P.rotr=Up;P.rotl=Bp;P.byteSwap=_n;P.byteSwap32=Qp;P.bytesToHex=Hp;P.hexToBytes=Gp;P.asyncLoop=Wp;P.utf8ToBytes=Qs;P.toBytes=vr;P.concatBytes=Kp;P.checkOpts=Zp;P.wrapConstructor=Xp;P.wrapConstructorWithOpts=Yp;P.wrapXOFConstructorWithOpts=ed;P.randomBytes=td;var Ge=Us(),Fn=On();function Lp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Vp(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function qp(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function jp(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Up(e,t){return e<<32-t|e>>>t}function Bp(e,t){return e<<t|e>>>32-t>>>0}P.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function _n(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}P.byteSwapIfBE=P.isLE?e=>e:e=>_n(e);function Qp(e){for(let t=0;t<e.length;t++)e[t]=_n(e[t])}var Jp=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hp(e){(0,Fn.abytes)(e);let t="";for(let r=0;r<e.length;r++)t+=Jp[e[r]];return t}var ie={_0:48,_9:57,A:65,F:70,a:97,f:102};function Bs(e){if(e>=ie._0&&e<=ie._9)return e-ie._0;if(e>=ie.A&&e<=ie.F)return e-(ie.A-10);if(e>=ie.a&&e<=ie.f)return e-(ie.a-10)}function Gp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Bs(e.charCodeAt(o)),a=Bs(e.charCodeAt(o+1));if(s===void 0||a===void 0){let l=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+o)}n[i]=s*16+a}return n}var zp=async()=>{};P.nextTick=zp;async function Wp(e,t,r){let n=Date.now();for(let i=0;i<e;i++){r(i);let o=Date.now()-n;o>=0&&o<t||(await(0,P.nextTick)(),n+=o)}}function Qs(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function vr(e){return typeof e=="string"&&(e=Qs(e)),(0,Fn.abytes)(e),e}function Kp(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];(0,Fn.abytes)(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}var Mn=class{clone(){return this._cloneInto()}};P.Hash=Mn;function Zp(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function Xp(e){let t=n=>e().update(vr(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Yp(e){let t=(n,i)=>e(i).update(vr(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function ed(e){let t=(n,i)=>e(i).update(vr(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function td(e=32){if(Ge.crypto&&typeof Ge.crypto.getRandomValues=="function")return Ge.crypto.getRandomValues(new Uint8Array(e));if(Ge.crypto&&typeof Ge.crypto.randomBytes=="function")return Ge.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}});var Ys=L(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.shake256=R.shake128=R.keccak_512=R.keccak_384=R.keccak_256=R.keccak_224=R.sha3_512=R.sha3_384=R.sha3_256=R.sha3_224=R.Keccak=void 0;R.keccakP=Zs;var ze=On(),Rt=js(),oe=Js(),zs=[],Ws=[],Ks=[],rd=BigInt(0),At=BigInt(1),nd=BigInt(2),id=BigInt(7),od=BigInt(256),sd=BigInt(113);for(let e=0,t=At,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],zs.push(2*(5*n+r)),Ws.push((e+1)*(e+2)/2%64);let i=rd;for(let o=0;o<7;o++)t=(t<<At^(t>>id)*sd)%od,t&nd&&(i^=At<<(At<<BigInt(o))-At);Ks.push(i)}var[ad,ld]=(0,Rt.split)(Ks,!0),Hs=(e,t,r)=>r>32?(0,Rt.rotlBH)(e,t,r):(0,Rt.rotlSH)(e,t,r),Gs=(e,t,r)=>r>32?(0,Rt.rotlBL)(e,t,r):(0,Rt.rotlSL)(e,t,r);function Zs(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],c=r[l+1],p=Hs(u,c,1)^r[a],d=Gs(u,c,1)^r[a+1];for(let h=0;h<50;h+=10)e[s+h]^=p,e[s+h+1]^=d}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=Ws[s],l=Hs(i,o,a),u=Gs(i,o,a),c=zs[s];i=e[c],o=e[c+1],e[c]=l,e[c+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=ad[n],e[1]^=ld[n]}r.fill(0)}var Ct=class e extends oe.Hash{constructor(t,r,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ze.anumber)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,oe.u32)(this.state)}keccak(){oe.isLE||(0,oe.byteSwap32)(this.state32),Zs(this.state32,this.rounds),oe.isLE||(0,oe.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,ze.aexists)(this);let{blockLen:r,state:n}=this;t=(0,oe.toBytes)(t);let i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);for(let a=0;a<s;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,ze.aexists)(this,!1),(0,ze.abytes)(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);t.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,ze.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,ze.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new e(r,n,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}};R.Keccak=Ct;var me=(e,t,r)=>(0,oe.wrapConstructor)(()=>new Ct(t,e,r));R.sha3_224=me(6,144,224/8);R.sha3_256=me(6,136,256/8);R.sha3_384=me(6,104,384/8);R.sha3_512=me(6,72,512/8);R.keccak_224=me(1,144,224/8);R.keccak_256=me(1,136,256/8);R.keccak_384=me(1,104,384/8);R.keccak_512=me(1,72,512/8);var Xs=(e,t,r)=>(0,oe.wrapXOFConstructorWithOpts)((n={})=>new Ct(t,e,n.dkLen===void 0?r:n.dkLen,!0));R.shake128=Xs(31,168,128/8);R.shake256=Xs(31,136,256/8)});var aa=L((Jx,fe)=>{"use strict";var{sha3_512:ud}=Ys(),ta=24,It=32,$n=(e=4,t=Math.random)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function ra(e){let t=8n,r=0n;for(let n of e.values()){let i=BigInt(n);r=(r<<t)+i}return r}var na=(e="")=>ra(ud(e)).toString(36).slice(1),ea=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),cd=e=>ea[Math.floor(e()*ea.length)],ia=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let r=Object.keys(e).toString(),n=r.length?r+$n(It,t):$n(It,t);return na(n).substring(0,It)},oa=e=>()=>e++,pd=476782367,sa=({random:e=Math.random,counter:t=oa(Math.floor(e()*pd)),length:r=ta,fingerprint:n=ia({random:e})}={})=>function(){let o=cd(e),s=Date.now().toString(36),a=t().toString(36),l=$n(r,e),u=`${s+l+a+n}`;return`${o+na(u).substring(1,r)}`},dd=sa(),md=(e,{minLength:t=2,maxLength:r=It}={})=>{let n=e.length,i=/^[0-9a-z]+$/;try{if(typeof e=="string"&&n>=t&&n<=r&&i.test(e))return!0}finally{}return!1};fe.exports.getConstants=()=>({defaultLength:ta,bigLength:It});fe.exports.init=sa;fe.exports.createId=dd;fe.exports.bufToBigInt=ra;fe.exports.createCounter=oa;fe.exports.createFingerprint=ia;fe.exports.isCuid=md});var la=L((Hx,kt)=>{"use strict";var{createId:fd,init:gd,getConstants:yd,isCuid:hd}=aa();kt.exports.createId=fd;kt.exports.init=gd;kt.exports.getConstants=yd;kt.exports.isCuid=hd});var Ai={};nt(Ai,{defineExtension:()=>vi,getExtensionContext:()=>Si});function vi(e){return typeof e=="function"?e:t=>t.$extends(e)}function Si(e){return e}var Ci={};nt(Ci,{validator:()=>Ri});function Ri(...e){return t=>t}var z=class{_map=new Map;get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};function le(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function Ii(e,t){let r={};for(let n of e){let i=n[t];r[i]=n}return r}function it(e){let t;return{get(){return t||(t={value:e()}),t.value}}}function Gl(e){return{models:Wr(e.models),enums:Wr(e.enums),types:Wr(e.types)}}function Wr(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}import{isObjectEnumValue as dc}from"@prisma/client-runtime-utils";var Qt={};nt(Qt,{$:()=>Mi,bgBlack:()=>nu,bgBlue:()=>au,bgCyan:()=>uu,bgGreen:()=>ou,bgMagenta:()=>lu,bgRed:()=>iu,bgWhite:()=>cu,bgYellow:()=>su,black:()=>Yl,blue:()=>we,bold:()=>Q,cyan:()=>re,dim:()=>ot,gray:()=>ut,green:()=>at,grey:()=>ru,hidden:()=>Zl,inverse:()=>Kl,italic:()=>Wl,magenta:()=>eu,red:()=>he,reset:()=>zl,strikethrough:()=>Xl,underline:()=>st,white:()=>tu,yellow:()=>lt});var Kr,ki,Oi,Ni,Di=!0;typeof process<"u"&&({FORCE_COLOR:Kr,NODE_DISABLE_COLORS:ki,NO_COLOR:Oi,TERM:Ni}=process.env||{},Di=process.stdout&&process.stdout.isTTY);var Mi={enabled:!ki&&Oi==null&&Ni!=="dumb"&&(Kr!=null&&Kr!=="0"||Di)};function v(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Mi.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var zl=v(0,0),Q=v(1,22),ot=v(2,22),Wl=v(3,23),st=v(4,24),Kl=v(7,27),Zl=v(8,28),Xl=v(9,29),Yl=v(30,39),he=v(31,39),at=v(32,39),lt=v(33,39),we=v(34,39),eu=v(35,39),re=v(36,39),tu=v(37,39),ut=v(90,39),ru=v(90,39),nu=v(40,49),iu=v(41,49),ou=v(42,49),su=v(43,49),au=v(44,49),lu=v(45,49),uu=v(46,49),cu=v(47,49);var pu=100,Fi=["green","yellow","blue","magenta","cyan","red"],ct=[],_i=Date.now(),du=0,Zr=typeof process<"u"?process.env:{};globalThis.DEBUG??=Zr.DEBUG??"";globalThis.DEBUG_COLORS??=Zr.DEBUG_COLORS?Zr.DEBUG_COLORS==="true":!0;var pt={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function mu(e){let t={color:Fi[du++%Fi.length],enabled:pt.enabled(e),namespace:e,log:pt.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&&ct.push([o,...n]),ct.length>pu&&ct.shift(),pt.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:fu(c)),u=`+${Date.now()-_i}ms`;_i=Date.now(),globalThis.DEBUG_COLORS?a(Qt[s](Q(o)),...l,Qt[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var M=new Proxy(mu,{get:(e,t)=>pt[t],set:(e,t,r)=>pt[t]=r});function fu(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function $i(e=7500){let t=ct.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
|
|
9
|
+
`);return t.length<e?t:t.slice(-e)}function Li(){ct.length=0}function ne(e,t){throw new Error(t)}var Bi=ye(Ui(),1);function Xr(e){let t=(0,Bi.default)(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}var Qi="prisma+postgres",Ht=`${Qi}:`;function Ji(e){return e?.toString().startsWith(`${Ht}//`)??!1}function Yr(e){if(!Ji(e))return!1;let{host:t}=new URL(e);return t.includes("localhost")||t.includes("127.0.0.1")||t.includes("[::1]")}var mt={};nt(mt,{error:()=>wu,info:()=>hu,log:()=>yu,query:()=>bu,should:()=>zi,tags:()=>dt,warn:()=>en});var dt={error:he("prisma:error"),warn:lt("prisma:warn"),info:re("prisma:info"),query:we("prisma:query")},zi={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function yu(...e){console.log(...e)}function en(e,...t){zi.warn()&&console.warn(`${dt.warn} ${e}`,...t)}function hu(e,...t){console.info(`${dt.info} ${e}`,...t)}function wu(e,...t){console.error(`${dt.error} ${e}`,...t)}function bu(e,...t){console.log(`${dt.query} ${e}`,...t)}function tn({onlyFirst:e=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")}var xu=tn();function Oe(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(xu,"")}import Gt from"node:path";function rn(e){return Gt.sep===Gt.posix.sep?e:e.split(Gt.sep).join(Gt.posix.sep)}function nn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wt(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function on(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}function ft(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var Ki=new Set,Zi=(e,t,...r)=>{Ki.has(e)||(Ki.add(e),en(t,...r))};function Ne(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function De(e){return e.toString()!=="Invalid Date"}import{Decimal as Pu}from"@prisma/client-runtime-utils";function Me(e){return Pu.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}import{PrismaClientValidationError as lc}from"@prisma/client-runtime-utils";var Kt={};nt(Kt,{ModelAction:()=>Fe,datamodelEnumToSchemaEnum:()=>Eu});function Eu(e){return{name:e.name,values:e.values.map(t=>t.name)}}var Fe=(b=>(b.findUnique="findUnique",b.findUniqueOrThrow="findUniqueOrThrow",b.findFirst="findFirst",b.findFirstOrThrow="findFirstOrThrow",b.findMany="findMany",b.create="create",b.createMany="createMany",b.createManyAndReturn="createManyAndReturn",b.update="update",b.updateMany="updateMany",b.updateManyAndReturn="updateManyAndReturn",b.upsert="upsert",b.delete="delete",b.deleteMany="deleteMany",b.groupBy="groupBy",b.count="count",b.aggregate="aggregate",b.findRaw="findRaw",b.aggregateRaw="aggregateRaw",b))(Fe||{});var to=ye(Gi());import Ru from"node:fs";var Xi={keyword:re,entity:re,value:e=>Q(we(e)),punctuation:we,directive:re,function:re,variable:e=>Q(we(e)),string:e=>Q(at(e)),boolean:lt,number:re,comment:ut};var Tu=e=>e,Zt={},vu=0,y={manual:Zt.Prism&&Zt.Prism.manual,disableWorkerMessageHandler:Zt.Prism&&Zt.Prism.disableWorkerMessageHandler,util:{encode:function(e){if(e instanceof J){let t=e;return new J(t.type,y.util.encode(t.content),t.alias)}else return Array.isArray(e)?e.map(y.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++vu}),e.__id},clone:function e(t,r){let n,i,o=y.util.type(t);switch(r=r||{},o){case"Object":if(i=y.util.objId(t),r[i])return r[i];n={},r[i]=n;for(let s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return i=y.util.objId(t),r[i]?r[i]:(n=[],r[i]=n,t.forEach(function(s,a){n[a]=e(s,r)}),n);default:return t}}},languages:{extend:function(e,t){let r=y.util.clone(y.languages[e]);for(let n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){n=n||y.languages;let i=n[e],o={};for(let a in i)if(i.hasOwnProperty(a)){if(a==t)for(let l in r)r.hasOwnProperty(l)&&(o[l]=r[l]);r.hasOwnProperty(a)||(o[a]=i[a])}let s=n[e];return n[e]=o,y.languages.DFS(y.languages,function(a,l){l===s&&a!=e&&(this[a]=o)}),o},DFS:function e(t,r,n,i){i=i||{};let o=y.util.objId;for(let s in t)if(t.hasOwnProperty(s)){r.call(t,s,t[s],n||s);let a=t[s],l=y.util.type(a);l==="Object"&&!i[o(a)]?(i[o(a)]=!0,e(a,r,null,i)):l==="Array"&&!i[o(a)]&&(i[o(a)]=!0,e(a,r,s,i))}}},plugins:{},highlight:function(e,t,r){let n={code:e,grammar:t,language:r};return y.hooks.run("before-tokenize",n),n.tokens=y.tokenize(n.code,n.grammar),y.hooks.run("after-tokenize",n),J.stringify(y.util.encode(n.tokens),n.language)},matchGrammar:function(e,t,r,n,i,o,s){for(let x in r){if(!r.hasOwnProperty(x)||!r[x])continue;if(x==s)return;let C=r[x];C=y.util.type(C)==="Array"?C:[C];for(let S=0;S<C.length;++S){let w=C[S],b=w.inside,D=!!w.lookbehind,te=!!w.greedy,Gr=0,$l=w.alias;if(te&&!w.pattern.global){let _=w.pattern.toString().match(/[imuy]*$/)[0];w.pattern=RegExp(w.pattern.source,_+"g")}w=w.pattern||w;for(let _=n,ae=i;_<t.length;ae+=t[_].length,++_){let rt=t[_];if(t.length>e.length)return;if(rt instanceof J)continue;if(te&&_!=t.length-1){w.lastIndex=ae;var p=w.exec(e);if(!p)break;var c=p.index+(D?p[1].length:0),d=p.index+p[0].length,a=_,l=ae;for(let Vl=t.length;a<Vl&&(l<d||!t[a].type&&!t[a-1].greedy);++a)l+=t[a].length,c>=l&&(++_,ae=l);if(t[_]instanceof J)continue;u=a-_,rt=e.slice(ae,l),p.index-=ae}else{w.lastIndex=0;var p=w.exec(rt),u=1}if(!p){if(o)break;continue}D&&(Gr=p[1]?p[1].length:0);var c=p.index+Gr,p=p[0].slice(Gr),d=c+p.length,h=rt.slice(0,c),m=rt.slice(d);let Bt=[_,u];h&&(++_,ae+=h.length,Bt.push(h));let Ll=new J(x,b?y.tokenize(p,b):p,$l,p,te);if(Bt.push(Ll),m&&Bt.push(m),Array.prototype.splice.apply(t,Bt),u!=1&&y.matchGrammar(e,t,r,_,ae,!0,x),o)break}}}},tokenize:function(e,t){let r=[e],n=t.rest;if(n){for(let i in n)t[i]=n[i];delete t.rest}return y.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){let r=y.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){let r=y.hooks.all[e];if(!(!r||!r.length))for(var n=0,i;i=r[n++];)i(t)}},Token:J};y.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};y.languages.javascript=y.languages.extend("clike",{"class-name":[y.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});y.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;y.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:y.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:y.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:y.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:y.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});y.languages.markup&&y.languages.markup.tag.addInlined("script","javascript");y.languages.js=y.languages.javascript;y.languages.typescript=y.languages.extend("javascript",{keyword:/\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/});y.languages.ts=y.languages.typescript;function J(e,t,r,n,i){this.type=e,this.content=t,this.alias=r,this.length=(n||"").length|0,this.greedy=!!i}J.stringify=function(e,t){return typeof e=="string"?e:Array.isArray(e)?e.map(function(r){return J.stringify(r,t)}).join(""):Su(e.type)(e.content)};function Su(e){return Xi[e]||Tu}function Yi(e){return Au(e,y.languages.javascript)}function Au(e,t){return y.tokenize(e,t).map(n=>J.stringify(n)).join("")}function eo(e){return Xr(e)}var Xt=class e{firstLineNumber;lines;static read(t){let r;try{r=Ru.readFileSync(t,"utf-8")}catch{return null}return e.fromContent(r)}static fromContent(t){let r=t.split(/\r?\n/);return new e(1,r)}constructor(t,r){this.firstLineNumber=t,this.lines=r}get lastLineNumber(){return this.firstLineNumber+this.lines.length-1}mapLineAt(t,r){if(t<this.firstLineNumber||t>this.lastLineNumber)return this;let n=t-this.firstLineNumber,i=[...this.lines];return i[n]=r(i[n]),new e(this.firstLineNumber,i)}mapLines(t){return new e(this.firstLineNumber,this.lines.map((r,n)=>t(r,this.firstLineNumber+n)))}lineAt(t){return this.lines[t-this.firstLineNumber]}prependSymbolAt(t,r){return this.mapLines((n,i)=>i===t?`${r} ${n}`:` ${n}`)}slice(t,r){let n=Math.max(t,this.firstLineNumber),i=Math.min(r,this.lastLineNumber);if(n>i)return new e(t,[]);let o=this.lines.slice(n-this.firstLineNumber,i-this.firstLineNumber+1).join(`
|
|
10
|
+
`);return new e(n,eo(o).split(`
|
|
11
|
+
`))}highlight(){let t=Yi(this.toString());return new e(this.firstLineNumber,t.split(`
|
|
12
12
|
`))}toString(){return this.lines.join(`
|
|
13
|
-
`)}};var
|
|
14
|
-
`)}function
|
|
15
|
-
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let t=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+t.slice(1):t}};
|
|
16
|
-
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function
|
|
17
|
-
`)}};function Ve(e){return new rn(co(e))}function co(e){let t=new _e;for(let[r,n]of Object.entries(e)){let i=new tr(r,po(n));t.addField(i)}return t}function po(e){if(typeof e=="string")return new k(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new k(String(e));if(typeof e=="bigint")return new k(`${e}n`);if(e===null)return new k("null");if(e===void 0)return new k("undefined");if(Oe(e))return new k(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new k(`Buffer.alloc(${e.byteLength})`):new k(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ie(e)?e.toISOString():"Invalid Date";return new k(`new Date("${t}")`)}return tc(e)?new k(`Prisma.${e._getName()}`):Le(e)?new k(`prisma.${le(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?rc(e):typeof e=="object"?co(e):new k(Object.prototype.toString.call(e))}function rc(e){let t=new Fe;for(let r of e)t.addItem(po(r));return t}function rr(e,t){let r=t==="pretty"?ro:Yt,n=e.renderAllMessages(r),i=new De(0,{colors:r}).write(e).toString();return{message:n,args:i}}function nr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=Ve(e);for(let p of t)Kt(p,a,s);let{message:l,args:u}=rr(a,r),c=Wt({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:u});throw new nc(c,{clientVersion:o})}function W(e){return e.replace(/^./,t=>t.toLowerCase())}function fo(e,t,r){let n=W(r);return!t.result||!(t.result.$allModels||t.result[n])?e:ic({...e,...mo(t.name,e,t.result.$allModels),...mo(t.name,e,t.result[n])})}function ic(e){let t=new G,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Jt(e,n=>({...n,needs:r(n.name,new Set)}))}function mo(e,t,r){return r?Jt(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:oc(t,o,i)})):{}}function oc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function go(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function yo(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var ir=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new G;modelExtensionsCache=new G;queryCallbacksCache=new G;clientExtensions=rt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=rt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>fo(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=W(t);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(t):{...this.previous?.getAllModelExtensions(t),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(t,r){return this.queryCallbacksCache.getOrCreate(`${t}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(t,r)??[],i=[],o=this.extension.query;return!o||!(o[t]||o.$allModels||o[r]||o.$allOperations)?n:(o[t]!==void 0&&(o[t][r]!==void 0&&i.push(o[t][r]),o[t].$allOperations!==void 0&&i.push(o[t].$allOperations)),t!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},qe=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new ir(t))}isEmpty(){return this.head===void 0}append(t){return new e(new ir(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var or=class{constructor(t){this.name=t}};function ho(e){return e instanceof or}function sc(e){return new or(e)}var wo=Symbol(),yt=class{constructor(t){if(t!==wo)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?nn:t}},nn=new yt(wo);function q(e){return e instanceof yt}var lc={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",updateManyAndReturn:"updateManyAndReturn",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},bo="explicitly `undefined` values are not allowed";function sn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=qe.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c,wrapRawValues:p}){let d=new on({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c,wrapRawValues:p});return{modelName:e,action:lc[t],query:ht(r,d)}}function ht({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Po(r,n),selection:uc(e,t,i,n)}}function uc(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),mc(e,n)):cc(n,t,r)}function cc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&pc(n,t,e),dc(n,r,e),n}function pc(e,t,r){for(let[n,i]of Object.entries(t)){if(q(i))continue;let o=r.nestSelection(n);if(an(i,o),i===!1||i===void 0){e[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){e[n]=ht(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=ht(i,o)}}function dc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=yo(i,n);for(let[s,a]of Object.entries(o)){if(q(a))continue;an(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function mc(e,t){let r={},n=t.getComputedFields(),i=go(e,n);for(let[o,s]of Object.entries(i)){if(q(s))continue;let a=t.nestSelection(o);an(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||q(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=ht({},a):r[o]=!0;continue}r[o]=ht(s,a)}}return r}function xo(e,t){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(ke(e)){if(Ie(e))return{$type:"DateTime",value:e.toISOString()};t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(ho(e))return{$type:"Param",value:e.name};if(Le(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return fc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:Buffer.from(r,n,i).toString("base64")}}if(gc(e))return e.values;if(Oe(e))return{$type:"Decimal",value:e.toFixed()};if(ac(e)){let r=e._getName();if(r!=="DbNull"&&r!=="JsonNull"&&r!=="AnyNull")throw new Error(`Invalid ObjectEnumValue: expected DbNull, JsonNull, or AnyNull, got ${r}`);return{$type:"Enum",value:r}}if(yc(e))return e.toJSON();if(typeof e=="object")return Po(e,t);t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function Po(e,t){if(t.shouldWrapRawValues()&&e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);q(i)||(i!==void 0?r[n]=xo(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:bo}))}return r}function fc(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||q(o)){let s=o===void 0?"undefined":"Prisma.skip";t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${t.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(xo(o,i))}return r}function gc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function yc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function an(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:bo})}var on=class e{constructor(t){this.params=t;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}modelOrType;throwValidationError(t){nr({errors:[t],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(t=>({name:t.name,typeName:"boolean",isRelation:t.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(t){return this.params.previewFeatures.includes(t)}shouldWrapRawValues(){return this.params.wrapRawValues??!0}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(t){return this.modelOrType?.fields.find(r=>r.name===t)}nestSelection(t){let r=this.findField(t),n=r?.kind==="object"?r.type:void 0;return new e({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(t)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[le(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"updateManyAndReturn":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:ne(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};function hc(e,t){let r=rt(()=>wc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function wc(e){return{datamodel:{models:ln(e.models),enums:ln(e.enums),types:ln(e.types)}}}function ln(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}var un=new WeakMap,sr="$$PrismaTypedSql",wt=class{constructor(t,r){un.set(this,{sql:t,values:r}),Object.defineProperty(this,sr,{value:sr})}get sql(){return un.get(this).sql}get values(){return un.get(this).values}};function bc(e){return(...t)=>new wt(e,t)}function ar(e){return e!=null&&e[sr]===sr}import{Sql as qm}from"@prisma/client-runtime-utils";import{AsyncResource as jm}from"node:async_hooks";import{EventEmitter as Um}from"node:events";function bt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}function F(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}function we(e){let t=new G;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}var lr={enumerable:!0,configurable:!0,writable:!0};function ur(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>lr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var Eo=Symbol.for("nodejs.util.inspect.custom");function J(e,t){let r=xc(t),n=new Set,i=new Proxy(e,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=To(Reflect.ownKeys(o),r),a=To(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...lr,...l?.getPropertyDescriptor(s)}:lr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[Eo]=function(){let o={...this};return delete o[Eo],o},i}function xc(e){let t=new Map;for(let r of e){let n=r.getKeys();for(let i of n)t.set(i,r)}return t}function To(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}function je(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function So(e){if(e===void 0)return"";let t=Ve(e);return new De(0,{colors:Yt}).write(t).toString()}var xt="<unknown>";function vo(e){var t=e.split(`
|
|
18
|
-
`);return t.reduce(function(r,n){var i=Tc(n)||vc(n)||Rc(n)||Nc(n)||Ic(n);return i&&r.push(i),r},[])}var Pc=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ec=/\((\S*)(?::(\d+))(?::(\d+))\)/;function Tc(e){var t=Pc.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=Ec.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||xt,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var Sc=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function vc(e){var t=Sc.exec(e);return t?{file:t[2],methodName:t[1]||xt,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var Ac=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Cc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Rc(e){var t=Ac.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=Cc.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||xt,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var kc=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function Ic(e){var t=kc.exec(e);return t?{file:t[3],methodName:t[1]||xt,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var Oc=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Nc(e){var t=Oc.exec(e);return t?{file:t[2],methodName:t[1]||xt,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var cn=class{getLocation(){return null}},pn=class{_error;constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=vo(t).find(i=>{if(!i.file)return!1;let o=Zr(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/client.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function ce(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new cn:new pn}var Ao={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Ue(e={}){let t=Mc(e);return Object.entries(t).reduce((n,[i,o])=>(Ao[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Mc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function cr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Co(e,t){let r=cr(e);return t({action:"aggregate",unpacker:r,argsMapper:Ue})(e)}function Fc(e={}){let{select:t,...r}=e;return typeof t=="object"?Ue({...r,_count:t}):Ue({...r,_count:{_all:!0}})}function _c(e={}){return typeof e.select=="object"?t=>cr(e)(t)._count:t=>cr(e)(t)._count._all}function Ro(e,t){return t({action:"count",unpacker:_c(e),argsMapper:Fc})(e)}function $c(e={}){let t=Ue(e);if(Array.isArray(t.by))for(let r of t.by)typeof r=="string"&&(t.select[r]=!0);else typeof t.by=="string"&&(t.select[t.by]=!0);return t}function Lc(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ko(e,t){return t({action:"groupBy",unpacker:Lc(e),argsMapper:$c})(e)}function Io(e,t,r){if(t==="aggregate")return n=>Co(n,r);if(t==="count")return n=>Ro(n,r);if(t==="groupBy")return n=>ko(n,r)}function Oo(e,t){let r=t.fields.filter(i=>!i.relationName),n=Ei(r,"name");return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new gt(e,o,s.type,s.isList,s.kind==="enum")},...ur(Object.keys(n))})}var No=e=>Array.isArray(e)?e:e.split("."),dn=(e,t)=>No(t).reduce((r,n)=>r&&r[n],e),Do=(e,t,r)=>No(t).reduceRight((n,i,o,s)=>Object.assign({},dn(e,s.slice(0,o)),{[i]:n}),r);function Vc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function qc(e,t,r){return t===void 0?e??{}:Do(t,r,e||!0)}function mn(e,t,r,n,i,o){let s=e._runtimeDataModel.models[t],a;return l=>{let u=ce(e._errorFormat),c=Vc(n,i),p=qc(l,o,c),d=r({dataPath:c,callsite:u})(p),h=jc(e,t);return new Proxy(d,{get(m,x){if(!h.includes(x))return m[x];a??=Object.fromEntries(s.fields.map(b=>[b.name,b]));let v=[a[x].type,r,x],w=[c,p];return mn(e,...v,...w)},...ur([...h,...Object.getOwnPropertyNames(d)])})}}function jc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var Uc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Bc=["aggregate","count","groupBy"];function fn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Qc(e,t),Hc(e,t),bt(r),F("name",()=>t),F("$name",()=>t),F("$parent",()=>e._appliedParent)];return J({},n)}function Qc(e,t){let r=W(t),n=Object.keys(Ne).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let u=ce(e._errorFormat);return e._createPrismaPromise(c=>{let p={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:c,callsite:u};return e._request({...p,...a})},{action:o,args:l,model:t})};return Uc.includes(o)?mn(e,t,s):Jc(i)?Io(e,i,s):s({})}}}function Jc(e){return Bc.includes(e)}function Hc(e,t){return we(F("fields",()=>{let r=e._runtimeDataModel.models[t];return Oo(t,r)}))}function Mo(e){return e.replace(/^./,t=>t.toUpperCase())}var gn=Symbol();function Pt(e){let t=[Gc(e),zc(e),F(gn,()=>e),F("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(bt(r)),J(e,t)}function Gc(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function zc(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(W),n=[...new Set(t.concat(r))];return we({getKeys(){return n},getPropertyValue(i){let o=Mo(i);if(e._runtimeDataModel.models[o]!==void 0)return fn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return fn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Fo(e){return e[gn]?e[gn]:e}function _o(e){if(typeof e=="function")return e(this);let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$on:{value:void 0}});return Pt(t)}function $o({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(c=>n[c]);u.length>0&&a.push(je(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(c=>!r[c]);u.length>0&&a.push(je(u))}Wc(e,l.needs)&&s.push(Kc(l,J(e,s)))}return s.length>0||a.length>0?J(e,[...s,...a]):e}function Wc(e,t){return t.every(r=>Xr(e,r))}function Kc(e,t){return we(F(e.name,()=>e.compute(t)))}function pr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=pr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Lo({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Lo({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Lo({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||q(s))continue;let l=n.models[r].fields.find(c=>c.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=pr({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function Vo({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:pr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,l,u)=>{let c=W(l);return $o({result:a,modelName:c,select:u.select,omit:u.select?void 0:{...o?.[c],...u.omit},extensions:n})}})}import{Decimal as Xc,isObjectEnumValue as Yc,Sql as jo}from"@prisma/client-runtime-utils";var Zc=["$connect","$disconnect","$on","$use","$extends"],qo=Zc;function Uo(e){if(e instanceof jo)return ep(e);if(ar(e))return tp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Et(e[n]);return r}let t={};for(let r in e)t[r]=Et(e[r]);return t}function ep(e){return new jo(e.strings,e.values)}function tp(e){return new wt(e.sql,e.values)}function Et(e){if(typeof e!="object"||e==null||Yc(e)||Le(e)||q(e))return e;if(Oe(e))return new Xc(e.toFixed());if(ke(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let t=e.length,r;for(r=Array(t);t--;)r[t]=Et(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Et(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Et(e[r]);return t}ne(e,"Unknown value")}function Qo(e,t,r,n=0){return e._createPrismaPromise(i=>{let o=t.customDataProxyFetch;return"transaction"in t&&i!==void 0&&(t.transaction?.kind==="batch"&&t.transaction.lock.then(),t.transaction=i),n===r.length?e._executeRequest(t):r[n]({model:t.model,operation:t.model?t.action:t.clientMethod,args:Uo(t.args??{}),__internalParams:t,query:(s,a=t)=>{let l=a.customDataProxyFetch;return a.customDataProxyFetch=zo(o,l),a.args=s,Qo(e,a,r,n+1)}})})}function Jo(e,t){let{jsModelName:r,action:n,clientMethod:i}=t,o=r?n:i;if(e._extensions.isEmpty())return e._executeRequest(t);let s=e._extensions.getAllQueryCallbacks(r??"$none",o);return Qo(e,t,s)}function Ho(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Go(r,n,0,e):e(r)}}function Go(e,t,r,n){if(r===t.length)return n(e);let i=e.customDataProxyFetch,o=e.requests[0].transaction;return t[r]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:e,query(s,a=e){let l=a.customDataProxyFetch;return a.customDataProxyFetch=zo(i,l),Go(a,t,r+1,n)}})}var Bo=e=>e;function zo(e=Bo,t=Bo){return r=>e(t(r))}function Ko({dataPath:e,modelName:t,args:r,runtimeDataModel:n}){let i={modelName:t,args:r??{}},o=rp(e);if(!o||o.length===0)return i;let s=t,a=r??{};for(let l of o){let u=n.models[s];if(!u)return i;let c=u.fields.find(p=>p.name===l);if(!c)throw new Error(`Could not resolve relation field "${l}" on model "${s}" from dataPath "${e.join(".")}"`);if(c.kind!=="object"||!c.relationName)return i;s=c.type,a=np(a,l)}return{modelName:s,args:a}}function rp(e){let t=[];for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(n!=="select"&&n!=="include"||i===void 0)return;t.push(i)}return t}function np(e,t){let r=e.select?.[t];if(Wo(r))return r;let n=e.include?.[t];return Wo(n)?n:{}}function Wo(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}import{Decimal as ip}from"@prisma/client-runtime-utils";import{Decimal as dr}from"@prisma/client-runtime-utils";function E(e,t){throw new Error(t)}function hn(e,t){return e===t||e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>hn(e[r],t[r]))}function Be(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]==typeof t[o]&&typeof e[o]!="object")return e[o]===t[o];if(dr.isDecimal(e[o])||dr.isDecimal(t[o])){let s=Zo(e[o]),a=Zo(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Xo(e[o]),a=Xo(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Yo(e[o])?.getTime()===Yo(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return es(e[o])===es(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return ts(e[o])===ts(t[o])}return hn(e[o],t[o])})}function Zo(e){return dr.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new dr(e):void 0}function Xo(e){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?Buffer.from(e,"base64"):void 0}function Yo(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function es(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function ts(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function H(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}var yn=8192;function mr(e,t){if(t.length<=yn){e.push(...t);return}for(let r=0;r<t.length;r+=yn)e.push(...t.slice(r,r+yn))}function op(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function sp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function K(e){return e===null?e:Array.isArray(e)?e.map(K):typeof e=="object"?op(e)?ap(e):e.constructor!==null&&e.constructor.name!=="Object"?e:sp(e,K):e}function ap({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return new Uint8Array(Buffer.from(t,"base64"));case"DateTime":return new Date(t);case"Decimal":return new ip(t);case"Json":return JSON.parse(t);case"Raw":return t;case"FieldRef":throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");case"Enum":return t;default:E(t,"Unknown tagged value")}}function fr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}var f={Int32:0,Int64:1,Float:2,Double:3,Numeric:4,Boolean:5,Character:6,Text:7,Date:8,Time:9,DateTime:10,Json:11,Enum:12,Bytes:13,Set:14,Uuid:15,Int32Array:64,Int64Array:65,FloatArray:66,DoubleArray:67,NumericArray:68,BooleanArray:69,CharacterArray:70,TextArray:71,DateArray:72,TimeArray:73,DateTimeArray:74,JsonArray:75,EnumArray:76,BytesArray:77,UuidArray:78,UnknownNumber:128};var I=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function Qe(e){if(!fr(e))throw e;let t=pp(e),r=ns(e);throw t!==void 0&&r!==void 0?new I(r,t,{driverAdapterError:e}):cp(e.cause.kind)?up(e):e}function bn(e){throw fr(e)?lp(e):e}function lp(e){let t=e.cause.originalCode??"N/A",r=rs(e);return new I(`Raw query failed. Code: \`${t}\`. Message: \`${r}\``,"P2010",{driverAdapterError:e})}function up(e){let t=e.cause.originalCode??"N/A",r=rs(e);return new I(`Database error. Code: \`${t}\`. Message: \`${r}\``,"P2039",{driverAdapterError:e})}function rs(e){return e.cause.originalMessage??ns(e)??e.message??"N/A"}function cp(e){switch(e){case"postgres":case"mysql":case"sqlite":case"mssql":return!0;default:return!1}}function pp(e){switch(e.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseNotReachable":return"P1001";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"TlsConnectionError":return"P1011";case"ConnectionClosed":return"P1017";case"TransactionAlreadyClosed":return"P1018";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":case"RestrictViolation":return"P2003";case"InvalidInputValue":return"P2007";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":case"InconsistentColumnData":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":case"mssql":return;default:E(e.cause,`Unknown error: ${H(e.cause)}`)}}function ns(e){switch(e.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${e.cause.user??"(not available)"}\` are not valid`;case"DatabaseNotReachable":{let t=e.cause.host&&e.cause.port?`${e.cause.host}:${e.cause.port}`:e.cause.host;return`Can't reach database server${t?` at ${t}`:""}`}case"DatabaseDoesNotExist":return`Database \`${e.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${e.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${e.cause.db??"(not available)"}\``;case"TlsConnectionError":return`Error opening a TLS connection: ${e.cause.reason}`;case"ConnectionClosed":return"Server has closed the connection.";case"TransactionAlreadyClosed":return e.cause.cause;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${e.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${wn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":case"RestrictViolation":return`Foreign key constraint violated on the ${wn(e.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${e.cause.type}'. If you're using $queryRaw and this column is explicitly marked as \`Unsupported\` in your Prisma schema, try casting this column to any supported Prisma type such as \`String\`.`;case"NullConstraintViolation":return`Null constraint violation on the ${wn(e.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type: ${e.cause.cause}`;case"TableDoesNotExist":return`The table \`${e.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${e.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Error in connector: Conversion error: ${e.cause.level}`;case"InconsistentColumnData":return`Inconsistent column data: ${e.cause.cause}`;case"MissingFullTextSearchIndex":return"Cannot find a fulltext index to use for the native search, try adding a @@fulltext([Fields...]) to your schema";case"TransactionWriteConflict":return"Transaction failed due to a write conflict or a deadlock. Please retry your transaction";case"GenericJs":return`Error in external connector (id ${e.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${e.cause.cause}`;case"InvalidInputValue":return`Invalid input value: ${e.cause.message}`;case"sqlite":case"postgres":case"mysql":case"mssql":return;default:E(e.cause,`Unknown error: ${H(e.cause)}`)}}function wn(e){return e&&"fields"in e?`fields: (${e.fields.map(t=>`\`${t}\``).join(", ")})`:e&&"index"in e?`constraint: \`${e.index}\``:e&&"foreignKey"in e?"foreign key":"(not available)"}function dp(e){if(typeof e!="object"||e===null)return!1;let t=e;return"$type"in t&&t.$type==="Param"||"prisma__type"in t&&t.prisma__type==="param"}function mp(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function fp(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,dp(i)){let o=mp(i);o&&o in t&&(r[n]=t[o])}return r}function is(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=K(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=fp(o,r),a=n.findIndex(l=>Be(l,s));if(a===-1)return t.expectNonEmpty?new I("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let l=Object.entries(e[a]).filter(([u])=>i.has(u));return Object.fromEntries(l)}})}import{Decimal as gp}from"@prisma/client-runtime-utils";var A=class extends I{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},os=new WeakMap;function yp(e){let t=os.get(e);return t||(t=Object.entries(e),os.set(e,t)),t}function as(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new A(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return Pn(e,t.fields,r,t.skipNulls);case"field":return xn(e,"<result>",t.fieldType,r);default:E(t,`Invalid data mapping type: '${t.type}'`)}}function Pn(e,t,r,n){if(e===null)return null;if(Array.isArray(e)){let i=e;return n&&(i=i.filter(o=>o!==null)),i.map(o=>ss(o,t,r))}if(typeof e=="object")return ss(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new A("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Pn(i,t,r,n)}throw new A(`Expected an array or an object, got: ${typeof e}`)}function ss(e,t,r){if(typeof e!="object")throw new A(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of yp(t))switch(o.type){case"affectedRows":throw new A(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:l}=o;if(s!==null&&!Object.hasOwn(e,s))throw new A(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let u=s!==null?e[s]:e;n[i]=Pn(u,a,r,l);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=hp(e[s],s,o.fieldType,r);else throw new A(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:E(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function hp(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>xn(o,`${t}[${s}]`,r,n)):xn(e,t,r,n)}function xn(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new A(`Expected a string in column '${t}', got ${typeof e}: ${e}`);return e}case"int":switch(typeof e){case"number":return Math.trunc(e);case"string":{let i=Math.trunc(Number(e));if(Number.isNaN(i)||!Number.isFinite(i))throw new A(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new A(`Integer value in column '${t}' is too large to represent as a JavaScript number without loss of precision, got: ${e}. Consider using BigInt type.`);return i}default:throw new A(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new A(`Expected a bigint in column '${t}', got ${typeof e}: ${e}`);return{$type:"BigInt",value:e}}case"float":{if(typeof e=="number")return e;if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(e.toLowerCase()))throw new A(`Expected a float in column '${t}', got string: ${e}`);return i}throw new A(`Expected a float in column '${t}', got ${typeof e}: ${e}`)}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="number")return e===1;if(typeof e=="string"){if(e==="true"||e==="TRUE"||e==="1")return!0;if(e==="false"||e==="FALSE"||e==="0")return!1;throw new A(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}if(Array.isArray(e)||e instanceof Uint8Array){for(let i of e)if(i!==0)return!0;return!1}throw new A(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!gp.isDecimal(e))throw new A(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"datetime":{if(typeof e=="string")return{$type:"DateTime",value:bp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new A(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:H(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new A(`Expected a base64-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:e};case"hex":if(typeof e!="string"||!e.startsWith("\\x"))throw new A(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:Buffer.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:Buffer.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:Buffer.from(e).toString("base64")};throw new A(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:E(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new A(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new A(`Value '${e}' not found in enum '${r.name}'`);return o}default:E(r,`DataMapper: Unknown result type: ${r.type}`)}}var wp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function bp(e){let t=wp.exec(e);if(t===null)return`${e}T00:00:00Z`;let r=e,[n,i,o]=t;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${e}:00`:i===void 0&&(r=`${e}Z`),n.length===e.length)return`1970-01-01T${r}`;let s=t.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}function j(e){if(typeof e!="object")return e;var t,r,n=Object.prototype.toString.call(e);if(n==="[object Object]"){if(e.constructor!==Object&&typeof e.constructor=="function"){r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&r[t]!==e[t]&&(r[t]=j(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:j(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=j(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=j(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(j(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(j(o),j(i))}),r):n==="[object Date]"?new Date(+e):n==="[object RegExp]"?(r=new RegExp(e.source,e.flags),r.lastIndex=e.lastIndex,r):n==="[object DataView]"?new e.constructor(j(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function xp(e){let t=Object.entries(e);return t.length===0?"":(t.sort(([n],[i])=>n.localeCompare(i)),`/*${t.map(([n,i])=>{let o=encodeURIComponent(n),s=encodeURIComponent(i).replace(/'/g,"\\'");return`${o}='${s}'`}).join(",")}*/`)}function gr(e,t){let r={};for(let n of e){let i=n(j(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function ls(e,t){let r=gr(e,t);return xp(r)}function us(e,t){return t?`${e} ${t}`:e}var Tt;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Tt||(Tt={}));function Pp(e){switch(e){case"postgresql":case"postgres":case"prisma+postgres":return"postgresql";case"sqlserver":return"mssql";case"mysql":case"sqlite":case"cockroachdb":case"mongodb":return e;default:E(e,`Unknown provider: ${e}`)}}async function yr({query:e,tracingHelper:t,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=performance.now(),l=await i(),u=performance.now();return n({timestamp:s,duration:u-a,query:e.sql,params:e.args}),l};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:Tt.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Pp(r)}},o):o()}function be(e,t){var r="000000000"+e;return r.substr(r.length-t)}import Ep from"node:os";function Tp(){try{return Ep.hostname()}catch{return process.env._CLUSTER_NETWORK_NAME_||process.env.COMPUTERNAME||"hostname"}}var cs=2,Sp=be(process.pid.toString(36),cs),ps=Tp(),vp=ps.length,Ap=be(ps.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+vp+36).toString(36),cs);function En(){return Sp+Ap}function hr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function Tn(e){let n=Math.pow(36,4),i=0;function o(){return be((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var l="c",u=new Date().getTime().toString(36),c=be(s().toString(36),4),p=e(),d=o()+o();return l+u+c+p+d}return a.fingerprint=e,a.isCuid=hr,a}var Cp=Tn(En);var ds=Cp;var ca=ge(ra());import{webcrypto as ia}from"node:crypto";var na="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var md=128,Pe,Ge;function fd(e){!Pe||Pe.length<e?(Pe=Buffer.allocUnsafe(e*md),ia.getRandomValues(Pe),Ge=0):Ge+e>Pe.length&&(ia.getRandomValues(Pe),Ge=0),Ge+=e}function Nn(e=21){fd(e|=0);let t="";for(let r=Ge-e;r<Ge;r++)t+=na[Pe[r]&63];return t}import Pr from"node:crypto";var sa="0123456789ABCDEFGHJKMNPQRSTVWXYZ",kt=32;var gd=16,aa=10,oa=0xffffffffffff;var Ee;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(Ee||(Ee={}));var Te=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function yd(e){let t=Math.floor(e()*kt);return t===kt&&(t=kt-1),sa.charAt(t)}function hd(e){let t=wd(),r=t&&(t.crypto||t.msCrypto)||(typeof Pr<"u"?Pr:null);if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;if(Pr?.randomBytes)return()=>Pr.randomBytes(1).readUInt8()/255;throw new Te(Ee.PRNGDetectFailure,"Failed to find a reliable PRNG")}function wd(){return Pd()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function bd(e,t){let r="";for(;e>0;e--)r=yd(t)+r;return r}function xd(e,t=aa){if(isNaN(e))throw new Te(Ee.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>oa)throw new Te(Ee.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${oa}: ${e}`);if(e<0)throw new Te(Ee.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new Te(Ee.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%kt,n=sa.charAt(r)+n,e=(e-r)/kt;return n}function Pd(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function la(e,t){let r=t||hd(),n=!e||isNaN(e)?Date.now():e;return xd(n,aa)+bd(gd,r)}var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));function Er(e,t=0){return(O[e[t+0]]+O[e[t+1]]+O[e[t+2]]+O[e[t+3]]+"-"+O[e[t+4]]+O[e[t+5]]+"-"+O[e[t+6]]+O[e[t+7]]+"-"+O[e[t+8]]+O[e[t+9]]+"-"+O[e[t+10]]+O[e[t+11]]+O[e[t+12]]+O[e[t+13]]+O[e[t+14]]+O[e[t+15]]).toLowerCase()}var Ed=new Uint8Array(16);function ze(){return crypto.getRandomValues(Ed)}function Td(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Sd(e,t,r)}function Sd(e,t,r){e=e||{};let n=e.random??e.rng?.()??ze();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Er(n)}var Dn=Td;var Mn={};function vd(e,t,r){let n;if(e)n=ua(e.random??e.rng?.()??ze(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=ze();Ad(Mn,i,o),n=ua(o,Mn.msecs,Mn.seq,t,r)}return t??Er(n)}function Ad(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function ua(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var Fn=vd;var Tr=class{#e={};constructor(){this.register("uuid",new $n),this.register("cuid",new Ln),this.register("ulid",new Vn),this.register("nanoid",new qn),this.register("product",new jn)}snapshot(){return Object.create(this.#e,{now:{value:new _n}})}register(t,r){this.#e[t]=r}},_n=class{#e;generate(){return this.#e===void 0&&(this.#e=new Date),this.#e.toISOString()}},$n=class{generate(t){if(t===4)return Dn();if(t===7)return Fn();throw new Error("Invalid UUID generator arguments")}},Ln=class{generate(t){if(t===1)return ds();if(t===2)return(0,ca.createId)();throw new Error("Invalid CUID generator arguments")}},Vn=class{generate(){return la()}},qn=class{generate(t){if(typeof t=="number")return Nn(t);if(t===void 0)return Nn();throw new Error("Invalid Nanoid generator arguments")}},jn=class{generate(t,r){if(t===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(t)&&Array.isArray(r)?t.flatMap(n=>r.map(i=>[n,i])):Array.isArray(t)?t.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[t,n]):[[t,r]]}};function Sr(e,t){return e==null?e:typeof e=="string"?Sr(JSON.parse(e),t):Array.isArray(e)?Rd(e,t):Cd(e,t)}function Cd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!Be(e,i))return null}return da(e,t.nested)}function da(e,t){for(let[r,n]of Object.entries(t))e[r]=Sr(e[r],n);return e}function Rd(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=kd(e,r)}return t.pagination&&(e=Id(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>da(r,t.nested))}function kd(e,t){let r=new Set,n=[];for(let i of e){let o=We(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function Id(e,t,r){if(r===null)return pa(e,t);let n=new Map;for(let o of e){let s=We(o,r);n.has(s)||n.set(s,[]),n.get(s).push(o)}let i=Array.from(n.entries());return i.sort(([o],[s])=>o<s?-1:o>s?1:0),i.flatMap(([,o])=>pa(o,t))}function pa(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>Be(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function We(e,t,r){let n=t.map((i,o)=>r?.[o]?e[i]!==null?r[o](e[i]):null:e[i]);return JSON.stringify(n)}function Un(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function Bn(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Hn(e,t,r,n){let i=e.args.map(o=>U(o,t,r));switch(e.type){case"rawSql":return[Dd(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?Fd(e.fragments,i,n):[i]).map(s=>{let a=Od(e.fragments,e.placeholderFormat,s,e.argTypes);if(n!==void 0&&a.args.length>n)throw new I("The query parameter limit supported by your database is exceeded.","P2029");return a});default:E(e.type,"Invalid query type")}}function U(e,t,r){for(;Md(e);)if(Un(e)){let n=t[e.prisma__value.name];if(n===void 0)throw new Error(`Missing value for query variable ${e.prisma__value.name}`);e.prisma__value.type==="DateTime"&&typeof n=="string"?e=new Date(n):e=n}else if(Bn(e)){let{name:n,args:i}=e.prisma__value,o=r[n];if(!o)throw new Error(`Encountered an unknown generator '${n}'`);e=o.generate(...i.map(s=>U(s,t,r)))}else E(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>U(n,t,r))),e}function Od(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let l of Jn(e,r,n)){if(i+=Nd(l,t,o),l.type==="stringChunk")continue;let u=Array.from(ma(l)),c=u.length;if(mr(s,u),l.argType.arity==="tuple"){if(c%l.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${c} parameters for a tuple of arity ${l.argType.elements.length}.`);for(let p=0;p<c/l.argType.elements.length;p++)a.push(...l.argType.elements)}else for(let p=0;p<c;p++)a.push(l.argType)}return{sql:i,args:s,argTypes:a}}function Nd(e,t,r){let n=e.type;switch(n){case"parameter":return Qn(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>{let o=Qn(t,r.placeholderNumber++);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.itemSeparator)})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Qn(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:E(n,"Invalid fragment type")}}function Qn(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function Dd(e,t,r){return{sql:e,args:t,argTypes:r}}function Md(e){return Un(e)||Bn(e)}function*Jn(e,t,r){let n=0;for(let i of e)switch(i.type){case"parameter":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);yield{...i,value:t[n],argType:r?.[n]},n++;break}case"stringChunk":{yield i;break}case"parameterTuple":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);let o=t[n];yield{...i,value:Array.isArray(o)?o:[o],argType:r?.[n]},n++;break}case"parameterTupleList":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);let o=t[n];if(!Array.isArray(o))throw new Error("Malformed query template. Tuple list expected.");if(o.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");for(let s of o)if(!Array.isArray(s))throw new Error("Malformed query template. Tuple expected.");yield{...i,value:o,argType:r?.[n]},n++;break}}}function*ma(e){switch(e.type){case"parameter":yield e.value;break;case"stringChunk":break;case"parameterTuple":yield*e.value;break;case"parameterTupleList":for(let t of e.value)yield*t;break}}function Fd(e,t,r){let n=0,i=0;for(let s of Jn(e,t,void 0)){let a=0;for(let l of ma(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of Jn(e,t,void 0))switch(s.type){case"parameter":{for(let a of o)a.push(s.value);break}case"stringChunk":break;case"parameterTuple":{let a=s.value.length,l=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let u=r-(n-a);l=_d(s.value,u)}else l=[s.value];o=o.flatMap(u=>l.map(c=>[...u,c]));break}case"parameterTupleList":{let a=s.value.reduce((p,d)=>p+d.length,0),l=[],u=[],c=0;for(let p of s.value)r&&o.length===1&&a===i&&u.length>0&&n-a+c+p.length>r&&(l.push(u),u=[],c=0),u.push(p),c+=p.length;u.length>0&&l.push(u),o=o.flatMap(p=>l.map(d=>[...p,d]));break}}return o}function _d(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function fa(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function ga(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>$d(t)),rows:e.rows.map(t=>t.map((r,n)=>It(r,e.columnTypes[n])))}}function It(e,t){if(e===null)return null;switch(t){case f.Int32:switch(typeof e){case"number":return Math.trunc(e);case"string":return Math.trunc(Number(e));default:throw new Error(`Cannot serialize value of type ${typeof e} as Int32`)}case f.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>It(r,f.Int32));case f.Int64:switch(typeof e){case"number":return BigInt(Math.trunc(e));case"string":return e;default:throw new Error(`Cannot serialize value of type ${typeof e} as Int64`)}case f.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>It(r,f.Int64));case f.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case f.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>It(r,f.Json));case f.Boolean:switch(typeof e){case"boolean":return e;case"string":return e==="true"||e==="1";case"number":return e===1;default:throw new Error(`Cannot serialize value of type ${typeof e} as Boolean`)}case f.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>It(r,f.Boolean));default:return e}}function $d(e){switch(e){case f.Int32:return"int";case f.Int64:return"bigint";case f.Float:return"float";case f.Double:return"double";case f.Text:return"string";case f.Enum:return"enum";case f.Bytes:return"bytes";case f.Boolean:return"bool";case f.Character:return"char";case f.Numeric:return"decimal";case f.Json:return"json";case f.Uuid:return"uuid";case f.DateTime:return"datetime";case f.Date:return"date";case f.Time:return"time";case f.Int32Array:return"int-array";case f.Int64Array:return"bigint-array";case f.FloatArray:return"float-array";case f.DoubleArray:return"double-array";case f.TextArray:return"string-array";case f.EnumArray:return"string-array";case f.BytesArray:return"bytes-array";case f.BooleanArray:return"bool-array";case f.CharacterArray:return"char-array";case f.NumericArray:return"decimal-array";case f.JsonArray:return"json-array";case f.UuidArray:return"uuid-array";case f.DateTimeArray:return"datetime-array";case f.DateArray:return"date-array";case f.TimeArray:return"time-array";case f.UnknownNumber:return"unknown";case f.Set:return"string";default:E(e,`Unexpected column type: ${e}`)}}function ya(e,t,r){if(!t.every(n=>Gn(e,n))){let n=Ld(e,r),i=Vd(r);throw new I(n,i,r.context)}}function Gn(e,t){switch(t.type){case"rowCountEq":return Array.isArray(e)?e.length===t.args:e===null?t.args===0:t.args===1;case"rowCountNeq":return Array.isArray(e)?e.length!==t.args:e===null?t.args!==0:t.args!==1;case"affectedRowCountEq":return e===t.args;case"never":return!1;default:E(t,`Unknown rule type: ${t.type}`)}}function Ld(e,t){switch(t.errorIdentifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${t.context.relation}' between the \`${t.context.modelA}\` and \`${t.context.modelB}\` models.`;case"MISSING_RECORD":return`An operation failed because it depends on one or more records that were required but not found. No record was found for ${t.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=t.context.neededFor?` (needed to ${t.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${t.context.model}' record${r} was found for ${t.context.operation} on ${t.context.relationType} relation '${t.context.relation}'.`}case"INCOMPLETE_CONNECT_INPUT":return`An operation failed because it depends on one or more records that were required but not found. Expected ${t.context.expectedRows} records to be connected, found only ${Array.isArray(e)?e.length:e}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${t.context.expectedRows} records to be connected after connect operation on ${t.context.relationType} relation '${t.context.relation}', found ${Array.isArray(e)?e.length:e}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${t.context.relation}\` between the \`${t.context.parent}\` and \`${t.context.child}\` models are not connected.`;default:E(t,`Unknown error identifier: ${t}`)}}function Vd(e){switch(e.errorIdentifier){case"RELATION_VIOLATION":return"P2014";case"RECORDS_NOT_CONNECTED":return"P2017";case"INCOMPLETE_CONNECT_OUTPUT":return"P2018";case"MISSING_RECORD":case"MISSING_RELATED_RECORD":case"INCOMPLETE_CONNECT_INPUT":return"P2025";default:E(e,`Unknown error identifier: ${e}`)}}var Ot=class e{#e;#t=new Tr;#r;#n;#i;#o;#s;constructor({onQuery:t,tracingHelper:r,serializer:n,rawSerializer:i,provider:o,connectionInfo:s}){this.#e=t,this.#r=r,this.#n=n,this.#i=i??n,this.#o=o,this.#s=s}static forSql(t){return new e({onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:fa,rawSerializer:ga,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let{value:n}=await this.interpretNode(t,{...r,generators:this.#t.snapshot()}).catch(i=>Qe(i));return n}async interpretNode(t,r){switch(t.type){case"value":return{value:U(t.args,r.scope,r.generators)};case"seq":{let n;for(let i of t.args)n=await this.interpretNode(i,r);return n??{value:void 0}}case"get":return{value:r.scope[t.args.name]};case"let":{let n=Object.create(r.scope);for(let i of t.args.bindings){let{value:o}=await this.interpretNode(i.expr,{...r,scope:n});n[i.name]=o}return this.interpretNode(t.args.expr,{...r,scope:n})}case"getFirstNonEmpty":{for(let n of t.args.names){let i=r.scope[n];if(!ha(i))return{value:i}}return{value:[]}}case"concat":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>i.concat(zn(o)),[]):[]}}case"sum":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>Z(i)+Z(o)):0}}case"execute":{let n=Hn(t.args,r.scope,r.generators,this.#a()),i=0;for(let o of n){let s=wa(o,r.sqlCommenter);i+=await this.#l(s,r.queryable,()=>r.queryable.executeRaw(Wn(s)).catch(a=>t.args.type==="rawSql"?bn(a):Qe(a)))}return{value:i}}case"query":{let n=Hn(t.args,r.scope,r.generators,this.#a()),i;for(let o of n){let s=wa(o,r.sqlCommenter),a=await this.#l(s,r.queryable,()=>r.queryable.queryRaw(Wn(s)).catch(l=>t.args.type==="rawSql"?bn(l):Qe(l)));i===void 0?i=a:(mr(i.rows,a.rows),i.lastInsertId=a.lastInsertId)}return{value:t.args.type==="rawSql"?this.#i(i):this.#n(i),lastInsertId:i?.lastInsertId}}case"reverse":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);return{value:Array.isArray(n)?n.reverse():n,lastInsertId:i}}case"unique":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);if(!Array.isArray(n))return{value:n,lastInsertId:i};if(n.length>1)throw new Error(`Expected zero or one element, got ${n.length}`);return{value:n[0]??null,lastInsertId:i}}case"required":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);if(ha(n))throw new Error("Required value is empty");return{value:n,lastInsertId:i}}case"mapField":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.records,r);return{value:ba(n,t.args.field),lastInsertId:i}}case"join":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.parent,r);if(n===null)return{value:null,lastInsertId:i};let o=await Promise.all(t.args.children.map(async s=>({joinExpr:s,childRecords:(await this.interpretNode(s.child,r)).value})));return{value:qd(n,o,t.args.canAssumeStrictEquality),lastInsertId:i}}case"transaction":{if(!r.transactionManager.enabled)return this.interpretNode(t.args,r);let n=r.transactionManager.manager,i=await n.startInternalTransaction(),o=await n.getTransaction(i,"query");try{let s=await this.interpretNode(t.args,{...r,queryable:o});return await n.commitTransaction(i.id),s}catch(s){throw await n.rollbackTransaction(i.id),s}}case"dataMap":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:as(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return ya(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Gn(n,t.args.rule)?await this.interpretNode(t.args.then,r):await this.interpretNode(t.args.else,r)}case"unit":return{value:void 0};case"diff":{let{value:n}=await this.interpretNode(t.args.from,r),{value:i}=await this.interpretNode(t.args.to,r),o=a=>a!==null?We(Nt(a),t.args.fields):null,s=new Set(zn(i).map(o));return{value:zn(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r),o=Wn(t.args.operations);return xa(o,r.scope,r.generators),{value:Sr(n,o),lastInsertId:i}}case"initializeRecord":{let{lastInsertId:n}=await this.interpretNode(t.args.expr,r),i={};for(let[o,s]of Object.entries(t.args.fields))i[o]=Ud(s,n,r.scope,r.generators);return{value:i,lastInsertId:n}}case"mapRecord":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r),o=n===null?{}:Nt(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=Bd(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:E(t,`Unexpected node type: ${t.type}`)}}#a(){return this.#s?.maxBindValues!==void 0?this.#s.maxBindValues:this.#u()}#u(){if(this.#o!==void 0)switch(this.#o){case"cockroachdb":case"postgres":case"postgresql":case"prisma+postgres":return 32766;case"mysql":return 65535;case"sqlite":return 999;case"sqlserver":return 2098;case"mongodb":return;default:E(this.#o,`Unexpected provider: ${this.#o}`)}}#l(t,r,n){return yr({query:t,execute:n,provider:this.#o??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function ha(e){return Array.isArray(e)?e.length===0:e==null}function zn(e){return Array.isArray(e)?e:[e]}function Z(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Nt(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function ba(e,t){return Array.isArray(e)?e.map(r=>ba(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function qd(e,t,r){for(let{joinExpr:n,childRecords:i}of t){let o=n.on.map(([c])=>c),s=n.on.map(([,c])=>c),a={},l=Array.isArray(e)?e:[e];for(let c of l){let p=Nt(c),d=We(p,o);a[d]||(a[d]=[]),a[d].push(p),n.isRelationUnique?p[n.parentField]=null:p[n.parentField]=[]}let u=r?void 0:jd(l,o);for(let c of Array.isArray(i)?i:[i]){if(c===null)continue;let p=We(Nt(c),s,u);for(let d of a[p]??[])n.isRelationUnique?d[n.parentField]=c:d[n.parentField].push(c)}}return e}function jd(e,t){function r(o){switch(o){case"number":return Number;case"string":return String;case"boolean":return Boolean;case"bigint":return BigInt;default:return}}let n=Array.from({length:t.length}),i=0;for(let o of e){let s=Nt(o);for(let[a,l]of t.entries())if(s[l]!==null&&n[a]===void 0){let u=r(typeof s[l]);u!==void 0&&(n[a]=u),i++}if(i===t.length)break}return n}function Ud(e,t,r,n){switch(e.type){case"value":return U(e.value,r,n);case"lastInsertId":return t;default:E(e,`Unexpected field initializer type: ${e.type}`)}}function Bd(e,t,r,n){switch(e.type){case"set":return U(e.value,r,n);case"add":return Z(t)+Z(U(e.value,r,n));case"subtract":return Z(t)-Z(U(e.value,r,n));case"multiply":return Z(t)*Z(U(e.value,r,n));case"divide":{let i=Z(t),o=Z(U(e.value,r,n));return o===0?null:i/o}default:E(e,`Unexpected field operation type: ${e.type}`)}}function wa(e,t){if(!t||t.plugins.length===0)return e;let r=ls(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:us(e.sql,r)}:e}function xa(e,t,r){let n=e.pagination?.cursor;if(n)for(let[i,o]of Object.entries(n))n[i]=U(o,t,r);for(let i of Object.values(e.nested))xa(i,t,r)}function Wn(e){return j(e)}function Pa(e){return new Kn(e).deserialize()}function Qd(e){return Buffer.from(e,"base64url")}var Kn=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=Qd(t.graph);this.#t=new DataView(r.buffer,r.byteOffset,r.byteLength)}deserialize(){let{inputNodeCount:t,outputNodeCount:r,rootCount:n}=this.#a(),i=this.#u(t),o=this.#l(r),s=this.#p(n);return{strings:this.#e.strings,inputNodes:i,outputNodes:o,roots:s}}#n(){let t=0,r=0,n;do n=this.#t.getUint8(this.#r++),t|=(n&127)<<r,r+=7;while(n>=128);return t}#i(){let t=this.#n();return t===0?void 0:t-1}#o(){let t=this.#t.getUint8(this.#r);return this.#r+=1,t}#s(){let t=this.#t.getUint16(this.#r,!0);return this.#r+=2,t}#a(){let t=this.#n(),r=this.#n(),n=this.#n();return{inputNodeCount:t,outputNodeCount:r,rootCount:n}}#u(t){let r=[];for(let n=0;n<t;n++){let i=this.#n(),o={};for(let s=0;s<i;s++){let a=this.#n(),l=this.#s(),u=this.#i(),c=this.#i(),d={flags:this.#o()};l!==0&&(d.scalarMask=l),u!==void 0&&(d.childNodeId=u),c!==void 0&&(d.enumNameIndex=c),o[a]=d}r.push({edges:o})}return r}#l(t){let r=[];for(let n=0;n<t;n++){let i=this.#n(),o={};for(let s=0;s<i;s++){let a=this.#n(),l=this.#i(),u=this.#i(),c={};l!==void 0&&(c.argsNodeId=l),u!==void 0&&(c.outputNodeId=u),o[a]=c}r.push({edges:o})}return r}#p(t){let r={};for(let n=0;n<t;n++){let i=this.#n(),o=this.#i(),s=this.#i(),a=this.#e.strings[i],l={};o!==void 0&&(l.argsNodeId=o),s!==void 0&&(l.outputNodeId=s),r[a]=l}return r}};var Dt=class e{#e;#t;#r;constructor(t,r){this.#e=t,this.#r=r,this.#t=new Map;for(let n=0;n<t.strings.length;n++)this.#t.set(t.strings[n],n)}static deserialize(t,r){let n=Pa(t);return new e(n,r)}static fromData(t,r){return new e(t,r)}root(t){let r=this.#e.roots[t];if(r)return{argsNodeId:r.argsNodeId,outputNodeId:r.outputNodeId}}inputNode(t){if(!(t===void 0||t<0||t>=this.#e.inputNodes.length))return{id:t}}outputNode(t){if(!(t===void 0||t<0||t>=this.#e.outputNodes.length))return{id:t}}inputEdge(t,r){if(!t)return;let n=this.#e.inputNodes[t.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{flags:o.flags,childNodeId:o.childNodeId,scalarMask:o.scalarMask??0,enumNameIndex:o.enumNameIndex}}outputEdge(t,r){if(!t)return;let n=this.#e.outputNodes[t.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{argsNodeId:o.argsNodeId,outputNodeId:o.outputNodeId}}enumValues(t){if(t?.enumNameIndex===void 0)return;let r=this.#e.strings[t.enumNameIndex];if(r)return this.#r(r)}getString(t){return this.#e.strings[t]}},X={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},N={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Y(e,t){return(e.flags&t)!==0}function fe(e){return e.scalarMask}var Jd=new Set(["DateTime","Decimal","BigInt","Bytes","Json","Raw"]);function vr(e){if(e==null)return{kind:"null"};if(typeof e=="string")return{kind:"primitive",value:e};if(typeof e=="number")return{kind:"primitive",value:e};if(typeof e=="boolean")return{kind:"primitive",value:e};if(Array.isArray(e))return{kind:"array",items:e};if(typeof e=="object"){let t=e;if("$type"in t&&typeof t.$type=="string"){let r=t.$type;return Jd.has(r)?{kind:"taggedScalar",tag:r,value:t.value}:{kind:"structural",value:t.value}}return{kind:"object",entries:t}}return{kind:"structural",value:e}}function Ea(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("$type"in e)}function Ta(e){return typeof e=="object"&&e!==null&&"$type"in e&&typeof e.$type=="string"}function Zn(e,t){let r=new Ar(t),n=e.modelName?`${e.modelName}.${e.action}`:e.action,i=t.root(n);return{parameterizedQuery:{...e,query:r.parameterizeFieldSelection(e.query,i?.argsNodeId,i?.outputNodeId)},placeholderValues:r.getPlaceholderValues()}}function Xn(e,t){let r=new Ar(t),n=[];for(let i=0;i<e.batch.length;i++){let o=e.batch[i],s=o.modelName?`${o.modelName}.${o.action}`:o.action,a=t.root(s);n.push({...o,query:r.parameterizeFieldSelection(o.query,a?.argsNodeId,a?.outputNodeId)})}return{parameterizedBatch:{...e,batch:n},placeholderValues:r.getPlaceholderValues()}}var Ar=class{#e;#t=new Map;#r=new Map;#n=1;constructor(t){this.#e=t}getPlaceholderValues(){return Object.fromEntries(this.#t)}#i(t,r){let n=Gd(t,r),i=this.#r.get(n);if(i!==void 0)return Sa(i,r);let o=`%${this.#n++}`;return this.#r.set(n,o),this.#t.set(o,t),Sa(o,r)}parameterizeFieldSelection(t,r,n){let i=this.#e.inputNode(r),o=this.#e.outputNode(n),s={...t};return t.arguments&&t.arguments.$type!=="Raw"&&(s.arguments=this.#o(t.arguments,i)),t.selection&&(s.selection=this.#c(t.selection,o)),s}#o(t,r){if(!r)return t;let n={};for(let[i,o]of Object.entries(t)){let s=this.#e.inputEdge(r,i);s?n[i]=this.#s(o,s):n[i]=o}return n}#s(t,r){let n=vr(t);switch(n.kind){case"null":return t;case"structural":return t;case"primitive":return this.#a(n.value,r);case"taggedScalar":return this.#u(t,n.tag,r);case"array":return this.#l(n.items,t,r);case"object":return this.#p(n.entries,r);default:throw new Error(`Unknown value kind ${n.kind}`)}}#a(t,r){if(Y(r,X.ParamEnum)&&r.enumNameIndex!==void 0&&typeof t=="string"){let o=this.#e.enumValues(r);if(o&&Object.hasOwn(o,t)){let s={type:"Enum"};return this.#i(o[t],s)}}if(!Y(r,X.ParamScalar))return t;let n=fe(r);if(n===0)return t;let i=Yn(t);return Aa(i,n)?(n&N.Json&&(t=JSON.stringify(t)),this.#i(t,i)):t}#u(t,r,n){if(!Y(n,X.ParamScalar))return t;let i=fe(n);if(i===0||!Ra(r,i))return t;let o=Ca(t.$type),s=ka(t);return this.#i(s,o)}#l(t,r,n){if(Y(n,X.ParamScalar)&&fe(n)&N.Json){let i=H(K(t)),o={type:"Json"};return this.#i(i,o)}if(Y(n,X.ParamEnum)){let i=this.#e.enumValues(n);if(i&&t.every(o=>typeof o=="string"&&Object.hasOwn(i,o))){let o={type:"List",inner:{type:"Enum"}};return this.#i(t,o)}}if(Y(n,X.ParamListScalar)&&t.every(o=>Xd(o,n))&&t.length>0){let o=t.map(l=>Yd(l)),a={type:"List",inner:Kd(t)};return this.#i(o,a)}if(Y(n,X.ListObject)){let i=this.#e.inputNode(n.childNodeId);if(i)return t.map(o=>Ea(o)?this.#o(o,i):o)}return r}#p(t,r){if(Y(r,X.Object)){let i=this.#e.inputNode(r.childNodeId);if(i)return this.#o(t,i)}if(fe(r)&N.Json){let i=H(K(t)),o={type:"Json"};return this.#i(i,o)}return t}#c(t,r){if(!t||!r)return t;let n={};for(let[i,o]of Object.entries(t)){if(i==="$scalars"||i==="$composites"||typeof o=="boolean"){n[i]=o;continue}let s=this.#e.outputEdge(r,i);if(s){let a=o,l=this.#e.inputNode(s.argsNodeId),u=this.#e.outputNode(s.outputNodeId),c={selection:a.selection?this.#c(a.selection,u):{}};a.arguments&&(c.arguments=this.#o(a.arguments,l)),n[i]=c}else n[i]=o}return n}};function Sa(e,t){return{$type:"Param",value:{name:e,...t}}}function va(e){return e.type==="List"?`List<${va(e.inner)}>`:e.type}function Hd(e){return ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"):JSON.stringify(e)}function Gd(e,t){let r=va(t),n=Hd(e);return`${r}:${n}`}var zd=2**31-1,Wd=-(2**31);function Yn(e){switch(typeof e){case"boolean":return{type:"Boolean"};case"number":return Number.isInteger(e)?Wd<=e&&e<=zd?{type:"Int"}:{type:"BigInt"}:{type:"Float"};case"string":return{type:"String"};default:throw new Error("unreachable")}}function Aa({type:e},t){switch(e){case"Boolean":return(t&N.Boolean)!==0;case"Int":return(t&(N.Int|N.BigInt|N.Float))!==0;case"BigInt":return(t&N.BigInt)!==0;case"Float":return(t&N.Float)!==0;case"String":return(t&N.String)!==0;default:return!1}}function Ca(e){switch(e){case"BigInt":case"Bytes":case"DateTime":case"Json":return{type:e};case"Decimal":return{type:"Float"};default:return}}function Kd(e){let t={type:"Any"};for(let r of e){let n=vr(r),i;switch(n.kind){case"primitive":i=Yn(n.value);break;case"taggedScalar":i=Ca(n.tag)??{type:"Any"};break;default:return{type:"Any"}}t=Zd(t,i)}return t}function Zd(e,t){if(e.type==="Any")return t;if(t.type==="Any"||e.type===t.type)return e;let r={Int:0,BigInt:1,Float:2},n=r[e.type],i=r[t.type];return n!==void 0&&i!==void 0?n>=i?e:t:{type:"Any"}}function Ra(e,t){switch(e){case"DateTime":return(t&N.DateTime)!==0;case"Decimal":return(t&N.Decimal)!==0;case"BigInt":return(t&N.BigInt)!==0;case"Bytes":return(t&N.Bytes)!==0;case"Json":return(t&N.Json)!==0;default:return!1}}function Xd(e,t){let r=vr(e);switch(r.kind){case"structural":return!1;case"null":return!1;case"primitive":{let n=Yn(r.value),i=fe(t);return i!==0&&Aa(n,i)}case"taggedScalar":{let n=fe(t);return n!==0&&Ra(r.tag,n)}default:return!1}}function Yd(e){return Ta(e)?ka(e):e}function ka(e){return e.value}async function em(){return globalThis.crypto??await import("node:crypto")}async function Ia(){return(await em()).randomUUID()}async function Oa(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}var $=class extends I{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Se=class extends ${constructor(){super("Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting.")}},Cr=class extends ${constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},Rr=class extends ${constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},Mt=class extends ${constructor(){super("Unable to start a transaction in the given time.")}},kr=class extends ${constructor(t,{timeout:r,timeTaken:n}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${r} ms, however ${n} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.`,{operation:t,timeout:r,timeTaken:n})}},ee=class extends ${constructor(t){super(`Internal Consistency Error: ${t}`)}},Ir=class extends ${constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var tm=100,rm=2e3;function nm(){let e,t=new Promise(r=>{e=r});return{abortController:new AbortController,settled:t,markSettled:e}}var Ke=M("prisma:client:transactionManager"),im=()=>({sql:"COMMIT",args:[],argTypes:[]}),Na=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),om=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),sm=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Ft=class{transactions=new Map;closedTransactions=[];#e=new Set;driverAdapter;transactionOptions;tracingHelper;#t;#r;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#r=o}async startInternalTransaction(t){let r=t!==void 0?this.#y(t):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#n(r))}async startTransaction(t){let r=t!==void 0?this.#y(t):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#n(r))}async#n(t){if(t.newTxId)return await this.#d(t.newTxId,"start",async o=>{if(o.status!=="running")throw new ee(`Transaction in invalid state ${o.status} when starting a nested transaction.`);if(!o.transaction)throw new ee("Transaction missing underlying driver transaction when starting a nested transaction.");o.depth+=1;let s=this.#s(o);o.savepoints.push(s);try{await this.#a(o.transaction)(s)}catch(a){throw o.depth-=1,o.savepoints.pop(),a}return{id:o.id}});let r=nm(),{abortController:n}=r;this.#e.add(r);let i;try{let o={id:await Ia(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0,operationQueue:Promise.resolve(),depth:1,savepoints:[],savepointCounter:0};if(n.signal.aborted)throw new Mt;let s=Da(()=>n.abort(),t.maxWait);s?.unref?.();let a=this.driverAdapter.startTransaction(t.isolationLevel).catch(Qe);switch(o.transaction=await Promise.race([a.finally(()=>clearTimeout(s)),Oa(n.signal,"abort").then(()=>{})]),this.transactions.set(o.id,o),o.status){case"waiting":if(n.signal.aborted)throw o.transaction=void 0,i=this.#i(a),await this.#f(o,"timed_out"),new Mt;return o.status="running",o.startedAt=Date.now(),o.timer=this.#c(o.id,t.timeout),{id:o.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new ee(`Transaction in invalid state ${o.status} although it just finished startup.`);default:return E(o.status,"Unknown transaction status.")}}finally{this.#e.delete(r),i?i.finally(r.markSettled):r.markSettled()}}async#i(t){try{let r=await t;if(r.options.usePhantomQuery)await r.rollback();else try{await r.executeRaw(Na())}finally{await r.rollback()}}catch(r){Ke("error in discarded transaction:",r)}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{await this.#d(t,"commit",async r=>{if(r.depth>1){if(!r.transaction)throw new Se;let n=r.savepoints.at(-1);if(!n)throw new ee(`Missing savepoint for nested commit. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#l(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"committed")})})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{await this.#d(t,"rollback",async r=>{if(r.depth>1){if(!r.transaction)throw new Se;let n=r.savepoints.at(-1);if(!n)throw new ee(`Missing savepoint for nested rollback. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#u(r.transaction)(n),await this.#l(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"rolled_back")})})}async getTransaction(t,r){let n=this.#o(t.id,r);if(n.status==="closing"&&(await n.closing,n=this.#o(t.id,r)),!n.transaction)throw new Se;return n.transaction}#o(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(Ke("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new ee("Active transaction found in closed transactions list.");case"committed":throw new Cr(r);case"rolled_back":throw new Rr(r);case"timed_out":throw new kr(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw Ke("Transaction not found.",t),new Se}if(["committed","rolled_back","timed_out"].includes(n.status))throw new ee("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){let t=[...this.#e];for(let{abortController:r}of t)r.abort();await Promise.allSettled([...[...this.transactions.values()].map(r=>this.#m(r,async()=>{let n=this.transactions.get(r.id);n&&await this.#f(n,"rolled_back")})),...t.map(({settled:r})=>am(r,rm))])}#s(t){return`prisma_sp_${t.savepointCounter++}`}#a(t){if(t.createSavepoint)return t.createSavepoint.bind(t);throw new $(`Nested transactions are not supported by adapter "${t.adapterName}" (${t.provider}): createSavepoint is not implemented.`)}#u(t){if(t.rollbackToSavepoint)return t.rollbackToSavepoint.bind(t);throw new $(`Nested transactions are not supported by adapter "${t.adapterName}" (${t.provider}): rollbackToSavepoint is not implemented.`)}async#l(t,r){t.releaseSavepoint&&await t.releaseSavepoint(r)}#p(t){Ke("Transaction already committed or rolled back when timeout happened.",t)}#c(t,r){let n=Date.now(),i=Da(async()=>{Ke("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);if(!o){this.#p(t);return}await this.#m(o,async()=>{let s=this.transactions.get(t);s&&["running","waiting"].includes(s.status)?await this.#f(s,"timed_out"):this.#p(t)})},r);return i?.unref?.(),i}async#d(t,r,n){let i=this.#o(t,r);return await this.#m(i,async()=>{let o=this.#o(t,r);return await n(o)})}async#m(t,r){let n=t.operationQueue,i;t.operationQueue=new Promise(o=>{i=o}),await n;try{return await r()}finally{i()}}async#f(t,r){let n=async()=>{Ke("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#g(om(),t.transaction,()=>t.transaction.commit());else{let i=im();await this.#g(i,t.transaction,()=>t.transaction.executeRaw(i)).then(()=>t.transaction.commit(),o=>{let s=()=>Promise.reject(o);return t.transaction.rollback().then(s,s)})}else if(t.transaction)if(t.transaction.options.usePhantomQuery)await this.#g(sm(),t.transaction,()=>t.transaction.rollback());else{let i=Na();try{await this.#g(i,t.transaction,()=>t.transaction.executeRaw(i))}finally{await t.transaction.rollback()}}}finally{t.status=r,clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>tm&&this.closedTransactions.shift()}};t.status==="closing"?(await t.closing,this.#o(t.id,r==="committed"?"commit":"rollback")):await Object.assign(t,{status:"closing",reason:r,closing:n()}).closing}#y(t){if(!t.timeout)throw new $("timeout is required");if(!t.maxWait)throw new $("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new Ir(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#g(t,r,n){return yr({query:t,execute:n,provider:this.#r??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function Da(e,t){return t!==void 0?setTimeout(e,t):void 0}function am(e,t){let r,n=new Promise(i=>{r=setTimeout(i,t),r?.unref?.()});return Promise.race([e,n]).finally(()=>clearTimeout(r))}import{PrismaClientInitializationError as ni,PrismaClientKnownRequestError as ii,PrismaClientRustPanicError as _t,PrismaClientUnknownRequestError as Xa}from"@prisma/client-runtime-utils";var Or="7.10.0-dev.21";var Ma={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function _a(e){let t;try{t=JSON.parse(e)}catch(i){throw new Error(`Received invalid serialized parameters: ${i.message}`)}if(!Array.isArray(t))throw new Error("Received invalid serialized parameters: expected an array");let r=t.map(i=>$a(i)),n=t.map(i=>um(i));return{args:r,argTypes:n}}function $a(e){if(Array.isArray(e))return e.map(t=>$a(t));if(typeof e=="object"&&e!==null&&"prisma__value"in e){if(!("prisma__type"in e))throw new Error("Invalid serialized parameter, prisma__type should be present when prisma__value is present");return`${e.prisma__value}`}return typeof e=="object"&&e!==null?JSON.stringify(e):e}function um(e){return Array.isArray(e)?{scalarType:e.length>0?Fa(e[0]):"unknown",arity:"list"}:{scalarType:Fa(e),arity:"scalar"}}function Fa(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in Ma?Ma[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}function La(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}function Va(e){return e?e.replace(/"(?:[^"\\]|\\.)*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function qa(e){return e.split(`
|
|
13
|
+
`)}};var Cu={red:he,gray:ut,dim:ot,bold:Q,underline:st,highlightSource:e=>e.highlight()},Iu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function ku({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function Ou({callsite:e,message:t,originalMethod:r,isPanic:n,callArguments:i},o){let s=ku({message:t,originalMethod:r,isPanic:n,callArguments:i});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let a=e.getLocation();if(!a||!a.lineNumber||!a.columnNumber)return s;let l=Math.max(1,a.lineNumber-3),u=Xt.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=Du(c),d=Nu(c);if(!d)return s;s.functionName=`${d.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,m=>m.slice(0,d.openingBraceIndex))),u=o.highlightSource(u);let h=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((m,x)=>o.gray(String(x).padStart(h))+" "+m).mapLines(m=>o.dim(m)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let m=p+h+1;m+=2,s.callArguments=(0,to.default)(i,m).slice(m)}}return s}function Nu(e){let t=Object.keys(Fe).join("|"),n=new RegExp(String.raw`\.(${t})\(`).exec(e);if(n){let i=n.index+n[0].length,o=e.lastIndexOf(" ",n.index)+1;return{code:e.slice(o,i),openingBraceIndex:i}}return null}function Du(e){let t=0;for(let r=0;r<e.length;r++){if(e.charAt(r)!==" ")return t;t++}return t}function Mu({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=t?" in":":";if(n?(a.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),a.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${l}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${l}`)),t&&a.push(s.underline(Fu(t))),i){a.push("");let u=[i.toString()];o&&(u.push(o),u.push(s.dim(")"))),a.push(u.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
|
|
14
|
+
`)}function Fu(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function Yt(e){let t=e.showColors?Cu:Iu,r;return r=Ou(e,t),Mu(r,t)}var co=ye(sn());function oo(e,t,r){let n=so(e),i=_u(n),o=Lu(i);o?er(o,t,r):t.addErrorMessage(()=>"Unknown error")}function so(e){return e.errors.flatMap(t=>t.kind==="Union"?so(t):[t])}function _u(e){let t=new Map,r=[];for(let n of e){if(n.kind!=="InvalidArgumentType"){r.push(n);continue}let i=`${n.selectionPath.join(".")}:${n.argumentPath.join(".")}`,o=t.get(i);o?t.set(i,{...n,argument:{...n.argument,typeNames:$u(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function $u(e,t){return[...new Set(e.concat(t))]}function Lu(e){return on(e,(t,r)=>{let n=no(t),i=no(r);return n!==i?n-i:io(t)-io(r)})}function no(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function io(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var V=class{constructor(t,r){this.name=t;this.value=r}isRequired=!1;makeRequired(){return this.isRequired=!0,this}write(t){let{colors:{green:r}}=t.context;t.addMarginSymbol(r(this.isRequired?"+":"?")),t.write(r(this.name)),this.isRequired||t.write(r("?")),t.write(r(": ")),typeof this.value=="string"?t.write(r(this.value)):t.write(this.value)}};lo();var _e=class{constructor(t=0,r){this.context=r;this.currentIndent=t}lines=[];currentLine="";currentIndent=0;marginSymbol;afterNextNewLineCallback;write(t){return typeof t=="string"?this.currentLine+=t:t.write(this),this}writeJoined(t,r,n=(i,o)=>o.write(i)){let i=r.length-1;for(let o=0;o<r.length;o++)n(r[o],this),o!==i&&this.write(t);return this}writeLine(t){return this.write(t).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let t=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,t?.(),this}withIndent(t){return this.indent(),t(this),this.unindent(),this}afterNextNewline(t){return this.afterNextNewLineCallback=t,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(t){return this.marginSymbol=t,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
|
|
15
|
+
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let t=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+t.slice(1):t}};ao();var tr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};var rr=e=>e,nr={bold:rr,red:rr,green:rr,dim:rr,enabled:!1},uo={bold:Q,red:he,green:at,dim:ot,enabled:!0},$e={write(e){e.writeLine(",")}};var W=class{constructor(t){this.contents=t}isUnderlined=!1;color=t=>t;underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};var ue=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var Le=class extends ue{items=[];addItem(t){return this.items.push(new tr(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 W("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined($e,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Ve=class e extends ue{fields={};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 o=i;for(let s of n){let a;if(o.value instanceof e?a=o.value.getField(s):o.value instanceof Le&&(a=o.value.getField(Number(s))),!a)return;o=a}return o}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 o=n.value.getFieldValue(i);if(!o||!(o instanceof e))return;let s=o.getSelectionParent();if(!s)return;n=s}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 W("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined($e,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};var I=class extends ue{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new W(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};var gt=class{fields=[];addField(t,r){return this.fields.push({write(n){let{green:i,dim:o}=n.context.colors;n.write(i(o(`${t}: ${r}`))).addMarginSymbol(i(o("+")))}}),this}write(t){let{colors:{green:r}}=t.context;t.writeLine(r("{")).withIndent(()=>{t.writeJoined($e,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function er(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Vu(e,t);break;case"IncludeOnScalar":qu(e,t);break;case"EmptySelection":ju(e,t,r);break;case"UnknownSelectionField":Ju(e,t);break;case"InvalidSelectionValue":Hu(e,t);break;case"UnknownArgument":Gu(e,t);break;case"UnknownInputField":zu(e,t);break;case"RequiredArgumentMissing":Wu(e,t);break;case"InvalidArgumentType":Ku(e,t);break;case"InvalidArgumentValue":Zu(e,t);break;case"ValueTooLarge":Xu(e,t);break;case"SomeFieldsMissing":Yu(e,t);break;case"TooManyFieldsGiven":ec(e,t);break;case"Union":oo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function Vu(e,t){let r=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&(r.getField(e.firstField)?.markAsError(),r.getField(e.secondField)?.markAsError()),t.addErrorMessage(n=>`Please ${n.bold("either")} use ${n.green(`\`${e.firstField}\``)} or ${n.green(`\`${e.secondField}\``)}, but ${n.red("not both")} at the same time.`)}function qu(e,t){let[r,n]=qe(e.selectionPath),i=e.outputType,o=t.arguments.getDeepSelectionParent(r)?.value;if(o&&(o.getField(n)?.markAsError(),i))for(let s of i.fields)s.isRelation&&o.addSuggestion(new V(s.name,"true"));t.addErrorMessage(s=>{let a=`Invalid scalar field ${s.red(`\`${n}\``)} for ${s.bold("include")} statement`;return i?a+=` on model ${s.bold(i.name)}. ${yt(s)}`:a+=".",a+=`
|
|
16
|
+
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function ju(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){Uu(e,t,i);return}if(n.hasField("select")){Bu(e,t);return}}if(r?.[le(e.outputType.name)]){Qu(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function Uu(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new V(n.name,"false"));t.addErrorMessage(n=>`The ${n.red("omit")} statement includes every field of the model ${n.bold(e.outputType.name)}. At least one field must be included in the result`)}function Bu(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),fo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${yt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Qu(e,t){let r=new gt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new V("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=qe(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new Ve;l.addSuggestion(n),a.value=l}}t.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(e.outputType.name)}. At least one field must be included in the result`)}function Ju(e,t){let r=go(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":fo(n,e.outputType);break;case"include":tc(n,e.outputType);break;case"omit":rc(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(yt(n)),i.join(" ")})}function Hu(e,t){let r=go(e.selectionPath,t);r.parentKind!=="unknown"&&r.field.value.markAsError(),t.addErrorMessage(n=>`Invalid value for selection field \`${n.red(r.fieldName)}\`: ${e.underlyingError}`)}function Gu(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),nc(n,e.arguments)),t.addErrorMessage(i=>po(i,r,e.arguments.map(o=>o.name)))}function zu(e,t){let[r,n]=qe(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&yo(o,e.inputType)}t.addErrorMessage(o=>po(o,n,e.inputType.fields.map(s=>s.name)))}function po(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=oc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(yt(e)),n.join(" ")}function Wu(e,t){let r;t.addErrorMessage(l=>r?.value instanceof I&&r.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=qe(e.argumentPath),s=new gt,a=n.getDeepFieldValue(i)?.asObject();if(a){if(r=a.getField(o),r&&a.removeField(o),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new V(o,s).makeRequired())}else{let l=e.inputTypes.map(mo).join(" | ");a.addSuggestion(new V(o,l).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,l]=qe(e.dependentArgumentPath);t.addErrorMessage(u=>`Argument \`${u.green(o)}\` is required because argument \`${u.green(l)}\` was provided.`)}}}function mo(e){return e.kind==="list"?`${mo(e.elementType)}[]`:e.name}function Ku(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentPath)?.markAsError(),t.addErrorMessage(i=>{let o=ir("or",e.argument.typeNames.map(s=>i.green(s)));return`Argument \`${i.bold(r)}\`: Invalid value provided. Expected ${o}, provided ${i.red(e.inferredType)}.`})}function Zu(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentPath)?.markAsError(),t.addErrorMessage(i=>{let o=[`Invalid value for argument \`${i.bold(r)}\``];if(e.underlyingError&&o.push(`: ${e.underlyingError}`),o.push("."),e.argument.typeNames.length>0){let s=ir("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function Xu(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i;if(n){let s=n.getDeepField(e.argumentPath)?.value;s?.markAsError(),s instanceof I&&(i=s.text)}t.addErrorMessage(o=>{let s=["Unable to fit value"];return i&&s.push(o.red(i)),s.push(`into a 64-bit signed integer for field \`${o.bold(r)}\``),s.join(" ")})}function Yu(e,t){let r=e.argumentPath[e.argumentPath.length-1],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getDeepFieldValue(e.argumentPath)?.asObject();i&&yo(i,e.inputType)}t.addErrorMessage(i=>{let o=[`Argument \`${i.bold(r)}\` of type ${i.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1?e.constraints.requiredFields?o.push(`${i.green("at least one of")} ${ir("or",e.constraints.requiredFields.map(s=>`\`${i.bold(s)}\``))} arguments.`):o.push(`${i.green("at least one")} argument.`):o.push(`${i.green(`at least ${e.constraints.minFieldCount}`)} arguments.`),o.push(yt(i)),o.join(" ")})}function ec(e,t){let r=e.argumentPath[e.argumentPath.length-1],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i=[];if(n){let o=n.getDeepFieldValue(e.argumentPath)?.asObject();o&&(o.markAsError(),i=Object.keys(o.getFields()))}t.addErrorMessage(o=>{let s=[`Argument \`${o.bold(r)}\` of type ${o.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1&&e.constraints.maxFieldCount==1?s.push(`${o.green("exactly one")} argument,`):e.constraints.maxFieldCount==1?s.push(`${o.green("at most one")} argument,`):s.push(`${o.green(`at most ${e.constraints.maxFieldCount}`)} arguments,`),s.push(`but you provided ${ir("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function fo(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new V(r.name,"true"))}function tc(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new V(r.name,"true"))}function rc(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new V(r.name,"true"))}function nc(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new V(r.name,r.typeNames.join(" | ")))}function go(e,t){let[r,n]=qe(e),i=t.arguments.getDeepSubSelectionValue(r)?.asObject();if(!i)return{parentKind:"unknown",fieldName:n};let o=i.getFieldValue("select")?.asObject(),s=i.getFieldValue("include")?.asObject(),a=i.getFieldValue("omit")?.asObject(),l=o?.getField(n);return o&&l?{parentKind:"select",parent:o,field:l,fieldName:n}:(l=s?.getField(n),s&&l?{parentKind:"include",field:l,parent:s,fieldName:n}:(l=a?.getField(n),a&&l?{parentKind:"omit",field:l,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function yo(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new V(r.name,r.typeNames.join(" | ")))}function qe(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function yt({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function ir(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var ic=3;function oc(e,t){let r=1/0,n;for(let i of t){let o=(0,co.default)(e,i);o>ic||o<r&&(r=o,n=i)}return n}import{isObjectEnumValue as sc}from"@prisma/client-runtime-utils";var ht=class{modelName;name;typeName;isList;isEnum;constructor(t,r,n,i,o){this.modelName=t,this.name=r,this.typeName=n,this.isList=i,this.isEnum=o}_toGraphQLInputType(){let t=this.isList?"List":"",r=this.isEnum?"Enum":"";return`${t}${r}${this.typeName}FieldRefInput<${this.modelName}>`}};function je(e){return e instanceof ht}var ho=": ",or=class{constructor(t,r){this.name=t;this.value=r}hasError=!1;markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+ho.length}write(t){let r=new W(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(ho).write(this.value)}};var ln=class{arguments;errorMessages=[];constructor(t){this.arguments=t}write(t){t.write(this.arguments)}addErrorMessage(t){this.errorMessages.push(t)}renderAllMessages(t){return this.errorMessages.map(r=>r(t)).join(`
|
|
17
|
+
`)}};function Ue(e){return new ln(wo(e))}function wo(e){let t=new Ve;for(let[r,n]of Object.entries(e)){let i=new or(r,bo(n));t.addField(i)}return t}function bo(e){if(typeof e=="string")return new I(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new I(String(e));if(typeof e=="bigint")return new I(`${e}n`);if(e===null)return new I("null");if(e===void 0)return new I("undefined");if(Me(e))return new I(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new I(`Buffer.alloc(${e.byteLength})`):new I(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=De(e)?e.toISOString():"Invalid Date";return new I(`new Date("${t}")`)}return sc(e)?new I(`Prisma.${e._getName()}`):je(e)?new I(`prisma.${le(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?ac(e):typeof e=="object"?wo(e):new I(Object.prototype.toString.call(e))}function ac(e){let t=new Le;for(let r of e)t.addItem(bo(r));return t}function sr(e,t){let r=t==="pretty"?uo:nr,n=e.renderAllMessages(r),i=new _e(0,{colors:r}).write(e).toString();return{message:n,args:i}}function ar({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=Ue(e);for(let p of t)er(p,a,s);let{message:l,args:u}=sr(a,r),c=Yt({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:u});throw new lc(c,{clientVersion:o})}function K(e){return e.replace(/^./,t=>t.toLowerCase())}function Po(e,t,r){let n=K(r);return!t.result||!(t.result.$allModels||t.result[n])?e:uc({...e,...xo(t.name,e,t.result.$allModels),...xo(t.name,e,t.result[n])})}function uc(e){let t=new z,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Wt(e,n=>({...n,needs:r(n.name,new Set)}))}function xo(e,t,r){return r?Wt(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:cc(t,o,i)})):{}}function cc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function Eo(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function To(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var lr=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new z;modelExtensionsCache=new z;queryCallbacksCache=new z;clientExtensions=it(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=it(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Po(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=K(t);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(t):{...this.previous?.getAllModelExtensions(t),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(t,r){return this.queryCallbacksCache.getOrCreate(`${t}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(t,r)??[],i=[],o=this.extension.query;return!o||!(o[t]||o.$allModels||o[r]||o.$allOperations)?n:(o[t]!==void 0&&(o[t][r]!==void 0&&i.push(o[t][r]),o[t].$allOperations!==void 0&&i.push(o[t].$allOperations)),t!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Be=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new lr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new lr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var ur=class{constructor(t){this.name=t}};function vo(e){return e instanceof ur}function pc(e){return new ur(e)}var So=Symbol(),wt=class{constructor(t){if(t!==So)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?un:t}},un=new wt(So);function j(e){return e instanceof wt}var mc={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",updateManyAndReturn:"updateManyAndReturn",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},Ao="explicitly `undefined` values are not allowed";function pn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=Be.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c,wrapRawValues:p}){let d=new cn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c,wrapRawValues:p});return{modelName:e,action:mc[t],query:bt(r,d)}}function bt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Co(r,n),selection:fc(e,t,i,n)}}function fc(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),wc(e,n)):gc(n,t,r)}function gc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&yc(n,t,e),hc(n,r,e),n}function yc(e,t,r){for(let[n,i]of Object.entries(t)){if(j(i))continue;let o=r.nestSelection(n);if(dn(i,o),i===!1||i===void 0){e[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){e[n]=bt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=bt(i,o)}}function hc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=To(i,n);for(let[s,a]of Object.entries(o)){if(j(a))continue;dn(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function wc(e,t){let r={},n=t.getComputedFields(),i=Eo(e,n);for(let[o,s]of Object.entries(i)){if(j(s))continue;let a=t.nestSelection(o);dn(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||j(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=bt({},a):r[o]=!0;continue}r[o]=bt(s,a)}}return r}function Ro(e,t){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(Ne(e)){if(De(e))return{$type:"DateTime",value:e.toISOString()};t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(vo(e))return{$type:"Param",value:e.name};if(je(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return bc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:Buffer.from(r,n,i).toString("base64")}}if(xc(e))return e.values;if(Me(e))return{$type:"Decimal",value:e.toFixed()};if(dc(e)){let r=e._getName();if(r!=="DbNull"&&r!=="JsonNull"&&r!=="AnyNull")throw new Error(`Invalid ObjectEnumValue: expected DbNull, JsonNull, or AnyNull, got ${r}`);return{$type:"Enum",value:r}}if(Pc(e))return e.toJSON();if(typeof e=="object")return Co(e,t);t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function Co(e,t){if(t.shouldWrapRawValues()&&e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);j(i)||(i!==void 0?r[n]=Ro(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:Ao}))}return r}function bc(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||j(o)){let s=o===void 0?"undefined":"Prisma.skip";t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${t.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(Ro(o,i))}return r}function xc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function Pc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function dn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:Ao})}var cn=class e{constructor(t){this.params=t;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}modelOrType;throwValidationError(t){ar({errors:[t],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(t=>({name:t.name,typeName:"boolean",isRelation:t.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(t){return this.params.previewFeatures.includes(t)}shouldWrapRawValues(){return this.params.wrapRawValues??!0}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(t){return this.modelOrType?.fields.find(r=>r.name===t)}nestSelection(t){let r=this.findField(t),n=r?.kind==="object"?r.type:void 0;return new e({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(t)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[le(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"updateManyAndReturn":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:ne(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};function Ec(e,t){let r=it(()=>Tc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Tc(e){return{datamodel:{models:mn(e.models),enums:mn(e.enums),types:mn(e.types)}}}function mn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}var fn=new WeakMap,cr="$$PrismaTypedSql",xt=class{constructor(t,r){fn.set(this,{sql:t,values:r}),Object.defineProperty(this,cr,{value:cr})}get sql(){return fn.get(this).sql}get values(){return fn.get(this).values}};function vc(e){return(...t)=>new xt(e,t)}function pr(e){return e!=null&&e[cr]===cr}import{Sql as Bm}from"@prisma/client-runtime-utils";import{AsyncResource as Qm}from"node:async_hooks";import{EventEmitter as Jm}from"node:events";function Pt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}function F(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}function be(e){let t=new z;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}var dr={enumerable:!0,configurable:!0,writable:!0};function mr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>dr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var Io=Symbol.for("nodejs.util.inspect.custom");function H(e,t){let r=Sc(t),n=new Set,i=new Proxy(e,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=ko(Reflect.ownKeys(o),r),a=ko(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...dr,...l?.getPropertyDescriptor(s)}:dr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[Io]=function(){let o={...this};return delete o[Io],o},i}function Sc(e){let t=new Map;for(let r of e){let n=r.getKeys();for(let i of n)t.set(i,r)}return t}function ko(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}function Qe(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function Oo(e){if(e===void 0)return"";let t=Ue(e);return new _e(0,{colors:nr}).write(t).toString()}var Et="<unknown>";function No(e){var t=e.split(`
|
|
18
|
+
`);return t.reduce(function(r,n){var i=Cc(n)||kc(n)||Dc(n)||$c(n)||Fc(n);return i&&r.push(i),r},[])}var Ac=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rc=/\((\S*)(?::(\d+))(?::(\d+))\)/;function Cc(e){var t=Ac.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=Rc.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||Et,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var Ic=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function kc(e){var t=Ic.exec(e);return t?{file:t[2],methodName:t[1]||Et,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var Oc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Nc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Dc(e){var t=Oc.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=Nc.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||Et,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var Mc=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function Fc(e){var t=Mc.exec(e);return t?{file:t[3],methodName:t[1]||Et,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var _c=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function $c(e){var t=_c.exec(e);return t?{file:t[2],methodName:t[1]||Et,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var gn=class{getLocation(){return null}},yn=class{_error;constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=No(t).find(i=>{if(!i.file)return!1;let o=rn(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/client.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function ce(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new gn:new yn}var Do={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Je(e={}){let t=Vc(e);return Object.entries(t).reduce((n,[i,o])=>(Do[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Vc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function fr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Mo(e,t){let r=fr(e);return t({action:"aggregate",unpacker:r,argsMapper:Je})(e)}function qc(e={}){let{select:t,...r}=e;return typeof t=="object"?Je({...r,_count:t}):Je({...r,_count:{_all:!0}})}function jc(e={}){return typeof e.select=="object"?t=>fr(e)(t)._count:t=>fr(e)(t)._count._all}function Fo(e,t){return t({action:"count",unpacker:jc(e),argsMapper:qc})(e)}function Uc(e={}){let t=Je(e);if(Array.isArray(t.by))for(let r of t.by)typeof r=="string"&&(t.select[r]=!0);else typeof t.by=="string"&&(t.select[t.by]=!0);return t}function Bc(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function _o(e,t){return t({action:"groupBy",unpacker:Bc(e),argsMapper:Uc})(e)}function $o(e,t,r){if(t==="aggregate")return n=>Mo(n,r);if(t==="count")return n=>Fo(n,r);if(t==="groupBy")return n=>_o(n,r)}function Lo(e,t){let r=t.fields.filter(i=>!i.relationName),n=Ii(r,"name");return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new ht(e,o,s.type,s.isList,s.kind==="enum")},...mr(Object.keys(n))})}var Vo=e=>Array.isArray(e)?e:e.split("."),hn=(e,t)=>Vo(t).reduce((r,n)=>r&&r[n],e),qo=(e,t,r)=>Vo(t).reduceRight((n,i,o,s)=>Object.assign({},hn(e,s.slice(0,o)),{[i]:n}),r);function Qc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function Jc(e,t,r){return t===void 0?e??{}:qo(t,r,e||!0)}function wn(e,t,r,n,i,o){let s=e._runtimeDataModel.models[t],a;return l=>{let u=ce(e._errorFormat),c=Qc(n,i),p=Jc(l,o,c),d=r({dataPath:c,callsite:u})(p),h=Hc(e,t);return new Proxy(d,{get(m,x){if(!h.includes(x))return m[x];a??=Object.fromEntries(s.fields.map(b=>[b.name,b]));let S=[a[x].type,r,x],w=[c,p];return wn(e,...S,...w)},...mr([...h,...Object.getOwnPropertyNames(d)])})}}function Hc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var Gc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],zc=["aggregate","count","groupBy"];function bn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Wc(e,t),Zc(e,t),Pt(r),F("name",()=>t),F("$name",()=>t),F("$parent",()=>e._appliedParent)];return H({},n)}function Wc(e,t){let r=K(t),n=Object.keys(Fe).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let u=ce(e._errorFormat);return e._createPrismaPromise(c=>{let p={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:c,callsite:u};return e._request({...p,...a})},{action:o,args:l,model:t})};return Gc.includes(o)?wn(e,t,s):Kc(i)?$o(e,i,s):s({})}}}function Kc(e){return zc.includes(e)}function Zc(e,t){return be(F("fields",()=>{let r=e._runtimeDataModel.models[t];return Lo(t,r)}))}function jo(e){return e.replace(/^./,t=>t.toUpperCase())}var xn=Symbol();function Tt(e){let t=[Xc(e),Yc(e),F(xn,()=>e),F("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Pt(r)),H(e,t)}function Xc(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function Yc(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(K),n=[...new Set(t.concat(r))];return be({getKeys(){return n},getPropertyValue(i){let o=jo(i);if(e._runtimeDataModel.models[o]!==void 0)return bn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return bn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Uo(e){return e[xn]?e[xn]:e}function Bo(e){if(typeof e=="function")return e(this);let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$on:{value:void 0}});return Tt(t)}function Qo({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(c=>n[c]);u.length>0&&a.push(Qe(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(c=>!r[c]);u.length>0&&a.push(Qe(u))}ep(e,l.needs)&&s.push(tp(l,H(e,s)))}return s.length>0||a.length>0?H(e,[...s,...a]):e}function ep(e,t){return t.every(r=>nn(e,r))}function tp(e,t){return be(F(e.name,()=>e.compute(t)))}function gr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=gr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Jo({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Jo({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Jo({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||j(s))continue;let l=n.models[r].fields.find(c=>c.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=gr({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function Ho({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:gr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,l,u)=>{let c=K(l);return Qo({result:a,modelName:c,select:u.select,omit:u.select?void 0:{...o?.[c],...u.omit},extensions:n})}})}import{Decimal as np,isObjectEnumValue as ip,Sql as zo}from"@prisma/client-runtime-utils";var rp=["$connect","$disconnect","$on","$use","$extends"],Go=rp;function Wo(e){if(e instanceof zo)return op(e);if(pr(e))return sp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=vt(e[n]);return r}let t={};for(let r in e)t[r]=vt(e[r]);return t}function op(e){return new zo(e.strings,e.values)}function sp(e){return new xt(e.sql,e.values)}function vt(e){if(typeof e!="object"||e==null||ip(e)||je(e)||j(e))return e;if(Me(e))return new np(e.toFixed());if(Ne(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let t=e.length,r;for(r=Array(t);t--;)r[t]=vt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:vt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=vt(e[r]);return t}ne(e,"Unknown value")}function Zo(e,t,r,n=0){return e._createPrismaPromise(i=>{let o=t.customDataProxyFetch;return"transaction"in t&&i!==void 0&&(t.transaction?.kind==="batch"&&t.transaction.lock.then(),t.transaction=i),n===r.length?e._executeRequest(t):r[n]({model:t.model,operation:t.model?t.action:t.clientMethod,args:Wo(t.args??{}),__internalParams:t,query:(s,a=t)=>{let l=a.customDataProxyFetch;return a.customDataProxyFetch=ts(o,l),a.args=s,Zo(e,a,r,n+1)}})})}function Xo(e,t){let{jsModelName:r,action:n,clientMethod:i}=t,o=r?n:i;if(e._extensions.isEmpty())return e._executeRequest(t);let s=e._extensions.getAllQueryCallbacks(r??"$none",o);return Zo(e,t,s)}function Yo(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?es(r,n,0,e):e(r)}}function es(e,t,r,n){if(r===t.length)return n(e);let i=e.customDataProxyFetch,o=e.requests[0].transaction;return t[r]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:e,query(s,a=e){let l=a.customDataProxyFetch;return a.customDataProxyFetch=ts(i,l),es(a,t,r+1,n)}})}var Ko=e=>e;function ts(e=Ko,t=Ko){return r=>e(t(r))}function ns({dataPath:e,modelName:t,args:r,runtimeDataModel:n}){let i={modelName:t,args:r??{}},o=ap(e);if(!o||o.length===0)return i;let s=t,a=r??{};for(let l of o){let u=n.models[s];if(!u)return i;let c=u.fields.find(p=>p.name===l);if(!c)throw new Error(`Could not resolve relation field "${l}" on model "${s}" from dataPath "${e.join(".")}"`);if(c.kind!=="object"||!c.relationName)return i;s=c.type,a=lp(a,l)}return{modelName:s,args:a}}function ap(e){let t=[];for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(n!=="select"&&n!=="include"||i===void 0)return;t.push(i)}return t}function lp(e,t){let r=e.select?.[t];if(rs(r))return r;let n=e.include?.[t];return rs(n)?n:{}}function rs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}import{Decimal as up}from"@prisma/client-runtime-utils";import{Decimal as yr}from"@prisma/client-runtime-utils";function E(e,t){throw new Error(t)}function En(e,t){return e===t||e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>En(e[r],t[r]))}function He(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]==typeof t[o]&&typeof e[o]!="object")return e[o]===t[o];if(yr.isDecimal(e[o])||yr.isDecimal(t[o])){let s=is(e[o]),a=is(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=os(e[o]),a=os(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return ss(e[o])?.getTime()===ss(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return as(e[o])===as(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return ls(e[o])===ls(t[o])}return En(e[o],t[o])})}function is(e){return yr.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new yr(e):void 0}function os(e){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?Buffer.from(e,"base64"):void 0}function ss(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function as(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function ls(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function G(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}var Pn=8192;function hr(e,t){if(t.length<=Pn){e.push(...t);return}for(let r=0;r<t.length;r+=Pn)e.push(...t.slice(r,r+Pn))}function cp(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function pp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function Z(e){return e===null?e:Array.isArray(e)?e.map(Z):typeof e=="object"?cp(e)?dp(e):e.constructor!==null&&e.constructor.name!=="Object"?e:pp(e,Z):e}function dp({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return new Uint8Array(Buffer.from(t,"base64"));case"DateTime":return new Date(t);case"Decimal":return new up(t);case"Json":return JSON.parse(t);case"Raw":return t;case"FieldRef":throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");case"Enum":return t;default:E(t,"Unknown tagged value")}}function wr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}var f={Int32:0,Int64:1,Float:2,Double:3,Numeric:4,Boolean:5,Character:6,Text:7,Date:8,Time:9,DateTime:10,Json:11,Enum:12,Bytes:13,Set:14,Uuid:15,Int32Array:64,Int64Array:65,FloatArray:66,DoubleArray:67,NumericArray:68,BooleanArray:69,CharacterArray:70,TextArray:71,DateArray:72,TimeArray:73,DateTimeArray:74,JsonArray:75,EnumArray:76,BytesArray:77,UuidArray:78,UnknownNumber:128};var k=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function pe(e){if(!wr(e))throw e;let t=yp(e),r=cs(e);throw t!==void 0&&r!==void 0?new k(r,t,{driverAdapterError:e}):gp(e.cause.kind)?fp(e):e}function vn(e){throw wr(e)?mp(e):e}function mp(e){let t=e.cause.originalCode??"N/A",r=us(e);return new k(`Raw query failed. Code: \`${t}\`. Message: \`${r}\``,"P2010",{driverAdapterError:e})}function fp(e){let t=e.cause.originalCode??"N/A",r=us(e);return new k(`Database error. Code: \`${t}\`. Message: \`${r}\``,"P2039",{driverAdapterError:e})}function us(e){return e.cause.originalMessage??cs(e)??e.message??"N/A"}function gp(e){switch(e){case"postgres":case"mysql":case"sqlite":case"mssql":return!0;default:return!1}}function yp(e){switch(e.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseNotReachable":return"P1001";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"TlsConnectionError":return"P1011";case"ConnectionClosed":return"P1017";case"TransactionAlreadyClosed":return"P1018";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":case"RestrictViolation":return"P2003";case"InvalidInputValue":return"P2007";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":case"InconsistentColumnData":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":case"mssql":return;default:E(e.cause,`Unknown error: ${G(e.cause)}`)}}function cs(e){switch(e.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${e.cause.user??"(not available)"}\` are not valid`;case"DatabaseNotReachable":{let t=e.cause.host&&e.cause.port?`${e.cause.host}:${e.cause.port}`:e.cause.host;return`Can't reach database server${t?` at ${t}`:""}`}case"DatabaseDoesNotExist":return`Database \`${e.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${e.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${e.cause.db??"(not available)"}\``;case"TlsConnectionError":return`Error opening a TLS connection: ${e.cause.reason}`;case"ConnectionClosed":return"Server has closed the connection.";case"TransactionAlreadyClosed":return e.cause.cause;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${e.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${Tn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":case"RestrictViolation":return`Foreign key constraint violated on the ${Tn(e.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${e.cause.type}'. If you're using $queryRaw and this column is explicitly marked as \`Unsupported\` in your Prisma schema, try casting this column to any supported Prisma type such as \`String\`.`;case"NullConstraintViolation":return`Null constraint violation on the ${Tn(e.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type: ${e.cause.cause}`;case"TableDoesNotExist":return`The table \`${e.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${e.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Error in connector: Conversion error: ${e.cause.level}`;case"InconsistentColumnData":return`Inconsistent column data: ${e.cause.cause}`;case"MissingFullTextSearchIndex":return"Cannot find a fulltext index to use for the native search, try adding a @@fulltext([Fields...]) to your schema";case"TransactionWriteConflict":return"Transaction failed due to a write conflict or a deadlock. Please retry your transaction";case"GenericJs":return`Error in external connector (id ${e.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${e.cause.cause}`;case"InvalidInputValue":return`Invalid input value: ${e.cause.message}`;case"sqlite":case"postgres":case"mysql":case"mssql":return;default:E(e.cause,`Unknown error: ${G(e.cause)}`)}}function Tn(e){return e&&"fields"in e?`fields: (${e.fields.map(t=>`\`${t}\``).join(", ")})`:e&&"index"in e?`constraint: \`${e.index}\``:e&&"foreignKey"in e?"foreign key":"(not available)"}function hp(e){if(typeof e!="object"||e===null)return!1;let t=e;return"$type"in t&&t.$type==="Param"||"prisma__type"in t&&t.prisma__type==="param"}function wp(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function bp(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,hp(i)){let o=wp(i);o&&o in t&&(r[n]=t[o])}return r}function ps(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=Z(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=bp(o,r),a=n.findIndex(l=>He(l,s));if(a===-1)return t.expectNonEmpty?new k("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let l=Object.entries(e[a]).filter(([u])=>i.has(u));return Object.fromEntries(l)}})}import{Decimal as xp}from"@prisma/client-runtime-utils";var A=class extends k{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},ds=new WeakMap;function Pp(e){let t=ds.get(e);return t||(t=Object.entries(e),ds.set(e,t)),t}function An(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new A(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return Rn(e,t.fields,r,t.skipNulls);case"field":return Sn(e,"<result>",t.fieldType,r);default:E(t,`Invalid data mapping type: '${t.type}'`)}}function Rn(e,t,r,n){if(e===null)return null;if(Array.isArray(e)){let i=e;return n&&(i=i.filter(o=>o!==null)),i.map(o=>ms(o,t,r))}if(typeof e=="object")return ms(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new A("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Rn(i,t,r,n)}throw new A(`Expected an array or an object, got: ${typeof e}`)}function ms(e,t,r){if(typeof e!="object")throw new A(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Pp(t))switch(o.type){case"affectedRows":throw new A(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:l}=o;if(s!==null&&!Object.hasOwn(e,s))throw new A(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let u=s!==null?e[s]:e;n[i]=Rn(u,a,r,l);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=Ep(e[s],s,o.fieldType,r);else throw new A(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:E(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Ep(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>Sn(o,`${t}[${s}]`,r,n)):Sn(e,t,r,n)}function Sn(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new A(`Expected a string in column '${t}', got ${typeof e}: ${e}`);return e}case"int":switch(typeof e){case"number":return Math.trunc(e);case"string":{let i=Math.trunc(Number(e));if(Number.isNaN(i)||!Number.isFinite(i))throw new A(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new A(`Integer value in column '${t}' is too large to represent as a JavaScript number without loss of precision, got: ${e}. Consider using BigInt type.`);return i}default:throw new A(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new A(`Expected a bigint in column '${t}', got ${typeof e}: ${e}`);return{$type:"BigInt",value:e}}case"float":{if(typeof e=="number")return e;if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(e.toLowerCase()))throw new A(`Expected a float in column '${t}', got string: ${e}`);return i}throw new A(`Expected a float in column '${t}', got ${typeof e}: ${e}`)}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="number")return e===1;if(typeof e=="string"){if(e==="true"||e==="TRUE"||e==="1")return!0;if(e==="false"||e==="FALSE"||e==="0")return!1;throw new A(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}if(Array.isArray(e)||e instanceof Uint8Array){for(let i of e)if(i!==0)return!0;return!1}throw new A(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!xp.isDecimal(e))throw new A(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"datetime":{if(typeof e=="string")return{$type:"DateTime",value:vp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new A(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:G(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new A(`Expected a base64-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:e};case"hex":if(typeof e!="string"||!e.startsWith("\\x"))throw new A(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:Buffer.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:Buffer.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:Buffer.from(e).toString("base64")};throw new A(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:E(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new A(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new A(`Value '${e}' not found in enum '${r.name}'`);return o}default:E(r,`DataMapper: Unknown result type: ${r.type}`)}}var Tp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function vp(e){let t=Tp.exec(e);if(t===null)return`${e}T00:00:00Z`;let r=e,[n,i,o]=t;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${e}:00`:i===void 0&&(r=`${e}Z`),n.length===e.length)return`1970-01-01T${r}`;let s=t.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}function U(e){if(typeof e!="object")return e;var t,r,n=Object.prototype.toString.call(e);if(n==="[object Object]"){if(e.constructor!==Object&&typeof e.constructor=="function"){r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&r[t]!==e[t]&&(r[t]=U(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:U(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=U(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=U(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(U(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(U(o),U(i))}),r):n==="[object Date]"?new Date(+e):n==="[object RegExp]"?(r=new RegExp(e.source,e.flags),r.lastIndex=e.lastIndex,r):n==="[object DataView]"?new e.constructor(U(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function Sp(e){let t=Object.entries(e);return t.length===0?"":(t.sort(([n],[i])=>n.localeCompare(i)),`/*${t.map(([n,i])=>{let o=encodeURIComponent(n),s=encodeURIComponent(i).replace(/'/g,"\\'");return`${o}='${s}'`}).join(",")}*/`)}function br(e,t){let r={};for(let n of e){let i=n(U(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function fs(e,t){let r=br(e,t);return Sp(r)}function gs(e,t){return t?`${e} ${t}`:e}var St;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(St||(St={}));function Ap(e){switch(e){case"postgresql":case"postgres":case"prisma+postgres":return"postgresql";case"sqlserver":return"mssql";case"mysql":case"sqlite":case"cockroachdb":case"mongodb":return e;default:E(e,`Unknown provider: ${e}`)}}async function xr({query:e,tracingHelper:t,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=performance.now(),l=await i(),u=performance.now();return n({timestamp:s,duration:u-a,query:e.sql,params:e.args}),l};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:St.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Ap(r)}},o):o()}function xe(e,t){var r="000000000"+e;return r.substr(r.length-t)}import Rp from"node:os";function Cp(){try{return Rp.hostname()}catch{return process.env._CLUSTER_NETWORK_NAME_||process.env.COMPUTERNAME||"hostname"}}var ys=2,Ip=xe(process.pid.toString(36),ys),hs=Cp(),kp=hs.length,Op=xe(hs.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+kp+36).toString(36),ys);function Cn(){return Ip+Op}function Pr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function In(e){let n=Math.pow(36,4),i=0;function o(){return xe((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var l="c",u=new Date().getTime().toString(36),c=xe(s().toString(36),4),p=e(),d=o()+o();return l+u+c+p+d}return a.fingerprint=e,a.isCuid=Pr,a}var Np=In(Cn);var ws=Np;var ya=ye(la());import{webcrypto as ca}from"node:crypto";var ua="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var wd=128,Ee,We;function bd(e){!Ee||Ee.length<e?(Ee=Buffer.allocUnsafe(e*wd),ca.getRandomValues(Ee),We=0):We+e>Ee.length&&(ca.getRandomValues(Ee),We=0),We+=e}function Ln(e=21){bd(e|=0);let t="";for(let r=We-e;r<We;r++)t+=ua[Ee[r]&63];return t}import Sr from"node:crypto";var da="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Ot=32;var xd=16,ma=10,pa=0xffffffffffff;var Te;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(Te||(Te={}));var ve=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Pd(e){let t=Math.floor(e()*Ot);return t===Ot&&(t=Ot-1),da.charAt(t)}function Ed(e){let t=Td(),r=t&&(t.crypto||t.msCrypto)||(typeof Sr<"u"?Sr:null);if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;if(Sr?.randomBytes)return()=>Sr.randomBytes(1).readUInt8()/255;throw new ve(Te.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Td(){return Ad()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function vd(e,t){let r="";for(;e>0;e--)r=Pd(t)+r;return r}function Sd(e,t=ma){if(isNaN(e))throw new ve(Te.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>pa)throw new ve(Te.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${pa}: ${e}`);if(e<0)throw new ve(Te.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new ve(Te.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Ot,n=da.charAt(r)+n,e=(e-r)/Ot;return n}function Ad(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function fa(e,t){let r=t||Ed(),n=!e||isNaN(e)?Date.now():e;return Sd(n,ma)+vd(xd,r)}var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));function Ar(e,t=0){return(O[e[t+0]]+O[e[t+1]]+O[e[t+2]]+O[e[t+3]]+"-"+O[e[t+4]]+O[e[t+5]]+"-"+O[e[t+6]]+O[e[t+7]]+"-"+O[e[t+8]]+O[e[t+9]]+"-"+O[e[t+10]]+O[e[t+11]]+O[e[t+12]]+O[e[t+13]]+O[e[t+14]]+O[e[t+15]]).toLowerCase()}var Rd=new Uint8Array(16);function Ke(){return crypto.getRandomValues(Rd)}function Cd(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Id(e,t,r)}function Id(e,t,r){e=e||{};let n=e.random??e.rng?.()??Ke();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Ar(n)}var Vn=Cd;var qn={};function kd(e,t,r){let n;if(e)n=ga(e.random??e.rng?.()??Ke(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=Ke();Od(qn,i,o),n=ga(o,qn.msecs,qn.seq,t,r)}return t??Ar(n)}function Od(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function ga(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var jn=kd;var Rr=class{#e={};constructor(){this.register("uuid",new Bn),this.register("cuid",new Qn),this.register("ulid",new Jn),this.register("nanoid",new Hn),this.register("product",new Gn)}snapshot(){return Object.create(this.#e,{now:{value:new Un}})}register(t,r){this.#e[t]=r}},Un=class{#e;generate(){return this.#e===void 0&&(this.#e=new Date),this.#e.toISOString()}},Bn=class{generate(t){if(t===4)return Vn();if(t===7)return jn();throw new Error("Invalid UUID generator arguments")}},Qn=class{generate(t){if(t===1)return ws();if(t===2)return(0,ya.createId)();throw new Error("Invalid CUID generator arguments")}},Jn=class{generate(){return fa()}},Hn=class{generate(t){if(typeof t=="number")return Ln(t);if(t===void 0)return Ln();throw new Error("Invalid Nanoid generator arguments")}},Gn=class{generate(t,r){if(t===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(t)&&Array.isArray(r)?t.flatMap(n=>r.map(i=>[n,i])):Array.isArray(t)?t.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[t,n]):[[t,r]]}};function Nt(e,t){return e==null?e:typeof e=="string"?Nt(JSON.parse(e),t):Array.isArray(e)?Dd(e,t):Nd(e,t)}function Nd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!He(e,i))return null}return wa(e,t.nested)}function wa(e,t){for(let[r,n]of Object.entries(t))e[r]=Nt(e[r],n);return e}function Dd(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=Md(e,r)}return t.pagination&&(e=Fd(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>wa(r,t.nested))}function Md(e,t){let r=new Set,n=[];for(let i of e){let o=Se(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function Fd(e,t,r){if(r===null)return ha(e,t);let n=new Map;for(let o of e){let s=Se(o,r);n.has(s)||n.set(s,[]),n.get(s).push(o)}let i=Array.from(n.entries());return i.sort(([o],[s])=>o<s?-1:o>s?1:0),i.flatMap(([,o])=>ha(o,t))}function ha(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>He(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function Se(e,t,r){let n=t.map((i,o)=>r?.[o]?e[i]!==null?r[o](e[i]):null:e[i]);return JSON.stringify(n)}function zn(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function Wn(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Xn(e,t,r,n){let i=e.args.map(o=>q(o,t,r));switch(e.type){case"rawSql":return[Ld(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?qd(e.fragments,i,n):[i]).map(s=>{let a=_d(e.fragments,e.placeholderFormat,s,e.argTypes);if(n!==void 0&&a.args.length>n)throw new k("The query parameter limit supported by your database is exceeded.","P2029");return a});default:E(e.type,"Invalid query type")}}function q(e,t,r){for(;Vd(e);)if(zn(e)){let n=t[e.prisma__value.name];if(n===void 0)throw new Error(`Missing value for query variable ${e.prisma__value.name}`);e.prisma__value.type==="DateTime"&&typeof n=="string"?e=new Date(n):e=n}else if(Wn(e)){let{name:n,args:i}=e.prisma__value,o=r[n];if(!o)throw new Error(`Encountered an unknown generator '${n}'`);e=o.generate(...i.map(s=>q(s,t,r)))}else E(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>q(n,t,r))),e}function _d(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let l of Zn(e,r,n)){if(i+=$d(l,t,o),l.type==="stringChunk")continue;let u=Array.from(ba(l)),c=u.length;if(hr(s,u),l.argType.arity==="tuple"){if(c%l.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${c} parameters for a tuple of arity ${l.argType.elements.length}.`);for(let p=0;p<c/l.argType.elements.length;p++)a.push(...l.argType.elements)}else for(let p=0;p<c;p++)a.push(l.argType)}return{sql:i,args:s,argTypes:a}}function $d(e,t,r){let n=e.type;switch(n){case"parameter":return Kn(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>{let o=Kn(t,r.placeholderNumber++);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.itemSeparator)})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Kn(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:E(n,"Invalid fragment type")}}function Kn(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function Ld(e,t,r){return{sql:e,args:t,argTypes:r}}function Vd(e){return zn(e)||Wn(e)}function*Zn(e,t,r){let n=0;for(let i of e)switch(i.type){case"parameter":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);yield{...i,value:t[n],argType:r?.[n]},n++;break}case"stringChunk":{yield i;break}case"parameterTuple":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);let o=t[n];yield{...i,value:Array.isArray(o)?o:[o],argType:r?.[n]},n++;break}case"parameterTupleList":{if(n>=t.length)throw new Error(`Malformed query template. Fragments attempt to read over ${t.length} parameters.`);let o=t[n];if(!Array.isArray(o))throw new Error("Malformed query template. Tuple list expected.");if(o.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");for(let s of o)if(!Array.isArray(s))throw new Error("Malformed query template. Tuple expected.");yield{...i,value:o,argType:r?.[n]},n++;break}}}function*ba(e){switch(e.type){case"parameter":yield e.value;break;case"stringChunk":break;case"parameterTuple":yield*e.value;break;case"parameterTupleList":for(let t of e.value)yield*t;break}}function qd(e,t,r){let n=0,i=0;for(let s of Zn(e,t,void 0)){let a=0;for(let l of ba(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of Zn(e,t,void 0))switch(s.type){case"parameter":{for(let a of o)a.push(s.value);break}case"stringChunk":break;case"parameterTuple":{let a=s.value.length,l=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let u=r-(n-a);l=jd(s.value,u)}else l=[s.value];o=o.flatMap(u=>l.map(c=>[...u,c]));break}case"parameterTupleList":{let a=s.value.reduce((p,d)=>p+d.length,0),l=[],u=[],c=0;for(let p of s.value)r&&o.length===1&&a===i&&u.length>0&&n-a+c+p.length>r&&(l.push(u),u=[],c=0),u.push(p),c+=p.length;u.length>0&&l.push(u),o=o.flatMap(p=>l.map(d=>[...p,d]));break}}return o}function jd(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function xa(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function Pa(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>Ud(t)),rows:e.rows.map(t=>t.map((r,n)=>Dt(r,e.columnTypes[n])))}}function Dt(e,t){if(e===null)return null;switch(t){case f.Int32:switch(typeof e){case"number":return Math.trunc(e);case"string":return Math.trunc(Number(e));default:throw new Error(`Cannot serialize value of type ${typeof e} as Int32`)}case f.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>Dt(r,f.Int32));case f.Int64:switch(typeof e){case"number":return BigInt(Math.trunc(e));case"string":return e;default:throw new Error(`Cannot serialize value of type ${typeof e} as Int64`)}case f.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>Dt(r,f.Int64));case f.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case f.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>Dt(r,f.Json));case f.Boolean:switch(typeof e){case"boolean":return e;case"string":return e==="true"||e==="1";case"number":return e===1;default:throw new Error(`Cannot serialize value of type ${typeof e} as Boolean`)}case f.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>Dt(r,f.Boolean));default:return e}}function Ud(e){switch(e){case f.Int32:return"int";case f.Int64:return"bigint";case f.Float:return"float";case f.Double:return"double";case f.Text:return"string";case f.Enum:return"enum";case f.Bytes:return"bytes";case f.Boolean:return"bool";case f.Character:return"char";case f.Numeric:return"decimal";case f.Json:return"json";case f.Uuid:return"uuid";case f.DateTime:return"datetime";case f.Date:return"date";case f.Time:return"time";case f.Int32Array:return"int-array";case f.Int64Array:return"bigint-array";case f.FloatArray:return"float-array";case f.DoubleArray:return"double-array";case f.TextArray:return"string-array";case f.EnumArray:return"string-array";case f.BytesArray:return"bytes-array";case f.BooleanArray:return"bool-array";case f.CharacterArray:return"char-array";case f.NumericArray:return"decimal-array";case f.JsonArray:return"json-array";case f.UuidArray:return"uuid-array";case f.DateTimeArray:return"datetime-array";case f.DateArray:return"date-array";case f.TimeArray:return"time-array";case f.UnknownNumber:return"unknown";case f.Set:return"string";default:E(e,`Unexpected column type: ${e}`)}}function Yn(e,t,r){if(!t.every(n=>Cr(e,n))){let n=Bd(e,r),i=Qd(r);throw new k(n,i,r.context)}}function Cr(e,t){switch(t.type){case"rowCountEq":return Array.isArray(e)?e.length===t.args:e===null?t.args===0:t.args===1;case"rowCountNeq":return Array.isArray(e)?e.length!==t.args:e===null?t.args!==0:t.args!==1;case"affectedRowCountEq":return e===t.args;case"never":return!1;default:E(t,`Unknown rule type: ${t.type}`)}}function Bd(e,t){switch(t.errorIdentifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${t.context.relation}' between the \`${t.context.modelA}\` and \`${t.context.modelB}\` models.`;case"MISSING_RECORD":return`An operation failed because it depends on one or more records that were required but not found. No record was found for ${t.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=t.context.neededFor?` (needed to ${t.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${t.context.model}' record${r} was found for ${t.context.operation} on ${t.context.relationType} relation '${t.context.relation}'.`}case"INCOMPLETE_CONNECT_INPUT":return`An operation failed because it depends on one or more records that were required but not found. Expected ${t.context.expectedRows} records to be connected, found only ${Array.isArray(e)?e.length:e}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${t.context.expectedRows} records to be connected after connect operation on ${t.context.relationType} relation '${t.context.relation}', found ${Array.isArray(e)?e.length:e}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${t.context.relation}\` between the \`${t.context.parent}\` and \`${t.context.child}\` models are not connected.`;default:E(t,`Unknown error identifier: ${t}`)}}function Qd(e){switch(e.errorIdentifier){case"RELATION_VIOLATION":return"P2014";case"RECORDS_NOT_CONNECTED":return"P2017";case"INCOMPLETE_CONNECT_OUTPUT":return"P2018";case"MISSING_RECORD":case"MISSING_RELATED_RECORD":case"INCOMPLETE_CONNECT_INPUT":return"P2025";default:E(e,`Unknown error identifier: ${e}`)}}var _t=class e{#e;#t=new Rr;#r;#i;#o;#s;#a;constructor({onQuery:t,tracingHelper:r,serializer:n,rawSerializer:i,provider:o,connectionInfo:s}){this.#e=t,this.#r=r,this.#i=n,this.#o=i??n,this.#s=o,this.#a=s}static forSql(t){return new e({onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:xa,rawSerializer:Pa,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let n=this.#t.snapshot(),i={...r,generators:n},o=Hd(t,a=>this.interpretNode(a,i))?.catch(a=>pe(a));if(o)try{return this.#n(await o,i.scope,n).value}catch(a){pe(a)}let{value:s}=await this.interpretNode(t,i).catch(a=>pe(a));return s}async interpretNode(t,r){switch(t.type){case"value":return{value:q(t.args,r.scope,r.generators),lastInsertId:t.lastInsertId};case"seq":{let n;for(let i of t.args)n=await this.interpretNode(i,r);return n??{value:void 0}}case"let":{let n=Object.create(r.scope);for(let i of t.args.bindings){let{value:o}=await this.interpretNode(i.expr,{...r,scope:n});n[i.name]=o}return this.interpretNode(t.args.expr,{...r,scope:n})}case"concat":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>i.concat(Ze(o)),[]):[]}}case"sum":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>B(i)+B(o)):0}}case"execute":{let n=Xn(t.args,r.scope,r.generators,this.#u()),i=0;for(let o of n){let s=Sa(o,r.sqlCommenter);i+=await this.#c(s,r.queryable,()=>r.queryable.executeRaw(Ir(s)).catch(a=>t.args.type==="rawSql"?vn(a):pe(a)))}return{value:i}}case"query":{let n=Xn(t.args,r.scope,r.generators,this.#u()),i;for(let o of n){let s=Sa(o,r.sqlCommenter),a=await this.#c(s,r.queryable,()=>r.queryable.queryRaw(Ir(s)).catch(l=>t.args.type==="rawSql"?vn(l):pe(l)));i===void 0?i=a:(hr(i.rows,a.rows),i.lastInsertId=a.lastInsertId)}return{value:t.args.type==="rawSql"?this.#o(i):this.#i(i),lastInsertId:i?.lastInsertId}}case"reverse":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);return{value:Array.isArray(n)?n.reverse():n,lastInsertId:i}}case"unique":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);if(!Array.isArray(n))return{value:n,lastInsertId:i};if(n.length>1)throw new Error(`Expected zero or one element, got ${n.length}`);return{value:n[0]??null,lastInsertId:i}}case"required":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args,r);if(ei(n))throw new Error("Required value is empty");return{value:n,lastInsertId:i}}case"mapField":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.records,r);return{value:ti(n,t.args.field),lastInsertId:i}}case"join":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.parent,r);if(n===null)return{value:null,lastInsertId:i};let o=await Promise.all(t.args.children.map(async s=>({joinExpr:s,childRecords:(await this.interpretNode(s.child,r)).value})));return{value:Ea(n,o,t.args.canAssumeStrictEquality),lastInsertId:i}}case"transaction":{if(!r.transactionManager.enabled)return this.interpretNode(t.args,r);let n=r.transactionManager.manager,i=await n.startInternalTransaction(),o=await n.getTransaction(i,"query");try{let s=await this.interpretNode(t.args,{...r,queryable:o});return await n.commitTransaction(i.id),s}catch(s){throw await n.rollbackTransaction(i.id),s}}case"dataMap":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:An(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return Yn(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Cr(n,t.args.rule)?await this.interpretNode(t.args.then,r):await this.interpretNode(t.args.else,r)}case"diff":{let{value:n}=await this.interpretNode(t.args.from,r),{value:i}=await this.interpretNode(t.args.to,r),o=a=>a!==null?Se(Ae(a),t.args.fields):null,s=new Set(Ze(i).map(o));return{value:Ze(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r),o=Ir(t.args.operations);return ri(o,r.scope,r.generators),{value:Nt(n,o),lastInsertId:i}}case"initializeRecord":{let{lastInsertId:n}=await this.interpretNode(t.args.expr,r),i={};for(let[o,s]of Object.entries(t.args.fields))i[o]=Ta(s,n,r.scope,r.generators);return{value:i,lastInsertId:n}}case"mapRecord":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r),o=n===null?{}:Ae(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=va(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:return this.#n(t,r.scope,r.generators)}}#n(t,r,n){switch(t.type){case"value":return{value:q(t.args,r,n),lastInsertId:t.lastInsertId};case"seq":{let i;for(let o of t.args)i=this.#n(o,r,n);return i??{value:void 0}}case"get":return{value:r[t.args.name]};case"let":{let i=Object.create(r);for(let o of t.args.bindings){let{value:s}=this.#n(o.expr,i,n);i[o.name]=s}return this.#n(t.args.expr,i,n)}case"getFirstNonEmpty":{for(let i of t.args.names){let o=r[i];if(!ei(o))return{value:o}}return{value:[]}}case"concat":{let i=t.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>o.concat(Ze(s)),[]):[]}}case"sum":{let i=t.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>B(o)+B(s)):0}}case"reverse":{let{value:i,lastInsertId:o}=this.#n(t.args,r,n);return{value:Array.isArray(i)?i.reverse():i,lastInsertId:o}}case"unique":{let{value:i,lastInsertId:o}=this.#n(t.args,r,n);if(!Array.isArray(i))return{value:i,lastInsertId:o};if(i.length>1)throw new Error(`Expected zero or one element, got ${i.length}`);return{value:i[0]??null,lastInsertId:o}}case"required":{let{value:i,lastInsertId:o}=this.#n(t.args,r,n);if(ei(i))throw new Error("Required value is empty");return{value:i,lastInsertId:o}}case"mapField":{let{value:i,lastInsertId:o}=this.#n(t.args.records,r,n);return{value:ti(i,t.args.field),lastInsertId:o}}case"join":{let{value:i,lastInsertId:o}=this.#n(t.args.parent,r,n);if(i===null)return{value:null,lastInsertId:o};let s=t.args.children.map(a=>({joinExpr:a,childRecords:this.#n(a.child,r,n).value}));return{value:Ea(i,s,t.args.canAssumeStrictEquality),lastInsertId:o}}case"dataMap":{let{value:i,lastInsertId:o}=this.#n(t.args.expr,r,n);return{value:An(i,t.args.structure,t.args.enums),lastInsertId:o}}case"validate":{let{value:i,lastInsertId:o}=this.#n(t.args.expr,r,n);return Yn(i,t.args.rules,t.args),{value:i,lastInsertId:o}}case"if":{let{value:i}=this.#n(t.args.value,r,n);return Cr(i,t.args.rule)?this.#n(t.args.then,r,n):this.#n(t.args.else,r,n)}case"unit":return{value:void 0};case"diff":{let{value:i}=this.#n(t.args.from,r,n),{value:o}=this.#n(t.args.to,r,n),s=l=>l!==null?Se(Ae(l),t.args.fields):null,a=new Set(Ze(o).map(s));return{value:Ze(i).filter(l=>!a.has(s(l)))}}case"process":{let{value:i,lastInsertId:o}=this.#n(t.args.expr,r,n),s=Ir(t.args.operations);return ri(s,r,n),{value:Nt(i,s),lastInsertId:o}}case"initializeRecord":{let{lastInsertId:i}=this.#n(t.args.expr,r,n),o={};for(let[s,a]of Object.entries(t.args.fields))o[s]=Ta(a,i,r,n);return{value:o,lastInsertId:i}}case"mapRecord":{let{value:i,lastInsertId:o}=this.#n(t.args.expr,r,n),s=i===null?{}:Ae(i);for(let[a,l]of Object.entries(t.args.fields))s[a]=va(l,s[a],r,n);return{value:s,lastInsertId:o}}default:E(t,`Unexpected node type: ${t.type}`)}}#u(){return this.#a?.maxBindValues!==void 0?this.#a.maxBindValues:this.#l()}#l(){if(this.#s!==void 0)switch(this.#s){case"cockroachdb":case"postgres":case"postgresql":case"prisma+postgres":return 32766;case"mysql":return 65535;case"sqlite":return 999;case"sqlserver":return 2098;case"mongodb":return;default:E(this.#s,`Unexpected provider: ${this.#s}`)}}#c(t,r,n){return xr({query:t,execute:n,provider:this.#s??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function ei(e){return Array.isArray(e)?e.length===0:e==null}function Ze(e){return Array.isArray(e)?e:[e]}function B(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Ae(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function ti(e,t){return Array.isArray(e)?e.map(r=>ti(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function Ea(e,t,r){for(let{joinExpr:n,childRecords:i}of t){let o=n.on.map(([c])=>c),s=n.on.map(([,c])=>c),a={},l=Array.isArray(e)?e:[e];for(let c of l){let p=Ae(c),d=Se(p,o);a[d]||(a[d]=[]),a[d].push(p),n.isRelationUnique?p[n.parentField]=null:p[n.parentField]=[]}let u=r?void 0:Jd(l,o);for(let c of Array.isArray(i)?i:[i]){if(c===null)continue;let p=Se(Ae(c),s,u);for(let d of a[p]??[])n.isRelationUnique?d[n.parentField]=c:d[n.parentField].push(c)}}return e}function Jd(e,t){function r(o){switch(o){case"number":return Number;case"string":return String;case"boolean":return Boolean;case"bigint":return BigInt;default:return}}let n=Array.from({length:t.length}),i=0;for(let o of e){let s=Ae(o);for(let[a,l]of t.entries())if(s[l]!==null&&n[a]===void 0){let u=r(typeof s[l]);u!==void 0&&(n[a]=u),i++}if(i===t.length)break}return n}function Ta(e,t,r,n){switch(e.type){case"value":return q(e.value,r,n);case"lastInsertId":return t;default:E(e,`Unexpected field initializer type: ${e.type}`)}}function va(e,t,r,n){switch(e.type){case"set":return q(e.value,r,n);case"add":return B(t)+B(q(e.value,r,n));case"subtract":return B(t)-B(q(e.value,r,n));case"multiply":return B(t)*B(q(e.value,r,n));case"divide":{let i=B(t),o=B(q(e.value,r,n));return o===0?null:i/o}default:E(e,`Unexpected field operation type: ${e.type}`)}}function Hd(e,t){let r=Ft(e);if(r)return t(r).then(n=>{let i={type:"value",args:n.value,lastInsertId:n.lastInsertId},o=Mt(e,r,i);if(!o)throw new Error("Could not substitute the evaluated impure node into the query plan");return o})}function Mt(e,t,r){if(e===t)return r;switch(e.type){case"seq":case"sum":case"concat":{for(let n=0;n<e.args.length;n++){let i=Mt(e.args[n],t,r);if(i)return{...e,args:e.args.map((o,s)=>s===n?i:o)}}return}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":{let n=Mt(e.args.expr,t,r);return n&&{...e,args:{...e.args,expr:n}}}case"mapField":{let n=Mt(e.args.records,t,r);return n&&{...e,args:{...e.args,records:n}}}case"reverse":case"unique":case"required":{let n=Mt(e.args,t,r);return n&&{...e,args:n}}default:return}}function Ft(e){switch(e.type){case"query":case"execute":return e;case"seq":case"sum":case"concat":{let t;for(let r of e.args){let n=Ft(r);if(n===null)return null;if(n){if(t)return null;t=n}}return t}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":return Ft(e.args.expr);case"mapField":return Ft(e.args.records);case"reverse":case"unique":case"required":return Ft(e.args);case"let":case"join":case"diff":case"if":case"transaction":return null;case"value":case"get":case"getFirstNonEmpty":case"unit":return;default:E(e,`Unexpected node type: ${e.type}`)}}function Sa(e,t){if(!t||t.plugins.length===0)return e;let r=fs(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:gs(e.sql,r)}:e}function ri(e,t,r){let n=e.pagination?.cursor;if(n)for(let[i,o]of Object.entries(n))n[i]=q(o,t,r);for(let i of Object.values(e.nested))ri(i,t,r)}function Ir(e){return U(e)}function Aa(e){return new ni(e).deserialize()}function Gd(e){return Buffer.from(e,"base64url")}var ni=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=Gd(t.graph);this.#t=new DataView(r.buffer,r.byteOffset,r.byteLength)}deserialize(){let{inputNodeCount:t,outputNodeCount:r,rootCount:n}=this.#n(),i=this.#u(t),o=this.#l(r),s=this.#c(n);return{strings:this.#e.strings,inputNodes:i,outputNodes:o,roots:s}}#i(){let t=0,r=0,n;do n=this.#t.getUint8(this.#r++),t|=(n&127)<<r,r+=7;while(n>=128);return t}#o(){let t=this.#i();return t===0?void 0:t-1}#s(){let t=this.#t.getUint8(this.#r);return this.#r+=1,t}#a(){let t=this.#t.getUint16(this.#r,!0);return this.#r+=2,t}#n(){let t=this.#i(),r=this.#i(),n=this.#i();return{inputNodeCount:t,outputNodeCount:r,rootCount:n}}#u(t){let r=[];for(let n=0;n<t;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),l=this.#a(),u=this.#o(),c=this.#o(),d={flags:this.#s()};l!==0&&(d.scalarMask=l),u!==void 0&&(d.childNodeId=u),c!==void 0&&(d.enumNameIndex=c),o[a]=d}r.push({edges:o})}return r}#l(t){let r=[];for(let n=0;n<t;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),l=this.#o(),u=this.#o(),c={};l!==void 0&&(c.argsNodeId=l),u!==void 0&&(c.outputNodeId=u),o[a]=c}r.push({edges:o})}return r}#c(t){let r={};for(let n=0;n<t;n++){let i=this.#i(),o=this.#o(),s=this.#o(),a=this.#e.strings[i],l={};o!==void 0&&(l.argsNodeId=o),s!==void 0&&(l.outputNodeId=s),r[a]=l}return r}};var $t=class e{#e;#t;#r;constructor(t,r){this.#e=t,this.#r=r,this.#t=new Map;for(let n=0;n<t.strings.length;n++)this.#t.set(t.strings[n],n)}static deserialize(t,r){let n=Aa(t);return new e(n,r)}static fromData(t,r){return new e(t,r)}root(t){let r=this.#e.roots[t];if(r)return{argsNodeId:r.argsNodeId,outputNodeId:r.outputNodeId}}inputNode(t){if(!(t===void 0||t<0||t>=this.#e.inputNodes.length))return{id:t}}outputNode(t){if(!(t===void 0||t<0||t>=this.#e.outputNodes.length))return{id:t}}inputEdge(t,r){if(!t)return;let n=this.#e.inputNodes[t.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{flags:o.flags,childNodeId:o.childNodeId,scalarMask:o.scalarMask??0,enumNameIndex:o.enumNameIndex}}outputEdge(t,r){if(!t)return;let n=this.#e.outputNodes[t.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{argsNodeId:o.argsNodeId,outputNodeId:o.outputNodeId}}enumValues(t){if(t?.enumNameIndex===void 0)return;let r=this.#e.strings[t.enumNameIndex];if(r)return this.#r(r)}getString(t){return this.#e.strings[t]}},X={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},N={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Y(e,t){return(e.flags&t)!==0}function ge(e){return e.scalarMask}var zd=new Set(["DateTime","Decimal","BigInt","Bytes","Json","Raw"]);function kr(e){if(e==null)return{kind:"null"};if(typeof e=="string")return{kind:"primitive",value:e};if(typeof e=="number")return{kind:"primitive",value:e};if(typeof e=="boolean")return{kind:"primitive",value:e};if(Array.isArray(e))return{kind:"array",items:e};if(typeof e=="object"){let t=e;if("$type"in t&&typeof t.$type=="string"){let r=t.$type;return zd.has(r)?{kind:"taggedScalar",tag:r,value:t.value}:{kind:"structural",value:t.value}}return{kind:"object",entries:t}}return{kind:"structural",value:e}}function Ra(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("$type"in e)}function Ca(e){return typeof e=="object"&&e!==null&&"$type"in e&&typeof e.$type=="string"}function ii(e,t){let r=new Or(t),n=e.modelName?`${e.modelName}.${e.action}`:e.action,i=t.root(n);return{parameterizedQuery:{...e,query:r.parameterizeFieldSelection(e.query,i?.argsNodeId,i?.outputNodeId)},placeholderValues:r.getPlaceholderValues()}}function oi(e,t){let r=new Or(t),n=[];for(let i=0;i<e.batch.length;i++){let o=e.batch[i],s=o.modelName?`${o.modelName}.${o.action}`:o.action,a=t.root(s);n.push({...o,query:r.parameterizeFieldSelection(o.query,a?.argsNodeId,a?.outputNodeId)})}return{parameterizedBatch:{...e,batch:n},placeholderValues:r.getPlaceholderValues()}}var Or=class{#e;#t=new Map;#r=new Map;#i=1;constructor(t){this.#e=t}getPlaceholderValues(){return Object.fromEntries(this.#t)}#o(t,r){let n=Kd(t,r),i=this.#r.get(n);if(i!==void 0)return Ia(i,r);let o=`%${this.#i++}`;return this.#r.set(n,o),this.#t.set(o,t),Ia(o,r)}parameterizeFieldSelection(t,r,n){let i=this.#e.inputNode(r),o=this.#e.outputNode(n),s={...t};return t.arguments&&t.arguments.$type!=="Raw"&&(s.arguments=this.#s(t.arguments,i)),t.selection&&(s.selection=this.#p(t.selection,o)),s}#s(t,r){if(!r)return t;let n={};for(let[i,o]of Object.entries(t)){let s=this.#e.inputEdge(r,i);s?n[i]=this.#a(o,s):n[i]=o}return n}#a(t,r){let n=kr(t);switch(n.kind){case"null":return t;case"structural":return t;case"primitive":return this.#n(n.value,r);case"taggedScalar":return this.#u(t,n.tag,r);case"array":return this.#l(n.items,t,r);case"object":return this.#c(n.entries,r);default:throw new Error(`Unknown value kind ${n.kind}`)}}#n(t,r){if(Y(r,X.ParamEnum)&&r.enumNameIndex!==void 0&&typeof t=="string"){let o=this.#e.enumValues(r);if(o&&Object.hasOwn(o,t)){let s={type:"Enum"};return this.#o(o[t],s)}}if(!Y(r,X.ParamScalar))return t;let n=ge(r);if(n===0)return t;let i=si(t);return Oa(i,n)?(n&N.Json&&(t=JSON.stringify(t)),this.#o(t,i)):t}#u(t,r,n){if(!Y(n,X.ParamScalar))return t;let i=ge(n);if(i===0||!Da(r,i))return t;let o=Na(t.$type),s=Ma(t);return this.#o(s,o)}#l(t,r,n){if(Y(n,X.ParamScalar)&&ge(n)&N.Json){let i=G(Z(t)),o={type:"Json"};return this.#o(i,o)}if(Y(n,X.ParamEnum)){let i=this.#e.enumValues(n);if(i&&t.every(o=>typeof o=="string"&&Object.hasOwn(i,o))){let o={type:"List",inner:{type:"Enum"}};return this.#o(t,o)}}if(Y(n,X.ParamListScalar)&&t.every(o=>tm(o,n))&&t.length>0){let o=t.map(l=>rm(l)),a={type:"List",inner:Yd(t)};return this.#o(o,a)}if(Y(n,X.ListObject)){let i=this.#e.inputNode(n.childNodeId);if(i)return t.map(o=>Ra(o)?this.#s(o,i):o)}return r}#c(t,r){if(Y(r,X.Object)){let i=this.#e.inputNode(r.childNodeId);if(i)return this.#s(t,i)}if(ge(r)&N.Json){let i=G(Z(t)),o={type:"Json"};return this.#o(i,o)}return t}#p(t,r){if(!t||!r)return t;let n={};for(let[i,o]of Object.entries(t)){if(i==="$scalars"||i==="$composites"||typeof o=="boolean"){n[i]=o;continue}let s=this.#e.outputEdge(r,i);if(s){let a=o,l=this.#e.inputNode(s.argsNodeId),u=this.#e.outputNode(s.outputNodeId),c={selection:a.selection?this.#p(a.selection,u):{}};a.arguments&&(c.arguments=this.#s(a.arguments,l)),n[i]=c}else n[i]=o}return n}};function Ia(e,t){return{$type:"Param",value:{name:e,...t}}}function ka(e){return e.type==="List"?`List<${ka(e.inner)}>`:e.type}function Wd(e){return ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"):JSON.stringify(e)}function Kd(e,t){let r=ka(t),n=Wd(e);return`${r}:${n}`}var Zd=2**31-1,Xd=-(2**31);function si(e){switch(typeof e){case"boolean":return{type:"Boolean"};case"number":return Number.isInteger(e)?Xd<=e&&e<=Zd?{type:"Int"}:{type:"BigInt"}:{type:"Float"};case"string":return{type:"String"};default:throw new Error("unreachable")}}function Oa({type:e},t){switch(e){case"Boolean":return(t&N.Boolean)!==0;case"Int":return(t&(N.Int|N.BigInt|N.Float))!==0;case"BigInt":return(t&N.BigInt)!==0;case"Float":return(t&N.Float)!==0;case"String":return(t&N.String)!==0;default:return!1}}function Na(e){switch(e){case"BigInt":case"Bytes":case"DateTime":case"Json":return{type:e};case"Decimal":return{type:"Float"};default:return}}function Yd(e){let t={type:"Any"};for(let r of e){let n=kr(r),i;switch(n.kind){case"primitive":i=si(n.value);break;case"taggedScalar":i=Na(n.tag)??{type:"Any"};break;default:return{type:"Any"}}t=em(t,i)}return t}function em(e,t){if(e.type==="Any")return t;if(t.type==="Any"||e.type===t.type)return e;let r={Int:0,BigInt:1,Float:2},n=r[e.type],i=r[t.type];return n!==void 0&&i!==void 0?n>=i?e:t:{type:"Any"}}function Da(e,t){switch(e){case"DateTime":return(t&N.DateTime)!==0;case"Decimal":return(t&N.Decimal)!==0;case"BigInt":return(t&N.BigInt)!==0;case"Bytes":return(t&N.Bytes)!==0;case"Json":return(t&N.Json)!==0;default:return!1}}function tm(e,t){let r=kr(e);switch(r.kind){case"structural":return!1;case"null":return!1;case"primitive":{let n=si(r.value),i=ge(t);return i!==0&&Oa(n,i)}case"taggedScalar":{let n=ge(t);return n!==0&&Da(r.tag,n)}default:return!1}}function rm(e){return Ca(e)?Ma(e):e}function Ma(e){return e.value}async function nm(){return globalThis.crypto??await import("node:crypto")}async function Fa(){return(await nm()).randomUUID()}async function _a(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}var $=class extends k{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Re=class extends ${constructor(){super("Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting.")}},Nr=class extends ${constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},Dr=class extends ${constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},Lt=class extends ${constructor(){super("Unable to start a transaction in the given time.")}},Mr=class extends ${constructor(t,{timeout:r,timeTaken:n}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${r} ms, however ${n} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.`,{operation:t,timeout:r,timeTaken:n})}},ee=class extends ${constructor(t){super(`Internal Consistency Error: ${t}`)}},Fr=class extends ${constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var im=100,om=2e3;function sm(){let e,t=new Promise(r=>{e=r});return{abortController:new AbortController,settled:t,markSettled:e}}var Xe=M("prisma:client:transactionManager"),am=()=>({sql:"COMMIT",args:[],argTypes:[]}),$a=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),lm=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),um=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Vt=class{transactions=new Map;closedTransactions=[];#e=new Set;driverAdapter;transactionOptions;tracingHelper;#t;#r;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#r=o}async startInternalTransaction(t){let r=t!==void 0?this.#y(t):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async startTransaction(t){let r=t!==void 0?this.#y(t):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async#i(t){if(t.newTxId)return await this.#d(t.newTxId,"start",async o=>{if(o.status!=="running")throw new ee(`Transaction in invalid state ${o.status} when starting a nested transaction.`);if(!o.transaction)throw new ee("Transaction missing underlying driver transaction when starting a nested transaction.");o.depth+=1;let s=this.#a(o);o.savepoints.push(s);try{await this.#n(o.transaction)(s)}catch(a){throw o.depth-=1,o.savepoints.pop(),a}return{id:o.id}});let r=sm(),{abortController:n}=r;this.#e.add(r);let i;try{let o={id:await Fa(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0,operationQueue:Promise.resolve(),depth:1,savepoints:[],savepointCounter:0};if(n.signal.aborted)throw new Lt;let s=La(()=>n.abort(),t.maxWait);s?.unref?.();let a=this.driverAdapter.startTransaction(t.isolationLevel).catch(pe);switch(o.transaction=await Promise.race([a.finally(()=>clearTimeout(s)),_a(n.signal,"abort").then(()=>{})]),this.transactions.set(o.id,o),o.status){case"waiting":if(n.signal.aborted)throw o.transaction=void 0,i=this.#o(a),await this.#f(o,"timed_out"),new Lt;return o.status="running",o.startedAt=Date.now(),o.timer=this.#p(o.id,t.timeout),{id:o.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new ee(`Transaction in invalid state ${o.status} although it just finished startup.`);default:return E(o.status,"Unknown transaction status.")}}finally{this.#e.delete(r),i?i.finally(r.markSettled):r.markSettled()}}async#o(t){try{let r=await t;if(r.options.usePhantomQuery)await r.rollback();else try{await r.executeRaw($a())}finally{await r.rollback()}}catch(r){Xe("error in discarded transaction:",r)}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{await this.#d(t,"commit",async r=>{if(r.depth>1){if(!r.transaction)throw new Re;let n=r.savepoints.at(-1);if(!n)throw new ee(`Missing savepoint for nested commit. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#l(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"committed")})})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{await this.#d(t,"rollback",async r=>{if(r.depth>1){if(!r.transaction)throw new Re;let n=r.savepoints.at(-1);if(!n)throw new ee(`Missing savepoint for nested rollback. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#u(r.transaction)(n),await this.#l(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"rolled_back")})})}async getTransaction(t,r){let n=this.#s(t.id,r);if(n.status==="closing"&&(await n.closing,n=this.#s(t.id,r)),!n.transaction)throw new Re;return n.transaction}#s(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(Xe("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new ee("Active transaction found in closed transactions list.");case"committed":throw new Nr(r);case"rolled_back":throw new Dr(r);case"timed_out":throw new Mr(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw Xe("Transaction not found.",t),new Re}if(["committed","rolled_back","timed_out"].includes(n.status))throw new ee("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){let t=[...this.#e];for(let{abortController:r}of t)r.abort();await Promise.allSettled([...[...this.transactions.values()].map(r=>this.#m(r,async()=>{let n=this.transactions.get(r.id);n&&await this.#f(n,"rolled_back")})),...t.map(({settled:r})=>cm(r,om))])}#a(t){return`prisma_sp_${t.savepointCounter++}`}#n(t){if(t.createSavepoint)return t.createSavepoint.bind(t);throw new $(`Nested transactions are not supported by adapter "${t.adapterName}" (${t.provider}): createSavepoint is not implemented.`)}#u(t){if(t.rollbackToSavepoint)return t.rollbackToSavepoint.bind(t);throw new $(`Nested transactions are not supported by adapter "${t.adapterName}" (${t.provider}): rollbackToSavepoint is not implemented.`)}async#l(t,r){t.releaseSavepoint&&await t.releaseSavepoint(r)}#c(t){Xe("Transaction already committed or rolled back when timeout happened.",t)}#p(t,r){let n=Date.now(),i=La(async()=>{Xe("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);if(!o){this.#c(t);return}await this.#m(o,async()=>{let s=this.transactions.get(t);s&&["running","waiting"].includes(s.status)?await this.#f(s,"timed_out"):this.#c(t)})},r);return i?.unref?.(),i}async#d(t,r,n){let i=this.#s(t,r);return await this.#m(i,async()=>{let o=this.#s(t,r);return await n(o)})}async#m(t,r){let n=t.operationQueue,i;t.operationQueue=new Promise(o=>{i=o}),await n;try{return await r()}finally{i()}}async#f(t,r){let n=async()=>{Xe("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#g(lm(),t.transaction,()=>t.transaction.commit());else{let i=am();await this.#g(i,t.transaction,()=>t.transaction.executeRaw(i)).then(()=>t.transaction.commit(),o=>{let s=()=>Promise.reject(o);return t.transaction.rollback().then(s,s)})}else if(t.transaction)if(t.transaction.options.usePhantomQuery)await this.#g(um(),t.transaction,()=>t.transaction.rollback());else{let i=$a();try{await this.#g(i,t.transaction,()=>t.transaction.executeRaw(i))}finally{await t.transaction.rollback()}}}finally{t.status=r,clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>im&&this.closedTransactions.shift()}};t.status==="closing"?(await t.closing,this.#s(t.id,r==="committed"?"commit":"rollback")):await Object.assign(t,{status:"closing",reason:r,closing:n()}).closing}#y(t){if(!t.timeout)throw new $("timeout is required");if(!t.maxWait)throw new $("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new Fr(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#g(t,r,n){return xr({query:t,execute:n,provider:this.#r??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function La(e,t){return t!==void 0?setTimeout(e,t):void 0}function cm(e,t){let r,n=new Promise(i=>{r=setTimeout(i,t),r?.unref?.()});return Promise.race([e,n]).finally(()=>clearTimeout(r))}import{PrismaClientInitializationError as ci,PrismaClientKnownRequestError as pi,PrismaClientRustPanicError as qt,PrismaClientUnknownRequestError as nl}from"@prisma/client-runtime-utils";var _r="7.10.0-dev.23";var Va={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function ja(e){let t;try{t=JSON.parse(e)}catch(i){throw new Error(`Received invalid serialized parameters: ${i.message}`)}if(!Array.isArray(t))throw new Error("Received invalid serialized parameters: expected an array");let r=t.map(i=>Ua(i)),n=t.map(i=>dm(i));return{args:r,argTypes:n}}function Ua(e){if(Array.isArray(e))return e.map(t=>Ua(t));if(typeof e=="object"&&e!==null&&"prisma__value"in e){if(!("prisma__type"in e))throw new Error("Invalid serialized parameter, prisma__type should be present when prisma__value is present");return`${e.prisma__value}`}return typeof e=="object"&&e!==null?JSON.stringify(e):e}function dm(e){return Array.isArray(e)?{scalarType:e.length>0?qa(e[0]):"unknown",arity:"list"}:{scalarType:qa(e),arity:"scalar"}}function qa(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in Va?Va[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}function Ba(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}function Qa(e){return e?e.replace(/"(?:[^"\\]|\\.)*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function Ja(e){return e.split(`
|
|
19
19
|
`).map(t=>t.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(`
|
|
20
|
-
`)}var
|
|
20
|
+
`)}var Ha=ye(Wi());function Ga({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Ha.default)({user:t,repo:r,template:n,title:e,body:i})}function za({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=$i(6e3-(s?.length??0)),l=Ja(Oe(a)),u=n?`# Description
|
|
21
21
|
\`\`\`
|
|
22
22
|
${n}
|
|
23
|
-
\`\`\``:"",c=
|
|
23
|
+
\`\`\``:"",c=Oe(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
|
|
24
24
|
## Versions
|
|
25
25
|
|
|
26
26
|
| Name | Version |
|
|
@@ -50,27 +50,27 @@ ${l}
|
|
|
50
50
|
|
|
51
51
|
## Prisma Engine Query
|
|
52
52
|
\`\`\`
|
|
53
|
-
${s?
|
|
53
|
+
${s?Qa(s):""}
|
|
54
54
|
\`\`\`
|
|
55
|
-
`),p=
|
|
55
|
+
`),p=Ga({title:r,body:c});return`${r}
|
|
56
56
|
|
|
57
57
|
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
|
|
58
58
|
|
|
59
|
-
${
|
|
59
|
+
${st(p)}
|
|
60
60
|
|
|
61
61
|
If you want the Prisma team to look into it, please open the link above \u{1F64F}
|
|
62
62
|
To increase the chance of success, please post your schema and a snippet of
|
|
63
63
|
how you used Prisma Client in the issue.
|
|
64
|
-
`}var Nr=class e{#e;#t;#r;#n;#i;constructor(t,r,n){this.#e=t,this.#t=r,this.#r=n,this.#n=r.getConnectionInfo?.(),this.#i=Ot.forSql({onQuery:this.#e.onQuery,tracingHelper:this.#e.tracingHelper,provider:this.#e.provider,connectionInfo:this.#n})}static async connect(t){let r,n;try{r=await t.driverAdapterFactory.connect(),n=new Ft({driverAdapter:r,transactionOptions:t.transactionOptions,tracingHelper:t.tracingHelper,onQuery:t.onQuery,provider:t.provider})}catch(i){throw await r?.dispose(),i}return new e(t,r,n)}getConnectionInfo(){let t=this.#n??{supportsRelationJoins:!1};return Promise.resolve({provider:this.#t.provider,connectionInfo:t})}async execute({plan:t,placeholderValues:r,transaction:n,batchIndex:i,queryInfo:o}){let s=n?await this.#r.getTransaction(n,i!==void 0?"batch query":"query"):this.#t;return await this.#i.run(t,{queryable:s,transactionManager:n?{enabled:!1}:{enabled:!0,manager:this.#r},scope:r,sqlCommenter:this.#e.sqlCommenters&&{plugins:this.#e.sqlCommenters,queryInfo:o}})}async startTransaction(t){return{...await this.#r.startTransaction(t),payload:void 0}}async commitTransaction(t){await this.#r.commitTransaction(t.id)}async rollbackTransaction(t){await this.#r.rollbackTransaction(t.id)}async disconnect(){try{await this.#r.cancelAllTransactions()}finally{await this.#t.dispose()}}apiKey(){return null}};var Dr=class{#e;#t;#r;constructor(t=1e3){this.#e=new Map,this.#t=new Map,this.#r=t}getSingle(t){let r=this.#e.get(t);return r&&(this.#e.delete(t),this.#e.set(t,r)),r}setSingle(t,r){if(this.#e.has(t)){this.#e.delete(t),this.#e.set(t,r);return}if(this.#e.size>=this.#r){let n=this.#e.keys().next().value;n!==void 0&&this.#e.delete(n)}this.#e.set(t,r)}getBatch(t){let r=this.#t.get(t);return r&&(this.#t.delete(t),this.#t.set(t,r)),r}setBatch(t,r){if(this.#t.has(t)){this.#t.delete(t),this.#t.set(t,r);return}if(this.#t.size>=this.#r){let n=this.#t.keys().next().value;n!==void 0&&this.#t.delete(n)}this.#t.set(t,r)}clear(){this.#e.clear(),this.#t.clear()}get size(){return this.#e.size+this.#t.size}get singleCacheSize(){return this.#e.size}get batchCacheSize(){return this.#t.size}};import{PrismaClientKnownRequestError as mm}from"@prisma/client-runtime-utils";var Mr=/^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;function Qa(e,t,r){let n=r||{},i=n.encode||encodeURIComponent;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!Mr.test(e))throw new TypeError("argument name is invalid");let o=i(t);if(o&&!Mr.test(o))throw new TypeError("argument val is invalid");let s=e+"="+o;if(n.maxAge!==void 0&&n.maxAge!==null){let a=n.maxAge-0;if(Number.isNaN(a)||!Number.isFinite(a))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+Math.floor(a)}if(n.domain){if(!Mr.test(n.domain))throw new TypeError("option domain is invalid");s+="; Domain="+n.domain}if(n.path){if(!Mr.test(n.path))throw new TypeError("option path is invalid");s+="; Path="+n.path}if(n.expires){if(!cm(n.expires)||Number.isNaN(n.expires.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():n.priority){case"low":{s+="; Priority=Low";break}case"medium":{s+="; Priority=Medium";break}case"high":{s+="; Priority=High";break}default:throw new TypeError("option priority is invalid")}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:{s+="; SameSite=Strict";break}case"lax":{s+="; SameSite=Lax";break}case"strict":{s+="; SameSite=Strict";break}case"none":{s+="; SameSite=None";break}default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s}function cm(e){return Object.prototype.toString.call(e)==="[object Date]"||e instanceof Date}function Ja(e,t){let r=(e||"").split(";").filter(l=>typeof l=="string"&&!!l.trim()),n=r.shift()||"",i=pm(n),o=i.name,s=i.value;try{s=t?.decode===!1?s:(t?.decode||decodeURIComponent)(s)}catch{}let a={name:o,value:s};for(let l of r){let u=l.split("="),c=(u.shift()||"").trimStart().toLowerCase(),p=u.join("=");switch(c){case"expires":{a.expires=new Date(p);break}case"max-age":{a.maxAge=Number.parseInt(p,10);break}case"secure":{a.secure=!0;break}case"httponly":{a.httpOnly=!0;break}case"samesite":{a.sameSite=p;break}default:a[c]=p}}return a}function pm(e){let t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}var Fr=class extends Error{clientVersion;cause;constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var _r=class extends Fr{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function Ha(e,t){return{...e,isRetryable:t}}var ve=class extends _r{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,Ha(r,!1))}};dt(ve,"InvalidDatasourceError");function Ga(e){let t={clientVersion:e.clientVersion},r;try{r=new URL(e.accelerateUrl)}catch(l){let u=l.message;throw new ve(`Error validating \`accelerateUrl\`, the URL cannot be parsed, reason: ${u}`,t)}let{protocol:n,searchParams:i}=r;if(n!=="prisma:"&&n!==Ut)throw new ve("Error validating `accelerateUrl`: the URL must start with the protocol `prisma://` or `prisma+postgres://`",t);let o=i.get("api_key");if(o===null||o.length<1)throw new ve("Error validating `accelerateUrl`: the URL must contain a valid API key",t);let s=zr(r)?"http:":"https:";process.env.TEST_CLIENT_ENGINE_REMOTE_EXECUTOR&&r.searchParams.has("use_http")&&(s="http:");let a=new URL(r.href.replace(n,s));return{apiKey:o,url:a}}var za=ge(Di()),$r=class{apiKey;tracingHelper;logLevel;logQueries;engineHash;constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,transactionId:r}={}){let n={Accept:"application/json",Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json","Prisma-Engine-Hash":this.engineHash,"Prisma-Engine-Version":za.enginesVersion};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-Transaction-Id"]=r);let i=this.#e();return i.length>0&&(n["X-Capture-Telemetry"]=i.join(", ")),n}#e(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}};function dm(e){return e[0]*1e3+e[1]/1e6}function ei(e){return new Date(dm(e))}var Wa=M("prisma:client:clientEngine:remoteExecutor"),Lr=class{#e;#t;#r;#n;#i;#o;constructor(t){this.#e=t.clientVersion,this.#n=t.logEmitter,this.#i=t.tracingHelper,this.#o=t.sqlCommenters;let{url:r,apiKey:n}=Ga({clientVersion:t.clientVersion,accelerateUrl:t.accelerateUrl});this.#r=new ti(r),this.#t=new $r({apiKey:n,engineHash:t.clientVersion,logLevel:t.logLevel,logQueries:t.logQueries,tracingHelper:t.tracingHelper})}async getConnectionInfo(){return await this.#s({path:"/connection-info",method:"GET"})}async execute({plan:t,placeholderValues:r,batchIndex:n,model:i,operation:o,transaction:s,customFetch:a,queryInfo:l}){let u=l&&this.#o?.length?gr(this.#o,{query:l}):void 0;return(await this.#s({path:s?`/transaction/${s.id}/query`:"/query",method:"POST",body:{model:i,operation:o,plan:t,params:r,comments:u&&Object.keys(u).length>0?u:void 0},batchRequestIdx:n,fetch:a})).data}async startTransaction(t){return{...await this.#s({path:"/transaction/start",method:"POST",body:t}),payload:void 0}}async commitTransaction(t){await this.#s({path:`/transaction/${t.id}/commit`,method:"POST"})}async rollbackTransaction(t){await this.#s({path:`/transaction/${t.id}/rollback`,method:"POST"})}disconnect(){return Promise.resolve()}apiKey(){return this.#t.apiKey}async#s({path:t,method:r,body:n,fetch:i=globalThis.fetch,batchRequestIdx:o}){let s=await this.#r.request({method:r,path:t,headers:this.#t.build(),body:n,fetch:i});s.ok||await this.#a(s,o);let a=await s.json();return typeof a.extensions=="object"&&a.extensions!==null&&this.#u(a.extensions),a}async#a(t,r){let n=t.headers.get("Prisma-Error-Code"),i=await t.text(),o,s=i;try{o=JSON.parse(i)}catch{o={}}typeof o.code=="string"&&(n=o.code),typeof o.error=="string"?s=o.error:typeof o.message=="string"?s=o.message:typeof o.InvalidRequestError=="object"&&o.InvalidRequestError!==null&&typeof o.InvalidRequestError.reason=="string"&&(s=o.InvalidRequestError.reason),s=s||`HTTP ${t.status}: ${t.statusText}`;let a=typeof o.meta=="object"&&o.meta!==null?o.meta:o;throw new mm(s,{clientVersion:this.#e,code:n??"P6000",batchRequestIdx:r,meta:a})}#u(t){let r=t.logs??[];if(t.spans)this.#i.dispatchEngineSpans(t.spans,r,n=>this.#l(n));else for(let n of r)this.#l(n)}#l(t){switch(t.level){case"debug":case"trace":Wa(t);break;case"error":case"warn":case"info":{this.#n.emit(t.level,{timestamp:ei(t.timestamp),message:t.attributes.message??"",target:t.target??"RemoteExecutor"});break}case"query":{this.#n.emit("query",{query:t.attributes.query??"",timestamp:ei(t.timestamp),duration:t.attributes.duration_ms??0,params:t.attributes.params??"",target:t.target??"RemoteExecutor"});break}default:throw new Error(`Unexpected log level: ${t.level}`)}}},ti=class{#e;#t;#r;constructor(t){this.#e=t,this.#t=new Map}async request({method:t,path:r,headers:n,body:i,fetch:o}){let s=new URL(r,this.#e),a=this.#n(s);a&&(n.Cookie=a),this.#r&&(n["Accelerate-Query-Engine-Jwt"]=this.#r);let l=await o(s.href,{method:t,body:i!==void 0?JSON.stringify(i):void 0,headers:n});return Wa(t,s,l.status,l.statusText),this.#r=l.headers.get("Accelerate-Query-Engine-Jwt")??void 0,this.#i(s,l),l}#n(t){let r=[],n=new Date;for(let[i,o]of this.#t){if(o.expires&&o.expires<n){this.#t.delete(i);continue}let s=o.domain??t.hostname,a=o.path??"/";t.hostname.endsWith(s)&&t.pathname.startsWith(a)&&r.push(Qa(o.name,o.value))}return r.length>0?r.join("; "):void 0}#i(t,r){let n=r.headers.getSetCookie?.()||[];if(n.length===0){let i=r.headers.get("Set-Cookie");i&&n.push(i)}for(let i of n){let o=Ja(i),s=o.domain??t.hostname,a=o.path??"/",l=`${s}:${a}:${o.name}`;this.#t.set(l,{name:o.name,value:o.value,domain:s,path:a,expires:o.expires})}}};import{PrismaClientInitializationError as Ka}from"@prisma/client-runtime-utils";var ri={},Za={async loadQueryCompiler(e){let{clientVersion:t,compilerWasm:r}=e;if(r===void 0)throw new Ka("WASM query compiler was unexpectedly `undefined`",t);let n;return e.activeProvider===void 0||ri[e.activeProvider]===void 0?(n=(async()=>{let i=await r.getRuntime(),o=await r.getQueryCompilerWasmModule();if(o==null)throw new Ka("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={[r.importName]:i},a=new WebAssembly.Instance(o,s),l=a.exports.__wbindgen_start;return i.__wbg_set_wasm(a.exports),l(),i.QueryCompiler})(),e.activeProvider!==void 0&&(ri[e.activeProvider]=n)):n=ri[e.activeProvider],await n}};var fm="P2038",se=M("prisma:client:clientEngine"),rl=globalThis;rl.PRISMA_WASM_PANIC_REGISTRY={set_message(e){throw new _t(e,Or)}};var $t=class{name="ClientEngine";#e;#t={type:"disconnected"};#r;#n;#i;#o;config;datamodel;logEmitter;logQueries;logLevel;tracingHelper;#s;constructor(t,r){if(t.accelerateUrl!==void 0)this.#n={remote:!0,accelerateUrl:t.accelerateUrl};else if(t.adapter)this.#n={remote:!1,driverAdapterFactory:t.adapter},se("Using driver adapter: %O",t.adapter);else throw new ni("PrismaClient requires a driver adapter to connect to your database, but none was provided. Pass one to the PrismaClient constructor, e.g. `new PrismaClient({ adapter })`. Learn more: https://pris.ly/d/driver-adapters",t.clientVersion,fm);this.#r=r??Za,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,this.#i=t.queryPlanCacheMaxSize===0?void 0:new Dr(t.queryPlanCacheMaxSize),this.#o=Dt.deserialize(t.parameterizationSchema,n=>{if(!Object.hasOwn(t.runtimeDataModel.enums,n))return;let i={};for(let o of t.runtimeDataModel.enums[n].values)i[o.name]=o.dbName??o.name;return i}),t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&(this.#s=n=>{this.logEmitter.emit("query",{...n,params:H(n.params),target:"ClientEngine"})})}async#a(){switch(this.#t.type){case"disconnected":{let t=this.tracingHelper.runInChildSpan("connect",async()=>{let r,n;try{r=await this.#u(),n=await this.#l(r)}catch(o){throw this.#t={type:"disconnected"},n?.free(),await r?.disconnect(),o}let i={executor:r,queryCompiler:n};return this.#t={type:"connected",engine:i},i});return this.#t={type:"connecting",promise:t},await t}case"connecting":return await this.#t.promise;case"connected":return this.#t.engine;case"disconnecting":return await this.#t.promise,await this.#a()}}async#u(){return this.#n.remote?new Lr({clientVersion:this.config.clientVersion,accelerateUrl:this.#n.accelerateUrl,logEmitter:this.logEmitter,logLevel:this.logLevel,logQueries:this.logQueries,tracingHelper:this.tracingHelper,sqlCommenters:this.config.sqlCommenters}):await Nr.connect({driverAdapterFactory:this.#n.driverAdapterFactory,tracingHelper:this.tracingHelper,transactionOptions:{...this.config.transactionOptions,isolationLevel:this.#g(this.config.transactionOptions.isolationLevel)},onQuery:this.#s,provider:this.config.activeProvider,sqlCommenters:this.config.sqlCommenters})}async#l(t){let r=this.#e;r===void 0&&(r=await this.#r.loadQueryCompiler(this.config),this.#e=r);let{provider:n,connectionInfo:i}=await t.getConnectionInfo();try{return this.#m(()=>new r({datamodel:this.datamodel,provider:n,connectionInfo:i}),void 0,!1)}catch(o){throw this.#p(o)}}#p(t){if(t instanceof _t)return t;try{let r=JSON.parse(t.message);return new ni(r.message,this.config.clientVersion,r.error_code)}catch{return t}}#c(t,r){if(t instanceof ni)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new _t(Ya(this,t.message,r),this.config.clientVersion);if(t instanceof I)return new ii(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion});try{let n=JSON.parse(t);return new Xa(`${n.message}
|
|
65
|
-
${n.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#d(t){return t instanceof
|
|
64
|
+
`}var $r=class e{#e;#t;#r;#i;#o;constructor(t,r,n){this.#e=t,this.#t=r,this.#r=n,this.#i=r.getConnectionInfo?.(),this.#o=_t.forSql({onQuery:this.#e.onQuery,tracingHelper:this.#e.tracingHelper,provider:this.#e.provider,connectionInfo:this.#i})}static async connect(t){let r,n;try{r=await t.driverAdapterFactory.connect(),n=new Vt({driverAdapter:r,transactionOptions:t.transactionOptions,tracingHelper:t.tracingHelper,onQuery:t.onQuery,provider:t.provider})}catch(i){throw await r?.dispose(),i}return new e(t,r,n)}getConnectionInfo(){let t=this.#i??{supportsRelationJoins:!1};return Promise.resolve({provider:this.#t.provider,connectionInfo:t})}async execute({plan:t,placeholderValues:r,transaction:n,batchIndex:i,queryInfo:o}){let s=n?await this.#r.getTransaction(n,i!==void 0?"batch query":"query"):this.#t;return await this.#o.run(t,{queryable:s,transactionManager:n?{enabled:!1}:{enabled:!0,manager:this.#r},scope:r,sqlCommenter:this.#e.sqlCommenters&&{plugins:this.#e.sqlCommenters,queryInfo:o}})}async startTransaction(t){return{...await this.#r.startTransaction(t),payload:void 0}}async commitTransaction(t){await this.#r.commitTransaction(t.id)}async rollbackTransaction(t){await this.#r.rollbackTransaction(t.id)}async disconnect(){try{await this.#r.cancelAllTransactions()}finally{await this.#t.dispose()}}apiKey(){return null}};var Lr=class{#e;#t;#r;constructor(t=1e3){this.#e=new Map,this.#t=new Map,this.#r=t}getSingle(t){let r=this.#e.get(t);return r&&(this.#e.delete(t),this.#e.set(t,r)),r}setSingle(t,r){if(this.#e.has(t)){this.#e.delete(t),this.#e.set(t,r);return}if(this.#e.size>=this.#r){let n=this.#e.keys().next().value;n!==void 0&&this.#e.delete(n)}this.#e.set(t,r)}getBatch(t){let r=this.#t.get(t);return r&&(this.#t.delete(t),this.#t.set(t,r)),r}setBatch(t,r){if(this.#t.has(t)){this.#t.delete(t),this.#t.set(t,r);return}if(this.#t.size>=this.#r){let n=this.#t.keys().next().value;n!==void 0&&this.#t.delete(n)}this.#t.set(t,r)}clear(){this.#e.clear(),this.#t.clear()}get size(){return this.#e.size+this.#t.size}get singleCacheSize(){return this.#e.size}get batchCacheSize(){return this.#t.size}};import{PrismaClientKnownRequestError as ym}from"@prisma/client-runtime-utils";var Vr=/^[\u0009\u0020-\u007E\u0080-\u00FF]+$/;function Wa(e,t,r){let n=r||{},i=n.encode||encodeURIComponent;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!Vr.test(e))throw new TypeError("argument name is invalid");let o=i(t);if(o&&!Vr.test(o))throw new TypeError("argument val is invalid");let s=e+"="+o;if(n.maxAge!==void 0&&n.maxAge!==null){let a=n.maxAge-0;if(Number.isNaN(a)||!Number.isFinite(a))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+Math.floor(a)}if(n.domain){if(!Vr.test(n.domain))throw new TypeError("option domain is invalid");s+="; Domain="+n.domain}if(n.path){if(!Vr.test(n.path))throw new TypeError("option path is invalid");s+="; Path="+n.path}if(n.expires){if(!mm(n.expires)||Number.isNaN(n.expires.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(s+="; HttpOnly"),n.secure&&(s+="; Secure"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():n.priority){case"low":{s+="; Priority=Low";break}case"medium":{s+="; Priority=Medium";break}case"high":{s+="; Priority=High";break}default:throw new TypeError("option priority is invalid")}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:{s+="; SameSite=Strict";break}case"lax":{s+="; SameSite=Lax";break}case"strict":{s+="; SameSite=Strict";break}case"none":{s+="; SameSite=None";break}default:throw new TypeError("option sameSite is invalid")}return n.partitioned&&(s+="; Partitioned"),s}function mm(e){return Object.prototype.toString.call(e)==="[object Date]"||e instanceof Date}function Ka(e,t){let r=(e||"").split(";").filter(l=>typeof l=="string"&&!!l.trim()),n=r.shift()||"",i=fm(n),o=i.name,s=i.value;try{s=t?.decode===!1?s:(t?.decode||decodeURIComponent)(s)}catch{}let a={name:o,value:s};for(let l of r){let u=l.split("="),c=(u.shift()||"").trimStart().toLowerCase(),p=u.join("=");switch(c){case"expires":{a.expires=new Date(p);break}case"max-age":{a.maxAge=Number.parseInt(p,10);break}case"secure":{a.secure=!0;break}case"httponly":{a.httpOnly=!0;break}case"samesite":{a.sameSite=p;break}default:a[c]=p}}return a}function fm(e){let t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}var qr=class extends Error{clientVersion;cause;constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var jr=class extends qr{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function Za(e,t){return{...e,isRetryable:t}}var Ce=class extends jr{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,Za(r,!1))}};ft(Ce,"InvalidDatasourceError");function Xa(e){let t={clientVersion:e.clientVersion},r;try{r=new URL(e.accelerateUrl)}catch(l){let u=l.message;throw new Ce(`Error validating \`accelerateUrl\`, the URL cannot be parsed, reason: ${u}`,t)}let{protocol:n,searchParams:i}=r;if(n!=="prisma:"&&n!==Ht)throw new Ce("Error validating `accelerateUrl`: the URL must start with the protocol `prisma://` or `prisma+postgres://`",t);let o=i.get("api_key");if(o===null||o.length<1)throw new Ce("Error validating `accelerateUrl`: the URL must contain a valid API key",t);let s=Yr(r)?"http:":"https:";process.env.TEST_CLIENT_ENGINE_REMOTE_EXECUTOR&&r.searchParams.has("use_http")&&(s="http:");let a=new URL(r.href.replace(n,s));return{apiKey:o,url:a}}var Ya=ye(qi()),Ur=class{apiKey;tracingHelper;logLevel;logQueries;engineHash;constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,transactionId:r}={}){let n={Accept:"application/json",Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json","Prisma-Engine-Hash":this.engineHash,"Prisma-Engine-Version":Ya.enginesVersion};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-Transaction-Id"]=r);let i=this.#e();return i.length>0&&(n["X-Capture-Telemetry"]=i.join(", ")),n}#e(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}};function gm(e){return e[0]*1e3+e[1]/1e6}function ai(e){return new Date(gm(e))}var el=M("prisma:client:clientEngine:remoteExecutor"),Br=class{#e;#t;#r;#i;#o;#s;constructor(t){this.#e=t.clientVersion,this.#i=t.logEmitter,this.#o=t.tracingHelper,this.#s=t.sqlCommenters;let{url:r,apiKey:n}=Xa({clientVersion:t.clientVersion,accelerateUrl:t.accelerateUrl});this.#r=new li(r),this.#t=new Ur({apiKey:n,engineHash:t.clientVersion,logLevel:t.logLevel,logQueries:t.logQueries,tracingHelper:t.tracingHelper})}async getConnectionInfo(){return await this.#a({path:"/connection-info",method:"GET"})}async execute({plan:t,placeholderValues:r,batchIndex:n,model:i,operation:o,transaction:s,customFetch:a,queryInfo:l}){let u=l&&this.#s?.length?br(this.#s,{query:l}):void 0;return(await this.#a({path:s?`/transaction/${s.id}/query`:"/query",method:"POST",body:{model:i,operation:o,plan:t,params:r,comments:u&&Object.keys(u).length>0?u:void 0},batchRequestIdx:n,fetch:a})).data}async startTransaction(t){return{...await this.#a({path:"/transaction/start",method:"POST",body:t}),payload:void 0}}async commitTransaction(t){await this.#a({path:`/transaction/${t.id}/commit`,method:"POST"})}async rollbackTransaction(t){await this.#a({path:`/transaction/${t.id}/rollback`,method:"POST"})}disconnect(){return Promise.resolve()}apiKey(){return this.#t.apiKey}async#a({path:t,method:r,body:n,fetch:i=globalThis.fetch,batchRequestIdx:o}){let s=await this.#r.request({method:r,path:t,headers:this.#t.build(),body:n,fetch:i});s.ok||await this.#n(s,o);let a=await s.json();return typeof a.extensions=="object"&&a.extensions!==null&&this.#u(a.extensions),a}async#n(t,r){let n=t.headers.get("Prisma-Error-Code"),i=await t.text(),o,s=i;try{o=JSON.parse(i)}catch{o={}}typeof o.code=="string"&&(n=o.code),typeof o.error=="string"?s=o.error:typeof o.message=="string"?s=o.message:typeof o.InvalidRequestError=="object"&&o.InvalidRequestError!==null&&typeof o.InvalidRequestError.reason=="string"&&(s=o.InvalidRequestError.reason),s=s||`HTTP ${t.status}: ${t.statusText}`;let a=typeof o.meta=="object"&&o.meta!==null?o.meta:o;throw new ym(s,{clientVersion:this.#e,code:n??"P6000",batchRequestIdx:r,meta:a})}#u(t){let r=t.logs??[];if(t.spans)this.#o.dispatchEngineSpans(t.spans,r,n=>this.#l(n));else for(let n of r)this.#l(n)}#l(t){switch(t.level){case"debug":case"trace":el(t);break;case"error":case"warn":case"info":{this.#i.emit(t.level,{timestamp:ai(t.timestamp),message:t.attributes.message??"",target:t.target??"RemoteExecutor"});break}case"query":{this.#i.emit("query",{query:t.attributes.query??"",timestamp:ai(t.timestamp),duration:t.attributes.duration_ms??0,params:t.attributes.params??"",target:t.target??"RemoteExecutor"});break}default:throw new Error(`Unexpected log level: ${t.level}`)}}},li=class{#e;#t;#r;constructor(t){this.#e=t,this.#t=new Map}async request({method:t,path:r,headers:n,body:i,fetch:o}){let s=new URL(r,this.#e),a=this.#i(s);a&&(n.Cookie=a),this.#r&&(n["Accelerate-Query-Engine-Jwt"]=this.#r);let l=await o(s.href,{method:t,body:i!==void 0?JSON.stringify(i):void 0,headers:n});return el(t,s,l.status,l.statusText),this.#r=l.headers.get("Accelerate-Query-Engine-Jwt")??void 0,this.#o(s,l),l}#i(t){let r=[],n=new Date;for(let[i,o]of this.#t){if(o.expires&&o.expires<n){this.#t.delete(i);continue}let s=o.domain??t.hostname,a=o.path??"/";t.hostname.endsWith(s)&&t.pathname.startsWith(a)&&r.push(Wa(o.name,o.value))}return r.length>0?r.join("; "):void 0}#o(t,r){let n=r.headers.getSetCookie?.()||[];if(n.length===0){let i=r.headers.get("Set-Cookie");i&&n.push(i)}for(let i of n){let o=Ka(i),s=o.domain??t.hostname,a=o.path??"/",l=`${s}:${a}:${o.name}`;this.#t.set(l,{name:o.name,value:o.value,domain:s,path:a,expires:o.expires})}}};import{PrismaClientInitializationError as tl}from"@prisma/client-runtime-utils";var ui={},rl={async loadQueryCompiler(e){let{clientVersion:t,compilerWasm:r}=e;if(r===void 0)throw new tl("WASM query compiler was unexpectedly `undefined`",t);let n;return e.activeProvider===void 0||ui[e.activeProvider]===void 0?(n=(async()=>{let i=await r.getRuntime(),o=await r.getQueryCompilerWasmModule();if(o==null)throw new tl("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={[r.importName]:i},a=new WebAssembly.Instance(o,s),l=a.exports.__wbindgen_start;return i.__wbg_set_wasm(a.exports),l(),i.QueryCompiler})(),e.activeProvider!==void 0&&(ui[e.activeProvider]=n)):n=ui[e.activeProvider],await n}};var hm="P2038",se=M("prisma:client:clientEngine"),al=globalThis;al.PRISMA_WASM_PANIC_REGISTRY={set_message(e){throw new qt(e,_r)}};var jt=class{name="ClientEngine";#e;#t={type:"disconnected"};#r;#i;#o;#s;config;datamodel;logEmitter;logQueries;logLevel;tracingHelper;#a;constructor(t,r){if(t.accelerateUrl!==void 0)this.#i={remote:!0,accelerateUrl:t.accelerateUrl};else if(t.adapter)this.#i={remote:!1,driverAdapterFactory:t.adapter},se("Using driver adapter: %O",t.adapter);else throw new ci("PrismaClient requires a driver adapter to connect to your database, but none was provided. Pass one to the PrismaClient constructor, e.g. `new PrismaClient({ adapter })`. Learn more: https://pris.ly/d/driver-adapters",t.clientVersion,hm);this.#r=r??rl,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,this.#o=t.queryPlanCacheMaxSize===0?void 0:new Lr(t.queryPlanCacheMaxSize),this.#s=$t.deserialize(t.parameterizationSchema,n=>{if(!Object.hasOwn(t.runtimeDataModel.enums,n))return;let i={};for(let o of t.runtimeDataModel.enums[n].values)i[o.name]=o.dbName??o.name;return i}),t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&(this.#a=n=>{this.logEmitter.emit("query",{...n,params:G(n.params),target:"ClientEngine"})})}async#n(){switch(this.#t.type){case"disconnected":{let t=this.tracingHelper.runInChildSpan("connect",async()=>{let r,n;try{r=await this.#u(),n=await this.#l(r)}catch(o){throw this.#t={type:"disconnected"},n?.free(),await r?.disconnect(),o}let i={executor:r,queryCompiler:n};return this.#t={type:"connected",engine:i},i});return this.#t={type:"connecting",promise:t},await t}case"connecting":return await this.#t.promise;case"connected":return this.#t.engine;case"disconnecting":return await this.#t.promise,await this.#n()}}async#u(){return this.#i.remote?new Br({clientVersion:this.config.clientVersion,accelerateUrl:this.#i.accelerateUrl,logEmitter:this.logEmitter,logLevel:this.logLevel,logQueries:this.logQueries,tracingHelper:this.tracingHelper,sqlCommenters:this.config.sqlCommenters}):await $r.connect({driverAdapterFactory:this.#i.driverAdapterFactory,tracingHelper:this.tracingHelper,transactionOptions:{...this.config.transactionOptions,isolationLevel:this.#g(this.config.transactionOptions.isolationLevel)},onQuery:this.#a,provider:this.config.activeProvider,sqlCommenters:this.config.sqlCommenters})}async#l(t){let r=this.#e;r===void 0&&(r=await this.#r.loadQueryCompiler(this.config),this.#e=r);let{provider:n,connectionInfo:i}=await t.getConnectionInfo();try{return this.#m(()=>new r({datamodel:this.datamodel,provider:n,connectionInfo:i}),void 0,!1)}catch(o){throw this.#c(o)}}#c(t){if(t instanceof qt)return t;try{let r=JSON.parse(t.message);return new ci(r.message,this.config.clientVersion,r.error_code)}catch{return t}}#p(t,r){if(t instanceof ci)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new qt(il(this,t.message,r),this.config.clientVersion);if(t instanceof k)return new pi(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion});try{let n=JSON.parse(t);return new nl(`${n.message}
|
|
65
|
+
${n.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#d(t){return t instanceof qt?t:typeof t.message=="string"&&typeof t.code=="string"?new pi(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion}):typeof t.message=="string"?new nl(t.message,{clientVersion:this.config.clientVersion}):t}#m(t,r,n=!0){let i=al.PRISMA_WASM_PANIC_REGISTRY.set_message,o;global.PRISMA_WASM_PANIC_REGISTRY.set_message=s=>{o=s};try{return t()}finally{if(global.PRISMA_WASM_PANIC_REGISTRY.set_message=i,o)throw this.#e=void 0,n&&this.stop().catch(s=>se("failed to disconnect:",s)),new qt(il(this,o,r),this.config.clientVersion)}}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the client engine, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.')}async start(){await this.#n()}async stop(){switch(this.#t.type){case"disconnected":return;case"connecting":return await this.#t.promise,await this.stop();case"connected":{let t=this.#t.engine,r=this.tracingHelper.runInChildSpan("disconnect",async()=>{try{await t.executor.disconnect(),t.queryCompiler.free()}finally{this.#t={type:"disconnected"}}});return this.#t={type:"disconnecting",promise:r},await r}case"disconnecting":return await this.#t.promise}}version(){return"unknown"}async transaction(t,r,n){let i,{executor:o}=await this.#n();try{if(t==="start"){let s=n;i=await o.startTransaction({...s,isolationLevel:this.#g(s.isolationLevel)})}else if(t==="commit"){let s=n;await o.commitTransaction(s)}else if(t==="rollback"){let s=n;await o.rollbackTransaction(s)}else ne(t,"Invalid transaction action.")}catch(s){throw this.#p(s)}return i?{id:i.id,payload:void 0}:void 0}async request(t,{interactiveTransaction:r,customDataProxyFetch:n}){se("sending request");let{executor:i,queryCompiler:o}=await this.#n().catch(u=>{throw this.#p(u,JSON.stringify(t))}),s,a={},l=t.query;if(ol(t))s=sl(t);else{let{parameterizedQuery:u,placeholderValues:c}=ii(t,this.#s),p=JSON.stringify(u);a=c,l=u.query;let d=t.action!=="createMany"&&t.action!=="createManyAndReturn",h=d?this.#o?.getSingle(p):void 0;h?(se("query plan cache hit"),s=h):(se("query plan cache miss"),s=this.#f(u,p,o),d&&this.#o?.setSingle(p,s))}try{se("query plan created",s);let u=await i.execute({plan:s,model:t.modelName,operation:t.action,placeholderValues:a,transaction:r,batchIndex:void 0,customFetch:n?.(globalThis.fetch),queryInfo:{type:"single",modelName:t.modelName,action:t.action,query:l}});return se("query plan executed"),{data:{[t.action]:u}}}catch(u){throw this.#p(u,JSON.stringify(t))}}async requestBatch(t,{transaction:r,customDataProxyFetch:n}){if(t.length===0)return[];let i=t[0].action,o=t[0].modelName,s=Ba(t,r),a=JSON.stringify(s),{executor:l,queryCompiler:u}=await this.#n().catch(m=>{throw this.#p(m,a)}),c=o===void 0,p,d={},h=t.map(m=>m.query);if(c)p=this.#y(t,a,u);else{let{parameterizedBatch:m,placeholderValues:x}=oi(s,this.#s),C=JSON.stringify(m);d=x,h=m.batch.map(w=>w.query);let S=this.#o?.getBatch(C);if(S)se("batch query plan cache hit"),p=S;else{se("batch query plan cache miss");try{p=this.#y(m.batch,C,u),this.#o?.setBatch(C,p)}catch(w){throw this.#d(w)}}}try{let m;switch(r?.kind==="itx"&&(m=r.options),p.type){case"multi":{if(r?.kind!=="itx"){let w=r?.options,b={maxWait:w?.maxWait??this.config.transactionOptions.maxWait,timeout:w?.timeout??this.config.transactionOptions.timeout,isolationLevel:w?.isolationLevel??this.config.transactionOptions.isolationLevel};m=await this.transaction("start",{},b)}let x=[],C=!1,S;for(let[w,b]of p.plans.entries())try{let D=await l.execute({plan:b,placeholderValues:d,model:t[w].modelName,operation:t[w].action,batchIndex:w,transaction:m,customFetch:n?.(globalThis.fetch),queryInfo:{type:"single",modelName:t[w].modelName,action:t[w].action,query:h[w]}});x.push({data:{[t[w].action]:D}})}catch(D){if(S??=r?.kind!=="batch"&&t.every(te=>te.action==="findUnique"||te.action==="findUniqueOrThrow"),x.push(D),C=!0,!S)break}return m!==void 0&&r?.kind!=="itx"&&(C?await this.transaction("rollback",{},m):await this.transaction("commit",{},m)),x}case"compacted":{if(!t.every(S=>S.action===i&&S.modelName===o)){let S=t.map(b=>b.action).join(", "),w=t.map(b=>b.modelName).join(", ");throw new Error(`Internal error: All queries in a compacted batch must have the same action and model name, but received actions: [${S}] and model names: [${w}]. This indicates a bug in the client. Please report this issue to the Prisma team with your query details.`)}if(o===void 0)throw new Error("Internal error: A compacted batch cannot contain raw queries. This indicates a bug in the client. Please report this issue to the Prisma team with your query details.");let x=await l.execute({plan:p.plan,placeholderValues:d,model:o,operation:i,batchIndex:void 0,transaction:m,customFetch:n?.(globalThis.fetch),queryInfo:{type:"compacted",action:i,modelName:o,queries:h}});return ps(x,p,d).map(S=>({data:{[i]:S}}))}}}catch(m){throw this.#p(m,a)}}async apiKey(){let{executor:t}=await this.#n();return t.apiKey()}#f(t,r,n){try{return this.#m(()=>this.#h({queries:[t],execute:()=>n.compile(r)}))}catch(i){throw this.#d(i)}}#y(t,r,n){if(t.every(ol))return{type:"multi",plans:t.map(i=>sl(i))};try{return this.#m(()=>this.#h({queries:t,execute:()=>n.compileBatch(r)}))}catch(i){throw this.#d(i)}}#g(t){switch(t){case void 0:return;case"ReadUncommitted":return"READ UNCOMMITTED";case"ReadCommitted":return"READ COMMITTED";case"RepeatableRead":return"REPEATABLE READ";case"Serializable":return"SERIALIZABLE";case"Snapshot":return"SNAPSHOT";default:throw new pi(`Inconsistent column data: Conversion failed: Invalid isolation level \`${t}\``,{code:"P2023",clientVersion:this.config.clientVersion,meta:{providedIsolationLevel:t}})}}#h({queries:t,execute:r}){return this.tracingHelper.runInChildSpan({name:"compile",attributes:{models:t.map(n=>n.modelName).filter(n=>n!==void 0),actions:t.map(n=>n.action)}},r)}};function il(e,t,r){return za({binaryTarget:void 0,title:t,version:e.config.clientVersion,engineVersion:"unknown",database:e.config.activeProvider,query:r})}function ol(e){return e.action==="queryRaw"||e.action==="executeRaw"}function sl(e){let t=e.query.arguments.query,{args:r,argTypes:n}=ja(e.query.arguments.parameters);return{type:e.action==="queryRaw"?"query":"execute",args:{type:"rawSql",sql:t,args:r,argTypes:n}}}function ll(e){return new jt(e)}var ul=e=>({command:e});import{Sql as Pm}from"@prisma/client-runtime-utils";var cl=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);import{Decimal as wm,PrismaClientValidationError as bm}from"@prisma/client-runtime-utils";function Ye(e,t){try{return pl(e,"fast",t)}catch(r){if(r instanceof TypeError)return pl(e,"slow",t);throw r}}function pl(e,t,r){return JSON.stringify(e.map(n=>ml(n,t,r)))}function ml(e,t,r){if(Array.isArray(e))return e.map(n=>ml(n,t,r));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(Ne(e)){if(!De(e))throw new bm("Provided Date object is invalid",{clientVersion:r});return{prisma__type:"date",prisma__value:e.toJSON()}}if(wm.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(xm(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:n,byteOffset:i,byteLength:o}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(n,i,o).toString("base64")}}return typeof e=="object"&&t==="slow"?fl(e):e}function xm(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function fl(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(dl);let t={};for(let r of Object.keys(e))t[r]=dl(e[r]);return t}function dl(e){return typeof e=="bigint"?e.toString():fl(e)}var Em=/^(\s*alter\s)/i,gl=M("prisma:client");function di(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&Em.exec(t))throw new Error(`Running ALTER using ${n} is not supported
|
|
66
66
|
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.
|
|
67
67
|
|
|
68
68
|
Example:
|
|
69
69
|
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
|
|
70
70
|
|
|
71
71
|
More Information: https://pris.ly/d/execute-raw
|
|
72
|
-
`)}var
|
|
73
|
-
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};
|
|
72
|
+
`)}var mi=({clientMethod:e,activeProvider:t,clientVersion:r})=>n=>{let i="",o;if(pr(n))i=n.sql,o={values:Ye(n.values,r),__prismaRawParameters__:!0};else if(Array.isArray(n)){let[s,...a]=n;i=s,o={values:Ye(a||[],r),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{i=n.sql,o={values:Ye(n.values,r),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{i=n.text,o={values:Ye(n.values,r),__prismaRawParameters__:!0};break}case"sqlserver":{i=cl(n),o={values:Ye(n.values,r),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return o?.values?gl(`prisma.${e}(${i}, ${o.values})`):gl(`prisma.${e}(${i})`),{query:i,parameters:o}},yl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new Pm(t,r)}},hl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function fi(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=wl(r(s)):wl(r(s))}catch(a){return Promise.reject(a)}};return{get spec(){return n},then(s,a){return o().then(s,a)},catch(s){return o().catch(s)},finally(s){return o().finally(s)},requestTransaction(s){let a=o(s);return a.requestTransaction?a.requestTransaction(s):a},[Symbol.toStringTag]:"PrismaPromise"}}}function wl(e){return typeof e.then=="function"?e:Promise.resolve(e)}var bl={name:"@prisma/instrumentation-contract",version:"7.10.0-dev.23",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}};var vm=bl.version.split(".")[0],Sm="PRISMA_INSTRUMENTATION",Am=`V${vm}_PRISMA_INSTRUMENTATION`,xl=globalThis;function Pl(){let e=xl[Am];return e?.helper?e.helper:xl[Sm]?.helper}var Rm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(e,t,r){for(let n of t)r(n)},getActiveContext(){},runInChildSpan(e,t){return t()}},gi=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(t){return this.getTracingHelper().getTraceParent(t)}dispatchEngineSpans(t,r,n){return this.getTracingHelper().dispatchEngineSpans(t,r,n)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getTracingHelper().runInChildSpan(t,r)}getTracingHelper(){return Pl()??Rm}};function El(){return new gi}function Tl(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}function vl(e){return typeof e=="string"?e:e.reduce((t,r)=>{let n=typeof r=="string"?r:r.level;return n==="query"?t:t&&(r==="info"||t==="info")?"info":n},void 0)}import{hasBatchIndex as Om}from"@prisma/client-runtime-utils";function hi(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(yi(e.query.arguments)),t.push(yi(e.query.selection)),t.join("")}function yi(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${yi(n)})`:r}).join(" ")})`}var Cm={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,updateManyAndReturn:!0,updateOne:!0,upsertOne:!0};function wi(e){return Cm[e]}var Qr=class{constructor(t){this.options=t;this.batches={}}batches;tickActive=!1;request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:t,resolve:n,reject:i})})):this.options.singleLoader(t)}dispatchBatches(){for(let t in this.batches){let r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};import{Decimal as Im}from"@prisma/client-runtime-utils";function Ie(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":return new Uint8Array(Buffer.from(t,"base64"));case"decimal":return new Im(t);case"datetime":case"date":return new Date(t);case"time":return new Date(`1970-01-01T${t}Z`);case"bigint-array":return t.map(r=>Ie("bigint",r));case"bytes-array":return t.map(r=>Ie("bytes",r));case"decimal-array":return t.map(r=>Ie("decimal",r));case"datetime-array":return t.map(r=>Ie("datetime",r));case"date-array":return t.map(r=>Ie("date",r));case"time-array":return t.map(r=>Ie("time",r));default:return t}}function bi(e){let t=[],r=km(e);for(let n=0;n<e.rows.length;n++){let i=e.rows[n],o={...r};for(let s=0;s<i.length;s++)o[e.columns[s]]=Ie(e.types[s],i[s]);t.push(o)}return t}function km(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var Nm=M("prisma:client:request_handler"),Hr=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new Qr({batchLoader:Yo(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(p=>p.protocolQuery),l=this.client._tracingHelper.getTraceParent(s),u=n.some(p=>wi(p.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:l,transaction:Dm(o),containsWrite:u,customDataProxyFetch:i})).map((p,d)=>{if(p instanceof Error)return p;try{return this.mapQueryEngineResult(n[d],p)}catch(h){return h}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?Sl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:wi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>{if(n.transaction?.kind==="itx"){let i=hi(n.protocolQuery);return`itx-${n.transaction.id}${i?`-${i}`:""}`}return n.transaction?.id?`transaction-${n.transaction.id}`:hi(n.protocolQuery)},batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(t){try{return await this.dataloader.request(t)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=t;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:t.globalOmit})}}mapQueryEngineResult({dataPath:t,unpacker:r},n){let i=n?.data,o=this.unpack(i,t,r);return process.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(t){try{this.handleRequestError(t)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:t.clientMethod,timestamp:new Date}),r}}handleRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(Nm(t),Mm(t,i))throw t;if(t instanceof xi&&Fm(t)){let u=Al(t.meta);ar({args:o,errors:[u],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let l=t.message;if(n&&(l=Yt({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:l})),l=this.sanitizeMessage(l),t.code){let u=s?{modelName:s,...t.meta}:t.meta;throw new xi(l,{code:t.code,clientVersion:this.client._clientVersion,meta:u,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new Jr(l,this.client._clientVersion);if(t instanceof Pi)throw new Pi(l,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof ke)throw new ke(l,this.client._clientVersion);if(t instanceof Jr)throw new Jr(l,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?Oe(t):t}unpack(t,r,n){if(!t||(t.data&&(t=t.data),!t))return t;let i=Object.keys(t)[0],o=Object.values(t)[0],s=_m(r),a=hn(o,s),l=i==="queryRaw"?bi(a):Z(a);return n?n(l):l}get[Symbol.toStringTag](){return"RequestHandler"}};function Dm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel,maxWait:e.maxWait,timeout:e.timeout}};if(e.kind==="itx")return{kind:"itx",options:Sl(e)};ne(e,"Unknown transaction kind")}}function Sl(e){return{id:e.id,payload:e.payload}}function Mm(e,t){return Om(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Fm(e){return e.code==="P2009"||e.code==="P2012"}function Al(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Al)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}function _m(e){let t=[];for(let r=1;r<e.length;r+=2)t.push(e[r]);return t}var Ei=_r;var Ol=ye(sn());var T=class extends Error{constructor(t){super(t+`
|
|
73
|
+
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};ft(T,"PrismaClientConstructorValidationError");var Rl=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","queryPlanCacheMaxSize","__internal"],Cl=["pretty","colorless","minimal"],Il=["info","query","warn","error"],$m={adapter:()=>{},accelerateUrl:e=>{if(e!==void 0){if(typeof e!="string")throw new T(`Invalid value ${JSON.stringify(e)} for "accelerateUrl" provided to PrismaClient constructor.`);if(e.trim().length===0)throw new T('"accelerateUrl" provided to PrismaClient constructor must be a non-empty string.')}},errorFormat:e=>{if(e){if(typeof e!="string")throw new T(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Cl.includes(e)){let t=Ut(e,Cl);throw new T(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new T(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!Il.includes(r)){let n=Ut(r,Il);throw new T(`Invalid log level "${r}" provided to PrismaClient constructor.${n}`)}}for(let r of e){t(r);let n={level:t,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=Ut(i,o);throw new T(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(r&&typeof r=="object")for(let[i,o]of Object.entries(r))if(n[i])n[i](o);else throw new T(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let t=e.maxWait;if(t!=null&&t<=0)throw new T(`Invalid value ${t} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let r=e.timeout;if(r!=null&&r<=0)throw new T(`Invalid value ${r} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,t)=>{if(typeof e!="object")throw new T('"omit" option is expected to be an object.');if(e===null)throw new T('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=qm(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let l=o.fields.find(u=>u.name===s);if(!l){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(l.relationName){r.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&r.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(r.length>0)throw new T(jm(e,r))},queryPlanCacheMaxSize:e=>{if(e!==void 0){if(typeof e!="number")throw new T(`Invalid value ${JSON.stringify(e)} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Expected a number.`);if(!Number.isInteger(e))throw new T(`Invalid value ${e} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Expected an integer.`);if(e<0)throw new T(`Invalid value ${e} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Cache size needs to be greater or equal to 0.`)}},comments:e=>{if(e!==void 0){if(!Array.isArray(e))throw new T(`Invalid value ${JSON.stringify(e)} for "comments" provided to PrismaClient constructor. Expected an array of SQL commenter plugins.`);for(let t=0;t<e.length;t++)if(typeof e[t]!="function")throw new T(`Invalid value at index ${t} for "comments" provided to PrismaClient constructor. Each plugin must be a function.`)}},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new T(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=Ut(r,t);throw new T(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Lm(e){let t=e.adapter!==void 0,r=e.accelerateUrl!==void 0;if(t&&r)throw new T('The "adapter" and "accelerateUrl" options are mutually exclusive. Please provide only one of them.');if(!t&&!r)throw new T(`PrismaClient requires a driver adapter to connect to your database, but none was provided.
|
|
74
74
|
|
|
75
75
|
Pass a driver adapter to the PrismaClient constructor, for example:
|
|
76
76
|
|
|
@@ -82,11 +82,11 @@ Pass a driver adapter to the PrismaClient constructor, for example:
|
|
|
82
82
|
|
|
83
83
|
Learn more about driver adapters: https://pris.ly/d/driver-adapters
|
|
84
84
|
|
|
85
|
-
If you use Prisma Accelerate instead of connecting to your database directly, pass \`accelerateUrl\` to the PrismaClient constructor instead of \`adapter\`.`)}function
|
|
85
|
+
If you use Prisma Accelerate instead of connecting to your database directly, pass \`accelerateUrl\` to the PrismaClient constructor instead of \`adapter\`.`)}function Nl(e,t){for(let[r,n]of Object.entries(e)){if(!Rl.includes(r)){let i=Ut(r,Rl);throw new T(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}$m[r](n,t)}Lm(e)}function Ut(e,t){if(t.length===0||typeof e!="string")return"";let r=Vm(e,t);return r?` Did you mean "${r}"?`:""}function Vm(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Ol.default)(e,i)}));r.sort((i,o)=>i.distance<o.distance?-1:1);let n=r[0];return n.distance<3?n.value:null}function qm(e,t){return kl(t.models,e)??kl(t.types,e)}function kl(e,t){let r=Object.keys(e).find(n=>le(n)===t);if(r)return e[r]}function jm(e,t){let r=Ue(e);for(let o of t)switch(o.kind){case"UnknownModel":r.arguments.getField(o.modelKey)?.markAsError(),r.addErrorMessage(()=>`Unknown model name: ${o.modelKey}.`);break;case"UnknownField":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>`Model "${o.modelKey}" does not have a field named "${o.fieldName}".`);break;case"RelationInOmit":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>'Relations are already excluded by default and can not be specified in "omit".');break;case"InvalidFieldValue":r.arguments.getDeepFieldValue([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>"Omit field option value must be a boolean.");break}let{message:n,args:i}=sr(r,"colorless");return`Error validating "omit" option:
|
|
86
86
|
|
|
87
87
|
${i}
|
|
88
88
|
|
|
89
|
-
${n}`}import{hasBatchIndex as
|
|
89
|
+
${n}`}import{hasBatchIndex as Um}from"@prisma/client-runtime-utils";function Dl(e){return e.length===0?Promise.resolve([]):new Promise((t,r)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?r(i):t(n)))},l=u=>{o||(o=!0,r(u))};for(let u=0;u<e.length;u++)e[u].then(c=>{n[u]=c,a()},c=>{if(!Um(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var et=M("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var Hm={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},_l=Symbol.for("prisma.client.transaction.scope_context");function Ml(e){let r=e[_l];if(r===void 0)return{kind:"top-level"};if(Gm(r))return r;throw new Error("Internal error: inconsistent transaction scope context.")}function Gm(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="nested"&&typeof t.txId=="string"&&typeof t.scopeId=="string"&&zm(t.scopeState)}function zm(e){return typeof e!="object"||e===null?!1:Array.isArray(e.stack)}function Wm(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}var Km={id:0,nextId(){return++this.id}};function Zm(e){class t{_originalClient=this;_runtimeDataModel;_requestHandler;_connectionPromise;_disconnectionPromise;_engineConfig;_accelerateEngineConfig;_clientVersion;_errorFormat;_tracingHelper;_previewFeatures;_activeProvider;_globalOmit;_extensions;_engine;_appliedParent;_createPrismaPromise=fi();constructor(n){if(!n)throw new ke(`PrismaClient was instantiated without any options. A driver adapter is required to connect to your database.
|
|
90
90
|
|
|
91
91
|
Pass a driver adapter to the PrismaClient constructor, for example:
|
|
92
92
|
|
|
@@ -98,13 +98,13 @@ Pass a driver adapter to the PrismaClient constructor, for example:
|
|
|
98
98
|
|
|
99
99
|
Learn more about driver adapters: https://pris.ly/d/driver-adapters
|
|
100
100
|
|
|
101
|
-
If you use Prisma Accelerate instead of connecting to your database directly, pass \`accelerateUrl\` to the PrismaClient constructor instead of \`adapter\`.`,
|
|
101
|
+
If you use Prisma Accelerate instead of connecting to your database directly, pass \`accelerateUrl\` to the PrismaClient constructor instead of \`adapter\`.`,Ei);e=n.__internal?.configOverride?.(e)??e,Nl(n,e);let i=new Jm().on("error",()=>{});this._extensions=Be.empty(),this._previewFeatures=e.previewFeatures,this._clientVersion=e.clientVersion??Ei,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=El();let o;if(n.adapter){o=n.adapter;let s=e.activeProvider==="postgresql"||e.activeProvider==="cockroachdb"?"postgres":e.activeProvider;if(o.provider!==s)throw new ke(`The Driver Adapter \`${o.adapterName}\`, based on \`${o.provider}\`, is not compatible with the provider \`${s}\` specified in the Prisma schema.`,this._clientVersion)}try{let s=n??{},l=(s.__internal??{}).debug===!0;if(l&&M.enable("prisma:client"),s.errorFormat?this._errorFormat=s.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={enableDebugLogs:l,logLevel:s.log&&vl(s.log),logQueries:s.log&&!!(typeof s.log=="string"?s.log==="query":s.log.find(u=>typeof u=="string"?u==="query":u.level==="query")),compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:s.transactionOptions?.maxWait??2e3,timeout:s.transactionOptions?.timeout??5e3,isolationLevel:s.transactionOptions?.isolationLevel},logEmitter:i,adapter:o,accelerateUrl:s.accelerateUrl,sqlCommenters:s.comments,parameterizationSchema:e.parameterizationSchema,runtimeDataModel:e.runtimeDataModel,queryPlanCacheMaxSize:n.queryPlanCacheMaxSize},this._accelerateEngineConfig=Object.create(this._engineConfig),this._accelerateEngineConfig.accelerateUtils={resolveDatasourceUrl:()=>{if(s.accelerateUrl)return s.accelerateUrl;throw new ke(`\`accelerateUrl\` is required when using \`@prisma/extension-accelerate\`:
|
|
102
102
|
|
|
103
103
|
new PrismaClient({
|
|
104
104
|
accelerateUrl: "prisma://...",
|
|
105
105
|
}).$extends(withAccelerate())
|
|
106
|
-
`,e.clientVersion)}},
|
|
107
|
-
`)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:x,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:c,unpacker:p,otelParentCtx:d,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:h})}catch(m){throw m.clientVersion=this._clientVersion,m}}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$extends=
|
|
106
|
+
`,e.clientVersion)}},et("clientVersion",e.clientVersion),this._engine=ll(this._engineConfig),this._requestHandler=new Hr(this,i),s.log)for(let u of s.log){let c=typeof u=="string"?u:u.emit==="stdout"?u.level:null;c&&this.$on(c,p=>{mt.log(`${mt.tags[c]??""}`,p.message||p.query)})}}catch(s){throw s.clientVersion=this._clientVersion,s}return this._appliedParent=Tt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$on(n,i){return n==="beforeExit"?this._engine.onBeforeExit(i):n&&this._engineConfig.logEmitter.on(n,i),this}$connect(){try{return this._engine.start()}catch(n){throw n.clientVersion=this._clientVersion,n}}async $disconnect(){try{await this._engine.stop()}catch(n){throw n.clientVersion=this._clientVersion,n}finally{Li()}}$executeRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"executeRaw",args:o,transaction:n,clientMethod:i,argsMapper:mi({clientMethod:i,activeProvider:a,clientVersion:this._clientVersion}),callsite:ce(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$executeRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0){let[s,a]=Fl(n,i);return di(this._activeProvider,s.text,s.values,Array.isArray(n)?"prisma.$executeRaw`<SQL>`":"prisma.$executeRaw(sql`<SQL>`)"),this.$executeRawInternal(o,"$executeRaw",s,a)}throw new tt("`$executeRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#executeraw\n",{clientVersion:this._clientVersion})})}$executeRawUnsafe(n,...i){return this._createPrismaPromise(o=>(di(this._activeProvider,n,i,"prisma.$executeRawUnsafe(<SQL>, [...values])"),this.$executeRawInternal(o,"$executeRawUnsafe",[n,...i])))}$runCommandRaw(n){if(e.activeProvider!=="mongodb")throw new tt(`The ${e.activeProvider} provider does not support $runCommandRaw. Use the mongodb provider.`,{clientVersion:this._clientVersion});return this._createPrismaPromise(i=>this._request({args:n,clientMethod:"$runCommandRaw",dataPath:[],action:"runCommandRaw",argsMapper:ul,callsite:ce(this._errorFormat),transaction:i}))}async $queryRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"queryRaw",args:o,transaction:n,clientMethod:i,argsMapper:mi({clientMethod:i,activeProvider:a,clientVersion:this._clientVersion}),callsite:ce(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$queryRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0)return this.$queryRawInternal(o,"$queryRaw",...Fl(n,i));throw new tt("`$queryRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#queryraw\n",{clientVersion:this._clientVersion})})}$queryRawTyped(n){return this._createPrismaPromise(i=>{if(!this._hasPreviewFlag("typedSql"))throw new tt("`typedSql` preview feature must be enabled in order to access $queryRawTyped API",{clientVersion:this._clientVersion});return this.$queryRawInternal(i,"$queryRawTyped",n)})}$queryRawUnsafe(n,...i){return this._createPrismaPromise(o=>this.$queryRawInternal(o,"$queryRawUnsafe",[n,...i]))}_transactionWithArray({promises:n,options:i}){let o=Km.nextId(),s=Tl(n.length),a=n.map((l,u)=>{if(l?.[Symbol.toStringTag]!=="PrismaPromise")throw new Error("All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.");let c=i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel,p={kind:"batch",id:o,index:u,isolationLevel:c,maxWait:i?.maxWait??this._engineConfig.transactionOptions.maxWait,timeout:i?.timeout??this._engineConfig.transactionOptions.timeout,lock:s};return l.requestTransaction?.(p)??l});return Dl(a)}async _transactionWithCallback({callback:n,options:i={}}){let o=Ml(this),s=o.kind==="nested",a=s?o.scopeState:{stack:[]},l=a.stack,u=Wm();if(s){if(l.at(-1)!==o.scopeId)throw new Error("Concurrent nested transactions are not supported");i.newTxId=o.txId}l.push(u);let c={traceparent:this._tracingHelper.getTraceParent()},p={maxWait:i?.maxWait??this._engineConfig.transactionOptions.maxWait,timeout:i?.timeout??this._engineConfig.transactionOptions.timeout,isolationLevel:i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel,newTxId:i.newTxId},d;try{d=await this._engine.transaction("start",c,p)}catch(m){throw l.at(-1)===u&&l.pop(),m}let h;try{let m={kind:"itx",...d};if(h=await n(this._createItxClient(m,u,a)),s){if(l.at(-1)!==u)throw new Error("Nested transactions must be closed in reverse order of creation.")}else if(l.length!==1)throw new Error("Cannot close transaction while a nested transaction is still active.");await this._engine.transaction("commit",c,d)}catch(m){let C=l.at(-1)!==u?Math.max(1,l.length):1;for(let S=0;S<C;S++)await this._engine.transaction("rollback",c,d).catch(w=>{et("rollback attempt %d/%d failed: %O",S+1,C,w)});throw m}finally{l.at(-1)===u?l.pop():l.length=0}return h}_createItxClient(n,i,o){let s={kind:"nested",txId:n.id,scopeId:i,scopeState:o};return H(Tt(H(Uo(this),[F("_appliedParent",()=>this._appliedParent._createItxClient(n,i,o)),F("_createPrismaPromise",()=>fi(n)),F(_l,()=>s)])),[Qe(Go)])}$transaction(n,i){let o;typeof n=="function"?this._engineConfig.adapter?.adapterName==="@prisma/adapter-d1"?o=()=>{throw new Error("Cloudflare D1 does not support interactive transactions. We recommend you to refactor your queries with that limitation in mind, and use batch transactions with `prisma.$transactions([])` where applicable.")}:e.activeProvider==="mongodb"&&Ml(this).kind==="nested"?o=()=>{throw new tt(`The ${e.activeProvider} provider does not support nested transactions`,{clientVersion:this._clientVersion})}:o=()=>this._transactionWithCallback({callback:n,options:i}):o=()=>this._transactionWithArray({promises:n,options:i});let s={name:"transaction",attributes:{method:"$transaction"}};return this._tracingHelper.runInChildSpan(s,o)}_request(n){n.otelParentCtx=this._tracingHelper.getActiveContext();let i=n.middlewareArgsMapper??Hm,o={args:i.requestArgsToMiddlewareArgs(n.args),dataPath:n.dataPath,runInTransaction:!!n.transaction,action:n.action,model:n.model},s={operation:{name:"operation",attributes:{method:o.action,model:o.model,name:o.model?`${o.model}.${o.action}`:o.action}}},a=async l=>{let{runInTransaction:u,args:c,...p}=l,d={...n,...p};c&&(d.args=i.middlewareArgsToRequestArgs(c)),n.transaction!==void 0&&u===!1&&delete d.transaction;let h=await Xo(this,d);if(!d.model)return h;let m=ns({dataPath:d.dataPath,modelName:d.model,args:d.args,runtimeDataModel:this._runtimeDataModel});return Ho({result:h,modelName:m.modelName,args:m.args,extensions:this._extensions,runtimeDataModel:this._runtimeDataModel,globalOmit:this._globalOmit})};return this._tracingHelper.runInChildSpan(s.operation,()=>new Qm("prisma-client-request").runInAsyncScope(()=>a(o)))}async _executeRequest({args:n,clientMethod:i,dataPath:o,callsite:s,action:a,model:l,argsMapper:u,transaction:c,unpacker:p,otelParentCtx:d,customDataProxyFetch:h}){try{n=u?u(n):n;let m={name:"serialize"},x=this._tracingHelper.runInChildSpan(m,()=>pn({modelName:l,runtimeDataModel:this._runtimeDataModel,action:a,args:n,clientMethod:i,callsite:s,extensions:this._extensions,errorFormat:this._errorFormat,clientVersion:this._clientVersion,previewFeatures:this._previewFeatures,globalOmit:this._globalOmit}));return M.enabled("prisma:client")&&(et("Prisma Client call:"),et(`prisma.${i}(${Oo(n)})`),et("Generated request:"),et(JSON.stringify(x,null,2)+`
|
|
107
|
+
`)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:x,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:c,unpacker:p,otelParentCtx:d,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:h})}catch(m){throw m.clientVersion=this._clientVersion,m}}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$extends=Bo}return t}function Fl(e,t){return Xm(e)?[new Bm(e,t),yl]:[e,hl]}function Xm(e){return Array.isArray(e)&&Array.isArray(e.raw)}var Ym=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function ef(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Ym.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}var tf=()=>globalThis.process?.release?.name==="node",rf=()=>!!globalThis.Bun||!!globalThis.process?.versions?.bun,nf=()=>!!globalThis.Deno,of=()=>typeof globalThis.Netlify=="object",sf=()=>typeof globalThis.EdgeRuntime=="object",af=()=>globalThis.navigator?.userAgent==="Cloudflare-Workers";function lf(){return[[of,"netlify"],[sf,"edge-light"],[af,"workerd"],[nf,"deno"],[rf,"bun"],[tf,"node"]].flatMap(r=>r[0]()?[r[1]]:[]).at(0)??""}var uf={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 cf(){let e=lf();return{id:e,prettyName:uf[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}import{PrismaClientInitializationError as ke,PrismaClientKnownRequestError as xi,PrismaClientRustPanicError as Jr,PrismaClientUnknownRequestError as Pi,PrismaClientValidationError as tt}from"@prisma/client-runtime-utils";import{empty as LS,join as VS,raw as qS,Sql as jS,sql as US}from"@prisma/client-runtime-utils";import{AnyNull as QS,DbNull as JS,isAnyNull as HS,isDbNull as GS,isJsonNull as zS,isObjectEnumValue as WS,JsonNull as KS,NullTypes as ZS,ObjectEnumValue as XS}from"@prisma/client-runtime-utils";import{Decimal as eA}from"@prisma/client-runtime-utils";export{QS as AnyNull,Kt as DMMF,JS as DbNull,M as Debug,eA as Decimal,Ai as Extensions,KS as JsonNull,ZS as NullTypes,XS as ObjectEnumValue,ke as PrismaClientInitializationError,xi as PrismaClientKnownRequestError,Jr as PrismaClientRustPanicError,Pi as PrismaClientUnknownRequestError,tt as PrismaClientValidationError,Ci as Public,jS as Sql,pc as createParam,Ec as defineDmmfProperty,Z as deserializeJsonObject,bi as deserializeRawResult,Gl as dmmfToRuntimeDataModel,LS as empty,Zm as getPrismaClient,cf as getRuntime,HS as isAnyNull,GS as isDbNull,zS as isJsonNull,WS as isObjectEnumValue,VS as join,ef as makeStrictEnum,vc as makeTypedQueryFactory,qS as raw,pn as serializeJsonQuery,un as skip,US as sqltag,Zi as warnOnce};
|
|
108
108
|
/*! Bundled license information:
|
|
109
109
|
|
|
110
110
|
@noble/hashes/utils.js:
|