@prisma/client 7.4.0-integration-parameterization.19 → 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 @@ var yl=Object.create;var dr=Object.defineProperty;var hl=Object.getOwnPropertyDe
3
3
  `)}function Yl(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function vr(e){let t=e.showColors?zl:Wl,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=Kl(e),Zl(r,t)}u();l();c();p();d();var Jo=$e(Fn());u();l();c();p();d();function Vo(e,t,r){let n=qo(e),i=Xl(n),o=tc(i);o?Cr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function qo(e){return e.errors.flatMap(t=>t.kind==="Union"?qo(t):[t])}function Xl(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:ec(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function ec(e,t){return[...new Set(e.concat(t))]}function tc(e){return _n(e,(t,r)=>{let n=$o(t),i=$o(r);return n!==i?n-i:Uo(t)-Uo(r)})}function $o(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function Uo(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 se=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 st=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}};Bo();u();l();c();p();d();u();l();c();p();d();var Rr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};u();l();c();p();d();var Ir=e=>e,kr={bold:Ir,red:Ir,green:Ir,dim:Ir,enabled:!1},Qo={bold:gr,red:tt,green:yo,dim:yr,enabled:!0},at={write(e){e.writeLine(",")}};u();l();c();p();d();var he=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 Oe=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var ut=class extends Oe{items=[];addItem(t){return this.items.push(new Rr(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 he("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(at,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var lt=class e extends Oe{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 ut&&(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 he("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(at,[...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 W=class extends Oe{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new he(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};u();l();c();p();d();var Ft=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(at,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Cr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":rc(e,t);break;case"IncludeOnScalar":nc(e,t);break;case"EmptySelection":ic(e,t,r);break;case"UnknownSelectionField":uc(e,t);break;case"InvalidSelectionValue":lc(e,t);break;case"UnknownArgument":cc(e,t);break;case"UnknownInputField":pc(e,t);break;case"RequiredArgumentMissing":dc(e,t);break;case"InvalidArgumentType":mc(e,t);break;case"InvalidArgumentValue":fc(e,t);break;case"ValueTooLarge":gc(e,t);break;case"SomeFieldsMissing":yc(e,t);break;case"TooManyFieldsGiven":hc(e,t);break;case"Union":Vo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function rc(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 nc(e,t){let[r,n]=ct(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 se(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)}. ${$t(s)}`:a+=".",a+=`
5
5
  Note that ${s.bold("include")} statements only accept relation fields.`,a})}function ic(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){oc(e,t,i);return}if(n.hasField("select")){sc(e,t);return}}if(r?.[ke(e.outputType.name)]){ac(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function oc(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new se(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 sc(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),zo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${$t(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function ac(e,t){let r=new Ft;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new se("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=ct(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let m=a?.value.asObject()??new lt;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 uc(e,t){let r=Wo(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":zo(n,e.outputType);break;case"include":wc(n,e.outputType);break;case"omit":bc(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push($t(n)),i.join(" ")})}function lc(e,t){let r=Wo(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 cc(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),xc(n,e.arguments)),t.addErrorMessage(i=>Ho(i,r,e.arguments.map(o=>o.name)))}function pc(e,t){let[r,n]=ct(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Ko(o,e.inputType)}t.addErrorMessage(o=>Ho(o,n,e.inputType.fields.map(s=>s.name)))}function Ho(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Pc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push($t(e)),n.join(" ")}function dc(e,t){let r;t.addErrorMessage(m=>r?.value instanceof W&&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]=ct(e.argumentPath),s=new Ft,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 se(o,s).makeRequired())}else{let m=e.inputTypes.map(Go).join(" | ");a.addSuggestion(new se(o,m).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,m]=ct(e.dependentArgumentPath);t.addErrorMessage(f=>`Argument \`${f.green(o)}\` is required because argument \`${f.green(m)}\` was provided.`)}}}function Go(e){return e.kind==="list"?`${Go(e.elementType)}[]`:e.name}function mc(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=Or("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 fc(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=Or("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function gc(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 W&&(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 yc(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&&Ko(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")} ${Or("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($t(i)),o.join(" ")})}function hc(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 ${Or("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function zo(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new se(r.name,"true"))}function wc(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new se(r.name,"true"))}function bc(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new se(r.name,"true"))}function xc(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new se(r.name,r.typeNames.join(" | ")))}function Wo(e,t){let[r,n]=ct(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 Ko(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new se(r.name,r.typeNames.join(" | ")))}function ct(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function $t({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function Or(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var Ec=3;function Pc(e,t){let r=1/0,n;for(let i of t){let o=(0,Jo.default)(e,i);o>Ec||o<r&&(r=o,n=i)}return n}u();l();c();p();d();import{ObjectEnumValue as Tc}from"@prisma/client-runtime-utils";u();l();c();p();d();var Ut=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 pt(e){return e instanceof Ut}u();l();c();p();d();var Zo=": ",Nr=class{constructor(t,r){this.name=t;this.value=r}hasError=!1;markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Zo.length}write(t){let r=new he(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Zo).write(this.value)}};var Un=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 dt(e){return new Un(Yo(e))}function Yo(e){let t=new lt;for(let[r,n]of Object.entries(e)){let i=new Nr(r,Xo(n));t.addField(i)}return t}function Xo(e){if(typeof e=="string")return new W(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new W(String(e));if(typeof e=="bigint")return new W(`${e}n`);if(e===null)return new W("null");if(e===void 0)return new W("undefined");if(ot(e))return new W(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return g.isBuffer(e)?new W(`Buffer.alloc(${e.byteLength})`):new W(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ar(e)?e.toISOString():"Invalid Date";return new W(`new Date("${t}")`)}return e instanceof Tc?new W(`Prisma.${e._getName()}`):pt(e)?new W(`prisma.${ke(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Ac(e):typeof e=="object"?Yo(e):new W(Object.prototype.toString.call(e))}function Ac(e){let t=new ut;for(let r of e)t.addItem(Xo(r));return t}function Dr(e,t){let r=t==="pretty"?Qo:kr,n=e.renderAllMessages(r),i=new st(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Mr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=dt(e);for(let A of t)Cr(A,a,s);let{message:m,args:f}=Dr(a,r),T=vr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new Sc(T,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function we(e){return e.replace(/^./,t=>t.toLowerCase())}u();l();c();p();d();function ts(e,t,r){let n=we(r);return!t.result||!(t.result.$allModels||t.result[n])?e:vc({...e,...es(t.name,e,t.result.$allModels),...es(t.name,e,t.result[n])})}function vc(e){let t=new ye,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Tr(e,n=>({...n,needs:r(n.name,new Set)}))}function es(e,t,r){return r?Tr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Cc(t,o,i)})):{}}function Cc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function rs(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 ns(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var Lr=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new ye;modelExtensionsCache=new ye;queryCallbacksCache=new ye;clientExtensions=Rt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Rt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>ts(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=we(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()}},mt=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new Lr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Lr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};u();l();c();p();d();var _r=class{constructor(t){this.name=t}};function is(e){return e instanceof _r}function Rc(e){return new _r(e)}u();l();c();p();d();u();l();c();p();d();var os=Symbol(),Vt=class{constructor(t){if(t!==os)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Vn:t}},Vn=new Vt(os);function be(e){return e instanceof Vt}var Dc={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"},ss="explicitly `undefined` values are not allowed";function Bn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=mt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A}){let C=new qn({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:Dc[t],query:qt(r,C)}}function qt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:us(r,n),selection:Mc(e,t,i,n)}}function Mc(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()}),$c(e,n)):Lc(n,t,r)}function Lc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&_c(n,t,e),Fc(n,r,e),n}function _c(e,t,r){for(let[n,i]of Object.entries(t)){if(be(i))continue;let o=r.nestSelection(n);if(jn(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]=qt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=qt(i,o)}}function Fc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=ns(i,n);for(let[s,a]of Object.entries(o)){if(be(a))continue;jn(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(e[s]=!a)}}function $c(e,t){let r={},n=t.getComputedFields(),i=rs(e,n);for(let[o,s]of Object.entries(i)){if(be(s))continue;let a=t.nestSelection(o);jn(s,a);let m=t.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||be(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=qt({},a):r[o]=!0;continue}r[o]=qt(s,a)}}return r}function as(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(it(e)){if(Ar(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(is(e))return{$type:"Param",value:e.name};if(pt(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Uc(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(Vc(e))return e.values;if(ot(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Nc){if(!kc(e)&&!Oc(e)&&!Ic(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(qc(e))return e.toJSON();if(typeof e=="object")return us(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 us(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);be(i)||(i!==void 0?r[n]=as(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:ss}))}return r}function Uc(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||be(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(as(o,i))}return r}function Vc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function qc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function jn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:ss})}var qn=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){Mr({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?.[ke(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:Se(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};u();l();c();p();d();function Bc(e,t){let r=Rt(()=>jc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function jc(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function Qn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}u();l();c();p();d();var Jn=new WeakMap,Fr="$$PrismaTypedSql",Bt=class{constructor(t,r){Jn.set(this,{sql:t,values:r}),Object.defineProperty(this,Fr,{value:Fr})}get sql(){return Jn.get(this).sql}get values(){return Jn.get(this).values}};function Qc(e){return(...t)=>new Bt(e,t)}function $r(e){return e!=null&&e[Fr]===Fr}u();l();c();p();d();import{Sql as Vm}from"@prisma/client-runtime-utils";u();l();c();p();d();ls();u();l();c();p();d();u();l();c();p();d();function jt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}u();l();c();p();d();function te(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}u();l();c();p();d();function je(e){let t=new ye;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 Vr={enumerable:!0,configurable:!0,writable:!0};function qr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Vr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var cs=Symbol.for("nodejs.util.inspect.custom");function ce(e,t){let r=Jc(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=ps(Reflect.ownKeys(o),r),a=ps(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?{...Vr,...m?.getPropertyDescriptor(s)}:Vr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[cs]=function(){let o={...this};return delete o[cs],o},i}function Jc(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 ps(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}u();l();c();p();d();function ft(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function ds(e){if(e===void 0)return"";let t=dt(e);return new st(0,{colors:kr}).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 Hn=class{getLocation(){return null}};function Ne(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Hn}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var ms={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function gt(e={}){let t=Gc(e);return Object.entries(t).reduce((n,[i,o])=>(ms[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Gc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Br(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function fs(e,t){let r=Br(e);return t({action:"aggregate",unpacker:r,argsMapper:gt})(e)}u();l();c();p();d();function zc(e={}){let{select:t,...r}=e;return typeof t=="object"?gt({...r,_count:t}):gt({...r,_count:{_all:!0}})}function Wc(e={}){return typeof e.select=="object"?t=>Br(e)(t)._count:t=>Br(e)(t)._count._all}function gs(e,t){return t({action:"count",unpacker:Wc(e),argsMapper:zc})(e)}u();l();c();p();d();function Kc(e={}){let t=gt(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 Zc(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ys(e,t){return t({action:"groupBy",unpacker:Zc(e),argsMapper:Kc})(e)}function hs(e,t,r){if(t==="aggregate")return n=>fs(n,r);if(t==="count")return n=>gs(n,r);if(t==="groupBy")return n=>ys(n,r)}u();l();c();p();d();function ws(e,t){let r=t.fields.filter(i=>!i.relationName),n=co(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 Ut(e,o,s.type,s.isList,s.kind==="enum")},...qr(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var bs=e=>Array.isArray(e)?e:e.split("."),Gn=(e,t)=>bs(t).reduce((r,n)=>r&&r[n],e),xs=(e,t,r)=>bs(t).reduceRight((n,i,o,s)=>Object.assign({},Gn(e,s.slice(0,o)),{[i]:n}),r);function Yc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function Xc(e,t,r){return t===void 0?e??{}:xs(t,r,e||!0)}function zn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((m,f)=>({...m,[f.name]:f}),{});return m=>{let f=Ne(e._errorFormat),T=Yc(n,i),A=Xc(m,o,T),C=r({dataPath:T,callsite:f})(A),S=ep(e,t);return new Proxy(C,{get(D,R){if(!S.includes(R))return D[R];let X=[a[R].type,r,R],j=[T,A];return zn(e,...X,...j)},...qr([...S,...Object.getOwnPropertyNames(C)])})}}function ep(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var tp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],rp=["aggregate","count","groupBy"];function Wn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[np(e,t),op(e,t),jt(r),te("name",()=>t),te("$name",()=>t),te("$parent",()=>e._appliedParent)];return ce({},n)}function np(e,t){let r=we(t),n=Object.keys(_t).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let f=Ne(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 tp.includes(o)?zn(e,t,s):ip(i)?hs(e,i,s):s({})}}}function ip(e){return rp.includes(e)}function op(e,t){return je(te("fields",()=>{let r=e._runtimeDataModel.models[t];return ws(t,r)}))}u();l();c();p();d();function Es(e){return e.replace(/^./,t=>t.toUpperCase())}var Kn=Symbol();function Qt(e){let t=[sp(e),ap(e),te(Kn,()=>e),te("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(jt(r)),ce(e,t)}function sp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function ap(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(we),n=[...new Set(t.concat(r))];return je({getKeys(){return n},getPropertyValue(i){let o=Es(i);if(e._runtimeDataModel.models[o]!==void 0)return Wn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Wn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Ps(e){return e[Kn]?e[Kn]:e}function Ts(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 Qt(t)}u();l();c();p();d();u();l();c();p();d();function As({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(ft(f))}else if(r){if(!r[m.name])continue;let f=m.needs.filter(T=>!r[T]);f.length>0&&a.push(ft(f))}up(e,m.needs)&&s.push(lp(m,ce(e,s)))}return s.length>0||a.length>0?ce(e,[...s,...a]):e}function up(e,t){return t.every(r=>Ln(e,r))}function lp(e,t){return je(te(e.name,()=>e.compute(t)))}u();l();c();p();d();function jr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=jr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Ss({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Ss({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Ss({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||be(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]=jr({visitor:i,result:t[o],args:f,modelName:m.type,runtimeDataModel:n})}}function vs({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:jr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,m,f)=>{let T=we(m);return As({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();import{Decimal as pp,ObjectEnumValue as dp,Sql as Rs}from"@prisma/client-runtime-utils";u();l();c();p();d();var cp=["$connect","$disconnect","$on","$transaction","$extends"],Cs=cp;function Is(e){if(e instanceof Rs)return mp(e);if($r(e))return fp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Jt(e[n]);return r}let t={};for(let r in e)t[r]=Jt(e[r]);return t}function mp(e){return new Rs(e.strings,e.values)}function fp(e){return new Bt(e.sql,e.values)}function Jt(e){if(typeof e!="object"||e==null||e instanceof dp||pt(e))return e;if(ot(e))return new pp(e.toFixed());if(it(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]=Jt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Jt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Jt(e[r]);return t}Se(e,"Unknown value")}function Os(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:Is(t.args??{}),__internalParams:t,query:(s,a=t)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=Ls(o,m),a.args=s,Os(e,a,r,n+1)}})})}function Ns(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 Os(e,t,s)}function Ds(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Ms(r,n,0,e):e(r)}}function Ms(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=Ls(i,m),Ms(a,t,r+1,n)}})}var ks=e=>e;function Ls(e=ks,t=ks){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();import{Decimal as gp}from"@prisma/client-runtime-utils";u();l();c();p();d();import{Decimal as Qr}from"@prisma/client-runtime-utils";function M(e,t){throw new Error(t)}function Zn(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=>Zn(e[r],t[r]))}function yt(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(Qr.isDecimal(e[o])||Qr.isDecimal(t[o])){let s=_s(e[o]),a=_s(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Fs(e[o]),a=Fs(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return $s(e[o])?.getTime()===$s(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Us(e[o])===Us(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Vs(e[o])===Vs(t[o])}return Zn(e[o],t[o])})}function _s(e){return Qr.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new Qr(e):void 0}function Fs(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 $s(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Us(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Vs(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Ht(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 yp(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function hp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function Qe(e){return e===null?e:Array.isArray(e)?e.map(Qe):typeof e=="object"?yp(e)?wp(e):e.constructor!==null&&e.constructor.name!=="Object"?e:hp(e,Qe):e}function wp({$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 gp(t);case"Json":return JSON.parse(t);default:M(t,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Jr(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 K=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function ht(e){if(!Jr(e))throw e;let t=bp(e),r=qs(e);throw!t||!r?e:new K(r,t,{driverAdapterError:e})}function Xn(e){throw Jr(e)?new K(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??qs(e)}\``,"P2010",{driverAdapterError:e}):e}function bp(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:M(e.cause,`Unknown error: ${e.cause}`)}}function qs(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 ${Yn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Yn(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 ${Yn(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:M(e.cause,`Unknown error: ${e.cause}`)}}function Yn(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 xp(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 Ep(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function Pp(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,xp(i)){let o=Ep(i);o&&o in t&&(r[n]=t[o])}return r}function Bs(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=Qe(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=Pp(o,r),a=n.findIndex(m=>yt(m,s));if(a===-1)return t.expectNonEmpty?new K("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(e[a]).filter(([f])=>i.has(f));return Object.fromEntries(m)}})}u();l();c();p();d();import{Decimal as Tp}from"@prisma/client-runtime-utils";var U=class extends K{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},js=new WeakMap;function Ap(e){let t=js.get(e);return t||(t=Object.entries(e),js.set(e,t)),t}function Js(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new U(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return ti(e,t.fields,r,t.skipNulls);case"field":return ei(e,"<result>",t.fieldType,r);default:M(t,`Invalid data mapping type: '${t.type}'`)}}function ti(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=>Qs(o,t,r))}if(typeof e=="object")return Qs(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new U("Expected an array or object, got a string that is not valid JSON",{cause:o})}return ti(i,t,r,n)}throw new U(`Expected an array or an object, got: ${typeof e}`)}function Qs(e,t,r){if(typeof e!="object")throw new U(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Ap(t))switch(o.type){case"affectedRows":throw new U(`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 U(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=ti(f,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=Sp(e[s],s,o.fieldType,r);else throw new U(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:M(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Sp(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>ei(o,`${t}[${s}]`,r,n)):ei(e,t,r,n)}function ei(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new U(`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 U(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new U(`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 U(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new U(`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 U(`Expected a float in column '${t}', got string: ${e}`);return i}throw new U(`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 U(`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 U(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Tp.isDecimal(e))throw new U(`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:Cp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new U(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Ht(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new U(`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 U(`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 U(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:M(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new U(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new U(`Value '${e}' not found in enum '${r.name}'`);return o}default:M(r,`DataMapper: Unknown result type: ${r.type}`)}}var vp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Cp(e){let t=vp.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 xe(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]=xe(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:xe(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=xe(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=xe(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(xe(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(xe(o),xe(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(xe(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function Rp(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 Hr(e,t){let r={};for(let n of e){let i=n(xe(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function Hs(e,t){let r=Hr(e,t);return Rp(r)}function Gs(e,t){return t?`${e} ${t}`:e}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Gt;(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"})(Gt||(Gt={}));function Ip(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:M(e,`Unknown provider: ${e}`)}}async function Gr({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:Gt.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Ip(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Je(e,t){var r="000000000"+e;return r.substr(r.length-t)}var zs=$e(vo(),1);function kp(){try{return zs.default.hostname()}catch{return y.env._CLUSTER_NETWORK_NAME_||y.env.COMPUTERNAME||"hostname"}}var Ws=2,Op=Je(y.pid.toString(36),Ws),Ks=kp(),Np=Ks.length,Dp=Je(Ks.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Np+36).toString(36),Ws);function ri(){return Op+Dp}u();l();c();p();d();u();l();c();p();d();function zr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function ni(e){let n=Math.pow(36,4),i=0;function o(){return Je((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=Je(s().toString(36),4),A=e(),C=o()+o();return m+f+T+A+C}return a.fingerprint=e,a.isCuid=zr,a}var Mp=ni(ri);var Zs=Mp;var za=$e(qa());u();l();c();p();d();Be();u();l();c();p();d();var Ba="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var xd=128,Ge,xt;function Ed(e){!Ge||Ge.length<e?(Ge=g.allocUnsafe(e*xd),Nt.getRandomValues(Ge),xt=0):xt+e>Ge.length&&(Nt.getRandomValues(Ge),xt=0),xt+=e}function di(e=21){Ed(e|=0);let t="";for(let r=xt-e;r<xt;r++)t+=Ba[Ge[r]&63];return t}u();l();c();p();d();Be();var Qa="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Xt=32;var Pd=16,Ja=10,ja=0xffffffffffff;var ze;(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"})(ze||(ze={}));var We=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Td(e){let t=Math.floor(e()*Xt);return t===Xt&&(t=Xt-1),Qa.charAt(t)}function Ad(e){let t=Sd(),r=t&&(t.crypto||t.msCrypto)||(typeof rt<"u"?rt: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(rt?.randomBytes)return()=>rt.randomBytes(1).readUInt8()/255;throw new We(ze.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Sd(){return Rd()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function vd(e,t){let r="";for(;e>0;e--)r=Td(t)+r;return r}function Cd(e,t=Ja){if(isNaN(e))throw new We(ze.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>ja)throw new We(ze.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ja}: ${e}`);if(e<0)throw new We(ze.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new We(ze.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Xt,n=Qa.charAt(r)+n,e=(e-r)/Xt;return n}function Rd(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Ha(e,t){let r=t||Ad(),n=!e||isNaN(e)?Date.now():e;return Cd(n,Ja)+vd(Pd,r)}u();l();c();p();d();u();l();c();p();d();var Z=[];for(let e=0;e<256;++e)Z.push((e+256).toString(16).slice(1));function Yr(e,t=0){return(Z[e[t+0]]+Z[e[t+1]]+Z[e[t+2]]+Z[e[t+3]]+"-"+Z[e[t+4]]+Z[e[t+5]]+"-"+Z[e[t+6]]+Z[e[t+7]]+"-"+Z[e[t+8]]+Z[e[t+9]]+"-"+Z[e[t+10]]+Z[e[t+11]]+Z[e[t+12]]+Z[e[t+13]]+Z[e[t+14]]+Z[e[t+15]]).toLowerCase()}u();l();c();p();d();Be();var en=new Uint8Array(256),Xr=en.length;function Et(){return Xr>en.length-16&&(br(en),Xr=0),en.slice(Xr,Xr+=16)}u();l();c();p();d();u();l();c();p();d();Be();var mi={randomUUID:wr};function Id(e,t,r){if(mi.randomUUID&&!t&&!e)return mi.randomUUID();e=e||{};let n=e.random??e.rng?.()??Et();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 Yr(n)}var fi=Id;u();l();c();p();d();var gi={};function kd(e,t,r){let n;if(e)n=Ga(e.random??e.rng?.()??Et(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=Et();Od(gi,i,o),n=Ga(o,gi.msecs,gi.seq,t,r)}return t??Yr(n)}function Od(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Ga(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var yi=kd;var tn=class{#e={};constructor(){this.register("uuid",new wi),this.register("cuid",new bi),this.register("ulid",new xi),this.register("nanoid",new Ei),this.register("product",new Pi)}snapshot(){return Object.create(this.#e,{now:{value:new hi}})}register(t,r){this.#e[t]=r}},hi=class{#e=new Date;generate(){return this.#e.toISOString()}},wi=class{generate(t){if(t===4)return fi();if(t===7)return yi();throw new Error("Invalid UUID generator arguments")}},bi=class{generate(t){if(t===1)return Zs();if(t===2)return(0,za.createId)();throw new Error("Invalid CUID generator arguments")}},xi=class{generate(){return Ha()}},Ei=class{generate(t){if(typeof t=="number")return di(t);if(t===void 0)return di();throw new Error("Invalid Nanoid generator arguments")}},Pi=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 rn(e,t){return e==null?e:typeof e=="string"?rn(JSON.parse(e),t):Array.isArray(e)?Dd(e,t):Nd(e,t)}function Nd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!yt(e,i))return null}return Ka(e,t.nested)}function Ka(e,t){for(let[r,n]of Object.entries(t))e[r]=rn(e[r],n);return e}function Dd(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=Md(e,r)}return t.pagination&&(e=Ld(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>Ka(r,t.nested))}function Md(e,t){let r=new Set,n=[];for(let i of e){let o=Pt(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function Ld(e,t,r){if(r===null)return Wa(e,t);let n=new Map;for(let o of e){let s=Pt(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])=>Wa(o,t))}function Wa(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>yt(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 Pt(e,t){return JSON.stringify(t.map(r=>e[r]))}u();l();c();p();d();u();l();c();p();d();function Ti(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function Ai(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Ci(e,t,r,n){let i=e.args.map(o=>pe(o,t,r));switch(e.type){case"rawSql":return[$d(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?Vd(e.fragments,i,n):[i]).map(s=>{if(n!==void 0&&s.length>n)throw new K("The query parameter limit supported by your database is exceeded.","P2029");return _d(e.fragments,e.placeholderFormat,s,e.argTypes)});default:M(e.type,"Invalid query type")}}function pe(e,t,r){for(;Ud(e);)if(Ti(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(Ai(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=>pe(s,t,r)))}else M(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>pe(n,t,r))),e}function _d(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of vi(e,r,n)){if(i+=Fd(m,t,o),m.type==="stringChunk")continue;let f=s.length,T=s.push(...Za(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 Fd(e,t,r){let n=e.type;switch(n){case"parameter":return Si(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>Si(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Si(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:M(n,"Invalid fragment type")}}function Si(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function $d(e,t,r){return{sql:e,args:t,argTypes:r}}function Ud(e){return Ti(e)||Ai(e)}function*vi(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*Za(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 Vd(e,t,r){let n=0,i=0;for(let s of vi(e,t,void 0)){let a=0;for(let m of Za(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of vi(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=qd(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 qd(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 Ya(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function Xa(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>Bd(t)),rows:e.rows.map(t=>t.map((r,n)=>er(r,e.columnTypes[n])))}}function er(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=>er(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=>er(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=>er(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=>er(r,k.Boolean));default:return e}}function Bd(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:M(e,`Unexpected column type: ${e}`)}}u();l();c();p();d();function eu(e,t,r){if(!t.every(n=>Ri(e,n))){let n=jd(e,r),i=Qd(r);throw new K(n,i,r.context)}}function Ri(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:M(t,`Unknown rule type: ${t.type}`)}}function jd(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:M(t,`Unknown error identifier: ${t}`)}}function Qd(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:M(e,`Unknown error identifier: ${e}`)}}var tr=class e{#e;#t=new tn;#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:Ya,rawSerializer:Xa,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let{value:n}=await this.interpretNode(t,{...r,generators:this.#t.snapshot()}).catch(i=>ht(i));return n}async interpretNode(t,r){switch(t.type){case"value":return{value:pe(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(!tu(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(Ii(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)=>Ee(i)+Ee(o)):0}}case"execute":{let n=Ci(t.args,r.scope,r.generators,this.#a()),i=0;for(let o of n){let s=ru(o,r.sqlCommenter);i+=await this.#l(s,r.queryable,()=>r.queryable.executeRaw(s).catch(a=>t.args.type==="rawSql"?Xn(a):ht(a)))}return{value:i}}case"query":{let n=Ci(t.args,r.scope,r.generators,this.#a()),i;for(let o of n){let s=ru(o,r.sqlCommenter),a=await this.#l(s,r.queryable,()=>r.queryable.queryRaw(s).catch(m=>t.args.type==="rawSql"?Xn(m):ht(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(tu(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:nu(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:Jd(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:Js(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return eu(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Ri(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?Pt(nn(a),t.args.fields):null,s=new Set(Ii(i).map(o));return{value:Ii(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:rn(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]=Hd(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?{}:nn(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=Gd(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:M(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:M(this.#o,`Unexpected provider: ${this.#o}`)}}#l(t,r,n){return Gr({query:t,execute:n,provider:this.#o??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function tu(e){return Array.isArray(e)?e.length===0:e==null}function Ii(e){return Array.isArray(e)?e:[e]}function Ee(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function nn(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function nu(e,t){return Array.isArray(e)?e.map(r=>nu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function Jd(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=nn(a),f=Pt(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=Pt(nn(a),o);for(let f of s[m]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Hd(e,t,r,n){switch(e.type){case"value":return pe(e.value,r,n);case"lastInsertId":return t;default:M(e,`Unexpected field initializer type: ${e.type}`)}}function Gd(e,t,r,n){switch(e.type){case"set":return pe(e.value,r,n);case"add":return Ee(t)+Ee(pe(e.value,r,n));case"subtract":return Ee(t)-Ee(pe(e.value,r,n));case"multiply":return Ee(t)*Ee(pe(e.value,r,n));case"divide":{let i=Ee(t),o=Ee(pe(e.value,r,n));return o===0?null:i/o}default:M(e,`Unexpected field operation type: ${e.type}`)}}function ru(e,t){if(!t||t.plugins.length===0)return e;let r=Hs(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:Gs(e.sql,r)}:e}u();l();c();p();d();u();l();c();p();d();async function zd(){return globalThis.crypto??await Promise.resolve().then(()=>(Be(),On))}async function iu(){return(await zd()).randomUUID()}u();l();c();p();d();async function ou(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}u();l();c();p();d();var ue=class extends K{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},rr=class extends ue{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.")}},on=class extends ue{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},sn=class extends ue{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},an=class extends ue{constructor(){super("Unable to start a transaction in the given time.")}},un=class extends ue{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})}},Tt=class extends ue{constructor(t){super(`Internal Consistency Error: ${t}`)}},ln=class extends ue{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Wd=100,At=ee("prisma:client:transactionManager"),Kd=()=>({sql:"COMMIT",args:[],argTypes:[]}),Zd=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Yd=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),Xd=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),nr=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 iu(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=su(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(ht);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),ou(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=>At("error in discarded transaction:",s)),await this.#o(r,"timed_out"),new an;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 Tt(`Transaction in invalid state ${r.status} although it just finished startup.`);default:M(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 rr;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(At("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new Tt("Active transaction found in closed transactions list.");case"committed":throw new on(r);case"rolled_back":throw new sn(r);case"timed_out":throw new un(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw At("Transaction not found.",t),new rr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new Tt("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=su(async()=>{At("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"):At("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#o(t,r){let n=async()=>{At("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#a(Yd(),t.transaction,()=>t.transaction.commit());else{let i=Kd();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(Xd(),t.transaction,()=>t.transaction.rollback());else{let i=Zd();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>Wd&&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 ue("timeout is required");if(!t.maxWait)throw new ue("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new ln(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#a(t,r,n){return Gr({query:t,execute:n,provider:this.#t??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#e})}};function su(e,t){return t!==void 0?setTimeout(e,t):void 0}import{PrismaClientInitializationError as Li,PrismaClientKnownRequestError as _i,PrismaClientRustPanicError as or,PrismaClientUnknownRequestError as _u}from"@prisma/client-runtime-utils";u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function au(e){return new ki(e).deserialize()}function em(e){return g.from(e,"base64url")}var ki=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=em(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 ir=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=au(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]}},Pe={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},Y={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Te(e,t){return(e.flags&t)!==0}function _e(e){return e.scalarMask}var cn="7.4.0-integration-parameterization.19";u();l();c();p();d();var uu={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function cu(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=>pu(i)),n=t.map(i=>rm(i));return{args:r,argTypes:n}}function pu(e){if(Array.isArray(e))return e.map(t=>pu(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 rm(e){return Array.isArray(e)?{scalarType:e.length>0?lu(e[0]):"unknown",arity:"list"}:{scalarType:lu(e),arity:"scalar"}}function lu(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in uu?uu[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}u();l();c();p();d();function du(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 mu(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}u();l();c();p();d();function fu(e){return e.split(`
6
+ `)}};function dt(e){return new Un(Yo(e))}function Yo(e){let t=new lt;for(let[r,n]of Object.entries(e)){let i=new Nr(r,Xo(n));t.addField(i)}return t}function Xo(e){if(typeof e=="string")return new W(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new W(String(e));if(typeof e=="bigint")return new W(`${e}n`);if(e===null)return new W("null");if(e===void 0)return new W("undefined");if(ot(e))return new W(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return g.isBuffer(e)?new W(`Buffer.alloc(${e.byteLength})`):new W(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Ar(e)?e.toISOString():"Invalid Date";return new W(`new Date("${t}")`)}return e instanceof Tc?new W(`Prisma.${e._getName()}`):pt(e)?new W(`prisma.${ke(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Ac(e):typeof e=="object"?Yo(e):new W(Object.prototype.toString.call(e))}function Ac(e){let t=new ut;for(let r of e)t.addItem(Xo(r));return t}function Dr(e,t){let r=t==="pretty"?Qo:kr,n=e.renderAllMessages(r),i=new st(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Mr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=dt(e);for(let A of t)Cr(A,a,s);let{message:m,args:f}=Dr(a,r),T=vr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new Sc(T,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function we(e){return e.replace(/^./,t=>t.toLowerCase())}u();l();c();p();d();function ts(e,t,r){let n=we(r);return!t.result||!(t.result.$allModels||t.result[n])?e:vc({...e,...es(t.name,e,t.result.$allModels),...es(t.name,e,t.result[n])})}function vc(e){let t=new ye,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Tr(e,n=>({...n,needs:r(n.name,new Set)}))}function es(e,t,r){return r?Tr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Cc(t,o,i)})):{}}function Cc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function rs(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 ns(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var Lr=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new ye;modelExtensionsCache=new ye;queryCallbacksCache=new ye;clientExtensions=Rt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Rt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>ts(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=we(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()}},mt=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new Lr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Lr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};u();l();c();p();d();var _r=class{constructor(t){this.name=t}};function is(e){return e instanceof _r}function Rc(e){return new _r(e)}u();l();c();p();d();u();l();c();p();d();var os=Symbol(),Vt=class{constructor(t){if(t!==os)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Vn:t}},Vn=new Vt(os);function be(e){return e instanceof Vt}var Dc={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"},ss="explicitly `undefined` values are not allowed";function Bn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=mt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:f,globalOmit:T,wrapRawValues:A}){let C=new qn({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:Dc[t],query:qt(r,C)}}function qt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:us(r,n),selection:Mc(e,t,i,n)}}function Mc(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()}),$c(e,n)):Lc(n,t,r)}function Lc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&_c(n,t,e),Fc(n,r,e),n}function _c(e,t,r){for(let[n,i]of Object.entries(t)){if(be(i))continue;let o=r.nestSelection(n);if(jn(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]=qt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=qt(i,o)}}function Fc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=ns(i,n);for(let[s,a]of Object.entries(o)){if(be(a))continue;jn(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(e[s]=!a)}}function $c(e,t){let r={},n=t.getComputedFields(),i=rs(e,n);for(let[o,s]of Object.entries(i)){if(be(s))continue;let a=t.nestSelection(o);jn(s,a);let m=t.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||be(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=qt({},a):r[o]=!0;continue}r[o]=qt(s,a)}}return r}function as(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(it(e)){if(Ar(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(is(e))return{$type:"Param",value:e.name};if(pt(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Uc(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(Vc(e))return e.values;if(ot(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Nc){if(!kc(e)&&!Oc(e)&&!Ic(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(qc(e))return e.toJSON();if(typeof e=="object")return us(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 us(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);be(i)||(i!==void 0?r[n]=as(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:ss}))}return r}function Uc(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||be(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(as(o,i))}return r}function Vc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function qc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function jn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:ss})}var qn=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){Mr({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?.[ke(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:Se(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};u();l();c();p();d();function Bc(e,t){let r=Rt(()=>jc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function jc(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function Qn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}u();l();c();p();d();var Jn=new WeakMap,Fr="$$PrismaTypedSql",Bt=class{constructor(t,r){Jn.set(this,{sql:t,values:r}),Object.defineProperty(this,Fr,{value:Fr})}get sql(){return Jn.get(this).sql}get values(){return Jn.get(this).values}};function Qc(e){return(...t)=>new Bt(e,t)}function $r(e){return e!=null&&e[Fr]===Fr}u();l();c();p();d();import{Sql as Vm}from"@prisma/client-runtime-utils";u();l();c();p();d();ls();u();l();c();p();d();u();l();c();p();d();function jt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}u();l();c();p();d();function te(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}u();l();c();p();d();function je(e){let t=new ye;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 Vr={enumerable:!0,configurable:!0,writable:!0};function qr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Vr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var cs=Symbol.for("nodejs.util.inspect.custom");function ce(e,t){let r=Jc(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=ps(Reflect.ownKeys(o),r),a=ps(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?{...Vr,...m?.getPropertyDescriptor(s)}:Vr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[cs]=function(){let o={...this};return delete o[cs],o},i}function Jc(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 ps(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}u();l();c();p();d();function ft(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function ds(e){if(e===void 0)return"";let t=dt(e);return new st(0,{colors:kr}).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 Hn=class{getLocation(){return null}};function Ne(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Hn}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var ms={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function gt(e={}){let t=Gc(e);return Object.entries(t).reduce((n,[i,o])=>(ms[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Gc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Br(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function fs(e,t){let r=Br(e);return t({action:"aggregate",unpacker:r,argsMapper:gt})(e)}u();l();c();p();d();function zc(e={}){let{select:t,...r}=e;return typeof t=="object"?gt({...r,_count:t}):gt({...r,_count:{_all:!0}})}function Wc(e={}){return typeof e.select=="object"?t=>Br(e)(t)._count:t=>Br(e)(t)._count._all}function gs(e,t){return t({action:"count",unpacker:Wc(e),argsMapper:zc})(e)}u();l();c();p();d();function Kc(e={}){let t=gt(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 Zc(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ys(e,t){return t({action:"groupBy",unpacker:Zc(e),argsMapper:Kc})(e)}function hs(e,t,r){if(t==="aggregate")return n=>fs(n,r);if(t==="count")return n=>gs(n,r);if(t==="groupBy")return n=>ys(n,r)}u();l();c();p();d();function ws(e,t){let r=t.fields.filter(i=>!i.relationName),n=co(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 Ut(e,o,s.type,s.isList,s.kind==="enum")},...qr(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var bs=e=>Array.isArray(e)?e:e.split("."),Gn=(e,t)=>bs(t).reduce((r,n)=>r&&r[n],e),xs=(e,t,r)=>bs(t).reduceRight((n,i,o,s)=>Object.assign({},Gn(e,s.slice(0,o)),{[i]:n}),r);function Yc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function Xc(e,t,r){return t===void 0?e??{}:xs(t,r,e||!0)}function zn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((m,f)=>({...m,[f.name]:f}),{});return m=>{let f=Ne(e._errorFormat),T=Yc(n,i),A=Xc(m,o,T),C=r({dataPath:T,callsite:f})(A),S=ep(e,t);return new Proxy(C,{get(D,R){if(!S.includes(R))return D[R];let X=[a[R].type,r,R],j=[T,A];return zn(e,...X,...j)},...qr([...S,...Object.getOwnPropertyNames(C)])})}}function ep(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var tp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],rp=["aggregate","count","groupBy"];function Wn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[np(e,t),op(e,t),jt(r),te("name",()=>t),te("$name",()=>t),te("$parent",()=>e._appliedParent)];return ce({},n)}function np(e,t){let r=we(t),n=Object.keys(_t).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let f=Ne(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 tp.includes(o)?zn(e,t,s):ip(i)?hs(e,i,s):s({})}}}function ip(e){return rp.includes(e)}function op(e,t){return je(te("fields",()=>{let r=e._runtimeDataModel.models[t];return ws(t,r)}))}u();l();c();p();d();function Es(e){return e.replace(/^./,t=>t.toUpperCase())}var Kn=Symbol();function Qt(e){let t=[sp(e),ap(e),te(Kn,()=>e),te("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(jt(r)),ce(e,t)}function sp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function ap(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(we),n=[...new Set(t.concat(r))];return je({getKeys(){return n},getPropertyValue(i){let o=Es(i);if(e._runtimeDataModel.models[o]!==void 0)return Wn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Wn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Ps(e){return e[Kn]?e[Kn]:e}function Ts(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 Qt(t)}u();l();c();p();d();u();l();c();p();d();function As({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(ft(f))}else if(r){if(!r[m.name])continue;let f=m.needs.filter(T=>!r[T]);f.length>0&&a.push(ft(f))}up(e,m.needs)&&s.push(lp(m,ce(e,s)))}return s.length>0||a.length>0?ce(e,[...s,...a]):e}function up(e,t){return t.every(r=>Ln(e,r))}function lp(e,t){return je(te(e.name,()=>e.compute(t)))}u();l();c();p();d();function jr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=jr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Ss({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Ss({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Ss({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||be(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]=jr({visitor:i,result:t[o],args:f,modelName:m.type,runtimeDataModel:n})}}function vs({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:jr({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,m,f)=>{let T=we(m);return As({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();import{Decimal as pp,ObjectEnumValue as dp,Sql as Rs}from"@prisma/client-runtime-utils";u();l();c();p();d();var cp=["$connect","$disconnect","$on","$transaction","$extends"],Cs=cp;function Is(e){if(e instanceof Rs)return mp(e);if($r(e))return fp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Jt(e[n]);return r}let t={};for(let r in e)t[r]=Jt(e[r]);return t}function mp(e){return new Rs(e.strings,e.values)}function fp(e){return new Bt(e.sql,e.values)}function Jt(e){if(typeof e!="object"||e==null||e instanceof dp||pt(e))return e;if(ot(e))return new pp(e.toFixed());if(it(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]=Jt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Jt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Jt(e[r]);return t}Se(e,"Unknown value")}function Os(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:Is(t.args??{}),__internalParams:t,query:(s,a=t)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=Ls(o,m),a.args=s,Os(e,a,r,n+1)}})})}function Ns(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 Os(e,t,s)}function Ds(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Ms(r,n,0,e):e(r)}}function Ms(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=Ls(i,m),Ms(a,t,r+1,n)}})}var ks=e=>e;function Ls(e=ks,t=ks){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();import{Decimal as gp}from"@prisma/client-runtime-utils";u();l();c();p();d();import{Decimal as Qr}from"@prisma/client-runtime-utils";function M(e,t){throw new Error(t)}function Zn(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=>Zn(e[r],t[r]))}function yt(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(Qr.isDecimal(e[o])||Qr.isDecimal(t[o])){let s=_s(e[o]),a=_s(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Fs(e[o]),a=Fs(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return $s(e[o])?.getTime()===$s(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Us(e[o])===Us(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Vs(e[o])===Vs(t[o])}return Zn(e[o],t[o])})}function _s(e){return Qr.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new Qr(e):void 0}function Fs(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 $s(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Us(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Vs(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Ht(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 yp(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function hp(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function Qe(e){return e===null?e:Array.isArray(e)?e.map(Qe):typeof e=="object"?yp(e)?wp(e):e.constructor!==null&&e.constructor.name!=="Object"?e:hp(e,Qe):e}function wp({$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 gp(t);case"Json":return JSON.parse(t);default:M(t,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Jr(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 K=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function ht(e){if(!Jr(e))throw e;let t=bp(e),r=qs(e);throw!t||!r?e:new K(r,t,{driverAdapterError:e})}function Xn(e){throw Jr(e)?new K(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??qs(e)}\``,"P2010",{driverAdapterError:e}):e}function bp(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:M(e.cause,`Unknown error: ${e.cause}`)}}function qs(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 ${Yn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Yn(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 ${Yn(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:M(e.cause,`Unknown error: ${e.cause}`)}}function Yn(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 xp(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 Ep(e){return"prisma__type"in e?e.prisma__value?.name:e.value.name}function Pp(e,t){let r={};for(let[n,i]of Object.entries(e))if(r[n]=i,xp(i)){let o=Ep(i);o&&o in t&&(r[n]=t[o])}return r}function Bs(e,t,r={}){let n=e.map(o=>t.keys.reduce((s,a)=>(s[a]=Qe(o[a]),s),{})),i=new Set(t.nestedSelection);return t.arguments.map(o=>{let s=Pp(o,r),a=n.findIndex(m=>yt(m,s));if(a===-1)return t.expectNonEmpty?new K("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(e[a]).filter(([f])=>i.has(f));return Object.fromEntries(m)}})}u();l();c();p();d();import{Decimal as Tp}from"@prisma/client-runtime-utils";var U=class extends K{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},js=new WeakMap;function Ap(e){let t=js.get(e);return t||(t=Object.entries(e),js.set(e,t)),t}function Js(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new U(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return ti(e,t.fields,r,t.skipNulls);case"field":return ei(e,"<result>",t.fieldType,r);default:M(t,`Invalid data mapping type: '${t.type}'`)}}function ti(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=>Qs(o,t,r))}if(typeof e=="object")return Qs(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new U("Expected an array or object, got a string that is not valid JSON",{cause:o})}return ti(i,t,r,n)}throw new U(`Expected an array or an object, got: ${typeof e}`)}function Qs(e,t,r){if(typeof e!="object")throw new U(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Ap(t))switch(o.type){case"affectedRows":throw new U(`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 U(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=ti(f,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=Sp(e[s],s,o.fieldType,r);else throw new U(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:M(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Sp(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>ei(o,`${t}[${s}]`,r,n)):ei(e,t,r,n)}function ei(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new U(`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 U(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new U(`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 U(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new U(`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 U(`Expected a float in column '${t}', got string: ${e}`);return i}throw new U(`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 U(`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 U(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Tp.isDecimal(e))throw new U(`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:Cp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new U(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Ht(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new U(`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 U(`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 U(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:M(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new U(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new U(`Value '${e}' not found in enum '${r.name}'`);return o}default:M(r,`DataMapper: Unknown result type: ${r.type}`)}}var vp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Cp(e){let t=vp.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 xe(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]=xe(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:xe(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=xe(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=xe(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(xe(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(xe(o),xe(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(xe(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function Rp(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 Hr(e,t){let r={};for(let n of e){let i=n(xe(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function Hs(e,t){let r=Hr(e,t);return Rp(r)}function Gs(e,t){return t?`${e} ${t}`:e}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Gt;(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"})(Gt||(Gt={}));function Ip(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:M(e,`Unknown provider: ${e}`)}}async function Gr({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:Gt.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Ip(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function Je(e,t){var r="000000000"+e;return r.substr(r.length-t)}var zs=$e(vo(),1);function kp(){try{return zs.default.hostname()}catch{return y.env._CLUSTER_NETWORK_NAME_||y.env.COMPUTERNAME||"hostname"}}var Ws=2,Op=Je(y.pid.toString(36),Ws),Ks=kp(),Np=Ks.length,Dp=Je(Ks.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Np+36).toString(36),Ws);function ri(){return Op+Dp}u();l();c();p();d();u();l();c();p();d();function zr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function ni(e){let n=Math.pow(36,4),i=0;function o(){return Je((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=Je(s().toString(36),4),A=e(),C=o()+o();return m+f+T+A+C}return a.fingerprint=e,a.isCuid=zr,a}var Mp=ni(ri);var Zs=Mp;var za=$e(qa());u();l();c();p();d();Be();u();l();c();p();d();var Ba="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var xd=128,Ge,xt;function Ed(e){!Ge||Ge.length<e?(Ge=g.allocUnsafe(e*xd),Nt.getRandomValues(Ge),xt=0):xt+e>Ge.length&&(Nt.getRandomValues(Ge),xt=0),xt+=e}function di(e=21){Ed(e|=0);let t="";for(let r=xt-e;r<xt;r++)t+=Ba[Ge[r]&63];return t}u();l();c();p();d();Be();var Qa="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Xt=32;var Pd=16,Ja=10,ja=0xffffffffffff;var ze;(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"})(ze||(ze={}));var We=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Td(e){let t=Math.floor(e()*Xt);return t===Xt&&(t=Xt-1),Qa.charAt(t)}function Ad(e){let t=Sd(),r=t&&(t.crypto||t.msCrypto)||(typeof rt<"u"?rt: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(rt?.randomBytes)return()=>rt.randomBytes(1).readUInt8()/255;throw new We(ze.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Sd(){return Rd()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function vd(e,t){let r="";for(;e>0;e--)r=Td(t)+r;return r}function Cd(e,t=Ja){if(isNaN(e))throw new We(ze.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>ja)throw new We(ze.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ja}: ${e}`);if(e<0)throw new We(ze.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new We(ze.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Xt,n=Qa.charAt(r)+n,e=(e-r)/Xt;return n}function Rd(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Ha(e,t){let r=t||Ad(),n=!e||isNaN(e)?Date.now():e;return Cd(n,Ja)+vd(Pd,r)}u();l();c();p();d();u();l();c();p();d();var Z=[];for(let e=0;e<256;++e)Z.push((e+256).toString(16).slice(1));function Yr(e,t=0){return(Z[e[t+0]]+Z[e[t+1]]+Z[e[t+2]]+Z[e[t+3]]+"-"+Z[e[t+4]]+Z[e[t+5]]+"-"+Z[e[t+6]]+Z[e[t+7]]+"-"+Z[e[t+8]]+Z[e[t+9]]+"-"+Z[e[t+10]]+Z[e[t+11]]+Z[e[t+12]]+Z[e[t+13]]+Z[e[t+14]]+Z[e[t+15]]).toLowerCase()}u();l();c();p();d();Be();var en=new Uint8Array(256),Xr=en.length;function Et(){return Xr>en.length-16&&(br(en),Xr=0),en.slice(Xr,Xr+=16)}u();l();c();p();d();u();l();c();p();d();Be();var mi={randomUUID:wr};function Id(e,t,r){if(mi.randomUUID&&!t&&!e)return mi.randomUUID();e=e||{};let n=e.random??e.rng?.()??Et();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 Yr(n)}var fi=Id;u();l();c();p();d();var gi={};function kd(e,t,r){let n;if(e)n=Ga(e.random??e.rng?.()??Et(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=Et();Od(gi,i,o),n=Ga(o,gi.msecs,gi.seq,t,r)}return t??Yr(n)}function Od(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Ga(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var yi=kd;var tn=class{#e={};constructor(){this.register("uuid",new wi),this.register("cuid",new bi),this.register("ulid",new xi),this.register("nanoid",new Ei),this.register("product",new Pi)}snapshot(){return Object.create(this.#e,{now:{value:new hi}})}register(t,r){this.#e[t]=r}},hi=class{#e=new Date;generate(){return this.#e.toISOString()}},wi=class{generate(t){if(t===4)return fi();if(t===7)return yi();throw new Error("Invalid UUID generator arguments")}},bi=class{generate(t){if(t===1)return Zs();if(t===2)return(0,za.createId)();throw new Error("Invalid CUID generator arguments")}},xi=class{generate(){return Ha()}},Ei=class{generate(t){if(typeof t=="number")return di(t);if(t===void 0)return di();throw new Error("Invalid Nanoid generator arguments")}},Pi=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 rn(e,t){return e==null?e:typeof e=="string"?rn(JSON.parse(e),t):Array.isArray(e)?Dd(e,t):Nd(e,t)}function Nd(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!yt(e,i))return null}return Ka(e,t.nested)}function Ka(e,t){for(let[r,n]of Object.entries(t))e[r]=rn(e[r],n);return e}function Dd(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=Md(e,r)}return t.pagination&&(e=Ld(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>Ka(r,t.nested))}function Md(e,t){let r=new Set,n=[];for(let i of e){let o=Pt(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function Ld(e,t,r){if(r===null)return Wa(e,t);let n=new Map;for(let o of e){let s=Pt(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])=>Wa(o,t))}function Wa(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>yt(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 Pt(e,t){return JSON.stringify(t.map(r=>e[r]))}u();l();c();p();d();u();l();c();p();d();function Ti(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function Ai(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function Ci(e,t,r,n){let i=e.args.map(o=>pe(o,t,r));switch(e.type){case"rawSql":return[$d(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?Vd(e.fragments,i,n):[i]).map(s=>{if(n!==void 0&&s.length>n)throw new K("The query parameter limit supported by your database is exceeded.","P2029");return _d(e.fragments,e.placeholderFormat,s,e.argTypes)});default:M(e.type,"Invalid query type")}}function pe(e,t,r){for(;Ud(e);)if(Ti(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(Ai(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=>pe(s,t,r)))}else M(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>pe(n,t,r))),e}function _d(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of vi(e,r,n)){if(i+=Fd(m,t,o),m.type==="stringChunk")continue;let f=s.length,T=s.push(...Za(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 Fd(e,t,r){let n=e.type;switch(n){case"parameter":return Si(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>Si(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>Si(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:M(n,"Invalid fragment type")}}function Si(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function $d(e,t,r){return{sql:e,args:t,argTypes:r}}function Ud(e){return Ti(e)||Ai(e)}function*vi(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*Za(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 Vd(e,t,r){let n=0,i=0;for(let s of vi(e,t,void 0)){let a=0;for(let m of Za(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of vi(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=qd(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 qd(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 Ya(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function Xa(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>Bd(t)),rows:e.rows.map(t=>t.map((r,n)=>er(r,e.columnTypes[n])))}}function er(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=>er(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=>er(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=>er(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=>er(r,k.Boolean));default:return e}}function Bd(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:M(e,`Unexpected column type: ${e}`)}}u();l();c();p();d();function eu(e,t,r){if(!t.every(n=>Ri(e,n))){let n=jd(e,r),i=Qd(r);throw new K(n,i,r.context)}}function Ri(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:M(t,`Unknown rule type: ${t.type}`)}}function jd(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:M(t,`Unknown error identifier: ${t}`)}}function Qd(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:M(e,`Unknown error identifier: ${e}`)}}var tr=class e{#e;#t=new tn;#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:Ya,rawSerializer:Xa,provider:t.provider,connectionInfo:t.connectionInfo})}async run(t,r){let{value:n}=await this.interpretNode(t,{...r,generators:this.#t.snapshot()}).catch(i=>ht(i));return n}async interpretNode(t,r){switch(t.type){case"value":return{value:pe(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(!tu(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(Ii(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)=>Ee(i)+Ee(o)):0}}case"execute":{let n=Ci(t.args,r.scope,r.generators,this.#a()),i=0;for(let o of n){let s=ru(o,r.sqlCommenter);i+=await this.#l(s,r.queryable,()=>r.queryable.executeRaw(s).catch(a=>t.args.type==="rawSql"?Xn(a):ht(a)))}return{value:i}}case"query":{let n=Ci(t.args,r.scope,r.generators,this.#a()),i;for(let o of n){let s=ru(o,r.sqlCommenter),a=await this.#l(s,r.queryable,()=>r.queryable.queryRaw(s).catch(m=>t.args.type==="rawSql"?Xn(m):ht(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(tu(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:nu(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:Jd(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:Js(n,t.args.structure,t.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return eu(n,t.args.rules,t.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(t.args.value,r);return Ri(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?Pt(nn(a),t.args.fields):null,s=new Set(Ii(i).map(o));return{value:Ii(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(t.args.expr,r);return{value:rn(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]=Hd(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?{}:nn(n);for(let[s,a]of Object.entries(t.args.fields))o[s]=Gd(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:M(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:M(this.#o,`Unexpected provider: ${this.#o}`)}}#l(t,r,n){return Gr({query:t,execute:n,provider:this.#o??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function tu(e){return Array.isArray(e)?e.length===0:e==null}function Ii(e){return Array.isArray(e)?e:[e]}function Ee(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function nn(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function nu(e,t){return Array.isArray(e)?e.map(r=>nu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function Jd(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=nn(a),f=Pt(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=Pt(nn(a),o);for(let f of s[m]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Hd(e,t,r,n){switch(e.type){case"value":return pe(e.value,r,n);case"lastInsertId":return t;default:M(e,`Unexpected field initializer type: ${e.type}`)}}function Gd(e,t,r,n){switch(e.type){case"set":return pe(e.value,r,n);case"add":return Ee(t)+Ee(pe(e.value,r,n));case"subtract":return Ee(t)-Ee(pe(e.value,r,n));case"multiply":return Ee(t)*Ee(pe(e.value,r,n));case"divide":{let i=Ee(t),o=Ee(pe(e.value,r,n));return o===0?null:i/o}default:M(e,`Unexpected field operation type: ${e.type}`)}}function ru(e,t){if(!t||t.plugins.length===0)return e;let r=Hs(t.plugins,{query:t.queryInfo,sql:e.sql});return r?{...e,sql:Gs(e.sql,r)}:e}u();l();c();p();d();u();l();c();p();d();async function zd(){return globalThis.crypto??await Promise.resolve().then(()=>(Be(),On))}async function iu(){return(await zd()).randomUUID()}u();l();c();p();d();async function ou(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}u();l();c();p();d();var ue=class extends K{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},rr=class extends ue{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.")}},on=class extends ue{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},sn=class extends ue{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},an=class extends ue{constructor(){super("Unable to start a transaction in the given time.")}},un=class extends ue{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})}},Tt=class extends ue{constructor(t){super(`Internal Consistency Error: ${t}`)}},ln=class extends ue{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Wd=100,At=ee("prisma:client:transactionManager"),Kd=()=>({sql:"COMMIT",args:[],argTypes:[]}),Zd=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Yd=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),Xd=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),nr=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 iu(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=su(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(ht);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),ou(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=>At("error in discarded transaction:",s)),await this.#o(r,"timed_out"),new an;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 Tt(`Transaction in invalid state ${r.status} although it just finished startup.`);default:M(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 rr;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(At("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new Tt("Active transaction found in closed transactions list.");case"committed":throw new on(r);case"rolled_back":throw new sn(r);case"timed_out":throw new un(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw At("Transaction not found.",t),new rr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new Tt("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=su(async()=>{At("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"):At("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#o(t,r){let n=async()=>{At("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#a(Yd(),t.transaction,()=>t.transaction.commit());else{let i=Kd();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(Xd(),t.transaction,()=>t.transaction.rollback());else{let i=Zd();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>Wd&&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 ue("timeout is required");if(!t.maxWait)throw new ue("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new ln(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#a(t,r,n){return Gr({query:t,execute:n,provider:this.#t??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#e})}};function su(e,t){return t!==void 0?setTimeout(e,t):void 0}import{PrismaClientInitializationError as Li,PrismaClientKnownRequestError as _i,PrismaClientRustPanicError as or,PrismaClientUnknownRequestError as _u}from"@prisma/client-runtime-utils";u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function au(e){return new ki(e).deserialize()}function em(e){return g.from(e,"base64url")}var ki=class{#e;#t;#r=0;constructor(t){this.#e=t;let r=em(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 ir=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=au(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]}},Pe={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},Y={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Te(e,t){return(e.flags&t)!==0}function _e(e){return e.scalarMask}var cn="7.4.0-integration-parameterization.21";u();l();c();p();d();var uu={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function cu(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=>pu(i)),n=t.map(i=>rm(i));return{args:r,argTypes:n}}function pu(e){if(Array.isArray(e))return e.map(t=>pu(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 rm(e){return Array.isArray(e)?{scalarType:e.length>0?lu(e[0]):"unknown",arity:"list"}:{scalarType:lu(e),arity:"scalar"}}function lu(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in uu?uu[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}u();l();c();p();d();function du(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 mu(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}u();l();c();p();d();function fu(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 gu=$e(Mo());function yu({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,gu.default)({user:t,repo:r,template:n,title:e,body:i})}function hu({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=To(6e3-(s?.length??0)),m=fu(nt(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 $i=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if($r(r))n=r.sql,i={values:St(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:St(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:St(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:St(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=ju(r),i={values:St(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?zu(`prisma.${e}(${n}, ${i.values})`):zu(`prisma.${e}(${n})`),{query:n,parameters:i}},Wu={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new bm(t,r)}},Ku={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};u();l();c();p();d();function Ui(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Zu(r(s)):Zu(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 Zu(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 Yu={name:"@prisma/instrumentation-contract",version:"7.4.0-integration-parameterization.19",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 Pm=Yu.version.split(".")[0],Tm="PRISMA_INSTRUMENTATION",Am=`V${Pm}_PRISMA_INSTRUMENTATION`,Xu=globalThis;function el(){let e=Xu[Am];return e?.helper?e.helper:Xu[Tm]?.helper}var Sm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Vi=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 el()??Sm}};function tl(){return new Vi}u();l();c();p();d();function rl(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 nl(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();import{hasBatchIndex as Im}from"@prisma/client-runtime-utils";u();l();c();p();d();function il(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(qi(e.query.arguments)),t.push(qi(e.query.selection)),t.join("")}function qi(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${qi(n)})`:r}).join(" ")})`}u();l();c();p();d();var vm={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 Bi(e){return vm[e]}u();l();c();p();d();var xn=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();import{Decimal as Cm}from"@prisma/client-runtime-utils";function Ze(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 Cm(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=>Ze("bigint",r));case"bytes-array":return t.map(r=>Ze("bytes",r));case"decimal-array":return t.map(r=>Ze("decimal",r));case"datetime-array":return t.map(r=>Ze("datetime",r));case"date-array":return t.map(r=>Ze("date",r));case"time-array":return t.map(r=>Ze("time",r));default:return t}}function ji(e){let t=[],r=Rm(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]]=Ze(e.types[s],i[s]);t.push(o)}return t}function Rm(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var km=ee("prisma:client:request_handler"),Pn=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new xn({batchLoader:Ds(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=>Bi(A.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:Om(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"?ol(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Bi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:il(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(km(t),Nm(t,i))throw t;if(t instanceof Qi&&Dm(t)){let f=sl(t.meta);Mr({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=vr({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 Qi(m,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new En(m,this.client._clientVersion);if(t instanceof Ji)throw new Ji(m,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof Ye)throw new Ye(m,this.client._clientVersion);if(t instanceof En)throw new En(m,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?nt(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=Gn(o,s),m=i==="queryRaw"?ji(a):Qe(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function Om(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:ol(e)};Se(e,"Unknown transaction kind")}}function ol(e){return{id:e.id,payload:e.payload}}function Nm(e,t){return Im(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Dm(e){return e.code==="P2009"||e.code==="P2012"}function sl(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(sl)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}u();l();c();p();d();var Hi=cn;u();l();c();p();d();var pl=$e(Fn());u();l();c();p();d();var B=class extends Error{constructor(t){super(t+`
60
+ `)}var $i=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if($r(r))n=r.sql,i={values:St(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:St(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:St(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:St(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=ju(r),i={values:St(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?zu(`prisma.${e}(${n}, ${i.values})`):zu(`prisma.${e}(${n})`),{query:n,parameters:i}},Wu={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new bm(t,r)}},Ku={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};u();l();c();p();d();function Ui(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Zu(r(s)):Zu(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 Zu(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 Yu={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 Pm=Yu.version.split(".")[0],Tm="PRISMA_INSTRUMENTATION",Am=`V${Pm}_PRISMA_INSTRUMENTATION`,Xu=globalThis;function el(){let e=Xu[Am];return e?.helper?e.helper:Xu[Tm]?.helper}var Sm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Vi=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 el()??Sm}};function tl(){return new Vi}u();l();c();p();d();function rl(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 nl(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();import{hasBatchIndex as Im}from"@prisma/client-runtime-utils";u();l();c();p();d();function il(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(qi(e.query.arguments)),t.push(qi(e.query.selection)),t.join("")}function qi(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${qi(n)})`:r}).join(" ")})`}u();l();c();p();d();var vm={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 Bi(e){return vm[e]}u();l();c();p();d();var xn=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();import{Decimal as Cm}from"@prisma/client-runtime-utils";function Ze(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 Cm(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=>Ze("bigint",r));case"bytes-array":return t.map(r=>Ze("bytes",r));case"decimal-array":return t.map(r=>Ze("decimal",r));case"datetime-array":return t.map(r=>Ze("datetime",r));case"date-array":return t.map(r=>Ze("date",r));case"time-array":return t.map(r=>Ze("time",r));default:return t}}function ji(e){let t=[],r=Rm(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]]=Ze(e.types[s],i[s]);t.push(o)}return t}function Rm(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var km=ee("prisma:client:request_handler"),Pn=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new xn({batchLoader:Ds(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=>Bi(A.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:Om(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"?ol(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Bi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:il(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(km(t),Nm(t,i))throw t;if(t instanceof Qi&&Dm(t)){let f=sl(t.meta);Mr({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=vr({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 Qi(m,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new En(m,this.client._clientVersion);if(t instanceof Ji)throw new Ji(m,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof Ye)throw new Ye(m,this.client._clientVersion);if(t instanceof En)throw new En(m,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?nt(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=Gn(o,s),m=i==="queryRaw"?ji(a):Qe(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function Om(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:ol(e)};Se(e,"Unknown transaction kind")}}function ol(e){return{id:e.id,payload:e.payload}}function Nm(e,t){return Im(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Dm(e){return e.code==="P2009"||e.code==="P2012"}function sl(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(sl)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}u();l();c();p();d();var Hi=cn;u();l();c();p();d();var pl=$e(Fn());u();l();c();p();d();var B=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"}};Lt(B,"PrismaClientConstructorValidationError");var al=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","__internal"],ul=["pretty","colorless","minimal"],ll=["info","query","warn","error"],Mm={adapter:()=>{},accelerateUrl:e=>{if(e!==void 0){if(typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "accelerateUrl" provided to PrismaClient constructor.`);if(e.trim().length===0)throw new B('"accelerateUrl" provided to PrismaClient constructor must be a non-empty string.')}},errorFormat:e=>{if(e){if(typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!ul.includes(e)){let t=ar(e,ul);throw new B(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!ll.includes(r)){let n=ar(r,ll);throw new B(`Invalid log level "${r}" provided to PrismaClient constructor.${n}`)}}for(let r of e){t(r);let n={level:t,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=ar(i,o);throw new B(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(r&&typeof r=="object")for(let[i,o]of Object.entries(r))if(n[i])n[i](o);else throw new B(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let t=e.maxWait;if(t!=null&&t<=0)throw new B(`Invalid value ${t} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let r=e.timeout;if(r!=null&&r<=0)throw new B(`Invalid value ${r} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,t)=>{if(typeof e!="object")throw new B('"omit" option is expected to be an object.');if(e===null)throw new B('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=Fm(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 B($m(e,r))},comments:e=>{if(e!==void 0){if(!Array.isArray(e))throw new B(`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 B(`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 B(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=ar(r,t);throw new B(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Lm(e){let t=e.adapter!==void 0,r=e.accelerateUrl!==void 0;if(t&&r)throw new B('The "adapter" and "accelerateUrl" options are mutually exclusive. Please provide only one of them.');if(!t&&!r)throw new B('Using engine type "client" requires either "adapter" or "accelerateUrl" to be provided to PrismaClient constructor.')}function dl(e,t){for(let[r,n]of Object.entries(e)){if(!al.includes(r)){let i=ar(r,al);throw new B(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}Mm[r](n,t)}Lm(e)}function ar(e,t){if(t.length===0||typeof e!="string")return"";let r=_m(e,t);return r?` Did you mean "${r}"?`:""}function _m(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 Fm(e,t){return cl(t.models,e)??cl(t.types,e)}function cl(e,t){let r=Object.keys(e).find(n=>ke(n)===t);if(r)return e[r]}function $m(e,t){let r=dt(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}=Dr(r,"colorless");return`Error validating "omit" option:
62
62
 
63
63
  ${i}