casualroom/apps/oa/db/generated/prisma/runtime/edge.js

35 lines
166 KiB
JavaScript
Raw Normal View History

2025-07-28 07:50:50 +08:00
/* !!! This is code generated by Prisma. Do not edit directly. !!!
/* eslint-disable */
"use strict";var Pa=Object.create;var lr=Object.defineProperty;var va=Object.getOwnPropertyDescriptor;var Ta=Object.getOwnPropertyNames;var Ca=Object.getPrototypeOf,Aa=Object.prototype.hasOwnProperty;var me=(e,t)=>()=>(e&&(t=e(e=0)),t);var Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pt=(e,t)=>{for(var r in t)lr(e,r,{get:t[r],enumerable:!0})},li=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ta(t))!Aa.call(e,i)&&i!==r&&lr(e,i,{get:()=>t[i],enumerable:!(n=va(t,i))||n.enumerable});return e};var Le=(e,t,r)=>(r=e!=null?Pa(Ca(e)):{},li(t||!e||!e.__esModule?lr(r,"default",{value:e,enumerable:!0}):r,e)),Ra=e=>li(lr({},"__esModule",{value:!0}),e);var y,u=me(()=>{"use strict";y={nextTick:(e,...t)=>{setTimeout(()=>{e(...t)},0)},env:{},version:"",cwd:()=>"/",stderr:{},argv:["/bin/node"],pid:1e4}});var b,c=me(()=>{"use strict";b=globalThis.performance??(()=>{let e=Date.now();return{now:()=>Date.now()-e}})()});var E,p=me(()=>{"use strict";E=()=>{};E.prototype=E});var m=me(()=>{"use strict"});var Ri=Re(He=>{"use strict";d();u();c();p();m();var di=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Sa=di(e=>{"use strict";e.byteLength=l,e.toByteArray=g,e.fromByteArray=S;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(o=0,s=i.length;o<s;++o)t[o]=i[o],r[i.charCodeAt(o)]=o;var o,s;r[45]=62,r[95]=63;function a(C){var R=C.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var D=C.indexOf("=");D===-1&&(D=R);var M=D===R?0:4-D%4;return[D,M]}function l(C){var R=a(C),D=R[0],M=R[1];return(D+M)*3/4-M}function f(C,R,D){return(R+D)*3/4-D}function g(C){var R,D=a(C),M=D[0],U=D[1],k=new n(f(C,M,U)),F=0,ae=U>0?M-4:M,G;for(G=0;G<ae;G+=4)R=r[C.charCodeAt(G)]<<18|r[C.charCodeAt(G+1)]<<12|r[C.charCodeAt(G+2)]<<6|r[C.charCodeAt(G+3)],k[F++]=R>>16&255,k[F++]=R>>8&255,k[F++]=R&255;return U===2&&(R=r[C.charCodeAt(G)]<<2|r[C.charCodeAt(G+1)]>>4,k[F++]=R&255),U===1&&(R=r[C.charCodeAt(G)]<<10|r[C.charCodeAt(G+1)]<<4|r[C.charCodeAt(G+2)]>>2,k[F++]=R>>8&255,k[F++]=R&255),k}function h(C){return t[C>>18&63]+t[C>>12&63]+t[C>>6&63]+t[C&63]}function v(C,R,D){for(var M,U=[],k=R;k<D;k+=3)M=(C[k]<<16&16711680)+(C[k+1]<<8&65280)+(C[k+2]&255),U.push(h(M));return U.join("")}function S(C){for(var R,D=C.length,M=D%3,U=[],k=16383,F=0,ae=D-M;F<ae;F+=k)U.push(v(C,F,F+k>ae?ae:F+k));return M===1?(R=C[D-1],U.push(t[R>>2]+t[R<<4&63]+"==")):M===2&&(R=(C[D-2]<<8)+C[D-1],U.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),U.join("")}}),ka=di(e=>{e.read=function(t,r,n,i,o){var s,a,l=o*8-i-1,f=(1<<l)-1,g=f>>1,h=-7,v=n?o-1:0,S=n?-1:1,C=t[r+v];for(v+=S,s=C&(1<<-h)-1,C>>=-h,h+=l;h>0;s=s*256+t[r+v],v+=S,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=a*256+t[r+v],v+=S,h-=8);if(s===0)s=1-g;else{if(s===f)return a?NaN:(C?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-g}return(C?-1:1)*a*Math.pow(2,s-i)},e.write=function(t,r,n,i,o,s){var a,l,f,g=s*8-o-1,h=(1<<g)-1,v=h>>1,S=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=i?0:s-1,R=i?1:-1,D=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+v>=1?r+=S/f:r+=S*Math.pow(2,1-v),r*f>=2&&(a++,f/=2),a+v>=h?(l=0,a=h):a+v>=1?(l=(r*f-1)*Math.pow(2,o),a=a+v):(l=r*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;t[n+C]=l&255,C+=R,l/=256,o-=8);for(a=a<<o|l,g+=o;g>0;t[n+C]=a&255,C+=R,a/=256,g-=8);t[n+C-R]|=D*128}}),cn=Sa(),We=ka(),ui=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;He.Buffer=T;He.SlowBuffer=Na;He.INSPECT_MAX_BYTES=50;var ur=2147483647;He.kMaxLength=ur;T.TYPED_ARRAY_SUPPORT=Ia();!T.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ia(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!
`)}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 Rr(e){let t=e.showColors?Du:Mu,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=_u(e),Nu(r,t)}d();u();c();p();m();var _o=Le(Mn());d();u();c();p();m();function ko(e,t,r){let n=Io(e),i=Lu(n),o=Bu(i);o?Sr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Io(e){return e.errors.flatMap(t=>t.kind==="Union"?Io(t):[t])}function Lu(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:Uu(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Uu(e,t){return[...new Set(e.concat(t))]}function Bu(e){return An(e,(t,r)=>{let n=Ro(t),i=Ro(r);return n!==i?n-i:So(t)-So(r)})}function Ro(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function So(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}d();u();c();p();m();var le=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)}};d();u();c();p();m();d();u();c();p();m();Do();d();u();c();p();m();var it=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(`
`)}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}};Oo();d();u();c();p();m();d();u();c();p();m();var kr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};d();u();c();p();m();var Ir=e=>e,Or={bold:Ir,red:Ir,green:Ir,dim:Ir,enabled:!1},Mo={bold:pr,red:ze,green:Fi,dim:mr,enabled:!0},ot={write(e){e.writeLine(",")}};d();u();c();p();m();var we=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)))})}};d();u();c();p();m();var _e=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var st=class extends _e{items=[];addItem(t){return this.items.push(new kr(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 we("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(ot,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var at=class e extends _e{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 st&&(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 we("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(ot,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};d();u();c();p();m();var K=class extends _e{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new we(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};d();u();c();p();m();var Dt=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(ot,this.fie
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Vu(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){ju(e,t,i);return}if(n.hasField("select")){Gu(e,t);return}}if(r?.[Me(e.outputType.name)]){Qu(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function ju(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new le(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 Gu(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Lo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${_t(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 Dt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new le("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=Mt(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new at;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=Uo(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Lo(n,e.outputType);break;case"include":rc(n,e.outputType);break;case"omit":nc(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(_t(n)),i.join(" ")})}function Wu(e,t){let r=Uo(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 Ku(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),ic(n,e.arguments)),t.addErrorMessage(i=>No(i,r,e.arguments.map(o=>o.name)))}function Hu(e,t){let[r,n]=Mt(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Bo(o,e.inputType)}t.addErrorMessage(o=>No(o,n,e.inputType.fields.map(s=>s.name)))}function No(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=sc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(_t(e)),n.join(" ")}function zu(e,t){let r;t.addErrorMessage(l=>r?.value instanceof K&&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]=Mt(e.argumentPath),s=new Dt,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 le(o,s).makeRequired())}else{let l=e.inputTypes.map(Fo).join(" | ");a.addSuggestion(new le(o,l).makeRequired())}}function Fo(e){return e.kind==="list"?`${Fo(e.elementType)}[]`:e.name}function Yu(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=Dr("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.
`)}};function ut(e){return new Ln($o(e))}function $o(e){let t=new at;for(let[r,n]of Object.entries(e)){let i=new Nr(r,Vo(n));t.addField(i)}return t}function Vo(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(nt(e))return new K(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return w.Buffer.isBuffer(e)?new K(`Buffer.alloc(${e.byteLength})`):new K(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ar(e)?e.toISOString():"Invalid Date";return new K(`new Date("${t}")`)}return e instanceof Ce?new K(`Prisma.${e._getName()}`):lt(e)?new K(`prisma.${Me(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?ac(e):typeof e=="object"?$o(e):new K(Object.prototype.toString.call(e))}function ac(e){let t=new st;for(let r of e)t.addItem(Vo(r));return t}function Fr(e,t){let r=t==="pretty"?Mo:Or,n=e.renderAllMessages(r),i=new it(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Lr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=ut(e);for(let h of t)Sr(h,a,s);let{message:l,args:f}=Fr(a,r),g=Rr({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new Z(g,{clientVersion:o})}d();u();c();p();m();d();u();c();p();m();function Ee(e){return e.replace(/^./,t=>t.toLowerCase())}d();u();c();p();m();function Go(e,t,r){let n=Ee(r);return!t.result||!(t.result.$allModels||t.result[n])?e:lc({...e,...jo(t.name,e,t.result.$allModels),...jo(t.name,e,t.result[n])})}function lc(e){let t=new ye,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 Ze(e,n=>({...n,needs:r(n.name,new Set)}))}function jo(e,t,r){return r?Ze(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:uc(t,o,i)})):{}}function uc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function Qo(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 Jo(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 Ur=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new ye;modelExtensionsCache=new ye;queryCallbacksCache=new ye;clientExtensions=kt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=kt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Go(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=Ee(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()}},ct=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new Ur(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Ur
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var Gn=class{getLocation(){return null}};function Ne(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Gn}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var ls={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function dt(e={}){let t=Tc(e);return Object.entries(t).reduce((n,[i,o])=>(ls[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Tc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Hr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function us(e,t){let r=Hr(e);return t({action:"aggregate",unpacker:r,argsMapper:dt})(e)}d();u();c();p();m();function Cc(e={}){let{select:t,...r}=e;return typeof t=="object"?dt({...r,_count:t}):dt({...r,_count:{_all:!0}})}function Ac(e={}){return typeof e.select=="object"?t=>Hr(e)(t)._count:t=>Hr(e)(t)._count._all}function cs(e,t){return t({action:"count",unpacker:Ac(e),argsMapper:Cc})(e)}d();u();c();p();m();function Rc(e={}){let t=dt(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 Sc(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ps(e,t){return t({action:"groupBy",unpacker:Sc(e),argsMapper:Rc})(e)}function ms(e,t,r){if(t==="aggregate")return n=>us(n,r);if(t==="count")return n=>cs(n,r);if(t==="groupBy")return n=>ps(n,r)}d();u();c();p();m();function ds(e,t){let r=t.fields.filter(i=>!i.relationName),n=To(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 Nt(e,o,s.type,s.isList,s.kind==="enum")},...Jr(Object.keys(n))})}d();u();c();p();m();d();u();c();p();m();var fs=e=>Array.isArray(e)?e:e.split("."),Qn=(e,t)=>fs(t).reduce((r,n)=>r&&r[n],e),gs=(e,t,r)=>fs(t).reduceRight((n,i,o,s)=>Object.assign({},Qn(e,s.slice(0,o)),{[i]:n}),r);function kc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function Ic(e,t,r){return t===void 0?e??{}:gs(t,r,e||!0)}function Jn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,f)=>({...l,[f.name]:f}),{});return l=>{let f=Ne(e._errorFormat),g=kc(n,i),h=Ic(l,o,g),v=r({dataPath:g,callsite:f})(h),S=Oc(e,t);return new Proxy(v,{get(C,R){if(!S.includes(R))return C[R];let M=[a[R].type,r,R],U=[g,h];return Jn(e,...M,...U)},...Jr([...S,...Object.getOwnPropertyNames(v)])})}}function Oc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var Dc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Mc=["aggregate","count","groupBy"];function Wn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[_c(e,t),Fc(e,t),jt(r),ee("name",()=>t),ee("$name",()=>t),ee("$parent",()=>e._appliedParent)];return pe({},n)}function _c(e,t){let r=Ee(t),n=Object.keys(It).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let f=Ne(e._errorFormat);return e._createPrismaPromise(g=>{let h={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:g,callsite:f};return e._request({...h,...a})},{action:o,args:l,model:t})};return Dc.includes(o)?Jn(e,t,s):Nc(i)?ms(e,i,s):s({})}}}function Nc(e){return Mc.includes(e)}function Fc(e,t){return qe(ee("fields",()=>{let r=e._runtimeDataModel.models[t];return ds(t,r)}))}d();u();c();p();m();function hs(e){return e.replace(/^./,t=>t.toUpperCase())}var Kn=Symbol();function Gt(e){let t=[Lc(e),Uc(e),ee(Kn,()=>e),ee("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(jt(r)),pe(e,t)}function Lc(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function Uc(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(Ee),n=[...new Set(t
Learn how: https://pris.ly/d/${Os[t]}-build`;throw console.error(n),new Q(n,r)}}d();u();c();p();m();function Ms(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}d();u();c();p();m();d();u();c();p();m();var Gc=()=>globalThis.process?.release?.name==="node",Qc=()=>!!globalThis.Bun||!!globalThis.process?.versions?.bun,Jc=()=>!!globalThis.Deno,Wc=()=>typeof globalThis.Netlify=="object",Kc=()=>typeof globalThis.EdgeRuntime=="object",Hc=()=>globalThis.navigator?.userAgent==="Cloudflare-Workers";function zc(){return[[Wc,"netlify"],[Kc,"edge-light"],[Hc,"workerd"],[Jc,"deno"],[Qc,"bun"],[Gc,"node"]].flatMap(r=>r[0]()?[r[1]]:[]).at(0)??""}var Yc={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 Yr(){let e=zc();return{id:e,prettyName:Yc[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}d();u();c();p();m();var _s="6.12.0";d();u();c();p();m();d();u();c();p();m();function ft({inlineDatasources:e,overrideDatasources:t,env:r,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=t[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=r[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw Yr().id==="workerd"?new Q(`error: Environment variable not found: ${s.fromEnvVar}.
In Cloudflare module Workers, environment variables are available only in the Worker's \`env\` parameter of \`fetch\`.
To solve this, provide the connection string directly: https://pris.ly/d/cloudflare-datasource-url`,n):new Q(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new Q("error: Missing URL environment variable, value, or override.",n);return i}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var Zr=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 se=class extends Zr{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};d();u();c();p();m();function L(e,t){return{...e,isRetryable:t}}var $e=class extends se{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,L(r,!1))}};N($e,"InvalidDatasourceError");function Ns(e){let t={clientVersion:e.clientVersion},r=Object.keys(e.inlineDatasources)[0],n=ft({inlineDatasources:e.inlineDatasources,overrideDatasources:e.overrideDatasources,clientVersion:e.clientVersion,env:{...e.env,...typeof y<"u"?y.env:{}}}),i;try{i=new URL(n)}catch{throw new $e(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t)}let{protocol:o,searchParams:s}=i;if(o!=="prisma:"&&o!==hr)throw new $e(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\` or \`prisma+postgres://\``,t);let a=s.get("api_key");if(a===null||a.length<1)throw new $e(`Error validating datasource \`${r}\`: the URL must contain a valid API key`,t);let l=vn(i)?"http:":"https:",f=new URL(i.href.replace(o,l));return{apiKey:a,url:f}}d();u();c();p();m();var Fs=Le(Zi()),Xr=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":Fs.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}};d();u();c();p();m();function Xc(e){return e[0]*1e3+e[1]/1e6}function Hn(e){return new Date(Xc(e))}d();u();c();p();m();d();u();c();p();m();var gt=class extends se{name="ForcedRetryError";code="P5001";constructor(t){super("This request must be retried",L(t,!0))}};N(gt,"ForcedRetryError");d();u();c();p();m();var Ve=class extends se{name="NotImplementedYetError";code="P5004";constructor(t,r){super(t,L(r,!1))}};N(Ve,"NotImplementedYetError");d();u();c();p();m();d();u();c();p();m();var j=class extends se{response;constructor(t,r){super(t,r),this.response=r.response;let n=this.response.headers.get("prisma-request-id");if(n){let i=`(The request id was: ${n})`;this.message=this.message+" "+i}}};var je=class extends j{name="SchemaMissingError";code="P5005";constructor(t){super("Schema needs to be uploaded",L(t,!0))}};N(je,"SchemaMissingError");d();u();c();p();m();d();u();c();p();m();var zn="This request could not be understood by the server",Jt=class extends j{name="BadRequestError";code="P5000";constructor(t,r,n){super(r||zn,L(t,!1)),n&&(this.code=n)}};N(Jt,"BadRequestError");d();u();c();p();m();var Wt=class extends j{name="HealthcheckTimeoutError";code="P5013";logs;constructor(t,r){super("Engine not started: healthcheck timeout",L(t,!0)),this.logs=r}};N(Wt,"HealthcheckTimeoutError");d();u();c();p();m();var Kt=class extends j{name="EngineStartupError";code="P5014";logs;constructor(t,r,n){super(r,L(t,!0)),this.logs=n}};N(Kt,"EngineStartupError");d();u();c();p();m();var Ht=class extends j{name="EngineVersionNotSupportedError";code="P5012";constructor(t){super("Engine version is not supported",L(t,!1))}};N(Ht,"EngineVersionNotSupportedError");d();u();c();p(
${t}`,L(r,!0))}};N(nr,"RequestError");async function Ge(e,t,r=n=>n){let{clientVersion:n,...i}=t,o=r(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new nr(a,{clientVersion:n,cause:s})}}var ip=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,$s=H("prisma:client:dataproxyEngine");async function op(e,t){let r=qs["@prisma/engines-version"],n=t.clientVersion??"unknown";if(y.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return y.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&ip.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){let[s]=r.split("-")??[],[a,l,f]=s.split("."),g=sp(`<=${a}.${l}.${f}`),h=await Ge(g,{clientVersion:n});if(!h.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${h.status} ${h.statusText}, response body: ${await h.text()||"<empty body>"}`);let v=await h.text();$s("length of body fetched from unpkg.com",v.length);let S;try{S=JSON.parse(v)}catch(C){throw console.error("JSON.parse error: body fetched from unpkg.com: ",v),C}return S.version}throw new Ve("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function Vs(e,t){let r=await op(e,t);return $s("version",r),r}function sp(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var js=3,ir=H("prisma:client:dataproxyEngine"),wt=class{name="DataProxyEngine";inlineSchema;inlineSchemaHash;inlineDatasources;config;logEmitter;env;clientVersion;engineHash;tracingHelper;remoteClientVersion;host;headerBuilder;startPromise;protocol;constructor(t){Bs(t),this.config=t,this.env=t.env,this.inlineSchema=Us(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let{apiKey:t,url:r}=this.getURLAndAPIKey();this.host=r.host,this.protocol=r.protocol,this.headerBuilder=new Xr({apiKey:t,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel??"error",logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await Vs(this.host,this.config),ir("host",this.host),ir("protocol",this.protocol)})(),await this.startPromise}async stop(){}propagateResponseExtensions(t){t?.logs?.length&&t.logs.forEach(r=>{switch(r.level){case"debug":case"trace":ir(r);break;case"error":case"warn":case"info":{this.logEmitter.emit(r.level,{timestamp:Hn(r.timestamp),message:r.attributes.message??"",target:r.target});break}case"query":{this.logEmitter.emit("query",{query:r.attributes.query??"",timestamp:Hn(r.timestamp),duration:r.attributes.duration_ms??0,params:r.attributes.params??"",target:r.target});break}default:r.level}}),t?.traces?.length&&this.tracingHelper.dispatchEngineSpans(t.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(t){return await this.start(),`${this.protocol}//${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${t}`}async uploadSchema(){let t={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(t,async()=>{let r=await Ge(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});r.ok||ir("schema response status",r.status);let n=await rr(r,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(t,{traceparent:r,interactiveTransaction:n,customDataProxyFetch:i}){return this.requestInternal({body:t,traceparent:r,interactive
`);o.push({_tag:"error",value:D})},l=!!e?.startsWith("prisma://"),f=yr(e),g=!!t,h=l||f;!g&&r&&h&&s(["recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)"]);let v=h||!r;g&&(v||n==="edge")&&(n==="edge"?a(["Prisma Client was configured to use the `adapter` option but it was imported via its `/edge` endpoint.","Please either remove the `/edge` endpoint or remove the `adapter` from the Prisma Client constructor."]):r?l&&a(["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]):a(["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."]));let S={accelerate:v,ppg:f,driverAdapters:g};function C(R){return R.length>0}return C(o)?{ok:!1,diagnostics:{warnings:i,errors:o},isUsing:S}:{ok:!0,diagnostics:{warnings:i},isUsing:S}}function Qs({copyEngine:e=!0},t){let r;try{r=ft({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...y.env},clientVersion:t.clientVersion})}catch{}let{ok:n,isUsing:i,diagnostics:o}=Gs({url:r,adapter:t.adapter,copyEngine:e,targetBuildType:"edge"});for(let h of o.warnings)Rt(...h.value);if(!n){let h=o.errors[0];throw new Z(h.value,{clientVersion:t.clientVersion})}let s=Ye(t.generator),a=s==="library",l=s==="binary",f=s==="client",g=(i.accelerate||i.ppg)&&!i.driverAdapters;return i.accelerate?new wt(t):(i.driverAdapters,i.accelerate,new wt(t))}d();u();c();p();m();function en({generator:e}){return e?.previewFeatures??[]}d();u();c();p();m();var Js=e=>({command:e});d();u();c();p();m();d();u();c();p();m();var Ws=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);d();u();c();p();m();function Et(e){try{return Ks(e,"fast")}catch{return Ks(e,"slow")}}function Ks(e,t){return JSON.stringify(e.map(r=>zs(r,t)))}function zs(e,t){if(Array.isArray(e))return e.map(r=>zs(r,t));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(rt(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(he.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(w.Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(ap(e))return{prisma__type:"bytes",prisma__value:w.Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:w.Buffer.from(r,n,i).toString("base64")}}return typeof e=="object"&&t==="slow"?Ys(e):e}function ap(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Ys(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(Hs);let t={};for(let r of Object.keys(e))t[r]=Hs(e[r]);return t}function Hs(e){return typeof e=="bigint"?e.toString():Ys(e)}var lp=/^(\s*alter\s)/i,Zs=H("prisma:client");function ri(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&lp.exec(t))throw new Error(`Running ALTER using ${n} is not supported
Using the example below you can still execute your query with Prisma, but please note that it is vulnerable to SQL injection attacks and requires you to take care of input sanitization.
Example:
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
More Information: https://pris.ly/d/execute-raw
`)}var ni=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(jr(r))n=r.sql,i={values:Et(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Et(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Et(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Et(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Ws(r),i={values:Et(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Zs(`prisma.${e}(${n}, ${i.values})`):Zs(`prisma.${e}(${n})`),{query:n,parameters:i}},Xs={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new oe(t,r)}},ea={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};d();u();c();p();m();function ii(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=ta(r(s)):ta(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 ta(e){return typeof e.then=="function"?e:Promise.resolve(e)}d();u();c();p();m();var up=xn.split(".")[0],cp={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},oi=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){let t=globalThis[`V${up}_PRISMA_INSTRUMENTATION`],r=globalThis.PRISMA_INSTRUMENTATION;return t?.helper??r?.helper??cp}};function ra(){return new oi}d();u();c();p();m();function na(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}d();u();c();p();m();function ia(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)}d();u();c();p();m();var tn=class{_middlewares=[];use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};d();u();c();p();m();var sa=Le(so());d();u();c();p();m();function rn(e){return typeof e.batchRequestIdx=="number"}d();u();c();p();m();function oa(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(si(e.query.arguments)),t.push(si(e.query.selection)),t.join("")}function si(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${si(n)})`:r}).join(" ")})`}d();u();c();p();m();var pp={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 ai(e){return pp[e]}d();u();c();p();m();var nn=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,y.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
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};N(B,"PrismaClientConstructorValidationError");var ca=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],pa=["pretty","colorless","minimal"],ma=["info","query","warn","error"],yp={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[r,n]of Object.entries(e)){if(!t.includes(r)){let i=bt(r,t)||` Available datasources: ${t.join(", ")}`;throw new B(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new B(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`);if(n&&typeof n=="object")for(let[i,o]of Object.entries(n)){if(i!=="url")throw new B(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof o!="string")throw new B(`Invalid value ${JSON.stringify(o)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,t)=>{if(!e&&Ye(t.generator)==="client")throw new B('Using engine type "client" requires a driver adapter to be provided to PrismaClient constructor.');if(e===null)return;if(e===void 0)throw new B('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!en(t).includes("driverAdapters"))throw new B('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(Ye(t.generator)==="binary")throw new B('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
Expected string or undefined.`)},errorFormat:e=>{if(e){if(typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!pa.includes(e)){let t=bt(e,pa);throw new B(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!ma.includes(r)){let n=bt(r,ma);throw new B(`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=bt(i,o);throw new B(`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 B(`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 B(`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 B(`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 B('"omit" option is expected to be an object.');if(e===null)throw new B('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=Ep(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(f=>f.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 B(bp(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new B(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=bt(r,t);throw new B(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function ga(e,t){for(let[r,n]of Object.entries(e)){if(!ca.includes(r)){let i=bt(r,ca);throw new B(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}yp[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new B('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function bt(e,t){if(t.length===0||typeof e!="string")return"";let r=wp(e,t);return r?` Did you mean "${r}"?`:""}function wp(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,fa.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 Ep(e,t){return da(t.models,e)??da(t.types,e)}function da(e,t){let r=Object.keys(e).find(n=>Me(n)===t);if(r)return e[r]}function bp(e,t){let r=ut(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}=Fr(r,"colorless");return`Error validating "omit" option:
${i}
${n}`}d();u();c();p();m();function ha(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=f=>{o||(o=!0,r(f))};for(let f=0;f<e.length;f++)e[f].then(g=>{n[f]=g,a()},g=>{if(!rn(g)){l(g);return}g.batchRequestIdx===f?l(g):(i||(i=g),a())})})}var Fe=H("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var xp={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Pp=Symbol.for("prisma.client.transaction.id"),vp={id:0,nextId(){return++this.id}};function Ea(e){class t{_originalClient=this;_runtimeDataModel;_requestHandler;_connectionPromise;_disconnectionPromise;_engineConfig;_accelerateEngineConfig;_clientVersion;_errorFormat;_tracingHelper;_middlewares=new tn;_previewFeatures;_activeProvider;_globalOmit;_extensions;_engine;_appliedParent;_createPrismaPromise=ii();constructor(n){e=n?.__internal?.configOverride?.(e)??e,Ds(e),n&&ga(n,e);let i=new Gr().on("error",()=>{});this._extensions=ct.empty(),this._previewFeatures=en(e),this._clientVersion=e.clientVersion??ua,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=ra();let o=e.relativeEnvPaths&&{rootEnvPath:e.relativeEnvPaths.rootEnvPath&&fr.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&fr.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=n.adapter;let l=e.activeProvider==="postgresql"||e.activeProvider==="cockroachdb"?"postgres":e.activeProvider;if(s.provider!==l)throw new Q(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${l}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new Q("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let a=e.injectableEdgeEnv?.();try{let l=n??{},f=l.__internal??{},g=f.debug===!0;g&&H.enable("prisma:client");let h=fr.resolve(e.dirname,e.relativePath);Qi.existsSync(h)||(h=e.dirname),Fe("dirname",e.dirname),Fe("relativePath",e.relativePath),Fe("cwd",h);let v=f.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:y.env.NODE_ENV==="production"?this._errorFormat="minimal":y.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:h,dirname:e.dirname,enableDebugLogs:g,allowTriggerPanic:v.allowTriggerPanic,prismaPath:v.binaryPath??void 0,engineEndpoint:v.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&ia(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(S=>typeof S=="string"?S==="query":S.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Ms(l,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:l.transactionOptions?.maxWait??2e3,timeout:l.transactionOptions?.timeout??5e3,isolationLevel:l.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:ft,getBatchRequestPayload:Wr,prismaGraphQLToJSError:Kr,PrismaClientUnknownRequestError:ne,PrismaClientInitializationError:Q,PrismaClientKnownRequestError:re,debug:H("prisma:client:accelerateEngine"),engineVersion:wa.version,clientVersion:e.clientVersion}},Fe("clientVersion",e.clientVersion),this._engine=Qs(e,this._engineConfig),this._requestHandler=new sn(this,i),l.log)for(let S of l.log){let C=typeof S=="string"?S:S.emit==="stdout"?S.level:null;C&&this.$on(C,R=>{At.log(`${At.tags[C]??""}`,R.message||R.query)})}}catch(l){throw l.clientV
`)),g?.kind==="batch"&&await g.lock,this._requestHandler.request({protocolQuery:R,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:g,unpacker:h,otelParentCtx:v,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:S})}catch(C){throw C.clientVersion=this._clientVersion,C}}$metrics=new pt(this);_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}$extends=ws}return t}function ya(e,t){return Tp(e)?[new oe(e,t),Xs]:[e,ea]}function Tp(e){return Array.isArray(e)&&Array.isArray(e.raw)}d();u();c();p();m();var Cp=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function ba(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Cp.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}d();u();c();p();m();0&&(module.exports={DMMF,Debug,Decimal,Extensions,MetricsClient,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,createParam,defineDmmfProperty,deserializeJsonResponse,deserializeRawResult,dmmfToRuntimeDataModel,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,serializeJsonQuery,skip,sqltag,warnEnvConflicts,warnOnce});
//# sourceMappingURL=edge.js.map