@prisma/client 7.4.0-integration-parameterization.20 → 7.4.0-integration-parameterization.21

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.
@@ -3,7 +3,7 @@
3
3
  `)}function dc(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function kr(e){let t=e.showColors?uc:lc,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=cc(e),pc(r,t)}u();l();c();p();d();var Go=Qe(Jn());u();l();c();p();d();function Bo(e,t,r){let n=jo(e),i=mc(n),o=gc(i);o?Or(o,t,r):t.addErrorMessage(()=>"Unknown error")}function jo(e){return e.errors.flatMap(t=>t.kind==="Union"?jo(t):[t])}function mc(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:fc(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function fc(e,t){return[...new Set(e.concat(t))]}function gc(e){return jn(e,(t,r)=>{let n=Vo(t),i=Vo(r);return n!==i?n-i:qo(t)-qo(r)})}function Vo(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function qo(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}u();l();c();p();d();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)}};u();l();c();p();d();u();l();c();p();d();Jo();u();l();c();p();d();var dt=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(`
4
4
  `)}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}};Qo();u();l();c();p();d();u();l();c();p();d();var Nr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};u();l();c();p();d();var Dr=e=>e,Mr={bold:Dr,red:Dr,green:Dr,dim:Dr,enabled:!1},Ho={bold:xr,red:at,green:wo,dim:Er,enabled:!0},mt={write(e){e.writeLine(",")}};u();l();c();p();d();var xe=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)))})}};u();l();c();p();d();var Le=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var ft=class extends Le{items=[];addItem(t){return this.items.push(new Nr(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 xe("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(mt,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var gt=class e extends Le{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 ft&&(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 xe("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(mt,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};u();l();c();p();d();var K=class extends Le{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new xe(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};u();l();c();p();d();var jt=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(mt,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Or(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":yc(e,t);break;case"IncludeOnScalar":hc(e,t);break;case"EmptySelection":wc(e,t,r);break;case"UnknownSelectionField":Pc(e,t);break;case"InvalidSelectionValue":Tc(e,t);break;case"UnknownArgument":Ac(e,t);break;case"UnknownInputField":Sc(e,t);break;case"RequiredArgumentMissing":vc(e,t);break;case"InvalidArgumentType":Cc(e,t);break;case"InvalidArgumentValue":Rc(e,t);break;case"ValueTooLarge":Ic(e,t);break;case"SomeFieldsMissing":kc(e,t);break;case"TooManyFieldsGiven":Oc(e,t);break;case"Union":Bo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function yc(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 hc(e,t){let[r,n]=yt(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 le(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)}. ${Qt(s)}`:a+=".",a+=`
5
5
  Note that ${s.bold("include")} statements only accept relation fields.`,a})}function wc(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){bc(e,t,i);return}if(n.hasField("select")){xc(e,t);return}}if(r?.[Me(e.outputType.name)]){Ec(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function bc(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 xc(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Ko(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${Qt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Ec(e,t){let r=new jt;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]=yt(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let m=a?.value.asObject()??new gt;m.addSuggestion(n),a.value=m}}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 Pc(e,t){let r=Zo(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Ko(n,e.outputType);break;case"include":Nc(n,e.outputType);break;case"omit":Dc(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(Qt(n)),i.join(" ")})}function Tc(e,t){let r=Zo(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 Ac(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Mc(n,e.arguments)),t.addErrorMessage(i=>zo(i,r,e.arguments.map(o=>o.name)))}function Sc(e,t){let[r,n]=yt(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=>zo(o,n,e.inputType.fields.map(s=>s.name)))}function zo(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=_c(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(Qt(e)),n.join(" ")}function vc(e,t){let r;t.addErrorMessage(m=>r?.value instanceof K&&r.value.text==="null"?`Argument \`${m.green(o)}\` must not be ${m.red("null")}.`:`Argument \`${m.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=yt(e.argumentPath),s=new jt,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 m of e.inputTypes[0].fields)s.addField(m.name,m.typeNames.join(" | "));a.addSuggestion(new le(o,s).makeRequired())}else{let m=e.inputTypes.map(Wo).join(" | ");a.addSuggestion(new le(o,m).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,m]=yt(e.dependentArgumentPath);t.addErrorMessage(f=>`Argument \`${f.green(o)}\` is required because argument \`${f.green(m)}\` was provided.`)}}}function Wo(e){return e.kind==="list"?`${Wo(e.elementType)}[]`:e.name}function Cc(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=Lr("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 Rc(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=Lr("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function Ic(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 K&&(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 kc(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")} ${Lr("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(Qt(i)),o.join(" ")})}function Oc(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 ${Lr("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Ko(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new le(r.name,"true"))}function Nc(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new le(r.name,"true"))}function Dc(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new le(r.name,"true"))}function Mc(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new le(r.name,r.typeNames.join(" | ")))}function Zo(e,t){let[r,n]=yt(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(),m=o?.getField(n);return o&&m?{parentKind:"select",parent:o,field:m,fieldName:n}:(m=s?.getField(n),s&&m?{parentKind:"include",field:m,parent:s,fieldName:n}:(m=a?.getField(n),a&&m?{parentKind:"omit",field:m,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 le(r.name,r.typeNames.join(" | ")))}function yt(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function Qt({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function Lr(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var Lc=3;function _c(e,t){let r=1/0,n;for(let i of t){let o=(0,Go.default)(e,i);o>Lc||o<r&&(r=o,n=i)}return n}u();l();c();p();d();var es=require("@prisma/client-runtime-utils");u();l();c();p();d();var Jt=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 ht(e){return e instanceof Jt}u();l();c();p();d();var Xo=": ",_r=class{constructor(t,r){this.name=t;this.value=r}hasError=!1;markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Xo.length}write(t){let r=new xe(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Xo).write(this.value)}};var Gn=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(`
6
- `)}};function wt(e){return new Gn(ts(e))}function ts(e){let t=new gt;for(let[r,n]of Object.entries(e)){let i=new _r(r,rs(n));t.addField(i)}return t}function rs(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(pt(e))return new K(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return g.isBuffer(e)?new K(`Buffer.alloc(${e.byteLength})`):new K(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ir(e)?e.toISOString():"Invalid Date";return new K(`new Date("${t}")`)}return e instanceof es.ObjectEnumValue?new K(`Prisma.${e._getName()}`):ht(e)?new K(`prisma.${Me(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Fc(e):typeof e=="object"?ts(e):new K(Object.prototype.toString.call(e))}function Fc(e){let t=new ft;for(let r of e)t.addItem(rs(r));return t}function Fr(e,t){let r=t==="pretty"?Ho:Mr,n=e.renderAllMessages(r),i=new dt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function $r({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=wt(e);for(let A of t)Or(A,a,s);let{message:m,args:f}=Fr(a,r),T=kr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new ns.PrismaClientValidationError(T,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function Ee(e){return e.replace(/^./,t=>t.toLowerCase())}u();l();c();p();d();function os(e,t,r){let n=Ee(r);return!t.result||!(t.result.$allModels||t.result[n])?e:$c({...e,...is(t.name,e,t.result.$allModels),...is(t.name,e,t.result[n])})}function $c(e){let t=new be,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 Rr(e,n=>({...n,needs:r(n.name,new Set)}))}function is(e,t,r){return r?Rr(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 ss(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 as(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 be;modelExtensionsCache=new be;queryCallbacksCache=new be;clientExtensions=Dt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Dt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>os(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()}},bt=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(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()??[]}};u();l();c();p();d();var Vr=class{constructor(t){this.name=t}};function us(e){return e instanceof Vr}function ls(e){return new Vr(e)}u();l();c();p();d();u();l();c();p();d();var cs=Symbol(),Ht=class{constructor(t){if(t!==cs)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?qr:t}},qr=new Ht(cs);function Pe(e){return e instanceof Ht}var Vc={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"},ps="explicitly `undefined` values are not allowed";function Br({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=bt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A}){let C=new zn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A});return{modelName:e,action:Vc[t],query:Gt(r,C)}}function Gt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:ms(r,n),selection:qc(e,t,i,n)}}function qc(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()}),Jc(e,n)):Bc(n,t,r)}function Bc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&jc(n,t,e),Qc(n,r,e),n}function jc(e,t,r){for(let[n,i]of Object.entries(t)){if(Pe(i))continue;let o=r.nestSelection(n);if(Wn(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]=Gt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Gt(i,o)}}function Qc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=as(i,n);for(let[s,a]of Object.entries(o)){if(Pe(a))continue;Wn(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(e[s]=!a)}}function Jc(e,t){let r={},n=t.getComputedFields(),i=ss(e,n);for(let[o,s]of Object.entries(i)){if(Pe(s))continue;let a=t.nestSelection(o);Wn(s,a);let m=t.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||Pe(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=Gt({},a):r[o]=!0;continue}r[o]=Gt(s,a)}}return r}function ds(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(ct(e)){if(Ir(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(us(e))return{$type:"Param",value:e.name};if(ht(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Hc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:g.from(r,n,i).toString("base64")}}if(Gc(e))return e.values;if(pt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof _e.ObjectEnumValue){if(!(0,_e.isDbNull)(e)&&!(0,_e.isJsonNull)(e)&&!(0,_e.isAnyNull)(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(zc(e))return e.toJSON();if(typeof e=="object")return ms(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 ms(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);Pe(i)||(i!==void 0?r[n]=ds(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:ps}))}return r}function Hc(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||Pe(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(ds(o,i))}return r}function Gc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function zc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Wn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:ps})}var zn=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){$r({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??!1}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?.[Me(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:Ie(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};u();l();c();p();d();function fs(e,t){let r=Dt(()=>Wc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Wc(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function Kn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}u();l();c();p();d();var Zn=new WeakMap,jr="$$PrismaTypedSql",zt=class{constructor(t,r){Zn.set(this,{sql:t,values:r}),Object.defineProperty(this,jr,{value:jr})}get sql(){return Zn.get(this).sql}get values(){return Zn.get(this).values}};function gs(e){return(...t)=>new zt(e,t)}function Qr(e){return e!=null&&e[jr]===jr}u();l();c();p();d();var Cl=require("@prisma/client-runtime-utils");u();l();c();p();d();ys();u();l();c();p();d();u();l();c();p();d();function Wt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}u();l();c();p();d();function ie(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}u();l();c();p();d();function We(e){let t=new be;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}u();l();c();p();d();u();l();c();p();d();var Hr={enumerable:!0,configurable:!0,writable:!0};function Gr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Hr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var hs=Symbol.for("nodejs.util.inspect.custom");function me(e,t){let r=Kc(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=ws(Reflect.ownKeys(o),r),a=ws(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 m=r.get(s);return m?m.getPropertyDescriptor?{...Hr,...m?.getPropertyDescriptor(s)}:Hr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[hs]=function(){let o={...this};return delete o[hs],o},i}function Kc(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 ws(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}u();l();c();p();d();function xt(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function bs(e){if(e===void 0)return"";let t=wt(e);return new dt(0,{colors:Mr}).write(t).toString()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Yn=class{getLocation(){return null}};function Fe(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Yn}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var xs={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Et(e={}){let t=Yc(e);return Object.entries(t).reduce((n,[i,o])=>(xs[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Yc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function zr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Es(e,t){let r=zr(e);return t({action:"aggregate",unpacker:r,argsMapper:Et})(e)}u();l();c();p();d();function Xc(e={}){let{select:t,...r}=e;return typeof t=="object"?Et({...r,_count:t}):Et({...r,_count:{_all:!0}})}function ep(e={}){return typeof e.select=="object"?t=>zr(e)(t)._count:t=>zr(e)(t)._count._all}function Ps(e,t){return t({action:"count",unpacker:ep(e),argsMapper:Xc})(e)}u();l();c();p();d();function tp(e={}){let t=Et(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 rp(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Ts(e,t){return t({action:"groupBy",unpacker:rp(e),argsMapper:tp})(e)}function As(e,t,r){if(t==="aggregate")return n=>Es(n,r);if(t==="count")return n=>Ps(n,r);if(t==="groupBy")return n=>Ts(n,r)}u();l();c();p();d();function Ss(e,t){let r=t.fields.filter(i=>!i.relationName),n=po(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 Jt(e,o,s.type,s.isList,s.kind==="enum")},...Gr(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var vs=e=>Array.isArray(e)?e:e.split("."),Xn=(e,t)=>vs(t).reduce((r,n)=>r&&r[n],e),Cs=(e,t,r)=>vs(t).reduceRight((n,i,o,s)=>Object.assign({},Xn(e,s.slice(0,o)),{[i]:n}),r);function np(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function ip(e,t,r){return t===void 0?e??{}:Cs(t,r,e||!0)}function ei(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((m,f)=>({...m,[f.name]:f}),{});return m=>{let f=Fe(e._errorFormat),T=np(n,i),A=ip(m,o,T),C=r({dataPath:T,callsite:f})(A),S=op(e,t);return new Proxy(C,{get(M,R){if(!S.includes(R))return M[R];let ne=[a[R].type,r,R],Q=[T,A];return ei(e,...ne,...Q)},...Gr([...S,...Object.getOwnPropertyNames(C)])})}}function op(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var sp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],ap=["aggregate","count","groupBy"];function ti(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[up(e,t),cp(e,t),Wt(r),ie("name",()=>t),ie("$name",()=>t),ie("$parent",()=>e._appliedParent)];return me({},n)}function up(e,t){let r=Ee(t),n=Object.keys(qt).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let f=Fe(e._errorFormat);return e._createPrismaPromise(T=>{let A={args:m,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:T,callsite:f};return e._request({...A,...a})},{action:o,args:m,model:t})};return sp.includes(o)?ei(e,t,s):lp(i)?As(e,i,s):s({})}}}function lp(e){return ap.includes(e)}function cp(e,t){return We(ie("fields",()=>{let r=e._runtimeDataModel.models[t];return Ss(t,r)}))}u();l();c();p();d();function Rs(e){return e.replace(/^./,t=>t.toUpperCase())}var ri=Symbol();function Kt(e){let t=[pp(e),dp(e),ie(ri,()=>e),ie("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Wt(r)),me(e,t)}function pp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function dp(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(Ee),n=[...new Set(t.concat(r))];return We({getKeys(){return n},getPropertyValue(i){let o=Rs(i);if(e._runtimeDataModel.models[o]!==void 0)return ti(e,o);if(e._runtimeDataModel.models[i]!==void 0)return ti(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Is(e){return e[ri]?e[ri]:e}function ks(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 Kt(t)}u();l();c();p();d();u();l();c();p();d();function Os({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let m of Object.values(o)){if(n){if(n[m.name])continue;let f=m.needs.filter(T=>n[T]);f.length>0&&a.push(xt(f))}else if(r){if(!r[m.name])continue;let f=m.needs.filter(T=>!r[T]);f.length>0&&a.push(xt(f))}mp(e,m.needs)&&s.push(fp(m,me(e,s)))}return s.length>0||a.length>0?me(e,[...s,...a]):e}function mp(e,t){return t.every(r=>Bn(e,r))}function fp(e,t){return We(ie(e.name,()=>e.compute(t)))}u();l();c();p();d();function Wr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Wr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Ns({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Ns({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Ns({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||Pe(s))continue;let m=n.models[r].fields.find(T=>T.name===o);if(!m||m.kind!=="object"||!m.relationName)continue;let f=typeof s=="object"?s:{};t[o]=Wr({visitor:i,result:t[o],args:f,modelName:m.type,runtimeDataModel:n})}}function Ds({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:Wr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,m,f)=>{let T=Ee(m);return Os({result:a,modelName:T,select:f.select,omit:f.select?void 0:{...o?.[T],...f.omit},extensions:n})}})}u();l();c();p();d();u();l();c();p();d();var Ke=require("@prisma/client-runtime-utils");u();l();c();p();d();var gp=["$connect","$disconnect","$on","$transaction","$extends"],Ms=gp;function Ls(e){if(e instanceof Ke.Sql)return yp(e);if(Qr(e))return hp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Zt(e[n]);return r}let t={};for(let r in e)t[r]=Zt(e[r]);return t}function yp(e){return new Ke.Sql(e.strings,e.values)}function hp(e){return new zt(e.sql,e.values)}function Zt(e){if(typeof e!="object"||e==null||e instanceof Ke.ObjectEnumValue||ht(e))return e;if(pt(e))return new Ke.Decimal(e.toFixed());if(ct(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]=Zt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Zt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Zt(e[r]);return t}Ie(e,"Unknown value")}function Fs(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:Ls(t.args??{}),__internalParams:t,query:(s,a=t)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=qs(o,m),a.args=s,Fs(e,a,r,n+1)}})})}function $s(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 Fs(e,t,s)}function Us(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Vs(r,n,0,e):e(r)}}function Vs(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 m=a.customDataProxyFetch;return a.customDataProxyFetch=qs(i,m),Vs(a,t,r+1,n)}})}var _s=e=>e;function qs(e=_s,t=_s){return r=>e(t(r))}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Gs=require("@prisma/client-runtime-utils");u();l();c();p();d();var Yt=require("@prisma/client-runtime-utils");function L(e,t){throw new Error(t)}function ni(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=>ni(e[r],t[r]))}function Pt(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(Yt.Decimal.isDecimal(e[o])||Yt.Decimal.isDecimal(t[o])){let s=Bs(e[o]),a=Bs(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=js(e[o]),a=js(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Qs(e[o])?.getTime()===Qs(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Js(e[o])===Js(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Hs(e[o])===Hs(t[o])}return ni(e[o],t[o])})}function Bs(e){return Yt.Decimal.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new Yt.Decimal(e):void 0}function js(e){return g.isBuffer(e)?e:e instanceof Uint8Array?g.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?g.from(e,"base64"):void 0}function Qs(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Js(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Hs(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Xt(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?g.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}function wp(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function bp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function $e(e){return e===null?e:Array.isArray(e)?e.map($e):typeof e=="object"?wp(e)?xp(e):e.constructor!==null&&e.constructor.name!=="Object"?e:bp(e,$e):e}function xp({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=g.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new Gs.Decimal(t);case"Json":return JSON.parse(t);default:L(t,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Kr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}u();l();c();p();d();var k={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 Z=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 Tt(e){if(!Kr(e))throw e;let t=Ep(e),r=zs(e);throw!t||!r?e:new Z(r,t,{driverAdapterError:e})}function oi(e){throw Kr(e)?new Z(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??zs(e)}\``,"P2010",{driverAdapterError:e}):e}function Ep(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":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:L(e.cause,`Unknown error: ${e.cause}`)}}function zs(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 ${ii(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${ii(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 ${ii(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:L(e.cause,`Unknown error: ${e.cause}`)}}function ii(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 Pp(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 Tp(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function Ap(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,Pp(i)){let o=Tp(i);o&&o in t&&(r[n]=t[o])}return r}function Ws(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=$e(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=Ap(o,r),a=n.findIndex(m=>Pt(m,s));if(a===-1)return t.expectNonEmpty?new Z("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(e[a]).filter(([f])=>i.has(f));return Object.fromEntries(m)}})}u();l();c();p();d();var Ys=require("@prisma/client-runtime-utils");var V=class extends Z{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},Ks=new WeakMap;function Sp(e){let t=Ks.get(e);return t||(t=Object.entries(e),Ks.set(e,t)),t}function Xs(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new V(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return ai(e,t.fields,r,t.skipNulls);case"field":return si(e,"<result>",t.fieldType,r);default:L(t,`Invalid data mapping type: '${t.type}'`)}}function ai(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=>Zs(o,t,r))}if(typeof e=="object")return Zs(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new V("Expected an array or object, got a string that is not valid JSON",{cause:o})}return ai(i,t,r,n)}throw new V(`Expected an array or an object, got: ${typeof e}`)}function Zs(e,t,r){if(typeof e!="object")throw new V(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Sp(t))switch(o.type){case"affectedRows":throw new V(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:m}=o;if(s!==null&&!Object.hasOwn(e,s))throw new V(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=ai(f,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=vp(e[s],s,o.fieldType,r);else throw new V(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:L(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function vp(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>si(o,`${t}[${s}]`,r,n)):si(e,t,r,n)}function si(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new V(`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 V(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new V(`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 V(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new V(`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 V(`Expected a float in column '${t}', got string: ${e}`);return i}throw new V(`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 V(`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 V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Ys.Decimal.isDecimal(e))throw new V(`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:Rp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new V(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Xt(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new V(`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 V(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:g.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:g.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:g.from(e).toString("base64")};throw new V(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:L(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new V(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new V(`Value '${e}' not found in enum '${r.name}'`);return o}default:L(r,`DataMapper: Unknown result type: ${r.type}`)}}var Cp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Rp(e){let t=Cp.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}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Te(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]=Te(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:Te(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=Te(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=Te(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(Te(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(Te(o),Te(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(Te(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function Ip(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 Zr(e,t){let r={};for(let n of e){let i=n(Te(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function ea(e,t){let r=Zr(e,t);return Ip(r)}function ta(e,t){return t?`${e} ${t}`:e}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var er;(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"})(er||(er={}));function kp(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:L(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=w.now(),m=await i(),f=w.now();return n({timestamp:s,duration:f-a,query:e.sql,params:e.args}),m};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:er.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":kp(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Ze(e,t){var r="000000000"+e;return r.substr(r.length-t)}var ra=Qe(Ro(),1);function Op(){try{return ra.default.hostname()}catch{return y.env._CLUSTER_NETWORK_NAME_||y.env.COMPUTERNAME||"hostname"}}var na=2,Np=Ze(y.pid.toString(36),na),ia=Op(),Dp=ia.length,Mp=Ze(ia.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Dp+36).toString(36),na);function ui(){return Np+Mp}u();l();c();p();d();u();l();c();p();d();function Xr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function li(e){let n=Math.pow(36,4),i=0;function o(){return Ze((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var m="c",f=new Date().getTime().toString(36),T=Ze(s().toString(36),4),A=e(),C=o()+o();return m+f+T+A+C}return a.fingerprint=e,a.isCuid=Xr,a}var Lp=li(ui);var oa=Lp;var ru=Qe(Wa());u();l();c();p();d();ze();u();l();c();p();d();var Ka="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ed=128,Xe,vt;function Pd(e){!Xe||Xe.length<e?(Xe=g.allocUnsafe(e*Ed),Ft.getRandomValues(Xe),vt=0):vt+e>Xe.length&&(Ft.getRandomValues(Xe),vt=0),vt+=e}function wi(e=21){Pd(e|=0);let t="";for(let r=vt-e;r<vt;r++)t+=Ka[Xe[r]&63];return t}u();l();c();p();d();ze();var Ya="0123456789ABCDEFGHJKMNPQRSTVWXYZ",sr=32;var Td=16,Xa=10,Za=0xffffffffffff;var et;(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"})(et||(et={}));var tt=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Ad(e){let t=Math.floor(e()*sr);return t===sr&&(t=sr-1),Ya.charAt(t)}function Sd(e){let t=vd(),r=t&&(t.crypto||t.msCrypto)||(typeof ut<"u"?ut: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(ut?.randomBytes)return()=>ut.randomBytes(1).readUInt8()/255;throw new tt(et.PRNGDetectFailure,"Failed to find a reliable PRNG")}function vd(){return Id()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function Cd(e,t){let r="";for(;e>0;e--)r=Ad(t)+r;return r}function Rd(e,t=Xa){if(isNaN(e))throw new tt(et.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Za)throw new tt(et.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Za}: ${e}`);if(e<0)throw new tt(et.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new tt(et.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%sr,n=Ya.charAt(r)+n,e=(e-r)/sr;return n}function Id(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function eu(e,t){let r=t||Sd(),n=!e||isNaN(e)?Date.now():e;return Rd(n,Xa)+Cd(Td,r)}u();l();c();p();d();u();l();c();p();d();var Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));function nn(e,t=0){return(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+"-"+Y[e[t+4]]+Y[e[t+5]]+"-"+Y[e[t+6]]+Y[e[t+7]]+"-"+Y[e[t+8]]+Y[e[t+9]]+"-"+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}u();l();c();p();d();ze();var sn=new Uint8Array(256),on=sn.length;function Ct(){return on>sn.length-16&&(Ar(sn),on=0),sn.slice(on,on+=16)}u();l();c();p();d();u();l();c();p();d();ze();var bi={randomUUID:Tr};function kd(e,t,r){if(bi.randomUUID&&!t&&!e)return bi.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ct();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 nn(n)}var xi=kd;u();l();c();p();d();var Ei={};function Od(e,t,r){let n;if(e)n=tu(e.random??e.rng?.()??Ct(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=Ct();Nd(Ei,i,o),n=tu(o,Ei.msecs,Ei.seq,t,r)}return t??nn(n)}function Nd(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 tu(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 Pi=Od;var an=class{#e={};constructor(){this.register("uuid",new Ai),this.register("cuid",new Si),this.register("ulid",new vi),this.register("nanoid",new Ci),this.register("product",new Ri)}snapshot(){return Object.create(this.#e,{now:{value:new Ti}})}register(t,r){this.#e[t]=r}},Ti=class{#e=new Date;generate(){return this.#e.toISOString()}},Ai=class{generate(t){if(t===4)return xi();if(t===7)return Pi();throw new Error("Invalid UUID generator arguments")}},Si=class{generate(t){if(t===1)return oa();if(t===2)return(0,ru.createId)();throw new Error("Invalid CUID generator arguments")}},vi=class{generate(){return eu()}},Ci=class{generate(t){if(typeof t=="number")return wi(t);if(t===void 0)return wi();throw new Error("Invalid Nanoid generator arguments")}},Ri=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]]}};u();l();c();p();d();function un(e,t){return e==null?e:typeof e=="string"?un(JSON.parse(e),t):Array.isArray(e)?Md(e,t):Dd(e,t)}function Dd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!Pt(e,i))return null}return iu(e,t.nested)}function iu(e,t){for(let[r,n]of Object.entries(t))e[r]=un(e[r],n);return e}function Md(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=Ld(e,r)}return t.pagination&&(e=_d(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>iu(r,t.nested))}function Ld(e,t){let r=new Set,n=[];for(let i of e){let o=Rt(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function _d(e,t,r){if(r===null)return nu(e,t);let n=new Map;for(let o of e){let s=Rt(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])=>nu(o,t))}function nu(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>Pt(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 Rt(e,t){return JSON.stringify(t.map(r=>e[r]))}u();l();c();p();d();u();l();c();p();d();function Ii(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function ki(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Di(e,t,r,n){let i=e.args.map(o=>fe(o,t,r));switch(e.type){case"rawSql":return[Ud(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?qd(e.fragments,i,n):[i]).map(s=>{if(n!==void 0&&s.length>n)throw new Z("The query parameter limit supported by your database is exceeded.","P2029");return Fd(e.fragments,e.placeholderFormat,s,e.argTypes)});default:L(e.type,"Invalid query type")}}function fe(e,t,r){for(;Vd(e);)if(Ii(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=n}else if(ki(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=>fe(s,t,r)))}else L(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>fe(n,t,r))),e}function Fd(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of Ni(e,r,n)){if(i+=$d(m,t,o),m.type==="stringChunk")continue;let f=s.length,T=s.push(...ou(m))-f;if(m.argType.arity==="tuple"){if(T%m.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${T} parameters for a tuple of arity ${m.argType.elements.length}.`);for(let A=0;A<T/m.argType.elements.length;A++)a.push(...m.argType.elements)}else for(let A=0;A<T;A++)a.push(m.argType)}return{sql:i,args:s,argTypes:a}}function $d(e,t,r){let n=e.type;switch(n){case"parameter":return Oi(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>Oi(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Oi(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:L(n,"Invalid fragment type")}}function Oi(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function Ud(e,t,r){return{sql:e,args:t,argTypes:r}}function Vd(e){return Ii(e)||ki(e)}function*Ni(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*ou(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 Ni(e,t,void 0)){let a=0;for(let m of ou(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of Ni(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,m=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let f=r-(n-a);m=Bd(s.value,f)}else m=[s.value];o=o.flatMap(f=>m.map(T=>[...f,T]));break}case"parameterTupleList":{let a=s.value.reduce((A,C)=>A+C.length,0),m=[],f=[],T=0;for(let A of s.value)r&&o.length===1&&a===i&&f.length>0&&n-a+T+A.length>r&&(m.push(f),f=[],T=0),f.push(A),T+=A.length;f.length>0&&m.push(f),o=o.flatMap(A=>m.map(C=>[...A,C]));break}}return o}function Bd(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}u();l();c();p();d();function su(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function au(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>jd(t)),rows:e.rows.map(t=>t.map((r,n)=>ar(r,e.columnTypes[n])))}}function ar(e,t){if(e===null)return null;switch(t){case k.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 k.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>ar(r,k.Int32));case k.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 k.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>ar(r,k.Int64));case k.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case k.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>ar(r,k.Json));case k.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 k.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>ar(r,k.Boolean));default:return e}}function jd(e){switch(e){case k.Int32:return"int";case k.Int64:return"bigint";case k.Float:return"float";case k.Double:return"double";case k.Text:return"string";case k.Enum:return"enum";case k.Bytes:return"bytes";case k.Boolean:return"bool";case k.Character:return"char";case k.Numeric:return"decimal";case k.Json:return"json";case k.Uuid:return"uuid";case k.DateTime:return"datetime";case k.Date:return"date";case k.Time:return"time";case k.Int32Array:return"int-array";case k.Int64Array:return"bigint-array";case k.FloatArray:return"float-array";case k.DoubleArray:return"double-array";case k.TextArray:return"string-array";case k.EnumArray:return"string-array";case k.BytesArray:return"bytes-array";case k.BooleanArray:return"bool-array";case k.CharacterArray:return"char-array";case k.NumericArray:return"decimal-array";case k.JsonArray:return"json-array";case k.UuidArray:return"uuid-array";case k.DateTimeArray:return"datetime-array";case k.DateArray:return"date-array";case k.TimeArray:return"time-array";case k.UnknownNumber:return"unknown";case k.Set:return"string";default:L(e,`Unexpected column type: ${e}`)}}u();l();c();p();d();function uu(e,t,r){if(!t.every(n=>Mi(e,n))){let n=Qd(e,r),i=Jd(r);throw new Z(n,i,r.context)}}function Mi(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:L(t,`Unknown rule type: ${t.type}`)}}function Qd(e,t){switch(t.error_identifier){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:L(t,`Unknown error identifier: ${t}`)}}function Jd(e){switch(e.error_identifier){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:L(e,`Unknown error identifier: ${e}`)}}var ur=class e{#e;#t=new an;#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:su,rawSerializer:au,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let{value:n}=await this.interpretNode(t,{...r,generators:this.#t.snapshot()}).catch(i=>Tt(i));return n}async interpretNode(t,r){switch(t.type){case"value":return{value:fe(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(!lu(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(Li(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)=>Ae(i)+Ae(o)):0}}case"execute":{let n=Di(t.args,r.scope,r.generators,this.#a()),i=0;for(let o of n){let s=cu(o,r.sqlCommenter);i+=await this.#l(s,r.queryable,()=>r.queryable.executeRaw(s).catch(a=>t.args.type==="rawSql"?oi(a):Tt(a)))}return{value:i}}case"query":{let n=Di(t.args,r.scope,r.generators,this.#a()),i;for(let o of n){let s=cu(o,r.sqlCommenter),a=await this.#l(s,r.queryable,()=>r.queryable.queryRaw(s).catch(m=>t.args.type==="rawSql"?oi(m):Tt(m)));i===void 0?i=a:(i.rows.push(...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(lu(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:pu(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:Hd(n,o),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:Xs(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return uu(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Mi(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?Rt(ln(a),t.args.fields):null,s=new Set(Li(i).map(o));return{value:Li(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:un(n,t.args.operations),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]=Gd(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?{}:ln(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=zd(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:L(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:L(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 lu(e){return Array.isArray(e)?e.length===0:e==null}function Li(e){return Array.isArray(e)?e:[e]}function Ae(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function ln(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function pu(e,t){return Array.isArray(e)?e.map(r=>pu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function Hd(e,t){for(let{joinExpr:r,childRecords:n}of t){let i=r.on.map(([a])=>a),o=r.on.map(([,a])=>a),s={};for(let a of Array.isArray(e)?e:[e]){let m=ln(a),f=Rt(m,i);s[f]||(s[f]=[]),s[f].push(m),r.isRelationUnique?m[r.parentField]=null:m[r.parentField]=[]}for(let a of Array.isArray(n)?n:[n]){if(a===null)continue;let m=Rt(ln(a),o);for(let f of s[m]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Gd(e,t,r,n){switch(e.type){case"value":return fe(e.value,r,n);case"lastInsertId":return t;default:L(e,`Unexpected field initializer type: ${e.type}`)}}function zd(e,t,r,n){switch(e.type){case"set":return fe(e.value,r,n);case"add":return Ae(t)+Ae(fe(e.value,r,n));case"subtract":return Ae(t)-Ae(fe(e.value,r,n));case"multiply":return Ae(t)*Ae(fe(e.value,r,n));case"divide":{let i=Ae(t),o=Ae(fe(e.value,r,n));return o===0?null:i/o}default:L(e,`Unexpected field operation type: ${e.type}`)}}function cu(e,t){if(!t||t.plugins.length===0)return e;let r=ea(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:ta(e.sql,r)}:e}u();l();c();p();d();u();l();c();p();d();async function Wd(){return globalThis.crypto??await Promise.resolve().then(()=>(ze(),$n))}async function du(){return(await Wd()).randomUUID()}u();l();c();p();d();async function mu(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}u();l();c();p();d();var pe=class extends Z{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},lr=class extends pe{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.")}},cn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},pn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},dn=class extends pe{constructor(){super("Unable to start a transaction in the given time.")}},mn=class extends pe{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})}},It=class extends pe{constructor(t){super(`Internal Consistency Error: ${t}`)}},fn=class extends pe{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Kd=100,kt=te("prisma:client:transactionManager"),Zd=()=>({sql:"COMMIT",args:[],argTypes:[]}),Yd=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Xd=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),em=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),cr=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#e;#t;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#e=i,this.#t=o}async startInternalTransaction(t){let r=t!==void 0?this.#s(t):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(r))}async startTransaction(t){let r=t!==void 0?this.#s(t):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(r))}async#r(t){let r={id:await du(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=fu(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(Tt);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),mu(n.signal,"abort").then(()=>{})]),this.transactions.set(r.id,r),r.status){case"waiting":if(n.signal.aborted)throw o.then(s=>s.rollback()).catch(s=>kt("error in discarded transaction:",s)),await this.#o(r,"timed_out"),new dn;return r.status="running",r.timer=this.#i(r.id,t.timeout),{id:r.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new It(`Transaction in invalid state ${r.status} although it just finished startup.`);default:L(r.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.#n(t,"commit");await this.#o(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.#n(t,"rollback");await this.#o(r,"rolled_back")})}async getTransaction(t,r){let n=this.#n(t.id,r);if(n.status==="closing"&&(await n.closing,n=this.#n(t.id,r)),!n.transaction)throw new lr;return n.transaction}#n(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(kt("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new It("Active transaction found in closed transactions list.");case"committed":throw new cn(r);case"rolled_back":throw new pn(r);case"timed_out":throw new mn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw kt("Transaction not found.",t),new lr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new It("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.#o(t,"rolled_back")))}#i(t,r){let n=Date.now(),i=fu(async()=>{kt("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);o&&["running","waiting"].includes(o.status)?await this.#o(o,"timed_out"):kt("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#o(t,r){let n=async()=>{kt("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#a(Xd(),t.transaction,()=>t.transaction.commit());else{let i=Zd();await this.#a(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.#a(em(),t.transaction,()=>t.transaction.rollback());else{let i=Yd();try{await this.#a(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>Kd&&this.closedTransactions.shift()}};t.status==="closing"?(await t.closing,this.#n(t.id,r==="committed"?"commit":"rollback")):await Object.assign(t,{status:"closing",reason:r,closing:n()}).closing}#s(t){if(!t.timeout)throw new pe("timeout is required");if(!t.maxWait)throw new pe("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new fn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#a(t,r,n){return Yr({query:t,execute:n,provider:this.#t??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#e})}};function fu(e,t){return t!==void 0?setTimeout(e,t):void 0}var ee=require("@prisma/client-runtime-utils");u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function gu(e){return new _i(e).deserialize()}function tm(e){return g.from(e,"base64url")}var _i=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=tm(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.#c(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(),m=this.#s(),f=this.#i(),T=this.#i(),C={flags:this.#o()};m!==0&&(C.scalarMask=m),f!==void 0&&(C.childNodeId=f),T!==void 0&&(C.enumNameIndex=T),o[a]=C}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(),m=this.#i(),f=this.#i(),T={};m!==void 0&&(T.argsNodeId=m),f!==void 0&&(T.outputNodeId=f),o[a]=T}r.push({edges:o})}return r}#c(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],m={};o!==void 0&&(m.argsNodeId=o),s!==void 0&&(m.outputNodeId=s),r[a]=m}return r}};var pr=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=gu(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]}},Se={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},X={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function ve(e,t){return(e.flags&t)!==0}function Be(e){return e.scalarMask}var gn="7.4.0-integration-parameterization.20";u();l();c();p();d();var yu={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function wu(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=>bu(i)),n=t.map(i=>nm(i));return{args:r,argTypes:n}}function bu(e){if(Array.isArray(e))return e.map(t=>bu(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 nm(e){return Array.isArray(e)?{scalarType:e.length>0?hu(e[0]):"unknown",arity:"list"}:{scalarType:hu(e),arity:"scalar"}}function hu(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in yu?yu[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}u();l();c();p();d();function xu(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}u();l();c();p();d();u();l();c();p();d();function Eu(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}u();l();c();p();d();function Pu(e){return e.split(`
6
+ `)}};function wt(e){return new Gn(ts(e))}function ts(e){let t=new gt;for(let[r,n]of Object.entries(e)){let i=new _r(r,rs(n));t.addField(i)}return t}function rs(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(pt(e))return new K(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return g.isBuffer(e)?new K(`Buffer.alloc(${e.byteLength})`):new K(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ir(e)?e.toISOString():"Invalid Date";return new K(`new Date("${t}")`)}return e instanceof es.ObjectEnumValue?new K(`Prisma.${e._getName()}`):ht(e)?new K(`prisma.${Me(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Fc(e):typeof e=="object"?ts(e):new K(Object.prototype.toString.call(e))}function Fc(e){let t=new ft;for(let r of e)t.addItem(rs(r));return t}function Fr(e,t){let r=t==="pretty"?Ho:Mr,n=e.renderAllMessages(r),i=new dt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function $r({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=wt(e);for(let A of t)Or(A,a,s);let{message:m,args:f}=Fr(a,r),T=kr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new ns.PrismaClientValidationError(T,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function Ee(e){return e.replace(/^./,t=>t.toLowerCase())}u();l();c();p();d();function os(e,t,r){let n=Ee(r);return!t.result||!(t.result.$allModels||t.result[n])?e:$c({...e,...is(t.name,e,t.result.$allModels),...is(t.name,e,t.result[n])})}function $c(e){let t=new be,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 Rr(e,n=>({...n,needs:r(n.name,new Set)}))}function is(e,t,r){return r?Rr(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 ss(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 as(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 be;modelExtensionsCache=new be;queryCallbacksCache=new be;clientExtensions=Dt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Dt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>os(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()}},bt=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(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()??[]}};u();l();c();p();d();var Vr=class{constructor(t){this.name=t}};function us(e){return e instanceof Vr}function ls(e){return new Vr(e)}u();l();c();p();d();u();l();c();p();d();var cs=Symbol(),Ht=class{constructor(t){if(t!==cs)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?qr:t}},qr=new Ht(cs);function Pe(e){return e instanceof Ht}var Vc={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"},ps="explicitly `undefined` values are not allowed";function Br({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=bt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A}){let C=new zn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A});return{modelName:e,action:Vc[t],query:Gt(r,C)}}function Gt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:ms(r,n),selection:qc(e,t,i,n)}}function qc(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()}),Jc(e,n)):Bc(n,t,r)}function Bc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&jc(n,t,e),Qc(n,r,e),n}function jc(e,t,r){for(let[n,i]of Object.entries(t)){if(Pe(i))continue;let o=r.nestSelection(n);if(Wn(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]=Gt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Gt(i,o)}}function Qc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=as(i,n);for(let[s,a]of Object.entries(o)){if(Pe(a))continue;Wn(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(e[s]=!a)}}function Jc(e,t){let r={},n=t.getComputedFields(),i=ss(e,n);for(let[o,s]of Object.entries(i)){if(Pe(s))continue;let a=t.nestSelection(o);Wn(s,a);let m=t.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||Pe(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=Gt({},a):r[o]=!0;continue}r[o]=Gt(s,a)}}return r}function ds(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(ct(e)){if(Ir(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(us(e))return{$type:"Param",value:e.name};if(ht(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Hc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:g.from(r,n,i).toString("base64")}}if(Gc(e))return e.values;if(pt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof _e.ObjectEnumValue){if(!(0,_e.isDbNull)(e)&&!(0,_e.isJsonNull)(e)&&!(0,_e.isAnyNull)(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(zc(e))return e.toJSON();if(typeof e=="object")return ms(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 ms(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);Pe(i)||(i!==void 0?r[n]=ds(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:ps}))}return r}function Hc(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||Pe(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(ds(o,i))}return r}function Gc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function zc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Wn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:ps})}var zn=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){$r({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??!1}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?.[Me(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:Ie(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};u();l();c();p();d();function fs(e,t){let r=Dt(()=>Wc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Wc(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function Kn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}u();l();c();p();d();var Zn=new WeakMap,jr="$$PrismaTypedSql",zt=class{constructor(t,r){Zn.set(this,{sql:t,values:r}),Object.defineProperty(this,jr,{value:jr})}get sql(){return Zn.get(this).sql}get values(){return Zn.get(this).values}};function gs(e){return(...t)=>new zt(e,t)}function Qr(e){return e!=null&&e[jr]===jr}u();l();c();p();d();var Cl=require("@prisma/client-runtime-utils");u();l();c();p();d();ys();u();l();c();p();d();u();l();c();p();d();function Wt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}u();l();c();p();d();function ie(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}u();l();c();p();d();function We(e){let t=new be;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}u();l();c();p();d();u();l();c();p();d();var Hr={enumerable:!0,configurable:!0,writable:!0};function Gr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Hr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var hs=Symbol.for("nodejs.util.inspect.custom");function me(e,t){let r=Kc(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=ws(Reflect.ownKeys(o),r),a=ws(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 m=r.get(s);return m?m.getPropertyDescriptor?{...Hr,...m?.getPropertyDescriptor(s)}:Hr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[hs]=function(){let o={...this};return delete o[hs],o},i}function Kc(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 ws(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}u();l();c();p();d();function xt(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function bs(e){if(e===void 0)return"";let t=wt(e);return new dt(0,{colors:Mr}).write(t).toString()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Yn=class{getLocation(){return null}};function Fe(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Yn}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var xs={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Et(e={}){let t=Yc(e);return Object.entries(t).reduce((n,[i,o])=>(xs[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Yc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function zr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Es(e,t){let r=zr(e);return t({action:"aggregate",unpacker:r,argsMapper:Et})(e)}u();l();c();p();d();function Xc(e={}){let{select:t,...r}=e;return typeof t=="object"?Et({...r,_count:t}):Et({...r,_count:{_all:!0}})}function ep(e={}){return typeof e.select=="object"?t=>zr(e)(t)._count:t=>zr(e)(t)._count._all}function Ps(e,t){return t({action:"count",unpacker:ep(e),argsMapper:Xc})(e)}u();l();c();p();d();function tp(e={}){let t=Et(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 rp(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Ts(e,t){return t({action:"groupBy",unpacker:rp(e),argsMapper:tp})(e)}function As(e,t,r){if(t==="aggregate")return n=>Es(n,r);if(t==="count")return n=>Ps(n,r);if(t==="groupBy")return n=>Ts(n,r)}u();l();c();p();d();function Ss(e,t){let r=t.fields.filter(i=>!i.relationName),n=po(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 Jt(e,o,s.type,s.isList,s.kind==="enum")},...Gr(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var vs=e=>Array.isArray(e)?e:e.split("."),Xn=(e,t)=>vs(t).reduce((r,n)=>r&&r[n],e),Cs=(e,t,r)=>vs(t).reduceRight((n,i,o,s)=>Object.assign({},Xn(e,s.slice(0,o)),{[i]:n}),r);function np(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function ip(e,t,r){return t===void 0?e??{}:Cs(t,r,e||!0)}function ei(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((m,f)=>({...m,[f.name]:f}),{});return m=>{let f=Fe(e._errorFormat),T=np(n,i),A=ip(m,o,T),C=r({dataPath:T,callsite:f})(A),S=op(e,t);return new Proxy(C,{get(M,R){if(!S.includes(R))return M[R];let ne=[a[R].type,r,R],Q=[T,A];return ei(e,...ne,...Q)},...Gr([...S,...Object.getOwnPropertyNames(C)])})}}function op(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var sp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],ap=["aggregate","count","groupBy"];function ti(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[up(e,t),cp(e,t),Wt(r),ie("name",()=>t),ie("$name",()=>t),ie("$parent",()=>e._appliedParent)];return me({},n)}function up(e,t){let r=Ee(t),n=Object.keys(qt).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let f=Fe(e._errorFormat);return e._createPrismaPromise(T=>{let A={args:m,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:T,callsite:f};return e._request({...A,...a})},{action:o,args:m,model:t})};return sp.includes(o)?ei(e,t,s):lp(i)?As(e,i,s):s({})}}}function lp(e){return ap.includes(e)}function cp(e,t){return We(ie("fields",()=>{let r=e._runtimeDataModel.models[t];return Ss(t,r)}))}u();l();c();p();d();function Rs(e){return e.replace(/^./,t=>t.toUpperCase())}var ri=Symbol();function Kt(e){let t=[pp(e),dp(e),ie(ri,()=>e),ie("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Wt(r)),me(e,t)}function pp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function dp(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(Ee),n=[...new Set(t.concat(r))];return We({getKeys(){return n},getPropertyValue(i){let o=Rs(i);if(e._runtimeDataModel.models[o]!==void 0)return ti(e,o);if(e._runtimeDataModel.models[i]!==void 0)return ti(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Is(e){return e[ri]?e[ri]:e}function ks(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 Kt(t)}u();l();c();p();d();u();l();c();p();d();function Os({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let m of Object.values(o)){if(n){if(n[m.name])continue;let f=m.needs.filter(T=>n[T]);f.length>0&&a.push(xt(f))}else if(r){if(!r[m.name])continue;let f=m.needs.filter(T=>!r[T]);f.length>0&&a.push(xt(f))}mp(e,m.needs)&&s.push(fp(m,me(e,s)))}return s.length>0||a.length>0?me(e,[...s,...a]):e}function mp(e,t){return t.every(r=>Bn(e,r))}function fp(e,t){return We(ie(e.name,()=>e.compute(t)))}u();l();c();p();d();function Wr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Wr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Ns({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Ns({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Ns({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||Pe(s))continue;let m=n.models[r].fields.find(T=>T.name===o);if(!m||m.kind!=="object"||!m.relationName)continue;let f=typeof s=="object"?s:{};t[o]=Wr({visitor:i,result:t[o],args:f,modelName:m.type,runtimeDataModel:n})}}function Ds({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:Wr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,m,f)=>{let T=Ee(m);return Os({result:a,modelName:T,select:f.select,omit:f.select?void 0:{...o?.[T],...f.omit},extensions:n})}})}u();l();c();p();d();u();l();c();p();d();var Ke=require("@prisma/client-runtime-utils");u();l();c();p();d();var gp=["$connect","$disconnect","$on","$transaction","$extends"],Ms=gp;function Ls(e){if(e instanceof Ke.Sql)return yp(e);if(Qr(e))return hp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Zt(e[n]);return r}let t={};for(let r in e)t[r]=Zt(e[r]);return t}function yp(e){return new Ke.Sql(e.strings,e.values)}function hp(e){return new zt(e.sql,e.values)}function Zt(e){if(typeof e!="object"||e==null||e instanceof Ke.ObjectEnumValue||ht(e))return e;if(pt(e))return new Ke.Decimal(e.toFixed());if(ct(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]=Zt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Zt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Zt(e[r]);return t}Ie(e,"Unknown value")}function Fs(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:Ls(t.args??{}),__internalParams:t,query:(s,a=t)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=qs(o,m),a.args=s,Fs(e,a,r,n+1)}})})}function $s(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 Fs(e,t,s)}function Us(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Vs(r,n,0,e):e(r)}}function Vs(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 m=a.customDataProxyFetch;return a.customDataProxyFetch=qs(i,m),Vs(a,t,r+1,n)}})}var _s=e=>e;function qs(e=_s,t=_s){return r=>e(t(r))}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Gs=require("@prisma/client-runtime-utils");u();l();c();p();d();var Yt=require("@prisma/client-runtime-utils");function L(e,t){throw new Error(t)}function ni(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=>ni(e[r],t[r]))}function Pt(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(Yt.Decimal.isDecimal(e[o])||Yt.Decimal.isDecimal(t[o])){let s=Bs(e[o]),a=Bs(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=js(e[o]),a=js(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Qs(e[o])?.getTime()===Qs(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Js(e[o])===Js(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Hs(e[o])===Hs(t[o])}return ni(e[o],t[o])})}function Bs(e){return Yt.Decimal.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new Yt.Decimal(e):void 0}function js(e){return g.isBuffer(e)?e:e instanceof Uint8Array?g.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?g.from(e,"base64"):void 0}function Qs(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Js(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Hs(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Xt(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?g.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}function wp(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function bp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function $e(e){return e===null?e:Array.isArray(e)?e.map($e):typeof e=="object"?wp(e)?xp(e):e.constructor!==null&&e.constructor.name!=="Object"?e:bp(e,$e):e}function xp({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=g.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new Gs.Decimal(t);case"Json":return JSON.parse(t);default:L(t,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Kr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}u();l();c();p();d();var k={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 Z=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 Tt(e){if(!Kr(e))throw e;let t=Ep(e),r=zs(e);throw!t||!r?e:new Z(r,t,{driverAdapterError:e})}function oi(e){throw Kr(e)?new Z(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??zs(e)}\``,"P2010",{driverAdapterError:e}):e}function Ep(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":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:L(e.cause,`Unknown error: ${e.cause}`)}}function zs(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 ${ii(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${ii(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 ${ii(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:L(e.cause,`Unknown error: ${e.cause}`)}}function ii(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 Pp(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 Tp(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function Ap(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,Pp(i)){let o=Tp(i);o&&o in t&&(r[n]=t[o])}return r}function Ws(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=$e(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=Ap(o,r),a=n.findIndex(m=>Pt(m,s));if(a===-1)return t.expectNonEmpty?new Z("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(e[a]).filter(([f])=>i.has(f));return Object.fromEntries(m)}})}u();l();c();p();d();var Ys=require("@prisma/client-runtime-utils");var V=class extends Z{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},Ks=new WeakMap;function Sp(e){let t=Ks.get(e);return t||(t=Object.entries(e),Ks.set(e,t)),t}function Xs(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new V(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return ai(e,t.fields,r,t.skipNulls);case"field":return si(e,"<result>",t.fieldType,r);default:L(t,`Invalid data mapping type: '${t.type}'`)}}function ai(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=>Zs(o,t,r))}if(typeof e=="object")return Zs(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new V("Expected an array or object, got a string that is not valid JSON",{cause:o})}return ai(i,t,r,n)}throw new V(`Expected an array or an object, got: ${typeof e}`)}function Zs(e,t,r){if(typeof e!="object")throw new V(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Sp(t))switch(o.type){case"affectedRows":throw new V(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:m}=o;if(s!==null&&!Object.hasOwn(e,s))throw new V(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=ai(f,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=vp(e[s],s,o.fieldType,r);else throw new V(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:L(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function vp(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>si(o,`${t}[${s}]`,r,n)):si(e,t,r,n)}function si(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new V(`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 V(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new V(`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 V(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new V(`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 V(`Expected a float in column '${t}', got string: ${e}`);return i}throw new V(`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 V(`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 V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Ys.Decimal.isDecimal(e))throw new V(`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:Rp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new V(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Xt(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new V(`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 V(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:g.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:g.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:g.from(e).toString("base64")};throw new V(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:L(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new V(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new V(`Value '${e}' not found in enum '${r.name}'`);return o}default:L(r,`DataMapper: Unknown result type: ${r.type}`)}}var Cp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Rp(e){let t=Cp.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}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Te(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]=Te(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:Te(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=Te(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=Te(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(Te(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(Te(o),Te(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(Te(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function Ip(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 Zr(e,t){let r={};for(let n of e){let i=n(Te(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function ea(e,t){let r=Zr(e,t);return Ip(r)}function ta(e,t){return t?`${e} ${t}`:e}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var er;(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"})(er||(er={}));function kp(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:L(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=w.now(),m=await i(),f=w.now();return n({timestamp:s,duration:f-a,query:e.sql,params:e.args}),m};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:er.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":kp(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Ze(e,t){var r="000000000"+e;return r.substr(r.length-t)}var ra=Qe(Ro(),1);function Op(){try{return ra.default.hostname()}catch{return y.env._CLUSTER_NETWORK_NAME_||y.env.COMPUTERNAME||"hostname"}}var na=2,Np=Ze(y.pid.toString(36),na),ia=Op(),Dp=ia.length,Mp=Ze(ia.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Dp+36).toString(36),na);function ui(){return Np+Mp}u();l();c();p();d();u();l();c();p();d();function Xr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function li(e){let n=Math.pow(36,4),i=0;function o(){return Ze((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var m="c",f=new Date().getTime().toString(36),T=Ze(s().toString(36),4),A=e(),C=o()+o();return m+f+T+A+C}return a.fingerprint=e,a.isCuid=Xr,a}var Lp=li(ui);var oa=Lp;var ru=Qe(Wa());u();l();c();p();d();ze();u();l();c();p();d();var Ka="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ed=128,Xe,vt;function Pd(e){!Xe||Xe.length<e?(Xe=g.allocUnsafe(e*Ed),Ft.getRandomValues(Xe),vt=0):vt+e>Xe.length&&(Ft.getRandomValues(Xe),vt=0),vt+=e}function wi(e=21){Pd(e|=0);let t="";for(let r=vt-e;r<vt;r++)t+=Ka[Xe[r]&63];return t}u();l();c();p();d();ze();var Ya="0123456789ABCDEFGHJKMNPQRSTVWXYZ",sr=32;var Td=16,Xa=10,Za=0xffffffffffff;var et;(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"})(et||(et={}));var tt=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Ad(e){let t=Math.floor(e()*sr);return t===sr&&(t=sr-1),Ya.charAt(t)}function Sd(e){let t=vd(),r=t&&(t.crypto||t.msCrypto)||(typeof ut<"u"?ut: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(ut?.randomBytes)return()=>ut.randomBytes(1).readUInt8()/255;throw new tt(et.PRNGDetectFailure,"Failed to find a reliable PRNG")}function vd(){return Id()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function Cd(e,t){let r="";for(;e>0;e--)r=Ad(t)+r;return r}function Rd(e,t=Xa){if(isNaN(e))throw new tt(et.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Za)throw new tt(et.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Za}: ${e}`);if(e<0)throw new tt(et.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new tt(et.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%sr,n=Ya.charAt(r)+n,e=(e-r)/sr;return n}function Id(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function eu(e,t){let r=t||Sd(),n=!e||isNaN(e)?Date.now():e;return Rd(n,Xa)+Cd(Td,r)}u();l();c();p();d();u();l();c();p();d();var Y=[];for(let e=0;e<256;++e)Y.push((e+256).toString(16).slice(1));function nn(e,t=0){return(Y[e[t+0]]+Y[e[t+1]]+Y[e[t+2]]+Y[e[t+3]]+"-"+Y[e[t+4]]+Y[e[t+5]]+"-"+Y[e[t+6]]+Y[e[t+7]]+"-"+Y[e[t+8]]+Y[e[t+9]]+"-"+Y[e[t+10]]+Y[e[t+11]]+Y[e[t+12]]+Y[e[t+13]]+Y[e[t+14]]+Y[e[t+15]]).toLowerCase()}u();l();c();p();d();ze();var sn=new Uint8Array(256),on=sn.length;function Ct(){return on>sn.length-16&&(Ar(sn),on=0),sn.slice(on,on+=16)}u();l();c();p();d();u();l();c();p();d();ze();var bi={randomUUID:Tr};function kd(e,t,r){if(bi.randomUUID&&!t&&!e)return bi.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ct();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 nn(n)}var xi=kd;u();l();c();p();d();var Ei={};function Od(e,t,r){let n;if(e)n=tu(e.random??e.rng?.()??Ct(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=Ct();Nd(Ei,i,o),n=tu(o,Ei.msecs,Ei.seq,t,r)}return t??nn(n)}function Nd(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 tu(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 Pi=Od;var an=class{#e={};constructor(){this.register("uuid",new Ai),this.register("cuid",new Si),this.register("ulid",new vi),this.register("nanoid",new Ci),this.register("product",new Ri)}snapshot(){return Object.create(this.#e,{now:{value:new Ti}})}register(t,r){this.#e[t]=r}},Ti=class{#e=new Date;generate(){return this.#e.toISOString()}},Ai=class{generate(t){if(t===4)return xi();if(t===7)return Pi();throw new Error("Invalid UUID generator arguments")}},Si=class{generate(t){if(t===1)return oa();if(t===2)return(0,ru.createId)();throw new Error("Invalid CUID generator arguments")}},vi=class{generate(){return eu()}},Ci=class{generate(t){if(typeof t=="number")return wi(t);if(t===void 0)return wi();throw new Error("Invalid Nanoid generator arguments")}},Ri=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]]}};u();l();c();p();d();function un(e,t){return e==null?e:typeof e=="string"?un(JSON.parse(e),t):Array.isArray(e)?Md(e,t):Dd(e,t)}function Dd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!Pt(e,i))return null}return iu(e,t.nested)}function iu(e,t){for(let[r,n]of Object.entries(t))e[r]=un(e[r],n);return e}function Md(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=Ld(e,r)}return t.pagination&&(e=_d(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>iu(r,t.nested))}function Ld(e,t){let r=new Set,n=[];for(let i of e){let o=Rt(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function _d(e,t,r){if(r===null)return nu(e,t);let n=new Map;for(let o of e){let s=Rt(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])=>nu(o,t))}function nu(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>Pt(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 Rt(e,t){return JSON.stringify(t.map(r=>e[r]))}u();l();c();p();d();u();l();c();p();d();function Ii(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function ki(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Di(e,t,r,n){let i=e.args.map(o=>fe(o,t,r));switch(e.type){case"rawSql":return[Ud(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?qd(e.fragments,i,n):[i]).map(s=>{if(n!==void 0&&s.length>n)throw new Z("The query parameter limit supported by your database is exceeded.","P2029");return Fd(e.fragments,e.placeholderFormat,s,e.argTypes)});default:L(e.type,"Invalid query type")}}function fe(e,t,r){for(;Vd(e);)if(Ii(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=n}else if(ki(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=>fe(s,t,r)))}else L(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>fe(n,t,r))),e}function Fd(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of Ni(e,r,n)){if(i+=$d(m,t,o),m.type==="stringChunk")continue;let f=s.length,T=s.push(...ou(m))-f;if(m.argType.arity==="tuple"){if(T%m.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${T} parameters for a tuple of arity ${m.argType.elements.length}.`);for(let A=0;A<T/m.argType.elements.length;A++)a.push(...m.argType.elements)}else for(let A=0;A<T;A++)a.push(m.argType)}return{sql:i,args:s,argTypes:a}}function $d(e,t,r){let n=e.type;switch(n){case"parameter":return Oi(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>Oi(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Oi(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:L(n,"Invalid fragment type")}}function Oi(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function Ud(e,t,r){return{sql:e,args:t,argTypes:r}}function Vd(e){return Ii(e)||ki(e)}function*Ni(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*ou(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 Ni(e,t,void 0)){let a=0;for(let m of ou(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of Ni(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,m=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let f=r-(n-a);m=Bd(s.value,f)}else m=[s.value];o=o.flatMap(f=>m.map(T=>[...f,T]));break}case"parameterTupleList":{let a=s.value.reduce((A,C)=>A+C.length,0),m=[],f=[],T=0;for(let A of s.value)r&&o.length===1&&a===i&&f.length>0&&n-a+T+A.length>r&&(m.push(f),f=[],T=0),f.push(A),T+=A.length;f.length>0&&m.push(f),o=o.flatMap(A=>m.map(C=>[...A,C]));break}}return o}function Bd(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}u();l();c();p();d();function su(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function au(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>jd(t)),rows:e.rows.map(t=>t.map((r,n)=>ar(r,e.columnTypes[n])))}}function ar(e,t){if(e===null)return null;switch(t){case k.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 k.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>ar(r,k.Int32));case k.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 k.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>ar(r,k.Int64));case k.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case k.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>ar(r,k.Json));case k.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 k.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>ar(r,k.Boolean));default:return e}}function jd(e){switch(e){case k.Int32:return"int";case k.Int64:return"bigint";case k.Float:return"float";case k.Double:return"double";case k.Text:return"string";case k.Enum:return"enum";case k.Bytes:return"bytes";case k.Boolean:return"bool";case k.Character:return"char";case k.Numeric:return"decimal";case k.Json:return"json";case k.Uuid:return"uuid";case k.DateTime:return"datetime";case k.Date:return"date";case k.Time:return"time";case k.Int32Array:return"int-array";case k.Int64Array:return"bigint-array";case k.FloatArray:return"float-array";case k.DoubleArray:return"double-array";case k.TextArray:return"string-array";case k.EnumArray:return"string-array";case k.BytesArray:return"bytes-array";case k.BooleanArray:return"bool-array";case k.CharacterArray:return"char-array";case k.NumericArray:return"decimal-array";case k.JsonArray:return"json-array";case k.UuidArray:return"uuid-array";case k.DateTimeArray:return"datetime-array";case k.DateArray:return"date-array";case k.TimeArray:return"time-array";case k.UnknownNumber:return"unknown";case k.Set:return"string";default:L(e,`Unexpected column type: ${e}`)}}u();l();c();p();d();function uu(e,t,r){if(!t.every(n=>Mi(e,n))){let n=Qd(e,r),i=Jd(r);throw new Z(n,i,r.context)}}function Mi(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:L(t,`Unknown rule type: ${t.type}`)}}function Qd(e,t){switch(t.error_identifier){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:L(t,`Unknown error identifier: ${t}`)}}function Jd(e){switch(e.error_identifier){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:L(e,`Unknown error identifier: ${e}`)}}var ur=class e{#e;#t=new an;#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:su,rawSerializer:au,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let{value:n}=await this.interpretNode(t,{...r,generators:this.#t.snapshot()}).catch(i=>Tt(i));return n}async interpretNode(t,r){switch(t.type){case"value":return{value:fe(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(!lu(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(Li(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)=>Ae(i)+Ae(o)):0}}case"execute":{let n=Di(t.args,r.scope,r.generators,this.#a()),i=0;for(let o of n){let s=cu(o,r.sqlCommenter);i+=await this.#l(s,r.queryable,()=>r.queryable.executeRaw(s).catch(a=>t.args.type==="rawSql"?oi(a):Tt(a)))}return{value:i}}case"query":{let n=Di(t.args,r.scope,r.generators,this.#a()),i;for(let o of n){let s=cu(o,r.sqlCommenter),a=await this.#l(s,r.queryable,()=>r.queryable.queryRaw(s).catch(m=>t.args.type==="rawSql"?oi(m):Tt(m)));i===void 0?i=a:(i.rows.push(...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(lu(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:pu(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:Hd(n,o),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:Xs(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return uu(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Mi(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?Rt(ln(a),t.args.fields):null,s=new Set(Li(i).map(o));return{value:Li(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:un(n,t.args.operations),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]=Gd(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?{}:ln(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=zd(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:L(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:L(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 lu(e){return Array.isArray(e)?e.length===0:e==null}function Li(e){return Array.isArray(e)?e:[e]}function Ae(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function ln(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function pu(e,t){return Array.isArray(e)?e.map(r=>pu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function Hd(e,t){for(let{joinExpr:r,childRecords:n}of t){let i=r.on.map(([a])=>a),o=r.on.map(([,a])=>a),s={};for(let a of Array.isArray(e)?e:[e]){let m=ln(a),f=Rt(m,i);s[f]||(s[f]=[]),s[f].push(m),r.isRelationUnique?m[r.parentField]=null:m[r.parentField]=[]}for(let a of Array.isArray(n)?n:[n]){if(a===null)continue;let m=Rt(ln(a),o);for(let f of s[m]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Gd(e,t,r,n){switch(e.type){case"value":return fe(e.value,r,n);case"lastInsertId":return t;default:L(e,`Unexpected field initializer type: ${e.type}`)}}function zd(e,t,r,n){switch(e.type){case"set":return fe(e.value,r,n);case"add":return Ae(t)+Ae(fe(e.value,r,n));case"subtract":return Ae(t)-Ae(fe(e.value,r,n));case"multiply":return Ae(t)*Ae(fe(e.value,r,n));case"divide":{let i=Ae(t),o=Ae(fe(e.value,r,n));return o===0?null:i/o}default:L(e,`Unexpected field operation type: ${e.type}`)}}function cu(e,t){if(!t||t.plugins.length===0)return e;let r=ea(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:ta(e.sql,r)}:e}u();l();c();p();d();u();l();c();p();d();async function Wd(){return globalThis.crypto??await Promise.resolve().then(()=>(ze(),$n))}async function du(){return(await Wd()).randomUUID()}u();l();c();p();d();async function mu(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}u();l();c();p();d();var pe=class extends Z{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},lr=class extends pe{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.")}},cn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},pn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},dn=class extends pe{constructor(){super("Unable to start a transaction in the given time.")}},mn=class extends pe{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})}},It=class extends pe{constructor(t){super(`Internal Consistency Error: ${t}`)}},fn=class extends pe{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Kd=100,kt=te("prisma:client:transactionManager"),Zd=()=>({sql:"COMMIT",args:[],argTypes:[]}),Yd=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Xd=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),em=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),cr=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#e;#t;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#e=i,this.#t=o}async startInternalTransaction(t){let r=t!==void 0?this.#s(t):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(r))}async startTransaction(t){let r=t!==void 0?this.#s(t):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(r))}async#r(t){let r={id:await du(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=fu(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(Tt);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),mu(n.signal,"abort").then(()=>{})]),this.transactions.set(r.id,r),r.status){case"waiting":if(n.signal.aborted)throw o.then(s=>s.rollback()).catch(s=>kt("error in discarded transaction:",s)),await this.#o(r,"timed_out"),new dn;return r.status="running",r.timer=this.#i(r.id,t.timeout),{id:r.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new It(`Transaction in invalid state ${r.status} although it just finished startup.`);default:L(r.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.#n(t,"commit");await this.#o(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.#n(t,"rollback");await this.#o(r,"rolled_back")})}async getTransaction(t,r){let n=this.#n(t.id,r);if(n.status==="closing"&&(await n.closing,n=this.#n(t.id,r)),!n.transaction)throw new lr;return n.transaction}#n(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(kt("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new It("Active transaction found in closed transactions list.");case"committed":throw new cn(r);case"rolled_back":throw new pn(r);case"timed_out":throw new mn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw kt("Transaction not found.",t),new lr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new It("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.#o(t,"rolled_back")))}#i(t,r){let n=Date.now(),i=fu(async()=>{kt("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);o&&["running","waiting"].includes(o.status)?await this.#o(o,"timed_out"):kt("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#o(t,r){let n=async()=>{kt("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#a(Xd(),t.transaction,()=>t.transaction.commit());else{let i=Zd();await this.#a(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.#a(em(),t.transaction,()=>t.transaction.rollback());else{let i=Yd();try{await this.#a(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>Kd&&this.closedTransactions.shift()}};t.status==="closing"?(await t.closing,this.#n(t.id,r==="committed"?"commit":"rollback")):await Object.assign(t,{status:"closing",reason:r,closing:n()}).closing}#s(t){if(!t.timeout)throw new pe("timeout is required");if(!t.maxWait)throw new pe("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new fn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#a(t,r,n){return Yr({query:t,execute:n,provider:this.#t??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#e})}};function fu(e,t){return t!==void 0?setTimeout(e,t):void 0}var ee=require("@prisma/client-runtime-utils");u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function gu(e){return new _i(e).deserialize()}function tm(e){return g.from(e,"base64url")}var _i=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=tm(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.#c(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(),m=this.#s(),f=this.#i(),T=this.#i(),C={flags:this.#o()};m!==0&&(C.scalarMask=m),f!==void 0&&(C.childNodeId=f),T!==void 0&&(C.enumNameIndex=T),o[a]=C}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(),m=this.#i(),f=this.#i(),T={};m!==void 0&&(T.argsNodeId=m),f!==void 0&&(T.outputNodeId=f),o[a]=T}r.push({edges:o})}return r}#c(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],m={};o!==void 0&&(m.argsNodeId=o),s!==void 0&&(m.outputNodeId=s),r[a]=m}return r}};var pr=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=gu(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]}},Se={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},X={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function ve(e,t){return(e.flags&t)!==0}function Be(e){return e.scalarMask}var gn="7.4.0-integration-parameterization.21";u();l();c();p();d();var yu={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function wu(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=>bu(i)),n=t.map(i=>nm(i));return{args:r,argTypes:n}}function bu(e){if(Array.isArray(e))return e.map(t=>bu(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 nm(e){return Array.isArray(e)?{scalarType:e.length>0?hu(e[0]):"unknown",arity:"list"}:{scalarType:hu(e),arity:"scalar"}}function hu(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in yu?yu[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}u();l();c();p();d();function xu(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}u();l();c();p();d();u();l();c();p();d();function Eu(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}u();l();c();p();d();function Pu(e){return e.split(`
7
7
  `).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(`
8
8
  `)}u();l();c();p();d();var Tu=Qe(_o());function Au({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Tu.default)({user:t,repo:r,template:n,title:e,body:i})}function Su({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=So(6e3-(s?.length??0)),m=Pu(lt(a)),f=n?`# Description
9
9
  \`\`\`
@@ -57,7 +57,7 @@ Example:
57
57
  await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
58
58
 
59
59
  More Information: https://pris.ly/d/execute-raw
60
- `)}var ji=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Qr(r))n=r.sql,i={values:Ot(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Ot(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Ot(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Ot(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Ku(r),i={values:Ot(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?rl(`prisma.${e}(${n}, ${i.values})`):rl(`prisma.${e}(${n})`),{query:n,parameters:i}},il={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new nl.Sql(t,r)}},ol={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};u();l();c();p();d();function Qi(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=sl(r(s)):sl(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 sl(e){return typeof e.then=="function"?e:Promise.resolve(e)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var al={name:"@prisma/instrumentation-contract",version:"7.4.0-integration-parameterization.20",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 xm=al.version.split(".")[0],Em="PRISMA_INSTRUMENTATION",Pm=`V${xm}_PRISMA_INSTRUMENTATION`,ul=globalThis;function ll(){let e=ul[Pm];return e?.helper?e.helper:ul[Em]?.helper}var Tm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Ji=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(t){return this.getTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getTracingHelper().runInChildSpan(t,r)}getTracingHelper(){return ll()??Tm}};function cl(){return new Ji}u();l();c();p();d();function pl(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}u();l();c();p();d();function dl(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)}u();l();c();p();d();var gl=require("@prisma/client-runtime-utils");u();l();c();p();d();function ml(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Hi(e.query.arguments)),t.push(Hi(e.query.selection)),t.join("")}function Hi(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Hi(n)})`:r}).join(" ")})`}u();l();c();p();d();var Am={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 Gi(e){return Am[e]}u();l();c();p();d();var Sn=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)}).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"}};u();l();c();p();d();var fl=require("@prisma/client-runtime-utils");function nt(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=g.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new fl.Decimal(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=>nt("bigint",r));case"bytes-array":return t.map(r=>nt("bytes",r));case"decimal-array":return t.map(r=>nt("decimal",r));case"datetime-array":return t.map(r=>nt("datetime",r));case"date-array":return t.map(r=>nt("date",r));case"time-array":return t.map(r=>nt("time",r));default:return t}}function vn(e){let t=[],r=Sm(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]]=nt(e.types[s],i[s]);t.push(o)}return t}function Sm(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var vm=te("prisma:client:request_handler"),Cn=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new Sn({batchLoader:Us(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(A=>A.protocolQuery),m=this.client._tracingHelper.getTraceParent(s),f=n.some(A=>Gi(A.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:Cm(o),containsWrite:f,customDataProxyFetch:i})).map((A,C)=>{if(A instanceof Error)return A;try{return this.mapQueryEngineResult(n[C],A)}catch(S){return S}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?yl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Gi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:ml(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 y.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(vm(t),Rm(t,i))throw t;if(t instanceof N.PrismaClientKnownRequestError&&Im(t)){let f=hl(t.meta);$r({args:o,errors:[f],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let m=t.message;if(n&&(m=kr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:m})),m=this.sanitizeMessage(m),t.code){let f=s?{modelName:s,...t.meta}:t.meta;throw new N.PrismaClientKnownRequestError(m,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new N.PrismaClientRustPanicError(m,this.client._clientVersion);if(t instanceof N.PrismaClientUnknownRequestError)throw new N.PrismaClientUnknownRequestError(m,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof N.PrismaClientInitializationError)throw new N.PrismaClientInitializationError(m,this.client._clientVersion);if(t instanceof N.PrismaClientRustPanicError)throw new N.PrismaClientRustPanicError(m,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?lt(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=r.filter(f=>f!=="select"&&f!=="include"),a=Xn(o,s),m=i==="queryRaw"?vn(a):$e(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function Cm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:yl(e)};Ie(e,"Unknown transaction kind")}}function yl(e){return{id:e.id,payload:e.payload}}function Rm(e,t){return(0,gl.hasBatchIndex)(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Im(e){return e.code==="P2009"||e.code==="P2012"}function hl(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(hl)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}u();l();c();p();d();var zi=gn;u();l();c();p();d();var Pl=Qe(Jn());u();l();c();p();d();var j=class extends Error{constructor(t){super(t+`
60
+ `)}var ji=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Qr(r))n=r.sql,i={values:Ot(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Ot(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Ot(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Ot(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Ku(r),i={values:Ot(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?rl(`prisma.${e}(${n}, ${i.values})`):rl(`prisma.${e}(${n})`),{query:n,parameters:i}},il={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new nl.Sql(t,r)}},ol={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};u();l();c();p();d();function Qi(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=sl(r(s)):sl(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 sl(e){return typeof e.then=="function"?e:Promise.resolve(e)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var al={name:"@prisma/instrumentation-contract",version:"7.4.0-integration-parameterization.21",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 xm=al.version.split(".")[0],Em="PRISMA_INSTRUMENTATION",Pm=`V${xm}_PRISMA_INSTRUMENTATION`,ul=globalThis;function ll(){let e=ul[Pm];return e?.helper?e.helper:ul[Em]?.helper}var Tm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Ji=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(t){return this.getTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getTracingHelper().runInChildSpan(t,r)}getTracingHelper(){return ll()??Tm}};function cl(){return new Ji}u();l();c();p();d();function pl(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}u();l();c();p();d();function dl(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)}u();l();c();p();d();var gl=require("@prisma/client-runtime-utils");u();l();c();p();d();function ml(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Hi(e.query.arguments)),t.push(Hi(e.query.selection)),t.join("")}function Hi(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Hi(n)})`:r}).join(" ")})`}u();l();c();p();d();var Am={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 Gi(e){return Am[e]}u();l();c();p();d();var Sn=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)}).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"}};u();l();c();p();d();var fl=require("@prisma/client-runtime-utils");function nt(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=g.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new fl.Decimal(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=>nt("bigint",r));case"bytes-array":return t.map(r=>nt("bytes",r));case"decimal-array":return t.map(r=>nt("decimal",r));case"datetime-array":return t.map(r=>nt("datetime",r));case"date-array":return t.map(r=>nt("date",r));case"time-array":return t.map(r=>nt("time",r));default:return t}}function vn(e){let t=[],r=Sm(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]]=nt(e.types[s],i[s]);t.push(o)}return t}function Sm(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var vm=te("prisma:client:request_handler"),Cn=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new Sn({batchLoader:Us(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(A=>A.protocolQuery),m=this.client._tracingHelper.getTraceParent(s),f=n.some(A=>Gi(A.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:Cm(o),containsWrite:f,customDataProxyFetch:i})).map((A,C)=>{if(A instanceof Error)return A;try{return this.mapQueryEngineResult(n[C],A)}catch(S){return S}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?yl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Gi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:ml(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 y.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(vm(t),Rm(t,i))throw t;if(t instanceof N.PrismaClientKnownRequestError&&Im(t)){let f=hl(t.meta);$r({args:o,errors:[f],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let m=t.message;if(n&&(m=kr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:m})),m=this.sanitizeMessage(m),t.code){let f=s?{modelName:s,...t.meta}:t.meta;throw new N.PrismaClientKnownRequestError(m,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new N.PrismaClientRustPanicError(m,this.client._clientVersion);if(t instanceof N.PrismaClientUnknownRequestError)throw new N.PrismaClientUnknownRequestError(m,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof N.PrismaClientInitializationError)throw new N.PrismaClientInitializationError(m,this.client._clientVersion);if(t instanceof N.PrismaClientRustPanicError)throw new N.PrismaClientRustPanicError(m,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?lt(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=r.filter(f=>f!=="select"&&f!=="include"),a=Xn(o,s),m=i==="queryRaw"?vn(a):$e(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function Cm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:yl(e)};Ie(e,"Unknown transaction kind")}}function yl(e){return{id:e.id,payload:e.payload}}function Rm(e,t){return(0,gl.hasBatchIndex)(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Im(e){return e.code==="P2009"||e.code==="P2012"}function hl(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(hl)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}u();l();c();p();d();var zi=gn;u();l();c();p();d();var Pl=Qe(Jn());u();l();c();p();d();var j=class extends Error{constructor(t){super(t+`
61
61
  Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};Vt(j,"PrismaClientConstructorValidationError");var wl=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","__internal"],bl=["pretty","colorless","minimal"],xl=["info","query","warn","error"],km={adapter:()=>{},accelerateUrl:e=>{if(e!==void 0){if(typeof e!="string")throw new j(`Invalid value ${JSON.stringify(e)} for "accelerateUrl" provided to PrismaClient constructor.`);if(e.trim().length===0)throw new j('"accelerateUrl" provided to PrismaClient constructor must be a non-empty string.')}},errorFormat:e=>{if(e){if(typeof e!="string")throw new j(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!bl.includes(e)){let t=mr(e,bl);throw new j(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new j(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!xl.includes(r)){let n=mr(r,xl);throw new j(`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=mr(i,o);throw new j(`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 j(`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 j(`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 j(`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 j('"omit" option is expected to be an object.');if(e===null)throw new j('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=Dm(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let m=o.fields.find(f=>f.name===s);if(!m){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(m.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 j(Mm(e,r))},comments:e=>{if(e!==void 0){if(!Array.isArray(e))throw new j(`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 j(`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 j(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=mr(r,t);throw new j(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Om(e){let t=e.adapter!==void 0,r=e.accelerateUrl!==void 0;if(t&&r)throw new j('The "adapter" and "accelerateUrl" options are mutually exclusive. Please provide only one of them.');if(!t&&!r)throw new j('Using engine type "client" requires either "adapter" or "accelerateUrl" to be provided to PrismaClient constructor.')}function Tl(e,t){for(let[r,n]of Object.entries(e)){if(!wl.includes(r)){let i=mr(r,wl);throw new j(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}km[r](n,t)}Om(e)}function mr(e,t){if(t.length===0||typeof e!="string")return"";let r=Nm(e,t);return r?` Did you mean "${r}"?`:""}function Nm(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Pl.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 Dm(e,t){return El(t.models,e)??El(t.types,e)}function El(e,t){let r=Object.keys(e).find(n=>Me(n)===t);if(r)return e[r]}function Mm(e,t){let r=wt(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:
62
62
 
63
63
  ${i}