@prisma/client 7.3.0-dev.13 → 7.3.0-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generator-build/index.js +2 -2
- package/package.json +32 -32
- package/runtime/client.js +2 -2
- package/runtime/client.js.map +1 -1
- package/runtime/client.mjs +2 -2
- package/runtime/client.mjs.map +1 -1
- package/runtime/wasm-compiler-edge.js +2 -2
- package/runtime/wasm-compiler-edge.js.map +2 -2
- package/runtime/wasm-compiler-edge.mjs +2 -2
- package/runtime/wasm-compiler-edge.mjs.map +2 -2
- package/scripts/default-index.js +1 -1
|
@@ -3,7 +3,7 @@ var Gl=Object.create;var ar=Object.defineProperty;var Kl=Object.getOwnPropertyDe
|
|
|
3
3
|
`)}function Ou(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function Er(e){let t=e.showColors?Cu:Su,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=Ru(e),Iu(r,t)}l();u();c();p();m();var Lo=Ne(In());l();u();c();p();m();function Oo(e,t,r){let n=ko(e),i=ku(n),o=Nu(i);o?Tr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function ko(e){return e.errors.flatMap(t=>t.kind==="Union"?ko(t):[t])}function ku(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:Mu(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Mu(e,t){return[...new Set(e.concat(t))]}function Nu(e){return Rn(e,(t,r)=>{let n=Ro(t),i=Ro(r);return n!==i?n-i:Io(t)-Io(r)})}function Ro(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function Io(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}l();u();c();p();m();var ie=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)}};l();u();c();p();m();l();u();c();p();m();No();l();u();c();p();m();var tt=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}};Mo();l();u();c();p();m();l();u();c();p();m();var Pr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};l();u();c();p();m();var Ar=e=>e,vr={bold:Ar,red:Ar,green:Ar,dim:Ar,enabled:!1},Do={bold:cr,red:ze,green:oo,dim:pr,enabled:!0},rt={write(e){e.writeLine(",")}};l();u();c();p();m();var ge=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)))})}};l();u();c();p();m();var Se=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var nt=class extends Se{items=[];addItem(t){return this.items.push(new Pr(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 ge("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(rt,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var it=class e extends Se{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 nt&&(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 ge("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(rt,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};l();u();c();p();m();var G=class extends Se{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new ge(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};l();u();c();p();m();var Mt=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(rt,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Tr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Du(e,t);break;case"IncludeOnScalar":Lu(e,t);break;case"EmptySelection":_u(e,t,r);break;case"UnknownSelectionField":qu(e,t);break;case"InvalidSelectionValue":Vu(e,t);break;case"UnknownArgument":Bu(e,t);break;case"UnknownInputField":ju(e,t);break;case"RequiredArgumentMissing":Qu(e,t);break;case"InvalidArgumentType":Hu(e,t);break;case"InvalidArgumentValue":Ju(e,t);break;case"ValueTooLarge":Wu(e,t);break;case"SomeFieldsMissing":Gu(e,t);break;case"TooManyFieldsGiven":Ku(e,t);break;case"Union":Oo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function Du(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 Lu(e,t){let[r,n]=ot(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 ie(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)}. ${Nt(s)}`:a+=".",a+=`
|
|
5
5
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function _u(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){Fu(e,t,i);return}if(n.hasField("select")){Uu(e,t);return}}if(r?.[Ce(e.outputType.name)]){$u(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function Fu(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ie(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 Uu(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Uo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${Nt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function $u(e,t){let r=new Mt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ie("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=ot(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let d=a?.value.asObject()??new it;d.addSuggestion(n),a.value=d}}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 qu(e,t){let r=$o(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Uo(n,e.outputType);break;case"include":zu(n,e.outputType);break;case"omit":Zu(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(Nt(n)),i.join(" ")})}function Vu(e,t){let r=$o(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 Bu(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Yu(n,e.arguments)),t.addErrorMessage(i=>_o(i,r,e.arguments.map(o=>o.name)))}function ju(e,t){let[r,n]=ot(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&qo(o,e.inputType)}t.addErrorMessage(o=>_o(o,n,e.inputType.fields.map(s=>s.name)))}function _o(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=ec(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(Nt(e)),n.join(" ")}function Qu(e,t){let r;t.addErrorMessage(d=>r?.value instanceof G&&r.value.text==="null"?`Argument \`${d.green(o)}\` must not be ${d.red("null")}.`:`Argument \`${d.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=ot(e.argumentPath),s=new Mt,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 d of e.inputTypes[0].fields)s.addField(d.name,d.typeNames.join(" | "));a.addSuggestion(new ie(o,s).makeRequired())}else{let d=e.inputTypes.map(Fo).join(" | ");a.addSuggestion(new ie(o,d).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,d]=ot(e.dependentArgumentPath);t.addErrorMessage(f=>`Argument \`${f.green(o)}\` is required because argument \`${f.green(d)}\` was provided.`)}}}function Fo(e){return e.kind==="list"?`${Fo(e.elementType)}[]`:e.name}function Hu(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=Cr("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 Ju(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=Cr("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function Wu(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 G&&(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 Gu(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&&qo(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")} ${Cr("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(Nt(i)),o.join(" ")})}function Ku(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 ${Cr("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Uo(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ie(r.name,"true"))}function zu(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new ie(r.name,"true"))}function Zu(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new ie(r.name,"true"))}function Yu(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new ie(r.name,r.typeNames.join(" | ")))}function $o(e,t){let[r,n]=ot(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(),d=o?.getField(n);return o&&d?{parentKind:"select",parent:o,field:d,fieldName:n}:(d=s?.getField(n),s&&d?{parentKind:"include",field:d,parent:s,fieldName:n}:(d=a?.getField(n),a&&d?{parentKind:"omit",field:d,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function qo(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ie(r.name,r.typeNames.join(" | ")))}function ot(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function Nt({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function Cr(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var Xu=3;function ec(e,t){let r=1/0,n;for(let i of t){let o=(0,Lo.default)(e,i);o>Xu||o<r&&(r=o,n=i)}return n}l();u();c();p();m();import{ObjectEnumValue as tc}from"@prisma/client-runtime-utils";l();u();c();p();m();var Dt=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 st(e){return e instanceof Dt}l();u();c();p();m();var Vo=": ",Sr=class{constructor(t,r){this.name=t;this.value=r}hasError=!1;markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Vo.length}write(t){let r=new ge(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Vo).write(this.value)}};var kn=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 at(e){return new kn(Bo(e))}function Bo(e){let t=new it;for(let[r,n]of Object.entries(e)){let i=new Sr(r,jo(n));t.addField(i)}return t}function jo(e){if(typeof e=="string")return new G(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new G(String(e));if(typeof e=="bigint")return new G(`${e}n`);if(e===null)return new G("null");if(e===void 0)return new G("undefined");if(et(e))return new G(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return y.isBuffer(e)?new G(`Buffer.alloc(${e.byteLength})`):new G(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=br(e)?e.toISOString():"Invalid Date";return new G(`new Date("${t}")`)}return e instanceof tc?new G(`Prisma.${e._getName()}`):st(e)?new G(`prisma.${Ce(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?rc(e):typeof e=="object"?Bo(e):new G(Object.prototype.toString.call(e))}function rc(e){let t=new nt;for(let r of e)t.addItem(jo(r));return t}function Rr(e,t){let r=t==="pretty"?Do:vr,n=e.renderAllMessages(r),i=new tt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Ir({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=at(e);for(let A of t)Tr(A,a,s);let{message:d,args:f}=Rr(a,r),P=Er({message:d,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new nc(P,{clientVersion:o})}l();u();c();p();m();l();u();c();p();m();function ye(e){return e.replace(/^./,t=>t.toLowerCase())}l();u();c();p();m();function Ho(e,t,r){let n=ye(r);return!t.result||!(t.result.$allModels||t.result[n])?e:ic({...e,...Qo(t.name,e,t.result.$allModels),...Qo(t.name,e,t.result[n])})}function ic(e){let t=new fe,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 wr(e,n=>({...n,needs:r(n.name,new Set)}))}function Qo(e,t,r){return r?wr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:oc(t,o,i)})):{}}function oc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function Jo(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function Wo(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 Or=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new fe;modelExtensionsCache=new fe;queryCallbacksCache=new fe;clientExtensions=Pt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Pt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Ho(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=ye(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()}},lt=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new Or(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Or(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()??[]}};l();u();c();p();m();var kr=class{constructor(t){this.name=t}};function Go(e){return e instanceof kr}function sc(e){return new kr(e)}l();u();c();p();m();l();u();c();p();m();var Ko=Symbol(),Lt=class{constructor(t){if(t!==Ko)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Mn:t}},Mn=new Lt(Ko);function he(e){return e instanceof Lt}var pc={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"},zo="explicitly `undefined` values are not allowed";function Dn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=lt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:d,previewFeatures:f,globalOmit:P}){let A=new Nn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:d,previewFeatures:f,globalOmit:P});return{modelName:e,action:pc[t],query:_t(r,A)}}function _t({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Yo(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()}),yc(e,n)):dc(n,t,r)}function dc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&fc(n,t,e),gc(n,r,e),n}function fc(e,t,r){for(let[n,i]of Object.entries(t)){if(he(i))continue;let o=r.nestSelection(n);if(Ln(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]=_t(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=_t(i,o)}}function gc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=Wo(i,n);for(let[s,a]of Object.entries(o)){if(he(a))continue;Ln(a,r.nestSelection(s));let d=r.findField(s);n?.[s]&&!d||(e[s]=!a)}}function yc(e,t){let r={},n=t.getComputedFields(),i=Jo(e,n);for(let[o,s]of Object.entries(i)){if(he(s))continue;let a=t.nestSelection(o);Ln(s,a);let d=t.findField(o);if(!(n?.[o]&&!d)){if(s===!1||s===void 0||he(s)){r[o]=!1;continue}if(s===!0){d?.kind==="object"?r[o]=_t({},a):r[o]=!0;continue}r[o]=_t(s,a)}}return r}function Zo(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(Xe(e)){if(br(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(Go(e))return{$type:"Param",value:e.name};if(st(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return hc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:y.from(r,n,i).toString("base64")}}if(wc(e))return e.values;if(et(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof cc){if(!lc(e)&&!uc(e)&&!ac(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(bc(e))return e.toJSON();if(typeof e=="object")return Yo(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 Yo(e,t){if(e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);he(i)||(i!==void 0?r[n]=Zo(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:zo}))}return r}function hc(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||he(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(Zo(o,i))}return r}function wc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function bc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Ln(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:zo})}var Nn=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){Ir({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)}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?.[Ce(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:Te(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};l();u();c();p();m();function xc(e,t){let r=Pt(()=>Ec(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Ec(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function _n(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}l();u();c();p();m();var Fn=new WeakMap,Mr="$$PrismaTypedSql",Ft=class{constructor(t,r){Fn.set(this,{sql:t,values:r}),Object.defineProperty(this,Mr,{value:Mr})}get sql(){return Fn.get(this).sql}get values(){return Fn.get(this).values}};function Tc(e){return(...t)=>new Ft(e,t)}function Nr(e){return e!=null&&e[Mr]===Mr}l();u();c();p();m();import{Sql as od}from"@prisma/client-runtime-utils";l();u();c();p();m();Xo();l();u();c();p();m();l();u();c();p();m();function Ut(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}l();u();c();p();m();function Y(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}l();u();c();p();m();function Ue(e){let t=new fe;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}l();u();c();p();m();l();u();c();p();m();var Lr={enumerable:!0,configurable:!0,writable:!0};function _r(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Lr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var es=Symbol.for("nodejs.util.inspect.custom");function le(e,t){let r=Pc(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=ts(Reflect.ownKeys(o),r),a=ts(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 d=r.get(s);return d?d.getPropertyDescriptor?{...Lr,...d?.getPropertyDescriptor(s)}:Lr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[es]=function(){let o={...this};return delete o[es],o},i}function Pc(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 ts(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}l();u();c();p();m();function ut(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}l();u();c();p();m();function rs(e){if(e===void 0)return"";let t=at(e);return new tt(0,{colors:vr}).write(t).toString()}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Un=class{getLocation(){return null}};function Re(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Un}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var ns={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function ct(e={}){let t=vc(e);return Object.entries(t).reduce((n,[i,o])=>(ns[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function vc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Fr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function is(e,t){let r=Fr(e);return t({action:"aggregate",unpacker:r,argsMapper:ct})(e)}l();u();c();p();m();function Cc(e={}){let{select:t,...r}=e;return typeof t=="object"?ct({...r,_count:t}):ct({...r,_count:{_all:!0}})}function Sc(e={}){return typeof e.select=="object"?t=>Fr(e)(t)._count:t=>Fr(e)(t)._count._all}function os(e,t){return t({action:"count",unpacker:Sc(e),argsMapper:Cc})(e)}l();u();c();p();m();function Rc(e={}){let t=ct(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 Ic(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ss(e,t){return t({action:"groupBy",unpacker:Ic(e),argsMapper:Rc})(e)}function as(e,t,r){if(t==="aggregate")return n=>is(n,r);if(t==="count")return n=>os(n,r);if(t==="groupBy")return n=>ss(n,r)}l();u();c();p();m();function ls(e,t){let r=t.fields.filter(i=>!i.relationName),n=eo(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 Dt(e,o,s.type,s.isList,s.kind==="enum")},..._r(Object.keys(n))})}l();u();c();p();m();l();u();c();p();m();var us=e=>Array.isArray(e)?e:e.split("."),$n=(e,t)=>us(t).reduce((r,n)=>r&&r[n],e),cs=(e,t,r)=>us(t).reduceRight((n,i,o,s)=>Object.assign({},$n(e,s.slice(0,o)),{[i]:n}),r);function Oc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function kc(e,t,r){return t===void 0?e??{}:cs(t,r,e||!0)}function qn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((d,f)=>({...d,[f.name]:f}),{});return d=>{let f=Re(e._errorFormat),P=Oc(n,i),A=kc(d,o,P),S=r({dataPath:P,callsite:f})(A),C=Mc(e,t);return new Proxy(S,{get(M,R){if(!C.includes(R))return M[R];let xe=[a[R].type,r,R],X=[P,A];return qn(e,...xe,...X)},..._r([...C,...Object.getOwnPropertyNames(S)])})}}function Mc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var Nc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Dc=["aggregate","count","groupBy"];function Vn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Lc(e,t),Fc(e,t),Ut(r),Y("name",()=>t),Y("$name",()=>t),Y("$parent",()=>e._appliedParent)];return le({},n)}function Lc(e,t){let r=ye(t),n=Object.keys(kt).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>d=>{let f=Re(e._errorFormat);return e._createPrismaPromise(P=>{let A={args:d,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:P,callsite:f};return e._request({...A,...a})},{action:o,args:d,model:t})};return Nc.includes(o)?qn(e,t,s):_c(i)?as(e,i,s):s({})}}}function _c(e){return Dc.includes(e)}function Fc(e,t){return Ue(Y("fields",()=>{let r=e._runtimeDataModel.models[t];return ls(t,r)}))}l();u();c();p();m();function ps(e){return e.replace(/^./,t=>t.toUpperCase())}var Bn=Symbol();function $t(e){let t=[Uc(e),$c(e),Y(Bn,()=>e),Y("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Ut(r)),le(e,t)}function Uc(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function $c(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(ye),n=[...new Set(t.concat(r))];return Ue({getKeys(){return n},getPropertyValue(i){let o=ps(i);if(e._runtimeDataModel.models[o]!==void 0)return Vn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Vn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function ms(e){return e[Bn]?e[Bn]:e}function ds(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 $t(t)}l();u();c();p();m();l();u();c();p();m();function fs({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let d of Object.values(o)){if(n){if(n[d.name])continue;let f=d.needs.filter(P=>n[P]);f.length>0&&a.push(ut(f))}else if(r){if(!r[d.name])continue;let f=d.needs.filter(P=>!r[P]);f.length>0&&a.push(ut(f))}qc(e,d.needs)&&s.push(Vc(d,le(e,s)))}return s.length>0||a.length>0?le(e,[...s,...a]):e}function qc(e,t){return t.every(r=>Sn(e,r))}function Vc(e,t){return Ue(Y(e.name,()=>e.compute(t)))}l();u();c();p();m();function Ur({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Ur({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&gs({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&gs({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function gs({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||he(s))continue;let d=n.models[r].fields.find(P=>P.name===o);if(!d||d.kind!=="object"||!d.relationName)continue;let f=typeof s=="object"?s:{};t[o]=Ur({visitor:i,result:t[o],args:f,modelName:d.type,runtimeDataModel:n})}}function ys({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:Ur({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,d,f)=>{let P=ye(d);return fs({result:a,modelName:P,select:f.select,omit:f.select?void 0:{...o?.[P],...f.omit},extensions:n})}})}l();u();c();p();m();l();u();c();p();m();import{Decimal as jc,ObjectEnumValue as Qc,Sql as ws}from"@prisma/client-runtime-utils";l();u();c();p();m();var Bc=["$connect","$disconnect","$on","$transaction","$extends"],hs=Bc;function bs(e){if(e instanceof ws)return Hc(e);if(Nr(e))return Jc(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=qt(e[n]);return r}let t={};for(let r in e)t[r]=qt(e[r]);return t}function Hc(e){return new ws(e.strings,e.values)}function Jc(e){return new Ft(e.sql,e.values)}function qt(e){if(typeof e!="object"||e==null||e instanceof Qc||st(e))return e;if(et(e))return new jc(e.toFixed());if(Xe(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]=qt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:qt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=qt(e[r]);return t}Te(e,"Unknown value")}function Es(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:bs(t.args??{}),__internalParams:t,query:(s,a=t)=>{let d=a.customDataProxyFetch;return a.customDataProxyFetch=vs(o,d),a.args=s,Es(e,a,r,n+1)}})})}function Ts(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 Es(e,t,s)}function Ps(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?As(r,n,0,e):e(r)}}function As(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 d=a.customDataProxyFetch;return a.customDataProxyFetch=vs(i,d),As(a,t,r+1,n)}})}var xs=e=>e;function vs(e=xs,t=xs){return r=>e(t(r))}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();import{Decimal as Wc}from"@prisma/client-runtime-utils";l();u();c();p();m();import{Decimal as $r}from"@prisma/client-runtime-utils";function D(e,t){throw new Error(t)}function jn(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=>jn(e[r],t[r]))}function pt(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]==typeof t[o]&&typeof e[o]!="object")return e[o]===t[o];if($r.isDecimal(e[o])||$r.isDecimal(t[o])){let s=Cs(e[o]),a=Cs(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Ss(e[o]),a=Ss(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Rs(e[o])?.getTime()===Rs(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Is(e[o])===Is(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Os(e[o])===Os(t[o])}return jn(e[o],t[o])})}function Cs(e){return $r.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new $r(e):void 0}function Ss(e){return y.isBuffer(e)?e:e instanceof Uint8Array?y.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?y.from(e,"base64"):void 0}function Rs(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Is(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Os(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Vt(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?y.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}function Gc(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Kc(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function $e(e){return e===null?e:Array.isArray(e)?e.map($e):typeof e=="object"?Gc(e)?zc(e):e.constructor!==null&&e.constructor.name!=="Object"?e:Kc(e,$e):e}function zc({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=y.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new Wc(t);case"Json":return JSON.parse(t);default:D(t,"Unknown tagged value")}}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function qr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}l();u();c();p();m();var I={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 mt(e){if(!qr(e))throw e;let t=Zc(e),r=ks(e);throw!t||!r?e:new K(r,t,{driverAdapterError:e})}function Hn(e){throw qr(e)?new K(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??ks(e)}\``,"P2010",{driverAdapterError:e}):e}function Zc(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:D(e.cause,`Unknown error: ${e.cause}`)}}function ks(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 ${Qn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Qn(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 ${Qn(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:D(e.cause,`Unknown error: ${e.cause}`)}}function Qn(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 Ms(e,t){let r=e.map(i=>t.keys.reduce((o,s)=>(o[s]=$e(i[s]),o),{})),n=new Set(t.nestedSelection);return t.arguments.map(i=>{let o=r.findIndex(s=>pt(s,i));if(o===-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 s=Object.entries(e[o]).filter(([a])=>n.has(a));return Object.fromEntries(s)}})}l();u();c();p();m();import{Decimal as Yc}from"@prisma/client-runtime-utils";var $=class extends K{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},Ns=new WeakMap;function Xc(e){let t=Ns.get(e);return t||(t=Object.entries(e),Ns.set(e,t)),t}function Ls(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new $(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return Wn(e,t.fields,r,t.skipNulls);case"field":return Jn(e,"<result>",t.fieldType,r);default:D(t,`Invalid data mapping type: '${t.type}'`)}}function Wn(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=>Ds(o,t,r))}if(typeof e=="object")return Ds(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new $("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Wn(i,t,r,n)}throw new $(`Expected an array or an object, got: ${typeof e}`)}function Ds(e,t,r){if(typeof e!="object")throw new $(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Xc(t))switch(o.type){case"affectedRows":throw new $(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:d}=o;if(s!==null&&!Object.hasOwn(e,s))throw new $(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=Wn(f,a,r,d);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=ep(e[s],s,o.fieldType,r);else throw new $(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:D(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function ep(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>Jn(o,`${t}[${s}]`,r,n)):Jn(e,t,r,n)}function Jn(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new $(`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 $(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new $(`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 $(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new $(`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 $(`Expected a float in column '${t}', got string: ${e}`);return i}throw new $(`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 $(`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 $(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Yc.isDecimal(e))throw new $(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"datetime":{if(typeof e=="string")return{$type:"DateTime",value:rp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new $(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Vt(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new $(`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 $(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:y.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:y.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:y.from(e).toString("base64")};throw new $(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:D(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new $(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new $(`Value '${e}' not found in enum '${r.name}'`);return o}default:D(r,`DataMapper: Unknown result type: ${r.type}`)}}var tp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function rp(e){let t=tp.exec(e);if(t===null)return`${e}T00:00:00Z`;let r=e,[n,i,o]=t;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${e}:00`:i===void 0&&(r=`${e}Z`),n.length===e.length)return`1970-01-01T${r}`;let s=t.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function we(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]=we(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:we(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=we(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=we(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(we(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(we(o),we(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(we(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function np(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 Vr(e,t){let r={};for(let n of e){let i=n(we(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function _s(e,t){let r=Vr(e,t);return np(r)}function Fs(e,t){return t?`${e} ${t}`:e}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Bt;(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"})(Bt||(Bt={}));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:D(e,`Unknown provider: ${e}`)}}async function Br({query:e,tracingHelper:t,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=w.now(),d=await i(),f=w.now();return n({timestamp:s,duration:f-a,query:e.sql,params:e.args}),d};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:Bt.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":ip(r)}},o):o()}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function qe(e,t){var r="000000000"+e;return r.substr(r.length-t)}var Us=Ne(yo(),1);function op(){try{return Us.default.hostname()}catch{return g.env._CLUSTER_NETWORK_NAME_||g.env.COMPUTERNAME||"hostname"}}var $s=2,sp=qe(g.pid.toString(36),$s),qs=op(),ap=qs.length,lp=qe(qs.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+ap+36).toString(36),$s);function Gn(){return sp+lp}l();u();c();p();m();l();u();c();p();m();function jr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function Kn(e){let n=Math.pow(36,4),i=0;function o(){return qe((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var d="c",f=new Date().getTime().toString(36),P=qe(s().toString(36),4),A=e(),S=o()+o();return d+f+P+A+S}return a.fingerprint=e,a.isCuid=jr,a}var up=Kn(Gn);var Vs=up;var Ua=Ne(ka());l();u();c();p();m();Fe();l();u();c();p();m();var Ma="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Kp=128,Be,gt;function zp(e){!Be||Be.length<e?(Be=y.allocUnsafe(e*Kp),St.getRandomValues(Be),gt=0):gt+e>Be.length&&(St.getRandomValues(Be),gt=0),gt+=e}function ii(e=21){zp(e|=0);let t="";for(let r=gt-e;r<gt;r++)t+=Ma[Be[r]&63];return t}l();u();c();p();m();Fe();var Da="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Gt=32;var Zp=16,La=10,Na=0xffffffffffff;var je;(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"})(je||(je={}));var Qe=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Yp(e){let t=Math.floor(e()*Gt);return t===Gt&&(t=Gt-1),Da.charAt(t)}function Xp(e){let t=em(),r=t&&(t.crypto||t.msCrypto)||(typeof Ze<"u"?Ze: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(Ze?.randomBytes)return()=>Ze.randomBytes(1).readUInt8()/255;throw new Qe(je.PRNGDetectFailure,"Failed to find a reliable PRNG")}function em(){return nm()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function tm(e,t){let r="";for(;e>0;e--)r=Yp(t)+r;return r}function rm(e,t=La){if(isNaN(e))throw new Qe(je.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Na)throw new Qe(je.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Na}: ${e}`);if(e<0)throw new Qe(je.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new Qe(je.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Gt,n=Da.charAt(r)+n,e=(e-r)/Gt;return n}function nm(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function _a(e,t){let r=t||Xp(),n=!e||isNaN(e)?Date.now():e;return rm(n,La)+tm(Zp,r)}l();u();c();p();m();l();u();c();p();m();var z=[];for(let e=0;e<256;++e)z.push((e+256).toString(16).slice(1));function Wr(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()}l();u();c();p();m();Fe();var Kr=new Uint8Array(256),Gr=Kr.length;function yt(){return Gr>Kr.length-16&&(fr(Kr),Gr=0),Kr.slice(Gr,Gr+=16)}l();u();c();p();m();l();u();c();p();m();Fe();var oi={randomUUID:dr};function im(e,t,r){if(oi.randomUUID&&!t&&!e)return oi.randomUUID();e=e||{};let n=e.random??e.rng?.()??yt();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 Wr(n)}var si=im;l();u();c();p();m();var ai={};function om(e,t,r){let n;if(e)n=Fa(e.random??e.rng?.()??yt(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=yt();sm(ai,i,o),n=Fa(o,ai.msecs,ai.seq,t,r)}return t??Wr(n)}function sm(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 Fa(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 li=om;var zr=class{#t={};constructor(){this.register("uuid",new ci),this.register("cuid",new pi),this.register("ulid",new mi),this.register("nanoid",new di),this.register("product",new fi)}snapshot(){return Object.create(this.#t,{now:{value:new ui}})}register(t,r){this.#t[t]=r}},ui=class{#t=new Date;generate(){return this.#t.toISOString()}},ci=class{generate(t){if(t===4)return si();if(t===7)return li();throw new Error("Invalid UUID generator arguments")}},pi=class{generate(t){if(t===1)return Vs();if(t===2)return(0,Ua.createId)();throw new Error("Invalid CUID generator arguments")}},mi=class{generate(){return _a()}},di=class{generate(t){if(typeof t=="number")return ii(t);if(t===void 0)return ii();throw new Error("Invalid Nanoid generator arguments")}},fi=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]]}};l();u();c();p();m();function Zr(e,t){return e==null?e:typeof e=="string"?Zr(JSON.parse(e),t):Array.isArray(e)?lm(e,t):am(e,t)}function am(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!pt(e,i))return null}return qa(e,t.nested)}function qa(e,t){for(let[r,n]of Object.entries(t))e[r]=Zr(e[r],n);return e}function lm(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=um(e,r)}return t.pagination&&(e=cm(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>qa(r,t.nested))}function um(e,t){let r=new Set,n=[];for(let i of e){let o=ht(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function cm(e,t,r){if(r===null)return $a(e,t);let n=new Map;for(let o of e){let s=ht(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])=>$a(o,t))}function $a(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>pt(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function ht(e,t){return JSON.stringify(t.map(r=>e[r]))}l();u();c();p();m();l();u();c();p();m();function gi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function yi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function bi(e,t,r,n){let i=e.args.map(o=>ue(o,t,r));switch(e.type){case"rawSql":return[dm(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?gm(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 pm(e.fragments,e.placeholderFormat,s,e.argTypes)});default:D(e.type,"Invalid query type")}}function ue(e,t,r){for(;fm(e);)if(gi(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(yi(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=>ue(s,t,r)))}else D(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>ue(n,t,r))),e}function pm(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let d of wi(e,r,n)){if(i+=mm(d,t,o),d.type==="stringChunk")continue;let f=s.length,P=s.push(...Va(d))-f;if(d.argType.arity==="tuple"){if(P%d.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${P} parameters for a tuple of arity ${d.argType.elements.length}.`);for(let A=0;A<P/d.argType.elements.length;A++)a.push(...d.argType.elements)}else for(let A=0;A<P;A++)a.push(d.argType)}return{sql:i,args:s,argTypes:a}}function mm(e,t,r){let n=e.type;switch(n){case"parameter":return hi(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>hi(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>hi(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:D(n,"Invalid fragment type")}}function hi(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function dm(e,t,r){return{sql:e,args:t,argTypes:r}}function fm(e){return gi(e)||yi(e)}function*wi(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*Va(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 gm(e,t,r){let n=0,i=0;for(let s of wi(e,t,void 0)){let a=0;for(let d of Va(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of wi(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,d=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let f=r-(n-a);d=ym(s.value,f)}else d=[s.value];o=o.flatMap(f=>d.map(P=>[...f,P]));break}case"parameterTupleList":{let a=s.value.reduce((A,S)=>A+S.length,0),d=[],f=[],P=0;for(let A of s.value)r&&o.length===1&&a===i&&f.length>0&&n-a+P+A.length>r&&(d.push(f),f=[],P=0),f.push(A),P+=A.length;f.length>0&&d.push(f),o=o.flatMap(A=>d.map(S=>[...A,S]));break}}return o}function ym(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}l();u();c();p();m();function Ba(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function ja(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>hm(t)),rows:e.rows.map(t=>t.map((r,n)=>Kt(r,e.columnTypes[n])))}}function Kt(e,t){if(e===null)return null;switch(t){case I.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 I.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>Kt(r,I.Int32));case I.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 I.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>Kt(r,I.Int64));case I.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case I.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>Kt(r,I.Json));case I.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 I.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>Kt(r,I.Boolean));default:return e}}function hm(e){switch(e){case I.Int32:return"int";case I.Int64:return"bigint";case I.Float:return"float";case I.Double:return"double";case I.Text:return"string";case I.Enum:return"enum";case I.Bytes:return"bytes";case I.Boolean:return"bool";case I.Character:return"char";case I.Numeric:return"decimal";case I.Json:return"json";case I.Uuid:return"uuid";case I.DateTime:return"datetime";case I.Date:return"date";case I.Time:return"time";case I.Int32Array:return"int-array";case I.Int64Array:return"bigint-array";case I.FloatArray:return"float-array";case I.DoubleArray:return"double-array";case I.TextArray:return"string-array";case I.EnumArray:return"string-array";case I.BytesArray:return"bytes-array";case I.BooleanArray:return"bool-array";case I.CharacterArray:return"char-array";case I.NumericArray:return"decimal-array";case I.JsonArray:return"json-array";case I.UuidArray:return"uuid-array";case I.DateTimeArray:return"datetime-array";case I.DateArray:return"date-array";case I.TimeArray:return"time-array";case I.UnknownNumber:return"unknown";case I.Set:return"string";default:D(e,`Unexpected column type: ${e}`)}}l();u();c();p();m();function Qa(e,t,r){if(!t.every(n=>xi(e,n))){let n=wm(e,r),i=bm(r);throw new K(n,i,r.context)}}function xi(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:D(t,`Unknown rule type: ${t.type}`)}}function wm(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:D(t,`Unknown error identifier: ${t}`)}}function bm(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:D(e,`Unknown error identifier: ${e}`)}}var zt=class e{#t;#e;#r;#n=new zr;#l;#i;#s;#o;#u;#a;constructor({transactionManager:t,placeholderValues:r,onQuery:n,tracingHelper:i,serializer:o,rawSerializer:s,provider:a,connectionInfo:d,sqlCommenter:f}){this.#t=t,this.#e=r,this.#r=n,this.#l=i,this.#i=o,this.#s=s??o,this.#o=a,this.#u=d,this.#a=f}static forSql(t){return new e({transactionManager:t.transactionManager,placeholderValues:t.placeholderValues,onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:Ba,rawSerializer:ja,provider:t.provider,connectionInfo:t.connectionInfo,sqlCommenter:t.sqlCommenter})}async run(t,r){let{value:n}=await this.interpretNode(t,r,this.#e,this.#n.snapshot()).catch(i=>mt(i));return n}async interpretNode(t,r,n,i){switch(t.type){case"value":return{value:ue(t.args,n,i)};case"seq":{let o;for(let s of t.args)o=await this.interpretNode(s,r,n,i);return o??{value:void 0}}case"get":return{value:n[t.args.name]};case"let":{let o=Object.create(n);for(let s of t.args.bindings){let{value:a}=await this.interpretNode(s.expr,r,o,i);o[s.name]=a}return this.interpretNode(t.args.expr,r,o,i)}case"getFirstNonEmpty":{for(let o of t.args.names){let s=n[o];if(!Ha(s))return{value:s}}return{value:[]}}case"concat":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>s.concat(Ei(a)),[]):[]}}case"sum":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>be(s)+be(a)):0}}case"execute":{let o=bi(t.args,n,i,this.#c()),s=0;for(let a of o){let d=this.#d(a);s+=await this.#m(d,r,()=>r.executeRaw(d).catch(f=>t.args.type==="rawSql"?Hn(f):mt(f)))}return{value:s}}case"query":{let o=bi(t.args,n,i,this.#c()),s;for(let a of o){let d=this.#d(a),f=await this.#m(d,r,()=>r.queryRaw(d).catch(P=>t.args.type==="rawSql"?Hn(P):mt(P)));s===void 0?s=f:(s.rows.push(...f.rows),s.lastInsertId=f.lastInsertId)}return{value:t.args.type==="rawSql"?this.#s(s):this.#i(s),lastInsertId:s?.lastInsertId}}case"reverse":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);return{value:Array.isArray(o)?o.reverse():o,lastInsertId:s}}case"unique":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(!Array.isArray(o))return{value:o,lastInsertId:s};if(o.length>1)throw new Error(`Expected zero or one element, got ${o.length}`);return{value:o[0]??null,lastInsertId:s}}case"required":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(Ha(o))throw new Error("Required value is empty");return{value:o,lastInsertId:s}}case"mapField":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.records,r,n,i);return{value:Ja(o,t.args.field),lastInsertId:s}}case"join":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.parent,r,n,i);if(o===null)return{value:null,lastInsertId:s};let a=await Promise.all(t.args.children.map(async d=>({joinExpr:d,childRecords:(await this.interpretNode(d.child,r,n,i)).value})));return{value:xm(o,a),lastInsertId:s}}case"transaction":{if(!this.#t.enabled)return this.interpretNode(t.args,r,n,i);let o=this.#t.manager,s=await o.startInternalTransaction(),a=await o.getTransaction(s,"query");try{let d=await this.interpretNode(t.args,a,n,i);return await o.commitTransaction(s.id),d}catch(d){throw await o.rollbackTransaction(s.id),d}}case"dataMap":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:Ls(o,t.args.structure,t.args.enums),lastInsertId:s}}case"validate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return Qa(o,t.args.rules,t.args),{value:o,lastInsertId:s}}case"if":{let{value:o}=await this.interpretNode(t.args.value,r,n,i);return xi(o,t.args.rule)?await this.interpretNode(t.args.then,r,n,i):await this.interpretNode(t.args.else,r,n,i)}case"unit":return{value:void 0};case"diff":{let{value:o}=await this.interpretNode(t.args.from,r,n,i),{value:s}=await this.interpretNode(t.args.to,r,n,i),a=f=>f!==null?ht(Yr(f),t.args.fields):null,d=new Set(Ei(s).map(a));return{value:Ei(o).filter(f=>!d.has(a(f)))}}case"process":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:Zr(o,t.args.operations),lastInsertId:s}}case"initializeRecord":{let{lastInsertId:o}=await this.interpretNode(t.args.expr,r,n,i),s={};for(let[a,d]of Object.entries(t.args.fields))s[a]=Em(d,o,n,i);return{value:s,lastInsertId:o}}case"mapRecord":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=o===null?{}:Yr(o);for(let[d,f]of Object.entries(t.args.fields))a[d]=Tm(f,a[d],n,i);return{value:a,lastInsertId:s}}default:D(t,`Unexpected node type: ${t.type}`)}}#c(){return this.#u?.maxBindValues!==void 0?this.#u.maxBindValues:this.#p()}#p(){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:D(this.#o,`Unexpected provider: ${this.#o}`)}}#m(t,r,n){return Br({query:t,execute:n,provider:this.#o??r.provider,tracingHelper:this.#l,onQuery:this.#r})}#d(t){if(!this.#a||this.#a.plugins.length===0)return t;let r=_s(this.#a.plugins,{query:this.#a.queryInfo,sql:t.sql});return r?{...t,sql:Fs(t.sql,r)}:t}};function Ha(e){return Array.isArray(e)?e.length===0:e==null}function Ei(e){return Array.isArray(e)?e:[e]}function be(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Yr(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function Ja(e,t){return Array.isArray(e)?e.map(r=>Ja(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function xm(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 d=Yr(a),f=ht(d,i);s[f]||(s[f]=[]),s[f].push(d),r.isRelationUnique?d[r.parentField]=null:d[r.parentField]=[]}for(let a of Array.isArray(n)?n:[n]){if(a===null)continue;let d=ht(Yr(a),o);for(let f of s[d]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Em(e,t,r,n){switch(e.type){case"value":return ue(e.value,r,n);case"lastInsertId":return t;default:D(e,`Unexpected field initializer type: ${e.type}`)}}function Tm(e,t,r,n){switch(e.type){case"set":return ue(e.value,r,n);case"add":return be(t)+be(ue(e.value,r,n));case"subtract":return be(t)-be(ue(e.value,r,n));case"multiply":return be(t)*be(ue(e.value,r,n));case"divide":{let i=be(t),o=be(ue(e.value,r,n));return o===0?null:i/o}default:D(e,`Unexpected field operation type: ${e.type}`)}}l();u();c();p();m();l();u();c();p();m();async function Pm(){return globalThis.crypto??await Promise.resolve().then(()=>(Fe(),Pn))}async function Wa(){return(await Pm()).randomUUID()}l();u();c();p();m();async function Ga(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}l();u();c();p();m();var se=class extends K{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Zt=class extends se{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.")}},Xr=class extends se{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},en=class extends se{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},tn=class extends se{constructor(){super("Unable to start a transaction in the given time.")}},rn=class extends se{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})}},wt=class extends se{constructor(t){super(`Internal Consistency Error: ${t}`)}},nn=class extends se{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Am=100,bt=Z("prisma:client:transactionManager"),vm=()=>({sql:"COMMIT",args:[],argTypes:[]}),Cm=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Sm=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),Rm=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Yt=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#t;#e;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#e=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 Wa(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=Ka(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(mt);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),Ga(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=>bt("error in discarded transaction:",s)),await this.#i(r,"timed_out"),new tn;return r.status="running",r.timer=this.#l(r.id,t.timeout),{id:r.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new wt(`Transaction in invalid state ${r.status} although it just finished startup.`);default:D(r.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.#n(t,"commit");await this.#i(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.#n(t,"rollback");await this.#i(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 Zt;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(bt("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new wt("Active transaction found in closed transactions list.");case"committed":throw new Xr(r);case"rolled_back":throw new en(r);case"timed_out":throw new rn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw bt("Transaction not found.",t),new Zt}if(["committed","rolled_back","timed_out"].includes(n.status))throw new wt("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.#i(t,"rolled_back")))}#l(t,r){let n=Date.now(),i=Ka(async()=>{bt("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);o&&["running","waiting"].includes(o.status)?await this.#i(o,"timed_out"):bt("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#i(t,r){let n=async()=>{bt("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#o(Sm(),t.transaction,()=>t.transaction.commit());else{let i=vm();await this.#o(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.#o(Rm(),t.transaction,()=>t.transaction.rollback());else{let i=Cm();try{await this.#o(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>Am&&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 se("timeout is required");if(!t.maxWait)throw new se("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new nn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#o(t,r,n){return Br({query:t,execute:n,provider:this.#e??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function Ka(e,t){return t!==void 0?setTimeout(e,t):void 0}import{PrismaClientInitializationError as vi,PrismaClientKnownRequestError as Ci,PrismaClientRustPanicError as er,PrismaClientUnknownRequestError as fl}from"@prisma/client-runtime-utils";var on="7.3.0-dev.13";l();u();c();p();m();var za={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function Ya(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=>Xa(i)),n=t.map(i=>Om(i));return{args:r,argTypes:n}}function Xa(e){if(Array.isArray(e))return e.map(t=>Xa(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 Om(e){return Array.isArray(e)?{scalarType:e.length>0?Za(e[0]):"unknown",arity:"list"}:{scalarType:Za(e),arity:"scalar"}}function Za(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in za?za[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}l();u();c();p();m();function el(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}l();u();c();p();m();l();u();c();p();m();function tl(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}l();u();c();p();m();function rl(e){return e.split(`
|
|
6
|
+
`)}};function at(e){return new kn(Bo(e))}function Bo(e){let t=new it;for(let[r,n]of Object.entries(e)){let i=new Sr(r,jo(n));t.addField(i)}return t}function jo(e){if(typeof e=="string")return new G(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new G(String(e));if(typeof e=="bigint")return new G(`${e}n`);if(e===null)return new G("null");if(e===void 0)return new G("undefined");if(et(e))return new G(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return y.isBuffer(e)?new G(`Buffer.alloc(${e.byteLength})`):new G(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=br(e)?e.toISOString():"Invalid Date";return new G(`new Date("${t}")`)}return e instanceof tc?new G(`Prisma.${e._getName()}`):st(e)?new G(`prisma.${Ce(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?rc(e):typeof e=="object"?Bo(e):new G(Object.prototype.toString.call(e))}function rc(e){let t=new nt;for(let r of e)t.addItem(jo(r));return t}function Rr(e,t){let r=t==="pretty"?Do:vr,n=e.renderAllMessages(r),i=new tt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Ir({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=at(e);for(let A of t)Tr(A,a,s);let{message:d,args:f}=Rr(a,r),P=Er({message:d,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new nc(P,{clientVersion:o})}l();u();c();p();m();l();u();c();p();m();function ye(e){return e.replace(/^./,t=>t.toLowerCase())}l();u();c();p();m();function Ho(e,t,r){let n=ye(r);return!t.result||!(t.result.$allModels||t.result[n])?e:ic({...e,...Qo(t.name,e,t.result.$allModels),...Qo(t.name,e,t.result[n])})}function ic(e){let t=new fe,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 wr(e,n=>({...n,needs:r(n.name,new Set)}))}function Qo(e,t,r){return r?wr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:oc(t,o,i)})):{}}function oc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function Jo(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function Wo(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 Or=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new fe;modelExtensionsCache=new fe;queryCallbacksCache=new fe;clientExtensions=Pt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Pt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Ho(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=ye(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()}},lt=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new Or(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Or(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()??[]}};l();u();c();p();m();var kr=class{constructor(t){this.name=t}};function Go(e){return e instanceof kr}function sc(e){return new kr(e)}l();u();c();p();m();l();u();c();p();m();var Ko=Symbol(),Lt=class{constructor(t){if(t!==Ko)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Mn:t}},Mn=new Lt(Ko);function he(e){return e instanceof Lt}var pc={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"},zo="explicitly `undefined` values are not allowed";function Dn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=lt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:d,previewFeatures:f,globalOmit:P}){let A=new Nn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:d,previewFeatures:f,globalOmit:P});return{modelName:e,action:pc[t],query:_t(r,A)}}function _t({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Yo(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()}),yc(e,n)):dc(n,t,r)}function dc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&fc(n,t,e),gc(n,r,e),n}function fc(e,t,r){for(let[n,i]of Object.entries(t)){if(he(i))continue;let o=r.nestSelection(n);if(Ln(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]=_t(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=_t(i,o)}}function gc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=Wo(i,n);for(let[s,a]of Object.entries(o)){if(he(a))continue;Ln(a,r.nestSelection(s));let d=r.findField(s);n?.[s]&&!d||(e[s]=!a)}}function yc(e,t){let r={},n=t.getComputedFields(),i=Jo(e,n);for(let[o,s]of Object.entries(i)){if(he(s))continue;let a=t.nestSelection(o);Ln(s,a);let d=t.findField(o);if(!(n?.[o]&&!d)){if(s===!1||s===void 0||he(s)){r[o]=!1;continue}if(s===!0){d?.kind==="object"?r[o]=_t({},a):r[o]=!0;continue}r[o]=_t(s,a)}}return r}function Zo(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(Xe(e)){if(br(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(Go(e))return{$type:"Param",value:e.name};if(st(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return hc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:y.from(r,n,i).toString("base64")}}if(wc(e))return e.values;if(et(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof cc){if(!lc(e)&&!uc(e)&&!ac(e))throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(bc(e))return e.toJSON();if(typeof e=="object")return Yo(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 Yo(e,t){if(e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);he(i)||(i!==void 0?r[n]=Zo(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:zo}))}return r}function hc(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||he(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(Zo(o,i))}return r}function wc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function bc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Ln(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:zo})}var Nn=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){Ir({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)}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?.[Ce(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:Te(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};l();u();c();p();m();function xc(e,t){let r=Pt(()=>Ec(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Ec(e){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function _n(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}l();u();c();p();m();var Fn=new WeakMap,Mr="$$PrismaTypedSql",Ft=class{constructor(t,r){Fn.set(this,{sql:t,values:r}),Object.defineProperty(this,Mr,{value:Mr})}get sql(){return Fn.get(this).sql}get values(){return Fn.get(this).values}};function Tc(e){return(...t)=>new Ft(e,t)}function Nr(e){return e!=null&&e[Mr]===Mr}l();u();c();p();m();import{Sql as od}from"@prisma/client-runtime-utils";l();u();c();p();m();Xo();l();u();c();p();m();l();u();c();p();m();function Ut(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}l();u();c();p();m();function Y(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}l();u();c();p();m();function Ue(e){let t=new fe;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}l();u();c();p();m();l();u();c();p();m();var Lr={enumerable:!0,configurable:!0,writable:!0};function _r(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Lr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var es=Symbol.for("nodejs.util.inspect.custom");function le(e,t){let r=Pc(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=ts(Reflect.ownKeys(o),r),a=ts(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 d=r.get(s);return d?d.getPropertyDescriptor?{...Lr,...d?.getPropertyDescriptor(s)}:Lr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[es]=function(){let o={...this};return delete o[es],o},i}function Pc(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 ts(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}l();u();c();p();m();function ut(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}l();u();c();p();m();function rs(e){if(e===void 0)return"";let t=at(e);return new tt(0,{colors:vr}).write(t).toString()}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Un=class{getLocation(){return null}};function Re(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Un}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var ns={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function ct(e={}){let t=vc(e);return Object.entries(t).reduce((n,[i,o])=>(ns[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function vc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Fr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function is(e,t){let r=Fr(e);return t({action:"aggregate",unpacker:r,argsMapper:ct})(e)}l();u();c();p();m();function Cc(e={}){let{select:t,...r}=e;return typeof t=="object"?ct({...r,_count:t}):ct({...r,_count:{_all:!0}})}function Sc(e={}){return typeof e.select=="object"?t=>Fr(e)(t)._count:t=>Fr(e)(t)._count._all}function os(e,t){return t({action:"count",unpacker:Sc(e),argsMapper:Cc})(e)}l();u();c();p();m();function Rc(e={}){let t=ct(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 Ic(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ss(e,t){return t({action:"groupBy",unpacker:Ic(e),argsMapper:Rc})(e)}function as(e,t,r){if(t==="aggregate")return n=>is(n,r);if(t==="count")return n=>os(n,r);if(t==="groupBy")return n=>ss(n,r)}l();u();c();p();m();function ls(e,t){let r=t.fields.filter(i=>!i.relationName),n=eo(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 Dt(e,o,s.type,s.isList,s.kind==="enum")},..._r(Object.keys(n))})}l();u();c();p();m();l();u();c();p();m();var us=e=>Array.isArray(e)?e:e.split("."),$n=(e,t)=>us(t).reduce((r,n)=>r&&r[n],e),cs=(e,t,r)=>us(t).reduceRight((n,i,o,s)=>Object.assign({},$n(e,s.slice(0,o)),{[i]:n}),r);function Oc(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function kc(e,t,r){return t===void 0?e??{}:cs(t,r,e||!0)}function qn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((d,f)=>({...d,[f.name]:f}),{});return d=>{let f=Re(e._errorFormat),P=Oc(n,i),A=kc(d,o,P),S=r({dataPath:P,callsite:f})(A),C=Mc(e,t);return new Proxy(S,{get(M,R){if(!C.includes(R))return M[R];let xe=[a[R].type,r,R],X=[P,A];return qn(e,...xe,...X)},..._r([...C,...Object.getOwnPropertyNames(S)])})}}function Mc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var Nc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Dc=["aggregate","count","groupBy"];function Vn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Lc(e,t),Fc(e,t),Ut(r),Y("name",()=>t),Y("$name",()=>t),Y("$parent",()=>e._appliedParent)];return le({},n)}function Lc(e,t){let r=ye(t),n=Object.keys(kt).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>d=>{let f=Re(e._errorFormat);return e._createPrismaPromise(P=>{let A={args:d,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:P,callsite:f};return e._request({...A,...a})},{action:o,args:d,model:t})};return Nc.includes(o)?qn(e,t,s):_c(i)?as(e,i,s):s({})}}}function _c(e){return Dc.includes(e)}function Fc(e,t){return Ue(Y("fields",()=>{let r=e._runtimeDataModel.models[t];return ls(t,r)}))}l();u();c();p();m();function ps(e){return e.replace(/^./,t=>t.toUpperCase())}var Bn=Symbol();function $t(e){let t=[Uc(e),$c(e),Y(Bn,()=>e),Y("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Ut(r)),le(e,t)}function Uc(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function $c(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(ye),n=[...new Set(t.concat(r))];return Ue({getKeys(){return n},getPropertyValue(i){let o=ps(i);if(e._runtimeDataModel.models[o]!==void 0)return Vn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Vn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function ms(e){return e[Bn]?e[Bn]:e}function ds(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 $t(t)}l();u();c();p();m();l();u();c();p();m();function fs({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let d of Object.values(o)){if(n){if(n[d.name])continue;let f=d.needs.filter(P=>n[P]);f.length>0&&a.push(ut(f))}else if(r){if(!r[d.name])continue;let f=d.needs.filter(P=>!r[P]);f.length>0&&a.push(ut(f))}qc(e,d.needs)&&s.push(Vc(d,le(e,s)))}return s.length>0||a.length>0?le(e,[...s,...a]):e}function qc(e,t){return t.every(r=>Sn(e,r))}function Vc(e,t){return Ue(Y(e.name,()=>e.compute(t)))}l();u();c();p();m();function Ur({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Ur({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&gs({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&gs({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function gs({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||he(s))continue;let d=n.models[r].fields.find(P=>P.name===o);if(!d||d.kind!=="object"||!d.relationName)continue;let f=typeof s=="object"?s:{};t[o]=Ur({visitor:i,result:t[o],args:f,modelName:d.type,runtimeDataModel:n})}}function ys({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:Ur({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,d,f)=>{let P=ye(d);return fs({result:a,modelName:P,select:f.select,omit:f.select?void 0:{...o?.[P],...f.omit},extensions:n})}})}l();u();c();p();m();l();u();c();p();m();import{Decimal as jc,ObjectEnumValue as Qc,Sql as ws}from"@prisma/client-runtime-utils";l();u();c();p();m();var Bc=["$connect","$disconnect","$on","$transaction","$extends"],hs=Bc;function bs(e){if(e instanceof ws)return Hc(e);if(Nr(e))return Jc(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=qt(e[n]);return r}let t={};for(let r in e)t[r]=qt(e[r]);return t}function Hc(e){return new ws(e.strings,e.values)}function Jc(e){return new Ft(e.sql,e.values)}function qt(e){if(typeof e!="object"||e==null||e instanceof Qc||st(e))return e;if(et(e))return new jc(e.toFixed());if(Xe(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]=qt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:qt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=qt(e[r]);return t}Te(e,"Unknown value")}function Es(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:bs(t.args??{}),__internalParams:t,query:(s,a=t)=>{let d=a.customDataProxyFetch;return a.customDataProxyFetch=vs(o,d),a.args=s,Es(e,a,r,n+1)}})})}function Ts(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 Es(e,t,s)}function Ps(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?As(r,n,0,e):e(r)}}function As(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 d=a.customDataProxyFetch;return a.customDataProxyFetch=vs(i,d),As(a,t,r+1,n)}})}var xs=e=>e;function vs(e=xs,t=xs){return r=>e(t(r))}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();import{Decimal as Wc}from"@prisma/client-runtime-utils";l();u();c();p();m();import{Decimal as $r}from"@prisma/client-runtime-utils";function D(e,t){throw new Error(t)}function jn(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=>jn(e[r],t[r]))}function pt(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]==typeof t[o]&&typeof e[o]!="object")return e[o]===t[o];if($r.isDecimal(e[o])||$r.isDecimal(t[o])){let s=Cs(e[o]),a=Cs(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Ss(e[o]),a=Ss(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Rs(e[o])?.getTime()===Rs(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Is(e[o])===Is(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Os(e[o])===Os(t[o])}return jn(e[o],t[o])})}function Cs(e){return $r.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new $r(e):void 0}function Ss(e){return y.isBuffer(e)?e:e instanceof Uint8Array?y.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?y.from(e,"base64"):void 0}function Rs(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Is(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Os(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function Vt(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?y.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}function Gc(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Kc(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function $e(e){return e===null?e:Array.isArray(e)?e.map($e):typeof e=="object"?Gc(e)?zc(e):e.constructor!==null&&e.constructor.name!=="Object"?e:Kc(e,$e):e}function zc({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=y.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new Wc(t);case"Json":return JSON.parse(t);default:D(t,"Unknown tagged value")}}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function qr(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}l();u();c();p();m();var I={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 mt(e){if(!qr(e))throw e;let t=Zc(e),r=ks(e);throw!t||!r?e:new K(r,t,{driverAdapterError:e})}function Hn(e){throw qr(e)?new K(`Raw query failed. Code: \`${e.cause.originalCode??"N/A"}\`. Message: \`${e.cause.originalMessage??ks(e)}\``,"P2010",{driverAdapterError:e}):e}function Zc(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:D(e.cause,`Unknown error: ${e.cause}`)}}function ks(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 ${Qn(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Qn(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 ${Qn(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:D(e.cause,`Unknown error: ${e.cause}`)}}function Qn(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 Ms(e,t){let r=e.map(i=>t.keys.reduce((o,s)=>(o[s]=$e(i[s]),o),{})),n=new Set(t.nestedSelection);return t.arguments.map(i=>{let o=r.findIndex(s=>pt(s,i));if(o===-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 s=Object.entries(e[o]).filter(([a])=>n.has(a));return Object.fromEntries(s)}})}l();u();c();p();m();import{Decimal as Yc}from"@prisma/client-runtime-utils";var $=class extends K{name="DataMapperError";constructor(t,r){super(t,"P2023",r)}},Ns=new WeakMap;function Xc(e){let t=Ns.get(e);return t||(t=Object.entries(e),Ns.set(e,t)),t}function Ls(e,t,r){switch(t.type){case"affectedRows":if(typeof e!="number")throw new $(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"object":return Wn(e,t.fields,r,t.skipNulls);case"field":return Jn(e,"<result>",t.fieldType,r);default:D(t,`Invalid data mapping type: '${t.type}'`)}}function Wn(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=>Ds(o,t,r))}if(typeof e=="object")return Ds(e,t,r);if(typeof e=="string"){let i;try{i=JSON.parse(e)}catch(o){throw new $("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Wn(i,t,r,n)}throw new $(`Expected an array or an object, got: ${typeof e}`)}function Ds(e,t,r){if(typeof e!="object")throw new $(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Xc(t))switch(o.type){case"affectedRows":throw new $(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:d}=o;if(s!==null&&!Object.hasOwn(e,s))throw new $(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let f=s!==null?e[s]:e;n[i]=Wn(f,a,r,d);break}case"field":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=ep(e[s],s,o.fieldType,r);else throw new $(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:D(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function ep(e,t,r,n){return e===null?r.arity==="list"?[]:null:r.arity==="list"?e.map((o,s)=>Jn(o,`${t}[${s}]`,r,n)):Jn(e,t,r,n)}function Jn(e,t,r,n){switch(r.type){case"unsupported":return e;case"string":{if(typeof e!="string")throw new $(`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 $(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new $(`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 $(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"bigint":{if(typeof e!="number"&&typeof e!="string")throw new $(`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 $(`Expected a float in column '${t}', got string: ${e}`);return i}throw new $(`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 $(`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 $(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"decimal":if(typeof e!="number"&&typeof e!="string"&&!Yc.isDecimal(e))throw new $(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"datetime":{if(typeof e=="string")return{$type:"DateTime",value:rp(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new $(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"object":return{$type:"Json",value:Vt(e)};case"json":return{$type:"Json",value:`${e}`};case"bytes":{switch(r.encoding){case"base64":if(typeof e!="string")throw new $(`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 $(`Expected a hex-encoded byte array in column '${t}', got ${typeof e}: ${e}`);return{$type:"Bytes",value:y.from(e.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(e))return{$type:"Bytes",value:y.from(e).toString("base64")};if(e instanceof Uint8Array)return{$type:"Bytes",value:y.from(e).toString("base64")};throw new $(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`);default:D(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new $(`Unknown enum '${r.name}'`);let o=i[`${e}`];if(o===void 0)throw new $(`Value '${e}' not found in enum '${r.name}'`);return o}default:D(r,`DataMapper: Unknown result type: ${r.type}`)}}var tp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function rp(e){let t=tp.exec(e);if(t===null)return`${e}T00:00:00Z`;let r=e,[n,i,o]=t;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${e}:00`:i===void 0&&(r=`${e}Z`),n.length===e.length)return`1970-01-01T${r}`;let s=t.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function we(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]=we(e[t]))}else{r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:we(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=we(e[t])}return r}if(n==="[object Array]"){for(t=e.length,r=Array(t);t--;)r[t]=we(e[t]);return r}return n==="[object Set]"?(r=new Set,e.forEach(function(i){r.add(we(i))}),r):n==="[object Map]"?(r=new Map,e.forEach(function(i,o){r.set(we(o),we(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(we(e.buffer)):n==="[object ArrayBuffer]"?e.slice(0):n.slice(-6)==="Array]"?new e.constructor(e):e}function np(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 Vr(e,t){let r={};for(let n of e){let i=n(we(t));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function _s(e,t){let r=Vr(e,t);return np(r)}function Fs(e,t){return t?`${e} ${t}`:e}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Bt;(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"})(Bt||(Bt={}));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:D(e,`Unknown provider: ${e}`)}}async function Br({query:e,tracingHelper:t,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=w.now(),d=await i(),f=w.now();return n({timestamp:s,duration:f-a,query:e.sql,params:e.args}),d};return t.isEnabled()?await t.runInChildSpan({name:"db_query",kind:Bt.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":ip(r)}},o):o()}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();function qe(e,t){var r="000000000"+e;return r.substr(r.length-t)}var Us=Ne(yo(),1);function op(){try{return Us.default.hostname()}catch{return g.env._CLUSTER_NETWORK_NAME_||g.env.COMPUTERNAME||"hostname"}}var $s=2,sp=qe(g.pid.toString(36),$s),qs=op(),ap=qs.length,lp=qe(qs.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+ap+36).toString(36),$s);function Gn(){return sp+lp}l();u();c();p();m();l();u();c();p();m();function jr(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function Kn(e){let n=Math.pow(36,4),i=0;function o(){return qe((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var d="c",f=new Date().getTime().toString(36),P=qe(s().toString(36),4),A=e(),S=o()+o();return d+f+P+A+S}return a.fingerprint=e,a.isCuid=jr,a}var up=Kn(Gn);var Vs=up;var Ua=Ne(ka());l();u();c();p();m();Fe();l();u();c();p();m();var Ma="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Kp=128,Be,gt;function zp(e){!Be||Be.length<e?(Be=y.allocUnsafe(e*Kp),St.getRandomValues(Be),gt=0):gt+e>Be.length&&(St.getRandomValues(Be),gt=0),gt+=e}function ii(e=21){zp(e|=0);let t="";for(let r=gt-e;r<gt;r++)t+=Ma[Be[r]&63];return t}l();u();c();p();m();Fe();var Da="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Gt=32;var Zp=16,La=10,Na=0xffffffffffff;var je;(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"})(je||(je={}));var Qe=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Yp(e){let t=Math.floor(e()*Gt);return t===Gt&&(t=Gt-1),Da.charAt(t)}function Xp(e){let t=em(),r=t&&(t.crypto||t.msCrypto)||(typeof Ze<"u"?Ze: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(Ze?.randomBytes)return()=>Ze.randomBytes(1).readUInt8()/255;throw new Qe(je.PRNGDetectFailure,"Failed to find a reliable PRNG")}function em(){return nm()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function tm(e,t){let r="";for(;e>0;e--)r=Yp(t)+r;return r}function rm(e,t=La){if(isNaN(e))throw new Qe(je.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Na)throw new Qe(je.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Na}: ${e}`);if(e<0)throw new Qe(je.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new Qe(je.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Gt,n=Da.charAt(r)+n,e=(e-r)/Gt;return n}function nm(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function _a(e,t){let r=t||Xp(),n=!e||isNaN(e)?Date.now():e;return rm(n,La)+tm(Zp,r)}l();u();c();p();m();l();u();c();p();m();var z=[];for(let e=0;e<256;++e)z.push((e+256).toString(16).slice(1));function Wr(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()}l();u();c();p();m();Fe();var Kr=new Uint8Array(256),Gr=Kr.length;function yt(){return Gr>Kr.length-16&&(fr(Kr),Gr=0),Kr.slice(Gr,Gr+=16)}l();u();c();p();m();l();u();c();p();m();Fe();var oi={randomUUID:dr};function im(e,t,r){if(oi.randomUUID&&!t&&!e)return oi.randomUUID();e=e||{};let n=e.random??e.rng?.()??yt();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 Wr(n)}var si=im;l();u();c();p();m();var ai={};function om(e,t,r){let n;if(e)n=Fa(e.random??e.rng?.()??yt(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=yt();sm(ai,i,o),n=Fa(o,ai.msecs,ai.seq,t,r)}return t??Wr(n)}function sm(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 Fa(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 li=om;var zr=class{#t={};constructor(){this.register("uuid",new ci),this.register("cuid",new pi),this.register("ulid",new mi),this.register("nanoid",new di),this.register("product",new fi)}snapshot(){return Object.create(this.#t,{now:{value:new ui}})}register(t,r){this.#t[t]=r}},ui=class{#t=new Date;generate(){return this.#t.toISOString()}},ci=class{generate(t){if(t===4)return si();if(t===7)return li();throw new Error("Invalid UUID generator arguments")}},pi=class{generate(t){if(t===1)return Vs();if(t===2)return(0,Ua.createId)();throw new Error("Invalid CUID generator arguments")}},mi=class{generate(){return _a()}},di=class{generate(t){if(typeof t=="number")return ii(t);if(t===void 0)return ii();throw new Error("Invalid Nanoid generator arguments")}},fi=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]]}};l();u();c();p();m();function Zr(e,t){return e==null?e:typeof e=="string"?Zr(JSON.parse(e),t):Array.isArray(e)?lm(e,t):am(e,t)}function am(e,t){if(t.pagination){let{skip:r,take:n,cursor:i}=t.pagination;if(r!==null&&r>0||n===0||i!==null&&!pt(e,i))return null}return qa(e,t.nested)}function qa(e,t){for(let[r,n]of Object.entries(t))e[r]=Zr(e[r],n);return e}function lm(e,t){if(t.distinct!==null){let r=t.linkingFields!==null?[...t.distinct,...t.linkingFields]:t.distinct;e=um(e,r)}return t.pagination&&(e=cm(e,t.pagination,t.linkingFields)),t.reverse&&e.reverse(),Object.keys(t.nested).length===0?e:e.map(r=>qa(r,t.nested))}function um(e,t){let r=new Set,n=[];for(let i of e){let o=ht(i,t);r.has(o)||(r.add(o),n.push(i))}return n}function cm(e,t,r){if(r===null)return $a(e,t);let n=new Map;for(let o of e){let s=ht(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])=>$a(o,t))}function $a(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>pt(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function ht(e,t){return JSON.stringify(t.map(r=>e[r]))}l();u();c();p();m();l();u();c();p();m();function gi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function yi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function bi(e,t,r,n){let i=e.args.map(o=>ue(o,t,r));switch(e.type){case"rawSql":return[dm(e.sql,i,e.argTypes)];case"templateSql":return(e.chunkable?gm(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 pm(e.fragments,e.placeholderFormat,s,e.argTypes)});default:D(e.type,"Invalid query type")}}function ue(e,t,r){for(;fm(e);)if(gi(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(yi(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=>ue(s,t,r)))}else D(e,`Unexpected unevaluated value type: ${e}`);return Array.isArray(e)&&(e=e.map(n=>ue(n,t,r))),e}function pm(e,t,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let d of wi(e,r,n)){if(i+=mm(d,t,o),d.type==="stringChunk")continue;let f=s.length,P=s.push(...Va(d))-f;if(d.argType.arity==="tuple"){if(P%d.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${P} parameters for a tuple of arity ${d.argType.elements.length}.`);for(let A=0;A<P/d.argType.elements.length;A++)a.push(...d.argType.elements)}else for(let A=0;A<P;A++)a.push(d.argType)}return{sql:i,args:s,argTypes:a}}function mm(e,t,r){let n=e.type;switch(n){case"parameter":return hi(t,r.placeholderNumber++);case"stringChunk":return e.chunk;case"parameterTuple":return`(${e.value.length==0?"NULL":e.value.map(()=>hi(t,r.placeholderNumber++)).join(",")})`;case"parameterTupleList":return e.value.map(i=>{let o=i.map(()=>hi(t,r.placeholderNumber++)).join(e.itemSeparator);return`${e.itemPrefix}${o}${e.itemSuffix}`}).join(e.groupSeparator);default:D(n,"Invalid fragment type")}}function hi(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function dm(e,t,r){return{sql:e,args:t,argTypes:r}}function fm(e){return gi(e)||yi(e)}function*wi(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*Va(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 gm(e,t,r){let n=0,i=0;for(let s of wi(e,t,void 0)){let a=0;for(let d of Va(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of wi(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,d=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let f=r-(n-a);d=ym(s.value,f)}else d=[s.value];o=o.flatMap(f=>d.map(P=>[...f,P]));break}case"parameterTupleList":{let a=s.value.reduce((A,S)=>A+S.length,0),d=[],f=[],P=0;for(let A of s.value)r&&o.length===1&&a===i&&f.length>0&&n-a+P+A.length>r&&(d.push(f),f=[],P=0),f.push(A),P+=A.length;f.length>0&&d.push(f),o=o.flatMap(A=>d.map(S=>[...A,S]));break}}return o}function ym(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}l();u();c();p();m();function Ba(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}function ja(e){return{columns:e.columnNames,types:e.columnTypes.map(t=>hm(t)),rows:e.rows.map(t=>t.map((r,n)=>Kt(r,e.columnTypes[n])))}}function Kt(e,t){if(e===null)return null;switch(t){case I.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 I.Int32Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int32Array`);return e.map(r=>Kt(r,I.Int32));case I.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 I.Int64Array:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as Int64Array`);return e.map(r=>Kt(r,I.Int64));case I.Json:switch(typeof e){case"string":return JSON.parse(e);default:throw new Error(`Cannot serialize value of type ${typeof e} as Json`)}case I.JsonArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as JsonArray`);return e.map(r=>Kt(r,I.Json));case I.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 I.BooleanArray:if(!Array.isArray(e))throw new Error(`Cannot serialize value of type ${typeof e} as BooleanArray`);return e.map(r=>Kt(r,I.Boolean));default:return e}}function hm(e){switch(e){case I.Int32:return"int";case I.Int64:return"bigint";case I.Float:return"float";case I.Double:return"double";case I.Text:return"string";case I.Enum:return"enum";case I.Bytes:return"bytes";case I.Boolean:return"bool";case I.Character:return"char";case I.Numeric:return"decimal";case I.Json:return"json";case I.Uuid:return"uuid";case I.DateTime:return"datetime";case I.Date:return"date";case I.Time:return"time";case I.Int32Array:return"int-array";case I.Int64Array:return"bigint-array";case I.FloatArray:return"float-array";case I.DoubleArray:return"double-array";case I.TextArray:return"string-array";case I.EnumArray:return"string-array";case I.BytesArray:return"bytes-array";case I.BooleanArray:return"bool-array";case I.CharacterArray:return"char-array";case I.NumericArray:return"decimal-array";case I.JsonArray:return"json-array";case I.UuidArray:return"uuid-array";case I.DateTimeArray:return"datetime-array";case I.DateArray:return"date-array";case I.TimeArray:return"time-array";case I.UnknownNumber:return"unknown";case I.Set:return"string";default:D(e,`Unexpected column type: ${e}`)}}l();u();c();p();m();function Qa(e,t,r){if(!t.every(n=>xi(e,n))){let n=wm(e,r),i=bm(r);throw new K(n,i,r.context)}}function xi(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:D(t,`Unknown rule type: ${t.type}`)}}function wm(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:D(t,`Unknown error identifier: ${t}`)}}function bm(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:D(e,`Unknown error identifier: ${e}`)}}var zt=class e{#t;#e;#r;#n=new zr;#l;#i;#s;#o;#u;#a;constructor({transactionManager:t,placeholderValues:r,onQuery:n,tracingHelper:i,serializer:o,rawSerializer:s,provider:a,connectionInfo:d,sqlCommenter:f}){this.#t=t,this.#e=r,this.#r=n,this.#l=i,this.#i=o,this.#s=s??o,this.#o=a,this.#u=d,this.#a=f}static forSql(t){return new e({transactionManager:t.transactionManager,placeholderValues:t.placeholderValues,onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:Ba,rawSerializer:ja,provider:t.provider,connectionInfo:t.connectionInfo,sqlCommenter:t.sqlCommenter})}async run(t,r){let{value:n}=await this.interpretNode(t,r,this.#e,this.#n.snapshot()).catch(i=>mt(i));return n}async interpretNode(t,r,n,i){switch(t.type){case"value":return{value:ue(t.args,n,i)};case"seq":{let o;for(let s of t.args)o=await this.interpretNode(s,r,n,i);return o??{value:void 0}}case"get":return{value:n[t.args.name]};case"let":{let o=Object.create(n);for(let s of t.args.bindings){let{value:a}=await this.interpretNode(s.expr,r,o,i);o[s.name]=a}return this.interpretNode(t.args.expr,r,o,i)}case"getFirstNonEmpty":{for(let o of t.args.names){let s=n[o];if(!Ha(s))return{value:s}}return{value:[]}}case"concat":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>s.concat(Ei(a)),[]):[]}}case"sum":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>be(s)+be(a)):0}}case"execute":{let o=bi(t.args,n,i,this.#c()),s=0;for(let a of o){let d=this.#d(a);s+=await this.#m(d,r,()=>r.executeRaw(d).catch(f=>t.args.type==="rawSql"?Hn(f):mt(f)))}return{value:s}}case"query":{let o=bi(t.args,n,i,this.#c()),s;for(let a of o){let d=this.#d(a),f=await this.#m(d,r,()=>r.queryRaw(d).catch(P=>t.args.type==="rawSql"?Hn(P):mt(P)));s===void 0?s=f:(s.rows.push(...f.rows),s.lastInsertId=f.lastInsertId)}return{value:t.args.type==="rawSql"?this.#s(s):this.#i(s),lastInsertId:s?.lastInsertId}}case"reverse":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);return{value:Array.isArray(o)?o.reverse():o,lastInsertId:s}}case"unique":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(!Array.isArray(o))return{value:o,lastInsertId:s};if(o.length>1)throw new Error(`Expected zero or one element, got ${o.length}`);return{value:o[0]??null,lastInsertId:s}}case"required":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(Ha(o))throw new Error("Required value is empty");return{value:o,lastInsertId:s}}case"mapField":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.records,r,n,i);return{value:Ja(o,t.args.field),lastInsertId:s}}case"join":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.parent,r,n,i);if(o===null)return{value:null,lastInsertId:s};let a=await Promise.all(t.args.children.map(async d=>({joinExpr:d,childRecords:(await this.interpretNode(d.child,r,n,i)).value})));return{value:xm(o,a),lastInsertId:s}}case"transaction":{if(!this.#t.enabled)return this.interpretNode(t.args,r,n,i);let o=this.#t.manager,s=await o.startInternalTransaction(),a=await o.getTransaction(s,"query");try{let d=await this.interpretNode(t.args,a,n,i);return await o.commitTransaction(s.id),d}catch(d){throw await o.rollbackTransaction(s.id),d}}case"dataMap":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:Ls(o,t.args.structure,t.args.enums),lastInsertId:s}}case"validate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return Qa(o,t.args.rules,t.args),{value:o,lastInsertId:s}}case"if":{let{value:o}=await this.interpretNode(t.args.value,r,n,i);return xi(o,t.args.rule)?await this.interpretNode(t.args.then,r,n,i):await this.interpretNode(t.args.else,r,n,i)}case"unit":return{value:void 0};case"diff":{let{value:o}=await this.interpretNode(t.args.from,r,n,i),{value:s}=await this.interpretNode(t.args.to,r,n,i),a=f=>f!==null?ht(Yr(f),t.args.fields):null,d=new Set(Ei(s).map(a));return{value:Ei(o).filter(f=>!d.has(a(f)))}}case"process":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:Zr(o,t.args.operations),lastInsertId:s}}case"initializeRecord":{let{lastInsertId:o}=await this.interpretNode(t.args.expr,r,n,i),s={};for(let[a,d]of Object.entries(t.args.fields))s[a]=Em(d,o,n,i);return{value:s,lastInsertId:o}}case"mapRecord":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=o===null?{}:Yr(o);for(let[d,f]of Object.entries(t.args.fields))a[d]=Tm(f,a[d],n,i);return{value:a,lastInsertId:s}}default:D(t,`Unexpected node type: ${t.type}`)}}#c(){return this.#u?.maxBindValues!==void 0?this.#u.maxBindValues:this.#p()}#p(){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:D(this.#o,`Unexpected provider: ${this.#o}`)}}#m(t,r,n){return Br({query:t,execute:n,provider:this.#o??r.provider,tracingHelper:this.#l,onQuery:this.#r})}#d(t){if(!this.#a||this.#a.plugins.length===0)return t;let r=_s(this.#a.plugins,{query:this.#a.queryInfo,sql:t.sql});return r?{...t,sql:Fs(t.sql,r)}:t}};function Ha(e){return Array.isArray(e)?e.length===0:e==null}function Ei(e){return Array.isArray(e)?e:[e]}function be(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Yr(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function Ja(e,t){return Array.isArray(e)?e.map(r=>Ja(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function xm(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 d=Yr(a),f=ht(d,i);s[f]||(s[f]=[]),s[f].push(d),r.isRelationUnique?d[r.parentField]=null:d[r.parentField]=[]}for(let a of Array.isArray(n)?n:[n]){if(a===null)continue;let d=ht(Yr(a),o);for(let f of s[d]??[])r.isRelationUnique?f[r.parentField]=a:f[r.parentField].push(a)}}return e}function Em(e,t,r,n){switch(e.type){case"value":return ue(e.value,r,n);case"lastInsertId":return t;default:D(e,`Unexpected field initializer type: ${e.type}`)}}function Tm(e,t,r,n){switch(e.type){case"set":return ue(e.value,r,n);case"add":return be(t)+be(ue(e.value,r,n));case"subtract":return be(t)-be(ue(e.value,r,n));case"multiply":return be(t)*be(ue(e.value,r,n));case"divide":{let i=be(t),o=be(ue(e.value,r,n));return o===0?null:i/o}default:D(e,`Unexpected field operation type: ${e.type}`)}}l();u();c();p();m();l();u();c();p();m();async function Pm(){return globalThis.crypto??await Promise.resolve().then(()=>(Fe(),Pn))}async function Wa(){return(await Pm()).randomUUID()}l();u();c();p();m();async function Ga(e,t){return new Promise(r=>{e.addEventListener(t,r,{once:!0})})}l();u();c();p();m();var se=class extends K{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Zt=class extends se{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.")}},Xr=class extends se{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},en=class extends se{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},tn=class extends se{constructor(){super("Unable to start a transaction in the given time.")}},rn=class extends se{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})}},wt=class extends se{constructor(t){super(`Internal Consistency Error: ${t}`)}},nn=class extends se{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var Am=100,bt=Z("prisma:client:transactionManager"),vm=()=>({sql:"COMMIT",args:[],argTypes:[]}),Cm=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),Sm=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),Rm=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Yt=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#t;#e;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#e=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 Wa(),status:"waiting",timer:void 0,timeout:t.timeout,startedAt:Date.now(),transaction:void 0},n=new AbortController,i=Ka(()=>n.abort(),t.maxWait);i?.unref?.();let o=this.driverAdapter.startTransaction(t.isolationLevel).catch(mt);switch(r.transaction=await Promise.race([o.finally(()=>clearTimeout(i)),Ga(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=>bt("error in discarded transaction:",s)),await this.#i(r,"timed_out"),new tn;return r.status="running",r.timer=this.#l(r.id,t.timeout),{id:r.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new wt(`Transaction in invalid state ${r.status} although it just finished startup.`);default:D(r.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.#n(t,"commit");await this.#i(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.#n(t,"rollback");await this.#i(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 Zt;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(bt("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new wt("Active transaction found in closed transactions list.");case"committed":throw new Xr(r);case"rolled_back":throw new en(r);case"timed_out":throw new rn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw bt("Transaction not found.",t),new Zt}if(["committed","rolled_back","timed_out"].includes(n.status))throw new wt("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.#i(t,"rolled_back")))}#l(t,r){let n=Date.now(),i=Ka(async()=>{bt("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(t);o&&["running","waiting"].includes(o.status)?await this.#i(o,"timed_out"):bt("Transaction already committed or rolled back when timeout happened.",t)},r);return i?.unref?.(),i}async#i(t,r){let n=async()=>{bt("Closing transaction.",{transactionId:t.id,status:r});try{if(t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#o(Sm(),t.transaction,()=>t.transaction.commit());else{let i=vm();await this.#o(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.#o(Rm(),t.transaction,()=>t.transaction.rollback());else{let i=Cm();try{await this.#o(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>Am&&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 se("timeout is required");if(!t.maxWait)throw new se("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new nn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#o(t,r,n){return Br({query:t,execute:n,provider:this.#e??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function Ka(e,t){return t!==void 0?setTimeout(e,t):void 0}import{PrismaClientInitializationError as vi,PrismaClientKnownRequestError as Ci,PrismaClientRustPanicError as er,PrismaClientUnknownRequestError as fl}from"@prisma/client-runtime-utils";var on="7.3.0-dev.14";l();u();c();p();m();var za={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function Ya(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=>Xa(i)),n=t.map(i=>Om(i));return{args:r,argTypes:n}}function Xa(e){if(Array.isArray(e))return e.map(t=>Xa(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 Om(e){return Array.isArray(e)?{scalarType:e.length>0?Za(e[0]):"unknown",arity:"list"}:{scalarType:Za(e),arity:"scalar"}}function Za(e){return typeof e=="object"&&e!==null&&"prisma__type"in e&&typeof e.prisma__type=="string"&&e.prisma__type in za?za[e.prisma__type]:typeof e=="number"?"decimal":typeof e=="string"?"string":"unknown"}l();u();c();p();m();function el(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}l();u();c();p();m();l();u();c();p();m();function tl(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}l();u();c();p();m();function rl(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
|
`)}l();u();c();p();m();var nl=Ne(Ao());function il({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,nl.default)({user:t,repo:r,template:n,title:e,body:i})}function ol({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=mo(6e3-(s?.length??0)),d=rl(Ye(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 Ri=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Nr(r))n=r.sql,i={values:xt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:xt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:xt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:xt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=El(r),i={values:xt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Cl(`prisma.${e}(${n}, ${i.values})`):Cl(`prisma.${e}(${n})`),{query:n,parameters:i}},Sl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new Um(t,r)}},Rl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};l();u();c();p();m();function Ii(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Il(r(s)):Il(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 Il(e){return typeof e.then=="function"?e:Promise.resolve(e)}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Ol={name:"@prisma/instrumentation-contract",version:"7.3.0-dev.
|
|
60
|
+
`)}var Ri=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Nr(r))n=r.sql,i={values:xt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:xt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:xt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:xt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=El(r),i={values:xt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Cl(`prisma.${e}(${n}, ${i.values})`):Cl(`prisma.${e}(${n})`),{query:n,parameters:i}},Sl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new Um(t,r)}},Rl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};l();u();c();p();m();function Ii(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Il(r(s)):Il(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 Il(e){return typeof e.then=="function"?e:Promise.resolve(e)}l();u();c();p();m();l();u();c();p();m();l();u();c();p();m();var Ol={name:"@prisma/instrumentation-contract",version:"7.3.0-dev.14",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}};var Vm=Ol.version.split(".")[0],Bm="PRISMA_INSTRUMENTATION",jm=`V${Vm}_PRISMA_INSTRUMENTATION`,kl=globalThis;function Ml(){let e=kl[jm];return e?.helper?e.helper:kl[Bm]?.helper}var Qm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Oi=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 Ml()??Qm}};function Nl(){return new Oi}l();u();c();p();m();function Dl(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}l();u();c();p();m();function Ll(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)}l();u();c();p();m();import{hasBatchIndex as Gm}from"@prisma/client-runtime-utils";l();u();c();p();m();function _l(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(ki(e.query.arguments)),t.push(ki(e.query.selection)),t.join("")}function ki(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${ki(n)})`:r}).join(" ")})`}l();u();c();p();m();var Hm={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 Mi(e){return Hm[e]}l();u();c();p();m();var mn=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,g.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"}};l();u();c();p();m();import{Decimal as Jm}from"@prisma/client-runtime-utils";function Je(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=y.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new Jm(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=>Je("bigint",r));case"bytes-array":return t.map(r=>Je("bytes",r));case"decimal-array":return t.map(r=>Je("decimal",r));case"datetime-array":return t.map(r=>Je("datetime",r));case"date-array":return t.map(r=>Je("date",r));case"time-array":return t.map(r=>Je("time",r));default:return t}}function Ni(e){let t=[],r=Wm(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]]=Je(e.types[s],i[s]);t.push(o)}return t}function Wm(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var Km=Z("prisma:client:request_handler"),fn=class{client;dataloader;logEmitter;constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new mn({batchLoader:Ps(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(A=>A.protocolQuery),d=this.client._tracingHelper.getTraceParent(s),f=n.some(A=>Mi(A.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:d,transaction:zm(o),containsWrite:f,customDataProxyFetch:i})).map((A,S)=>{if(A instanceof Error)return A;try{return this.mapQueryEngineResult(n[S],A)}catch(C){return C}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?Fl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Mi(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:_l(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 g.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),Zm(t,i))throw t;if(t instanceof Di&&Ym(t)){let f=Ul(t.meta);Ir({args:o,errors:[f],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let d=t.message;if(n&&(d=Er({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:d})),d=this.sanitizeMessage(d),t.code){let f=s?{modelName:s,...t.meta}:t.meta;throw new Di(d,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new dn(d,this.client._clientVersion);if(t instanceof Li)throw new Li(d,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof We)throw new We(d,this.client._clientVersion);if(t instanceof dn)throw new dn(d,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?Ye(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=$n(o,s),d=i==="queryRaw"?Ni(a):$e(a);return n?n(d):d}get[Symbol.toStringTag](){return"RequestHandler"}};function zm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:Fl(e)};Te(e,"Unknown transaction kind")}}function Fl(e){return{id:e.id,payload:e.payload}}function Zm(e,t){return Gm(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Ym(e){return e.code==="P2009"||e.code==="P2012"}function Ul(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Ul)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}l();u();c();p();m();var _i=on;l();u();c();p();m();var jl=Ne(In());l();u();c();p();m();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"}};Ot(B,"PrismaClientConstructorValidationError");var $l=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","__internal"],ql=["pretty","colorless","minimal"],Vl=["info","query","warn","error"],Xm={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(!ql.includes(e)){let t=rr(e,ql);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"&&!Vl.includes(r)){let n=rr(r,Vl);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=rr(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=rd(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let d=o.fields.find(f=>f.name===s);if(!d){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(d.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(nd(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=rr(r,t);throw new B(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function ed(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 Ql(e,t){for(let[r,n]of Object.entries(e)){if(!$l.includes(r)){let i=rr(r,$l);throw new B(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}Xm[r](n,t)}ed(e)}function rr(e,t){if(t.length===0||typeof e!="string")return"";let r=td(e,t);return r?` Did you mean "${r}"?`:""}function td(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,jl.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 rd(e,t){return Bl(t.models,e)??Bl(t.types,e)}function Bl(e,t){let r=Object.keys(e).find(n=>Ce(n)===t);if(r)return e[r]}function nd(e,t){let r=at(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}=Rr(r,"colorless");return`Error validating "omit" option:
|
|
62
62
|
|
|
63
63
|
${i}
|