prisma 6.4.0-dev.34 → 6.4.0-dev.36

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.
@@ -1,8 +1,8 @@
1
- "use strict";var el=Object.create;var Er=Object.defineProperty;var tl=Object.getOwnPropertyDescriptor;var rl=Object.getOwnPropertyNames;var nl=Object.getPrototypeOf,il=Object.prototype.hasOwnProperty;var Ni=e=>{throw TypeError(e)};var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vt=(e,t)=>{for(var r in t)Er(e,r,{get:t[r],enumerable:!0})},_i=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rl(t))!il.call(e,i)&&i!==r&&Er(e,i,{get:()=>t[i],enumerable:!(n=tl(t,i))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?el(nl(e)):{},_i(t||!e||!e.__esModule?Er(r,"default",{value:e,enumerable:!0}):r,e)),ol=e=>_i(Er({},"__esModule",{value:!0}),e);var Pn=(e,t,r)=>t.has(e)||Ni("Cannot "+r);var Ce=(e,t,r)=>(Pn(e,t,"read from private field"),r?r.call(e):t.get(e)),Ne=(e,t,r)=>t.has(e)?Ni("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ge=(e,t,r,n)=>(Pn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),vn=(e,t,r)=>(Pn(e,t,"access private method"),r);var Wi=oe((Rm,Rl)=>{Rl.exports={name:"@prisma/internals",version:"6.4.0-dev.34",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/internals"},homepage:"https://www.prisma.io",author:"Tim Suchanek <suchanek@prisma.io>",bugs:"https://github.com/prisma/prisma/issues",license:"Apache-2.0",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",test:"dotenv -e ../../.db.env -- jest --silent",prepublishOnly:"pnpm run build"},files:["README.md","dist","!**/libquery_engine*","!dist/get-generators/engines/*","scripts"],devDependencies:{"@antfu/ni":"0.21.12","@babel/helper-validator-identifier":"7.24.7","@opentelemetry/api":"1.9.0","@swc/core":"1.2.204","@swc/jest":"0.2.37","@types/babel__helper-validator-identifier":"7.15.2","@types/jest":"29.5.14","@types/node":"18.19.31","@types/resolve":"1.20.6",archiver:"6.0.2","checkpoint-client":"1.1.33","cli-truncate":"2.1.0",dotenv:"16.4.7",esbuild:"0.24.2","escape-string-regexp":"4.0.0",execa:"5.1.1","fast-glob":"3.3.3","find-up":"5.0.0","fp-ts":"2.16.9","fs-extra":"11.1.1","fs-jetpack":"5.1.0","global-dirs":"4.0.0",globby:"11.1.0","identifier-regex":"1.0.0","indent-string":"4.0.0","is-windows":"1.0.2","is-wsl":"3.1.0",jest:"29.7.0","jest-junit":"16.0.0",kleur:"4.1.5","mock-stdin":"1.0.0","new-github-issue-url":"0.2.1","node-fetch":"3.3.2","npm-packlist":"5.1.3",open:"7.4.2","p-map":"4.0.0","read-package-up":"11.0.0","replace-string":"3.1.0",resolve:"1.22.10","string-width":"4.2.3","strip-ansi":"6.0.1","strip-indent":"3.0.0","temp-dir":"2.0.0",tempy:"1.0.1","terminal-link":"2.1.1",tmp:"0.2.3","ts-node":"10.9.2","ts-pattern":"5.6.2","ts-toolbelt":"9.6.0",typescript:"5.4.5",yarn:"1.22.22"},dependencies:{"@prisma/debug":"workspace:*","@prisma/engines":"workspace:*","@prisma/fetch-engine":"workspace:*","@prisma/generator-helper":"workspace:*","@prisma/get-platform":"workspace:*","@prisma/prisma-schema-wasm":"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22","@prisma/schema-files-loader":"workspace:*",arg:"5.0.2",prompts:"2.4.2"},peerDependencies:{typescript:">=5.1.0"},peerDependenciesMeta:{typescript:{optional:!0}},sideEffects:!1}});var Hi=oe((km,kl)=>{kl.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Zi=oe((Om,xe)=>{"use strict";var On=require("fs"),In=require("path"),Ol=require("os"),Il=require("crypto"),Dl=Hi(),Dn=Dl.version,Nl=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function _l(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
1
+ "use strict";var el=Object.create;var Er=Object.defineProperty;var tl=Object.getOwnPropertyDescriptor;var rl=Object.getOwnPropertyNames;var nl=Object.getPrototypeOf,il=Object.prototype.hasOwnProperty;var _i=e=>{throw TypeError(e)};var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vt=(e,t)=>{for(var r in t)Er(e,r,{get:t[r],enumerable:!0})},Mi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rl(t))!il.call(e,i)&&i!==r&&Er(e,i,{get:()=>t[i],enumerable:!(n=tl(t,i))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?el(nl(e)):{},Mi(t||!e||!e.__esModule?Er(r,"default",{value:e,enumerable:!0}):r,e)),ol=e=>Mi(Er({},"__esModule",{value:!0}),e);var vn=(e,t,r)=>t.has(e)||_i("Cannot "+r);var Ce=(e,t,r)=>(vn(e,t,"read from private field"),r?r.call(e):t.get(e)),Ne=(e,t,r)=>t.has(e)?_i("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ge=(e,t,r,n)=>(vn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Tn=(e,t,r)=>(vn(e,t,"access private method"),r);var Hi=oe((Rm,Rl)=>{Rl.exports={name:"@prisma/internals",version:"6.4.0-dev.36",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/internals"},homepage:"https://www.prisma.io",author:"Tim Suchanek <suchanek@prisma.io>",bugs:"https://github.com/prisma/prisma/issues",license:"Apache-2.0",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",test:"dotenv -e ../../.db.env -- jest --silent",prepublishOnly:"pnpm run build"},files:["README.md","dist","!**/libquery_engine*","!dist/get-generators/engines/*","scripts"],devDependencies:{"@antfu/ni":"0.21.12","@babel/helper-validator-identifier":"7.24.7","@opentelemetry/api":"1.9.0","@swc/core":"1.2.204","@swc/jest":"0.2.37","@types/babel__helper-validator-identifier":"7.15.2","@types/jest":"29.5.14","@types/node":"18.19.31","@types/resolve":"1.20.6",archiver:"6.0.2","checkpoint-client":"1.1.33","cli-truncate":"2.1.0",dotenv:"16.4.7",esbuild:"0.24.2","escape-string-regexp":"4.0.0",execa:"5.1.1","fast-glob":"3.3.3","find-up":"5.0.0","fp-ts":"2.16.9","fs-extra":"11.1.1","fs-jetpack":"5.1.0","global-dirs":"4.0.0",globby:"11.1.0","identifier-regex":"1.0.0","indent-string":"4.0.0","is-windows":"1.0.2","is-wsl":"3.1.0",jest:"29.7.0","jest-junit":"16.0.0",kleur:"4.1.5","mock-stdin":"1.0.0","new-github-issue-url":"0.2.1","node-fetch":"3.3.2","npm-packlist":"5.1.3",open:"7.4.2","p-map":"4.0.0","read-package-up":"11.0.0","replace-string":"3.1.0",resolve:"1.22.10","string-width":"4.2.3","strip-ansi":"6.0.1","strip-indent":"3.0.0","temp-dir":"2.0.0",tempy:"1.0.1","terminal-link":"2.1.1",tmp:"0.2.3","ts-node":"10.9.2","ts-pattern":"5.6.2","ts-toolbelt":"9.6.0",typescript:"5.4.5",yarn:"1.22.22"},dependencies:{"@prisma/debug":"workspace:*","@prisma/engines":"workspace:*","@prisma/fetch-engine":"workspace:*","@prisma/generator-helper":"workspace:*","@prisma/get-platform":"workspace:*","@prisma/prisma-schema-wasm":"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22","@prisma/schema-files-loader":"workspace:*",arg:"5.0.2",prompts:"2.4.2"},peerDependencies:{typescript:">=5.1.0"},peerDependenciesMeta:{typescript:{optional:!0}},sideEffects:!1}});var Ki=oe((km,kl)=>{kl.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Xi=oe((Om,xe)=>{"use strict";var In=require("fs"),Dn=require("path"),Ol=require("os"),Il=require("crypto"),Dl=Ki(),Nn=Dl.version,Nl=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function _l(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
2
2
  `);let n;for(;(n=Nl.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
3
- `),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function Ml(e){let t=Yi(e),r=L.configDotenv({path:t});if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=zi(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),l=Vl(r,a);o=L.decrypt(l.ciphertext,l.key);break}catch(a){if(s+1>=i)throw a}return L.parse(o)}function Fl(e){console.log(`[dotenv@${Dn}][INFO] ${e}`)}function Ll(e){console.log(`[dotenv@${Dn}][WARN] ${e}`)}function xr(e){console.log(`[dotenv@${Dn}][DEBUG] ${e}`)}function zi(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Vl(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function Yi(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)On.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=In.resolve(process.cwd(),".env.vault");return On.existsSync(t)?t:null}function Ki(e){return e[0]==="~"?In.join(Ol.homedir(),e.slice(1)):e}function $l(e){Fl("Loading env from encrypted .env.vault");let t=L._parseVault(e),r=process.env;return e&&e.processEnv!=null&&(r=e.processEnv),L.populate(r,t,e),{parsed:t}}function ql(e){let t=In.resolve(process.cwd(),".env"),r="utf8",n=!!(e&&e.debug);e&&e.encoding?r=e.encoding:n&&xr("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[Ki(e.path)];else{i=[];for(let l of e.path)i.push(Ki(l))}let o,s={};for(let l of i)try{let u=L.parse(On.readFileSync(l,{encoding:r}));L.populate(s,u,e)}catch(u){n&&xr(`Failed to load ${l} ${u.message}`),o=u}let a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),L.populate(a,s,e),o?{parsed:s,error:o}:{parsed:s}}function jl(e){if(zi(e).length===0)return L.configDotenv(e);let t=Yi(e);return t?L._configVault(e):(Ll(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),L.configDotenv(e))}function Ul(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=Il.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,l=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(u){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw s}}function Bl(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override);if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o]),n&&xr(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=t[o]}var L={configDotenv:ql,_configVault:$l,_parseVault:Ml,config:jl,decrypt:Ul,parse:_l,populate:Bl};xe.exports.configDotenv=L.configDotenv;xe.exports._configVault=L._configVault;xe.exports._parseVault=L._parseVault;xe.exports.config=L.config;xe.exports.decrypt=L.decrypt;xe.exports.parse=L.parse;xe.exports.populate=L.populate;xe.exports=L});var io=oe((Lm,no)=>{"use strict";no.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var so=oe((Vm,oo)=>{"use strict";var Wl=io();oo.exports=e=>{let t=Wl(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}});var uo=oe((Jm,lo)=>{"use strict";lo.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var mo=oe((Wm,po)=>{"use strict";po.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var Vn=oe((Hm,fo)=>{"use strict";var Zl=mo();fo.exports=e=>typeof e=="string"?e.replace(Zl(),""):e});var go=oe((zm,Tr)=>{"use strict";Tr.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};Tr.exports.default=Tr.exports});var Wn=oe((sf,Vo)=>{"use strict";Vo.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,m,f,g,h,R,P,T,v,k=[];for(l=0;l<i;l++)k.push(l+1),k.push(t.charCodeAt(s+l));for(var A=k.length-1;a<o-3;)for(R=r.charCodeAt(s+(u=a)),P=r.charCodeAt(s+(c=a+1)),T=r.charCodeAt(s+(p=a+2)),v=r.charCodeAt(s+(m=a+3)),f=a+=4,l=0;l<A;l+=2)g=k[l],h=k[l+1],u=e(g,u,c,R,h),c=e(u,c,p,P,h),p=e(c,p,m,T,h),f=e(p,m,f,v,h),k[l]=f,m=p,p=c,c=u,u=g;for(;a<o;)for(R=r.charCodeAt(s+(u=a)),f=++a,l=0;l<A;l+=2)g=k[l],k[l]=f=e(g,u,f,R,k[l+1]),u=g;return f}}()});var gs=oe((th,Wc)=>{Wc.exports={name:"@prisma/engines-version",version:"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"08b0da61b89855d81a37b120c20ccb3019379e22"},repository:{type:"git",url:"https://github.com/prisma/engines-wrapper.git",directory:"packages/engines-version"},devDependencies:{"@types/node":"18.19.68",typescript:"4.9.5"},files:["index.js","index.d.ts"],scripts:{build:"tsc -d"}}});var gm={};vt(gm,{Debug:()=>Sn,Decimal:()=>me,Extensions:()=>Tn,MetricsClient:()=>ut,PrismaClientInitializationError:()=>S,PrismaClientKnownRequestError:()=>Q,PrismaClientRustPanicError:()=>se,PrismaClientUnknownRequestError:()=>J,PrismaClientValidationError:()=>G,Public:()=>Cn,Sql:()=>X,createParam:()=>os,defineDmmfProperty:()=>ms,deserializeJsonResponse:()=>Ze,deserializeRawResult:()=>En,dmmfToRuntimeDataModel:()=>ps,empty:()=>ys,getPrismaClient:()=>Ya,getRuntime:()=>on,join:()=>hs,makeStrictEnum:()=>Za,makeTypedQueryFactory:()=>ds,objectEnumValues:()=>Br,raw:()=>oi,serializeJsonQuery:()=>zr,skip:()=>Kr,sqltag:()=>si,warnEnvConflicts:()=>Xa,warnOnce:()=>Nt});module.exports=ol(gm);var Tn={};vt(Tn,{defineExtension:()=>Mi,getExtensionContext:()=>Fi});function Mi(e){return typeof e=="function"?e:t=>t.$extends(e)}function Fi(e){return e}var Cn={};vt(Cn,{validator:()=>Li});function Li(...e){return t=>t}var br={};vt(br,{$:()=>Ui,bgBlack:()=>gl,bgBlue:()=>El,bgCyan:()=>xl,bgGreen:()=>yl,bgMagenta:()=>bl,bgRed:()=>hl,bgWhite:()=>Pl,bgYellow:()=>wl,black:()=>pl,blue:()=>Fe,bold:()=>H,cyan:()=>be,dim:()=>_e,gray:()=>Ct,green:()=>Tt,grey:()=>fl,hidden:()=>ul,inverse:()=>ll,italic:()=>al,magenta:()=>ml,red:()=>Ee,reset:()=>sl,strikethrough:()=>cl,underline:()=>Y,white:()=>dl,yellow:()=>Me});var An,Vi,$i,qi,ji=!0;typeof process<"u"&&({FORCE_COLOR:An,NODE_DISABLE_COLORS:Vi,NO_COLOR:$i,TERM:qi}=process.env||{},ji=process.stdout&&process.stdout.isTTY);var Ui={enabled:!Vi&&$i==null&&qi!=="dumb"&&(An!=null&&An!=="0"||ji)};function N(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Ui.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var sl=N(0,0),H=N(1,22),_e=N(2,22),al=N(3,23),Y=N(4,24),ll=N(7,27),ul=N(8,28),cl=N(9,29),pl=N(30,39),Ee=N(31,39),Tt=N(32,39),Me=N(33,39),Fe=N(34,39),ml=N(35,39),be=N(36,39),dl=N(37,39),Ct=N(90,39),fl=N(90,39),gl=N(40,49),hl=N(41,49),yl=N(42,49),wl=N(43,49),El=N(44,49),bl=N(45,49),xl=N(46,49),Pl=N(47,49);var vl=100,Bi=["green","yellow","blue","magenta","cyan","red"],At=[],Qi=Date.now(),Tl=0,Rn=typeof process<"u"?process.env:{};globalThis.DEBUG??=Rn.DEBUG??"";globalThis.DEBUG_COLORS??=Rn.DEBUG_COLORS?Rn.DEBUG_COLORS==="true":!0;var Rt={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function Cl(e){let t={color:Bi[Tl++%Bi.length],enabled:Rt.enabled(e),namespace:e,log:Rt.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&&At.push([o,...n]),At.length>vl&&At.shift(),Rt.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:Al(c)),u=`+${Date.now()-Qi}ms`;Qi=Date.now(),globalThis.DEBUG_COLORS?a(br[s](H(o)),...l,br[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var Sn=new Proxy(Cl,{get:(e,t)=>Rt[t],set:(e,t,r)=>Rt[t]=r});function Al(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function Ji(e=7500){let t=At.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
4
- `);return t.length<e?t:t.slice(-e)}function Gi(){At.length=0}var M=Sn;var Sl=Wi(),kn=Sl.version;var _n=B(Zi()),Pr=B(require("fs"));var We=B(require("path"));function Xi(e){let t=e.ignoreProcessEnv?{}:process.env,r=n=>n.match(/(.?\${(?:[a-zA-Z0-9_]+)?})/g)?.reduce(function(o,s){let a=/(.?)\${([a-zA-Z0-9_]+)?}/g.exec(s);if(!a)return o;let l=a[1],u,c;if(l==="\\")c=a[0],u=c.replace("\\$","$");else{let p=a[2];c=a[0].substring(l.length),u=Object.hasOwnProperty.call(t,p)?t[p]:e.parsed[p]||"",u=r(u)}return o.replace(c,u)},n)??n;for(let n in e.parsed){let i=Object.hasOwnProperty.call(t,n)?t[n]:e.parsed[n];e.parsed[n]=r(i)}for(let n in e.parsed)t[n]=e.parsed[n];return e}var Nn=M("prisma:tryLoadEnv");function St({rootEnvPath:e,schemaEnvPath:t},r={conflictCheck:"none"}){let n=eo(e);r.conflictCheck!=="none"&&Ql(n,t,r.conflictCheck);let i=null;return to(n?.path,t)||(i=eo(t)),!n&&!i&&Nn("No Environment variables loaded"),i?.dotenvResult.error?console.error(Ee(H("Schema Env Error: "))+i.dotenvResult.error):{message:[n?.message,i?.message].filter(Boolean).join(`
5
- `),parsed:{...n?.dotenvResult?.parsed,...i?.dotenvResult?.parsed}}}function Ql(e,t,r){let n=e?.dotenvResult.parsed,i=!to(e?.path,t);if(n&&t&&i&&Pr.default.existsSync(t)){let o=_n.default.parse(Pr.default.readFileSync(t)),s=[];for(let a in o)n[a]===o[a]&&s.push(a);if(s.length>0){let a=We.default.relative(process.cwd(),e.path),l=We.default.relative(process.cwd(),t);if(r==="error"){let u=`There is a conflict between env var${s.length>1?"s":""} in ${Y(a)} and ${Y(l)}
3
+ `),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function Ml(e){let t=Zi(e),r=L.configDotenv({path:t});if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=Yi(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),l=Vl(r,a);o=L.decrypt(l.ciphertext,l.key);break}catch(a){if(s+1>=i)throw a}return L.parse(o)}function Fl(e){console.log(`[dotenv@${Nn}][INFO] ${e}`)}function Ll(e){console.log(`[dotenv@${Nn}][WARN] ${e}`)}function xr(e){console.log(`[dotenv@${Nn}][DEBUG] ${e}`)}function Yi(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Vl(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function Zi(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)In.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=Dn.resolve(process.cwd(),".env.vault");return In.existsSync(t)?t:null}function zi(e){return e[0]==="~"?Dn.join(Ol.homedir(),e.slice(1)):e}function $l(e){Fl("Loading env from encrypted .env.vault");let t=L._parseVault(e),r=process.env;return e&&e.processEnv!=null&&(r=e.processEnv),L.populate(r,t,e),{parsed:t}}function ql(e){let t=Dn.resolve(process.cwd(),".env"),r="utf8",n=!!(e&&e.debug);e&&e.encoding?r=e.encoding:n&&xr("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[zi(e.path)];else{i=[];for(let l of e.path)i.push(zi(l))}let o,s={};for(let l of i)try{let u=L.parse(In.readFileSync(l,{encoding:r}));L.populate(s,u,e)}catch(u){n&&xr(`Failed to load ${l} ${u.message}`),o=u}let a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),L.populate(a,s,e),o?{parsed:s,error:o}:{parsed:s}}function jl(e){if(Yi(e).length===0)return L.configDotenv(e);let t=Zi(e);return t?L._configVault(e):(Ll(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),L.configDotenv(e))}function Ul(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=Il.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,l=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(u){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw s}}function Bl(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override);if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o]),n&&xr(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=t[o]}var L={configDotenv:ql,_configVault:$l,_parseVault:Ml,config:jl,decrypt:Ul,parse:_l,populate:Bl};xe.exports.configDotenv=L.configDotenv;xe.exports._configVault=L._configVault;xe.exports._parseVault=L._parseVault;xe.exports.config=L.config;xe.exports.decrypt=L.decrypt;xe.exports.parse=L.parse;xe.exports.populate=L.populate;xe.exports=L});var oo=oe((Lm,io)=>{"use strict";io.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var ao=oe((Vm,so)=>{"use strict";var Wl=oo();so.exports=e=>{let t=Wl(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}});var co=oe((Jm,uo)=>{"use strict";uo.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var fo=oe((Wm,mo)=>{"use strict";mo.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var $n=oe((Hm,go)=>{"use strict";var Zl=fo();go.exports=e=>typeof e=="string"?e.replace(Zl(),""):e});var ho=oe((zm,Tr)=>{"use strict";Tr.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};Tr.exports.default=Tr.exports});var Hn=oe((sf,$o)=>{"use strict";$o.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,m,f,g,h,R,P,T,v,k=[];for(l=0;l<i;l++)k.push(l+1),k.push(t.charCodeAt(s+l));for(var A=k.length-1;a<o-3;)for(R=r.charCodeAt(s+(u=a)),P=r.charCodeAt(s+(c=a+1)),T=r.charCodeAt(s+(p=a+2)),v=r.charCodeAt(s+(m=a+3)),f=a+=4,l=0;l<A;l+=2)g=k[l],h=k[l+1],u=e(g,u,c,R,h),c=e(u,c,p,P,h),p=e(c,p,m,T,h),f=e(p,m,f,v,h),k[l]=f,m=p,p=c,c=u,u=g;for(;a<o;)for(R=r.charCodeAt(s+(u=a)),f=++a,l=0;l<A;l+=2)g=k[l],k[l]=f=e(g,u,f,R,k[l+1]),u=g;return f}}()});var hs=oe((th,Wc)=>{Wc.exports={name:"@prisma/engines-version",version:"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"08b0da61b89855d81a37b120c20ccb3019379e22"},repository:{type:"git",url:"https://github.com/prisma/engines-wrapper.git",directory:"packages/engines-version"},devDependencies:{"@types/node":"18.19.68",typescript:"4.9.5"},files:["index.js","index.d.ts"],scripts:{build:"tsc -d"}}});var gm={};vt(gm,{Debug:()=>kn,Decimal:()=>me,Extensions:()=>Cn,MetricsClient:()=>ut,PrismaClientInitializationError:()=>S,PrismaClientKnownRequestError:()=>Q,PrismaClientRustPanicError:()=>se,PrismaClientUnknownRequestError:()=>J,PrismaClientValidationError:()=>G,Public:()=>An,Sql:()=>X,createParam:()=>ss,defineDmmfProperty:()=>ds,deserializeJsonResponse:()=>Ze,deserializeRawResult:()=>bn,dmmfToRuntimeDataModel:()=>ms,empty:()=>ws,getPrismaClient:()=>Ya,getRuntime:()=>on,join:()=>ys,makeStrictEnum:()=>Za,makeTypedQueryFactory:()=>fs,objectEnumValues:()=>Br,raw:()=>si,serializeJsonQuery:()=>zr,skip:()=>Kr,sqltag:()=>ai,warnEnvConflicts:()=>Xa,warnOnce:()=>Nt});module.exports=ol(gm);var Cn={};vt(Cn,{defineExtension:()=>Fi,getExtensionContext:()=>Li});function Fi(e){return typeof e=="function"?e:t=>t.$extends(e)}function Li(e){return e}var An={};vt(An,{validator:()=>Vi});function Vi(...e){return t=>t}var br={};vt(br,{$:()=>Bi,bgBlack:()=>gl,bgBlue:()=>El,bgCyan:()=>xl,bgGreen:()=>yl,bgMagenta:()=>bl,bgRed:()=>hl,bgWhite:()=>Pl,bgYellow:()=>wl,black:()=>pl,blue:()=>Fe,bold:()=>H,cyan:()=>be,dim:()=>_e,gray:()=>Ct,green:()=>Tt,grey:()=>fl,hidden:()=>ul,inverse:()=>ll,italic:()=>al,magenta:()=>ml,red:()=>Ee,reset:()=>sl,strikethrough:()=>cl,underline:()=>Y,white:()=>dl,yellow:()=>Me});var Rn,$i,qi,ji,Ui=!0;typeof process<"u"&&({FORCE_COLOR:Rn,NODE_DISABLE_COLORS:$i,NO_COLOR:qi,TERM:ji}=process.env||{},Ui=process.stdout&&process.stdout.isTTY);var Bi={enabled:!$i&&qi==null&&ji!=="dumb"&&(Rn!=null&&Rn!=="0"||Ui)};function N(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Bi.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var sl=N(0,0),H=N(1,22),_e=N(2,22),al=N(3,23),Y=N(4,24),ll=N(7,27),ul=N(8,28),cl=N(9,29),pl=N(30,39),Ee=N(31,39),Tt=N(32,39),Me=N(33,39),Fe=N(34,39),ml=N(35,39),be=N(36,39),dl=N(37,39),Ct=N(90,39),fl=N(90,39),gl=N(40,49),hl=N(41,49),yl=N(42,49),wl=N(43,49),El=N(44,49),bl=N(45,49),xl=N(46,49),Pl=N(47,49);var vl=100,Qi=["green","yellow","blue","magenta","cyan","red"],At=[],Ji=Date.now(),Tl=0,Sn=typeof process<"u"?process.env:{};globalThis.DEBUG??=Sn.DEBUG??"";globalThis.DEBUG_COLORS??=Sn.DEBUG_COLORS?Sn.DEBUG_COLORS==="true":!0;var Rt={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function Cl(e){let t={color:Qi[Tl++%Qi.length],enabled:Rt.enabled(e),namespace:e,log:Rt.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&&At.push([o,...n]),At.length>vl&&At.shift(),Rt.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:Al(c)),u=`+${Date.now()-Ji}ms`;Ji=Date.now(),globalThis.DEBUG_COLORS?a(br[s](H(o)),...l,br[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var kn=new Proxy(Cl,{get:(e,t)=>Rt[t],set:(e,t,r)=>Rt[t]=r});function Al(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function Gi(e=7500){let t=At.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
4
+ `);return t.length<e?t:t.slice(-e)}function Wi(){At.length=0}var M=kn;var Sl=Hi(),On=Sl.version;var Mn=B(Xi()),Pr=B(require("fs"));var We=B(require("path"));function eo(e){let t=e.ignoreProcessEnv?{}:process.env,r=n=>n.match(/(.?\${(?:[a-zA-Z0-9_]+)?})/g)?.reduce(function(o,s){let a=/(.?)\${([a-zA-Z0-9_]+)?}/g.exec(s);if(!a)return o;let l=a[1],u,c;if(l==="\\")c=a[0],u=c.replace("\\$","$");else{let p=a[2];c=a[0].substring(l.length),u=Object.hasOwnProperty.call(t,p)?t[p]:e.parsed[p]||"",u=r(u)}return o.replace(c,u)},n)??n;for(let n in e.parsed){let i=Object.hasOwnProperty.call(t,n)?t[n]:e.parsed[n];e.parsed[n]=r(i)}for(let n in e.parsed)t[n]=e.parsed[n];return e}var _n=M("prisma:tryLoadEnv");function St({rootEnvPath:e,schemaEnvPath:t},r={conflictCheck:"none"}){let n=to(e);r.conflictCheck!=="none"&&Ql(n,t,r.conflictCheck);let i=null;return ro(n?.path,t)||(i=to(t)),!n&&!i&&_n("No Environment variables loaded"),i?.dotenvResult.error?console.error(Ee(H("Schema Env Error: "))+i.dotenvResult.error):{message:[n?.message,i?.message].filter(Boolean).join(`
5
+ `),parsed:{...n?.dotenvResult?.parsed,...i?.dotenvResult?.parsed}}}function Ql(e,t,r){let n=e?.dotenvResult.parsed,i=!ro(e?.path,t);if(n&&t&&i&&Pr.default.existsSync(t)){let o=Mn.default.parse(Pr.default.readFileSync(t)),s=[];for(let a in o)n[a]===o[a]&&s.push(a);if(s.length>0){let a=We.default.relative(process.cwd(),e.path),l=We.default.relative(process.cwd(),t);if(r==="error"){let u=`There is a conflict between env var${s.length>1?"s":""} in ${Y(a)} and ${Y(l)}
6
6
  Conflicting env vars:
7
7
  ${s.map(c=>` ${H(c)}`).join(`
8
8
  `)}
@@ -10,24 +10,24 @@ ${s.map(c=>` ${H(c)}`).join(`
10
10
  We suggest to move the contents of ${Y(l)} to ${Y(a)} to consolidate your env vars.
11
11
  `;throw new Error(u)}else if(r==="warn"){let u=`Conflict for env var${s.length>1?"s":""} ${s.map(c=>H(c)).join(", ")} in ${Y(a)} and ${Y(l)}
12
12
  Env vars from ${Y(l)} overwrite the ones from ${Y(a)}
13
- `;console.warn(`${Me("warn(prisma)")} ${u}`)}}}}function eo(e){if(Jl(e)){Nn(`Environment variables loaded from ${e}`);let t=_n.default.config({path:e,debug:process.env.DOTENV_CONFIG_DEBUG?!0:void 0});return{dotenvResult:Xi(t),message:_e(`Environment variables loaded from ${We.default.relative(process.cwd(),e)}`),path:e}}else Nn(`Environment variables not found at ${e}`);return null}function to(e,t){return e&&t&&We.default.resolve(e)===We.default.resolve(t)}function Jl(e){return!!(e&&Pr.default.existsSync(e))}var ro="library";function He(e){let t=Gl();return t||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":e?.config.engineType==="client"?"client":ro)}function Gl(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":e==="client"?"client":void 0}var ao="prisma+postgres",vr=`${ao}:`;function Mn(e){return e?.startsWith(`${vr}//`)??!1}var kt;(t=>{let e;(A=>(A.findUnique="findUnique",A.findUniqueOrThrow="findUniqueOrThrow",A.findFirst="findFirst",A.findFirstOrThrow="findFirstOrThrow",A.findMany="findMany",A.create="create",A.createMany="createMany",A.createManyAndReturn="createManyAndReturn",A.update="update",A.updateMany="updateMany",A.updateManyAndReturn="updateManyAndReturn",A.upsert="upsert",A.delete="delete",A.deleteMany="deleteMany",A.groupBy="groupBy",A.count="count",A.aggregate="aggregate",A.findRaw="findRaw",A.aggregateRaw="aggregateRaw"))(e=t.ModelAction||={})})(kt||={});var Ot=B(require("path"));function Fn(e){return Ot.default.sep===Ot.default.posix.sep?e:e.split(Ot.default.sep).join(Ot.default.posix.sep)}var Dt={};vt(Dt,{error:()=>zl,info:()=>Kl,log:()=>Hl,query:()=>Yl,should:()=>co,tags:()=>It,warn:()=>Ln});var It={error:Ee("prisma:error"),warn:Me("prisma:warn"),info:be("prisma:info"),query:Fe("prisma:query")},co={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function Hl(...e){console.log(...e)}function Ln(e,...t){co.warn()&&console.warn(`${It.warn} ${e}`,...t)}function Kl(e,...t){console.info(`${It.info} ${e}`,...t)}function zl(e,...t){console.error(`${It.error} ${e}`,...t)}function Yl(e,...t){console.log(`${It.query} ${e}`,...t)}function re(e,t){throw new Error(t)}function $n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qn=(e,t)=>e.reduce((r,n)=>(r[t(n)]=n,r),{});function Ke(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function jn(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}function b(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var ho=new Set,Nt=(e,t,...r)=>{ho.has(e)||(ho.add(e),Ln(t,...r))};var S=class e extends Error{constructor(t,r,n){super(t),this.name="PrismaClientInitializationError",this.clientVersion=r,this.errorCode=n,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};b(S,"PrismaClientInitializationError");var Q=class extends Error{constructor(t,{code:r,clientVersion:n,meta:i,batchRequestIdx:o}){super(t),this.name="PrismaClientKnownRequestError",this.code=r,this.clientVersion=n,this.meta=i,Object.defineProperty(this,"batchRequestIdx",{value:o,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};b(Q,"PrismaClientKnownRequestError");var se=class extends Error{constructor(t,r){super(t),this.name="PrismaClientRustPanicError",this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};b(se,"PrismaClientRustPanicError");var J=class extends Error{constructor(t,{clientVersion:r,batchRequestIdx:n}){super(t),this.name="PrismaClientUnknownRequestError",this.clientVersion=r,Object.defineProperty(this,"batchRequestIdx",{value:n,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};b(J,"PrismaClientUnknownRequestError");var G=class extends Error{constructor(r,{clientVersion:n}){super(r);this.name="PrismaClientValidationError";this.clientVersion=n}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};b(G,"PrismaClientValidationError");var ze=9e15,ke=1e9,Un="0123456789abcdef",Rr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Sr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Bn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ze,maxE:ze,crypto:!1},xo,Pe,E=!0,Or="[DecimalError] ",Se=Or+"Invalid argument: ",Po=Or+"Precision limit exceeded",vo=Or+"crypto unavailable",To="[object Decimal]",W=Math.floor,V=Math.pow,Xl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,eu=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,tu=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Co=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ae=1e7,w=7,ru=9007199254740991,nu=Rr.length-1,Qn=Sr.length-1,d={toStringTag:To};d.absoluteValue=d.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),y(e)};d.ceil=function(){return y(new this.constructor(this),this.e+1,2)};d.clampedTo=d.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Se+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};d.comparedTo=d.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,l=o.s,u=e.s;if(!s||!a)return!l||!u?NaN:l!==u?l:s===a?0:!s^l<0?1:-1;if(!s[0]||!a[0])return s[0]?l:a[0]?-u:0;if(l!==u)return l;if(o.e!==e.e)return o.e>e.e^l<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};d.cosine=d.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+w,n.rounding=1,r=iu(n,Oo(n,r)),n.precision=e,n.rounding=t,y(Pe==2||Pe==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};d.cubeRoot=d.cbrt=function(){var e,t,r,n,i,o,s,a,l,u,c=this,p=c.constructor;if(!c.isFinite()||c.isZero())return new p(c);for(E=!1,o=c.s*V(c.s*c,1/3),!o||Math.abs(o)==1/0?(r=q(c.d),e=c.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=V(r,1/3),e=W((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new p(r),n.s=c.s):n=new p(o.toString()),s=(e=p.precision)+3;;)if(a=n,l=a.times(a).times(a),u=l.plus(c),n=D(u.plus(c).times(a),u.plus(l),s+2,1),q(a.d).slice(0,s)===(r=q(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(y(a,e+1,0),a.times(a).times(a).eq(c))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(y(n,e+1,1),t=!n.times(n).times(n).eq(c));break}return E=!0,y(n,e,p.rounding,t)};d.decimalPlaces=d.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-W(this.e/w))*w,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};d.dividedBy=d.div=function(e){return D(this,new this.constructor(e))};d.dividedToIntegerBy=d.divToInt=function(e){var t=this,r=t.constructor;return y(D(t,new r(e),0,1,1),r.precision,r.rounding)};d.equals=d.eq=function(e){return this.cmp(e)===0};d.floor=function(){return y(new this.constructor(this),this.e+1,3)};d.greaterThan=d.gt=function(e){return this.cmp(e)>0};d.greaterThanOrEqualTo=d.gte=function(e){var t=this.cmp(e);return t==1||t===0};d.hyperbolicCosine=d.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Dr(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=Ye(s,1,o.times(t),new s(1),!0);for(var l,u=e,c=new s(8);u--;)l=o.times(o),o=a.minus(l.times(c.minus(l.times(c))));return y(o,s.precision=r,s.rounding=n,!0)};d.hyperbolicSine=d.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=Ye(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Dr(5,e)),i=Ye(o,2,i,i,!0);for(var s,a=new o(5),l=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(l.times(s).plus(u))))}return o.precision=t,o.rounding=r,y(i,t,r,!0)};d.hyperbolicTangent=d.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,D(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};d.inverseCosine=d.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?ce(t,n,i):new t(0):new t(NaN):e.isZero()?ce(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))};d.inverseHyperbolicCosine=d.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,E=!1,r=r.times(r).minus(1).sqrt().plus(r),E=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};d.inverseHyperbolicSine=d.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,E=!1,r=r.times(r).plus(1).sqrt().plus(r),E=!0,n.precision=e,n.rounding=t,r.ln())};d.inverseHyperbolicTangent=d.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?y(new o(i),e,t,!0):(o.precision=r=n-i.e,i=D(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)};d.inverseSine=d.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=ce(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))};d.inverseTangent=d.atan=function(){var e,t,r,n,i,o,s,a,l,u=this,c=u.constructor,p=c.precision,m=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&p+4<=Qn)return s=ce(c,p+4,m).times(.25),s.s=u.s,s}else{if(!u.s)return new c(NaN);if(p+4<=Qn)return s=ce(c,p+4,m).times(.5),s.s=u.s,s}for(c.precision=a=p+10,c.rounding=1,r=Math.min(28,a/w+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(E=!1,t=Math.ceil(a/w),n=1,l=u.times(u),s=new c(u),i=u;e!==-1;)if(i=i.times(l),o=s.minus(i.div(n+=2)),i=i.times(l),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),E=!0,y(s,c.precision=p,c.rounding=m,!0)};d.isFinite=function(){return!!this.d};d.isInteger=d.isInt=function(){return!!this.d&&W(this.e/w)>this.d.length-2};d.isNaN=function(){return!this.s};d.isNegative=d.isNeg=function(){return this.s<0};d.isPositive=d.isPos=function(){return this.s>0};d.isZero=function(){return!!this.d&&this.d[0]===0};d.lessThan=d.lt=function(e){return this.cmp(e)<0};d.lessThanOrEqualTo=d.lte=function(e){return this.cmp(e)<1};d.logarithm=d.log=function(e){var t,r,n,i,o,s,a,l,u=this,c=u.constructor,p=c.precision,m=c.rounding,f=5;if(e==null)e=new c(10),t=!0;else{if(e=new c(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(E=!1,a=p+f,s=Re(u,a),n=t?kr(c,a+10):Re(e,a),l=D(s,n,a,1),_t(l.d,i=p,m))do if(a+=10,s=Re(u,a),n=t?kr(c,a+10):Re(e,a),l=D(s,n,a,1),!o){+q(l.d).slice(i+1,i+15)+1==1e14&&(l=y(l,p+1,0));break}while(_t(l.d,i+=10,m));return E=!0,y(l,p,m)};d.minus=d.sub=function(e){var t,r,n,i,o,s,a,l,u,c,p,m,f=this,g=f.constructor;if(e=new g(e),!f.d||!e.d)return!f.s||!e.s?e=new g(NaN):f.d?e.s=-e.s:e=new g(e.d||f.s!==e.s?f:NaN),e;if(f.s!=e.s)return e.s=-e.s,f.plus(e);if(u=f.d,m=e.d,a=g.precision,l=g.rounding,!u[0]||!m[0]){if(m[0])e.s=-e.s;else if(u[0])e=new g(f);else return new g(l===3?-0:0);return E?y(e,a,l):e}if(r=W(e.e/w),c=W(f.e/w),u=u.slice(),o=c-r,o){for(p=o<0,p?(t=u,o=-o,s=m.length):(t=m,r=c,s=u.length),n=Math.max(Math.ceil(a/w),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=m.length,p=n<s,p&&(s=n),n=0;n<s;n++)if(u[n]!=m[n]){p=u[n]<m[n];break}o=0}for(p&&(t=u,u=m,m=t,e.s=-e.s),s=u.length,n=m.length-s;n>0;--n)u[s++]=0;for(n=m.length;n>o;){if(u[--n]<m[n]){for(i=n;i&&u[--i]===0;)u[i]=ae-1;--u[i],u[n]+=ae}u[n]-=m[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Ir(u,r),E?y(e,a,l):e):new g(l===3?-0:0)};d.modulo=d.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?y(new n(r),n.precision,n.rounding):(E=!1,n.modulo==9?(t=D(r,e.abs(),0,3,1),t.s*=e.s):t=D(r,e,0,n.modulo,1),t=t.times(e),E=!0,r.minus(t))};d.naturalExponential=d.exp=function(){return Jn(this)};d.naturalLogarithm=d.ln=function(){return Re(this)};d.negated=d.neg=function(){var e=new this.constructor(this);return e.s=-e.s,y(e)};d.plus=d.add=function(e){var t,r,n,i,o,s,a,l,u,c,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d||(e=new m(e.d||p.s===e.s?p:NaN)),e;if(p.s!=e.s)return e.s=-e.s,p.minus(e);if(u=p.d,c=e.d,a=m.precision,l=m.rounding,!u[0]||!c[0])return c[0]||(e=new m(p)),E?y(e,a,l):e;if(o=W(p.e/w),n=W(e.e/w),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=c.length):(r=c,n=o,s=u.length),o=Math.ceil(a/w),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=c.length,s-i<0&&(i=s,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/ae|0,u[i]%=ae;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=Ir(u,n),E?y(e,a,l):e};d.precision=d.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Se+e);return r.d?(t=Ao(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};d.round=function(){var e=this,t=e.constructor;return y(new t(e),e.e+1,t.rounding)};d.sine=d.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+w,n.rounding=1,r=su(n,Oo(n,r)),n.precision=e,n.rounding=t,y(Pe>2?r.neg():r,e,t,!0)):new n(NaN)};d.squareRoot=d.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,l=s.e,u=s.s,c=s.constructor;if(u!==1||!a||!a[0])return new c(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(E=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=q(a),(t.length+l)%2==0&&(t+="0"),u=Math.sqrt(t),l=W((l+1)/2)-(l<0||l%2),u==1/0?t="5e"+l:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+l),n=new c(t)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(o=n,n=o.plus(D(s,o,r+2,1)).times(.5),q(o.d).slice(0,r)===(t=q(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(y(o,l+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(y(n,l+1,1),e=!n.times(n).eq(s));break}return E=!0,y(n,l,c.rounding,e)};d.tangent=d.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=D(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,y(Pe==2||Pe==4?r.neg():r,e,t,!0)):new n(NaN)};d.times=d.mul=function(e){var t,r,n,i,o,s,a,l,u,c=this,p=c.constructor,m=c.d,f=(e=new p(e)).d;if(e.s*=c.s,!m||!m[0]||!f||!f[0])return new p(!e.s||m&&!m[0]&&!f||f&&!f[0]&&!m?NaN:!m||!f?e.s/0:e.s*0);for(r=W(c.e/w)+W(e.e/w),l=m.length,u=f.length,l<u&&(o=m,m=f,f=o,s=l,l=u,u=s),o=[],s=l+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=l+n;i>n;)a=o[i]+f[n]*m[i-n-1]+t,o[i--]=a%ae|0,t=a/ae|0;o[i]=(o[i]+t)%ae|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=Ir(o,r),E?y(e,p.precision,p.rounding):e};d.toBinary=function(e,t){return Gn(this,2,e,t)};d.toDecimalPlaces=d.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Z(e,0,ke),t===void 0?t=n.rounding:Z(t,0,8),y(r,e+r.e+1,t))};d.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=pe(n,!0):(Z(e,0,ke),t===void 0?t=i.rounding:Z(t,0,8),n=y(new i(n),e+1,t),r=pe(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};d.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=pe(i):(Z(e,0,ke),t===void 0?t=o.rounding:Z(t,0,8),n=y(new o(i),e+i.e+1,t),r=pe(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};d.toFraction=function(e){var t,r,n,i,o,s,a,l,u,c,p,m,f=this,g=f.d,h=f.constructor;if(!g)return new h(f);if(u=r=new h(1),n=l=new h(0),t=new h(n),o=t.e=Ao(g)-f.e-1,s=o%w,t.d[0]=V(10,s<0?w+s:s),e==null)e=o>0?t:u;else{if(a=new h(e),!a.isInt()||a.lt(u))throw Error(Se+a);e=a.gt(t)?o>0?t:u:a}for(E=!1,a=new h(q(g)),c=h.precision,h.precision=o=g.length*w*2;p=D(a,t,0,1,1),i=r.plus(p.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=l.plus(p.times(i)),l=i,i=t,t=a.minus(p.times(i)),a=i;return i=D(e.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=f.s,m=D(u,n,o,1).minus(f).abs().cmp(D(l,r,o,1).minus(f).abs())<1?[u,n]:[l,r],h.precision=c,E=!0,m};d.toHexadecimal=d.toHex=function(e,t){return Gn(this,16,e,t)};d.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Z(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(E=!1,r=D(r,e,0,t,1).times(e),E=!0,y(r)):(e.s=r.s,r=e),r};d.toNumber=function(){return+this};d.toOctal=function(e,t){return Gn(this,8,e,t)};d.toPower=d.pow=function(e){var t,r,n,i,o,s,a=this,l=a.constructor,u=+(e=new l(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new l(V(+a,u));if(a=new l(a),a.eq(1))return a;if(n=l.precision,o=l.rounding,e.eq(1))return y(a,n,o);if(t=W(e.e/w),t>=e.d.length-1&&(r=u<0?-u:u)<=ru)return i=Ro(l,a,r,n),e.s<0?new l(1).div(i):y(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new l(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=V(+a,u),t=r==0||!isFinite(r)?W(u*(Math.log("0."+q(a.d))/Math.LN10+a.e+1)):new l(r+"").e,t>l.maxE+1||t<l.minE-1?new l(t>0?s/0:0):(E=!1,l.rounding=a.s=1,r=Math.min(12,(t+"").length),i=Jn(e.times(Re(a,n+r)),n),i.d&&(i=y(i,n+5,1),_t(i.d,n,o)&&(t=n+10,i=y(Jn(e.times(Re(a,t+r)),t),t+5,1),+q(i.d).slice(n+1,n+15)+1==1e14&&(i=y(i,n+1,0)))),i.s=s,E=!0,l.rounding=o,y(i,n,o))};d.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=pe(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Z(e,1,ke),t===void 0?t=i.rounding:Z(t,0,8),n=y(new i(n),e,t),r=pe(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};d.toSignificantDigits=d.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Z(e,1,ke),t===void 0?t=n.rounding:Z(t,0,8)),y(new n(r),e,t)};d.toString=function(){var e=this,t=e.constructor,r=pe(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};d.truncated=d.trunc=function(){return y(new this.constructor(this),this.e+1,1)};d.valueOf=d.toJSON=function(){var e=this,t=e.constructor,r=pe(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function q(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=w-n.length,r&&(o+=Ae(r)),o+=n;s=e[t],n=s+"",r=w-n.length,r&&(o+=Ae(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Z(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Se+e)}function _t(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=w,i=0):(i=Math.ceil((t+1)/w),t%=w),o=V(10,w-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==V(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==V(10,t-3)-1,s}function Cr(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=Un.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function iu(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Dr(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Ye(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var D=function(){function e(n,i,o){var s,a=0,l=n.length;for(n=n.slice();l--;)s=n[l]*i+a,n[l]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,l;if(o!=s)l=o>s?1:-1;else for(a=l=0;a<o;a++)if(n[a]!=i[a]){l=n[a]>i[a]?1:-1;break}return l}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,l){var u,c,p,m,f,g,h,R,P,T,v,k,A,te,Pt,F,z,we,j,Je,wr=n.constructor,xn=n.s==i.s?1:-1,U=n.d,I=i.d;if(!U||!U[0]||!I||!I[0])return new wr(!n.s||!i.s||(U?I&&U[0]==I[0]:!I)?NaN:U&&U[0]==0||!I?xn*0:xn/0);for(l?(f=1,c=n.e-i.e):(l=ae,f=w,c=W(n.e/f)-W(i.e/f)),j=I.length,z=U.length,P=new wr(xn),T=P.d=[],p=0;I[p]==(U[p]||0);p++);if(I[p]>(U[p]||0)&&c--,o==null?(te=o=wr.precision,s=wr.rounding):a?te=o+(n.e-i.e)+1:te=o,te<0)T.push(1),g=!0;else{if(te=te/f+2|0,p=0,j==1){for(m=0,I=I[0],te++;(p<z||m)&&te--;p++)Pt=m*l+(U[p]||0),T[p]=Pt/I|0,m=Pt%I|0;g=m||p<z}else{for(m=l/(I[0]+1)|0,m>1&&(I=e(I,m,l),U=e(U,m,l),j=I.length,z=U.length),F=j,v=U.slice(0,j),k=v.length;k<j;)v[k++]=0;Je=I.slice(),Je.unshift(0),we=I[0],I[1]>=l/2&&++we;do m=0,u=t(I,v,j,k),u<0?(A=v[0],j!=k&&(A=A*l+(v[1]||0)),m=A/we|0,m>1?(m>=l&&(m=l-1),h=e(I,m,l),R=h.length,k=v.length,u=t(h,v,R,k),u==1&&(m--,r(h,j<R?Je:I,R,l))):(m==0&&(u=m=1),h=I.slice()),R=h.length,R<k&&h.unshift(0),r(v,h,k,l),u==-1&&(k=v.length,u=t(I,v,j,k),u<1&&(m++,r(v,j<k?Je:I,k,l))),k=v.length):u===0&&(m++,v=[0]),T[p++]=m,u&&v[0]?v[k++]=U[F]||0:(v=[U[F]],k=1);while((F++<z||v[0]!==void 0)&&te--);g=v[0]!==void 0}T[0]||T.shift()}if(f==1)P.e=c,xo=g;else{for(p=1,m=T[0];m>=10;m/=10)p++;P.e=p+c*f-1,y(P,a?o+P.e+1:o,s,g)}return P}}();function y(e,t,r,n){var i,o,s,a,l,u,c,p,m,f=e.constructor;e:if(t!=null){if(p=e.d,!p)return e;for(i=1,a=p[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=w,s=t,c=p[m=0],l=c/V(10,i-s-1)%10|0;else if(m=Math.ceil((o+1)/w),a=p.length,m>=a)if(n){for(;a++<=m;)p.push(0);c=l=0,i=1,o%=w,s=o-w+1}else break e;else{for(c=a=p[m],i=1;a>=10;a/=10)i++;o%=w,s=o-w+i,l=s<0?0:c/V(10,i-s-1)%10|0}if(n=n||t<0||p[m+1]!==void 0||(s<0?c:c%V(10,i-s-1)),u=r<4?(l||n)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(o>0?s>0?c/V(10,i-s):0:p[m-1])%10&1||r==(e.s<0?8:7)),t<1||!p[0])return p.length=0,u?(t-=e.e+1,p[0]=V(10,(w-t%w)%w),e.e=-t||0):p[0]=e.e=0,e;if(o==0?(p.length=m,a=1,m--):(p.length=m+1,a=V(10,w-o),p[m]=s>0?(c/V(10,i-s)%V(10,s)|0)*a:0),u)for(;;)if(m==0){for(o=1,s=p[0];s>=10;s/=10)o++;for(s=p[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,p[0]==ae&&(p[0]=1));break}else{if(p[m]+=a,p[m]!=ae)break;p[m--]=0,a=1}for(o=p.length;p[--o]===0;)p.pop()}return E&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function pe(e,t,r){if(!e.isFinite())return ko(e);var n,i=e.e,o=q(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+Ae(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Ae(-i-1)+o,r&&(n=r-s)>0&&(o+=Ae(n))):i>=s?(o+=Ae(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+Ae(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=Ae(n))),o}function Ir(e,t){var r=e[0];for(t*=w;r>=10;r/=10)t++;return t}function kr(e,t,r){if(t>nu)throw E=!0,r&&(e.precision=r),Error(Po);return y(new e(Rr),t,1,!0)}function ce(e,t,r){if(t>Qn)throw Error(Po);return y(new e(Sr),t,r,!0)}function Ao(e){var t=e.length-1,r=t*w+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Ae(e){for(var t="";e--;)t+="0";return t}function Ro(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/w+4);for(E=!1;;){if(r%2&&(o=o.times(t),Eo(o.d,s)&&(i=!0)),r=W(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),Eo(t.d,s)}return E=!0,o}function wo(e){return e.d[e.d.length-1]&1}function So(e,t,r){for(var n,i,o=new e(t[0]),s=0;++s<t.length;){if(i=new e(t[s]),!i.s){o=i;break}n=o.cmp(i),(n===r||n===0&&o.s===r)&&(o=i)}return o}function Jn(e,t){var r,n,i,o,s,a,l,u=0,c=0,p=0,m=e.constructor,f=m.rounding,g=m.precision;if(!e.d||!e.d[0]||e.e>17)return new m(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(E=!1,l=g):l=t,a=new m(.03125);e.e>-2;)e=e.times(a),p+=5;for(n=Math.log(V(2,p))/Math.LN10*2+5|0,l+=n,r=o=s=new m(1),m.precision=l;;){if(o=y(o.times(e),l,1),r=r.times(++c),a=s.plus(D(o,r,l,1)),q(a.d).slice(0,l)===q(s.d).slice(0,l)){for(i=p;i--;)s=y(s.times(s),l,1);if(t==null)if(u<3&&_t(s.d,l-n,f,u))m.precision=l+=10,r=o=a=new m(1),c=0,u++;else return y(s,m.precision=g,f,E=!0);else return m.precision=g,s}s=a}}function Re(e,t){var r,n,i,o,s,a,l,u,c,p,m,f=1,g=10,h=e,R=h.d,P=h.constructor,T=P.rounding,v=P.precision;if(h.s<0||!R||!R[0]||!h.e&&R[0]==1&&R.length==1)return new P(R&&!R[0]?-1/0:h.s!=1?NaN:R?0:h);if(t==null?(E=!1,c=v):c=t,P.precision=c+=g,r=q(R),n=r.charAt(0),Math.abs(o=h.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=q(h.d),n=r.charAt(0),f++;o=h.e,n>1?(h=new P("0."+r),o++):h=new P(n+"."+r.slice(1))}else return u=kr(P,c+2,v).times(o+""),h=Re(new P(n+"."+r.slice(1)),c-g).plus(u),P.precision=v,t==null?y(h,v,T,E=!0):h;for(p=h,l=s=h=D(h.minus(1),h.plus(1),c,1),m=y(h.times(h),c,1),i=3;;){if(s=y(s.times(m),c,1),u=l.plus(D(s,new P(i),c,1)),q(u.d).slice(0,c)===q(l.d).slice(0,c))if(l=l.times(2),o!==0&&(l=l.plus(kr(P,c+2,v).times(o+""))),l=D(l,new P(f),c,1),t==null)if(_t(l.d,c-g,T,a))P.precision=c+=g,u=s=h=D(p.minus(1),p.plus(1),c,1),m=y(h.times(h),c,1),i=a=1;else return y(l,P.precision=v,T,E=!0);else return P.precision=v,l;l=u,i+=2}}function ko(e){return String(e.s*e.s/0)}function Ar(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%w,r<0&&(n+=w),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=w;n<i;)e.d.push(+t.slice(n,n+=w));t=t.slice(n),n=w-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),E&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function ou(e,t){var r,n,i,o,s,a,l,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Co.test(t))return Ar(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(eu.test(t))r=16,t=t.toLowerCase();else if(Xl.test(t))r=2;else if(tu.test(t))r=8;else throw Error(Se+t);for(o=t.search(/p/i),o>0?(l=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=Ro(n,new n(r),o,o*2)),u=Cr(t,r,ae),c=u.length-1,o=c;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=Ir(u,c),e.d=u,E=!1,s&&(e=D(e,i,a*4)),l&&(e=e.times(Math.abs(l)<54?V(2,l):Le.pow(2,l))),E=!0,e)}function su(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Ye(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Dr(5,r)),t=Ye(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function Ye(e,t,r,n,i){var o,s,a,l,u=1,c=e.precision,p=Math.ceil(c/w);for(E=!1,l=r.times(r),a=new e(n);;){if(s=D(a.times(l),new e(t++*t++),c,1),a=i?n.plus(s):n.minus(s),n=D(s.times(l),new e(t++*t++),c,1),s=a.plus(n),s.d[p]!==void 0){for(o=p;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,u++}return E=!0,s.d.length=p+1,s}function Dr(e,t){for(var r=e;--t;)r*=e;return r}function Oo(e,t){var r,n=t.s<0,i=ce(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return Pe=n?4:1,t;if(r=t.divToInt(i),r.isZero())Pe=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return Pe=wo(r)?n?2:3:n?4:1,t;Pe=wo(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Gn(e,t,r,n){var i,o,s,a,l,u,c,p,m,f=e.constructor,g=r!==void 0;if(g?(Z(r,1,ke),n===void 0?n=f.rounding:Z(n,0,8)):(r=f.precision,n=f.rounding),!e.isFinite())c=ko(e);else{for(c=pe(e),s=c.indexOf("."),g?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(c=c.replace(".",""),m=new f(1),m.e=c.length-s,m.d=Cr(pe(m),10,i),m.e=m.d.length),p=Cr(c,10,i),o=l=p.length;p[--l]==0;)p.pop();if(!p[0])c=g?"0p+0":"0";else{if(s<0?o--:(e=new f(e),e.d=p,e.e=o,e=D(e,m,r,n,0,i),p=e.d,o=e.e,u=xo),s=p[r],a=i/2,u=u||p[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&p[r-1]&1||n===(e.s<0?8:7)),p.length=r,u)for(;++p[--r]>i-1;)p[r]=0,r||(++o,p.unshift(1));for(l=p.length;!p[l-1];--l);for(s=0,c="";s<l;s++)c+=Un.charAt(p[s]);if(g){if(l>1)if(t==16||t==8){for(s=t==16?4:3,--l;l%s;l++)c+="0";for(p=Cr(c,i,t),l=p.length;!p[l-1];--l);for(s=1,c="1.";s<l;s++)c+=Un.charAt(p[s])}else c=c.charAt(0)+"."+c.slice(1);c=c+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)c="0"+c;c="0."+c}else if(++o>l)for(o-=l;o--;)c+="0";else o<l&&(c=c.slice(0,o)+"."+c.slice(o))}c=(t==16?"0x":t==2?"0b":t==8?"0o":"")+c}return e.s<0?"-"+c:c}function Eo(e,t){if(e.length>t)return e.length=t,!0}function au(e){return new this(e).abs()}function lu(e){return new this(e).acos()}function uu(e){return new this(e).acosh()}function cu(e,t){return new this(e).plus(t)}function pu(e){return new this(e).asin()}function mu(e){return new this(e).asinh()}function du(e){return new this(e).atan()}function fu(e){return new this(e).atanh()}function gu(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=ce(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?ce(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=ce(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(D(e,t,o,1)),t=ce(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(D(e,t,o,1)),r}function hu(e){return new this(e).cbrt()}function yu(e){return y(e=new this(e),e.e+1,2)}function wu(e,t,r){return new this(e).clamp(t,r)}function Eu(e){if(!e||typeof e!="object")throw Error(Or+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,ke,"rounding",0,8,"toExpNeg",-ze,0,"toExpPos",0,ze,"maxE",0,ze,"minE",-ze,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=Bn[r]),(n=e[r])!==void 0)if(W(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(Se+r+": "+n);if(r="crypto",i&&(this[r]=Bn[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(vo);else this[r]=!1;else throw Error(Se+r+": "+n);return this}function bu(e){return new this(e).cos()}function xu(e){return new this(e).cosh()}function Io(e){var t,r,n;function i(o){var s,a,l,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,bo(o)){u.s=o.s,E?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(l=typeof o,l==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;E?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Ar(u,o.toString())}if(l==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Co.test(o)?Ar(u,o):ou(u,o);if(l==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Ar(u,o.toString());throw Error(Se+o)}if(i.prototype=d,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Eu,i.clone=Io,i.isDecimal=bo,i.abs=au,i.acos=lu,i.acosh=uu,i.add=cu,i.asin=pu,i.asinh=mu,i.atan=du,i.atanh=fu,i.atan2=gu,i.cbrt=hu,i.ceil=yu,i.clamp=wu,i.cos=bu,i.cosh=xu,i.div=Pu,i.exp=vu,i.floor=Tu,i.hypot=Cu,i.ln=Au,i.log=Ru,i.log10=ku,i.log2=Su,i.max=Ou,i.min=Iu,i.mod=Du,i.mul=Nu,i.pow=_u,i.random=Mu,i.round=Fu,i.sign=Lu,i.sin=Vu,i.sinh=$u,i.sqrt=qu,i.sub=ju,i.sum=Uu,i.tan=Bu,i.tanh=Qu,i.trunc=Ju,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function Pu(e,t){return new this(e).div(t)}function vu(e){return new this(e).exp()}function Tu(e){return y(e=new this(e),e.e+1,3)}function Cu(){var e,t,r=new this(0);for(E=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return E=!0,new this(1/0);r=t}return E=!0,r.sqrt()}function bo(e){return e instanceof Le||e&&e.toStringTag===To||!1}function Au(e){return new this(e).ln()}function Ru(e,t){return new this(e).log(t)}function Su(e){return new this(e).log(2)}function ku(e){return new this(e).log(10)}function Ou(){return So(this,arguments,-1)}function Iu(){return So(this,arguments,1)}function Du(e,t){return new this(e).mod(t)}function Nu(e,t){return new this(e).mul(t)}function _u(e,t){return new this(e).pow(t)}function Mu(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Z(e,1,ke),n=Math.ceil(e/w),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(vo);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=w,n&&e&&(i=V(10,w-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=w)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<w&&(r-=w-n)}return s.e=r,s.d=a,s}function Fu(e){return y(e=new this(e),e.e+1,this.rounding)}function Lu(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Vu(e){return new this(e).sin()}function $u(e){return new this(e).sinh()}function qu(e){return new this(e).sqrt()}function ju(e,t){return new this(e).sub(t)}function Uu(){var e=0,t=arguments,r=new this(t[e]);for(E=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return E=!0,y(r,this.precision,this.rounding)}function Bu(e){return new this(e).tan()}function Qu(e){return new this(e).tanh()}function Ju(e){return y(e=new this(e),e.e+1,1)}d[Symbol.for("nodejs.util.inspect.custom")]=d.toString;d[Symbol.toStringTag]="Decimal";var Le=d.constructor=Io(Bn);Rr=new Le(Rr);Sr=new Le(Sr);var me=Le;function Ze(e){return e===null?e:Array.isArray(e)?e.map(Ze):typeof e=="object"?Gu(e)?Wu(e):Ke(e,Ze):e}function Gu(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Wu({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new me(t);case"Json":return JSON.parse(t);default:re(t,"Unknown tagged value")}}function Xe(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function et(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Nr(e){return e.toString()!=="Invalid Date"}function tt(e){return Le.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}var Lo=B(uo());var Fo=B(require("fs"));var Do={keyword:be,entity:be,value:e=>H(Fe(e)),punctuation:Fe,directive:be,function:be,variable:e=>H(Fe(e)),string:e=>H(Tt(e)),boolean:Me,number:be,comment:Ct};var Hu=e=>e,_r={},Ku=0,x={manual:_r.Prism&&_r.Prism.manual,disableWorkerMessageHandler:_r.Prism&&_r.Prism.disableWorkerMessageHandler,util:{encode:function(e){if(e instanceof le){let t=e;return new le(t.type,x.util.encode(t.content),t.alias)}else return Array.isArray(e)?e.map(x.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++Ku}),e.__id},clone:function e(t,r){let n,i,o=x.util.type(t);switch(r=r||{},o){case"Object":if(i=x.util.objId(t),r[i])return r[i];n={},r[i]=n;for(let s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return i=x.util.objId(t),r[i]?r[i]:(n=[],r[i]=n,t.forEach(function(s,a){n[a]=e(s,r)}),n);default:return t}}},languages:{extend:function(e,t){let r=x.util.clone(x.languages[e]);for(let n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){n=n||x.languages;let i=n[e],o={};for(let a in i)if(i.hasOwnProperty(a)){if(a==t)for(let l in r)r.hasOwnProperty(l)&&(o[l]=r[l]);r.hasOwnProperty(a)||(o[a]=i[a])}let s=n[e];return n[e]=o,x.languages.DFS(x.languages,function(a,l){l===s&&a!=e&&(this[a]=o)}),o},DFS:function e(t,r,n,i){i=i||{};let o=x.util.objId;for(let s in t)if(t.hasOwnProperty(s)){r.call(t,s,t[s],n||s);let a=t[s],l=x.util.type(a);l==="Object"&&!i[o(a)]?(i[o(a)]=!0,e(a,r,null,i)):l==="Array"&&!i[o(a)]&&(i[o(a)]=!0,e(a,r,s,i))}}},plugins:{},highlight:function(e,t,r){let n={code:e,grammar:t,language:r};return x.hooks.run("before-tokenize",n),n.tokens=x.tokenize(n.code,n.grammar),x.hooks.run("after-tokenize",n),le.stringify(x.util.encode(n.tokens),n.language)},matchGrammar:function(e,t,r,n,i,o,s){for(let h in r){if(!r.hasOwnProperty(h)||!r[h])continue;if(h==s)return;let R=r[h];R=x.util.type(R)==="Array"?R:[R];for(let P=0;P<R.length;++P){let T=R[P],v=T.inside,k=!!T.lookbehind,A=!!T.greedy,te=0,Pt=T.alias;if(A&&!T.pattern.global){let F=T.pattern.toString().match(/[imuy]*$/)[0];T.pattern=RegExp(T.pattern.source,F+"g")}T=T.pattern||T;for(let F=n,z=i;F<t.length;z+=t[F].length,++F){let we=t[F];if(t.length>e.length)return;if(we instanceof le)continue;if(A&&F!=t.length-1){T.lastIndex=z;var p=T.exec(e);if(!p)break;var c=p.index+(k?p[1].length:0),m=p.index+p[0].length,a=F,l=z;for(let I=t.length;a<I&&(l<m||!t[a].type&&!t[a-1].greedy);++a)l+=t[a].length,c>=l&&(++F,z=l);if(t[F]instanceof le)continue;u=a-F,we=e.slice(z,l),p.index-=z}else{T.lastIndex=0;var p=T.exec(we),u=1}if(!p){if(o)break;continue}k&&(te=p[1]?p[1].length:0);var c=p.index+te,p=p[0].slice(te),m=c+p.length,f=we.slice(0,c),g=we.slice(m);let j=[F,u];f&&(++F,z+=f.length,j.push(f));let Je=new le(h,v?x.tokenize(p,v):p,Pt,p,A);if(j.push(Je),g&&j.push(g),Array.prototype.splice.apply(t,j),u!=1&&x.matchGrammar(e,t,r,F,z,!0,h),o)break}}}},tokenize:function(e,t){let r=[e],n=t.rest;if(n){for(let i in n)t[i]=n[i];delete t.rest}return x.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){let r=x.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){let r=x.hooks.all[e];if(!(!r||!r.length))for(var n=0,i;i=r[n++];)i(t)}},Token:le};x.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};x.languages.javascript=x.languages.extend("clike",{"class-name":[x.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});x.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;x.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:x.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:x.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:x.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:x.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});x.languages.markup&&x.languages.markup.tag.addInlined("script","javascript");x.languages.js=x.languages.javascript;x.languages.typescript=x.languages.extend("javascript",{keyword:/\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/});x.languages.ts=x.languages.typescript;function le(e,t,r,n,i){this.type=e,this.content=t,this.alias=r,this.length=(n||"").length|0,this.greedy=!!i}le.stringify=function(e,t){return typeof e=="string"?e:Array.isArray(e)?e.map(function(r){return le.stringify(r,t)}).join(""):zu(e.type)(e.content)};function zu(e){return Do[e]||Hu}function No(e){return Yu(e,x.languages.javascript)}function Yu(e,t){return x.tokenize(e,t).map(n=>le.stringify(n)).join("")}var _o=B(so());function Mo(e){return(0,_o.default)(e)}var Mr=class e{static read(t){let r;try{r=Fo.default.readFileSync(t,"utf-8")}catch{return null}return e.fromContent(r)}static fromContent(t){let r=t.split(/\r?\n/);return new e(1,r)}constructor(t,r){this.firstLineNumber=t,this.lines=r}get lastLineNumber(){return this.firstLineNumber+this.lines.length-1}mapLineAt(t,r){if(t<this.firstLineNumber||t>this.lines.length+this.firstLineNumber)return this;let n=t-this.firstLineNumber,i=[...this.lines];return i[n]=r(i[n]),new e(this.firstLineNumber,i)}mapLines(t){return new e(this.firstLineNumber,this.lines.map((r,n)=>t(r,this.firstLineNumber+n)))}lineAt(t){return this.lines[t-this.firstLineNumber]}prependSymbolAt(t,r){return this.mapLines((n,i)=>i===t?`${r} ${n}`:` ${n}`)}slice(t,r){let n=this.lines.slice(t-1,r).join(`
14
- `);return new e(t,Mo(n).split(`
15
- `))}highlight(){let t=No(this.toString());return new e(this.firstLineNumber,t.split(`
13
+ `;console.warn(`${Me("warn(prisma)")} ${u}`)}}}}function to(e){if(Jl(e)){_n(`Environment variables loaded from ${e}`);let t=Mn.default.config({path:e,debug:process.env.DOTENV_CONFIG_DEBUG?!0:void 0});return{dotenvResult:eo(t),message:_e(`Environment variables loaded from ${We.default.relative(process.cwd(),e)}`),path:e}}else _n(`Environment variables not found at ${e}`);return null}function ro(e,t){return e&&t&&We.default.resolve(e)===We.default.resolve(t)}function Jl(e){return!!(e&&Pr.default.existsSync(e))}var no="library";function He(e){let t=Gl();return t||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":e?.config.engineType==="client"?"client":no)}function Gl(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":e==="client"?"client":void 0}var lo="prisma+postgres",vr=`${lo}:`;function Fn(e){return e?.startsWith(`${vr}//`)??!1}var kt;(t=>{let e;(A=>(A.findUnique="findUnique",A.findUniqueOrThrow="findUniqueOrThrow",A.findFirst="findFirst",A.findFirstOrThrow="findFirstOrThrow",A.findMany="findMany",A.create="create",A.createMany="createMany",A.createManyAndReturn="createManyAndReturn",A.update="update",A.updateMany="updateMany",A.updateManyAndReturn="updateManyAndReturn",A.upsert="upsert",A.delete="delete",A.deleteMany="deleteMany",A.groupBy="groupBy",A.count="count",A.aggregate="aggregate",A.findRaw="findRaw",A.aggregateRaw="aggregateRaw"))(e=t.ModelAction||={})})(kt||={});var Ot=B(require("path"));function Ln(e){return Ot.default.sep===Ot.default.posix.sep?e:e.split(Ot.default.sep).join(Ot.default.posix.sep)}var Dt={};vt(Dt,{error:()=>zl,info:()=>Kl,log:()=>Hl,query:()=>Yl,should:()=>po,tags:()=>It,warn:()=>Vn});var It={error:Ee("prisma:error"),warn:Me("prisma:warn"),info:be("prisma:info"),query:Fe("prisma:query")},po={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function Hl(...e){console.log(...e)}function Vn(e,...t){po.warn()&&console.warn(`${It.warn} ${e}`,...t)}function Kl(e,...t){console.info(`${It.info} ${e}`,...t)}function zl(e,...t){console.error(`${It.error} ${e}`,...t)}function Yl(e,...t){console.log(`${It.query} ${e}`,...t)}function re(e,t){throw new Error(t)}function qn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var jn=(e,t)=>e.reduce((r,n)=>(r[t(n)]=n,r),{});function Ke(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function Un(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}function b(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var yo=new Set,Nt=(e,t,...r)=>{yo.has(e)||(yo.add(e),Vn(t,...r))};var S=class e extends Error{constructor(t,r,n){super(t),this.name="PrismaClientInitializationError",this.clientVersion=r,this.errorCode=n,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};b(S,"PrismaClientInitializationError");var Q=class extends Error{constructor(t,{code:r,clientVersion:n,meta:i,batchRequestIdx:o}){super(t),this.name="PrismaClientKnownRequestError",this.code=r,this.clientVersion=n,this.meta=i,Object.defineProperty(this,"batchRequestIdx",{value:o,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};b(Q,"PrismaClientKnownRequestError");var se=class extends Error{constructor(t,r){super(t),this.name="PrismaClientRustPanicError",this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};b(se,"PrismaClientRustPanicError");var J=class extends Error{constructor(t,{clientVersion:r,batchRequestIdx:n}){super(t),this.name="PrismaClientUnknownRequestError",this.clientVersion=r,Object.defineProperty(this,"batchRequestIdx",{value:n,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};b(J,"PrismaClientUnknownRequestError");var G=class extends Error{constructor(r,{clientVersion:n}){super(r);this.name="PrismaClientValidationError";this.clientVersion=n}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};b(G,"PrismaClientValidationError");var ze=9e15,ke=1e9,Bn="0123456789abcdef",Rr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Sr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ze,maxE:ze,crypto:!1},Po,Pe,E=!0,Or="[DecimalError] ",Se=Or+"Invalid argument: ",vo=Or+"Precision limit exceeded",To=Or+"crypto unavailable",Co="[object Decimal]",W=Math.floor,V=Math.pow,Xl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,eu=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,tu=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ao=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ae=1e7,w=7,ru=9007199254740991,nu=Rr.length-1,Jn=Sr.length-1,d={toStringTag:Co};d.absoluteValue=d.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),y(e)};d.ceil=function(){return y(new this.constructor(this),this.e+1,2)};d.clampedTo=d.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Se+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};d.comparedTo=d.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,l=o.s,u=e.s;if(!s||!a)return!l||!u?NaN:l!==u?l:s===a?0:!s^l<0?1:-1;if(!s[0]||!a[0])return s[0]?l:a[0]?-u:0;if(l!==u)return l;if(o.e!==e.e)return o.e>e.e^l<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};d.cosine=d.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+w,n.rounding=1,r=iu(n,Io(n,r)),n.precision=e,n.rounding=t,y(Pe==2||Pe==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};d.cubeRoot=d.cbrt=function(){var e,t,r,n,i,o,s,a,l,u,c=this,p=c.constructor;if(!c.isFinite()||c.isZero())return new p(c);for(E=!1,o=c.s*V(c.s*c,1/3),!o||Math.abs(o)==1/0?(r=q(c.d),e=c.e,(o=(e-r.length+1)%3)&&(r+=o==1||o==-2?"0":"00"),o=V(r,1/3),e=W((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new p(r),n.s=c.s):n=new p(o.toString()),s=(e=p.precision)+3;;)if(a=n,l=a.times(a).times(a),u=l.plus(c),n=D(u.plus(c).times(a),u.plus(l),s+2,1),q(a.d).slice(0,s)===(r=q(n.d)).slice(0,s))if(r=r.slice(s-3,s+1),r=="9999"||!i&&r=="4999"){if(!i&&(y(a,e+1,0),a.times(a).times(a).eq(c))){n=a;break}s+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(y(n,e+1,1),t=!n.times(n).times(n).eq(c));break}return E=!0,y(n,e,p.rounding,t)};d.decimalPlaces=d.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-W(this.e/w))*w,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};d.dividedBy=d.div=function(e){return D(this,new this.constructor(e))};d.dividedToIntegerBy=d.divToInt=function(e){var t=this,r=t.constructor;return y(D(t,new r(e),0,1,1),r.precision,r.rounding)};d.equals=d.eq=function(e){return this.cmp(e)===0};d.floor=function(){return y(new this.constructor(this),this.e+1,3)};d.greaterThan=d.gt=function(e){return this.cmp(e)>0};d.greaterThanOrEqualTo=d.gte=function(e){var t=this.cmp(e);return t==1||t===0};d.hyperbolicCosine=d.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(e=Math.ceil(i/3),t=(1/Dr(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),o=Ye(s,1,o.times(t),new s(1),!0);for(var l,u=e,c=new s(8);u--;)l=o.times(o),o=a.minus(l.times(c.minus(l.times(c))));return y(o,s.precision=r,s.rounding=n,!0)};d.hyperbolicSine=d.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,n=i.d.length,n<3)i=Ye(o,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Dr(5,e)),i=Ye(o,2,i,i,!0);for(var s,a=new o(5),l=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(l.times(s).plus(u))))}return o.precision=t,o.rounding=r,y(i,t,r,!0)};d.hyperbolicTangent=d.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,D(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};d.inverseCosine=d.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return r!==-1?r===0?e.isNeg()?ce(t,n,i):new t(0):new t(NaN):e.isZero()?ce(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))};d.inverseHyperbolicCosine=d.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,E=!1,r=r.times(r).minus(1).sqrt().plus(r),E=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};d.inverseHyperbolicSine=d.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,E=!1,r=r.times(r).plus(1).sqrt().plus(r),E=!0,n.precision=e,n.rounding=t,r.ln())};d.inverseHyperbolicTangent=d.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?y(new o(i),e,t,!0):(o.precision=r=n-i.e,i=D(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)};d.inverseSine=d.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,t!==-1?t===0?(e=ce(o,r+4,n).times(.5),e.s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))};d.inverseTangent=d.atan=function(){var e,t,r,n,i,o,s,a,l,u=this,c=u.constructor,p=c.precision,m=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&p+4<=Jn)return s=ce(c,p+4,m).times(.25),s.s=u.s,s}else{if(!u.s)return new c(NaN);if(p+4<=Jn)return s=ce(c,p+4,m).times(.5),s.s=u.s,s}for(c.precision=a=p+10,c.rounding=1,r=Math.min(28,a/w+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(E=!1,t=Math.ceil(a/w),n=1,l=u.times(u),s=new c(u),i=u;e!==-1;)if(i=i.times(l),o=s.minus(i.div(n+=2)),i=i.times(l),s=o.plus(i.div(n+=2)),s.d[t]!==void 0)for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),E=!0,y(s,c.precision=p,c.rounding=m,!0)};d.isFinite=function(){return!!this.d};d.isInteger=d.isInt=function(){return!!this.d&&W(this.e/w)>this.d.length-2};d.isNaN=function(){return!this.s};d.isNegative=d.isNeg=function(){return this.s<0};d.isPositive=d.isPos=function(){return this.s>0};d.isZero=function(){return!!this.d&&this.d[0]===0};d.lessThan=d.lt=function(e){return this.cmp(e)<0};d.lessThanOrEqualTo=d.lte=function(e){return this.cmp(e)<1};d.logarithm=d.log=function(e){var t,r,n,i,o,s,a,l,u=this,c=u.constructor,p=c.precision,m=c.rounding,f=5;if(e==null)e=new c(10),t=!0;else{if(e=new c(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=i!==1}if(E=!1,a=p+f,s=Re(u,a),n=t?kr(c,a+10):Re(e,a),l=D(s,n,a,1),_t(l.d,i=p,m))do if(a+=10,s=Re(u,a),n=t?kr(c,a+10):Re(e,a),l=D(s,n,a,1),!o){+q(l.d).slice(i+1,i+15)+1==1e14&&(l=y(l,p+1,0));break}while(_t(l.d,i+=10,m));return E=!0,y(l,p,m)};d.minus=d.sub=function(e){var t,r,n,i,o,s,a,l,u,c,p,m,f=this,g=f.constructor;if(e=new g(e),!f.d||!e.d)return!f.s||!e.s?e=new g(NaN):f.d?e.s=-e.s:e=new g(e.d||f.s!==e.s?f:NaN),e;if(f.s!=e.s)return e.s=-e.s,f.plus(e);if(u=f.d,m=e.d,a=g.precision,l=g.rounding,!u[0]||!m[0]){if(m[0])e.s=-e.s;else if(u[0])e=new g(f);else return new g(l===3?-0:0);return E?y(e,a,l):e}if(r=W(e.e/w),c=W(f.e/w),u=u.slice(),o=c-r,o){for(p=o<0,p?(t=u,o=-o,s=m.length):(t=m,r=c,s=u.length),n=Math.max(Math.ceil(a/w),s)+2,o>n&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=m.length,p=n<s,p&&(s=n),n=0;n<s;n++)if(u[n]!=m[n]){p=u[n]<m[n];break}o=0}for(p&&(t=u,u=m,m=t,e.s=-e.s),s=u.length,n=m.length-s;n>0;--n)u[s++]=0;for(n=m.length;n>o;){if(u[--n]<m[n]){for(i=n;i&&u[--i]===0;)u[i]=ae-1;--u[i],u[n]+=ae}u[n]-=m[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Ir(u,r),E?y(e,a,l):e):new g(l===3?-0:0)};d.modulo=d.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?y(new n(r),n.precision,n.rounding):(E=!1,n.modulo==9?(t=D(r,e.abs(),0,3,1),t.s*=e.s):t=D(r,e,0,n.modulo,1),t=t.times(e),E=!0,r.minus(t))};d.naturalExponential=d.exp=function(){return Gn(this)};d.naturalLogarithm=d.ln=function(){return Re(this)};d.negated=d.neg=function(){var e=new this.constructor(this);return e.s=-e.s,y(e)};d.plus=d.add=function(e){var t,r,n,i,o,s,a,l,u,c,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d||(e=new m(e.d||p.s===e.s?p:NaN)),e;if(p.s!=e.s)return e.s=-e.s,p.minus(e);if(u=p.d,c=e.d,a=m.precision,l=m.rounding,!u[0]||!c[0])return c[0]||(e=new m(p)),E?y(e,a,l):e;if(o=W(p.e/w),n=W(e.e/w),u=u.slice(),i=o-n,i){for(i<0?(r=u,i=-i,s=c.length):(r=c,n=o,s=u.length),o=Math.ceil(a/w),s=o>s?o+1:s+1,i>s&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(s=u.length,i=c.length,s-i<0&&(i=s,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/ae|0,u[i]%=ae;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return e.d=u,e.e=Ir(u,n),E?y(e,a,l):e};d.precision=d.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Se+e);return r.d?(t=Ro(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};d.round=function(){var e=this,t=e.constructor;return y(new t(e),e.e+1,t.rounding)};d.sine=d.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+w,n.rounding=1,r=su(n,Io(n,r)),n.precision=e,n.rounding=t,y(Pe>2?r.neg():r,e,t,!0)):new n(NaN)};d.squareRoot=d.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,l=s.e,u=s.s,c=s.constructor;if(u!==1||!a||!a[0])return new c(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(E=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=q(a),(t.length+l)%2==0&&(t+="0"),u=Math.sqrt(t),l=W((l+1)/2)-(l<0||l%2),u==1/0?t="5e"+l:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+l),n=new c(t)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(o=n,n=o.plus(D(s,o,r+2,1)).times(.5),q(o.d).slice(0,r)===(t=q(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(y(o,l+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(y(n,l+1,1),e=!n.times(n).eq(s));break}return E=!0,y(n,l,c.rounding,e)};d.tangent=d.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=D(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,y(Pe==2||Pe==4?r.neg():r,e,t,!0)):new n(NaN)};d.times=d.mul=function(e){var t,r,n,i,o,s,a,l,u,c=this,p=c.constructor,m=c.d,f=(e=new p(e)).d;if(e.s*=c.s,!m||!m[0]||!f||!f[0])return new p(!e.s||m&&!m[0]&&!f||f&&!f[0]&&!m?NaN:!m||!f?e.s/0:e.s*0);for(r=W(c.e/w)+W(e.e/w),l=m.length,u=f.length,l<u&&(o=m,m=f,f=o,s=l,l=u,u=s),o=[],s=l+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=l+n;i>n;)a=o[i]+f[n]*m[i-n-1]+t,o[i--]=a%ae|0,t=a/ae|0;o[i]=(o[i]+t)%ae|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=Ir(o,r),E?y(e,p.precision,p.rounding):e};d.toBinary=function(e,t){return Wn(this,2,e,t)};d.toDecimalPlaces=d.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Z(e,0,ke),t===void 0?t=n.rounding:Z(t,0,8),y(r,e+r.e+1,t))};d.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=pe(n,!0):(Z(e,0,ke),t===void 0?t=i.rounding:Z(t,0,8),n=y(new i(n),e+1,t),r=pe(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};d.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?r=pe(i):(Z(e,0,ke),t===void 0?t=o.rounding:Z(t,0,8),n=y(new o(i),e+i.e+1,t),r=pe(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};d.toFraction=function(e){var t,r,n,i,o,s,a,l,u,c,p,m,f=this,g=f.d,h=f.constructor;if(!g)return new h(f);if(u=r=new h(1),n=l=new h(0),t=new h(n),o=t.e=Ro(g)-f.e-1,s=o%w,t.d[0]=V(10,s<0?w+s:s),e==null)e=o>0?t:u;else{if(a=new h(e),!a.isInt()||a.lt(u))throw Error(Se+a);e=a.gt(t)?o>0?t:u:a}for(E=!1,a=new h(q(g)),c=h.precision,h.precision=o=g.length*w*2;p=D(a,t,0,1,1),i=r.plus(p.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=l.plus(p.times(i)),l=i,i=t,t=a.minus(p.times(i)),a=i;return i=D(e.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=f.s,m=D(u,n,o,1).minus(f).abs().cmp(D(l,r,o,1).minus(f).abs())<1?[u,n]:[l,r],h.precision=c,E=!0,m};d.toHexadecimal=d.toHex=function(e,t){return Wn(this,16,e,t)};d.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Z(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(E=!1,r=D(r,e,0,t,1).times(e),E=!0,y(r)):(e.s=r.s,r=e),r};d.toNumber=function(){return+this};d.toOctal=function(e,t){return Wn(this,8,e,t)};d.toPower=d.pow=function(e){var t,r,n,i,o,s,a=this,l=a.constructor,u=+(e=new l(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new l(V(+a,u));if(a=new l(a),a.eq(1))return a;if(n=l.precision,o=l.rounding,e.eq(1))return y(a,n,o);if(t=W(e.e/w),t>=e.d.length-1&&(r=u<0?-u:u)<=ru)return i=So(l,a,r,n),e.s<0?new l(1).div(i):y(i,n,o);if(s=a.s,s<0){if(t<e.d.length-1)return new l(NaN);if(e.d[t]&1||(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return r=V(+a,u),t=r==0||!isFinite(r)?W(u*(Math.log("0."+q(a.d))/Math.LN10+a.e+1)):new l(r+"").e,t>l.maxE+1||t<l.minE-1?new l(t>0?s/0:0):(E=!1,l.rounding=a.s=1,r=Math.min(12,(t+"").length),i=Gn(e.times(Re(a,n+r)),n),i.d&&(i=y(i,n+5,1),_t(i.d,n,o)&&(t=n+10,i=y(Gn(e.times(Re(a,t+r)),t),t+5,1),+q(i.d).slice(n+1,n+15)+1==1e14&&(i=y(i,n+1,0)))),i.s=s,E=!0,l.rounding=o,y(i,n,o))};d.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=pe(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Z(e,1,ke),t===void 0?t=i.rounding:Z(t,0,8),n=y(new i(n),e,t),r=pe(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};d.toSignificantDigits=d.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Z(e,1,ke),t===void 0?t=n.rounding:Z(t,0,8)),y(new n(r),e,t)};d.toString=function(){var e=this,t=e.constructor,r=pe(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};d.truncated=d.trunc=function(){return y(new this.constructor(this),this.e+1,1)};d.valueOf=d.toJSON=function(){var e=this,t=e.constructor,r=pe(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function q(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)n=e[t]+"",r=w-n.length,r&&(o+=Ae(r)),o+=n;s=e[t],n=s+"",r=w-n.length,r&&(o+=Ae(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function Z(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Se+e)}function _t(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=w,i=0):(i=Math.ceil((t+1)/w),t%=w),o=V(10,w-t),a=e[i]%o|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==V(10,t-2)-1||(a==o/2||a==0)&&(e[i+1]/o/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||r<4)&&a==9999||!n&&r>3&&a==4999):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==V(10,t-3)-1,s}function Cr(e,t,r){for(var n,i=[0],o,s=0,a=e.length;s<a;){for(o=i.length;o--;)i[o]*=t;for(i[0]+=Bn.indexOf(e.charAt(s++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function iu(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Dr(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Ye(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}var D=function(){function e(n,i,o){var s,a=0,l=n.length;for(n=n.slice();l--;)s=n[l]*i+a,n[l]=s%o|0,a=s/o|0;return a&&n.unshift(a),n}function t(n,i,o,s){var a,l;if(o!=s)l=o>s?1:-1;else for(a=l=0;a<o;a++)if(n[a]!=i[a]){l=n[a]>i[a]?1:-1;break}return l}function r(n,i,o,s){for(var a=0;o--;)n[o]-=a,a=n[o]<i[o]?1:0,n[o]=a*s+n[o]-i[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,o,s,a,l){var u,c,p,m,f,g,h,R,P,T,v,k,A,te,Pt,F,z,we,j,Je,wr=n.constructor,Pn=n.s==i.s?1:-1,U=n.d,I=i.d;if(!U||!U[0]||!I||!I[0])return new wr(!n.s||!i.s||(U?I&&U[0]==I[0]:!I)?NaN:U&&U[0]==0||!I?Pn*0:Pn/0);for(l?(f=1,c=n.e-i.e):(l=ae,f=w,c=W(n.e/f)-W(i.e/f)),j=I.length,z=U.length,P=new wr(Pn),T=P.d=[],p=0;I[p]==(U[p]||0);p++);if(I[p]>(U[p]||0)&&c--,o==null?(te=o=wr.precision,s=wr.rounding):a?te=o+(n.e-i.e)+1:te=o,te<0)T.push(1),g=!0;else{if(te=te/f+2|0,p=0,j==1){for(m=0,I=I[0],te++;(p<z||m)&&te--;p++)Pt=m*l+(U[p]||0),T[p]=Pt/I|0,m=Pt%I|0;g=m||p<z}else{for(m=l/(I[0]+1)|0,m>1&&(I=e(I,m,l),U=e(U,m,l),j=I.length,z=U.length),F=j,v=U.slice(0,j),k=v.length;k<j;)v[k++]=0;Je=I.slice(),Je.unshift(0),we=I[0],I[1]>=l/2&&++we;do m=0,u=t(I,v,j,k),u<0?(A=v[0],j!=k&&(A=A*l+(v[1]||0)),m=A/we|0,m>1?(m>=l&&(m=l-1),h=e(I,m,l),R=h.length,k=v.length,u=t(h,v,R,k),u==1&&(m--,r(h,j<R?Je:I,R,l))):(m==0&&(u=m=1),h=I.slice()),R=h.length,R<k&&h.unshift(0),r(v,h,k,l),u==-1&&(k=v.length,u=t(I,v,j,k),u<1&&(m++,r(v,j<k?Je:I,k,l))),k=v.length):u===0&&(m++,v=[0]),T[p++]=m,u&&v[0]?v[k++]=U[F]||0:(v=[U[F]],k=1);while((F++<z||v[0]!==void 0)&&te--);g=v[0]!==void 0}T[0]||T.shift()}if(f==1)P.e=c,Po=g;else{for(p=1,m=T[0];m>=10;m/=10)p++;P.e=p+c*f-1,y(P,a?o+P.e+1:o,s,g)}return P}}();function y(e,t,r,n){var i,o,s,a,l,u,c,p,m,f=e.constructor;e:if(t!=null){if(p=e.d,!p)return e;for(i=1,a=p[0];a>=10;a/=10)i++;if(o=t-i,o<0)o+=w,s=t,c=p[m=0],l=c/V(10,i-s-1)%10|0;else if(m=Math.ceil((o+1)/w),a=p.length,m>=a)if(n){for(;a++<=m;)p.push(0);c=l=0,i=1,o%=w,s=o-w+1}else break e;else{for(c=a=p[m],i=1;a>=10;a/=10)i++;o%=w,s=o-w+i,l=s<0?0:c/V(10,i-s-1)%10|0}if(n=n||t<0||p[m+1]!==void 0||(s<0?c:c%V(10,i-s-1)),u=r<4?(l||n)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(o>0?s>0?c/V(10,i-s):0:p[m-1])%10&1||r==(e.s<0?8:7)),t<1||!p[0])return p.length=0,u?(t-=e.e+1,p[0]=V(10,(w-t%w)%w),e.e=-t||0):p[0]=e.e=0,e;if(o==0?(p.length=m,a=1,m--):(p.length=m+1,a=V(10,w-o),p[m]=s>0?(c/V(10,i-s)%V(10,s)|0)*a:0),u)for(;;)if(m==0){for(o=1,s=p[0];s>=10;s/=10)o++;for(s=p[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,p[0]==ae&&(p[0]=1));break}else{if(p[m]+=a,p[m]!=ae)break;p[m--]=0,a=1}for(o=p.length;p[--o]===0;)p.pop()}return E&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function pe(e,t,r){if(!e.isFinite())return Oo(e);var n,i=e.e,o=q(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+Ae(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Ae(-i-1)+o,r&&(n=r-s)>0&&(o+=Ae(n))):i>=s?(o+=Ae(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+Ae(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=Ae(n))),o}function Ir(e,t){var r=e[0];for(t*=w;r>=10;r/=10)t++;return t}function kr(e,t,r){if(t>nu)throw E=!0,r&&(e.precision=r),Error(vo);return y(new e(Rr),t,1,!0)}function ce(e,t,r){if(t>Jn)throw Error(vo);return y(new e(Sr),t,r,!0)}function Ro(e){var t=e.length-1,r=t*w+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Ae(e){for(var t="";e--;)t+="0";return t}function So(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/w+4);for(E=!1;;){if(r%2&&(o=o.times(t),bo(o.d,s)&&(i=!0)),r=W(r/2),r===0){r=o.d.length-1,i&&o.d[r]===0&&++o.d[r];break}t=t.times(t),bo(t.d,s)}return E=!0,o}function Eo(e){return e.d[e.d.length-1]&1}function ko(e,t,r){for(var n,i,o=new e(t[0]),s=0;++s<t.length;){if(i=new e(t[s]),!i.s){o=i;break}n=o.cmp(i),(n===r||n===0&&o.s===r)&&(o=i)}return o}function Gn(e,t){var r,n,i,o,s,a,l,u=0,c=0,p=0,m=e.constructor,f=m.rounding,g=m.precision;if(!e.d||!e.d[0]||e.e>17)return new m(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(E=!1,l=g):l=t,a=new m(.03125);e.e>-2;)e=e.times(a),p+=5;for(n=Math.log(V(2,p))/Math.LN10*2+5|0,l+=n,r=o=s=new m(1),m.precision=l;;){if(o=y(o.times(e),l,1),r=r.times(++c),a=s.plus(D(o,r,l,1)),q(a.d).slice(0,l)===q(s.d).slice(0,l)){for(i=p;i--;)s=y(s.times(s),l,1);if(t==null)if(u<3&&_t(s.d,l-n,f,u))m.precision=l+=10,r=o=a=new m(1),c=0,u++;else return y(s,m.precision=g,f,E=!0);else return m.precision=g,s}s=a}}function Re(e,t){var r,n,i,o,s,a,l,u,c,p,m,f=1,g=10,h=e,R=h.d,P=h.constructor,T=P.rounding,v=P.precision;if(h.s<0||!R||!R[0]||!h.e&&R[0]==1&&R.length==1)return new P(R&&!R[0]?-1/0:h.s!=1?NaN:R?0:h);if(t==null?(E=!1,c=v):c=t,P.precision=c+=g,r=q(R),n=r.charAt(0),Math.abs(o=h.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=q(h.d),n=r.charAt(0),f++;o=h.e,n>1?(h=new P("0."+r),o++):h=new P(n+"."+r.slice(1))}else return u=kr(P,c+2,v).times(o+""),h=Re(new P(n+"."+r.slice(1)),c-g).plus(u),P.precision=v,t==null?y(h,v,T,E=!0):h;for(p=h,l=s=h=D(h.minus(1),h.plus(1),c,1),m=y(h.times(h),c,1),i=3;;){if(s=y(s.times(m),c,1),u=l.plus(D(s,new P(i),c,1)),q(u.d).slice(0,c)===q(l.d).slice(0,c))if(l=l.times(2),o!==0&&(l=l.plus(kr(P,c+2,v).times(o+""))),l=D(l,new P(f),c,1),t==null)if(_t(l.d,c-g,T,a))P.precision=c+=g,u=s=h=D(p.minus(1),p.plus(1),c,1),m=y(h.times(h),c,1),i=a=1;else return y(l,P.precision=v,T,E=!0);else return P.precision=v,l;l=u,i+=2}}function Oo(e){return String(e.s*e.s/0)}function Ar(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%w,r<0&&(n+=w),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=w;n<i;)e.d.push(+t.slice(n,n+=w));t=t.slice(n),n=w-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),E&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function ou(e,t){var r,n,i,o,s,a,l,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Ao.test(t))return Ar(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(eu.test(t))r=16,t=t.toLowerCase();else if(Xl.test(t))r=2;else if(tu.test(t))r=8;else throw Error(Se+t);for(o=t.search(/p/i),o>0?(l=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),o=t.indexOf("."),s=o>=0,n=e.constructor,s&&(t=t.replace(".",""),a=t.length,o=a-o,i=So(n,new n(r),o,o*2)),u=Cr(t,r,ae),c=u.length-1,o=c;u[o]===0;--o)u.pop();return o<0?new n(e.s*0):(e.e=Ir(u,c),e.d=u,E=!1,s&&(e=D(e,i,a*4)),l&&(e=e.times(Math.abs(l)<54?V(2,l):Le.pow(2,l))),E=!0,e)}function su(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Ye(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Dr(5,r)),t=Ye(e,2,t,t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function Ye(e,t,r,n,i){var o,s,a,l,u=1,c=e.precision,p=Math.ceil(c/w);for(E=!1,l=r.times(r),a=new e(n);;){if(s=D(a.times(l),new e(t++*t++),c,1),a=i?n.plus(s):n.minus(s),n=D(s.times(l),new e(t++*t++),c,1),s=a.plus(n),s.d[p]!==void 0){for(o=p;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=n,n=s,s=o,u++}return E=!0,s.d.length=p+1,s}function Dr(e,t){for(var r=e;--t;)r*=e;return r}function Io(e,t){var r,n=t.s<0,i=ce(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return Pe=n?4:1,t;if(r=t.divToInt(i),r.isZero())Pe=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(o))return Pe=Eo(r)?n?2:3:n?4:1,t;Pe=Eo(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Wn(e,t,r,n){var i,o,s,a,l,u,c,p,m,f=e.constructor,g=r!==void 0;if(g?(Z(r,1,ke),n===void 0?n=f.rounding:Z(n,0,8)):(r=f.precision,n=f.rounding),!e.isFinite())c=Oo(e);else{for(c=pe(e),s=c.indexOf("."),g?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,s>=0&&(c=c.replace(".",""),m=new f(1),m.e=c.length-s,m.d=Cr(pe(m),10,i),m.e=m.d.length),p=Cr(c,10,i),o=l=p.length;p[--l]==0;)p.pop();if(!p[0])c=g?"0p+0":"0";else{if(s<0?o--:(e=new f(e),e.d=p,e.e=o,e=D(e,m,r,n,0,i),p=e.d,o=e.e,u=Po),s=p[r],a=i/2,u=u||p[r+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(e.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&p[r-1]&1||n===(e.s<0?8:7)),p.length=r,u)for(;++p[--r]>i-1;)p[r]=0,r||(++o,p.unshift(1));for(l=p.length;!p[l-1];--l);for(s=0,c="";s<l;s++)c+=Bn.charAt(p[s]);if(g){if(l>1)if(t==16||t==8){for(s=t==16?4:3,--l;l%s;l++)c+="0";for(p=Cr(c,i,t),l=p.length;!p[l-1];--l);for(s=1,c="1.";s<l;s++)c+=Bn.charAt(p[s])}else c=c.charAt(0)+"."+c.slice(1);c=c+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)c="0"+c;c="0."+c}else if(++o>l)for(o-=l;o--;)c+="0";else o<l&&(c=c.slice(0,o)+"."+c.slice(o))}c=(t==16?"0x":t==2?"0b":t==8?"0o":"")+c}return e.s<0?"-"+c:c}function bo(e,t){if(e.length>t)return e.length=t,!0}function au(e){return new this(e).abs()}function lu(e){return new this(e).acos()}function uu(e){return new this(e).acosh()}function cu(e,t){return new this(e).plus(t)}function pu(e){return new this(e).asin()}function mu(e){return new this(e).asinh()}function du(e){return new this(e).atan()}function fu(e){return new this(e).atanh()}function gu(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=ce(this,o,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?ce(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=ce(this,o,1).times(.5),r.s=e.s):t.s<0?(this.precision=o,this.rounding=1,r=this.atan(D(e,t,o,1)),t=ce(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(D(e,t,o,1)),r}function hu(e){return new this(e).cbrt()}function yu(e){return y(e=new this(e),e.e+1,2)}function wu(e,t,r){return new this(e).clamp(t,r)}function Eu(e){if(!e||typeof e!="object")throw Error(Or+"Object expected");var t,r,n,i=e.defaults===!0,o=["precision",1,ke,"rounding",0,8,"toExpNeg",-ze,0,"toExpPos",0,ze,"maxE",0,ze,"minE",-ze,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=Qn[r]),(n=e[r])!==void 0)if(W(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(Se+r+": "+n);if(r="crypto",i&&(this[r]=Qn[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(To);else this[r]=!1;else throw Error(Se+r+": "+n);return this}function bu(e){return new this(e).cos()}function xu(e){return new this(e).cosh()}function Do(e){var t,r,n;function i(o){var s,a,l,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,xo(o)){u.s=o.s,E?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(l=typeof o,l==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;E?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Ar(u,o.toString())}if(l==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Ao.test(o)?Ar(u,o):ou(u,o);if(l==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Ar(u,o.toString());throw Error(Se+o)}if(i.prototype=d,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Eu,i.clone=Do,i.isDecimal=xo,i.abs=au,i.acos=lu,i.acosh=uu,i.add=cu,i.asin=pu,i.asinh=mu,i.atan=du,i.atanh=fu,i.atan2=gu,i.cbrt=hu,i.ceil=yu,i.clamp=wu,i.cos=bu,i.cosh=xu,i.div=Pu,i.exp=vu,i.floor=Tu,i.hypot=Cu,i.ln=Au,i.log=Ru,i.log10=ku,i.log2=Su,i.max=Ou,i.min=Iu,i.mod=Du,i.mul=Nu,i.pow=_u,i.random=Mu,i.round=Fu,i.sign=Lu,i.sin=Vu,i.sinh=$u,i.sqrt=qu,i.sub=ju,i.sum=Uu,i.tan=Bu,i.tanh=Qu,i.trunc=Ju,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function Pu(e,t){return new this(e).div(t)}function vu(e){return new this(e).exp()}function Tu(e){return y(e=new this(e),e.e+1,3)}function Cu(){var e,t,r=new this(0);for(E=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return E=!0,new this(1/0);r=t}return E=!0,r.sqrt()}function xo(e){return e instanceof Le||e&&e.toStringTag===Co||!1}function Au(e){return new this(e).ln()}function Ru(e,t){return new this(e).log(t)}function Su(e){return new this(e).log(2)}function ku(e){return new this(e).log(10)}function Ou(){return ko(this,arguments,-1)}function Iu(){return ko(this,arguments,1)}function Du(e,t){return new this(e).mod(t)}function Nu(e,t){return new this(e).mul(t)}function _u(e,t){return new this(e).pow(t)}function Mu(e){var t,r,n,i,o=0,s=new this(1),a=[];if(e===void 0?e=this.precision:Z(e,1,ke),n=Math.ceil(e/w),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)i=t[o],i>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((t[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(To);else for(;o<n;)a[o++]=Math.random()*1e7|0;for(n=a[--o],e%=w,n&&e&&(i=V(10,w-e),a[o]=(n/i|0)*i);a[o]===0;o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=w)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<w&&(r-=w-n)}return s.e=r,s.d=a,s}function Fu(e){return y(e=new this(e),e.e+1,this.rounding)}function Lu(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Vu(e){return new this(e).sin()}function $u(e){return new this(e).sinh()}function qu(e){return new this(e).sqrt()}function ju(e,t){return new this(e).sub(t)}function Uu(){var e=0,t=arguments,r=new this(t[e]);for(E=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return E=!0,y(r,this.precision,this.rounding)}function Bu(e){return new this(e).tan()}function Qu(e){return new this(e).tanh()}function Ju(e){return y(e=new this(e),e.e+1,1)}d[Symbol.for("nodejs.util.inspect.custom")]=d.toString;d[Symbol.toStringTag]="Decimal";var Le=d.constructor=Do(Qn);Rr=new Le(Rr);Sr=new Le(Sr);var me=Le;function Ze(e){return e===null?e:Array.isArray(e)?e.map(Ze):typeof e=="object"?Gu(e)?Wu(e):Ke(e,Ze):e}function Gu(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Wu({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new me(t);case"Json":return JSON.parse(t);default:re(t,"Unknown tagged value")}}function Xe(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function et(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Nr(e){return e.toString()!=="Invalid Date"}function tt(e){return Le.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}var Vo=B(co());var Lo=B(require("fs"));var No={keyword:be,entity:be,value:e=>H(Fe(e)),punctuation:Fe,directive:be,function:be,variable:e=>H(Fe(e)),string:e=>H(Tt(e)),boolean:Me,number:be,comment:Ct};var Hu=e=>e,_r={},Ku=0,x={manual:_r.Prism&&_r.Prism.manual,disableWorkerMessageHandler:_r.Prism&&_r.Prism.disableWorkerMessageHandler,util:{encode:function(e){if(e instanceof le){let t=e;return new le(t.type,x.util.encode(t.content),t.alias)}else return Array.isArray(e)?e.map(x.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++Ku}),e.__id},clone:function e(t,r){let n,i,o=x.util.type(t);switch(r=r||{},o){case"Object":if(i=x.util.objId(t),r[i])return r[i];n={},r[i]=n;for(let s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return i=x.util.objId(t),r[i]?r[i]:(n=[],r[i]=n,t.forEach(function(s,a){n[a]=e(s,r)}),n);default:return t}}},languages:{extend:function(e,t){let r=x.util.clone(x.languages[e]);for(let n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){n=n||x.languages;let i=n[e],o={};for(let a in i)if(i.hasOwnProperty(a)){if(a==t)for(let l in r)r.hasOwnProperty(l)&&(o[l]=r[l]);r.hasOwnProperty(a)||(o[a]=i[a])}let s=n[e];return n[e]=o,x.languages.DFS(x.languages,function(a,l){l===s&&a!=e&&(this[a]=o)}),o},DFS:function e(t,r,n,i){i=i||{};let o=x.util.objId;for(let s in t)if(t.hasOwnProperty(s)){r.call(t,s,t[s],n||s);let a=t[s],l=x.util.type(a);l==="Object"&&!i[o(a)]?(i[o(a)]=!0,e(a,r,null,i)):l==="Array"&&!i[o(a)]&&(i[o(a)]=!0,e(a,r,s,i))}}},plugins:{},highlight:function(e,t,r){let n={code:e,grammar:t,language:r};return x.hooks.run("before-tokenize",n),n.tokens=x.tokenize(n.code,n.grammar),x.hooks.run("after-tokenize",n),le.stringify(x.util.encode(n.tokens),n.language)},matchGrammar:function(e,t,r,n,i,o,s){for(let h in r){if(!r.hasOwnProperty(h)||!r[h])continue;if(h==s)return;let R=r[h];R=x.util.type(R)==="Array"?R:[R];for(let P=0;P<R.length;++P){let T=R[P],v=T.inside,k=!!T.lookbehind,A=!!T.greedy,te=0,Pt=T.alias;if(A&&!T.pattern.global){let F=T.pattern.toString().match(/[imuy]*$/)[0];T.pattern=RegExp(T.pattern.source,F+"g")}T=T.pattern||T;for(let F=n,z=i;F<t.length;z+=t[F].length,++F){let we=t[F];if(t.length>e.length)return;if(we instanceof le)continue;if(A&&F!=t.length-1){T.lastIndex=z;var p=T.exec(e);if(!p)break;var c=p.index+(k?p[1].length:0),m=p.index+p[0].length,a=F,l=z;for(let I=t.length;a<I&&(l<m||!t[a].type&&!t[a-1].greedy);++a)l+=t[a].length,c>=l&&(++F,z=l);if(t[F]instanceof le)continue;u=a-F,we=e.slice(z,l),p.index-=z}else{T.lastIndex=0;var p=T.exec(we),u=1}if(!p){if(o)break;continue}k&&(te=p[1]?p[1].length:0);var c=p.index+te,p=p[0].slice(te),m=c+p.length,f=we.slice(0,c),g=we.slice(m);let j=[F,u];f&&(++F,z+=f.length,j.push(f));let Je=new le(h,v?x.tokenize(p,v):p,Pt,p,A);if(j.push(Je),g&&j.push(g),Array.prototype.splice.apply(t,j),u!=1&&x.matchGrammar(e,t,r,F,z,!0,h),o)break}}}},tokenize:function(e,t){let r=[e],n=t.rest;if(n){for(let i in n)t[i]=n[i];delete t.rest}return x.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){let r=x.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){let r=x.hooks.all[e];if(!(!r||!r.length))for(var n=0,i;i=r[n++];)i(t)}},Token:le};x.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};x.languages.javascript=x.languages.extend("clike",{"class-name":[x.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});x.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;x.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:x.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:x.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:x.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:x.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});x.languages.markup&&x.languages.markup.tag.addInlined("script","javascript");x.languages.js=x.languages.javascript;x.languages.typescript=x.languages.extend("javascript",{keyword:/\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/});x.languages.ts=x.languages.typescript;function le(e,t,r,n,i){this.type=e,this.content=t,this.alias=r,this.length=(n||"").length|0,this.greedy=!!i}le.stringify=function(e,t){return typeof e=="string"?e:Array.isArray(e)?e.map(function(r){return le.stringify(r,t)}).join(""):zu(e.type)(e.content)};function zu(e){return No[e]||Hu}function _o(e){return Yu(e,x.languages.javascript)}function Yu(e,t){return x.tokenize(e,t).map(n=>le.stringify(n)).join("")}var Mo=B(ao());function Fo(e){return(0,Mo.default)(e)}var Mr=class e{static read(t){let r;try{r=Lo.default.readFileSync(t,"utf-8")}catch{return null}return e.fromContent(r)}static fromContent(t){let r=t.split(/\r?\n/);return new e(1,r)}constructor(t,r){this.firstLineNumber=t,this.lines=r}get lastLineNumber(){return this.firstLineNumber+this.lines.length-1}mapLineAt(t,r){if(t<this.firstLineNumber||t>this.lines.length+this.firstLineNumber)return this;let n=t-this.firstLineNumber,i=[...this.lines];return i[n]=r(i[n]),new e(this.firstLineNumber,i)}mapLines(t){return new e(this.firstLineNumber,this.lines.map((r,n)=>t(r,this.firstLineNumber+n)))}lineAt(t){return this.lines[t-this.firstLineNumber]}prependSymbolAt(t,r){return this.mapLines((n,i)=>i===t?`${r} ${n}`:` ${n}`)}slice(t,r){let n=this.lines.slice(t-1,r).join(`
14
+ `);return new e(t,Fo(n).split(`
15
+ `))}highlight(){let t=_o(this.toString());return new e(this.firstLineNumber,t.split(`
16
16
  `))}toString(){return this.lines.join(`
17
- `)}};var Zu={red:Ee,gray:Ct,dim:_e,bold:H,underline:Y,highlightSource:e=>e.highlight()},Xu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function ec({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function tc({callsite:e,message:t,originalMethod:r,isPanic:n,callArguments:i},o){let s=ec({message:t,originalMethod:r,isPanic:n,callArguments:i});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let a=e.getLocation();if(!a||!a.lineNumber||!a.columnNumber)return s;let l=Math.max(1,a.lineNumber-3),u=Mr.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=nc(c),m=rc(c);if(!m)return s;s.functionName=`${m.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,g=>g.slice(0,m.openingBraceIndex))),u=o.highlightSource(u);let f=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((g,h)=>o.gray(String(h).padStart(f))+" "+g).mapLines(g=>o.dim(g)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let g=p+f+1;g+=2,s.callArguments=(0,Lo.default)(i,g).slice(g)}}return s}function rc(e){let t=Object.keys(kt.ModelAction).join("|"),n=new RegExp(String.raw`\.(${t})\(`).exec(e);if(n){let i=n.index+n[0].length,o=e.lastIndexOf(" ",n.index)+1;return{code:e.slice(o,i),openingBraceIndex:i}}return null}function nc(e){let t=0;for(let r=0;r<e.length;r++){if(e.charAt(r)!==" ")return t;t++}return t}function ic({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=t?" in":":";if(n?(a.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),a.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${l}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${l}`)),t&&a.push(s.underline(oc(t))),i){a.push("");let u=[i.toString()];o&&(u.push(o),u.push(s.dim(")"))),a.push(u.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
18
- `)}function oc(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function Fr(e){let t=e.showColors?Zu:Xu,r;return r=tc(e,t),ic(r,t)}var Qo=B(Wn());function jo(e,t,r){let n=Uo(e),i=sc(n),o=lc(i);o?Lr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Uo(e){return e.errors.flatMap(t=>t.kind==="Union"?Uo(t):[t])}function sc(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:ac(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function ac(e,t){return[...new Set(e.concat(t))]}function lc(e){return jn(e,(t,r)=>{let n=$o(t),i=$o(r);return n!==i?n-i:qo(t)-qo(r)})}function $o(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function qo(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var ne=class{constructor(t,r){this.name=t;this.value=r;this.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)}};var rt=class{constructor(t=0,r){this.context=r;this.lines=[];this.currentLine="";this.currentIndent=0;this.currentIndent=t}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(`
19
- `)}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}};var Vr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};var $r=e=>e,qr={bold:$r,red:$r,green:$r,dim:$r,enabled:!1},Bo={bold:H,red:Ee,green:Tt,dim:_e,enabled:!0},nt={write(e){e.writeLine(",")}};var de=class{constructor(t){this.contents=t;this.isUnderlined=!1;this.color=t=>t}underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};var Oe=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var it=class extends Oe{constructor(){super(...arguments);this.items=[]}addItem(r){return this.items.push(new Vr(r)),this}getField(r){return this.items[r]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(n=>n.value.getPrintWidth()))+2}write(r){if(this.items.length===0){this.writeEmpty(r);return}this.writeWithItems(r)}writeEmpty(r){let n=new de("[]");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithItems(r){let{colors:n}=r.context;r.writeLine("[").withIndent(()=>r.writeJoined(nt,this.items).newLine()).write("]"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(n.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var ot=class e extends Oe{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(r){this.fields[r.name]=r}addSuggestion(r){this.suggestions.push(r)}getField(r){return this.fields[r]}getDeepField(r){let[n,...i]=r,o=this.getField(n);if(!o)return;let s=o;for(let a of i){let l;if(s.value instanceof e?l=s.value.getField(a):s.value instanceof it&&(l=s.value.getField(Number(a))),!l)return;s=l}return s}getDeepFieldValue(r){return r.length===0?this:this.getDeepField(r)?.value}hasField(r){return!!this.getField(r)}removeAllFields(){this.fields={}}removeField(r){delete this.fields[r]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(r){return this.getField(r)?.value}getDeepSubSelectionValue(r){let n=this;for(let i of r){if(!(n instanceof e))return;let o=n.getSubSelectionValue(i);if(!o)return;n=o}return n}getDeepSelectionParent(r){let n=this.getSelectionParent();if(!n)return;let i=n;for(let o of r){let s=i.value.getFieldValue(o);if(!s||!(s instanceof e))return;let a=s.getSelectionParent();if(!a)return;i=a}return i}getSelectionParent(){let r=this.getField("select")?.value.asObject();if(r)return{kind:"select",value:r};let n=this.getField("include")?.value.asObject();if(n)return{kind:"include",value:n}}getSubSelectionValue(r){return this.getSelectionParent()?.value.fields[r].value}getPrintWidth(){let r=Object.values(this.fields);return r.length==0?2:Math.max(...r.map(i=>i.getPrintWidth()))+2}write(r){let n=Object.values(this.fields);if(n.length===0&&this.suggestions.length===0){this.writeEmpty(r);return}this.writeWithContents(r,n)}asObject(){return this}writeEmpty(r){let n=new de("{}");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithContents(r,n){r.writeLine("{").withIndent(()=>{r.writeJoined(nt,[...n,...this.suggestions]).newLine()}),r.write("}"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(r.context.colors.red("~".repeat(this.getPrintWidth())))})}};var $=class extends Oe{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new de(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};var Mt=class{constructor(){this.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(nt,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Lr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":cc(e,t);break;case"IncludeOnScalar":pc(e,t);break;case"EmptySelection":mc(e,t,r);break;case"UnknownSelectionField":hc(e,t);break;case"InvalidSelectionValue":yc(e,t);break;case"UnknownArgument":wc(e,t);break;case"UnknownInputField":Ec(e,t);break;case"RequiredArgumentMissing":bc(e,t);break;case"InvalidArgumentType":xc(e,t);break;case"InvalidArgumentValue":Pc(e,t);break;case"ValueTooLarge":vc(e,t);break;case"SomeFieldsMissing":Tc(e,t);break;case"TooManyFieldsGiven":Cc(e,t);break;case"Union":jo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function cc(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 pc(e,t){let[r,n]=Ft(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 ne(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)}. ${Lt(s)}`:a+=".",a+=`
20
- Note that ${s.bold("include")} statements only accept relation fields.`,a})}function mc(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){dc(e,t,i);return}if(n.hasField("select")){fc(e,t);return}}if(r?.[Xe(e.outputType.name)]){gc(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function dc(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ne(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 fc(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Wo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${Lt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function gc(e,t){let r=new Mt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ne("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=Ft(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new ot;l.addSuggestion(n),a.value=l}}t.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(e.outputType.name)}. At least one field must be included in the result`)}function hc(e,t){let r=Ho(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Wo(n,e.outputType);break;case"include":Ac(n,e.outputType);break;case"omit":Rc(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(Lt(n)),i.join(" ")})}function yc(e,t){let r=Ho(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 wc(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Sc(n,e.arguments)),t.addErrorMessage(i=>Jo(i,r,e.arguments.map(o=>o.name)))}function Ec(e,t){let[r,n]=Ft(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Ko(o,e.inputType)}t.addErrorMessage(o=>Jo(o,n,e.inputType.fields.map(s=>s.name)))}function Jo(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Oc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(Lt(e)),n.join(" ")}function bc(e,t){let r;t.addErrorMessage(l=>r?.value instanceof $&&r.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=Ft(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 l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new ne(o,s).makeRequired())}else{let l=e.inputTypes.map(Go).join(" | ");a.addSuggestion(new ne(o,l).makeRequired())}}function Go(e){return e.kind==="list"?`${Go(e.elementType)}[]`:e.name}function xc(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=jr("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 Pc(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=jr("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function vc(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i;if(n){let s=n.getDeepField(e.argumentPath)?.value;s?.markAsError(),s instanceof $&&(i=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 Tc(e,t){let r=e.argumentPath[e.argumentPath.length-1],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getDeepFieldValue(e.argumentPath)?.asObject();i&&Ko(i,e.inputType)}t.addErrorMessage(i=>{let o=[`Argument \`${i.bold(r)}\` of type ${i.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1?e.constraints.requiredFields?o.push(`${i.green("at least one of")} ${jr("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(Lt(i)),o.join(" ")})}function Cc(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 ${jr("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Wo(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ne(r.name,"true"))}function Ac(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new ne(r.name,"true"))}function Rc(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new ne(r.name,"true"))}function Sc(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new ne(r.name,r.typeNames.join(" | ")))}function Ho(e,t){let[r,n]=Ft(e),i=t.arguments.getDeepSubSelectionValue(r)?.asObject();if(!i)return{parentKind:"unknown",fieldName:n};let o=i.getFieldValue("select")?.asObject(),s=i.getFieldValue("include")?.asObject(),a=i.getFieldValue("omit")?.asObject(),l=o?.getField(n);return o&&l?{parentKind:"select",parent:o,field:l,fieldName:n}:(l=s?.getField(n),s&&l?{parentKind:"include",field:l,parent:s,fieldName:n}:(l=a?.getField(n),a&&l?{parentKind:"omit",field:l,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function Ko(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ne(r.name,r.typeNames.join(" | ")))}function Ft(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function Lt({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function jr(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var kc=3;function Oc(e,t){let r=1/0,n;for(let i of t){let o=(0,Qo.default)(e,i);o>kc||o<r&&(r=o,n=i)}return n}function zo(e){return e.substring(0,1).toLowerCase()+e.substring(1)}var Vt=class{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 Vt}var Ur=Symbol(),Hn=new WeakMap,ve=class{constructor(t){t===Ur?Hn.set(this,`Prisma.${this._getName()}`):Hn.set(this,`new Prisma.${this._getNamespace()}.${this._getName()}()`)}_getName(){return this.constructor.name}toString(){return Hn.get(this)}},$t=class extends ve{_getNamespace(){return"NullTypes"}},qt=class extends $t{};Kn(qt,"DbNull");var jt=class extends $t{};Kn(jt,"JsonNull");var Ut=class extends $t{};Kn(Ut,"AnyNull");var Br={classes:{DbNull:qt,JsonNull:jt,AnyNull:Ut},instances:{DbNull:new qt(Ur),JsonNull:new jt(Ur),AnyNull:new Ut(Ur)}};function Kn(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var Yo=": ",Qr=class{constructor(t,r){this.name=t;this.value=r;this.hasError=!1}markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Yo.length}write(t){let r=new de(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Yo).write(this.value)}};var zn=class{constructor(t){this.errorMessages=[];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(`
21
- `)}};function at(e){return new zn(Zo(e))}function Zo(e){let t=new ot;for(let[r,n]of Object.entries(e)){let i=new Qr(r,Xo(n));t.addField(i)}return t}function Xo(e){if(typeof e=="string")return new $(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new $(String(e));if(typeof e=="bigint")return new $(`${e}n`);if(e===null)return new $("null");if(e===void 0)return new $("undefined");if(tt(e))return new $(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new $(`Buffer.alloc(${e.byteLength})`):new $(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Nr(e)?e.toISOString():"Invalid Date";return new $(`new Date("${t}")`)}return e instanceof ve?new $(`Prisma.${e._getName()}`):st(e)?new $(`prisma.${zo(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Ic(e):typeof e=="object"?Zo(e):new $(Object.prototype.toString.call(e))}function Ic(e){let t=new it;for(let r of e)t.addItem(Xo(r));return t}function Jr(e,t){let r=t==="pretty"?Bo:qr,n=e.renderAllMessages(r),i=new rt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Gr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=at(e);for(let p of t)Lr(p,a,s);let{message:l,args:u}=Jr(a,r),c=Fr({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:u});throw new G(c,{clientVersion:o})}var fe=class{constructor(){this._map=new Map}get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};function Bt(e){let t;return{get(){return t||(t={value:e()}),t.value}}}function ge(e){return e.replace(/^./,t=>t.toLowerCase())}function ts(e,t,r){let n=ge(r);return!t.result||!(t.result.$allModels||t.result[n])?e:Dc({...e,...es(t.name,e,t.result.$allModels),...es(t.name,e,t.result[n])})}function Dc(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 Ke(e,n=>({...n,needs:r(n.name,new Set)}))}function es(e,t,r){return r?Ke(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Nc(t,o,i)})):{}}function Nc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function rs(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function ns(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var Wr=class{constructor(t,r){this.extension=t;this.previous=r;this.computedFieldsCache=new fe;this.modelExtensionsCache=new fe;this.queryCallbacksCache=new fe;this.clientExtensions=Bt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=Bt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t})}getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>ts(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=ge(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 Wr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Wr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var Hr=class{constructor(t){this.name=t}};function is(e){return e instanceof Hr}function os(e){return new Hr(e)}var ss=Symbol(),Qt=class{constructor(t){if(t!==ss)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Kr:t}},Kr=new Qt(ss);function he(e){return e instanceof Qt}var _c={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"},as="explicitly `undefined` values are not allowed";function zr({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=lt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c}){let p=new Yn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c});return{modelName:e,action:_c[t],query:Jt(r,p)}}function Jt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:us(r,n),selection:Mc(e,t,i,n)}}function Mc(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),$c(e,n)):Fc(n,t,r)}function Fc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&Lc(n,t,e),Vc(n,r,e),n}function Lc(e,t,r){for(let[n,i]of Object.entries(t)){if(he(i))continue;let o=r.nestSelection(n);if(Zn(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]=Jt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Jt(i,o)}}function Vc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=ns(i,n);for(let[s,a]of Object.entries(o)){if(he(a))continue;Zn(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function $c(e,t){let r={},n=t.getComputedFields(),i=rs(e,n);for(let[o,s]of Object.entries(i)){if(he(s))continue;let a=t.nestSelection(o);Zn(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||he(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=Jt({},a):r[o]=!0;continue}r[o]=Jt(s,a)}}return r}function ls(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(et(e)){if(Nr(e))return{$type:"DateTime",value:e.toISOString()};t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(is(e))return{$type:"Param",value:e.name};if(st(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return qc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:Buffer.from(r,n,i).toString("base64")}}if(jc(e))return e.values;if(tt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof ve){if(e!==Br.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(Uc(e))return e.toJSON();if(typeof e=="object")return us(e,t);t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function us(e,t){if(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]=ls(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:as}))}return r}function qc(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(ls(o,i))}return r}function jc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function Uc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Zn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:as})}var Yn=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])}throwValidationError(t){Gr({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?.[Xe(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:re(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};function cs(e){if(!e._hasPreviewFlag("metrics"))throw new G("`metrics` preview feature must be enabled in order to access metrics API",{clientVersion:e._clientVersion})}var ut=class{constructor(t){this._client=t}prometheus(t){return cs(this._client),this._client._engine.metrics({format:"prometheus",...t})}json(t){return cs(this._client),this._client._engine.metrics({format:"json",...t})}};function ps(e){return{models:Xn(e.models),enums:Xn(e.enums),types:Xn(e.types)}}function Xn(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}function ms(e,t){let r=Bt(()=>Bc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Bc(e){return{datamodel:{models:ei(e.models),enums:ei(e.enums),types:ei(e.types)}}}function ei(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}var ti=new WeakMap,Yr="$$PrismaTypedSql",ri=class{constructor(t,r){ti.set(this,{sql:t,values:r}),Object.defineProperty(this,Yr,{value:Yr})}get sql(){return ti.get(this).sql}get values(){return ti.get(this).values}};function ds(e){return(...t)=>new ri(e,t)}function fs(e){return e!=null&&e[Yr]===Yr}function Gt(e){return{ok:!1,error:e,map(){return Gt(e)},flatMap(){return Gt(e)}}}var ni=class{constructor(){this.registeredErrors=[]}consumeError(t){return this.registeredErrors[t]}registerNewError(t){let r=0;for(;this.registeredErrors[r]!==void 0;)r++;return this.registeredErrors[r]={error:t},r}},ii=e=>{let t=new ni,r=ye(t,e.transactionContext.bind(e)),n={adapterName:e.adapterName,errorRegistry:t,queryRaw:ye(t,e.queryRaw.bind(e)),executeRaw:ye(t,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...i)=>(await r(...i)).map(s=>Qc(t,s))};return e.getConnectionInfo&&(n.getConnectionInfo=Gc(t,e.getConnectionInfo.bind(e))),n},Qc=(e,t)=>{let r=ye(e,t.startTransaction.bind(t));return{adapterName:t.adapterName,provider:t.provider,queryRaw:ye(e,t.queryRaw.bind(t)),executeRaw:ye(e,t.executeRaw.bind(t)),startTransaction:async(...n)=>(await r(...n)).map(o=>Jc(e,o))}},Jc=(e,t)=>({adapterName:t.adapterName,provider:t.provider,options:t.options,queryRaw:ye(e,t.queryRaw.bind(t)),executeRaw:ye(e,t.executeRaw.bind(t)),commit:ye(e,t.commit.bind(t)),rollback:ye(e,t.rollback.bind(t))});function ye(e,t){return async(...r)=>{try{return await t(...r)}catch(n){let i=e.registerNewError(n);return Gt({kind:"GenericJs",id:i})}}}function Gc(e,t){return(...r)=>{try{return t(...r)}catch(n){let i=e.registerNewError(n);return Gt({kind:"GenericJs",id:i})}}}var Wa=B(gs());var Ha=require("async_hooks"),Ka=require("events"),za=B(require("fs")),yr=B(require("path"));var X=class e{constructor(t,r){if(t.length-1!==r.length)throw t.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${t.length} strings to have ${t.length-1} values`);let n=r.reduce((s,a)=>s+(a instanceof e?a.values.length:1),0);this.values=new Array(n),this.strings=new Array(n+1),this.strings[0]=t[0];let i=0,o=0;for(;i<r.length;){let s=r[i++],a=t[i];if(s instanceof e){this.strings[o]+=s.strings[0];let l=0;for(;l<s.values.length;)this.values[o++]=s.values[l++],this.strings[o]=s.strings[l];this.strings[o]+=a}else this.values[o++]=s,this.strings[o]=a}}get sql(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`?${this.strings[r++]}`;return n}get statement(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`:${r}${this.strings[r++]}`;return n}get text(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`$${r}${this.strings[r++]}`;return n}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function hs(e,t=",",r="",n=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new X([r,...Array(e.length-1).fill(t),n],e)}function oi(e){return new X([e],[])}var ys=oi("");function si(e,...t){return new X(e,t)}function Wt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}function K(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}function Ve(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)}}}var Zr={enumerable:!0,configurable:!0,writable:!0};function Xr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Zr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var ws=Symbol.for("nodejs.util.inspect.custom");function ue(e,t){let r=Hc(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=Es(Reflect.ownKeys(o),r),a=Es(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...Zr,...l?.getPropertyDescriptor(s)}:Zr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[ws]=function(){let o={...this};return delete o[ws],o},i}function Hc(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 Es(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}function ct(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function en(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}function bs(e){if(e===void 0)return"";let t=at(e);return new rt(0,{colors:qr}).write(t).toString()}var Kc="P2037";function tn({error:e,user_facing_error:t},r,n){return t.error_code?new Q(zc(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new J(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function zc(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===Kc&&(r+=`
22
- Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}var Ht="<unknown>";function xs(e){var t=e.split(`
23
- `);return t.reduce(function(r,n){var i=Xc(n)||tp(n)||ip(n)||lp(n)||sp(n);return i&&r.push(i),r},[])}var Yc=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zc=/\((\S*)(?::(\d+))(?::(\d+))\)/;function Xc(e){var t=Yc.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=Zc.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||Ht,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var ep=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function tp(e){var t=ep.exec(e);return t?{file:t[2],methodName:t[1]||Ht,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var rp=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,np=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function ip(e){var t=rp.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=np.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||Ht,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var op=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function sp(e){var t=op.exec(e);return t?{file:t[3],methodName:t[1]||Ht,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var ap=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function lp(e){var t=ap.exec(e);return t?{file:t[2],methodName:t[1]||Ht,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var ai=class{getLocation(){return null}},li=class{constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=xs(t).find(i=>{if(!i.file)return!1;let o=Fn(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/binary.js")&&!o.endsWith("/runtime/library.js")&&!o.endsWith("/runtime/edge.js")&&!o.endsWith("/runtime/edge-esm.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function Ie(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new ai:new li}var Ps={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function pt(e={}){let t=cp(e);return Object.entries(t).reduce((n,[i,o])=>(Ps[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function cp(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function rn(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function vs(e,t){let r=rn(e);return t({action:"aggregate",unpacker:r,argsMapper:pt})(e)}function pp(e={}){let{select:t,...r}=e;return typeof t=="object"?pt({...r,_count:t}):pt({...r,_count:{_all:!0}})}function mp(e={}){return typeof e.select=="object"?t=>rn(e)(t)._count:t=>rn(e)(t)._count._all}function Ts(e,t){return t({action:"count",unpacker:mp(e),argsMapper:pp})(e)}function dp(e={}){let t=pt(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 fp(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Cs(e,t){return t({action:"groupBy",unpacker:fp(e),argsMapper:dp})(e)}function As(e,t,r){if(t==="aggregate")return n=>vs(n,r);if(t==="count")return n=>Ts(n,r);if(t==="groupBy")return n=>Cs(n,r)}function Rs(e,t){let r=t.fields.filter(i=>!i.relationName),n=qn(r,i=>i.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 Vt(e,o,s.type,s.isList,s.kind==="enum")},...Xr(Object.keys(n))})}var Ss=e=>Array.isArray(e)?e:e.split("."),ui=(e,t)=>Ss(t).reduce((r,n)=>r&&r[n],e),ks=(e,t,r)=>Ss(t).reduceRight((n,i,o,s)=>Object.assign({},ui(e,s.slice(0,o)),{[i]:n}),r);function gp(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function hp(e,t,r){return t===void 0?e??{}:ks(t,r,e||!0)}function ci(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,u)=>({...l,[u.name]:u}),{});return l=>{let u=Ie(e._errorFormat),c=gp(n,i),p=hp(l,o,c),m=r({dataPath:c,callsite:u})(p),f=yp(e,t);return new Proxy(m,{get(g,h){if(!f.includes(h))return g[h];let P=[a[h].type,r,h],T=[c,p];return ci(e,...P,...T)},...Xr([...f,...Object.getOwnPropertyNames(m)])})}}function yp(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var wp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Ep=["aggregate","count","groupBy"];function pi(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[bp(e,t),Pp(e,t),Wt(r),K("name",()=>t),K("$name",()=>t),K("$parent",()=>e._appliedParent)];return ue({},n)}function bp(e,t){let r=ge(t),n=Object.keys(kt.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let u=Ie(e._errorFormat);return e._createPrismaPromise(c=>{let p={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:c,callsite:u};return e._request({...p,...a})},{action:o,args:l,model:t})};return wp.includes(o)?ci(e,t,s):xp(i)?As(e,i,s):s({})}}}function xp(e){return Ep.includes(e)}function Pp(e,t){return Ve(K("fields",()=>{let r=e._runtimeDataModel.models[t];return Rs(t,r)}))}function Os(e){return e.replace(/^./,t=>t.toUpperCase())}var mi=Symbol();function Kt(e){let t=[vp(e),Tp(e),K(mi,()=>e),K("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Wt(r)),ue(e,t)}function vp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function Tp(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(ge),n=[...new Set(t.concat(r))];return Ve({getKeys(){return n},getPropertyValue(i){let o=Os(i);if(e._runtimeDataModel.models[o]!==void 0)return pi(e,o);if(e._runtimeDataModel.models[i]!==void 0)return pi(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Is(e){return e[mi]?e[mi]:e}function Ds(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let r=e.client.__AccelerateEngine;this._originalClient._engine=new r(this._originalClient._accelerateEngineConfig)}let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return Kt(t)}function Ns({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(c=>n[c]);u.length>0&&a.push(ct(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(c=>!r[c]);u.length>0&&a.push(ct(u))}Cp(e,l.needs)&&s.push(Ap(l,ue(e,s)))}return s.length>0||a.length>0?ue(e,[...s,...a]):e}function Cp(e,t){return t.every(r=>$n(e,r))}function Ap(e,t){return Ve(K(e.name,()=>e.compute(t)))}function nn({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=nn({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&_s({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&_s({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function _s({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 l=n.models[r].fields.find(c=>c.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=nn({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function Ms({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:nn({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,l,u)=>{let c=ge(l);return Ns({result:a,modelName:c,select:u.select,omit:u.select?void 0:{...o?.[c],...u.omit},extensions:n})}})}function Fs(e){if(e instanceof X)return Rp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=zt(e[n]);return r}let t={};for(let r in e)t[r]=zt(e[r]);return t}function Rp(e){return new X(e.strings,e.values)}function zt(e){if(typeof e!="object"||e==null||e instanceof ve||st(e))return e;if(tt(e))return new me(e.toFixed());if(et(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let t=e.length,r;for(r=Array(t);t--;)r[t]=zt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:zt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=zt(e[r]);return t}re(e,"Unknown value")}function Vs(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:Fs(t.args??{}),__internalParams:t,query:(s,a=t)=>{let l=a.customDataProxyFetch;return a.customDataProxyFetch=Us(o,l),a.args=s,Vs(e,a,r,n+1)}})})}function $s(e,t){let{jsModelName:r,action:n,clientMethod:i}=t,o=r?n:i;if(e._extensions.isEmpty())return e._executeRequest(t);let s=e._extensions.getAllQueryCallbacks(r??"$none",o);return Vs(e,t,s)}function qs(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?js(r,n,0,e):e(r)}}function js(e,t,r,n){if(r===t.length)return n(e);let i=e.customDataProxyFetch,o=e.requests[0].transaction;return t[r]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:e,query(s,a=e){let l=a.customDataProxyFetch;return a.customDataProxyFetch=Us(i,l),js(a,t,r+1,n)}})}var Ls=e=>e;function Us(e=Ls,t=Ls){return r=>e(t(r))}var Bs=M("prisma:client"),Qs={Vercel:"vercel","Netlify CI":"netlify"};function Js({postinstall:e,ciName:t,clientVersion:r}){if(Bs("checkPlatformCaching:postinstall",e),Bs("checkPlatformCaching:ciName",t),e===!0&&t&&t in Qs){let n=`Prisma has detected that this project was built on ${t}, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the \`prisma generate\` command during the build process.
24
-
25
- Learn how: https://pris.ly/d/${Qs[t]}-build`;throw console.error(n),new S(n,r)}}function Gs(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}var Sp="Cloudflare-Workers",kp="node";function Ws(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Sp?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===kp?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var Op={node:"Node.js",workerd:"Cloudflare Workers",deno:"Deno and Deno Deploy",netlify:"Netlify Edge Functions","edge-light":"Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)"};function on(){let e=Ws();return{id:e,prettyName:Op[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}var di=B(Vn());function Hs(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function Ks(e){return e.split(`
17
+ `)}};var Zu={red:Ee,gray:Ct,dim:_e,bold:H,underline:Y,highlightSource:e=>e.highlight()},Xu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function ec({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function tc({callsite:e,message:t,originalMethod:r,isPanic:n,callArguments:i},o){let s=ec({message:t,originalMethod:r,isPanic:n,callArguments:i});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let a=e.getLocation();if(!a||!a.lineNumber||!a.columnNumber)return s;let l=Math.max(1,a.lineNumber-3),u=Mr.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=nc(c),m=rc(c);if(!m)return s;s.functionName=`${m.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,g=>g.slice(0,m.openingBraceIndex))),u=o.highlightSource(u);let f=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((g,h)=>o.gray(String(h).padStart(f))+" "+g).mapLines(g=>o.dim(g)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let g=p+f+1;g+=2,s.callArguments=(0,Vo.default)(i,g).slice(g)}}return s}function rc(e){let t=Object.keys(kt.ModelAction).join("|"),n=new RegExp(String.raw`\.(${t})\(`).exec(e);if(n){let i=n.index+n[0].length,o=e.lastIndexOf(" ",n.index)+1;return{code:e.slice(o,i),openingBraceIndex:i}}return null}function nc(e){let t=0;for(let r=0;r<e.length;r++){if(e.charAt(r)!==" ")return t;t++}return t}function ic({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=t?" in":":";if(n?(a.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),a.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${l}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${l}`)),t&&a.push(s.underline(oc(t))),i){a.push("");let u=[i.toString()];o&&(u.push(o),u.push(s.dim(")"))),a.push(u.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
18
+ `)}function oc(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function Fr(e){let t=e.showColors?Zu:Xu,r;return r=tc(e,t),ic(r,t)}var Jo=B(Hn());function Uo(e,t,r){let n=Bo(e),i=sc(n),o=lc(i);o?Lr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Bo(e){return e.errors.flatMap(t=>t.kind==="Union"?Bo(t):[t])}function sc(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:ac(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function ac(e,t){return[...new Set(e.concat(t))]}function lc(e){return Un(e,(t,r)=>{let n=qo(t),i=qo(r);return n!==i?n-i:jo(t)-jo(r)})}function qo(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function jo(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var ne=class{constructor(t,r){this.name=t;this.value=r;this.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)}};var rt=class{constructor(t=0,r){this.context=r;this.lines=[];this.currentLine="";this.currentIndent=0;this.currentIndent=t}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(`
19
+ `)}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}};var Vr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};var $r=e=>e,qr={bold:$r,red:$r,green:$r,dim:$r,enabled:!1},Qo={bold:H,red:Ee,green:Tt,dim:_e,enabled:!0},nt={write(e){e.writeLine(",")}};var de=class{constructor(t){this.contents=t;this.isUnderlined=!1;this.color=t=>t}underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};var Oe=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var it=class extends Oe{constructor(){super(...arguments);this.items=[]}addItem(r){return this.items.push(new Vr(r)),this}getField(r){return this.items[r]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(n=>n.value.getPrintWidth()))+2}write(r){if(this.items.length===0){this.writeEmpty(r);return}this.writeWithItems(r)}writeEmpty(r){let n=new de("[]");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithItems(r){let{colors:n}=r.context;r.writeLine("[").withIndent(()=>r.writeJoined(nt,this.items).newLine()).write("]"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(n.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var ot=class e extends Oe{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(r){this.fields[r.name]=r}addSuggestion(r){this.suggestions.push(r)}getField(r){return this.fields[r]}getDeepField(r){let[n,...i]=r,o=this.getField(n);if(!o)return;let s=o;for(let a of i){let l;if(s.value instanceof e?l=s.value.getField(a):s.value instanceof it&&(l=s.value.getField(Number(a))),!l)return;s=l}return s}getDeepFieldValue(r){return r.length===0?this:this.getDeepField(r)?.value}hasField(r){return!!this.getField(r)}removeAllFields(){this.fields={}}removeField(r){delete this.fields[r]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(r){return this.getField(r)?.value}getDeepSubSelectionValue(r){let n=this;for(let i of r){if(!(n instanceof e))return;let o=n.getSubSelectionValue(i);if(!o)return;n=o}return n}getDeepSelectionParent(r){let n=this.getSelectionParent();if(!n)return;let i=n;for(let o of r){let s=i.value.getFieldValue(o);if(!s||!(s instanceof e))return;let a=s.getSelectionParent();if(!a)return;i=a}return i}getSelectionParent(){let r=this.getField("select")?.value.asObject();if(r)return{kind:"select",value:r};let n=this.getField("include")?.value.asObject();if(n)return{kind:"include",value:n}}getSubSelectionValue(r){return this.getSelectionParent()?.value.fields[r].value}getPrintWidth(){let r=Object.values(this.fields);return r.length==0?2:Math.max(...r.map(i=>i.getPrintWidth()))+2}write(r){let n=Object.values(this.fields);if(n.length===0&&this.suggestions.length===0){this.writeEmpty(r);return}this.writeWithContents(r,n)}asObject(){return this}writeEmpty(r){let n=new de("{}");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithContents(r,n){r.writeLine("{").withIndent(()=>{r.writeJoined(nt,[...n,...this.suggestions]).newLine()}),r.write("}"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(r.context.colors.red("~".repeat(this.getPrintWidth())))})}};var $=class extends Oe{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new de(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};var Mt=class{constructor(){this.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(nt,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Lr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":cc(e,t);break;case"IncludeOnScalar":pc(e,t);break;case"EmptySelection":mc(e,t,r);break;case"UnknownSelectionField":hc(e,t);break;case"InvalidSelectionValue":yc(e,t);break;case"UnknownArgument":wc(e,t);break;case"UnknownInputField":Ec(e,t);break;case"RequiredArgumentMissing":bc(e,t);break;case"InvalidArgumentType":xc(e,t);break;case"InvalidArgumentValue":Pc(e,t);break;case"ValueTooLarge":vc(e,t);break;case"SomeFieldsMissing":Tc(e,t);break;case"TooManyFieldsGiven":Cc(e,t);break;case"Union":Uo(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function cc(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 pc(e,t){let[r,n]=Ft(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 ne(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)}. ${Lt(s)}`:a+=".",a+=`
20
+ Note that ${s.bold("include")} statements only accept relation fields.`,a})}function mc(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){dc(e,t,i);return}if(n.hasField("select")){fc(e,t);return}}if(r?.[Xe(e.outputType.name)]){gc(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function dc(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ne(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 fc(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Ho(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${Lt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function gc(e,t){let r=new Mt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ne("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=Ft(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new ot;l.addSuggestion(n),a.value=l}}t.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(e.outputType.name)}. At least one field must be included in the result`)}function hc(e,t){let r=Ko(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Ho(n,e.outputType);break;case"include":Ac(n,e.outputType);break;case"omit":Rc(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(Lt(n)),i.join(" ")})}function yc(e,t){let r=Ko(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 wc(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Sc(n,e.arguments)),t.addErrorMessage(i=>Go(i,r,e.arguments.map(o=>o.name)))}function Ec(e,t){let[r,n]=Ft(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&zo(o,e.inputType)}t.addErrorMessage(o=>Go(o,n,e.inputType.fields.map(s=>s.name)))}function Go(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Oc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(Lt(e)),n.join(" ")}function bc(e,t){let r;t.addErrorMessage(l=>r?.value instanceof $&&r.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=Ft(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 l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new ne(o,s).makeRequired())}else{let l=e.inputTypes.map(Wo).join(" | ");a.addSuggestion(new ne(o,l).makeRequired())}}function Wo(e){return e.kind==="list"?`${Wo(e.elementType)}[]`:e.name}function xc(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=jr("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 Pc(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=jr("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function vc(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i;if(n){let s=n.getDeepField(e.argumentPath)?.value;s?.markAsError(),s instanceof $&&(i=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 Tc(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&&zo(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")} ${jr("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(Lt(i)),o.join(" ")})}function Cc(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 ${jr("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Ho(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ne(r.name,"true"))}function Ac(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new ne(r.name,"true"))}function Rc(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new ne(r.name,"true"))}function Sc(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new ne(r.name,r.typeNames.join(" | ")))}function Ko(e,t){let[r,n]=Ft(e),i=t.arguments.getDeepSubSelectionValue(r)?.asObject();if(!i)return{parentKind:"unknown",fieldName:n};let o=i.getFieldValue("select")?.asObject(),s=i.getFieldValue("include")?.asObject(),a=i.getFieldValue("omit")?.asObject(),l=o?.getField(n);return o&&l?{parentKind:"select",parent:o,field:l,fieldName:n}:(l=s?.getField(n),s&&l?{parentKind:"include",field:l,parent:s,fieldName:n}:(l=a?.getField(n),a&&l?{parentKind:"omit",field:l,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function zo(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ne(r.name,r.typeNames.join(" | ")))}function Ft(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function Lt({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function jr(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var kc=3;function Oc(e,t){let r=1/0,n;for(let i of t){let o=(0,Jo.default)(e,i);o>kc||o<r&&(r=o,n=i)}return n}function Yo(e){return e.substring(0,1).toLowerCase()+e.substring(1)}var Vt=class{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 Vt}var Ur=Symbol(),Kn=new WeakMap,ve=class{constructor(t){t===Ur?Kn.set(this,`Prisma.${this._getName()}`):Kn.set(this,`new Prisma.${this._getNamespace()}.${this._getName()}()`)}_getName(){return this.constructor.name}toString(){return Kn.get(this)}},$t=class extends ve{_getNamespace(){return"NullTypes"}},qt=class extends $t{};zn(qt,"DbNull");var jt=class extends $t{};zn(jt,"JsonNull");var Ut=class extends $t{};zn(Ut,"AnyNull");var Br={classes:{DbNull:qt,JsonNull:jt,AnyNull:Ut},instances:{DbNull:new qt(Ur),JsonNull:new jt(Ur),AnyNull:new Ut(Ur)}};function zn(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var Zo=": ",Qr=class{constructor(t,r){this.name=t;this.value=r;this.hasError=!1}markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Zo.length}write(t){let r=new de(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Zo).write(this.value)}};var Yn=class{constructor(t){this.errorMessages=[];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(`
21
+ `)}};function at(e){return new Yn(Xo(e))}function Xo(e){let t=new ot;for(let[r,n]of Object.entries(e)){let i=new Qr(r,es(n));t.addField(i)}return t}function es(e){if(typeof e=="string")return new $(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new $(String(e));if(typeof e=="bigint")return new $(`${e}n`);if(e===null)return new $("null");if(e===void 0)return new $("undefined");if(tt(e))return new $(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new $(`Buffer.alloc(${e.byteLength})`):new $(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Nr(e)?e.toISOString():"Invalid Date";return new $(`new Date("${t}")`)}return e instanceof ve?new $(`Prisma.${e._getName()}`):st(e)?new $(`prisma.${Yo(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Ic(e):typeof e=="object"?Xo(e):new $(Object.prototype.toString.call(e))}function Ic(e){let t=new it;for(let r of e)t.addItem(es(r));return t}function Jr(e,t){let r=t==="pretty"?Qo:qr,n=e.renderAllMessages(r),i=new rt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Gr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=at(e);for(let p of t)Lr(p,a,s);let{message:l,args:u}=Jr(a,r),c=Fr({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:u});throw new G(c,{clientVersion:o})}var fe=class{constructor(){this._map=new Map}get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};function Bt(e){let t;return{get(){return t||(t={value:e()}),t.value}}}function ge(e){return e.replace(/^./,t=>t.toLowerCase())}function rs(e,t,r){let n=ge(r);return!t.result||!(t.result.$allModels||t.result[n])?e:Dc({...e,...ts(t.name,e,t.result.$allModels),...ts(t.name,e,t.result[n])})}function Dc(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 Ke(e,n=>({...n,needs:r(n.name,new Set)}))}function ts(e,t,r){return r?Ke(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Nc(t,o,i)})):{}}function Nc(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function ns(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function is(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 Wr=class{constructor(t,r){this.extension=t;this.previous=r;this.computedFieldsCache=new fe;this.modelExtensionsCache=new fe;this.queryCallbacksCache=new fe;this.clientExtensions=Bt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=Bt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t})}getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>rs(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=ge(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 Wr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new Wr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var Hr=class{constructor(t){this.name=t}};function os(e){return e instanceof Hr}function ss(e){return new Hr(e)}var as=Symbol(),Qt=class{constructor(t){if(t!==as)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Kr:t}},Kr=new Qt(as);function he(e){return e instanceof Qt}var _c={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"},ls="explicitly `undefined` values are not allowed";function zr({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=lt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c}){let p=new Zn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:u,globalOmit:c});return{modelName:e,action:_c[t],query:Jt(r,p)}}function Jt({select:e,include:t,...r}={},n){let i=r.omit;return delete r.omit,{arguments:cs(r,n),selection:Mc(e,t,i,n)}}function Mc(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),$c(e,n)):Fc(n,t,r)}function Fc(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&Lc(n,t,e),Vc(n,r,e),n}function Lc(e,t,r){for(let[n,i]of Object.entries(t)){if(he(i))continue;let o=r.nestSelection(n);if(Xn(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]=Jt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Jt(i,o)}}function Vc(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=is(i,n);for(let[s,a]of Object.entries(o)){if(he(a))continue;Xn(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function $c(e,t){let r={},n=t.getComputedFields(),i=ns(e,n);for(let[o,s]of Object.entries(i)){if(he(s))continue;let a=t.nestSelection(o);Xn(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||he(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=Jt({},a):r[o]=!0;continue}r[o]=Jt(s,a)}}return r}function us(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(et(e)){if(Nr(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(os(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 qc(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:Buffer.from(r,n,i).toString("base64")}}if(jc(e))return e.values;if(tt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof ve){if(e!==Br.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(Uc(e))return e.toJSON();if(typeof e=="object")return cs(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 cs(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]=us(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:ls}))}return r}function qc(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(us(o,i))}return r}function jc(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function Uc(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Xn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:ls})}var Zn=class e{constructor(t){this.params=t;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}throwValidationError(t){Gr({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?.[Xe(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:re(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};function ps(e){if(!e._hasPreviewFlag("metrics"))throw new G("`metrics` preview feature must be enabled in order to access metrics API",{clientVersion:e._clientVersion})}var ut=class{constructor(t){this._client=t}prometheus(t){return ps(this._client),this._client._engine.metrics({format:"prometheus",...t})}json(t){return ps(this._client),this._client._engine.metrics({format:"json",...t})}};function ms(e){return{models:ei(e.models),enums:ei(e.enums),types:ei(e.types)}}function ei(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}function ds(e,t){let r=Bt(()=>Bc(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Bc(e){return{datamodel:{models:ti(e.models),enums:ti(e.enums),types:ti(e.types)}}}function ti(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}var ri=new WeakMap,Yr="$$PrismaTypedSql",ni=class{constructor(t,r){ri.set(this,{sql:t,values:r}),Object.defineProperty(this,Yr,{value:Yr})}get sql(){return ri.get(this).sql}get values(){return ri.get(this).values}};function fs(e){return(...t)=>new ni(e,t)}function gs(e){return e!=null&&e[Yr]===Yr}function Gt(e){return{ok:!1,error:e,map(){return Gt(e)},flatMap(){return Gt(e)}}}var ii=class{constructor(){this.registeredErrors=[]}consumeError(t){return this.registeredErrors[t]}registerNewError(t){let r=0;for(;this.registeredErrors[r]!==void 0;)r++;return this.registeredErrors[r]={error:t},r}},oi=e=>{let t=new ii,r=ye(t,e.transactionContext.bind(e)),n={adapterName:e.adapterName,errorRegistry:t,queryRaw:ye(t,e.queryRaw.bind(e)),executeRaw:ye(t,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...i)=>(await r(...i)).map(s=>Qc(t,s))};return e.getConnectionInfo&&(n.getConnectionInfo=Gc(t,e.getConnectionInfo.bind(e))),n},Qc=(e,t)=>{let r=ye(e,t.startTransaction.bind(t));return{adapterName:t.adapterName,provider:t.provider,queryRaw:ye(e,t.queryRaw.bind(t)),executeRaw:ye(e,t.executeRaw.bind(t)),startTransaction:async(...n)=>(await r(...n)).map(o=>Jc(e,o))}},Jc=(e,t)=>({adapterName:t.adapterName,provider:t.provider,options:t.options,queryRaw:ye(e,t.queryRaw.bind(t)),executeRaw:ye(e,t.executeRaw.bind(t)),commit:ye(e,t.commit.bind(t)),rollback:ye(e,t.rollback.bind(t))});function ye(e,t){return async(...r)=>{try{return await t(...r)}catch(n){let i=e.registerNewError(n);return Gt({kind:"GenericJs",id:i})}}}function Gc(e,t){return(...r)=>{try{return t(...r)}catch(n){let i=e.registerNewError(n);return Gt({kind:"GenericJs",id:i})}}}var Wa=B(hs());var Ha=require("async_hooks"),Ka=require("events"),za=B(require("fs")),yr=B(require("path"));var X=class e{constructor(t,r){if(t.length-1!==r.length)throw t.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${t.length} strings to have ${t.length-1} values`);let n=r.reduce((s,a)=>s+(a instanceof e?a.values.length:1),0);this.values=new Array(n),this.strings=new Array(n+1),this.strings[0]=t[0];let i=0,o=0;for(;i<r.length;){let s=r[i++],a=t[i];if(s instanceof e){this.strings[o]+=s.strings[0];let l=0;for(;l<s.values.length;)this.values[o++]=s.values[l++],this.strings[o]=s.strings[l];this.strings[o]+=a}else this.values[o++]=s,this.strings[o]=a}}get sql(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`?${this.strings[r++]}`;return n}get statement(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`:${r}${this.strings[r++]}`;return n}get text(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`$${r}${this.strings[r++]}`;return n}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function ys(e,t=",",r="",n=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new X([r,...Array(e.length-1).fill(t),n],e)}function si(e){return new X([e],[])}var ws=si("");function ai(e,...t){return new X(e,t)}function Wt(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}function K(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}function Ve(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)}}}var Zr={enumerable:!0,configurable:!0,writable:!0};function Xr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Zr,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 ue(e,t){let r=Hc(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=bs(Reflect.ownKeys(o),r),a=bs(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...Zr,...l?.getPropertyDescriptor(s)}:Zr: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 Hc(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 bs(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}function ct(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function en(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}function xs(e){if(e===void 0)return"";let t=at(e);return new rt(0,{colors:qr}).write(t).toString()}var Kc="P2037";function tn({error:e,user_facing_error:t},r,n){return t.error_code?new Q(zc(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new J(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function zc(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===Kc&&(r+=`
22
+ Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}var Ht="<unknown>";function Ps(e){var t=e.split(`
23
+ `);return t.reduce(function(r,n){var i=Xc(n)||tp(n)||ip(n)||lp(n)||sp(n);return i&&r.push(i),r},[])}var Yc=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zc=/\((\S*)(?::(\d+))(?::(\d+))\)/;function Xc(e){var t=Yc.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=Zc.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||Ht,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var ep=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function tp(e){var t=ep.exec(e);return t?{file:t[2],methodName:t[1]||Ht,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var rp=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,np=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function ip(e){var t=rp.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=np.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||Ht,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var op=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function sp(e){var t=op.exec(e);return t?{file:t[3],methodName:t[1]||Ht,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var ap=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function lp(e){var t=ap.exec(e);return t?{file:t[2],methodName:t[1]||Ht,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var li=class{getLocation(){return null}},ui=class{constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=Ps(t).find(i=>{if(!i.file)return!1;let o=Ln(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/binary.js")&&!o.endsWith("/runtime/library.js")&&!o.endsWith("/runtime/edge.js")&&!o.endsWith("/runtime/edge-esm.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function Ie(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new li:new ui}var vs={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function pt(e={}){let t=cp(e);return Object.entries(t).reduce((n,[i,o])=>(vs[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function cp(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function rn(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Ts(e,t){let r=rn(e);return t({action:"aggregate",unpacker:r,argsMapper:pt})(e)}function pp(e={}){let{select:t,...r}=e;return typeof t=="object"?pt({...r,_count:t}):pt({...r,_count:{_all:!0}})}function mp(e={}){return typeof e.select=="object"?t=>rn(e)(t)._count:t=>rn(e)(t)._count._all}function Cs(e,t){return t({action:"count",unpacker:mp(e),argsMapper:pp})(e)}function dp(e={}){let t=pt(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 fp(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function As(e,t){return t({action:"groupBy",unpacker:fp(e),argsMapper:dp})(e)}function Rs(e,t,r){if(t==="aggregate")return n=>Ts(n,r);if(t==="count")return n=>Cs(n,r);if(t==="groupBy")return n=>As(n,r)}function Ss(e,t){let r=t.fields.filter(i=>!i.relationName),n=jn(r,i=>i.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 Vt(e,o,s.type,s.isList,s.kind==="enum")},...Xr(Object.keys(n))})}var ks=e=>Array.isArray(e)?e:e.split("."),ci=(e,t)=>ks(t).reduce((r,n)=>r&&r[n],e),Os=(e,t,r)=>ks(t).reduceRight((n,i,o,s)=>Object.assign({},ci(e,s.slice(0,o)),{[i]:n}),r);function gp(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function hp(e,t,r){return t===void 0?e??{}:Os(t,r,e||!0)}function pi(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,u)=>({...l,[u.name]:u}),{});return l=>{let u=Ie(e._errorFormat),c=gp(n,i),p=hp(l,o,c),m=r({dataPath:c,callsite:u})(p),f=yp(e,t);return new Proxy(m,{get(g,h){if(!f.includes(h))return g[h];let P=[a[h].type,r,h],T=[c,p];return pi(e,...P,...T)},...Xr([...f,...Object.getOwnPropertyNames(m)])})}}function yp(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var wp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Ep=["aggregate","count","groupBy"];function mi(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[bp(e,t),Pp(e,t),Wt(r),K("name",()=>t),K("$name",()=>t),K("$parent",()=>e._appliedParent)];return ue({},n)}function bp(e,t){let r=ge(t),n=Object.keys(kt.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let u=Ie(e._errorFormat);return e._createPrismaPromise(c=>{let p={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:c,callsite:u};return e._request({...p,...a})},{action:o,args:l,model:t})};return wp.includes(o)?pi(e,t,s):xp(i)?Rs(e,i,s):s({})}}}function xp(e){return Ep.includes(e)}function Pp(e,t){return Ve(K("fields",()=>{let r=e._runtimeDataModel.models[t];return Ss(t,r)}))}function Is(e){return e.replace(/^./,t=>t.toUpperCase())}var di=Symbol();function Kt(e){let t=[vp(e),Tp(e),K(di,()=>e),K("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Wt(r)),ue(e,t)}function vp(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function Tp(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(ge),n=[...new Set(t.concat(r))];return Ve({getKeys(){return n},getPropertyValue(i){let o=Is(i);if(e._runtimeDataModel.models[o]!==void 0)return mi(e,o);if(e._runtimeDataModel.models[i]!==void 0)return mi(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Ds(e){return e[di]?e[di]:e}function Ns(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let r=e.client.__AccelerateEngine;this._originalClient._engine=new r(this._originalClient._accelerateEngineConfig)}let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return Kt(t)}function _s({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(c=>n[c]);u.length>0&&a.push(ct(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(c=>!r[c]);u.length>0&&a.push(ct(u))}Cp(e,l.needs)&&s.push(Ap(l,ue(e,s)))}return s.length>0||a.length>0?ue(e,[...s,...a]):e}function Cp(e,t){return t.every(r=>qn(e,r))}function Ap(e,t){return Ve(K(e.name,()=>e.compute(t)))}function nn({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=nn({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Ms({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Ms({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Ms({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 l=n.models[r].fields.find(c=>c.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=nn({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function Fs({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:nn({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,l,u)=>{let c=ge(l);return _s({result:a,modelName:c,select:u.select,omit:u.select?void 0:{...o?.[c],...u.omit},extensions:n})}})}function Ls(e){if(e instanceof X)return Rp(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=zt(e[n]);return r}let t={};for(let r in e)t[r]=zt(e[r]);return t}function Rp(e){return new X(e.strings,e.values)}function zt(e){if(typeof e!="object"||e==null||e instanceof ve||st(e))return e;if(tt(e))return new me(e.toFixed());if(et(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let t=e.length,r;for(r=Array(t);t--;)r[t]=zt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:zt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=zt(e[r]);return t}re(e,"Unknown value")}function $s(e,t,r,n=0){return e._createPrismaPromise(i=>{let o=t.customDataProxyFetch;return"transaction"in t&&i!==void 0&&(t.transaction?.kind==="batch"&&t.transaction.lock.then(),t.transaction=i),n===r.length?e._executeRequest(t):r[n]({model:t.model,operation:t.model?t.action:t.clientMethod,args:Ls(t.args??{}),__internalParams:t,query:(s,a=t)=>{let l=a.customDataProxyFetch;return a.customDataProxyFetch=Bs(o,l),a.args=s,$s(e,a,r,n+1)}})})}function qs(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 $s(e,t,s)}function js(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?Us(r,n,0,e):e(r)}}function Us(e,t,r,n){if(r===t.length)return n(e);let i=e.customDataProxyFetch,o=e.requests[0].transaction;return t[r]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:e,query(s,a=e){let l=a.customDataProxyFetch;return a.customDataProxyFetch=Bs(i,l),Us(a,t,r+1,n)}})}var Vs=e=>e;function Bs(e=Vs,t=Vs){return r=>e(t(r))}var Qs=M("prisma:client"),Js={Vercel:"vercel","Netlify CI":"netlify"};function Gs({postinstall:e,ciName:t,clientVersion:r}){if(Qs("checkPlatformCaching:postinstall",e),Qs("checkPlatformCaching:ciName",t),e===!0&&t&&t in Js){let n=`Prisma has detected that this project was built on ${t}, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the \`prisma generate\` command during the build process.
24
+
25
+ Learn how: https://pris.ly/d/${Js[t]}-build`;throw console.error(n),new S(n,r)}}function Ws(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}var Sp="Cloudflare-Workers",kp="node";function Hs(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Sp?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===kp?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var Op={node:"Node.js",workerd:"Cloudflare Workers",deno:"Deno and Deno Deploy",netlify:"Netlify Edge Functions","edge-light":"Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)"};function on(){let e=Hs();return{id:e,prettyName:Op[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}var fi=B($n());function Ks(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function zs(e){return e.split(`
26
26
  `).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(`
27
- `)}var zs=B(go());function Ys({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,zs.default)({user:t,repo:r,template:n,title:e,body:i})}function Zs({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=Ji(6e3-(s?.length??0)),l=Ks((0,di.default)(a)),u=n?`# Description
27
+ `)}var Ys=B(ho());function Zs({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Ys.default)({user:t,repo:r,template:n,title:e,body:i})}function Xs({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=Gi(6e3-(s?.length??0)),l=zs((0,fi.default)(a)),u=n?`# Description
28
28
  \`\`\`
29
29
  ${n}
30
- \`\`\``:"",c=(0,di.default)(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
30
+ \`\`\``:"",c=(0,fi.default)(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
31
31
  ## Versions
32
32
 
33
33
  | Name | Version |
@@ -57,9 +57,9 @@ ${l}
57
57
 
58
58
  ## Prisma Engine Query
59
59
  \`\`\`
60
- ${s?Hs(s):""}
60
+ ${s?Ks(s):""}
61
61
  \`\`\`
62
- `),p=Ys({title:r,body:c});return`${r}
62
+ `),p=Zs({title:r,body:c});return`${r}
63
63
 
64
64
  This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
65
65
 
@@ -68,26 +68,26 @@ ${Y(p)}
68
68
  If you want the Prisma team to look into it, please open the link above \u{1F64F}
69
69
  To increase the chance of success, please post your schema and a snippet of
70
70
  how you used Prisma Client in the issue.
71
- `}function fi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}var gi="/* prisma-comma-repeatable-start */",Xs="/* prisma-comma-repeatable-end */";function ea({query:e,params:t}){let r=[],n=1,i="",o=0;for(;o<e.length;)if(e.slice(o,o+gi.length)===gi){o+=gi.length,i+="(";let s=parseInt(e.slice(o).match(/^\$(\d+)/)?.[1]??"0"),a=t[s-1],l=a.map((u,c)=>"$"+(n+c)).join(", ");i+=l,r.push(...a),n+=a.length,o+=e.slice(o).indexOf(Xs)+Xs.length,i+=")"}else if(e[o]==="$"){let s=e.slice(o+1).match(/^\d+/);if(s){let a=parseInt(s[0]),l=t[a-1];Array.isArray(l)||(i+="$"+n,r.push(l),n++,o+=s[0].length+1)}else i+=e[o],o++}else i+=e[o],o++;return{query:i,params:r}}function hi({query:e,params:t},r){let n=t.map(a=>{if(!fi(a))return a;let l=r[a.prisma__value.name];if(l===void 0)throw new Error(`Missing value for query variable ${a.prisma__value.name}`);return l}),{query:i,params:o}=ea({query:e,params:n}),s=o.map(a=>Ip(a));return{sql:i,args:o,argTypes:s}}function Ip(e){return e===null?"Int32":typeof e=="string"?"Text":typeof e=="number"?"Numeric":typeof e=="boolean"?"Boolean":Array.isArray(e)?"Array":fi(e)?Dp(e.prisma__value.type):"Json"}function Dp(e){let r={Any:"Json",String:"Text",Int:"Int32",BigInt:"Int64",Float:"Double",Boolean:"Boolean",Decimal:"Numeric",Date:"DateTime",Object:"Json",Bytes:"Bytes",Array:"Array"}[e];if(!r)throw new Error(`Unknown placeholder type: ${e}`);return r}function ta(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}var mt,Zt,Xt,er,yi,Yt=class{constructor({queryable:t,placeholderValues:r,onQuery:n}){Ne(this,er);Ne(this,mt);Ne(this,Zt);Ne(this,Xt);Ge(this,mt,t),Ge(this,Zt,r),Ge(this,Xt,n)}async run(t){return this.interpretNode(t,Ce(this,Zt))}async interpretNode(t,r){switch(t.type){case"seq":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r)));return n[n.length-1]}case"get":return r[t.args.name];case"let":{let n=Object.create(r);return await Promise.all(t.args.bindings.map(async i=>{n[i.name]=await this.interpretNode(i.expr,r)})),this.interpretNode(t.args.expr,n)}case"getFirstNonEmpty":{for(let n of t.args.names){let i=r[n];if(!ra(i))return i}return[]}case"concat":return(await Promise.all(t.args.map(i=>this.interpretNode(i,r)))).reduce((i,o)=>i.concat(Np(o)),[]);case"sum":return(await Promise.all(t.args.map(i=>this.interpretNode(i,r)))).reduce((i,o)=>na(i)+na(o));case"execute":{let n=hi(t.args,r);return vn(this,er,yi).call(this,n,async()=>{let i=await Ce(this,mt).executeRaw(n);if(i.ok)return i.value;throw i.error})}case"query":{let n=hi(t.args,r);return vn(this,er,yi).call(this,n,async()=>{let i=await Ce(this,mt).queryRaw(n);if(i.ok)return ta(i.value);throw i.error})}case"reverse":{let n=await this.interpretNode(t.args,r);return Array.isArray(n)?n.reverse():n}case"unique":{let n=await this.interpretNode(t.args,r);if(!Array.isArray(n))return n;if(n.length!==1)throw new Error(`Expected exactly one element, got ${n.length}`);return n[0]}case"required":{let n=await this.interpretNode(t.args,r);if(ra(n))throw new Error("Required value is empty");return n}case"mapField":{let n=await this.interpretNode(t.args.records,r);return sa(n,t.args.field)}case"join":{let n=await this.interpretNode(t.args.parent,r),i=await Promise.all(t.args.children.map(async o=>({joinExpr:o,childRecords:await this.interpretNode(o.child,r)})));if(Array.isArray(n)){for(let o of n)ia(sn(o),i);return n}return ia(sn(n),i)}default:throw new Error(`Unexpected node type: ${t.type}`)}}};mt=new WeakMap,Zt=new WeakMap,Xt=new WeakMap,er=new WeakSet,yi=async function(t,r){var a;let n=new Date,i=performance.now(),o=await r(),s=performance.now();return(a=Ce(this,Xt))==null||a.call(this,{timestamp:n,duration:s-i,query:t.sql,params:JSON.stringify(t.args),target:"QueryInterpreter"}),o};function ra(e){return Array.isArray(e)?e.length===0:e==null}function Np(e){return Array.isArray(e)?e:[e]}function na(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function sn(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function sa(e,t){return Array.isArray(e)?e.map(r=>sa(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function ia(e,t){for(let{joinExpr:r,childRecords:n}of t)e[r.parentField]=_p(n,e,r);return e}function _p(e,t,r){if(Array.isArray(e))return e.filter(n=>oa(sn(n),t,r));{let n=sn(e);return oa(n,t,r)?n:null}}function oa(e,t,r){for(let[n,i]of r.on)if(t[n]!==e[i])return!1;return!0}var la=B(require("crypto"));var ie=class extends Q{constructor(t,{clientVersion:r,meta:n}){super("Transaction API error: "+t,{code:"P2028",clientVersion:r,meta:n})}},$e=class extends ie{constructor(t,r){super(`Error from Driver Adapter: ${t}`,{clientVersion:r.clientVersion,meta:{...r.driverAdapterError}})}},tr=class extends ie{constructor(t){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.",t)}},an=class extends ie{constructor(t,r){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction`,r)}},ln=class extends ie{constructor(t,r){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction`,r)}},un=class extends ie{constructor(t){super("Unable to start a transaction in the given time.",t)}},cn=class extends ie{constructor(t,{clientVersion:r,timeout:n,timeTaken:i}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${n} ms, however ${i} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction`,{clientVersion:r})}},dt=class extends ie{constructor(t,r){super(`Internal Consistency Error: ${t}`,r)}},rr=class extends ie{constructor(t,r){super(`Invalid isolation level: ${t}`,r)}};var Mp=100,Fp={ReadUncommitted:"READ UNCOMMITTED",ReadCommitted:"READ COMMITTED",RepeatableRead:"REPEATABLE READ",Snapshot:"SNAPSHOT",Serializable:"SERIALIZABLE"},nr=M("prisma:client:transactionManager"),Lp=()=>({sql:"COMMIT",args:[],argTypes:[]}),Vp=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),aa=e=>({sql:"SET TRANSACTION ISOLATION LEVEL "+Fp[e],args:[],argTypes:[]}),pn=class{constructor({driverAdapter:t,clientVersion:r}){this.transactions=new Map;this.closedTransactions=[];this.driverAdapter=t,this.clientVersion=r}async startTransaction(t){let r=this.validateOptions(t),n={id:la.default.randomUUID(),status:"waiting",timer:void 0,timeout:r.timeout,startedAt:Date.now(),transaction:void 0};this.transactions.set(n.id,n),n.timer=this.startTransactionTimeout(n.id,r.maxWait);let i=await this.driverAdapter.transactionContext();if(!i.ok)throw new $e("Failed to start transaction.",{driverAdapterError:i.error,clientVersion:this.clientVersion});this.requiresSettingIsolationLevelFirst()&&r.isolationLevel&&await i.value.executeRaw(aa(r.isolationLevel));let o=await i.value.startTransaction();if(!o.ok)throw new $e("Failed to start transaction.",{driverAdapterError:o.error,clientVersion:this.clientVersion});switch(o.value.options.usePhantomQuery||(await o.value.executeRaw({sql:"BEGIN",args:[],argTypes:[]}),!this.requiresSettingIsolationLevelFirst()&&r.isolationLevel&&await i.value.executeRaw(aa(r.isolationLevel))),n.status){case"waiting":return n.transaction=o.value,clearTimeout(n.timer),n.timer=void 0,n.status="running",n.timer=this.startTransactionTimeout(n.id,r.timeout),{id:n.id,payload:void 0};case"timed_out":throw new un({clientVersion:this.clientVersion});case"running":case"committed":case"rolled_back":throw new dt(`Transaction in invalid state ${n.status} although it just finished startup.`,{clientVersion:this.clientVersion});default:re(n.status,"Unknown transaction status.")}}async commitTransaction(t){let r=this.getActiveTransaction(t,"commit");await this.closeTransaction(r,"committed")}async rollbackTransaction(t){let r=this.getActiveTransaction(t,"rollback");await this.closeTransaction(r,"rolled_back")}getTransaction(t,r){let n=this.getActiveTransaction(t.id,r);if(!n.transaction)throw new tr({clientVersion:this.clientVersion});return n.transaction}getActiveTransaction(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(nr("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"waiting":case"running":throw new dt("Active transaction found in closed transactions list.",{clientVersion:this.clientVersion});case"committed":throw new an(r,{clientVersion:this.clientVersion});case"rolled_back":throw new ln(r,{clientVersion:this.clientVersion});case"timed_out":throw new cn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt,clientVersion:this.clientVersion})}else throw nr("Transaction not found.",t),new tr({clientVersion:this.clientVersion})}if(["committed","rolled_back","timed_out"].includes(n.status))throw new dt("Closed transaction found in active transactions map.",{clientVersion:this.clientVersion});return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.closeTransaction(t,"rolled_back")))}startTransactionTimeout(t,r){let n=Date.now();return setTimeout(async()=>{nr("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let i=this.transactions.get(t);i&&["running","waiting"].includes(i.status)?await this.closeTransaction(i,"timed_out"):nr("Transaction already committed or rolled back when timeout happened.",t)},r)}async closeTransaction(t,r){if(nr("Closing transaction.",{transactionId:t.id,status:r}),t.status=r,t.transaction&&r==="committed"){let n=await t.transaction.commit();if(!n.ok)throw new $e("Failed to commit transaction.",{driverAdapterError:n.error,clientVersion:this.clientVersion});t.transaction.options.usePhantomQuery||await t.transaction.executeRaw(Lp())}else if(t.transaction){let n=await t.transaction.rollback();if(!n.ok)throw new $e("Failed to rollback transaction.",{driverAdapterError:n.error,clientVersion:this.clientVersion});t.transaction.options.usePhantomQuery||await t.transaction.executeRaw(Vp())}clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>Mp&&this.closedTransactions.shift()}validateOptions(t){if(!t.timeout)throw new ie("timeout is required",{clientVersion:this.clientVersion});if(!t.maxWait)throw new ie("maxWait is required",{clientVersion:this.clientVersion});if(t.isolationLevel==="Snapshot")throw new rr(t.isolationLevel,{clientVersion:this.clientVersion});if(this.driverAdapter.provider==="sqlite"&&t.isolationLevel&&t.isolationLevel!=="Serializable")throw new rr(t.isolationLevel,{clientVersion:this.clientVersion});return{...t,timeout:t.timeout,maxWait:t.maxWait}}requiresSettingIsolationLevelFirst(){return this.driverAdapter.provider==="mysql"}};var wi,ua={async loadQueryCompiler(e){let{clientVersion:t,adapter:r,compilerWasm:n}=e;if(r===void 0)throw new S(`The \`adapter\` option for \`PrismaClient\` is required in this context (${on().prettyName})`,t);if(n===void 0)throw new S("WASM query compiler was unexpectedly `undefined`",t);return wi===void 0&&(wi=(async()=>{let i=n.getRuntime(),o=await n.getQueryCompilerWasmModule();if(o==null)throw new S("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={"./query_compiler_bg.js":i},a=new WebAssembly.Instance(o,s);return i.__wbg_set_wasm(a.exports),i.QueryCompiler})()),await wi}};var ca="P2038",mn=M("prisma:client:clientEngine"),ft,gt=class{constructor(t,r){this.name="ClientEngine";Ne(this,ft);if(!t.previewFeatures?.includes("driverAdapters"))throw new S("EngineType `client` requires the driverAdapters preview feature to be enabled.",t.clientVersion,ca);let{adapter:n}=t;if(n)this.driverAdapter=n,mn("Using driver adapter: %O",n);else throw new S("Missing configured driver adapter. Engine type `client` requires an active driver adapter. Please check your PrismaClient initialization code.",t.clientVersion,ca);this.queryCompilerLoader=r??ua,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&Ge(this,ft,i=>{this.logEmitter.emit("query",i)}),this.transactionManager=new pn({driverAdapter:this.driverAdapter,clientVersion:this.config.clientVersion}),this.instantiateQueryCompilerPromise=this.instantiateQueryCompiler()}applyPendingMigrations(){throw new Error("Cannot call applyPendingMigrations on engine type client.")}async instantiateQueryCompiler(){if(!this.queryCompiler){this.QueryCompilerConstructor||(this.QueryCompilerConstructor=await this.queryCompilerLoader.loadQueryCompiler(this.config));try{this.queryCompiler=new this.QueryCompilerConstructor({datamodel:this.datamodel,provider:this.driverAdapter.provider,connectionInfo:{}})}catch(t){throw this.transformInitError(t)}}}transformInitError(t){try{let r=JSON.parse(t.message);return new S(r.message,this.config.clientVersion,r.error_code)}catch{return t}}transformRequestError(t){if(t instanceof S)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new se($p(this,t.message),this.config.clientVersion);try{let r=JSON.parse(t);return new J(`${r.message}
72
- ${r.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the client engine, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.')}async start(){await this.instantiateQueryCompilerPromise}async stop(){await this.instantiateQueryCompilerPromise,await this.transactionManager.cancelAllTransactions()}version(){return"unknown"}async transaction(t,r,n){let i;if(t==="start"){let o=n;i=await this.transactionManager.startTransaction(o)}else if(t==="commit"){let o=n;await this.transactionManager.commitTransaction(o.id)}else if(t==="rollback"){let o=n;await this.transactionManager.rollbackTransaction(o.id)}else re(t,"Invalid transaction action.");return i}async request(t,{traceparent:r,interactiveTransaction:n}){mn("sending request");let i=JSON.stringify(t);this.lastStartedQuery=i;try{await this.start();let o=await this.queryCompiler.compile(i),s=JSON.parse(o);mn("query plan created",o);let a=n?this.transactionManager.getTransaction(n,t.action):this.driverAdapter,l={},c=await new Yt({queryable:a,placeholderValues:l,onQuery:Ce(this,ft)}).run(s);return mn("query plan executed"),{data:{[t.action]:c}}}catch(o){throw this.transformRequestError(o)}}async requestBatch(t,{transaction:r,traceparent:n}){this.lastStartedQuery=JSON.stringify(t);try{await this.start();let i=await Promise.all(t.map(async a=>{let l=JSON.stringify(a),u=await this.queryCompiler.compile(l);return{query:a,plan:JSON.parse(u)}})),o;if(r?.kind==="itx")o=r.options;else{let a=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;o=await this.transaction("start",{},a)}let s=[];for(let{query:a,plan:l}of i){let u=this.transactionManager.getTransaction(o,a.action),c=new Yt({queryable:u,placeholderValues:{},onQuery:Ce(this,ft)});s.push(await c.run(l))}return r?.kind!=="itx"&&await this.transaction("commit",{},o),s}catch(i){throw this.transformRequestError(i)}}metrics(t){throw new Error("Method not implemented.")}};ft=new WeakMap;function $p(e,t){return Zs({binaryTarget:void 0,title:t,version:e.config.clientVersion,engineVersion:"unknown",database:e.config.activeProvider,query:e.lastStartedQuery})}function ht({inlineDatasources:e,overrideDatasources:t,env:r,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=t[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=r[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw new S(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new S("error: Missing URL environment variable, value, or override.",n);return i}var dn=class extends Error{constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var ee=class extends dn{constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function C(e,t){return{...e,isRetryable:t}}var yt=class extends ee{constructor(r){super("This request must be retried",C(r,!0));this.name="ForcedRetryError";this.code="P5001"}};b(yt,"ForcedRetryError");var qe=class extends ee{constructor(r,n){super(r,C(n,!1));this.name="InvalidDatasourceError";this.code="P6001"}};b(qe,"InvalidDatasourceError");var je=class extends ee{constructor(r,n){super(r,C(n,!1));this.name="NotImplementedYetError";this.code="P5004"}};b(je,"NotImplementedYetError");var _=class extends ee{constructor(t,r){super(t,r),this.response=r.response;let n=this.response.headers.get("prisma-request-id");if(n){let i=`(The request id was: ${n})`;this.message=this.message+" "+i}}};var Ue=class extends _{constructor(r){super("Schema needs to be uploaded",C(r,!0));this.name="SchemaMissingError";this.code="P5005"}};b(Ue,"SchemaMissingError");var Ei="This request could not be understood by the server",ir=class extends _{constructor(r,n,i){super(n||Ei,C(r,!1));this.name="BadRequestError";this.code="P5000";i&&(this.code=i)}};b(ir,"BadRequestError");var or=class extends _{constructor(r,n){super("Engine not started: healthcheck timeout",C(r,!0));this.name="HealthcheckTimeoutError";this.code="P5013";this.logs=n}};b(or,"HealthcheckTimeoutError");var sr=class extends _{constructor(r,n,i){super(n,C(r,!0));this.name="EngineStartupError";this.code="P5014";this.logs=i}};b(sr,"EngineStartupError");var ar=class extends _{constructor(r){super("Engine version is not supported",C(r,!1));this.name="EngineVersionNotSupportedError";this.code="P5012"}};b(ar,"EngineVersionNotSupportedError");var bi="Request timed out",lr=class extends _{constructor(r,n=bi){super(n,C(r,!1));this.name="GatewayTimeoutError";this.code="P5009"}};b(lr,"GatewayTimeoutError");var qp="Interactive transaction error",ur=class extends _{constructor(r,n=qp){super(n,C(r,!1));this.name="InteractiveTransactionError";this.code="P5015"}};b(ur,"InteractiveTransactionError");var jp="Request parameters are invalid",cr=class extends _{constructor(r,n=jp){super(n,C(r,!1));this.name="InvalidRequestError";this.code="P5011"}};b(cr,"InvalidRequestError");var xi="Requested resource does not exist",pr=class extends _{constructor(r,n=xi){super(n,C(r,!1));this.name="NotFoundError";this.code="P5003"}};b(pr,"NotFoundError");var Pi="Unknown server error",wt=class extends _{constructor(r,n,i){super(n||Pi,C(r,!0));this.name="ServerError";this.code="P5006";this.logs=i}};b(wt,"ServerError");var vi="Unauthorized, check your connection string",mr=class extends _{constructor(r,n=vi){super(n,C(r,!1));this.name="UnauthorizedError";this.code="P5007"}};b(mr,"UnauthorizedError");var Ti="Usage exceeded, retry again later",dr=class extends _{constructor(r,n=Ti){super(n,C(r,!0));this.name="UsageExceededError";this.code="P5008"}};b(dr,"UsageExceededError");async function Up(e){let t;try{t=await e.text()}catch{return{type:"EmptyError"}}try{let r=JSON.parse(t);if(typeof r=="string")switch(r){case"InternalDataProxyError":return{type:"DataProxyError",body:r};default:return{type:"UnknownTextError",body:r}}if(typeof r=="object"&&r!==null){if("is_panic"in r&&"message"in r&&"error_code"in r)return{type:"QueryEngineError",body:r};if("EngineNotStarted"in r||"InteractiveTransactionMisrouted"in r||"InvalidRequestError"in r){let n=Object.values(r)[0].reason;return typeof n=="string"&&!["SchemaMissing","EngineVersionNotSupported"].includes(n)?{type:"UnknownJsonError",body:r}:{type:"DataProxyError",body:r}}}return{type:"UnknownJsonError",body:r}}catch{return t===""?{type:"EmptyError"}:{type:"UnknownTextError",body:t}}}async function fr(e,t){if(e.ok)return;let r={clientVersion:t,response:e},n=await Up(e);if(n.type==="QueryEngineError")throw new Q(n.body.message,{code:n.body.error_code,clientVersion:t});if(n.type==="DataProxyError"){if(n.body==="InternalDataProxyError")throw new wt(r,"Internal Data Proxy error");if("EngineNotStarted"in n.body){if(n.body.EngineNotStarted.reason==="SchemaMissing")return new Ue(r);if(n.body.EngineNotStarted.reason==="EngineVersionNotSupported")throw new ar(r);if("EngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,logs:o}=n.body.EngineNotStarted.reason.EngineStartupError;throw new sr(r,i,o)}if("KnownEngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,error_code:o}=n.body.EngineNotStarted.reason.KnownEngineStartupError;throw new S(i,t,o)}if("HealthcheckTimeout"in n.body.EngineNotStarted.reason){let{logs:i}=n.body.EngineNotStarted.reason.HealthcheckTimeout;throw new or(r,i)}}if("InteractiveTransactionMisrouted"in n.body){let i={IDParseError:"Could not parse interactive transaction ID",NoQueryEngineFoundError:"Could not find Query Engine for the specified host and transaction ID",TransactionStartError:"Could not start interactive transaction"};throw new ur(r,i[n.body.InteractiveTransactionMisrouted.reason])}if("InvalidRequestError"in n.body)throw new cr(r,n.body.InvalidRequestError.reason)}if(e.status===401||e.status===403)throw new mr(r,Et(vi,n));if(e.status===404)return new pr(r,Et(xi,n));if(e.status===429)throw new dr(r,Et(Ti,n));if(e.status===504)throw new lr(r,Et(bi,n));if(e.status>=500)throw new wt(r,Et(Pi,n));if(e.status>=400)throw new ir(r,Et(Ei,n))}function Et(e,t){return t.type==="EmptyError"?e:`${e}: ${JSON.stringify(t)}`}function pa(e){let t=Math.pow(2,e)*50,r=Math.ceil(Math.random()*t)-Math.ceil(t/2),n=t+r;return new Promise(i=>setTimeout(()=>i(n),n))}var Te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ma(e){let t=new TextEncoder().encode(e),r="",n=t.byteLength,i=n%3,o=n-i,s,a,l,u,c;for(let p=0;p<o;p=p+3)c=t[p]<<16|t[p+1]<<8|t[p+2],s=(c&16515072)>>18,a=(c&258048)>>12,l=(c&4032)>>6,u=c&63,r+=Te[s]+Te[a]+Te[l]+Te[u];return i==1?(c=t[o],s=(c&252)>>2,a=(c&3)<<4,r+=Te[s]+Te[a]+"=="):i==2&&(c=t[o]<<8|t[o+1],s=(c&64512)>>10,a=(c&1008)>>4,l=(c&15)<<2,r+=Te[s]+Te[a]+Te[l]+"="),r}function da(e){if(!!e.generator?.previewFeatures.some(r=>r.toLowerCase().includes("metrics")))throw new S("The `metrics` preview feature is not yet available with Accelerate.\nPlease remove `metrics` from the `previewFeatures` in your schema.\n\nMore information about Accelerate: https://pris.ly/d/accelerate",e.clientVersion)}function Bp(e){return e[0]*1e3+e[1]/1e6}function Ci(e){return new Date(Bp(e))}var fa={"@prisma/debug":"workspace:*","@prisma/engines-version":"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22","@prisma/fetch-engine":"workspace:*","@prisma/get-platform":"workspace:*"};var gr=class extends ee{constructor(r,n){super(`Cannot fetch data from service:
73
- ${r}`,C(n,!0));this.name="RequestError";this.code="P5010"}};b(gr,"RequestError");async function Be(e,t,r=n=>n){let{clientVersion:n,...i}=t,o=r(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new gr(a,{clientVersion:n,cause:s})}}var Jp=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,ga=M("prisma:client:dataproxyEngine");async function Gp(e,t){let r=fa["@prisma/engines-version"],n=t.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&Jp.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){if(e.startsWith("localhost")||e.startsWith("127.0.0.1"))return"0.0.0";let[s]=r.split("-")??[],[a,l,u]=s.split("."),c=Wp(`<=${a}.${l}.${u}`),p=await Be(c,{clientVersion:n});if(!p.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${p.status} ${p.statusText}, response body: ${await p.text()||"<empty body>"}`);let m=await p.text();ga("length of body fetched from unpkg.com",m.length);let f;try{f=JSON.parse(m)}catch(g){throw console.error("JSON.parse error: body fetched from unpkg.com: ",m),g}return f.version}throw new je("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function ha(e,t){let r=await Gp(e,t);return ga("version",r),r}function Wp(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var ya=3,fn=M("prisma:client:dataproxyEngine"),Ai=class{constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,interactiveTransaction:r}={}){let n={Authorization:`Bearer ${this.apiKey}`,"Prisma-Engine-Hash":this.engineHash};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-transaction-id"]=r.id);let i=this.buildCaptureSettings();return i.length>0&&(n["X-capture-telemetry"]=i.join(", ")),n}buildCaptureSettings(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}},hr=class{constructor(t){this.name="DataProxyEngine";da(t),this.config=t,this.env={...t.env,...typeof process<"u"?process.env:{}},this.inlineSchema=ma(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let[t,r]=this.extractHostAndApiKey();this.host=t,this.headerBuilder=new Ai({apiKey:r,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel,logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await ha(t,this.config),fn("host",this.host)})(),await this.startPromise}async stop(){}propagateResponseExtensions(t){t?.logs?.length&&t.logs.forEach(r=>{switch(r.level){case"debug":case"trace":fn(r);break;case"error":case"warn":case"info":{this.logEmitter.emit(r.level,{timestamp:Ci(r.timestamp),message:r.attributes.message??"",target:r.target});break}case"query":{this.logEmitter.emit("query",{query:r.attributes.query??"",timestamp:Ci(r.timestamp),duration:r.attributes.duration_ms??0,params:r.attributes.params??"",target:r.target});break}default:r.level}}),t?.traces?.length&&this.tracingHelper.dispatchEngineSpans(t.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(t){return await this.start(),`https://${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${t}`}async uploadSchema(){let t={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(t,async()=>{let r=await Be(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});r.ok||fn("schema response status",r.status);let n=await fr(r,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(t,{traceparent:r,interactiveTransaction:n,customDataProxyFetch:i}){return this.requestInternal({body:t,traceparent:r,interactiveTransaction:n,customDataProxyFetch:i})}async requestBatch(t,{traceparent:r,transaction:n,customDataProxyFetch:i}){let o=n?.kind==="itx"?n.options:void 0,s=en(t,n);return(await this.requestInternal({body:s,customDataProxyFetch:i,interactiveTransaction:o,traceparent:r})).map(l=>(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l?this.convertProtocolErrorsToClientError(l.errors):l))}requestInternal({body:t,traceparent:r,customDataProxyFetch:n,interactiveTransaction:i}){return this.withRetry({actionGerund:"querying",callback:async({logHttpCall:o})=>{let s=i?`${i.payload.endpoint}/graphql`:await this.url("graphql");o(s);let a=await Be(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r,interactiveTransaction:i}),body:JSON.stringify(t),clientVersion:this.clientVersion},n);a.ok||fn("graphql response status",a.status),await this.handleError(await fr(a,this.clientVersion));let l=await a.json();if(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l)throw this.convertProtocolErrorsToClientError(l.errors);return"batchResult"in l?l.batchResult:l}})}async transaction(t,r,n){let i={start:"starting",commit:"committing",rollback:"rolling back"};return this.withRetry({actionGerund:`${i[t]} transaction`,callback:async({logHttpCall:o})=>{if(t==="start"){let s=JSON.stringify({max_wait:n.maxWait,timeout:n.timeout,isolation_level:n.isolationLevel}),a=await this.url("transaction/start");o(a);let l=await Be(a,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),body:s,clientVersion:this.clientVersion});await this.handleError(await fr(l,this.clientVersion));let u=await l.json(),{extensions:c}=u;c&&this.propagateResponseExtensions(c);let p=u.id,m=u["data-proxy"].endpoint;return{id:p,payload:{endpoint:m}}}else{let s=`${n.payload.endpoint}/${t}`;o(s);let a=await Be(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),clientVersion:this.clientVersion});await this.handleError(await fr(a,this.clientVersion));let l=await a.json(),{extensions:u}=l;u&&this.propagateResponseExtensions(u);return}}})}extractHostAndApiKey(){let t={clientVersion:this.clientVersion},r=Object.keys(this.inlineDatasources)[0],n=ht({inlineDatasources:this.inlineDatasources,overrideDatasources:this.config.overrideDatasources,clientVersion:this.clientVersion,env:this.env}),i;try{i=new URL(n)}catch{throw new qe(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t)}let{protocol:o,host:s,searchParams:a}=i;if(o!=="prisma:"&&o!==vr)throw new qe(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t);let l=a.get("api_key");if(l===null||l.length<1)throw new qe(`Error validating datasource \`${r}\`: the URL must contain a valid API key`,t);return[s,l]}metrics(){throw new je("Metrics are not yet supported for Accelerate",{clientVersion:this.clientVersion})}async withRetry(t){for(let r=0;;r++){let n=i=>{this.logEmitter.emit("info",{message:`Calling ${i} (n=${r})`,timestamp:new Date,target:""})};try{return await t.callback({logHttpCall:n})}catch(i){if(!(i instanceof ee)||!i.isRetryable)throw i;if(r>=ya)throw i instanceof yt?i.cause:i;this.logEmitter.emit("warn",{message:`Attempt ${r+1}/${ya} failed for ${t.actionGerund}: ${i.message??"(unknown)"}`,timestamp:new Date,target:""});let o=await pa(r);this.logEmitter.emit("warn",{message:`Retrying after ${o}ms`,timestamp:new Date,target:""})}}}async handleError(t){if(t instanceof Ue)throw await this.uploadSchema(),new yt({clientVersion:this.clientVersion,cause:t});if(t)throw t}convertProtocolErrorsToClientError(t){return t.length===1?tn(t[0],this.config.clientVersion,this.config.activeProvider):new J(JSON.stringify(t),{clientVersion:this.config.clientVersion})}applyPendingMigrations(){throw new Error("Method not implemented.")}};function wa({copyEngine:e=!0},t){let r;try{r=ht({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...process.env},clientVersion:t.clientVersion})}catch{}let n=!!(r?.startsWith("prisma://")||Mn(r));e&&n&&Nt("recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)");let i=He(t.generator),o=n||!e,s=!!t.adapter,a=i==="library",l=i==="binary",u=i==="client";if(o&&s||s&&!1){let c;throw e?r?.startsWith("prisma://")?c=["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]:c=["Prisma Client was configured to use both the `adapter` and Accelerate, please chose one."]:c=["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."],new G(c.join(`
74
- `),{clientVersion:t.clientVersion})}return o?new hr(t):u?new gt(t):new gt(t)}function gn({generator:e}){return e?.previewFeatures??[]}var Ea=e=>({command:e});var ba=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);function bt(e){try{return xa(e,"fast")}catch{return xa(e,"slow")}}function xa(e,t){return JSON.stringify(e.map(r=>va(r,t)))}function va(e,t){if(Array.isArray(e))return e.map(r=>va(r,t));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(et(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(me.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(Hp(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(r,n,i).toString("base64")}}return typeof e=="object"&&t==="slow"?Ta(e):e}function Hp(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Ta(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(Pa);let t={};for(let r of Object.keys(e))t[r]=Pa(e[r]);return t}function Pa(e){return typeof e=="bigint"?e.toString():Ta(e)}var Kp=["$connect","$disconnect","$on","$transaction","$use","$extends"],Ca=Kp;var zp=/^(\s*alter\s)/i,Aa=M("prisma:client");function Ri(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&zp.exec(t))throw new Error(`Running ALTER using ${n} is not supported
71
+ `}function gi(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}var sn="/* prisma-comma-repeatable-start */",hi="/* prisma-comma-repeatable-end */";function ea({query:e,params:t}){if(!e.includes(sn))return{query:e,params:t};let r=[],n=1,i="",o=0,s=0,a=0;for(;o<e.length;){let l=e[o];if(s===1&&l!=='"'){i+=l,o++;continue}if(l==='"'){s===1?s=a:(a=s,s=1),i+=l,o++;continue}if(e.slice(o,o+sn.length)===sn){if(s===2)throw new Error("Nested repetition is not allowed");s=2,o+=sn.length,i+="(";continue}if(e.slice(o,o+hi.length)===hi){if(s===0)throw new Error("Unmatched repetition end");s=0,o+=hi.length,i+=")";continue}if(l==="$"){let u=e.slice(o+1).match(/^\d+/);if(!u){i+="$",o++;continue}o+=u[0].length+1;let c=parseInt(u[0]),p=t[c-1];switch(s){case 0:{r.push(p),i+=`$${n++}`;break}case 2:{let m=Array.isArray(p)?p:[p];if(m.length===0){i+="NULL";break}m.forEach((f,g)=>{r.push(f),i+=`$${n++}`,g!==m.length-1&&(i+=", ")});break}default:throw new Error(`Unexpected state: ${s}`)}continue}i+=l,o++}return{query:i,params:r}}function yi({query:e,params:t},r){let n=t.map(a=>{if(!gi(a))return a;let l=r[a.prisma__value.name];if(l===void 0)throw new Error(`Missing value for query variable ${a.prisma__value.name}`);return l}),{query:i,params:o}=ea({query:e,params:n}),s=o.map(a=>Ip(a));return{sql:i,args:o,argTypes:s}}function Ip(e){return e===null?"Int32":typeof e=="string"?"Text":typeof e=="number"?"Numeric":typeof e=="boolean"?"Boolean":Array.isArray(e)?"Array":gi(e)?Dp(e.prisma__value.type):"Json"}function Dp(e){let r={Any:"Json",String:"Text",Int:"Int32",BigInt:"Int64",Float:"Double",Boolean:"Boolean",Decimal:"Numeric",Date:"DateTime",Object:"Json",Bytes:"Bytes",Array:"Array"}[e];if(!r)throw new Error(`Unknown placeholder type: ${e}`);return r}function ta(e){return e.rows.map(t=>t.reduce((r,n,i)=>(r[e.columnNames[i]]=n,r),{}))}var mt,Zt,Xt,er,wi,Yt=class{constructor({queryable:t,placeholderValues:r,onQuery:n}){Ne(this,er);Ne(this,mt);Ne(this,Zt);Ne(this,Xt);Ge(this,mt,t),Ge(this,Zt,r),Ge(this,Xt,n)}async run(t){return this.interpretNode(t,Ce(this,Zt))}async interpretNode(t,r){switch(t.type){case"seq":{let n=await Promise.all(t.args.map(i=>this.interpretNode(i,r)));return n[n.length-1]}case"get":return r[t.args.name];case"let":{let n=Object.create(r);return await Promise.all(t.args.bindings.map(async i=>{n[i.name]=await this.interpretNode(i.expr,r)})),this.interpretNode(t.args.expr,n)}case"getFirstNonEmpty":{for(let n of t.args.names){let i=r[n];if(!ra(i))return i}return[]}case"concat":return(await Promise.all(t.args.map(i=>this.interpretNode(i,r)))).reduce((i,o)=>i.concat(Np(o)),[]);case"sum":return(await Promise.all(t.args.map(i=>this.interpretNode(i,r)))).reduce((i,o)=>na(i)+na(o));case"execute":{let n=yi(t.args,r);return Tn(this,er,wi).call(this,n,async()=>{let i=await Ce(this,mt).executeRaw(n);if(i.ok)return i.value;throw i.error})}case"query":{let n=yi(t.args,r);return Tn(this,er,wi).call(this,n,async()=>{let i=await Ce(this,mt).queryRaw(n);if(i.ok)return ta(i.value);throw i.error})}case"reverse":{let n=await this.interpretNode(t.args,r);return Array.isArray(n)?n.reverse():n}case"unique":{let n=await this.interpretNode(t.args,r);if(!Array.isArray(n))return n;if(n.length!==1)throw new Error(`Expected exactly one element, got ${n.length}`);return n[0]}case"required":{let n=await this.interpretNode(t.args,r);if(ra(n))throw new Error("Required value is empty");return n}case"mapField":{let n=await this.interpretNode(t.args.records,r);return sa(n,t.args.field)}case"join":{let n=await this.interpretNode(t.args.parent,r),i=await Promise.all(t.args.children.map(async o=>({joinExpr:o,childRecords:await this.interpretNode(o.child,r)})));if(Array.isArray(n)){for(let o of n)ia(an(o),i);return n}return ia(an(n),i)}default:throw new Error(`Unexpected node type: ${t.type}`)}}};mt=new WeakMap,Zt=new WeakMap,Xt=new WeakMap,er=new WeakSet,wi=async function(t,r){var a;let n=new Date,i=performance.now(),o=await r(),s=performance.now();return(a=Ce(this,Xt))==null||a.call(this,{timestamp:n,duration:s-i,query:t.sql,params:JSON.stringify(t.args),target:"QueryInterpreter"}),o};function ra(e){return Array.isArray(e)?e.length===0:e==null}function Np(e){return Array.isArray(e)?e:[e]}function na(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function an(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function sa(e,t){return Array.isArray(e)?e.map(r=>sa(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function ia(e,t){for(let{joinExpr:r,childRecords:n}of t)e[r.parentField]=_p(n,e,r);return e}function _p(e,t,r){if(Array.isArray(e))return e.filter(n=>oa(an(n),t,r));{let n=an(e);return oa(n,t,r)?n:null}}function oa(e,t,r){for(let[n,i]of r.on)if(t[n]!==e[i])return!1;return!0}var la=B(require("crypto"));var ie=class extends Q{constructor(t,{clientVersion:r,meta:n}){super("Transaction API error: "+t,{code:"P2028",clientVersion:r,meta:n})}},$e=class extends ie{constructor(t,r){super(`Error from Driver Adapter: ${t}`,{clientVersion:r.clientVersion,meta:{...r.driverAdapterError}})}},tr=class extends ie{constructor(t){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.",t)}},ln=class extends ie{constructor(t,r){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction`,r)}},un=class extends ie{constructor(t,r){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction`,r)}},cn=class extends ie{constructor(t){super("Unable to start a transaction in the given time.",t)}},pn=class extends ie{constructor(t,{clientVersion:r,timeout:n,timeTaken:i}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${n} ms, however ${i} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction`,{clientVersion:r})}},dt=class extends ie{constructor(t,r){super(`Internal Consistency Error: ${t}`,r)}},rr=class extends ie{constructor(t,r){super(`Invalid isolation level: ${t}`,r)}};var Mp=100,Fp={ReadUncommitted:"READ UNCOMMITTED",ReadCommitted:"READ COMMITTED",RepeatableRead:"REPEATABLE READ",Snapshot:"SNAPSHOT",Serializable:"SERIALIZABLE"},nr=M("prisma:client:transactionManager"),Lp=()=>({sql:"COMMIT",args:[],argTypes:[]}),Vp=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),aa=e=>({sql:"SET TRANSACTION ISOLATION LEVEL "+Fp[e],args:[],argTypes:[]}),mn=class{constructor({driverAdapter:t,clientVersion:r}){this.transactions=new Map;this.closedTransactions=[];this.driverAdapter=t,this.clientVersion=r}async startTransaction(t){let r=this.validateOptions(t),n={id:la.default.randomUUID(),status:"waiting",timer:void 0,timeout:r.timeout,startedAt:Date.now(),transaction:void 0};this.transactions.set(n.id,n),n.timer=this.startTransactionTimeout(n.id,r.maxWait);let i=await this.driverAdapter.transactionContext();if(!i.ok)throw new $e("Failed to start transaction.",{driverAdapterError:i.error,clientVersion:this.clientVersion});this.requiresSettingIsolationLevelFirst()&&r.isolationLevel&&await i.value.executeRaw(aa(r.isolationLevel));let o=await i.value.startTransaction();if(!o.ok)throw new $e("Failed to start transaction.",{driverAdapterError:o.error,clientVersion:this.clientVersion});switch(o.value.options.usePhantomQuery||(await o.value.executeRaw({sql:"BEGIN",args:[],argTypes:[]}),!this.requiresSettingIsolationLevelFirst()&&r.isolationLevel&&await i.value.executeRaw(aa(r.isolationLevel))),n.status){case"waiting":return n.transaction=o.value,clearTimeout(n.timer),n.timer=void 0,n.status="running",n.timer=this.startTransactionTimeout(n.id,r.timeout),{id:n.id,payload:void 0};case"timed_out":throw new cn({clientVersion:this.clientVersion});case"running":case"committed":case"rolled_back":throw new dt(`Transaction in invalid state ${n.status} although it just finished startup.`,{clientVersion:this.clientVersion});default:re(n.status,"Unknown transaction status.")}}async commitTransaction(t){let r=this.getActiveTransaction(t,"commit");await this.closeTransaction(r,"committed")}async rollbackTransaction(t){let r=this.getActiveTransaction(t,"rollback");await this.closeTransaction(r,"rolled_back")}getTransaction(t,r){let n=this.getActiveTransaction(t.id,r);if(!n.transaction)throw new tr({clientVersion:this.clientVersion});return n.transaction}getActiveTransaction(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(nr("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"waiting":case"running":throw new dt("Active transaction found in closed transactions list.",{clientVersion:this.clientVersion});case"committed":throw new ln(r,{clientVersion:this.clientVersion});case"rolled_back":throw new un(r,{clientVersion:this.clientVersion});case"timed_out":throw new pn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt,clientVersion:this.clientVersion})}else throw nr("Transaction not found.",t),new tr({clientVersion:this.clientVersion})}if(["committed","rolled_back","timed_out"].includes(n.status))throw new dt("Closed transaction found in active transactions map.",{clientVersion:this.clientVersion});return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.closeTransaction(t,"rolled_back")))}startTransactionTimeout(t,r){let n=Date.now();return setTimeout(async()=>{nr("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let i=this.transactions.get(t);i&&["running","waiting"].includes(i.status)?await this.closeTransaction(i,"timed_out"):nr("Transaction already committed or rolled back when timeout happened.",t)},r)}async closeTransaction(t,r){if(nr("Closing transaction.",{transactionId:t.id,status:r}),t.status=r,t.transaction&&r==="committed"){let n=await t.transaction.commit();if(!n.ok)throw new $e("Failed to commit transaction.",{driverAdapterError:n.error,clientVersion:this.clientVersion});t.transaction.options.usePhantomQuery||await t.transaction.executeRaw(Lp())}else if(t.transaction){let n=await t.transaction.rollback();if(!n.ok)throw new $e("Failed to rollback transaction.",{driverAdapterError:n.error,clientVersion:this.clientVersion});t.transaction.options.usePhantomQuery||await t.transaction.executeRaw(Vp())}clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>Mp&&this.closedTransactions.shift()}validateOptions(t){if(!t.timeout)throw new ie("timeout is required",{clientVersion:this.clientVersion});if(!t.maxWait)throw new ie("maxWait is required",{clientVersion:this.clientVersion});if(t.isolationLevel==="Snapshot")throw new rr(t.isolationLevel,{clientVersion:this.clientVersion});if(this.driverAdapter.provider==="sqlite"&&t.isolationLevel&&t.isolationLevel!=="Serializable")throw new rr(t.isolationLevel,{clientVersion:this.clientVersion});return{...t,timeout:t.timeout,maxWait:t.maxWait}}requiresSettingIsolationLevelFirst(){return this.driverAdapter.provider==="mysql"}};var Ei,ua={async loadQueryCompiler(e){let{clientVersion:t,adapter:r,compilerWasm:n}=e;if(r===void 0)throw new S(`The \`adapter\` option for \`PrismaClient\` is required in this context (${on().prettyName})`,t);if(n===void 0)throw new S("WASM query compiler was unexpectedly `undefined`",t);return Ei===void 0&&(Ei=(async()=>{let i=n.getRuntime(),o=await n.getQueryCompilerWasmModule();if(o==null)throw new S("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={"./query_compiler_bg.js":i},a=new WebAssembly.Instance(o,s);return i.__wbg_set_wasm(a.exports),i.QueryCompiler})()),await Ei}};var ca="P2038",dn=M("prisma:client:clientEngine"),ft,gt=class{constructor(t,r){this.name="ClientEngine";Ne(this,ft);if(!t.previewFeatures?.includes("driverAdapters"))throw new S("EngineType `client` requires the driverAdapters preview feature to be enabled.",t.clientVersion,ca);let{adapter:n}=t;if(n)this.driverAdapter=n,dn("Using driver adapter: %O",n);else throw new S("Missing configured driver adapter. Engine type `client` requires an active driver adapter. Please check your PrismaClient initialization code.",t.clientVersion,ca);this.queryCompilerLoader=r??ua,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&Ge(this,ft,i=>{this.logEmitter.emit("query",i)}),this.transactionManager=new mn({driverAdapter:this.driverAdapter,clientVersion:this.config.clientVersion}),this.instantiateQueryCompilerPromise=this.instantiateQueryCompiler()}applyPendingMigrations(){throw new Error("Cannot call applyPendingMigrations on engine type client.")}async instantiateQueryCompiler(){if(!this.queryCompiler){this.QueryCompilerConstructor||(this.QueryCompilerConstructor=await this.queryCompilerLoader.loadQueryCompiler(this.config));try{this.queryCompiler=new this.QueryCompilerConstructor({datamodel:this.datamodel,provider:this.driverAdapter.provider,connectionInfo:{}})}catch(t){throw this.transformInitError(t)}}}transformInitError(t){try{let r=JSON.parse(t.message);return new S(r.message,this.config.clientVersion,r.error_code)}catch{return t}}transformRequestError(t){if(t instanceof S)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new se($p(this,t.message),this.config.clientVersion);try{let r=JSON.parse(t);return new J(`${r.message}
72
+ ${r.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the client engine, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.')}async start(){await this.instantiateQueryCompilerPromise}async stop(){await this.instantiateQueryCompilerPromise,await this.transactionManager.cancelAllTransactions()}version(){return"unknown"}async transaction(t,r,n){let i;if(t==="start"){let o=n;i=await this.transactionManager.startTransaction(o)}else if(t==="commit"){let o=n;await this.transactionManager.commitTransaction(o.id)}else if(t==="rollback"){let o=n;await this.transactionManager.rollbackTransaction(o.id)}else re(t,"Invalid transaction action.");return i}async request(t,{traceparent:r,interactiveTransaction:n}){dn("sending request");let i=JSON.stringify(t);this.lastStartedQuery=i;try{await this.start();let o=await this.queryCompiler.compile(i),s=JSON.parse(o);dn("query plan created",o);let a=n?this.transactionManager.getTransaction(n,t.action):this.driverAdapter,l={},c=await new Yt({queryable:a,placeholderValues:l,onQuery:Ce(this,ft)}).run(s);return dn("query plan executed"),{data:{[t.action]:c}}}catch(o){throw this.transformRequestError(o)}}async requestBatch(t,{transaction:r,traceparent:n}){this.lastStartedQuery=JSON.stringify(t);try{await this.start();let i=await Promise.all(t.map(async a=>{let l=JSON.stringify(a),u=await this.queryCompiler.compile(l);return{query:a,plan:JSON.parse(u)}})),o;if(r?.kind==="itx")o=r.options;else{let a=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;o=await this.transaction("start",{},a)}let s=[];for(let{query:a,plan:l}of i){let u=this.transactionManager.getTransaction(o,a.action),c=new Yt({queryable:u,placeholderValues:{},onQuery:Ce(this,ft)});s.push(await c.run(l))}return r?.kind!=="itx"&&await this.transaction("commit",{},o),s}catch(i){throw this.transformRequestError(i)}}metrics(t){throw new Error("Method not implemented.")}};ft=new WeakMap;function $p(e,t){return Xs({binaryTarget:void 0,title:t,version:e.config.clientVersion,engineVersion:"unknown",database:e.config.activeProvider,query:e.lastStartedQuery})}function ht({inlineDatasources:e,overrideDatasources:t,env:r,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=t[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=r[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw new S(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new S("error: Missing URL environment variable, value, or override.",n);return i}var fn=class extends Error{constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var ee=class extends fn{constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function C(e,t){return{...e,isRetryable:t}}var yt=class extends ee{constructor(r){super("This request must be retried",C(r,!0));this.name="ForcedRetryError";this.code="P5001"}};b(yt,"ForcedRetryError");var qe=class extends ee{constructor(r,n){super(r,C(n,!1));this.name="InvalidDatasourceError";this.code="P6001"}};b(qe,"InvalidDatasourceError");var je=class extends ee{constructor(r,n){super(r,C(n,!1));this.name="NotImplementedYetError";this.code="P5004"}};b(je,"NotImplementedYetError");var _=class extends ee{constructor(t,r){super(t,r),this.response=r.response;let n=this.response.headers.get("prisma-request-id");if(n){let i=`(The request id was: ${n})`;this.message=this.message+" "+i}}};var Ue=class extends _{constructor(r){super("Schema needs to be uploaded",C(r,!0));this.name="SchemaMissingError";this.code="P5005"}};b(Ue,"SchemaMissingError");var bi="This request could not be understood by the server",ir=class extends _{constructor(r,n,i){super(n||bi,C(r,!1));this.name="BadRequestError";this.code="P5000";i&&(this.code=i)}};b(ir,"BadRequestError");var or=class extends _{constructor(r,n){super("Engine not started: healthcheck timeout",C(r,!0));this.name="HealthcheckTimeoutError";this.code="P5013";this.logs=n}};b(or,"HealthcheckTimeoutError");var sr=class extends _{constructor(r,n,i){super(n,C(r,!0));this.name="EngineStartupError";this.code="P5014";this.logs=i}};b(sr,"EngineStartupError");var ar=class extends _{constructor(r){super("Engine version is not supported",C(r,!1));this.name="EngineVersionNotSupportedError";this.code="P5012"}};b(ar,"EngineVersionNotSupportedError");var xi="Request timed out",lr=class extends _{constructor(r,n=xi){super(n,C(r,!1));this.name="GatewayTimeoutError";this.code="P5009"}};b(lr,"GatewayTimeoutError");var qp="Interactive transaction error",ur=class extends _{constructor(r,n=qp){super(n,C(r,!1));this.name="InteractiveTransactionError";this.code="P5015"}};b(ur,"InteractiveTransactionError");var jp="Request parameters are invalid",cr=class extends _{constructor(r,n=jp){super(n,C(r,!1));this.name="InvalidRequestError";this.code="P5011"}};b(cr,"InvalidRequestError");var Pi="Requested resource does not exist",pr=class extends _{constructor(r,n=Pi){super(n,C(r,!1));this.name="NotFoundError";this.code="P5003"}};b(pr,"NotFoundError");var vi="Unknown server error",wt=class extends _{constructor(r,n,i){super(n||vi,C(r,!0));this.name="ServerError";this.code="P5006";this.logs=i}};b(wt,"ServerError");var Ti="Unauthorized, check your connection string",mr=class extends _{constructor(r,n=Ti){super(n,C(r,!1));this.name="UnauthorizedError";this.code="P5007"}};b(mr,"UnauthorizedError");var Ci="Usage exceeded, retry again later",dr=class extends _{constructor(r,n=Ci){super(n,C(r,!0));this.name="UsageExceededError";this.code="P5008"}};b(dr,"UsageExceededError");async function Up(e){let t;try{t=await e.text()}catch{return{type:"EmptyError"}}try{let r=JSON.parse(t);if(typeof r=="string")switch(r){case"InternalDataProxyError":return{type:"DataProxyError",body:r};default:return{type:"UnknownTextError",body:r}}if(typeof r=="object"&&r!==null){if("is_panic"in r&&"message"in r&&"error_code"in r)return{type:"QueryEngineError",body:r};if("EngineNotStarted"in r||"InteractiveTransactionMisrouted"in r||"InvalidRequestError"in r){let n=Object.values(r)[0].reason;return typeof n=="string"&&!["SchemaMissing","EngineVersionNotSupported"].includes(n)?{type:"UnknownJsonError",body:r}:{type:"DataProxyError",body:r}}}return{type:"UnknownJsonError",body:r}}catch{return t===""?{type:"EmptyError"}:{type:"UnknownTextError",body:t}}}async function fr(e,t){if(e.ok)return;let r={clientVersion:t,response:e},n=await Up(e);if(n.type==="QueryEngineError")throw new Q(n.body.message,{code:n.body.error_code,clientVersion:t});if(n.type==="DataProxyError"){if(n.body==="InternalDataProxyError")throw new wt(r,"Internal Data Proxy error");if("EngineNotStarted"in n.body){if(n.body.EngineNotStarted.reason==="SchemaMissing")return new Ue(r);if(n.body.EngineNotStarted.reason==="EngineVersionNotSupported")throw new ar(r);if("EngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,logs:o}=n.body.EngineNotStarted.reason.EngineStartupError;throw new sr(r,i,o)}if("KnownEngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,error_code:o}=n.body.EngineNotStarted.reason.KnownEngineStartupError;throw new S(i,t,o)}if("HealthcheckTimeout"in n.body.EngineNotStarted.reason){let{logs:i}=n.body.EngineNotStarted.reason.HealthcheckTimeout;throw new or(r,i)}}if("InteractiveTransactionMisrouted"in n.body){let i={IDParseError:"Could not parse interactive transaction ID",NoQueryEngineFoundError:"Could not find Query Engine for the specified host and transaction ID",TransactionStartError:"Could not start interactive transaction"};throw new ur(r,i[n.body.InteractiveTransactionMisrouted.reason])}if("InvalidRequestError"in n.body)throw new cr(r,n.body.InvalidRequestError.reason)}if(e.status===401||e.status===403)throw new mr(r,Et(Ti,n));if(e.status===404)return new pr(r,Et(Pi,n));if(e.status===429)throw new dr(r,Et(Ci,n));if(e.status===504)throw new lr(r,Et(xi,n));if(e.status>=500)throw new wt(r,Et(vi,n));if(e.status>=400)throw new ir(r,Et(bi,n))}function Et(e,t){return t.type==="EmptyError"?e:`${e}: ${JSON.stringify(t)}`}function pa(e){let t=Math.pow(2,e)*50,r=Math.ceil(Math.random()*t)-Math.ceil(t/2),n=t+r;return new Promise(i=>setTimeout(()=>i(n),n))}var Te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ma(e){let t=new TextEncoder().encode(e),r="",n=t.byteLength,i=n%3,o=n-i,s,a,l,u,c;for(let p=0;p<o;p=p+3)c=t[p]<<16|t[p+1]<<8|t[p+2],s=(c&16515072)>>18,a=(c&258048)>>12,l=(c&4032)>>6,u=c&63,r+=Te[s]+Te[a]+Te[l]+Te[u];return i==1?(c=t[o],s=(c&252)>>2,a=(c&3)<<4,r+=Te[s]+Te[a]+"=="):i==2&&(c=t[o]<<8|t[o+1],s=(c&64512)>>10,a=(c&1008)>>4,l=(c&15)<<2,r+=Te[s]+Te[a]+Te[l]+"="),r}function da(e){if(!!e.generator?.previewFeatures.some(r=>r.toLowerCase().includes("metrics")))throw new S("The `metrics` preview feature is not yet available with Accelerate.\nPlease remove `metrics` from the `previewFeatures` in your schema.\n\nMore information about Accelerate: https://pris.ly/d/accelerate",e.clientVersion)}function Bp(e){return e[0]*1e3+e[1]/1e6}function Ai(e){return new Date(Bp(e))}var fa={"@prisma/debug":"workspace:*","@prisma/engines-version":"6.4.0-21.08b0da61b89855d81a37b120c20ccb3019379e22","@prisma/fetch-engine":"workspace:*","@prisma/get-platform":"workspace:*"};var gr=class extends ee{constructor(r,n){super(`Cannot fetch data from service:
73
+ ${r}`,C(n,!0));this.name="RequestError";this.code="P5010"}};b(gr,"RequestError");async function Be(e,t,r=n=>n){let{clientVersion:n,...i}=t,o=r(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new gr(a,{clientVersion:n,cause:s})}}var Jp=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,ga=M("prisma:client:dataproxyEngine");async function Gp(e,t){let r=fa["@prisma/engines-version"],n=t.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&Jp.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){if(e.startsWith("localhost")||e.startsWith("127.0.0.1"))return"0.0.0";let[s]=r.split("-")??[],[a,l,u]=s.split("."),c=Wp(`<=${a}.${l}.${u}`),p=await Be(c,{clientVersion:n});if(!p.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${p.status} ${p.statusText}, response body: ${await p.text()||"<empty body>"}`);let m=await p.text();ga("length of body fetched from unpkg.com",m.length);let f;try{f=JSON.parse(m)}catch(g){throw console.error("JSON.parse error: body fetched from unpkg.com: ",m),g}return f.version}throw new je("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function ha(e,t){let r=await Gp(e,t);return ga("version",r),r}function Wp(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var ya=3,gn=M("prisma:client:dataproxyEngine"),Ri=class{constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,interactiveTransaction:r}={}){let n={Authorization:`Bearer ${this.apiKey}`,"Prisma-Engine-Hash":this.engineHash};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-transaction-id"]=r.id);let i=this.buildCaptureSettings();return i.length>0&&(n["X-capture-telemetry"]=i.join(", ")),n}buildCaptureSettings(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}},hr=class{constructor(t){this.name="DataProxyEngine";da(t),this.config=t,this.env={...t.env,...typeof process<"u"?process.env:{}},this.inlineSchema=ma(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let[t,r]=this.extractHostAndApiKey();this.host=t,this.headerBuilder=new Ri({apiKey:r,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel,logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await ha(t,this.config),gn("host",this.host)})(),await this.startPromise}async stop(){}propagateResponseExtensions(t){t?.logs?.length&&t.logs.forEach(r=>{switch(r.level){case"debug":case"trace":gn(r);break;case"error":case"warn":case"info":{this.logEmitter.emit(r.level,{timestamp:Ai(r.timestamp),message:r.attributes.message??"",target:r.target});break}case"query":{this.logEmitter.emit("query",{query:r.attributes.query??"",timestamp:Ai(r.timestamp),duration:r.attributes.duration_ms??0,params:r.attributes.params??"",target:r.target});break}default:r.level}}),t?.traces?.length&&this.tracingHelper.dispatchEngineSpans(t.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(t){return await this.start(),`https://${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${t}`}async uploadSchema(){let t={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(t,async()=>{let r=await Be(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});r.ok||gn("schema response status",r.status);let n=await fr(r,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(t,{traceparent:r,interactiveTransaction:n,customDataProxyFetch:i}){return this.requestInternal({body:t,traceparent:r,interactiveTransaction:n,customDataProxyFetch:i})}async requestBatch(t,{traceparent:r,transaction:n,customDataProxyFetch:i}){let o=n?.kind==="itx"?n.options:void 0,s=en(t,n);return(await this.requestInternal({body:s,customDataProxyFetch:i,interactiveTransaction:o,traceparent:r})).map(l=>(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l?this.convertProtocolErrorsToClientError(l.errors):l))}requestInternal({body:t,traceparent:r,customDataProxyFetch:n,interactiveTransaction:i}){return this.withRetry({actionGerund:"querying",callback:async({logHttpCall:o})=>{let s=i?`${i.payload.endpoint}/graphql`:await this.url("graphql");o(s);let a=await Be(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r,interactiveTransaction:i}),body:JSON.stringify(t),clientVersion:this.clientVersion},n);a.ok||gn("graphql response status",a.status),await this.handleError(await fr(a,this.clientVersion));let l=await a.json();if(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l)throw this.convertProtocolErrorsToClientError(l.errors);return"batchResult"in l?l.batchResult:l}})}async transaction(t,r,n){let i={start:"starting",commit:"committing",rollback:"rolling back"};return this.withRetry({actionGerund:`${i[t]} transaction`,callback:async({logHttpCall:o})=>{if(t==="start"){let s=JSON.stringify({max_wait:n.maxWait,timeout:n.timeout,isolation_level:n.isolationLevel}),a=await this.url("transaction/start");o(a);let l=await Be(a,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),body:s,clientVersion:this.clientVersion});await this.handleError(await fr(l,this.clientVersion));let u=await l.json(),{extensions:c}=u;c&&this.propagateResponseExtensions(c);let p=u.id,m=u["data-proxy"].endpoint;return{id:p,payload:{endpoint:m}}}else{let s=`${n.payload.endpoint}/${t}`;o(s);let a=await Be(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),clientVersion:this.clientVersion});await this.handleError(await fr(a,this.clientVersion));let l=await a.json(),{extensions:u}=l;u&&this.propagateResponseExtensions(u);return}}})}extractHostAndApiKey(){let t={clientVersion:this.clientVersion},r=Object.keys(this.inlineDatasources)[0],n=ht({inlineDatasources:this.inlineDatasources,overrideDatasources:this.config.overrideDatasources,clientVersion:this.clientVersion,env:this.env}),i;try{i=new URL(n)}catch{throw new qe(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t)}let{protocol:o,host:s,searchParams:a}=i;if(o!=="prisma:"&&o!==vr)throw new qe(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t);let l=a.get("api_key");if(l===null||l.length<1)throw new qe(`Error validating datasource \`${r}\`: the URL must contain a valid API key`,t);return[s,l]}metrics(){throw new je("Metrics are not yet supported for Accelerate",{clientVersion:this.clientVersion})}async withRetry(t){for(let r=0;;r++){let n=i=>{this.logEmitter.emit("info",{message:`Calling ${i} (n=${r})`,timestamp:new Date,target:""})};try{return await t.callback({logHttpCall:n})}catch(i){if(!(i instanceof ee)||!i.isRetryable)throw i;if(r>=ya)throw i instanceof yt?i.cause:i;this.logEmitter.emit("warn",{message:`Attempt ${r+1}/${ya} failed for ${t.actionGerund}: ${i.message??"(unknown)"}`,timestamp:new Date,target:""});let o=await pa(r);this.logEmitter.emit("warn",{message:`Retrying after ${o}ms`,timestamp:new Date,target:""})}}}async handleError(t){if(t instanceof Ue)throw await this.uploadSchema(),new yt({clientVersion:this.clientVersion,cause:t});if(t)throw t}convertProtocolErrorsToClientError(t){return t.length===1?tn(t[0],this.config.clientVersion,this.config.activeProvider):new J(JSON.stringify(t),{clientVersion:this.config.clientVersion})}applyPendingMigrations(){throw new Error("Method not implemented.")}};function wa({copyEngine:e=!0},t){let r;try{r=ht({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...process.env},clientVersion:t.clientVersion})}catch{}let n=!!(r?.startsWith("prisma://")||Fn(r));e&&n&&Nt("recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)");let i=He(t.generator),o=n||!e,s=!!t.adapter,a=i==="library",l=i==="binary",u=i==="client";if(o&&s||s&&!1){let c;throw e?r?.startsWith("prisma://")?c=["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]:c=["Prisma Client was configured to use both the `adapter` and Accelerate, please chose one."]:c=["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."],new G(c.join(`
74
+ `),{clientVersion:t.clientVersion})}return o?new hr(t):u?new gt(t):new gt(t)}function hn({generator:e}){return e?.previewFeatures??[]}var Ea=e=>({command:e});var ba=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);function bt(e){try{return xa(e,"fast")}catch{return xa(e,"slow")}}function xa(e,t){return JSON.stringify(e.map(r=>va(r,t)))}function va(e,t){if(Array.isArray(e))return e.map(r=>va(r,t));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(et(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(me.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(Hp(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(r,n,i).toString("base64")}}return typeof e=="object"&&t==="slow"?Ta(e):e}function Hp(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Ta(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(Pa);let t={};for(let r of Object.keys(e))t[r]=Pa(e[r]);return t}function Pa(e){return typeof e=="bigint"?e.toString():Ta(e)}var Kp=["$connect","$disconnect","$on","$transaction","$use","$extends"],Ca=Kp;var zp=/^(\s*alter\s)/i,Aa=M("prisma:client");function Si(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&zp.exec(t))throw new Error(`Running ALTER using ${n} is not supported
75
75
  Using the example below you can still execute your query with Prisma, but please note that it is vulnerable to SQL injection attacks and requires you to take care of input sanitization.
76
76
 
77
77
  Example:
78
78
  await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
79
79
 
80
80
  More Information: https://pris.ly/d/execute-raw
81
- `)}var Si=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(fs(r))n=r.sql,i={values:bt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:bt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:bt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:bt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=ba(r),i={values:bt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Aa(`prisma.${e}(${n}, ${i.values})`):Aa(`prisma.${e}(${n})`),{query:n,parameters:i}},Ra={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new X(t,r)}},Sa={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function ki(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=ka(r(s)):ka(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 ka(e){return typeof e.then=="function"?e:Promise.resolve(e)}var Yp=kn.split(".")[0],Zp={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Oi=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){let t=globalThis[`V${Yp}_PRISMA_INSTRUMENTATION`],r=globalThis.PRISMA_INSTRUMENTATION;return t?.helper??r?.helper??Zp}};function Oa(){return new Oi}function Ia(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}function Da(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)}var hn=class{constructor(){this._middlewares=[]}use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};var _a=B(Vn());function yn(e){return typeof e.batchRequestIdx=="number"}function Na(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Ii(e.query.arguments)),t.push(Ii(e.query.selection)),t.join("")}function Ii(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Ii(n)})`:r}).join(" ")})`}var Xp={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 Di(e){return Xp[e]}var wn=class{constructor(t){this.options=t;this.tickActive=!1;this.batches={}}request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:t,resolve:n,reject:i})})):this.options.singleLoader(t)}dispatchBatches(){for(let t in this.batches){let r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};function Qe(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new me(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=>Qe("bigint",r));case"bytes-array":return t.map(r=>Qe("bytes",r));case"decimal-array":return t.map(r=>Qe("decimal",r));case"datetime-array":return t.map(r=>Qe("datetime",r));case"date-array":return t.map(r=>Qe("date",r));case"time-array":return t.map(r=>Qe("time",r));default:return t}}function En(e){let t=[],r=em(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]]=Qe(e.types[s],i[s]);t.push(o)}return t}function em(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var tm=M("prisma:client:request_handler"),bn=class{constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new wn({batchLoader:qs(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(p=>p.protocolQuery),l=this.client._tracingHelper.getTraceParent(s),u=n.some(p=>Di(p.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:l,transaction:rm(o),containsWrite:u,customDataProxyFetch:i})).map((p,m)=>{if(p instanceof Error)return p;try{return this.mapQueryEngineResult(n[m],p)}catch(f){return f}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?Ma(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Di(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:Na(n.protocolQuery),batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(t){try{return await this.dataloader.request(t)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=t;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:t.globalOmit})}}mapQueryEngineResult({dataPath:t,unpacker:r},n){let i=n?.data,o=this.unpack(i,t,r);return process.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(t){try{this.handleRequestError(t)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:t.clientMethod,timestamp:new Date}),r}}handleRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(tm(t),nm(t,i))throw t;if(t instanceof Q&&im(t)){let u=Fa(t.meta);Gr({args:o,errors:[u],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let l=t.message;if(n&&(l=Fr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:l})),l=this.sanitizeMessage(l),t.code){let u=s?{modelName:s,...t.meta}:t.meta;throw new Q(l,{code:t.code,clientVersion:this.client._clientVersion,meta:u,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new se(l,this.client._clientVersion);if(t instanceof J)throw new J(l,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof S)throw new S(l,this.client._clientVersion);if(t instanceof se)throw new se(l,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,_a.default)(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(u=>u!=="select"&&u!=="include"),a=ui(o,s),l=i==="queryRaw"?En(a):Ze(a);return n?n(l):l}get[Symbol.toStringTag](){return"RequestHandler"}};function rm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:Ma(e)};re(e,"Unknown transaction kind")}}function Ma(e){return{id:e.id,payload:e.payload}}function nm(e,t){return yn(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function im(e){return e.code==="P2009"||e.code==="P2012"}function Fa(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Fa)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}var La="6.4.0-dev.34";var Va=La;var Ba=B(Wn());var O=class extends Error{constructor(t){super(t+`
81
+ `)}var ki=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(gs(r))n=r.sql,i={values:bt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:bt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:bt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:bt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=ba(r),i={values:bt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Aa(`prisma.${e}(${n}, ${i.values})`):Aa(`prisma.${e}(${n})`),{query:n,parameters:i}},Ra={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new X(t,r)}},Sa={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function Oi(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=ka(r(s)):ka(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 ka(e){return typeof e.then=="function"?e:Promise.resolve(e)}var Yp=On.split(".")[0],Zp={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Ii=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){let t=globalThis[`V${Yp}_PRISMA_INSTRUMENTATION`],r=globalThis.PRISMA_INSTRUMENTATION;return t?.helper??r?.helper??Zp}};function Oa(){return new Ii}function Ia(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}function Da(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)}var yn=class{constructor(){this._middlewares=[]}use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};var _a=B($n());function wn(e){return typeof e.batchRequestIdx=="number"}function Na(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Di(e.query.arguments)),t.push(Di(e.query.selection)),t.join("")}function Di(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Di(n)})`:r}).join(" ")})`}var Xp={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 Ni(e){return Xp[e]}var En=class{constructor(t){this.options=t;this.tickActive=!1;this.batches={}}request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:t,resolve:n,reject:i})})):this.options.singleLoader(t)}dispatchBatches(){for(let t in this.batches){let r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};function Qe(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new me(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=>Qe("bigint",r));case"bytes-array":return t.map(r=>Qe("bytes",r));case"decimal-array":return t.map(r=>Qe("decimal",r));case"datetime-array":return t.map(r=>Qe("datetime",r));case"date-array":return t.map(r=>Qe("date",r));case"time-array":return t.map(r=>Qe("time",r));default:return t}}function bn(e){let t=[],r=em(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]]=Qe(e.types[s],i[s]);t.push(o)}return t}function em(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var tm=M("prisma:client:request_handler"),xn=class{constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new En({batchLoader:js(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(p=>p.protocolQuery),l=this.client._tracingHelper.getTraceParent(s),u=n.some(p=>Ni(p.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:l,transaction:rm(o),containsWrite:u,customDataProxyFetch:i})).map((p,m)=>{if(p instanceof Error)return p;try{return this.mapQueryEngineResult(n[m],p)}catch(f){return f}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?Ma(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Ni(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:Na(n.protocolQuery),batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(t){try{return await this.dataloader.request(t)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=t;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:t.globalOmit})}}mapQueryEngineResult({dataPath:t,unpacker:r},n){let i=n?.data,o=this.unpack(i,t,r);return process.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(t){try{this.handleRequestError(t)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:t.clientMethod,timestamp:new Date}),r}}handleRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(tm(t),nm(t,i))throw t;if(t instanceof Q&&im(t)){let u=Fa(t.meta);Gr({args:o,errors:[u],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let l=t.message;if(n&&(l=Fr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:l})),l=this.sanitizeMessage(l),t.code){let u=s?{modelName:s,...t.meta}:t.meta;throw new Q(l,{code:t.code,clientVersion:this.client._clientVersion,meta:u,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new se(l,this.client._clientVersion);if(t instanceof J)throw new J(l,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof S)throw new S(l,this.client._clientVersion);if(t instanceof se)throw new se(l,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,_a.default)(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(u=>u!=="select"&&u!=="include"),a=ci(o,s),l=i==="queryRaw"?bn(a):Ze(a);return n?n(l):l}get[Symbol.toStringTag](){return"RequestHandler"}};function rm(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:Ma(e)};re(e,"Unknown transaction kind")}}function Ma(e){return{id:e.id,payload:e.payload}}function nm(e,t){return wn(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function im(e){return e.code==="P2009"||e.code==="P2012"}function Fa(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Fa)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}var La="6.4.0-dev.36";var Va=La;var Ba=B(Hn());var O=class extends Error{constructor(t){super(t+`
82
82
  Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};b(O,"PrismaClientConstructorValidationError");var $a=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],qa=["pretty","colorless","minimal"],ja=["info","query","warn","error"],sm={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new O(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[r,n]of Object.entries(e)){if(!t.includes(r)){let i=xt(r,t)||` Available datasources: ${t.join(", ")}`;throw new O(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new O(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
83
83
  It should have this form: { url: "CONNECTION_STRING" }`);if(n&&typeof n=="object")for(let[i,o]of Object.entries(n)){if(i!=="url")throw new O(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
84
84
  It should have this form: { url: "CONNECTION_STRING" }`);if(typeof o!="string")throw new O(`Invalid value ${JSON.stringify(o)} for datasource "${r}" provided to PrismaClient constructor.
85
- It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,t)=>{if(!e&&He(t.generator)==="client")throw new O('Using engine type "client" requires a driver adapter to be provided to PrismaClient constructor.');if(e===null)return;if(e===void 0)throw new O('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!gn(t).includes("driverAdapters"))throw new O('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(He(t.generator)==="binary")throw new O('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new O(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
85
+ It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,t)=>{if(!e&&He(t.generator)==="client")throw new O('Using engine type "client" requires a driver adapter to be provided to PrismaClient constructor.');if(e===null)return;if(e===void 0)throw new O('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!hn(t).includes("driverAdapters"))throw new O('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(He(t.generator)==="binary")throw new O('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new O(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
86
86
  Expected string or undefined.`)},errorFormat:e=>{if(e){if(typeof e!="string")throw new O(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!qa.includes(e)){let t=xt(e,qa);throw new O(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new O(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!ja.includes(r)){let n=xt(r,ja);throw new O(`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=xt(i,o);throw new O(`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 O(`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 O(`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 O(`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 O('"omit" option is expected to be an object.');if(e===null)throw new O('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=lm(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let l=o.fields.find(u=>u.name===s);if(!l){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(l.relationName){r.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&r.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(r.length>0)throw new O(um(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new O(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=xt(r,t);throw new O(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Qa(e,t){for(let[r,n]of Object.entries(e)){if(!$a.includes(r)){let i=xt(r,$a);throw new O(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}sm[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new O('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function xt(e,t){if(t.length===0||typeof e!="string")return"";let r=am(e,t);return r?` Did you mean "${r}"?`:""}function am(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Ba.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 lm(e,t){return Ua(t.models,e)??Ua(t.types,e)}function Ua(e,t){let r=Object.keys(e).find(n=>Xe(n)===t);if(r)return e[r]}function um(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}=Jr(r,"colorless");return`Error validating "omit" option:
87
87
 
88
88
  ${i}
89
89
 
90
- ${n}`}function Ja(e){return e.length===0?Promise.resolve([]):new Promise((t,r)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?r(i):t(n)))},l=u=>{o||(o=!0,r(u))};for(let u=0;u<e.length;u++)e[u].then(c=>{n[u]=c,a()},c=>{if(!yn(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var De=M("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var cm={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},pm=Symbol.for("prisma.client.transaction.id"),mm={id:0,nextId(){return++this.id}};function Ya(e){class t{constructor(n){this._originalClient=this;this._middlewares=new hn;this._createPrismaPromise=ki();this.$metrics=new ut(this);this.$extends=Ds;e=n?.__internal?.configOverride?.(e)??e,Js(e),n&&Qa(n,e);let i=new Ka.EventEmitter().on("error",()=>{});this._extensions=lt.empty(),this._previewFeatures=gn(e),this._clientVersion=e.clientVersion??Va,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=Oa();let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&yr.default.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&yr.default.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=ii(n.adapter);let l=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==l)throw new S(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${l}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new S("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let a=!s&&St(o,{conflictCheck:"none"})||e.injectableEdgeEnv?.();try{let l=n??{},u=l.__internal??{},c=u.debug===!0;c&&M.enable("prisma:client");let p=yr.default.resolve(e.dirname,e.relativePath);za.default.existsSync(p)||(p=e.dirname),De("dirname",e.dirname),De("relativePath",e.relativePath),De("cwd",p);let m=u.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:process.env.NODE_ENV==="production"?this._errorFormat="minimal":process.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:p,dirname:e.dirname,enableDebugLogs:c,allowTriggerPanic:m.allowTriggerPanic,datamodelPath:yr.default.join(e.dirname,e.filename??"schema.prisma"),prismaPath:m.binaryPath??void 0,engineEndpoint:m.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&Da(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(f=>typeof f=="string"?f==="query":f.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Gs(l,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:l.transactionOptions?.maxWait??2e3,timeout:l.transactionOptions?.timeout??5e3,isolationLevel:l.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:ht,getBatchRequestPayload:en,prismaGraphQLToJSError:tn,PrismaClientUnknownRequestError:J,PrismaClientInitializationError:S,PrismaClientKnownRequestError:Q,debug:M("prisma:client:accelerateEngine"),engineVersion:Wa.version,clientVersion:e.clientVersion}},De("clientVersion",e.clientVersion),this._engine=wa(e,this._engineConfig),this._requestHandler=new bn(this,i),l.log)for(let f of l.log){let g=typeof f=="string"?f:f.emit==="stdout"?f.level:null;g&&this.$on(g,h=>{Dt.log(`${Dt.tags[g]??""}`,h.message||h.query)})}}catch(l){throw l.clientVersion=this._clientVersion,l}return this._appliedParent=Kt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$use(n){this._middlewares.use(n)}$on(n,i){n==="beforeExit"?this._engine.onBeforeExit(i):n&&this._engineConfig.logEmitter.on(n,i)}$connect(){try{return this._engine.start()}catch(n){throw n.clientVersion=this._clientVersion,n}}async $disconnect(){try{await this._engine.stop()}catch(n){throw n.clientVersion=this._clientVersion,n}finally{Gi()}}$executeRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"executeRaw",args:o,transaction:n,clientMethod:i,argsMapper:Si({clientMethod:i,activeProvider:a}),callsite:Ie(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$executeRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0){let[s,a]=Ga(n,i);return Ri(this._activeProvider,s.text,s.values,Array.isArray(n)?"prisma.$executeRaw`<SQL>`":"prisma.$executeRaw(sql`<SQL>`)"),this.$executeRawInternal(o,"$executeRaw",s,a)}throw new G("`$executeRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#executeraw\n",{clientVersion:this._clientVersion})})}$executeRawUnsafe(n,...i){return this._createPrismaPromise(o=>(Ri(this._activeProvider,n,i,"prisma.$executeRawUnsafe(<SQL>, [...values])"),this.$executeRawInternal(o,"$executeRawUnsafe",[n,...i])))}$runCommandRaw(n){if(e.activeProvider!=="mongodb")throw new G(`The ${e.activeProvider} provider does not support $runCommandRaw. Use the mongodb provider.`,{clientVersion:this._clientVersion});return this._createPrismaPromise(i=>this._request({args:n,clientMethod:"$runCommandRaw",dataPath:[],action:"runCommandRaw",argsMapper:Ea,callsite:Ie(this._errorFormat),transaction:i}))}async $queryRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"queryRaw",args:o,transaction:n,clientMethod:i,argsMapper:Si({clientMethod:i,activeProvider:a}),callsite:Ie(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$queryRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0)return this.$queryRawInternal(o,"$queryRaw",...Ga(n,i));throw new G("`$queryRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#queryraw\n",{clientVersion:this._clientVersion})})}$queryRawTyped(n){return this._createPrismaPromise(i=>{if(!this._hasPreviewFlag("typedSql"))throw new G("`typedSql` preview feature must be enabled in order to access $queryRawTyped API",{clientVersion:this._clientVersion});return this.$queryRawInternal(i,"$queryRawTyped",n)})}$queryRawUnsafe(n,...i){return this._createPrismaPromise(o=>this.$queryRawInternal(o,"$queryRawUnsafe",[n,...i]))}_transactionWithArray({promises:n,options:i}){let o=mm.nextId(),s=Ia(n.length),a=n.map((l,u)=>{if(l?.[Symbol.toStringTag]!=="PrismaPromise")throw new Error("All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.");let c=i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel,p={kind:"batch",id:o,index:u,isolationLevel:c,lock:s};return l.requestTransaction?.(p)??l});return Ja(a)}async _transactionWithCallback({callback:n,options:i}){let o={traceparent:this._tracingHelper.getTraceParent()},s={maxWait:i?.maxWait??this._engineConfig.transactionOptions.maxWait,timeout:i?.timeout??this._engineConfig.transactionOptions.timeout,isolationLevel:i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel},a=await this._engine.transaction("start",o,s),l;try{let u={kind:"itx",...a};l=await n(this._createItxClient(u)),await this._engine.transaction("commit",o,a)}catch(u){throw await this._engine.transaction("rollback",o,a).catch(()=>{}),u}return l}_createItxClient(n){return ue(Kt(ue(Is(this),[K("_appliedParent",()=>this._appliedParent._createItxClient(n)),K("_createPrismaPromise",()=>ki(n)),K(pm,()=>n.id)])),[ct(Ca)])}$transaction(n,i){let o;typeof n=="function"?this._engineConfig.adapter?.adapterName==="@prisma/adapter-d1"?o=()=>{throw new Error("Cloudflare D1 does not support interactive transactions. We recommend you to refactor your queries with that limitation in mind, and use batch transactions with `prisma.$transactions([])` where applicable.")}:o=()=>this._transactionWithCallback({callback:n,options:i}):o=()=>this._transactionWithArray({promises:n,options:i});let s={name:"transaction",attributes:{method:"$transaction"}};return this._tracingHelper.runInChildSpan(s,o)}_request(n){n.otelParentCtx=this._tracingHelper.getActiveContext();let i=n.middlewareArgsMapper??cm,o={args:i.requestArgsToMiddlewareArgs(n.args),dataPath:n.dataPath,runInTransaction:!!n.transaction,action:n.action,model:n.model},s={middleware:{name:"middleware",middleware:!0,attributes:{method:"$use"},active:!1},operation:{name:"operation",attributes:{method:o.action,model:o.model,name:o.model?`${o.model}.${o.action}`:o.action}}},a=-1,l=async u=>{let c=this._middlewares.get(++a);if(c)return this._tracingHelper.runInChildSpan(s.middleware,R=>c(u,P=>(R?.end(),l(P))));let{runInTransaction:p,args:m,...f}=u,g={...n,...f};m&&(g.args=i.middlewareArgsToRequestArgs(m)),n.transaction!==void 0&&p===!1&&delete g.transaction;let h=await $s(this,g);return g.model?Ms({result:h,modelName:g.model,args:g.args,extensions:this._extensions,runtimeDataModel:this._runtimeDataModel,globalOmit:this._globalOmit}):h};return this._tracingHelper.runInChildSpan(s.operation,()=>new Ha.AsyncResource("prisma-client-request").runInAsyncScope(()=>l(o)))}async _executeRequest({args:n,clientMethod:i,dataPath:o,callsite:s,action:a,model:l,argsMapper:u,transaction:c,unpacker:p,otelParentCtx:m,customDataProxyFetch:f}){try{n=u?u(n):n;let g={name:"serialize"},h=this._tracingHelper.runInChildSpan(g,()=>zr({modelName:l,runtimeDataModel:this._runtimeDataModel,action:a,args:n,clientMethod:i,callsite:s,extensions:this._extensions,errorFormat:this._errorFormat,clientVersion:this._clientVersion,previewFeatures:this._previewFeatures,globalOmit:this._globalOmit}));return M.enabled("prisma:client")&&(De("Prisma Client call:"),De(`prisma.${i}(${bs(n)})`),De("Generated request:"),De(JSON.stringify(h,null,2)+`
90
+ ${n}`}function Ja(e){return e.length===0?Promise.resolve([]):new Promise((t,r)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?r(i):t(n)))},l=u=>{o||(o=!0,r(u))};for(let u=0;u<e.length;u++)e[u].then(c=>{n[u]=c,a()},c=>{if(!wn(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var De=M("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var cm={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},pm=Symbol.for("prisma.client.transaction.id"),mm={id:0,nextId(){return++this.id}};function Ya(e){class t{constructor(n){this._originalClient=this;this._middlewares=new yn;this._createPrismaPromise=Oi();this.$metrics=new ut(this);this.$extends=Ns;e=n?.__internal?.configOverride?.(e)??e,Gs(e),n&&Qa(n,e);let i=new Ka.EventEmitter().on("error",()=>{});this._extensions=lt.empty(),this._previewFeatures=hn(e),this._clientVersion=e.clientVersion??Va,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=Oa();let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&yr.default.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&yr.default.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=oi(n.adapter);let l=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==l)throw new S(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${l}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new S("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let a=!s&&St(o,{conflictCheck:"none"})||e.injectableEdgeEnv?.();try{let l=n??{},u=l.__internal??{},c=u.debug===!0;c&&M.enable("prisma:client");let p=yr.default.resolve(e.dirname,e.relativePath);za.default.existsSync(p)||(p=e.dirname),De("dirname",e.dirname),De("relativePath",e.relativePath),De("cwd",p);let m=u.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:process.env.NODE_ENV==="production"?this._errorFormat="minimal":process.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:p,dirname:e.dirname,enableDebugLogs:c,allowTriggerPanic:m.allowTriggerPanic,datamodelPath:yr.default.join(e.dirname,e.filename??"schema.prisma"),prismaPath:m.binaryPath??void 0,engineEndpoint:m.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&Da(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(f=>typeof f=="string"?f==="query":f.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Ws(l,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:l.transactionOptions?.maxWait??2e3,timeout:l.transactionOptions?.timeout??5e3,isolationLevel:l.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:ht,getBatchRequestPayload:en,prismaGraphQLToJSError:tn,PrismaClientUnknownRequestError:J,PrismaClientInitializationError:S,PrismaClientKnownRequestError:Q,debug:M("prisma:client:accelerateEngine"),engineVersion:Wa.version,clientVersion:e.clientVersion}},De("clientVersion",e.clientVersion),this._engine=wa(e,this._engineConfig),this._requestHandler=new xn(this,i),l.log)for(let f of l.log){let g=typeof f=="string"?f:f.emit==="stdout"?f.level:null;g&&this.$on(g,h=>{Dt.log(`${Dt.tags[g]??""}`,h.message||h.query)})}}catch(l){throw l.clientVersion=this._clientVersion,l}return this._appliedParent=Kt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$use(n){this._middlewares.use(n)}$on(n,i){n==="beforeExit"?this._engine.onBeforeExit(i):n&&this._engineConfig.logEmitter.on(n,i)}$connect(){try{return this._engine.start()}catch(n){throw n.clientVersion=this._clientVersion,n}}async $disconnect(){try{await this._engine.stop()}catch(n){throw n.clientVersion=this._clientVersion,n}finally{Wi()}}$executeRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"executeRaw",args:o,transaction:n,clientMethod:i,argsMapper:ki({clientMethod:i,activeProvider:a}),callsite:Ie(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$executeRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0){let[s,a]=Ga(n,i);return Si(this._activeProvider,s.text,s.values,Array.isArray(n)?"prisma.$executeRaw`<SQL>`":"prisma.$executeRaw(sql`<SQL>`)"),this.$executeRawInternal(o,"$executeRaw",s,a)}throw new G("`$executeRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#executeraw\n",{clientVersion:this._clientVersion})})}$executeRawUnsafe(n,...i){return this._createPrismaPromise(o=>(Si(this._activeProvider,n,i,"prisma.$executeRawUnsafe(<SQL>, [...values])"),this.$executeRawInternal(o,"$executeRawUnsafe",[n,...i])))}$runCommandRaw(n){if(e.activeProvider!=="mongodb")throw new G(`The ${e.activeProvider} provider does not support $runCommandRaw. Use the mongodb provider.`,{clientVersion:this._clientVersion});return this._createPrismaPromise(i=>this._request({args:n,clientMethod:"$runCommandRaw",dataPath:[],action:"runCommandRaw",argsMapper:Ea,callsite:Ie(this._errorFormat),transaction:i}))}async $queryRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"queryRaw",args:o,transaction:n,clientMethod:i,argsMapper:ki({clientMethod:i,activeProvider:a}),callsite:Ie(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$queryRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0)return this.$queryRawInternal(o,"$queryRaw",...Ga(n,i));throw new G("`$queryRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#queryraw\n",{clientVersion:this._clientVersion})})}$queryRawTyped(n){return this._createPrismaPromise(i=>{if(!this._hasPreviewFlag("typedSql"))throw new G("`typedSql` preview feature must be enabled in order to access $queryRawTyped API",{clientVersion:this._clientVersion});return this.$queryRawInternal(i,"$queryRawTyped",n)})}$queryRawUnsafe(n,...i){return this._createPrismaPromise(o=>this.$queryRawInternal(o,"$queryRawUnsafe",[n,...i]))}_transactionWithArray({promises:n,options:i}){let o=mm.nextId(),s=Ia(n.length),a=n.map((l,u)=>{if(l?.[Symbol.toStringTag]!=="PrismaPromise")throw new Error("All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.");let c=i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel,p={kind:"batch",id:o,index:u,isolationLevel:c,lock:s};return l.requestTransaction?.(p)??l});return Ja(a)}async _transactionWithCallback({callback:n,options:i}){let o={traceparent:this._tracingHelper.getTraceParent()},s={maxWait:i?.maxWait??this._engineConfig.transactionOptions.maxWait,timeout:i?.timeout??this._engineConfig.transactionOptions.timeout,isolationLevel:i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel},a=await this._engine.transaction("start",o,s),l;try{let u={kind:"itx",...a};l=await n(this._createItxClient(u)),await this._engine.transaction("commit",o,a)}catch(u){throw await this._engine.transaction("rollback",o,a).catch(()=>{}),u}return l}_createItxClient(n){return ue(Kt(ue(Ds(this),[K("_appliedParent",()=>this._appliedParent._createItxClient(n)),K("_createPrismaPromise",()=>Oi(n)),K(pm,()=>n.id)])),[ct(Ca)])}$transaction(n,i){let o;typeof n=="function"?this._engineConfig.adapter?.adapterName==="@prisma/adapter-d1"?o=()=>{throw new Error("Cloudflare D1 does not support interactive transactions. We recommend you to refactor your queries with that limitation in mind, and use batch transactions with `prisma.$transactions([])` where applicable.")}:o=()=>this._transactionWithCallback({callback:n,options:i}):o=()=>this._transactionWithArray({promises:n,options:i});let s={name:"transaction",attributes:{method:"$transaction"}};return this._tracingHelper.runInChildSpan(s,o)}_request(n){n.otelParentCtx=this._tracingHelper.getActiveContext();let i=n.middlewareArgsMapper??cm,o={args:i.requestArgsToMiddlewareArgs(n.args),dataPath:n.dataPath,runInTransaction:!!n.transaction,action:n.action,model:n.model},s={middleware:{name:"middleware",middleware:!0,attributes:{method:"$use"},active:!1},operation:{name:"operation",attributes:{method:o.action,model:o.model,name:o.model?`${o.model}.${o.action}`:o.action}}},a=-1,l=async u=>{let c=this._middlewares.get(++a);if(c)return this._tracingHelper.runInChildSpan(s.middleware,R=>c(u,P=>(R?.end(),l(P))));let{runInTransaction:p,args:m,...f}=u,g={...n,...f};m&&(g.args=i.middlewareArgsToRequestArgs(m)),n.transaction!==void 0&&p===!1&&delete g.transaction;let h=await qs(this,g);return g.model?Fs({result:h,modelName:g.model,args:g.args,extensions:this._extensions,runtimeDataModel:this._runtimeDataModel,globalOmit:this._globalOmit}):h};return this._tracingHelper.runInChildSpan(s.operation,()=>new Ha.AsyncResource("prisma-client-request").runInAsyncScope(()=>l(o)))}async _executeRequest({args:n,clientMethod:i,dataPath:o,callsite:s,action:a,model:l,argsMapper:u,transaction:c,unpacker:p,otelParentCtx:m,customDataProxyFetch:f}){try{n=u?u(n):n;let g={name:"serialize"},h=this._tracingHelper.runInChildSpan(g,()=>zr({modelName:l,runtimeDataModel:this._runtimeDataModel,action:a,args:n,clientMethod:i,callsite:s,extensions:this._extensions,errorFormat:this._errorFormat,clientVersion:this._clientVersion,previewFeatures:this._previewFeatures,globalOmit:this._globalOmit}));return M.enabled("prisma:client")&&(De("Prisma Client call:"),De(`prisma.${i}(${xs(n)})`),De("Generated request:"),De(JSON.stringify(h,null,2)+`
91
91
  `)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:h,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:c,unpacker:p,otelParentCtx:m,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:f})}catch(g){throw g.clientVersion=this._clientVersion,g}}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}}return t}function Ga(e,t){return dm(e)?[new X(e,t),Ra]:[e,Sa]}function dm(e){return Array.isArray(e)&&Array.isArray(e.raw)}var fm=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function Za(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!fm.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}function Xa(e){St(e,{conflictCheck:"warn"})}0&&(module.exports={Debug,Decimal,Extensions,MetricsClient,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,createParam,defineDmmfProperty,deserializeJsonResponse,deserializeRawResult,dmmfToRuntimeDataModel,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,serializeJsonQuery,skip,sqltag,warnEnvConflicts,warnOnce});
92
92
  /*! Bundled license information:
93
93