PageSourceSearch

https://bsf.ai/assets/payment-config-XvXkNyzl.js

js bsf.ai collected 2026-10-05 12:13:15 UTC 416,597 bytes, 351 lines download raw bytes

1import{bL as $,bM as _,bN as K,bO as ie,bP as Tt,bQ as Qi,bR as pi,bS as Od,bT as hi,bU as Cd,bV as Pd,bW as Ld,bX as Xi,bY as P,bZ as Nd}from"./main-DniETxk8.js";import{j as w,c as T,p as R,i as Yi,d as zd,e as ea,f as ta,g as ra,$ as jd,h as Kd,k as Hd,l as Wd,m as Vd,n as Jd,q as Bd,r as Md,t as qd,v as Fd,w as Zd,x as Gd,y as Qd,z as Xd,A as Yd,B as eu,C as tu,D as ru,E as nu,F as iu,G as au,H as ou,I as su,J as cu,K as du,L as uu,M as lu,N as fu,O as mu,P as pu,Q as hu,R as gu,S as yu,T as vu,U as wu,V as bu,W as $u,X as ku,Y as Su,Z as Iu,a0 as _u,a1 as Au,a2 as Uu,a3 as Eu,a4 as xu,a5 as Tu,a6 as Du,a7 as Ru,a8 as Ou,a9 as Cu,aa as Pu,ab as Lu,ac as Nu,ad as zu,ae as ju,af as Ku,ag as Hu,ah as Wu,ai as Vu,aj as Ju,ak as Bu,al as Mu,am as qu,an as Fu,ao as Zu,ap as Gu,aq as Qu,ar as Xu,as as Yu,at as el,au as tl,av as rl,aw as nl,ax as il,ay as al,az as ol,aA as sl,aB as cl,aC as dl,aD as ul,aE as ll,aF as fl,aG as ml,aH as pl,aI as hl,aJ as gl,aK as yl,aL as vl,aM as wl,aN as bl,aO as $l,aP as kl,aQ as Sl,aR as Il,aS as _l,aT as Al,aU as Ul,aV as El,aW as xl,aX as Tl,aY as An,aZ as Dl,a_ as Un,a$ as En,b0 as Rl,b1 as xn,b2 as Tn,b3 as Ol,b4 as Cl,b5 as Pl,b6 as Ll,b7 as Nl,b8 as zl,b9 as jl,ba as Kl,bb as Hl,bc as Wl,bd as na,be as ia,bf as aa,bg as oa,bh as sa,bi as Vl,bj as Jl,bk as Bl,bl as Ml,bm as ql,bn as Fl,bo as Zl,bp as Gl,bq as Ql,br as Xl,bs as Yl,bt as ef,bu as tf,bv as cr,bw as rf,bx as nf,by as af,bz as of,bA as dr,bB as Dt,bC as sf,bD as ur,bE as cf,bF as df,bG as uf,bH as lf,bI as ff,bJ as mf,bK as pf,bL as hf,bM as gf,bN as yf,bO as vf,bP as wf,bQ as bf,bR as lr,bS as $f,bT as fr,bU as mr,bV as Rt,bW as kf,bX as Sf,bY as pr,bZ as hr,b_ as gr,b$ as yr,c0 as vr,c1 as wr,c2 as If,c3 as _f,c4 as Af,c5 as br,c6 as Uf,c7 as $r,c8 as Ef,c9 as kr,ca as Sr,cb as xf,cc as Tf,cd as Df,ce as Rf,cf as Ir,cg as Of,ch as Cf,ci as Pf,cj as _r,ck as Lf,cl as Ar,cm as Nf,cn as zf,co as jf,cp as Ur,cq as Kf,cr as Hf,cs as Wf,ct as Vf,cu as Jf,cv as Bf,cw as Mf,cx as Er,cy as xr,cz as Tr,cA as qf,cB as Ff,cC as Zf,cD as Gf,cE as Qf,cF as Xf,cG as Yf,cH as Dr,cI as Rr,cJ as em,cK as Or,cL as tm,cM as rm,cN as nm,cO as im,cP as am,cQ as om,cR as sm,cS as Cr,cT as cm,cU as dm,cV as um,cW as lm,cX as fm,cY as mm,cZ as pm,c_ as hm,c$ as Dn,d0 as vt,d1 as gm,d2 as ym,d3 as vm,d4 as wm,d5 as bm,d6 as $m,d7 as km,d8 as Rn,d9 as On,da as Sm,db as Pr,dc as Im,dd as _m,de as Am,df as Um,dg as Em,dh as xm,di as Cn,dj as Pn,dk as Ln,dl as Tm,dm as Dm,dn as Rm,dp as Om,dq as Cm,dr as Pm,ds as Lm,dt as Nn,du as zn,dv as jn,dw as Nm,dx as zm,dy as Kn,dz as Hn,dA as Wn,dB as Vn,dC as Jn,dD as Bn,dE as ca,dF as da,dG as ua,dH as la,dI as fa,dJ as ma,dK as pa,dL as ha,dM as ga,dN as ya,dO as va,dP as wa,dQ as ba,dR as $a,dS as ka,dT as Sa,dU as Ia,dV as _a,dW as Aa,dX as Ua,dY as Ea,dZ as xa,d_ as Ta,d$ as Da,e0 as Ra,e1 as Oa,e2 as Ca,e3 as Pa,e4 as La,e5 as Na,e6 as za,e7 as ja,e8 as Ka,e9 as Ha,ea as Wa,eb as Va,ec as Ja,ed as Ba,ee as Ma,ef as qa,eg as Fa,eh as Za,ei as Ga,ej as Qa,ek as Xa,el as Ya,em as eo,en as to,eo as ro,ep as no,eq as io,er as ao,es as oo,et as so,eu as co,ev as uo,ew as lo,ex as fo,ey as mo,ez as po,eA as ho,eB as go,eC as yo,eD as vo,eE as wo,eF as bo,eG as $o,eH as ko,eI as So,eJ as Io,eK as _o,eL as Xt,eM as De,a as pt,eN as Ao,eO as Uo,eP as Eo,b as Ae,eQ as xo,eR as To,eS as Do,eT as Ro,eU as Oo,eV as Co,eW as Po,eX as Lo,eY as Ke,eZ as No,e_ as zo,e$ as jo,f0 as Ko,f1 as Ho,f2 as Ge,f3 as Wo,f4 as Vo,f5 as Jo,_ as Mn,f6 as Bo,f7 as Mo,f8 as qo,f9 as Fo,fa as Zo,fb as Go,fc as Qo,fd as Xo,fe as Yo,ff as es,fg as ts,fh as rs,fi as ns,fj as is,fk as ht,fl as Lr,fm as Yt,fn as as,fo as os,fp as ss,fq as cs,fr as ds,fs as qn,ft as us,fu as ls,fv as fs,fw as ms,fx as ps,fy as hs,fz as gs,fA as ys,fB as vs,fC as ws,fD as bs,fE as $s,fF as Ze,o as W,fG as Nt,fH as ks,fI as Ss,fJ as Is,fK as _s,fL as As,fM as Us,fN as Es,fO as xs,fP as Qe,fQ as Ts,fR as Ds,fS as Rs,fT as Os,fU as Cs,fV as Ps,fW as Ls,fX as Ns,fY as zs,s as b,fZ as js,f_ as Ks,f$ as Hs,g0 as Ws,g1 as Vs,g2 as Js,g3 as Bs,g4 as Ms,g5 as qs,g6 as Fs,g7 as Zs,g8 as Gs,u as Qs,g9 as Xs,ga as Ys,gb as ec,gc as tc,gd as rc,ge as nc,gf as ic,gg as ac,gh as oc}from"./schemas-AkmBYKZr.js";function nn(e){return e==="-"||e==="^"||e==="$"||e==="+"||e==="."||e==="("||e===")"||e==="|"||e==="["||e==="]"||e==="{"||e==="}"||e==="*"||e==="?"||e==="\\"?`\\${e}`:e}function jm(e){let r="";for(let i=0;i<e.length;i++)r+=nn(e[i]);return r}function sc(e,r=!0){if(Array.isArray(e))return`(?:${e.map(d=>`^${sc(d,r)}$`).join("|")})`;let i="",a="",t=".";r===!0?(i="/",a="[/\\\\]",t="[^/\\\\]"):r&&(i=r,a=jm(i),a.length>1?(a=`(?:${a})`,t=`((?!${a}).)`):t=`[^${a}]`);const n=r?`${a}+?`:"",o=r?`${a}*?`:"",s=r?e.split(i):[e];let c="";for(let d=0;d<s.length;d++){const u=s[d],f=s[d+1];let l="";if(!(!u&&d>0)){if(r&&(d===s.length-1?l=o:f!=="**"?l=n:l=""),r&&u==="**"){l&&(c+=d===0?"":l,c+=`(?:${t}*?${l})*?`);continue}for(let m=0;m<u.length;m++){const h=u[m];h==="\\"?m<u.length-1&&(c+=nn(u[m+1]),m++):h==="?"?c+=t:h==="*"?c+=`${t}*?`:c+=nn(h)}c+=l}}return c}function Km(e,r){if(typeof r!="string")throw new TypeError(`Sample must be a string, but ${typeof r} given`);return e.test(r)}function gi(e,r){if(typeof e!="string"&&!Array.isArray(e))throw new TypeError(`The first argument must be a single pattern string or an array of patterns, but ${typeof e} given`);if((typeof r=="string"||typeof r=="boolean")&&(r={separator:r}),arguments.length===2&&!(typeof r>"u"||typeof r=="object"&&r!==null&&!Array.isArray(r)))throw new TypeError(`The second argument must be an options object or a string/boolean separator, but ${typeof r} given`);if(r=r||{},r.separator==="\\")throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");const i=sc(e,r.separator),a=new RegExp(`^${i}$`,r.flags),t=Km.bind(null,a);return t.options=r,t.pattern=e,t.regexp=a,t}function yi(e){switch(e){case"a-z":return"abcdefghijklmnopqrstuvwxyz";case"A-Z":return"ABCDEFGHIJKLMNOPQRSTUVWXYZ";case"0-9":return"0123456789";case"-_":return"-_";default:throw new Error(`Unsupported alphabet: ${e}`)}}function cc(...e){const r=e.map(yi).join("");if(r.length===0)throw new Error("No valid characters provided for random string generation.");const i=r.length;return(a,...t)=>{if(a<=0)throw new Error("Length must be a positive integer.");let n=r,o=i;t.length>0&&(n=t.map(yi).join(""),o=n.length);const s=Math.floor(256/o)*o,c=new Uint8Array(a*2),d=c.length;let u="",f=d,l;
1for(;u.length<a;)f>=d&&(crypto.getRandomValues(c),f=0),l=c[f++],l<s&&(u+=n[l%o]);return u}}const Fn=cc("a-z","0-9","A-Z","-_");function Hm(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function an(e,r=""){if(!Number.isSafeInteger(e)||e<0){const i=r&&`"${r}" `;throw new Error(`${i}expected integer >= 0, got ${e}`)}}function Ot(e,r,i=""){const a=Hm(e),t=e?.length,n=r!==void 0;if(!a||n&&t!==r){const o=i&&`"${i}" `,s=n?` of length ${r}`:"",c=a?`length=${t}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+s+", got "+c)}return e}function Zn(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");an(e.outputLen),an(e.blockLen)}function er(e,r=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function Wm(e,r){Ot(e,void 0,"digestInto() output");const i=r.outputLen;if(e.length<i)throw new Error('"digestInto() output" expected to be of length >='+i)}function Ct(...e){for(let r=0;r<e.length;r++)e[r].fill(0)}function Mr(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ke(e,r){return e<<32-r|e>>>r}function Vm(e,r={}){const i=(t,n)=>e(n).update(t).digest(),a=e(void 0);return i.outputLen=a.outputLen,i.blockLen=a.blockLen,i.create=t=>e(t),Object.assign(i,r),Object.freeze(i)}const Jm=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});class dc{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(r,i){if(Zn(r),Ot(i,void 0,"key"),this.iHash=r.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,t=new Uint8Array(a);t.set(i.length>a?r.create().update(i).digest():i);for(let n=0;n<t.length;n++)t[n]^=54;this.iHash.update(t),this.oHash=r.create();for(let n=0;n<t.length;n++)t[n]^=106;this.oHash.update(t),Ct(t)}update(r){return er(this),this.iHash.update(r),this}digestInto(r){er(this),Ot(r,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){const r=new Uint8Array(this.oHash.outputLen);return this.digestInto(r),r}_cloneInto(r){r||=Object.create(Object.getPrototypeOf(this),{});const{oHash:i,iHash:a,finished:t,destroyed:n,blockLen:o,outputLen:s}=this;return r=r,r.finished=t,r.destroyed=n,r.blockLen=o,r.outputLen=s,r.oHash=i._cloneInto(r.oHash),r.iHash=a._cloneInto(r.iHash),r}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Gn=(e,r,i)=>new dc(e,r).update(i).digest();Gn.create=(e,r)=>new dc(e,r);function Bm(e,r,i){return Zn(e),i===void 0&&(i=new Uint8Array(e.outputLen)),Gn(e,i,r)}const qr=Uint8Array.of(0),vi=Uint8Array.of();function Mm(e,r,i,a=32){Zn(e),an(a,"length");const t=e.outputLen;if(a>255*t)throw new Error("Length must be <= 255*HashLen");const n=Math.ceil(a/t);i===void 0?i=vi:Ot(i,void 0,"info");const o=new Uint8Array(n*t),s=Gn.create(e,r),c=s._cloneInto(),d=new Uint8Array(s.outputLen);for(let u=0;u<n;u++)qr[0]=u+1,c.update(u===0?vi:d).update(i).update(qr).digestInto(d),o.set(d,t*u),s._cloneInto(c);return s.destroy(),c.destroy(),Ct(d,qr),o.slice(0,a)}const qm=(e,r,i,a,t)=>Mm(e,Bm(e,r,i),a,t);function Fm(e,r,i){return e&r^~e&i}function Zm(e,r,i){return e&r^e&i^r&i}class Gm{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(r,i,a,t){this.blockLen=r,this.outputLen=i,this.padOffset=a,this.isLE=t,this.buffer=new Uint8Array(r),this.view=Mr(this.buffer)}update(r){er(this),Ot(r);const{view:i,buffer:a,blockLen:t}=this,n=r.length;for(let o=0;o<n;){const s=Math.min(t-this.pos,n-o);if(s===t){const c=Mr(r);for(;t<=n-o;o+=t)this.process(c,o);continue}a.set(r.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===t&&(this.process(i,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){er(this),Wm(r,this),this.finished=!0;const{buffer:i,view:a,blockLen:t,isLE:n}=this;let{pos:o}=this;i[o++]=128,Ct(this.buffer.subarray(o)),this.padOffset>t-o&&(this.process(a,0),o=0);for(let f=o;f<t;f++)i[f]=0;a.setBigUint64(t-8,BigInt(this.length*8),n),this.process(a,0);const s=Mr(r),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const d=c/4,u=this.get();if(d>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<d;f++)s.setUint32(4*f,u[f],n)}digest(){const{buffer:r,outputLen:i}=this;this.digestInto(r);const a=r.slice(0,i);return this.destroy(),a}_cloneInto(r){r||=new this.constructor,r.set(...this.get());const{blockLen:i,buffer:a,length:t,finished:n,destroyed:o,pos:s}=this;return r.destroyed=o,r.finished=n,r.length=t,r.pos=s,t%i&&r.buffer.set(a),r}clone(){return this._cloneInto()}}const Ce=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qm=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
1734187,3204031479,3329325298]),Pe=new Uint32Array(64);class Xm extends Gm{constructor(r){super(64,r,8,!1)}get(){const{A:r,B:i,C:a,D:t,E:n,F:o,G:s,H:c}=this;return[r,i,a,t,n,o,s,c]}set(r,i,a,t,n,o,s,c){this.A=r|0,this.B=i|0,this.C=a|0,this.D=t|0,this.E=n|0,this.F=o|0,this.G=s|0,this.H=c|0}process(r,i){for(let f=0;f<16;f++,i+=4)Pe[f]=r.getUint32(i,!1);for(let f=16;f<64;f++){const l=Pe[f-15],m=Pe[f-2],h=ke(l,7)^ke(l,18)^l>>>3,g=ke(m,17)^ke(m,19)^m>>>10;Pe[f]=g+Pe[f-7]+h+Pe[f-16]|0}let{A:a,B:t,C:n,D:o,E:s,F:c,G:d,H:u}=this;for(let f=0;f<64;f++){const l=ke(s,6)^ke(s,11)^ke(s,25),m=u+l+Fm(s,c,d)+Qm[f]+Pe[f]|0,g=(ke(a,2)^ke(a,13)^ke(a,22))+Zm(a,t,n)|0;u=d,d=c,c=s,s=o+m|0,o=n,n=t,t=a,a=m+g|0}a=a+this.A|0,t=t+this.B|0,n=n+this.C|0,o=o+this.D|0,s=s+this.E|0,c=c+this.F|0,d=d+this.G|0,u=u+this.H|0,this.set(a,t,n,o,s,c,d,u)}roundClean(){Ct(Pe)}destroy(){this.set(0,0,0,0,0,0,0,0),Ct(this.buffer)}}class Ym extends Xm{A=Ce[0]|0;B=Ce[1]|0;C=Ce[2]|0;D=Ce[3]|0;E=Ce[4]|0;F=Ce[5]|0;G=Ce[6]|0;H=Ce[7]|0;constructor(){super(32)}}const ep=Vm(()=>new Ym,Jm(1)),tr=new TextEncoder,Re=new TextDecoder,rr=2**32;function $e(...e){const r=e.reduce((t,{length:n})=>t+n,0),i=new Uint8Array(r);let a=0;for(const t of e)i.set(t,a),a+=t.length;return i}function on(e,r,i){if(r<0||r>=rr)throw new RangeError(`value must be >= 0 and <= ${rr-1}. Received ${r}`);e.set([r>>>24,r>>>16,r>>>8,r&255],i)}function uc(e){const r=Math.floor(e/rr),i=e%rr,a=new Uint8Array(8);return on(a,r,0),on(a,i,4),a}function Qn(e){const r=new Uint8Array(4);return on(r,e),r}function me(e){const r=new Uint8Array(e.length);for(let i=0;i<e.length;i++){const a=e.charCodeAt(i);if(a>127)throw new TypeError("non-ASCII string encountered in encode()");r[i]=a}return r}function tp(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const r=32768,i=[];for(let a=0;a<e.length;a+=r)i.push(String.fromCharCode.apply(null,e.subarray(a,a+r)));return btoa(i.join(""))}function rp(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const r=atob(e),i=new Uint8Array(r.length);for(let a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return i}function Xe(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Re.decode(e),{alphabet:"base64url"});let r=e;r instanceof Uint8Array&&(r=Re.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/");try{return rp(r)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}function oe(e){let r=e;return typeof r=="string"&&(r=tr.encode(r)),Uint8Array.prototype.toBase64?r.toBase64({alphabet:"base64url",omitPadding:!0}):tp(r).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}const le=(e,r="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${r} must be ${e}`),_e=(e,r)=>e.name===r;function np(e){return parseInt(e.name.slice(4),10)}function Ft(e,r){if(np(e.hash)!==r)throw le(`SHA-${r}`,"algorithm.hash")}function ip(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function lc(e,r){if(r&&!e.usages.includes(r))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${r}.`)}function ap(e,r,i){switch(r){case"HS256":case"HS384":case"HS512":{if(!_e(e.algorithm,"HMAC"))throw le("HMAC");Ft(e.algorithm,parseInt(r.slice(2),10));break}case"RS256":case"RS384":case"RS512":{if(!_e(e.algorithm,"RSASSA-PKCS1-v1_5"))throw le("RSASSA-PKCS1-v1_5");Ft(e.algorithm,parseInt(r.slice(2),10));break}
1case"PS256":case"PS384":case"PS512":{if(!_e(e.algorithm,"RSA-PSS"))throw le("RSA-PSS");Ft(e.algorithm,parseInt(r.slice(2),10));break}case"Ed25519":case"EdDSA":{if(!_e(e.algorithm,"Ed25519"))throw le("Ed25519");break}case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":{if(!_e(e.algorithm,r))throw le(r);break}case"ES256":case"ES384":case"ES512":{if(!_e(e.algorithm,"ECDSA"))throw le("ECDSA");const a=ip(r);if(e.algorithm.namedCurve!==a)throw le(a,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}lc(e,i)}function He(e,r,i){switch(r){case"A128GCM":case"A192GCM":case"A256GCM":{if(!_e(e.algorithm,"AES-GCM"))throw le("AES-GCM");const a=parseInt(r.slice(1,4),10);if(e.algorithm.length!==a)throw le(a,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!_e(e.algorithm,"AES-KW"))throw le("AES-KW");const a=parseInt(r.slice(1,4),10);if(e.algorithm.length!==a)throw le(a,"algorithm.length");break}case"ECDH":{switch(e.algorithm.name){case"ECDH":case"X25519":break;default:throw le("ECDH or X25519")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!_e(e.algorithm,"PBKDF2"))throw le("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!_e(e.algorithm,"RSA-OAEP"))throw le("RSA-OAEP");Ft(e.algorithm,parseInt(r.slice(9),10)||1);break}default:throw new TypeError("CryptoKey does not support this operation")}lc(e,i)}function fc(e,r,...i){if(i=i.filter(Boolean),i.length>2){const a=i.pop();e+=`one of type ${i.join(", ")}, or ${a}.`}else i.length===2?e+=`one of type ${i[0]} or ${i[1]}.`:e+=`of type ${i[0]}.`;return r==null?e+=` Received ${r}`:typeof r=="function"&&r.name?e+=` Received function ${r.name}`:typeof r=="object"&&r!=null&&r.constructor?.name&&(e+=` Received an instance of ${r.constructor.name}`),e}const wt=(e,...r)=>fc("Key must be ",e,...r),mc=(e,r,...i)=>fc(`Key for the ${e} algorithm must be `,r,...i);class ue extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(r,i){super(r,i),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class ge extends ue{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(r,i,a="unspecified",t="unspecified"){super(r,{cause:{claim:a,reason:t,payload:i}}),this.claim=a,this.reason=t,this.payload=i}}class sn extends ue{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(r,i,a="unspecified",t="unspecified"){super(r,{cause:{claim:a,reason:t,payload:i}}),this.claim=a,this.reason=t,this.payload=i}}class cn extends ue{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class F extends ue{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class dn extends ue{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(r="decryption operation failed",i){super(r,i)}}class E extends ue{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class re extends ue{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class Ie extends ue{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class op extends ue{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class pc extends ue{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class hc extends ue{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(r="no applicable key found in the JSON Web Key Set",i){super(r,i)}}class sp extends ue{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(r="multiple matching keys found in the JSON Web Key Set",i){super(r,i)}}class cp extends ue{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(r="request timed out",i){super(r,i)}}class dp extends ue{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(r="signature verification failed",i){super(r,i)}}function Et(e){if(!bt(e))throw new Error("CryptoKey instance expected")}const bt=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},Xn=e=>e?.[Symbol.toStringTag]==="KeyObject",Yn=e=>bt(e)||Xn(e);function ei(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new F(`Unsupported JWE Algorithm: ${e}`)}}const dt=e=>crypto.getRandomValues(new Uint8Array(ei(e)>>3));function nr(e,r){const i=e.byteLength<<3;if(i!==r)throw new E(`Invalid Content Encryption Key length. Expected ${r} bits, got ${i} bits`)}
1function gc(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new F(`Unsupported JWE Algorithm: ${e}`)}}const up=e=>crypto.getRandomValues(new Uint8Array(gc(e)>>3));function yc(e,r){if(r.length<<3!==gc(e))throw new E("Invalid Initialization Vector length")}async function vc(e,r,i){if(!(r instanceof Uint8Array))throw new TypeError(wt(r,"Uint8Array"));const a=parseInt(e.slice(1,4),10),t=await crypto.subtle.importKey("raw",r.subarray(a>>3),"AES-CBC",!1,[i]),n=await crypto.subtle.importKey("raw",r.subarray(0,a>>3),{hash:`SHA-${a<<1}`,name:"HMAC"},!1,["sign"]);return{encKey:t,macKey:n,keySize:a}}async function wc(e,r,i){return new Uint8Array((await crypto.subtle.sign("HMAC",e,r)).slice(0,i>>3))}async function lp(e,r,i,a,t){const{encKey:n,macKey:o,keySize:s}=await vc(e,i,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:a,name:"AES-CBC"},n,r)),d=$e(t,a,c,uc(t.length<<3)),u=await wc(o,d,s);return{ciphertext:c,tag:u,iv:a}}async function fp(e,r){if(!(e instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(r instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");const i={name:"HMAC",hash:"SHA-256"},a=await crypto.subtle.generateKey(i,!1,["sign"]),t=new Uint8Array(await crypto.subtle.sign(i,a,e)),n=new Uint8Array(await crypto.subtle.sign(i,a,r));let o=0,s=-1;for(;++s<32;)o|=t[s]^n[s];return o===0}async function mp(e,r,i,a,t,n){const{encKey:o,macKey:s,keySize:c}=await vc(e,r,"decrypt"),d=$e(n,a,i,uc(n.length<<3)),u=await wc(s,d,c);let f;try{f=await fp(t,u)}catch{}if(!f)throw new dn;let l;try{l=new Uint8Array(await crypto.subtle.decrypt({iv:a,name:"AES-CBC"},o,i))}catch{}if(!l)throw new dn;return l}async function pp(e,r,i,a,t){let n;i instanceof Uint8Array?n=await crypto.subtle.importKey("raw",i,"AES-GCM",!1,["encrypt"]):(He(i,e,"encrypt"),n=i);const o=new Uint8Array(await crypto.subtle.encrypt({additionalData:t,iv:a,name:"AES-GCM",tagLength:128},n,r)),s=o.slice(-16);return{ciphertext:o.slice(0,-16),tag:s,iv:a}}async function hp(e,r,i,a,t,n){let o;r instanceof Uint8Array?o=await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["decrypt"]):(He(r,e,"decrypt"),o=r);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:n,iv:a,name:"AES-GCM",tagLength:128},o,$e(i,t)))}catch{throw new dn}}const bc="Unsupported JWE Content Encryption Algorithm";async function $c(e,r,i,a,t){if(!bt(i)&&!(i instanceof Uint8Array))throw new TypeError(wt(i,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));switch(a?yc(e,a):a=up(e),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i instanceof Uint8Array&&nr(i,parseInt(e.slice(-3),10)),lp(e,r,i,a,t);case"A128GCM":case"A192GCM":case"A256GCM":return i instanceof Uint8Array&&nr(i,parseInt(e.slice(1,4),10)),pp(e,r,i,a,t);default:throw new F(bc)}}async function kc(e,r,i,a,t,n){if(!bt(r)&&!(r instanceof Uint8Array))throw new TypeError(wt(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!a)throw new E("JWE Initialization Vector missing");if(!t)throw new E("JWE Authentication Tag missing");switch(yc(e,a),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&nr(r,parseInt(e.slice(-3),10)),mp(e,r,i,a,t,n);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&nr(r,parseInt(e.slice(1,4),10)),hp(e,r,i,a,t,n);default:throw new F(bc)}}const gp=Symbol();function ve(e,r){if(e)throw new TypeError(`${r} can only be called once`)}function we(e,r,i){try{return Xe(e)}catch{throw new i(`Failed to base64url decode the ${r}`)}}async function Sc(e,r){const i=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(i,r))}const yp=e=>typeof e=="object"&&e!==null;function pe(e){if(!yp(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function Nr(...e){const r=e.filter(Boolean);if(r.length===0||r.length===1)return!0;let i;for(const a of r){const t=Object.keys(a);if(!i||i.size===0){i=new Set(t);continue}for(const n of t){if(i.has(n))return!1;i.add(n)}}return!0}const zr=e=>
1pe(e)&&typeof e.kty=="string",vp=e=>e.kty!=="oct"&&(e.kty==="AKP"&&typeof e.priv=="string"||typeof e.d=="string"),wp=e=>e.kty!=="oct"&&e.d===void 0&&e.priv===void 0,bp=e=>e.kty==="oct"&&typeof e.k=="string";function Ic(e,r){if(e.algorithm.length!==parseInt(r.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${r}`)}function _c(e,r,i){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"AES-KW",!0,[i]):(He(e,r,i),e)}async function un(e,r,i){const a=await _c(r,e,"wrapKey");Ic(a,e);const t=await crypto.subtle.importKey("raw",i,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",t,a,"AES-KW"))}async function ln(e,r,i){const a=await _c(r,e,"unwrapKey");Ic(a,e);const t=await crypto.subtle.unwrapKey("raw",i,a,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",t))}function Fr(e){return $e(Qn(e.length),e)}async function $p(e,r,i){const a=r>>3,t=32,n=Math.ceil(a/t),o=new Uint8Array(n*t);for(let s=1;s<=n;s++){const c=new Uint8Array(4+e.length+i.length);c.set(Qn(s),0),c.set(e,4),c.set(i,4+e.length);const d=await Sc("sha256",c);o.set(d,(s-1)*t)}return o.slice(0,a)}async function Ac(e,r,i,a,t=new Uint8Array,n=new Uint8Array){He(e,"ECDH"),He(r,"ECDH","deriveBits");const o=Fr(me(i)),s=Fr(t),c=Fr(n),d=Qn(a),u=new Uint8Array,f=$e(o,s,c,d,u),l=new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},r,kp(e)));return $p(l,a,f)}function kp(e){return e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3}function Uc(e){switch(e.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return e.algorithm.name==="X25519"}}function Sp(e,r){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]):(He(e,r,"deriveBits"),e)}const Ip=(e,r)=>$e(me(e),Uint8Array.of(0),r);async function Ec(e,r,i,a){if(!(e instanceof Uint8Array)||e.length<8)throw new E("PBES2 Salt Input must be 8 or more octets");const t=Ip(r,e),n=parseInt(r.slice(13,16),10),o={hash:`SHA-${r.slice(8,11)}`,iterations:i,name:"PBKDF2",salt:t},s=await Sp(a,r);return new Uint8Array(await crypto.subtle.deriveBits(o,s,n))}async function _p(e,r,i,a=2048,t=crypto.getRandomValues(new Uint8Array(16))){const n=await Ec(t,e,a,r);return{encryptedKey:await un(e.slice(-6),n,i),p2c:a,p2s:oe(t)}}async function Ap(e,r,i,a,t){const n=await Ec(t,e,a,r);return ln(e.slice(-6),n,i)}function jr(e,r){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:i}=r.algorithm;if(typeof i!="number"||i<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}function xc(e,r){const i=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:i,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:i,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:i,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:i,name:"ECDSA",namedCurve:r.namedCurve};
1case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new F(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function Tc(e,r,i){if(r instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(wt(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[i])}return ap(r,e,i),r}async function Up(e,r,i){const a=await Tc(e,r,"sign");jr(e,a);const t=await crypto.subtle.sign(xc(e,a.algorithm),a,i);return new Uint8Array(t)}async function Ep(e,r,i,a){const t=await Tc(e,r,"verify");jr(e,t);const n=xc(e,t.algorithm);try{return await crypto.subtle.verify(n,t,i,a)}catch{return!1}}const Dc=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new F(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};async function xp(e,r,i){return He(r,e,"encrypt"),jr(e,r),new Uint8Array(await crypto.subtle.encrypt(Dc(e),r,i))}async function Tp(e,r,i){return He(r,e,"decrypt"),jr(e,r),new Uint8Array(await crypto.subtle.decrypt(Dc(e),r,i))}const Jt='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';function Dp(e){let r,i;switch(e.kty){case"AKP":{switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":r={name:e.alg},i=e.priv?["sign"]:["verify"];break;default:throw new F(Jt)}break}case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},i=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new F(Jt)}break}case"EC":{switch(e.alg){case"ES256":case"ES384":case"ES512":r={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[e.alg]},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new F(Jt)}break}
1case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new F(Jt)}break}default:throw new F('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:i}}async function Zt(e){if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:i}=Dp(e),a={...e};return a.kty!=="AKP"&&delete a.alg,delete a.use,crypto.subtle.importKey("jwk",a,r,e.ext??!(e.d||e.priv),e.key_ops??i)}const st="given KeyObject instance cannot be used for this algorithm";let ft;const wi=async(e,r,i,a=!1)=>{ft||=new WeakMap;let t=ft.get(e);if(t?.[i])return t[i];const n=await Zt({...r,alg:i});return a&&Object.freeze(e),t?t[i]=n:ft.set(e,{[i]:n}),n},Rp=(e,r)=>{ft||=new WeakMap;let i=ft.get(e);if(i?.[r])return i[r];const a=e.type==="public",t=!!a;let n;if(e.asymmetricKeyType==="x25519"){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(st)}n=e.toCryptoKey(e.asymmetricKeyType,t,a?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(r!=="EdDSA"&&r!=="Ed25519")throw new TypeError(st);n=e.toCryptoKey(e.asymmetricKeyType,t,[a?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":{if(r!==e.asymmetricKeyType.toUpperCase())throw new TypeError(st);n=e.toCryptoKey(e.asymmetricKeyType,t,[a?"verify":"sign"])}}if(e.asymmetricKeyType==="rsa"){let o;switch(r){case"RSA-OAEP":o="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":o="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":o="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":o="SHA-512";break;default:throw new TypeError(st)}if(r.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:o},t,a?["encrypt"]:["decrypt"]);n=e.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:o},t,[a?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){const s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!s)throw new TypeError(st);const c={ES256:"P-256",ES384:"P-384",ES512:"P-521"};c[r]&&s===c[r]&&(n=e.toCryptoKey({name:"ECDSA",namedCurve:s},t,[a?"verify":"sign"])),r.startsWith("ECDH-ES")&&(n=e.toCryptoKey({name:"ECDH",namedCurve:s},t,a?[]:["deriveBits"]))}if(!n)throw new TypeError(st);return i?i[r]=n:ft.set(e,{[r]:n}),n};async function zt(e,r){if(e instanceof Uint8Array||bt(e))return e;if(Xn(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Rp(e,r)}catch(a){if(a instanceof TypeError)throw a}let i=e.export({format:"jwk"});return wi(e,i,r)}if(zr(e))return e.k?Xe(e.k):wi(e,e,r,!0);throw new Error("unreachable")}async function $t(e,r,i){if(!pe(e))throw new TypeError("JWK must be an object");let a;switch(r??=e.alg,a??=e.ext,e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Xe(e.k);case"RSA":if("oth"in e&&e.oth!==void 0)throw new F('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Zt({...e,alg:r,ext:a});case"AKP":{if(typeof e.alg!="string"||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(r!==void 0&&r!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Zt({...e,ext:a})}case"EC":case"OKP":return Zt({...e,alg:r,ext:a});default:throw new F('Unsupported "kty" (Key Type) Parameter value')}}async function Op(e){if(Xn(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:oe(e)};if(!bt(e))throw new TypeError(wt(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:r,key_ops:i,alg:a,use:t,...n}=await crypto.subtle.exportKey("jwk",e);return n.kty==="AKP"&&(n.alg=a),n}async function Rc(e){return Op(e)}async function Cp(e,r,i,a){const t=e.slice(0,7),n=await $c(t,i,r,a,new Uint8Array);return{encryptedKey:n.ciphertext,iv:oe(n.iv),tag:oe(n.tag)}}async function Pp(e,r,i,a,t){const n=e.slice(0,7);return kc(n,r,i,a,t,new Uint8Array)}const Oc='Invalid or unsupported "alg" (JWE Algorithm) header value';function kt(e){if(e===void 0)throw new E("JWE Encrypted Key missing")}async function Lp(e,r,i,a,t){switch(e){case"dir":{if(i!==void 0)throw new E("Encountered unexpected JWE Encrypted Key");return r}case"ECDH-ES":if(i!==void 0)throw new E("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!pe(a.epk))throw new E('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(Et(r),!Uc(r))throw new F("ECDH with the provided key is not allowed or not supported by your javascript runtime");const n=await $t(a.epk,e);Et(n);let o,s;if(a.apu!==void 0){if(typeof a.apu!="string")throw new E('JOSE Header "apu" (Agreement PartyUInfo) invalid');o=we(a.apu,"apu",E)}if(a.apv!==void 0){if(typeof a.apv!="string")throw new E('JOSE Header "apv" (Agreement PartyVInfo) invalid');s=we(a.apv,"apv",E)}const c=await Ac(n,r,e==="ECDH-ES"?a.enc:e,e==="ECDH-ES"?ei(a.enc):parseInt(e.slice(-5,-2),10),o,s);return e==="ECDH-ES"?c:(kt(i),ln(e.slice(-6),c,i))}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return kt(i),Et(r),Tp(e,r,i);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(kt(i),typeof a.p2c!="number")throw new E('JOSE Header "p2c" (PBES2 Count) missing or invalid');const n=t?.maxPBES2Count||1e4;if(a.p2c>n)throw new E('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');
1if(typeof a.p2s!="string")throw new E('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let o;return o=we(a.p2s,"p2s",E),Ap(e,r,i,a.p2c,o)}case"A128KW":case"A192KW":case"A256KW":return kt(i),ln(e,r,i);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(kt(i),typeof a.iv!="string")throw new E('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof a.tag!="string")throw new E('JOSE Header "tag" (Authentication Tag) missing or invalid');let n;n=we(a.iv,"iv",E);let o;return o=we(a.tag,"tag",E),Pp(e,r,i,n,o)}default:throw new F(Oc)}}async function Np(e,r,i,a,t={}){let n,o,s;switch(e){case"dir":{s=i;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(Et(i),!Uc(i))throw new F("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:c,apv:d}=t;let u;t.epk?u=await zt(t.epk,e):u=(await crypto.subtle.generateKey(i.algorithm,!0,["deriveBits"])).privateKey;const{x:f,y:l,crv:m,kty:h}=await Rc(u),g=await Ac(i,u,e==="ECDH-ES"?r:e,e==="ECDH-ES"?ei(r):parseInt(e.slice(-5,-2),10),c,d);if(o={epk:{x:f,crv:m,kty:h}},h==="EC"&&(o.epk.y=l),c&&(o.apu=oe(c)),d&&(o.apv=oe(d)),e==="ECDH-ES"){s=g;break}s=a||dt(r);const p=e.slice(-6);n=await un(p,g,s);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{s=a||dt(r),Et(i),n=await xp(e,i,s);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{s=a||dt(r);const{p2c:c,p2s:d}=t;({encryptedKey:n,...o}=await _p(e,i,s,c,d));break}case"A128KW":case"A192KW":case"A256KW":{s=a||dt(r),n=await un(e,i,s);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{s=a||dt(r);const{iv:c}=t;({encryptedKey:n,...o}=await Cp(e,i,s,c));break}default:throw new F(Oc)}return{cek:s,encryptedKey:n,parameters:o}}function Kr(e,r,i,a,t){if(t.crit!==void 0&&a?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!a||a.crit===void 0)return new Set;if(!Array.isArray(a.crit)||a.crit.length===0||a.crit.some(o=>typeof o!="string"||o.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let n;i!==void 0?n=new Map([...Object.entries(i),...r.entries()]):n=r;for(const o of a.crit){if(!n.has(o))throw new F(`Extension Header Parameter "${o}" is not recognized`);if(t[o]===void 0)throw new e(`Extension Header Parameter "${o}" is missing`);if(n.get(o)&&a[o]===void 0)throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(a.crit)}function fn(e,r){if(r!==void 0&&(!Array.isArray(r)||r.some(i=>typeof i!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(r)return new Set(r)}const ut=e=>e?.[Symbol.toStringTag],mn=(e,r,i)=>{if(r.use!==void 0){let a;switch(i){case"sign":case"verify":a="sig";break;case"encrypt":case"decrypt":a="enc";break}if(r.use!==a)throw new TypeError(`Invalid key for this operation, its "use" must be "${a}" when present`)}if(r.alg!==void 0&&r.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(r.key_ops)){let a;switch(!0){case(i==="sign"||i==="verify"):case e==="dir":case e.includes("CBC-HS"):a=i;break;case e.startsWith("PBES2"):a="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?a=i==="encrypt"?"wrapKey":"unwrapKey":a=i;break;case(i==="encrypt"&&e.startsWith("RSA")):a="wrapKey";break;case i==="decrypt":a=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(a&&r.key_ops?.includes?.(a)===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${a}" when present`)}return!0},zp=(e,r,i)=>{if(!(r instanceof Uint8Array)){if(zr(r)){if(bp(r)&&mn(e,r,i))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Yn(r))throw new TypeError(mc(e,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(r.type!=="secret")throw new TypeError(`${ut(r)} instances for symmetric algorithms must be of type "secret"`)}},jp=(e,r,i)=>{if(zr(r))switch(i){case"decrypt":case"sign":if(vp(r)&&mn(e,r,i))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if(wp(r)&&mn(e,r,i))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Yn(r))throw new TypeError(mc(e,r,"CryptoKey","KeyObject","JSON Web Key"));if(r.type==="secret")throw new TypeError(`${ut(r)} instances for asymmetric algorithms must not be of type "secret"`);if(r.type==="public")switch(i){case"sign":throw new TypeError(`${ut(r)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${ut(r)} instances for asymmetric algorithm decryption must be of type "private"`)}if(r.type==="private")switch(i){case"verify":throw new TypeError(`${ut(r)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${ut(r)} instances for asymmetric algorithm encryption must be of type "public"`)}};function Hr(e,r,i){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":zp(e,r,i);break;
1default:jp(e,r,i)}}function Cc(e){if(typeof globalThis[e]>"u")throw new F(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function Kp(e){Cc("CompressionStream");const r=new CompressionStream("deflate-raw"),i=r.writable.getWriter();i.write(e),i.close();const a=[],t=r.readable.getReader();for(;;){const{value:n,done:o}=await t.read();if(o)break;a.push(n)}return $e(...a)}async function Hp(e,r){Cc("DecompressionStream");const i=new DecompressionStream("deflate-raw"),a=i.writable.getWriter();a.write(e),a.close();const t=[];let n=0;const o=i.readable.getReader();for(;;){const{value:s,done:c}=await o.read();if(c)break;if(t.push(s),n+=s.byteLength,r!==1/0&&n>r)throw new E("Decompressed plaintext exceeded the configured limit")}return $e(...t)}async function Wp(e,r,i){if(!pe(e))throw new E("Flattened JWE must be an object");if(e.protected===void 0&&e.header===void 0&&e.unprotected===void 0)throw new E("JOSE Header missing");if(e.iv!==void 0&&typeof e.iv!="string")throw new E("JWE Initialization Vector incorrect type");if(typeof e.ciphertext!="string")throw new E("JWE Ciphertext missing or incorrect type");if(e.tag!==void 0&&typeof e.tag!="string")throw new E("JWE Authentication Tag incorrect type");if(e.protected!==void 0&&typeof e.protected!="string")throw new E("JWE Protected Header incorrect type");if(e.encrypted_key!==void 0&&typeof e.encrypted_key!="string")throw new E("JWE Encrypted Key incorrect type");if(e.aad!==void 0&&typeof e.aad!="string")throw new E("JWE AAD incorrect type");if(e.header!==void 0&&!pe(e.header))throw new E("JWE Shared Unprotected Header incorrect type");if(e.unprotected!==void 0&&!pe(e.unprotected))throw new E("JWE Per-Recipient Unprotected Header incorrect type");let a;if(e.protected)try{const A=Xe(e.protected);a=JSON.parse(Re.decode(A))}catch{throw new E("JWE Protected Header is invalid")}if(!Nr(a,e.header,e.unprotected))throw new E("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const t={...a,...e.header,...e.unprotected};if(Kr(E,new Map,i?.crit,a,t),t.zip!==void 0&&t.zip!=="DEF")throw new F('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!a?.zip)throw new E('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');const{alg:n,enc:o}=t;if(typeof n!="string"||!n)throw new E("missing JWE Algorithm (alg) in JWE Header");if(typeof o!="string"||!o)throw new E("missing JWE Encryption Algorithm (enc) in JWE Header");const s=i&&fn("keyManagementAlgorithms",i.keyManagementAlgorithms),c=i&&fn("contentEncryptionAlgorithms",i.contentEncryptionAlgorithms);if(s&&!s.has(n)||!s&&n.startsWith("PBES2"))throw new cn('"alg" (Algorithm) Header Parameter value not allowed');if(c&&!c.has(o))throw new cn('"enc" (Encryption Algorithm) Header Parameter value not allowed');let d;e.encrypted_key!==void 0&&(d=we(e.encrypted_key,"encrypted_key",E));let u=!1;typeof r=="function"&&(r=await r(a,e),u=!0),Hr(n==="dir"?o:n,r,"decrypt");const f=await zt(r,n);let l;try{l=await Lp(n,f,d,t,i)}catch(A){if(A instanceof TypeError||A instanceof E||A instanceof F)throw A;l=dt(o)}let m,h;e.iv!==void 0&&(m=we(e.iv,"iv",E)),e.tag!==void 0&&(h=we(e.tag,"tag",E));const g=e.protected!==void 0?me(e.protected):new Uint8Array;let p;e.aad!==void 0?p=$e(g,me("."),me(e.aad)):p=g;const y=we(e.ciphertext,"ciphertext",E),v=await kc(o,l,y,m,h,p),k={plaintext:v};if(t.zip==="DEF"){const A=i?.maxDecompressedLength??25e4;if(A===0)throw new F('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(A!==1/0&&(!Number.isSafeInteger(A)||A<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");k.plaintext=await Hp(v,A)}return e.protected!==void 0&&(k.protectedHeader=a),e.aad!==void 0&&(k.additionalAuthenticatedData=we(e.aad,"aad",E)),e.unprotected!==void 0&&(k.sharedUnprotectedHeader=e.unprotected),e.header!==void 0&&(k.unprotectedHeader=e.header),u?{...k,key:f}:k}async function Vp(e,r,i){if(e instanceof Uint8Array&&(e=Re.decode(e)),typeof e!="string")throw new E("Compact JWE must be a string or Uint8Array");const{0:a,1:t,2:n,3:o,4:s,length:c}=e.split(".");
1if(c!==5)throw new E("Invalid Compact JWE");const d=await Wp({ciphertext:o,iv:n||void 0,protected:a,tag:s||void 0,encrypted_key:t||void 0},r,i),u={plaintext:d.plaintext,protectedHeader:d.protectedHeader};return typeof r=="function"?{...u,key:d.key}:u}class Jp{#e;#t;#r;#n;#s;#a;#o;#i;constructor(r){if(!(r instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this.#e=r}setKeyManagementParameters(r){return ve(this.#i,"setKeyManagementParameters"),this.#i=r,this}setProtectedHeader(r){return ve(this.#t,"setProtectedHeader"),this.#t=r,this}setSharedUnprotectedHeader(r){return ve(this.#r,"setSharedUnprotectedHeader"),this.#r=r,this}setUnprotectedHeader(r){return ve(this.#n,"setUnprotectedHeader"),this.#n=r,this}setAdditionalAuthenticatedData(r){return this.#s=r,this}setContentEncryptionKey(r){return ve(this.#a,"setContentEncryptionKey"),this.#a=r,this}setInitializationVector(r){return ve(this.#o,"setInitializationVector"),this.#o=r,this}async encrypt(r,i){if(!this.#t&&!this.#n&&!this.#r)throw new E("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!Nr(this.#t,this.#n,this.#r))throw new E("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const a={...this.#t,...this.#n,...this.#r};if(Kr(E,new Map,i?.crit,this.#t,a),a.zip!==void 0&&a.zip!=="DEF")throw new F('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(a.zip!==void 0&&!this.#t?.zip)throw new E('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');const{alg:t,enc:n}=a;if(typeof t!="string"||!t)throw new E('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof n!="string"||!n)throw new E('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let o;if(this.#a&&(t==="dir"||t==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${t}`);Hr(t==="dir"?n:t,r,"encrypt");let s;{let y;const v=await zt(r,t);({cek:s,encryptedKey:o,parameters:y}=await Np(t,n,v,this.#a,this.#i)),y&&(i&&gp in i?this.#n?this.#n={...this.#n,...y}:this.setUnprotectedHeader(y):this.#t?this.#t={...this.#t,...y}:this.setProtectedHeader(y))}let c,d,u,f;if(this.#t?(d=oe(JSON.stringify(this.#t)),u=me(d)):(d="",u=new Uint8Array),this.#s){f=oe(this.#s);const y=me(f);c=$e(u,me("."),y)}else c=u;let l=this.#e;a.zip==="DEF"&&(l=await Kp(l));const{ciphertext:m,tag:h,iv:g}=await $c(n,l,s,this.#o,c),p={ciphertext:oe(m)};return g&&(p.iv=oe(g)),h&&(p.tag=oe(h)),o&&(p.encrypted_key=oe(o)),f&&(p.aad=f),this.#t&&(p.protected=d),this.#r&&(p.unprotected=this.#r),this.#n&&(p.header=this.#n),p}}async function Bp(e,r,i){if(!pe(e))throw new re("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new re('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new re("JWS Protected Header incorrect type");if(e.payload===void 0)throw new re("JWS Payload missing");if(typeof e.signature!="string")throw new re("JWS Signature missing or incorrect type");if(e.header!==void 0&&!pe(e.header))throw new re("JWS Unprotected Header incorrect type");let a={};if(e.protected)try{const p=Xe(e.protected);a=JSON.parse(Re.decode(p))}catch{throw new re("JWS Protected Header is invalid")}if(!Nr(a,e.header))throw new re("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const t={...a,...e.header},n=Kr(re,new Map([["b64",!0]]),i?.crit,a,t);let o=!0;if(n.has("b64")&&(o=a.b64,typeof o!="boolean"))throw new re('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=t;if(typeof s!="string"||!s)throw new re('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=i&&fn("algorithms",i.algorithms);if(c&&!c.has(s))throw new cn('"alg" (Algorithm) Header Parameter value not allowed');if(o){if(typeof e.payload!="string")throw new re("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new re("JWS Payload must be a string or an Uint8Array instance");let d=!1;typeof r=="function"&&(r=await r(a,e),d=!0),Hr(s,r,"verify");const u=$e(e.protected!==void 0?me(e.protected):new Uint8Array,me("."),typeof e.payload=="string"?o?me(e.payload):tr.encode(e.payload):e.payload),f=we(e.signature,"signature",re),l=await zt(r,s);if(!await Ep(s,l,f,u))throw new dp;let h;o?h=we(e.payload,"payload",re):typeof e.payload=="string"?h=tr.encode(e.payload):h=e.payload;const g={payload:h};return e.protected!==void 0&&(g.protectedHeader=a),e.header!==void 0&&(g.unprotectedHeader=e.header),d?{...g,key:l}:g}
1async function Mp(e,r,i){if(e instanceof Uint8Array&&(e=Re.decode(e)),typeof e!="string")throw new re("Compact JWS must be a string or Uint8Array");const{0:a,1:t,2:n,length:o}=e.split(".");if(o!==3)throw new re("Invalid Compact JWS");const s=await Bp({payload:t,protected:a,signature:n},r,i),c={payload:s.payload,protectedHeader:s.protectedHeader};return typeof r=="function"?{...c,key:s.key}:c}const Ne=e=>Math.floor(e.getTime()/1e3),Pc=60,Lc=Pc*60,ti=Lc*24,qp=ti*7,Fp=ti*365.25,Zp=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function xt(e){const r=Zp.exec(e);if(!r||r[4]&&r[1])throw new TypeError("Invalid time period format");const i=parseFloat(r[2]),a=r[3].toLowerCase();let t;switch(a){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(i);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(i*Pc);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(i*Lc);break;case"day":case"days":case"d":t=Math.round(i*ti);break;case"week":case"weeks":case"w":t=Math.round(i*qp);break;default:t=Math.round(i*Fp);break}return r[1]==="-"||r[4]==="ago"?-t:t}function Be(e,r){if(!Number.isFinite(r))throw new TypeError(`Invalid ${e} input`);return r}const bi=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,Gp=(e,r)=>typeof e=="string"?r.includes(e):Array.isArray(e)?r.some(Set.prototype.has.bind(new Set(e))):!1;function Nc(e,r,i={}){let a;try{a=JSON.parse(Re.decode(r))}catch{}if(!pe(a))throw new Ie("JWT Claims Set must be a top-level JSON object");const{typ:t}=i;if(t&&(typeof e.typ!="string"||bi(e.typ)!==bi(t)))throw new ge('unexpected "typ" JWT header value',a,"typ","check_failed");const{requiredClaims:n=[],issuer:o,subject:s,audience:c,maxTokenAge:d}=i,u=[...n];d!==void 0&&u.push("iat"),c!==void 0&&u.push("aud"),s!==void 0&&u.push("sub"),o!==void 0&&u.push("iss");for(const h of new Set(u.reverse()))if(!(h in a))throw new ge(`missing required "${h}" claim`,a,h,"missing");if(o&&!(Array.isArray(o)?o:[o]).includes(a.iss))throw new ge('unexpected "iss" claim value',a,"iss","check_failed");if(s&&a.sub!==s)throw new ge('unexpected "sub" claim value',a,"sub","check_failed");if(c&&!Gp(a.aud,typeof c=="string"?[c]:c))throw new ge('unexpected "aud" claim value',a,"aud","check_failed");let f;switch(typeof i.clockTolerance){case"string":f=xt(i.clockTolerance);break;case"number":f=i.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:l}=i,m=Ne(l||new Date);if((a.iat!==void 0||d)&&typeof a.iat!="number")throw new ge('"iat" claim must be a number',a,"iat","invalid");if(a.nbf!==void 0){if(typeof a.nbf!="number")throw new ge('"nbf" claim must be a number',a,"nbf","invalid");if(a.nbf>m+f)throw new ge('"nbf" claim timestamp check failed',a,"nbf","check_failed")}if(a.exp!==void 0){if(typeof a.exp!="number")throw new ge('"exp" claim must be a number',a,"exp","invalid");if(a.exp<=m-f)throw new sn('"exp" claim timestamp check failed',a,"exp","check_failed")}if(d){const h=m-a.iat,g=typeof d=="number"?d:xt(d);if(h-f>g)throw new sn('"iat" claim timestamp check failed (too far in the past)',a,"iat","check_failed");if(h<0-f)throw new ge('"iat" claim timestamp check failed (it should be in the past)',a,"iat","check_failed")}return a}class zc{#e;constructor(r){if(!pe(r))throw new TypeError("JWT Claims Set MUST be an object");this.#e=structuredClone(r)}data(){return tr.encode(JSON.stringify(this.#e))}get iss(){return this.#e.iss}set iss(r){this.#e.iss=r}get sub(){return this.#e.sub}set sub(r){this.#e.sub=r}get aud(){return this.#e.aud}set aud(r){this.#e.aud=r}set jti(r){this.#e.jti=r}set nbf(r){typeof r=="number"?this.#e.nbf=Be("setNotBefore",r):r instanceof Date?this.#e.nbf=Be("setNotBefore",Ne(r)):this.#e.nbf=Ne(new Date)+xt(r)}set exp(r){typeof r=="number"?this.#e.exp=Be("setExpirationTime",r):r instanceof Date?this.#e.exp=Be("setExpirationTime",Ne(r)):this.#e.exp=Ne(new Date)+xt(r)}set iat(r){r===void 0?this.#e.iat=Ne(new Date):r instanceof Date?this.#e.iat=Be("setIssuedAt",Ne(r)):typeof r=="string"?this.#e.iat=Be("setIssuedAt",Ne(new Date)+xt(r)):this.#e.iat=Be("setIssuedAt",r)}}
1async function Ye(e,r,i){const a=await Mp(e,r,i);if(a.protectedHeader.crit?.includes("b64")&&a.protectedHeader.b64===!1)throw new Ie("JWTs MUST NOT use unencoded payload");const n={payload:Nc(a.protectedHeader,a.payload,i),protectedHeader:a.protectedHeader};return typeof r=="function"?{...n,key:a.key}:n}async function $i(e,r,i){const a=await Vp(e,r,i),t=Nc(a.protectedHeader,a.plaintext,i),{protectedHeader:n}=a;if(n.iss!==void 0&&n.iss!==t.iss)throw new ge('replicated "iss" claim header parameter mismatch',t,"iss","mismatch");if(n.sub!==void 0&&n.sub!==t.sub)throw new ge('replicated "sub" claim header parameter mismatch',t,"sub","mismatch");if(n.aud!==void 0&&JSON.stringify(n.aud)!==JSON.stringify(t.aud))throw new ge('replicated "aud" claim header parameter mismatch',t,"aud","mismatch");const o={payload:t,protectedHeader:n};return typeof r=="function"?{...o,key:a.key}:o}class Qp{#e;constructor(r){this.#e=new Jp(r)}setContentEncryptionKey(r){return this.#e.setContentEncryptionKey(r),this}setInitializationVector(r){return this.#e.setInitializationVector(r),this}setProtectedHeader(r){return this.#e.setProtectedHeader(r),this}setKeyManagementParameters(r){return this.#e.setKeyManagementParameters(r),this}async encrypt(r,i){const a=await this.#e.encrypt(r,i);return[a.protected,a.encrypted_key,a.iv,a.ciphertext,a.tag].join(".")}}class Xp{#e;#t;#r;constructor(r){if(!(r instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this.#e=r}setProtectedHeader(r){return ve(this.#t,"setProtectedHeader"),this.#t=r,this}setUnprotectedHeader(r){return ve(this.#r,"setUnprotectedHeader"),this.#r=r,this}async sign(r,i){if(!this.#t&&!this.#r)throw new re("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Nr(this.#t,this.#r))throw new re("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...this.#t,...this.#r},t=Kr(re,new Map([["b64",!0]]),i?.crit,this.#t,a);let n=!0;if(t.has("b64")&&(n=this.#t.b64,typeof n!="boolean"))throw new re('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=a;if(typeof o!="string"||!o)throw new re('JWS "alg" (Algorithm) Header Parameter missing or invalid');Hr(o,r,"sign");let s,c;n?(s=oe(this.#e),c=me(s)):(c=this.#e,s="");let d,u;this.#t?(d=oe(JSON.stringify(this.#t)),u=me(d)):(d="",u=new Uint8Array);const f=$e(u,me("."),c),l=await zt(r,o),m=await Up(o,l,f),h={signature:oe(m),payload:s};return this.#r&&(h.header=this.#r),this.#t&&(h.protected=d),h}}class Yp{#e;constructor(r){this.#e=new Xp(r)}setProtectedHeader(r){return this.#e.setProtectedHeader(r),this}async sign(r,i){const a=await this.#e.sign(r,i);if(a.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${a.protected}.${a.payload}.${a.signature}`}}class eh{#e;#t;constructor(r={}){this.#t=new zc(r)}setIssuer(r){return this.#t.iss=r,this}setSubject(r){return this.#t.sub=r,this}setAudience(r){return this.#t.aud=r,this}setJti(r){return this.#t.jti=r,this}setNotBefore(r){return this.#t.nbf=r,this}setExpirationTime(r){return this.#t.exp=r,this}setIssuedAt(r){return this.#t.iat=r,this}setProtectedHeader(r){return this.#e=r,this}async sign(r,i){const a=new Yp(this.#t.data());if(a.setProtectedHeader(this.#e),Array.isArray(this.#e?.crit)&&this.#e.crit.includes("b64")&&this.#e.b64===!1)throw new Ie("JWTs MUST NOT use unencoded payload");return a.sign(r,i)}}class th{#e;#t;#r;#n;#s;#a;#o;#i;constructor(r={}){this.#i=new zc(r)}setIssuer(r){return this.#i.iss=r,this}setSubject(r){return this.#i.sub=r,this}setAudience(r){return this.#i.aud=r,this}setJti(r){return this.#i.jti=r,this}setNotBefore(r){return this.#i.nbf=r,this}setExpirationTime(r){return this.#i.exp=r,this}setIssuedAt(r){return this.#i.iat=r,this}setProtectedHeader(r){return ve(this.#n,"setProtectedHeader"),this.#n=r,this}setKeyManagementParameters(r){return ve(this.#r,"setKeyManagementParameters"),this.#r=r,this}setContentEncryptionKey(r){return ve(this.#e,"setContentEncryptionKey"),this.#e=r,this}setInitializationVector(r){return ve(this.#t,"setInitializationVector"),this.#t=r,this}replicateIssuerAsHeader(){return this.#s=!0,this}replicateSubjectAsHeader(){return this.#a=!0,this}replicateAudienceAsHeader(){return this.#o=!0,this}async encrypt(r,i){const a=new Qp(this.#i.data());return this.#n&&(this.#s||this.#a||this.#o)&&(this.#n={...this.#n,iss:this.#s?this.#i.iss:void 0,sub:this.#a?this.#i.sub:void 0,aud:this.#o?this.#i.aud:void 0}),a.setProtectedHeader(this.#n),this.#t&&a.setInitializationVector(this.#t),this.#e&&a.setContentEncryptionKey(this.#e),this.#r&&a.setKeyManagementParameters(this.#r),a.encrypt
1(r,i)}}const Se=(e,r)=>{if(typeof e!="string"||!e)throw new op(`${r} missing or invalid`)};async function jc(e,r){let i;if(zr(e))i=e;else if(Yn(e))i=await Rc(e);else throw new TypeError(wt(e,"CryptoKey","KeyObject","JSON Web Key"));if(r??="sha256",r!=="sha256"&&r!=="sha384"&&r!=="sha512")throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let a;switch(i.kty){case"AKP":Se(i.alg,'"alg" (Algorithm) Parameter'),Se(i.pub,'"pub" (Public key) Parameter'),a={alg:i.alg,kty:i.kty,pub:i.pub};break;case"EC":Se(i.crv,'"crv" (Curve) Parameter'),Se(i.x,'"x" (X Coordinate) Parameter'),Se(i.y,'"y" (Y Coordinate) Parameter'),a={crv:i.crv,kty:i.kty,x:i.x,y:i.y};break;case"OKP":Se(i.crv,'"crv" (Subtype of Key Pair) Parameter'),Se(i.x,'"x" (Public Key) Parameter'),a={crv:i.crv,kty:i.kty,x:i.x};break;case"RSA":Se(i.e,'"e" (Exponent) Parameter'),Se(i.n,'"n" (Modulus) Parameter'),a={e:i.e,kty:i.kty,n:i.n};break;case"oct":Se(i.k,'"k" (Key Value) Parameter'),a={k:i.k,kty:i.kty};break;default:throw new F('"kty" (Key Type) Parameter missing or unsupported')}const t=me(JSON.stringify(a));return oe(await Sc(r,t))}function rh(e){switch(typeof e=="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new F('Unsupported "alg" value for a JSON Web Key Set')}}function nh(e){return e&&typeof e=="object"&&Array.isArray(e.keys)&&e.keys.every(ih)}function ih(e){return pe(e)}class ah{#e;#t=new WeakMap;constructor(r){if(!nh(r))throw new pc("JSON Web Key Set malformed");this.#e=structuredClone(r)}jwks(){return this.#e}async getKey(r,i){const{alg:a,kid:t}={...r,...i?.header},n=rh(a),o=this.#e.keys.filter(d=>{let u=n===d.kty;if(u&&typeof t=="string"&&(u=t===d.kid),u&&(typeof d.alg=="string"||n==="AKP")&&(u=a===d.alg),u&&typeof d.use=="string"&&(u=d.use==="sig"),u&&Array.isArray(d.key_ops)&&(u=d.key_ops.includes("verify")),u)switch(a){case"ES256":u=d.crv==="P-256";break;case"ES384":u=d.crv==="P-384";break;case"ES512":u=d.crv==="P-521";break;
1case"Ed25519":case"EdDSA":u=d.crv==="Ed25519";break}return u}),{0:s,length:c}=o;if(c===0)throw new hc;if(c!==1){const d=new sp,u=this.#t;throw d[Symbol.asyncIterator]=async function*(){for(const f of o)try{yield await ki(u,f,a)}catch{}},d}return ki(this.#t,s,a)}}async function ki(e,r,i){const a=e.get(r)||e.set(r,{}).get(r);if(a[i]===void 0){const t=await $t({...r,ext:!0},i);if(t instanceof Uint8Array||t.type!=="public")throw new pc("JSON Web Key Set members must be public keys");a[i]=t}return a[i]}function Si(e){const r=new ah(e),i=async(a,t)=>r.getKey(a,t);return Object.defineProperties(i,{jwks:{value:()=>structuredClone(r.jwks()),enumerable:!1,configurable:!1,writable:!1}}),i}function oh(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}let pn;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(pn="jose/v6.2.1");const sh=Symbol();async function ch(e,r,i,a=fetch){const t=await a(e,{method:"GET",signal:i,redirect:"manual",headers:r}).catch(n=>{throw n.name==="TimeoutError"?new cp:n});if(t.status!==200)throw new ue("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await t.json()}catch{throw new ue("Failed to parse the JSON Web Key Set HTTP response as JSON")}}const Zr=Symbol();function dh(e,r){return!(typeof e!="object"||e===null||!("uat"in e)||typeof e.uat!="number"||Date.now()-e.uat>=r||!("jwks"in e)||!pe(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,pe))}class uh{#e;#t;#r;#n;#s;#a;#o;#i;#c;#d;constructor(r,i){if(!(r instanceof URL))throw new TypeError("url must be an instance of URL");this.#e=new URL(r.href),this.#t=typeof i?.timeoutDuration=="number"?i?.timeoutDuration:5e3,this.#r=typeof i?.cooldownDuration=="number"?i?.cooldownDuration:3e4,this.#n=typeof i?.cacheMaxAge=="number"?i?.cacheMaxAge:6e5,this.#o=new Headers(i?.headers),pn&&!this.#o.has("User-Agent")&&this.#o.set("User-Agent",pn),this.#o.has("accept")||(this.#o.set("accept","application/json"),this.#o.append("accept","application/jwk-set+json")),this.#i=i?.[sh],i?.[Zr]!==void 0&&(this.#d=i?.[Zr],dh(i?.[Zr],this.#n)&&(this.#s=this.#d.uat,this.#c=Si(this.#d.jwks)))}pendingFetch(){return!!this.#a}coolingDown(){return typeof this.#s=="number"?Date.now()<this.#s+this.#r:!1}fresh(){return typeof this.#s=="number"?Date.now()<this.#s+this.#n:!1}jwks(){return this.#c?.jwks()}async getKey(r,i){(!this.#c||!this.fresh())&&await this.reload();try{return await this.#c(r,i)}catch(a){if(a instanceof hc&&this.coolingDown()===!1)return await this.reload(),this.#c(r,i);throw a}}async reload(){this.#a&&oh()&&(this.#a=void 0),this.#a||=ch(this.#e.href,this.#o,AbortSignal.timeout(this.#t),this.#i).then(r=>{this.#c=Si(r),this.#d&&(this.#d.uat=Date.now(),this.#d.jwks=r),this.#s=Date.now(),this.#a=void 0}).catch(r=>{throw this.#a=void 0,r}),await this.#a}}function lh(e,r){const i=new uh(e,r),a=async(t,n)=>i.getKey(t,n);return Object.defineProperties(a,{coolingDown:{get:()=>i.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>i.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>i.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>i.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>i.jwks(),enumerable:!0,configurable:!1,writable:!1}}),a}function jt(e){let r;if(typeof e=="string"){const i=e.split(".");(i.length===3||i.length===5)&&([r]=i)}else if(typeof e=="object"&&e)if("protected"in e)r=e.protected;else throw new TypeError("Token does not contain a Protected Header");try{if(typeof r!="string"||!r)throw new Error;const i=JSON.parse(Re.decode(Xe(r)));if(!pe(i))throw new Error;return i}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}function Oe(e){if(typeof e!="string")throw new Ie("JWTs must use Compact JWS serialization, JWT must be a string");const{1:r,length:i}=e.split(".");if(i===5)throw new Ie("Only JWTs using Compact JWS serialization can be decoded");if(i!==3)throw new Ie("Invalid JWT");if(!r)throw new Ie("JWTs must contain a payload");let a;try{a=Xe(r)}catch{throw new Ie("Failed to base64url decode the payload")}let t;try{t=JSON.parse(Re.decode(a))}catch{throw new Ie("Failed to parse the decoded payload as JSON")}if(!pe(t))throw new Ie("Invalid JWT Claims Set");return t}async function Kc(e,r,i=3600){return await new eh(e).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+i).sign(new TextEncoder().encode(r))}async function fh(e,r){try{return(await Ye(e,new TextEncoder().encode(r))).payload}catch{return null}}
1const mh=new Uint8Array([66,101,116,116,101,114,65,117,116,104,46,106,115,32,71,101,110,101,114,97,116,101,100,32,69,110,99,114,121,112,116,105,111,110,32,75,101,121]),ph=()=>Date.now()/1e3|0,Hc="dir",Wc="A256CBC-HS512";function Ut(e,r){return qm(ep,new TextEncoder().encode(e),new TextEncoder().encode(r),mh,64)}function hh(e){if(typeof e=="string")return e;const r=e.keys.get(e.currentVersion);if(!r)throw new Error(`Secret version ${e.currentVersion} not found in keys`);return r}function Ii(e){if(typeof e=="string")return[{version:0,value:e}];const r=[];for(const[i,a]of e.keys)r.push({version:i,value:a});return e.legacySecret&&!r.some(i=>i.value===e.legacySecret)&&r.push({version:-1,value:e.legacySecret}),r}async function Vc(e,r,i,a=3600){const t=Ut(hh(r),i),n=await jc({kty:"oct",k:oe(t)},"sha256");return await new th(e).setProtectedHeader({alg:Hc,enc:Wc,kid:n}).setIssuedAt().setExpirationTime(ph()+a).setJti(crypto.randomUUID()).encrypt(t)}const _i={clockTolerance:15,keyManagementAlgorithms:[Hc],contentEncryptionAlgorithms:[Wc,"A256GCM"]};async function Jc(e,r,i){if(!e)return null;let a=!1;try{a=jt(e).kid!==void 0}catch{return null}try{const t=Ii(r),{payload:n}=await $i(e,async o=>{const s=o.kid;if(s!==void 0){for(const c of t){const d=Ut(c.value,i);if(s===await jc({kty:"oct",k:oe(d)},"sha256"))return d}throw new Error("no matching decryption secret")}return t.length===1,Ut(t[0].value,i)},_i);return n}catch{if(a)return null;const t=Ii(r);if(t.length<=1)return null;for(let n=1;n<t.length;n++)try{const o=t[n],{payload:s}=await $i(e,Ut(o.value,i),_i);return s}catch{continue}return null}}const gh="0123456789abcdef",Ai={encode:e=>{if(typeof e=="string"&&(e=new TextEncoder().encode(e)),e.byteLength===0)return"";const r=new Uint8Array(e);let i="";for(const a of r)i+=a.toString(16).padStart(2,"0");return i},decode:e=>{if(!e)return"";if(typeof e=="string"){if(e.length%2!==0)throw new Error("Invalid hexadecimal string");if(!new RegExp(`^[${gh}]+$`).test(e))throw new Error("Invalid hexadecimal string");const r=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)r[i/2]=parseInt(e.slice(i,i+2),16);return new TextDecoder().decode(r)}return new TextDecoder().decode(e)}};function ir(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}function Bc(e,r,i){let a="",t=0,n=0;for(const o of e)for(t=t<<8|o,n+=8;n>=6;)n-=6,a+=r[t>>n&63];if(n>0&&(a+=r[t<<6-n&63]),i){const o=(4-a.length%4)%4;a+="=".repeat(o)}return a}function Mc(e,r){const i=new Map;for(let o=0;o<r.length;o++)i.set(r[o],o);const a=[];let t=0,n=0;for(const o of e){if(o==="=")break;const s=i.get(o);if(s===void 0)throw new Error(`Invalid Base64 character: ${o}`);t=t<<6|s,n+=6,n>=8&&(n-=8,a.push(t>>n&255))}return Uint8Array.from(a)}const We={encode(e,r={}){const i=ir(!1),a=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return Bc(a,i,r.padding??!0)},decode(e){typeof e!="string"&&(e=new TextDecoder().decode(e));const r=e.includes("-")||e.includes("_"),i=ir(r);return Mc(e,i)}},Kt={encode(e,r={}){const i=ir(!0),a=typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e);return Bc(a,i,r.padding??!0)},decode(e){const r=e.includes("-")||e.includes("_"),i=ir(r);return Mc(e,i)}};function Fe(){const e=typeof globalThis<"u"&&globalThis.crypto;if(e&&typeof e.subtle=="object"&&e.subtle!=null)return e.subtle;throw new Error("crypto.subtle must be defined")}function ri(e,r){return{digest:async i=>{const a=new TextEncoder,t=typeof i=="string"?a.encode(i):i;return await Fe().digest(e,t)}}}function yh(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function hn(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function Gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ae(e,r,i=""){const a=yh(e),t=e?.length,n=r!==void 0;if(!a||n&&t!==r){const o=i&&`"${i}" `,s=n?` of length ${r}`:"",c=a?`length=${t}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+s+", got "+c)}return e}function Ui(e,r=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function vh(e,r){ae(e,void 0,"output");const i=r.outputLen;if(e.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}function je(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function gt(...e){for(let r=0;r<e.length;r++)e[r].fill(0)}function wh(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const bh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,qc=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",$h=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function kh(e){if(ae(e),qc)return e.toHex();let r="";for(let i=0;i<e.length;i++)r+=$h[e[i]];return r}const xe={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ei(e){if(e>=xe._0&&e<=xe._9)return e-xe._0;if(e>=xe.A&&e<=xe.F)return e-(xe.A-10);if(e>=xe.a&&e<=xe.f)return e-(xe.a-10)}function Sh(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(qc)return Uint8Array.fromHex(e);const r=e.length,i=r/2;if(r%2)throw new Error("hex string expected, got unpadded hex of length "+r);const a=new Uint8Array(i);for(let t=0,n=0;t<i;t++,n+=2){const o=Ei(e.charCodeAt(n)),s=Ei(e.charCodeAt(n+1));if(o===void 0||s===void 0){const c=e[n]+e[n+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+n)}a[t]=o*16+s}return a}function Ih(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function _h(...e){let r=0;for(let a=0;a<e.length;a++){const t=e[a];ae(t),r+=t.length}const i=new Uint8Array(r);for(let a=0,t=0;a<e.length;a++){const n=e[a];i.set(n,t),t+=n.length}return i}function Ah(e,r){if(r==null||typeof r!="object")throw new Error("options must be defined");return Object.assign(e,r)}function Uh(e,r){if(e.length!==r.length)return!1;let i=0;for(let a=0;a<e.length;a++)i|=e[a]^r[a];return i===0}const Eh=(e,r)=>{function i(a,...t){if(ae(a,void 0,"key"),!bh)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const u=t[0];ae(u,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const n=e.tagLength;n&&t[1]!==void 0&&ae(t[1],void 0,"AAD");const o=r(a,...t),s=(u,f)=>{if(f!==void 0){if(u!==2)throw new Error("cipher output not supported");ae(f,void 0,"output")}};let c=!1;
1return{encrypt(u,f){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,ae(u),s(o.encrypt.length,f),o.encrypt(u,f)},decrypt(u,f){if(ae(u),n&&u.length<n)throw new Error('"ciphertext" expected length bigger than tagLength='+n);return s(o.decrypt.length,f),o.decrypt(u,f)}}}return Object.assign(i,e),i};function xi(e,r,i=!0){if(r===void 0)return new Uint8Array(e);if(r.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+r.length);if(i&&!Th(r))throw new Error("invalid output, must be aligned");return r}function xh(e,r,i){hn(i);const a=new Uint8Array(16),t=wh(a);return t.setBigUint64(0,BigInt(r),i),t.setBigUint64(8,BigInt(e),i),a}function Th(e){return e.byteOffset%4===0}function ar(e){return Uint8Array.from(e)}function Dh(e=32){const r=typeof globalThis=="object"?globalThis.crypto:null;if(typeof r?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return r.getRandomValues(new Uint8Array(e))}function Fc(e,r=Dh){const{nonceLength:i}=e;Gt(i);const a=(t,n)=>{const o=_h(t,n);return n.fill(0),o};return((t,...n)=>({encrypt(o){ae(o);const s=r(i),c=e(t,s,...n).encrypt(o);return c instanceof Promise?c.then(d=>a(s,d)):a(s,c)},decrypt(o){ae(o);const s=o.subarray(0,i),c=o.subarray(i);return e(t,s,...n).decrypt(c)}}))}const Zc=e=>Uint8Array.from(e.split(""),r=>r.charCodeAt(0)),Rh=Zc("expand 16-byte k"),Oh=Zc("expand 32-byte k"),Ch=je(Rh),Ph=je(Oh);function I(e,r){return e<<r|e>>>32-r}function gn(e){return e.byteOffset%4===0}const Bt=64,Lh=16,Gc=2**32-1,Ti=Uint32Array.of();function Nh(e,r,i,a,t,n,o,s){const c=t.length,d=new Uint8Array(Bt),u=je(d),f=gn(t)&&gn(n),l=f?je(t):Ti,m=f?je(n):Ti;for(let h=0;h<c;o++){if(e(r,i,a,u,o,s),o>=Gc)throw new Error("arx: counter overflow");const g=Math.min(Bt,c-h);if(f&&g===Bt){const p=h/4;if(h%4!==0)throw new Error("arx: invalid block position");for(let y=0,v;y<Lh;y++)v=p+y,m[v]=l[v]^u[y];h+=Bt;continue}for(let p=0,y;p<g;p++)y=h+p,n[y]=t[y]^d[p];h+=g}}function zh(e,r){const{allowShortKeys:i,extendNonceFn:a,counterLength:t,counterRight:n,rounds:o}=Ah({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},r);if(typeof e!="function")throw new Error("core must be a function");return Gt(t),Gt(o),hn(n),hn(i),(s,c,d,u,f=0)=>{ae(s,void 0,"key"),ae(c,void 0,"nonce"),ae(d,void 0,"data");const l=d.length;if(u===void 0&&(u=new Uint8Array(l)),ae(u,void 0,"output"),Gt(f),f<0||f>=Gc)throw new Error("arx: counter overflow");if(u.length<l)throw new Error(`arx: output (${u.length}) is shorter than data (${l})`);const m=[];let h=s.length,g,p;if(h===32)m.push(g=ar(s)),p=Ph;else if(h===16&&i)g=new Uint8Array(32),g.set(s),g.set(s,16),p=Ch,m.push(g);else throw ae(s,32,"arx key"),new Error("invalid key size");gn(c)||m.push(c=ar(c));const y=je(g);if(a){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");a(p,y,je(c.subarray(0,16)),y),c=c.subarray(16)}const v=16-t;if(v!==c.length)throw new Error(`arx: nonce must be ${v} or 16 bytes`);if(v!==12){const A=new Uint8Array(12);A.set(c,n?0:12-c.length),c=A,m.push(c)}const k=je(c);return Nh(e,p,y,k,d,u,f,o),gt(...m),u}}function se(e,r){return e[r++]&255|(e[r++]&255)<<8}class jh{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;constructor(r){r=ar(ae(r,32,"key"));const i=se(r,0),a=se(r,2),t=se(r,4),n=se(r,6),o=se(r,8),s=se(r,10),c=se(r,12),d=se(r,14);this.r[0]=i&8191,this.r[1]=(i>>>13|a<<3)&8191,this.r[2]=(a>>>10|t<<6)&7939,this.r[3]=(t>>>7|n<<9)&8191,this.r[4]=(n>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|s<<2)&8191,this.r[7]=(s>>>11|c<<5)&8065,this.r[8]=(c>>>8|d<<8)&8191,this.r[9]=d>>>5&127;for(let u=0;u<8;u++)this.pad[u]=se(r,16+2*u)}process(r,i,a=!1){const t=a?0:2048,{h:n,r:o}=this,s=o[0],c=o[1],d=o[2],u=o[3],f=o[4],l=o[5],m=o[6],h=o[7],g=o[8],p=o[9],y=se(r,i+0),v=se(r,i+2),k=se(r,i+4),A=se(r,i+6),C=se(r,i+8),L=se(r,i+10),q=se(r,i+12),J=se(r,i+14);let x=n[0]+(y&8191),O=n[1]+((y>>>13|v<<3)&8191),D=n[2]+((v>>>10|k<<6)&8191),N=n[3]+((k>>>7|A<<9)&8191),z=n[4]+((A>>>4|C<<12)&8191),j=n[5]+(C>>>1&8191),H=n[6]+((C>>>14|L<<2)&8191),G=n[7]+((L>>>11|q<<5)&8191),Q=n[8]+((q>>>8|J<<8)&8191),X=n[9]+(J>>>5|t),U=0,te=U+x*s+O*(5*p)+D*(5*g)+N*(5*h)+z*(5*m);U=te>>>13,te&=8191,te+=j*(5*l)+H*(5*f)+G*(5*u)+Q*(5*d)+X*(5*c),U+=te>>>13,te&=8191;let ne=U+x*c+O*s+D*(5*p)+N*(5*g)+z*(5*h);U=ne>>>13,ne&=8191,ne+=j*(5*m)+H*(5*l)+G*(5*f)+Q*(5*u)+X*(5*d),U+=ne>>>13,ne&=8191;
vendor: 5,292 bytes, line 1
1let ee=U+x*d+O*c+D*s+N*(5*p)+z*(5*g);U=ee>>>13,ee&=8191,ee+=j*(5*h)+H*(5*m)+G*(5*l)+Q*(5*f)+X*(5*u),U+=ee>>>13,ee&=8191;let Ee=U+x*u+O*d+D*c+N*s+z*(5*p);U=Ee>>>13,Ee&=8191,Ee+=j*(5*g)+H*(5*h)+G*(5*m)+Q*(5*l)+X*(5*f),U+=Ee>>>13,Ee&=8191;let tt=U+x*f+O*u+D*d+N*c+z*s;U=tt>>>13,tt&=8191,tt+=j*(5*p)+H*(5*g)+G*(5*h)+Q*(5*m)+X*(5*l),U+=tt>>>13,tt&=8191;let rt=U+x*l+O*f+D*u+N*d+z*c;U=rt>>>13,rt&=8191,rt+=j*s+H*(5*p)+G*(5*g)+Q*(5*h)+X*(5*m),U+=rt>>>13,rt&=8191;let nt=U+x*m+O*l+D*f+N*u+z*d;U=nt>>>13,nt&=8191,nt+=j*c+H*s+G*(5*p)+Q*(5*g)+X*(5*h),U+=nt>>>13,nt&=8191;let it=U+x*h+O*m+D*l+N*f+z*u;U=it>>>13,it&=8191,it+=j*d+H*c+G*s+Q*(5*p)+X*(5*g),U+=it>>>13,it&=8191;let at=U+x*g+O*h+D*m+N*l+z*f;U=at>>>13,at&=8191,at+=j*u+H*d+G*c+Q*s+X*(5*p),U+=at>>>13,at&=8191;let ot=U+x*p+O*g+D*h+N*m+z*l;U=ot>>>13,ot&=8191,ot+=j*f+H*u+G*d+Q*c+X*s,U+=ot>>>13,ot&=8191,U=(U<<2)+U|0,U=U+te|0,te=U&8191,U=U>>>13,ne+=U,n[0]=te,n[1]=ne,n[2]=ee,n[3]=Ee,n[4]=tt,n[5]=rt,n[6]=nt,n[7]=it,n[8]=at,n[9]=ot}finalize(){const{h:r,pad:i}=this,a=new Uint16Array(10);let t=r[1]>>>13;r[1]&=8191;for(let s=2;s<10;s++)r[s]+=t,t=r[s]>>>13,r[s]&=8191;r[0]+=t*5,t=r[0]>>>13,r[0]&=8191,r[1]+=t,t=r[1]>>>13,r[1]&=8191,r[2]+=t,a[0]=r[0]+5,t=a[0]>>>13,a[0]&=8191;for(let s=1;s<10;s++)a[s]=r[s]+t,t=a[s]>>>13,a[s]&=8191;a[9]-=8192;let n=(t^1)-1;for(let s=0;s<10;s++)a[s]&=n;n=~n;for(let s=0;s<10;s++)r[s]=r[s]&n|a[s];r[0]=(r[0]|r[1]<<13)&65535,r[1]=(r[1]>>>3|r[2]<<10)&65535,r[2]=(r[2]>>>6|r[3]<<7)&65535,r[3]=(r[3]>>>9|r[4]<<4)&65535,r[4]=(r[4]>>>12|r[5]<<1|r[6]<<14)&65535,r[5]=(r[6]>>>2|r[7]<<11)&65535,r[6]=(r[7]>>>5|r[8]<<8)&65535,r[7]=(r[8]>>>8|r[9]<<5)&65535;let o=r[0]+i[0];r[0]=o&65535;for(let s=1;s<8;s++)o=(r[s]+i[s]|0)+(o>>>16)|0,r[s]=o&65535;gt(a)}update(r){Ui(this),ae(r),r=ar(r);const{buffer:i,blockLen:a}=this,t=r.length;for(let n=0;n<t;){const o=Math.min(a-this.pos,t-n);if(o===a){for(;a<=t-n;n+=a)this.process(r,n);continue}i.set(r.subarray(n,n+o),this.pos),this.pos+=o,n+=o,this.pos===a&&(this.process(i,0,!1),this.pos=0)}return this}destroy(){gt(this.h,this.r,this.buffer,this.pad)}digestInto(r){Ui(this),vh(r,this),this.finished=!0;const{buffer:i,h:a}=this;let{pos:t}=this;if(t){for(i[t++]=1;t<16;t++)i[t]=0;this.process(i,0,!0)}this.finalize();let n=0;for(let o=0;o<8;o++)r[n++]=a[o]>>>0,r[n++]=a[o]>>>8;return r}digest(){const{buffer:r,outputLen:i}=this;this.digestInto(r);const a=r.slice(0,i);return this.destroy(),a}}function Kh(e){const r=(a,t)=>e(t).update(a).digest(),i=e(new Uint8Array(32));return r.outputLen=i.outputLen,r.blockLen=i.blockLen,r.create=a=>e(a),r}const Hh=Kh(e=>new jh(e));function Wh(e,r,i,a,t,n=20){let o=e[0],s=e[1],c=e[2],d=e[3],u=r[0],f=r[1],l=r[2],m=r[3],h=r[4],g=r[5],p=r[6],y=r[7],v=t,k=i[0],A=i[1],C=i[2],L=o,q=s,J=c,x=d,O=u,D=f,N=l,z=m,j=h,H=g,G=p,Q=y,X=v,U=k,te=A,ne=C;for(let Ee=0;Ee<n;Ee+=2)L=L+O|0,X=I(X^L,16),j=j+X|0,O=I(O^j,12),L=L+O|0,X=I(X^L,8),j=j+X|0,O=I(O^j,7),q=q+D|0,U=I(U^q,16),H=H+U|0,D=I(D^H,12),q=q+D|0,U=I(U^q,8),H=H+U|0,D=I(D^H,7),J=J+N|0,te=I(te^J,16),G=G+te|0,N=I(N^G,12),J=J+N|0,te=I(te^J,8),G=G+te|0,N=I(N^G,7),x=x+z|0,ne=I(ne^x,16),Q=Q+ne|0,z=I(z^Q,12),x=x+z|0,ne=I(ne^x,8),Q=Q+ne|0,z=I(z^Q,7),L=L+D|0,ne=I(ne^L,16),G=G+ne|0,D=I(D^G,12),L=L+D|0,ne=I(ne^L,8),G=G+ne|0,D=I(D^G,7),q=q+N|0,X=I(X^q,16),Q=Q+X|0,N=I(N^Q,12),q=q+N|0,X=I(X^q,8),Q=Q+X|0,N=I(N^Q,7),J=J+z|0,U=I(U^J,16),j=j+U|0,z=I(z^j,12),J=J+z|0,U=I(U^J,8),j=j+U|0,z=I(z^j,7),x=x+O|0,te=I(te^x,16),H=H+te|0,O=I(O^H,12),x=x+O|0,te=I(te^x,8),H=H+te|0,O=I(O^H,7);let ee=0;a[ee++]=o+L|0,a[ee++]=s+q|0,a[ee++]=c+J|0,a[ee++]=d+x|0,a[ee++]=u+O|0,a[ee++]=f+D|0,a[ee++]=l+N|0,a[ee++]=m+z|0,a[ee++]=h+j|0,a[ee++]=g+H|0,a[ee++]=p+G|0,a[ee++]=y+Q|0,a[ee++]=v+X|0,a[ee++]=k+U|0,a[ee++]=A+te|0,a[ee++]=C+ne|0}function Vh(e,r,i,a){let t=e[0],n=e[1],o=e[2],s=e[3],c=r[0],d=r[1],u=r[2],f=r[3],l=r[4],m=r[5],h=r[6],g=r[7],p=i[0],y=i[1],v=i[2],k=i[3];for(let C=0;C<20;C+=2)t=t+c|0,p=I(p^t,16),l=l+p|0,c=I(c^l,12),t=t+c|0,p=I(p^t,8),l=l+p|0,c=I(c^l,7),n=n+d|0,y=I(y^n,16),m=m+y|0,d=I(d^m,12),n=n+d|0,y=I(y^n,8),m=m+y|0,d=I(d^m,7),o=o+u|0,v=I(v^o,16),h=h+v|0,u=I(u^h,12),o=o+u|0,v=I(v^o,8),h=h+v|0,u=I(u^h,7),s=s+f|0,k=I(k^s,16),g=g+k|0,f=I(f^g,12),s=s+f|0,k=I(k^s,8),g=g+k|0,f=I(f^g,7),t=t+d|0,k=I(k^t,16),h=h+k|0,d=I(d^h,12),t=t+d|0,k=I(k^t,8),h=h+k|0,d=I(d^h,7),n=n+u|0,p=I(p^n,16),g=g+p|0,u=I(u^g,12),n=n+u|0,p=I(p^n,8),g=g+p|0,u=I(u^g,7),o=o+f|0,y=I(y^o,16),l=l+y|0,f=I(f^l,12),o=o+f|0,y=I(y^o,8),l=l+y|0,f=I(f^l,7),s=s+c|0,v=I(v^s,16),m=m+v|0,c=I(c^m,12),s=s+c|0,v=I(v^s,8),m=m+v|0,c=I(c^m,7);let A=0;a[A++]=t,a[A++]=n,a[A++]=o,a[A++]=s,a[A++]=p,a[A++]=y,a[A++]=v,a[A++]=k}const Jh=zh(Wh,{counterRight:!1,counterLength:8,extendNonceFn:Vh,allowShortKeys:!1}),Bh=new Uint8Array(16),Di=(e,r)=>{e.update(r);const i=r.length%16;i&&e.update(Bh.subarray(i))},Mh=new Uint8Array(32);function Ri(e,r,i,a,t){t!==void 0&&ae(t,void 0,"AAD");const n=e(r,i,Mh),o=xh(a.length,t?t.length:0,!0),s=Hh.create(n);t&&Di(s,t),Di(s,a),s.update(o);const c=s.digest();return gt(n,o),c}const qh=e=>(r,i,a)=>({encrypt(n,o){const s=n.length;o=xi(s+16,o,!1),o.set(n);const c=o.subarray(0,-16);e(r,i,c,c,1);const d=Ri(e,r,i,c,a);return o.set(d,s),gt(d),o},decrypt(n,o){o=xi(n.length-16,o,!1);const s=n.subarray(0,-16),c=n.subarray(-16),d=Ri(e,r,i,s,a);if(!Uh(c,d))throw new Error("invalid tag");return o.set(n.subarray(0,-16)),e(r,i,o,o,1),gt(d),o}}
1),Qc=Eh({blockSize:64,nonceLength:24,tagLength:16},qh(Jh)),Xc="$ba$";function Fh(e){if(!e.startsWith(Xc))return null;const r=4,i=e.indexOf("$",r);if(i===-1)return null;const a=parseInt(e.slice(r,i),10);return!Number.isInteger(a)||a<0?null:{version:a,ciphertext:e.slice(i+1)}}function Zh(e,r){return`${Xc}${e}$${r}`}async function Oi(e,r){const i=await ri("SHA-256").digest(e),a=Ih(r);return kh(Fc(Qc)(new Uint8Array(i)).encrypt(a))}async function Gr(e,r){const i=await ri("SHA-256").digest(e),a=Sh(r),t=Fc(Qc)(new Uint8Array(i));return new TextDecoder().decode(t.decrypt(a))}const Yc=async({key:e,data:r})=>{if(typeof e=="string")return Oi(e,r);const i=e.keys.get(e.currentVersion);if(!i)throw new Error(`Secret version ${e.currentVersion} not found in keys`);const a=await Oi(i,r);return Zh(e.currentVersion,a)},ed=async({key:e,data:r})=>{if(typeof e=="string")return Gr(e,r);const i=Fh(r);if(i){const a=e.keys.get(i.version);if(!a)throw new Error(`Secret version ${i.version} not found in keys (key may have been retired)`);return Gr(a,i.ciphertext)}if(e.legacySecret)return Gr(e.legacySecret,r);throw new Error("Cannot decrypt legacy bare-hex payload: no legacy secret available. Set BETTER_AUTH_SECRET for backwards compatibility.")},yt=(e,r="ms")=>new Date(Date.now()+(r==="sec"?e*1e3:e)),ni=e=>{const r=(e.plugins??[]).reduce((f,l)=>{const m=l.schema;if(!m)return f;for(const[h,g]of Object.entries(m))f[h]={fields:{...f[h]?.fields,...g.fields},modelName:g.modelName||h};return f},{}),i=e.rateLimit?.storage==="database",a={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",unique:!0,required:!0,fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",required:!0,fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",bigint:!0,required:!0,fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest",defaultValue:()=>Date.now()}}}},{user:t,session:n,account:o,verification:s,...c}=r,d={verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier",index:!0},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!0,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,defaultValue:()=>new Date,onUpdate:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"},...s?.fields,...e.verification?.additionalFields},order:4}},u={session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,index:!0},...n?.fields,...e.session?.additionalFields},order:2}};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name",sortable:!0},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email",sortable:!0},emailVerified:{type:"boolean",defaultValue:!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified",input:!1},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,onUpdate:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...t?.fields,...e.user?.additionalFields},order:1},...!e.secondaryStorage||e.session?.storeSessionInDatabase?u:{},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"
1cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId",index:!0},accessToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.refreshTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},...o?.fields,...e.account?.additionalFields},order:3},...!e.secondaryStorage||e.verification?.storeInDatabase?d:{},...c,...i?a:{}}},Gh=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function r(t){return e[t]??null}const i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${t.expected}، ولكن تم إدخال ${s}`:`مدخلات غير مقبولة: يفترض إدخال ${n}، ولكن تم إدخال ${s}`}case"invalid_value":return t.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${T(t.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?` أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${n} ${t.maximum.toString()} ${o.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${n} ${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${n} ${t.minimum.toString()} ${o.unit}`:`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${n} ${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${t.prefix}"`:n.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${n.suffix}"`:n.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${n.includes}"`:n.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${n.pattern}`:`${i[n.format]??t.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${t.divisor}`;case"unrecognized_keys":return`معرف${t.keys.length>1?"ات":""} غريب${t.keys.length>1?"ة":""}: ${w(t.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${t.origin}`;
vendor: 34,515 bytes, line 1
1case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${t.origin}`;default:return"مدخل غير مقبول"}}};function Qh(){return{localeError:Gh()}}const Xh=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function r(t){return e[t]??null}const i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Yanlış dəyər: gözlənilən instanceof ${t.expected}, daxil olan ${s}`:`Yanlış dəyər: gözlənilən ${n}, daxil olan ${s}`}case"invalid_value":return t.values.length===1?`Yanlış dəyər: gözlənilən ${T(t.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${n}${t.maximum.toString()} ${o.unit??"element"}`:`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Çox kiçik: gözlənilən ${t.origin} ${n}${t.minimum.toString()} ${o.unit}`:`Çox kiçik: gözlənilən ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Yanlış mətn: "${n.prefix}" ilə başlamalıdır`:n.format==="ends_with"?`Yanlış mətn: "${n.suffix}" ilə bitməlidir`:n.format==="includes"?`Yanlış mətn: "${n.includes}" daxil olmalıdır`:n.format==="regex"?`Yanlış mətn: ${n.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[n.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Yh(){return{localeError:Xh()}}function Ci(e,r,i,a){const t=Math.abs(e),n=t%10,o=t%100;return o>=11&&o<=19?a:n===1?r:n>=2&&n<=4?i:a}const eg=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function r(t){return e[t]??null}const i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},a={nan:"NaN",number:"лік",array:"масіў"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Няправільны ўвод: чакаўся instanceof ${t.expected}, атрымана ${s}`:`Няправільны ўвод: чакаўся ${n}, атрымана ${s}`}case"invalid_value":return t.values.length===1?`Няправільны ўвод: чакалася ${T(t.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);if(o){const s=Number(t.maximum),c=Ci(s,o.unit.one,o.unit.few,o.unit.many);return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна ${o.verb} ${n}${t.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна быць ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);if(o){const s=Number(t.minimum),c=Ci(s,o.unit.one,o.unit.few,o.unit.many);return`Занадта малы: чакалася, што ${t.origin} павінна ${o.verb} ${n}${t.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${t.origin} павінна быць ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${n.prefix}"`:n.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${n.suffix}"`:n.format==="includes"?`Няправільны радок: павінен змяшчаць "${n.includes}"`:n.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${n.pattern}`:`Няправільны ${i[n.format]??t.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${t.keys.length>1?"ключы":"ключ"}: ${w(t.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${t.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${t.origin}`;default:return"Няправільны ўвод"}}};function tg(){return{localeError:eg()}}const rg=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function r(t){return e[t]??null}const i={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},a={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Невалиден вход: очакван instanceof ${t.expected}, получен ${s}`:`Невалиден вход: очакван ${n}, получен ${s}`}case"invalid_value":return t.values.length===1?`Невалиден вход: очакван ${T(t.values[0])}`:`Невалидна опция: очаквано едно от ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Твърде голямо: очаква се ${t.origin??"стойност"} да съдържа ${n}${t.maximum.toString()} ${o.unit??"елемента"}`:`Твърде голямо: очаква се ${t.origin??"стойност"} да бъде ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Твърде малко: очаква се ${t.origin} да съдържа ${n}${t.minimum.toString()} ${o.unit}`:`Твърде малко: очаква се ${t.origin} да бъде ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;if(n.format==="starts_with")return`Невалиден низ: трябва да започва с "${n.prefix}"`;if(n.format==="ends_with")return`Невалиден низ: трябва да завършва с "${n.suffix}"`;if(n.format==="includes")return`Невалиден низ: трябва да включва "${n.includes}"`;if(n.format==="regex")return`Невалиден низ: трябва да съвпада с ${n.pattern}`;let o="Невалиден";return n.format==="emoji"&&(o="Невалидно"),n.format==="datetime"&&(o="Невалидно"),n.format==="date"&&(o="Невалидна"),n.format==="time"&&(o="Невалидно"),n.format==="duration"&&(o="Невалидна"),`${o} ${i[n.format]??t.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${t.divisor}`;case"unrecognized_keys":return`Неразпознат${t.keys.length>1?"и":""} ключ${t.keys.length>1?"ове":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${t.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${t.origin}`;default:return"Невалиден вход"}}};function ng(){return{localeError:rg()}}const ig=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function r(t){return e[t]??null}const i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Tipus invàlid: s'esperava instanceof ${t.expected}, s'ha rebut ${s}`:`Tipus invàlid: s'esperava ${n}, s'ha rebut ${s}`}case"invalid_value":return t.values.length===1?`Valor invàlid: s'esperava ${T(t.values[0])}`:`Opció invàlida: s'esperava una de ${w(t.values," o ")}`;case"too_big":{const n=t.inclusive?"com a màxim":"menys de",o=r(t.origin);return o?`Massa gran: s'esperava que ${t.origin??"el valor"} contingués ${n} ${t.maximum.toString()} ${o.unit??"elements"}`:`Massa gran: s'esperava que ${t.origin??"el valor"} fos ${n} ${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?"com a mínim":"més de",o=r(t.origin);return o?`Massa petit: s'esperava que ${t.origin} contingués ${n} ${t.minimum.toString()} ${o.unit}`:`Massa petit: s'esperava que ${t.origin} fos ${n} ${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Format invàlid: ha de començar amb "${n.prefix}"`:n.format==="ends_with"?`Format invàlid: ha d'acabar amb "${n.suffix}"`:n.format==="includes"?`Format invàlid: ha d'incloure "${n.includes}"`:n.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${n.pattern}`:`Format invàlid per a ${i[n.format]??t.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${t.divisor}`;case"unrecognized_keys":return`Clau${t.keys.length>1?"s":""} no reconeguda${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${t.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${t.origin}`;default:return"Entrada invàlida"}}};function ag(){return{localeError:ig()}}const og=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function r(t){return e[t]??null}const i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},a={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Neplatný vstup: očekáváno instanceof ${t.expected}, obdrženo ${s}`:`Neplatný vstup: očekáváno ${n}, obdrženo ${s}`}case"invalid_value":return t.values.length===1?`Neplatný vstup: očekáváno ${T(t.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Hodnota je příliš velká: ${t.origin??"hodnota"} musí mít ${n}${t.maximum.toString()} ${o.unit??"prvků"}`:`Hodnota je příliš velká: ${t.origin??"hodnota"} musí být ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Hodnota je příliš malá: ${t.origin??"hodnota"} musí mít ${n}${t.minimum.toString()} ${o.unit??"prvků"}`:`Hodnota je příliš malá: ${t.origin??"hodnota"} musí být ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Neplatný řetězec: musí začínat na "${n.prefix}"`:n.format==="ends_with"?`Neplatný řetězec: musí končit na "${n.suffix}"`:n.format==="includes"?`Neplatný řetězec: musí obsahovat "${n.includes}"`:n.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${n.pattern}`:`Neplatný formát ${i[n.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${t.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${w(t.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function sg(){return{localeError:og()}}const cg=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function r(t){return e[t]??null}const i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},a={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ugyldigt input: forventede instanceof ${t.expected}, fik ${s}`:`Ugyldigt input: forventede ${n}, fik ${s}`}case"invalid_value":return t.values.length===1?`Ugyldig værdi: forventede ${T(t.values[0])}`:`Ugyldigt valg: forventede en af følgende ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin),s=a[t.origin]??t.origin;return o?`For stor: forventede ${s??"value"} ${o.verb} ${n} ${t.maximum.toString()} ${o.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${n} ${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin),s=a[t.origin]??t.origin;return o?`For lille: forventede ${s} ${o.verb} ${n} ${t.minimum.toString()} ${o.unit}`:`For lille: forventede ${s} havde ${n} ${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ugyldig streng: skal starte med "${n.prefix}"`:n.format==="ends_with"?`Ugyldig streng: skal ende med "${n.suffix}"`:n.format==="includes"?`Ugyldig streng: skal indeholde "${n.includes}"`:n.format==="regex"?`Ugyldig streng: skal matche mønsteret ${n.pattern}`:`Ugyldig ${i[n.format]??t.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${w(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${t.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${t.origin}`;default:return"Ugyldigt input"}}};function dg(){return{localeError:cg()}}const ug=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function r(t){return e[t]??null}const i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},a={nan:"NaN",number:"Zahl",array:"Array"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ungültige Eingabe: erwartet instanceof ${t.expected}, erhalten ${s}`:`Ungültige Eingabe: erwartet ${n}, erhalten ${s}`}case"invalid_value":return t.values.length===1?`Ungültige Eingabe: erwartet ${T(t.values[0])}`:`Ungültige Option: erwartet eine von ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Zu groß: erwartet, dass ${t.origin??"Wert"} ${n}${t.maximum.toString()} ${o.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${t.origin??"Wert"} ${n}${t.maximum.toString()} ist`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Zu klein: erwartet, dass ${t.origin} ${n}${t.minimum.toString()} ${o.unit} hat`:`Zu klein: erwartet, dass ${t.origin} ${n}${t.minimum.toString()} ist`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ungültiger String: muss mit "${n.prefix}" beginnen`:n.format==="ends_with"?`Ungültiger String: muss mit "${n.suffix}" enden`:n.format==="includes"?`Ungültiger String: muss "${n.includes}" enthalten`:n.format==="regex"?`Ungültiger String: muss dem Muster ${n.pattern} entsprechen`:`Ungültig: ${i[n.format]??t.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${t.divisor} sein`;case"unrecognized_keys":return`${t.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${w(t.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${t.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${t.origin}`;default:return"Ungültige Eingabe"}}};function lg(){return{localeError:ug()}}const fg=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function r(t){return e[t]??null}const i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return`Invalid input: expected ${n}, received ${s}`}case"invalid_value":return t.values.length===1?`Invalid input: expected ${T(t.values[0])}`:`Invalid option: expected one of ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Too big: expected ${t.origin??"value"} to have ${n}${t.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${t.origin??"value"} to be ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Too small: expected ${t.origin} to have ${n}${t.minimum.toString()} ${o.unit}`:`Too small: expected ${t.origin} to be ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${i[n.format]??t.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${t.divisor}`;case"unrecognized_keys":return`Unrecognized key${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Invalid key in ${t.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${t.origin}`;default:return"Invalid input"}}};function td(){return{localeError:fg()}}const mg=()=>{const e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function r(t){return e[t]??null}const i={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},a={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Nevalida enigo: atendiĝis instanceof ${t.expected}, riceviĝis ${s}`:`Nevalida enigo: atendiĝis ${n}, riceviĝis ${s}`}case"invalid_value":return t.values.length===1?`Nevalida enigo: atendiĝis ${T(t.values[0])}`:`Nevalida opcio: atendiĝis unu el ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${n}${t.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Tro malgranda: atendiĝis ke ${t.origin} havu ${n}${t.minimum.toString()} ${o.unit}`:`Tro malgranda: atendiĝis ke ${t.origin} estu ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`:n.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`:n.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${n.includes}"`:n.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`:`Nevalida ${i[n.format]??t.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${t.divisor}`;case"unrecognized_keys":return`Nekonata${t.keys.length>1?"j":""} ŝlosilo${t.keys.length>1?"j":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${t.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${t.origin}`;default:return"Nevalida enigo"}}};function pg(){return{localeError:mg()}}const hg=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function r(t){return e[t]??null}const i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},a={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Entrada inválida: se esperaba instanceof ${t.expected}, recibido ${s}`:`Entrada inválida: se esperaba ${n}, recibido ${s}`}case"invalid_value":return t.values.length===1?`Entrada inválida: se esperaba ${T(t.values[0])}`:`Opción inválida: se esperaba una de ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin),s=a[t.origin]??t.origin;return o?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${n}${t.maximum.toString()} ${o.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin),s=a[t.origin]??t.origin;return o?`Demasiado pequeño: se esperaba que ${s} tuviera ${n}${t.minimum.toString()} ${o.unit}`:`Demasiado pequeño: se esperaba que ${s} fuera ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Cadena inválida: debe comenzar con "${n.prefix}"`:n.format==="ends_with"?`Cadena inválida: debe terminar en "${n.suffix}"`:n.format==="includes"?`Cadena inválida: debe incluir "${n.includes}"`:n.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${n.pattern}`:`Inválido ${i[n.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${a[t.origin]??t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${a[t.origin]??t.origin}`;default:return"Entrada inválida"}}};function gg(){return{localeError:hg()}}const yg=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function r(t){return e[t]??null}const i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},a={nan:"NaN",number:"عدد",array:"آرایه"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`ورودی نامعتبر: می‌بایست instanceof ${t.expected} می‌بود، ${s} دریافت شد`:`ورودی نامعتبر: می‌بایست ${n} می‌بود، ${s} دریافت شد`}case"invalid_value":return t.values.length===1?`ورودی نامعتبر: می‌بایست ${T(t.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${w(t.values,"|")} می‌بود`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`خیلی بزرگ: ${t.origin??"مقدار"} باید ${n}${t.maximum.toString()} ${o.unit??"عنصر"} باشد`:`خیلی بزرگ: ${t.origin??"مقدار"} باید ${n}${t.maximum.toString()} باشد`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`خیلی کوچک: ${t.origin} باید ${n}${t.minimum.toString()} ${o.unit} باشد`:`خیلی کوچک: ${t.origin} باید ${n}${t.minimum.toString()} باشد`}case"invalid_format":{const n=t;return n.format==="starts_with"?`رشته نامعتبر: باید با "${n.prefix}" شروع شود`:n.format==="ends_with"?`رشته نامعتبر: باید با "${n.suffix}" تمام شود`:n.format==="includes"?`رشته نامعتبر: باید شامل "${n.includes}" باشد`:n.format==="regex"?`رشته نامعتبر: باید با الگوی ${n.pattern} مطابقت داشته باشد`:`${i[n.format]??t.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${t.divisor} باشد`;case"unrecognized_keys":return`کلید${t.keys.length>1?"های":""} ناشناس: ${w(t.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${t.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${t.origin}`;default:return"ورودی نامعتبر"}}};function vg(){return{localeError:yg()}}const wg=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function r(t){return e[t]??null}const i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Virheellinen tyyppi: odotettiin instanceof ${t.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${n}, oli ${s}`}case"invalid_value":return t.values.length===1?`Virheellinen syöte: täytyy olla ${T(t.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Liian suuri: ${o.subject} täytyy olla ${n}${t.maximum.toString()} ${o.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Liian pieni: ${o.subject} täytyy olla ${n}${t.minimum.toString()} ${o.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${n.prefix}"`:n.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${n.suffix}"`:n.format==="includes"?`Virheellinen syöte: täytyy sisältää "${n.includes}"`:n.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${n.pattern}`:`Virheellinen ${i[n.format]??t.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${t.divisor} monikerta`;case"unrecognized_keys":return`${t.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(t.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function bg(){return{localeError:wg()}}const $g=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function r(t){return e[t]??null}const i={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},a={nan:"NaN",number:"nombre",array:"tableau"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Entrée invalide : instanceof ${t.expected} attendu, ${s} reçu`:`Entrée invalide : ${n} attendu, ${s} reçu`}case"invalid_value":return t.values.length===1?`Entrée invalide : ${T(t.values[0])}
1 attendu`:`Option invalide : une valeur parmi ${w(t.values,"|")} attendue`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Trop grand : ${t.origin??"valeur"} doit ${o.verb} ${n}${t.maximum.toString()} ${o.unit??"élément(s)"}`:`Trop grand : ${t.origin??"valeur"} doit être ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Trop petit : ${t.origin} doit ${o.verb} ${n}${t.minimum.toString()} ${o.unit}`:`Trop petit : ${t.origin} doit être ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Chaîne invalide : doit commencer par "${n.prefix}"`:n.format==="ends_with"?`Chaîne invalide : doit se terminer par "${n.suffix}"`:n.format==="includes"?`Chaîne invalide : doit inclure "${n.includes}"`:n.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${n.pattern}`:`${i[n.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${w(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function kg(){return{localeError:$g()}}const Sg=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function r(t){return e[t]??null}const i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Entrée invalide : attendu instanceof ${t.expected}, reçu ${s}`:`Entrée invalide : attendu ${n}, reçu ${s}`}case"invalid_value":return t.values.length===1?`Entrée invalide : attendu ${T(t.values[0])}
1`:`Option invalide : attendu l'une des valeurs suivantes ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"≤":"<",o=r(t.origin);return o?`Trop grand : attendu que ${t.origin??"la valeur"} ait ${n}${t.maximum.toString()} ${o.unit}`:`Trop grand : attendu que ${t.origin??"la valeur"} soit ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?"≥":">",o=r(t.origin);return o?`Trop petit : attendu que ${t.origin} ait ${n}${t.minimum.toString()} ${o.unit}`:`Trop petit : attendu que ${t.origin} soit ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Chaîne invalide : doit commencer par "${n.prefix}"`:n.format==="ends_with"?`Chaîne invalide : doit se terminer par "${n.suffix}"`:n.format==="includes"?`Chaîne invalide : doit inclure "${n.includes}"`:n.format==="regex"?`Chaîne invalide : doit correspondre au motif ${n.pattern}`:`${i[n.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${w(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function Ig(){return{localeError:Sg()}}const _g=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},r={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},i=d=>d?e[d]:void 0,a=d=>{const u=i(d);return u?u.label:d??e.unknown.label},t=d=>`ה${a(d)}`,n=d=>(i(d)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",o=d=>d?r[d]??null:null,s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},c={nan:"NaN"};return d=>{switch(d.code){case"invalid_type":{const u=d.expected,f=c[u??""]??a(u),l=R(d.input),m=c[l]??e[l]?.label??l;return/^[A-Z]/.test(d.expected)?`קלט לא תקין: צריך להיות instanceof ${d.expected}, התקבל ${m}
1`:`קלט לא תקין: צריך להיות ${f}, התקבל ${m}`}case"invalid_value":{if(d.values.length===1)return`ערך לא תקין: הערך חייב להיות ${T(d.values[0])}`;const u=d.values.map(m=>T(m));if(d.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${u[0]} או ${u[1]}`;const f=u[u.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${u.slice(0,-1).join(", ")} או ${f}`}case"too_big":{const u=o(d.origin),f=t(d.origin??"value");if(d.origin==="string")return`${u?.longLabel??"ארוך"} מדי: ${f} צריכה להכיל ${d.maximum.toString()} ${u?.unit??""} ${d.inclusive?"או פחות":"לכל היותר"}`.trim();if(d.origin==="number"){const h=d.inclusive?`קטן או שווה ל-${d.maximum}`:`קטן מ-${d.maximum}`;return`גדול מדי: ${f} צריך להיות ${h}`}if(d.origin==="array"||d.origin==="set"){const h=d.origin==="set"?"צריכה":"צריך",g=d.inclusive?`${d.maximum} ${u?.unit??""} או פחות`:`פחות מ-${d.maximum} ${u?.unit??""}`;return`גדול מדי: ${f} ${h} להכיל ${g}`.trim()}const l=d.inclusive?"<=":"<",m=n(d.origin??"value");return u?.unit?`${u.longLabel} מדי: ${f} ${m} ${l}${d.maximum.toString()} ${u.unit}`:`${u?.longLabel??"גדול"} מדי: ${f} ${m} ${l}${d.maximum.toString()}`}case"too_small":{const u=o(d.origin),f=t(d.origin??"value");if(d.origin==="string")return`${u?.shortLabel??"קצר"} מדי: ${f} צריכה להכיל ${d.minimum.toString()} ${u?.unit??""} ${d.inclusive?"או יותר":"לפחות"}`.trim();if(d.origin==="number"){const h=d.inclusive?`גדול או שווה ל-${d.minimum}`:`גדול מ-${d.minimum}`;return`קטן מדי: ${f} צריך להיות ${h}`}if(d.origin==="array"||d.origin==="set"){const h=d.origin==="set"?"צריכה":"צריך";if(d.minimum===1&&d.inclusive){const p=(d.origin==="set","לפחות פריט אחד");return`קטן מדי: ${f} ${h} להכיל ${p}`}const g=d.inclusive?`${d.minimum} ${u?.unit??""} או יותר`:`יותר מ-${d.minimum} ${u?.unit??""}`;return`קטן מדי: ${f} ${h} להכיל ${g}`.trim()}const l=d.inclusive?">=":">",m=n(d.origin??"value");return u?.unit?`${u.shortLabel} מדי: ${f} ${m} ${l}${d.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"קטן"} מדי: ${f} ${m} ${l}${d.minimum.toString()}`}case"invalid_format":{const u=d;if(u.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${u.prefix}"`;if(u.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${u.suffix}"`;if(u.format==="includes")return`המחרוזת חייבת לכלול "${u.includes}"`;if(u.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${u.pattern}`;const f=s[u.format],l=f?.label??u.format,h=(f?.gender??"m")==="f"?"תקינה":"תקין";return`${l} לא ${h}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${d.divisor}`;case"unrecognized_keys":return`מפתח${d.keys.length>1?"ות":""} לא מזוה${d.keys.length>1?"ים":"ה"}: ${w(d.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${t(d.origin??"array")}`;default:return"קלט לא תקין"}}};function Ag(){return{localeError:_g()}}const Ug=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function r(t){return e[t]??null}const i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},a={nan:"NaN",number:"szám",array:"tömb"};return t=>
vendor: 23,560 bytes, line 1
1{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Érvénytelen bemenet: a várt érték instanceof ${t.expected}, a kapott érték ${s}`:`Érvénytelen bemenet: a várt érték ${n}, a kapott érték ${s}`}case"invalid_value":return t.values.length===1?`Érvénytelen bemenet: a várt érték ${T(t.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Túl nagy: ${t.origin??"érték"} mérete túl nagy ${n}${t.maximum.toString()} ${o.unit??"elem"}`:`Túl nagy: a bemeneti érték ${t.origin??"érték"} túl nagy: ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Túl kicsi: a bemeneti érték ${t.origin} mérete túl kicsi ${n}${t.minimum.toString()} ${o.unit}`:`Túl kicsi: a bemeneti érték ${t.origin} túl kicsi ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Érvénytelen string: "${n.prefix}" értékkel kell kezdődnie`:n.format==="ends_with"?`Érvénytelen string: "${n.suffix}" értékkel kell végződnie`:n.format==="includes"?`Érvénytelen string: "${n.includes}" értéket kell tartalmaznia`:n.format==="regex"?`Érvénytelen string: ${n.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[n.format]??t.format}`}case"not_multiple_of":return`Érvénytelen szám: ${t.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${t.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${t.origin}`;default:return"Érvénytelen bemenet"}}};function Eg(){return{localeError:Ug()}}function Pi(e,r,i){return Math.abs(e)===1?r:i}function ct(e){if(!e)return"";const r=["ա","ե","ը","ի","ո","ու","օ"],i=e[e.length-1];return e+(r.includes(i)?"ն":"ը")}const xg=()=>{const e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function r(t){return e[t]??null}const i={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},a={nan:"NaN",number:"թիվ",array:"զանգված"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${t.expected}, ստացվել է ${s}`:`Սխալ մուտքագրում․ սպասվում էր ${n}, ստացվել է ${s}`}case"invalid_value":return t.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${T(t.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);if(o){const s=Number(t.maximum),c=Pi(s,o.unit.one,o.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${ct(t.origin??"արժեք")} կունենա ${n}${t.maximum.toString()} ${c}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${ct(t.origin??"արժեք")} լինի ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);if(o){const s=Number(t.minimum),c=Pi(s,o.unit.one,o.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${ct(t.origin)} կունենա ${n}${t.minimum.toString()} ${c}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${ct(t.origin)} լինի ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Սխալ տող․ պետք է սկսվի "${n.prefix}"-ով`:n.format==="ends_with"?`Սխալ տող․ պետք է ավարտվի "${n.suffix}"-ով`:n.format==="includes"?`Սխալ տող․ պետք է պարունակի "${n.includes}"`:n.format==="regex"?`Սխալ տող․ պետք է համապատասխանի ${n.pattern} ձևաչափին`:`Սխալ ${i[n.format]??t.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${t.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${t.keys.length>1?"ներ":""}. ${w(t.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${ct(t.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${ct(t.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function Tg(){return{localeError:xg()}}const Dg=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function r(t){return e[t]??null}const i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Input tidak valid: diharapkan instanceof ${t.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${n}, diterima ${s}`}case"invalid_value":return t.values.length===1?`Input tidak valid: diharapkan ${T(t.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Terlalu besar: diharapkan ${t.origin??"value"} memiliki ${n}${t.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: diharapkan ${t.origin??"value"} menjadi ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Terlalu kecil: diharapkan ${t.origin} memiliki ${n}${t.minimum.toString()} ${o.unit}`:`Terlalu kecil: diharapkan ${t.origin} menjadi ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`String tidak valid: harus dimulai dengan "${n.prefix}"`:n.format==="ends_with"?`String tidak valid: harus berakhir dengan "${n.suffix}"`:n.format==="includes"?`String tidak valid: harus menyertakan "${n.includes}"`:n.format==="regex"?`String tidak valid: harus sesuai pola ${n.pattern}`:`${i[n.format]??t.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${t.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${t.origin}`;default:return"Input tidak valid"}}};function Rg(){return{localeError:Dg()}}const Og=()=>{const e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function r(t){return e[t]??null}const i={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},a={nan:"NaN",number:"númer",array:"fylki"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Rangt gildi: Þú slóst inn ${s} þar sem á að vera instanceof ${t.expected}`:`Rangt gildi: Þú slóst inn ${s} þar sem á að vera ${n}`}case"invalid_value":return t.values.length===1?`Rangt gildi: gert ráð fyrir ${T(t.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} hafi ${n}${t.maximum.toString()} ${o.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} sé ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Of lítið: gert er ráð fyrir að ${t.origin} hafi ${n}${t.minimum.toString()} ${o.unit}`:`Of lítið: gert er ráð fyrir að ${t.origin} sé ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ógildur strengur: verður að byrja á "${n.prefix}"`:n.format==="ends_with"?`Ógildur strengur: verður að enda á "${n.suffix}"`:n.format==="includes"?`Ógildur strengur: verður að innihalda "${n.includes}"`:n.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${n.pattern}`:`Rangt ${i[n.format]??t.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${t.divisor}`;case"unrecognized_keys":return`Óþekkt ${t.keys.length>1?"ir lyklar":"ur lykill"}: ${w(t.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${t.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${t.origin}`;default:return"Rangt gildi"}}};function Cg(){return{localeError:Og()}}const Pg=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function r(t){return e[t]??null}const i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},a={nan:"NaN",number:"numero",array:"vettore"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Input non valido: atteso instanceof ${t.expected}, ricevuto ${s}`:`Input non valido: atteso ${n}, ricevuto ${s}`}case"invalid_value":return t.values.length===1?`Input non valido: atteso ${T(t.values[0])}`:`Opzione non valida: atteso uno tra ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Troppo grande: ${t.origin??"valore"} deve avere ${n}${t.maximum.toString()} ${o.unit??"elementi"}`:`Troppo grande: ${t.origin??"valore"} deve essere ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Troppo piccolo: ${t.origin} deve avere ${n}${t.minimum.toString()} ${o.unit}`:`Troppo piccolo: ${t.origin} deve essere ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Stringa non valida: deve iniziare con "${n.prefix}"`:n.format==="ends_with"?`Stringa non valida: deve terminare con "${n.suffix}"`:n.format==="includes"?`Stringa non valida: deve includere "${n.includes}"`:n.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${n.pattern}`:`Invalid ${i[n.format]??t.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${t.divisor}`;case"unrecognized_keys":return`Chiav${t.keys.length>1?"i":"e"} non riconosciut${t.keys.length>1?"e":"a"}: ${w(t.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${t.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${t.origin}`;default:return"Input non valido"}}};function Lg(){return{localeError:Pg()}}const Ng=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function r(t){return e[t]??null}const i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},a={nan:"NaN",number:"数値",array:"配列"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`無効な入力: instanceof ${t.expected}が期待されましたが、${s}が入力されました`:`無効な入力: ${n}が期待されましたが、${s}が入力されました`}case"invalid_value":return t.values.length===1?`無効な入力: ${T(t.values[0])}が期待されました`:`無効な選択: ${w(t.values,"、")}のいずれかである必要があります`;case"too_big":{const n=t.inclusive?"以下である":"より小さい",o=r(t.origin);return o?`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${o.unit??"要素"}${n}必要があります`:`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${n}必要があります`}case"too_small":{const n=t.inclusive?"以上である":"より大きい",o=r(t.origin);return o?`小さすぎる値: ${t.origin}は${t.minimum.toString()}${o.unit}${n}必要があります`:`小さすぎる値: ${t.origin}は${t.minimum.toString()}${n}必要があります`}case"invalid_format":{const n=t;return n.format==="starts_with"?`無効な文字列: "${n.prefix}"で始まる必要があります`:n.format==="ends_with"?`無効な文字列: "${n.suffix}"で終わる必要があります`:n.format==="includes"?`無効な文字列: "${n.includes}"を含む必要があります`:n.format==="regex"?`無効な文字列: パターン${n.pattern}に一致する必要があります`:`無効な${i[n.format]??t.format}`}case"not_multiple_of":return`無効な数値: ${t.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${t.keys.length>1?"群":""}: ${w(t.keys,"、")}`;case"invalid_key":return`${t.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${t.origin}内の無効な値`;default:return"無効な入力"}}};function zg(){return{localeError:Ng()}}const jg=()=>{const e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function r(t){return e[t]??null}const i={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},a={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${t.expected}, მიღებული ${s}`:`არასწორი შეყვანა: მოსალოდნელი ${n}, მიღებული ${s}`}case"invalid_value":return t.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${T(t.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${w(t.values,"|")}-დან`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} ${o.verb} ${n}${t.maximum.toString()} ${o.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} იყოს ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`ზედმეტად პატარა: მოსალოდნელი ${t.origin} ${o.verb} ${n}${t.minimum.toString()} ${o.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${t.origin} იყოს ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${n.prefix}"-ით`:n.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${n.suffix}"-ით`:n.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${n.includes}"-ს`:n.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`:`არასწორი ${i[n.format]??t.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${t.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${t.keys.length>1?"ები":"ი"}: ${w(t.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${t.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${t.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Kg(){return{localeError:jg()}}const Hg=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function r(t){return e[t]??null}const i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},a={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${t.expected} ប៉ុន្តែទទួលបាន ${s}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n} ប៉ុន្តែទទួលបាន ${s}`}case"invalid_value":return t.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${T(t.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${n} ${t.maximum.toString()} ${o.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${n} ${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`តូចពេក៖ ត្រូវការ ${t.origin} ${n} ${t.minimum.toString()} ${o.unit}`:`តូចពេក៖ ត្រូវការ ${t.origin} ${n} ${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${n.prefix}"`:n.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${n.suffix}"`:n.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${n.includes}"`:n.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${n.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[n.format]??t.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${t.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${w(t.keys,", ")}`;
1case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function rd(){return{localeError:Hg()}}function Wg(){return rd()}const Vg=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function r(t){return e[t]??null}const i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`잘못된 입력: 예상 타입은 instanceof ${t.expected}, 받은 타입은 ${s}입니다`:`잘못된 입력: 예상 타입은 ${n}, 받은 타입은 ${s}입니다`}case"invalid_value":return t.values.length===1?`잘못된 입력: 값은 ${T(t.values[0])} 이어야 합니다`:`잘못된 옵션: ${w(t.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const n=t.inclusive?"이하":"미만",o=n==="미만"?"이어야 합니다":"여야 합니다",s=r(t.origin),c=s?.unit??"요소";return s?`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()}${c} ${n}${o}`:`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()} ${n}${o}`}case"too_small":{const n=t.inclusive?"이상":"초과",o=n==="이상"?"이어야 합니다":"여야 합니다",s=r(t.origin),c=s?.unit??"요소";return s?`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()}${c} ${n}${o}`:`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()} ${n}${o}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`잘못된 문자열: "${n.prefix}"(으)로 시작해야 합니다`:n.format==="ends_with"?`잘못된 문자열: "${n.suffix}"(으)로 끝나야 합니다`:n.format==="includes"?`잘못된 문자열: "${n.includes}"을(를) 포함해야 합니다`:n.format==="regex"?`잘못된 문자열: 정규식 ${n.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[n.format]??t.format}`}case"not_multiple_of":return`잘못된 숫자: ${t.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${w(t.keys,", ")}`;case"invalid_key":return`잘못된 키: ${t.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${t.origin}`;default:return"잘못된 입력"}}};function Jg(){return{localeError:Vg()}}const St=e=>e.charAt(0).toUpperCase()+e.slice(1);function Li(e){const r=Math.abs(e),i=r%10,a=r%100;return a>=11&&a<=19||i===0?"many":i===1?"one":"few"}const Bg=()=>{const e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function r(t,n,o,s){const c=e[t]??null;return c===null?c:{unit:c.unit[n],verb:c.verb[s][o?"inclusive":"notInclusive"]}}const i={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},a={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return t=>
vendor: 22,577 bytes, line 1
1{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Gautas tipas ${s}, o tikėtasi - instanceof ${t.expected}`:`Gautas tipas ${s}, o tikėtasi - ${n}`}case"invalid_value":return t.values.length===1?`Privalo būti ${T(t.values[0])}`:`Privalo būti vienas iš ${w(t.values,"|")} pasirinkimų`;case"too_big":{const n=a[t.origin]??t.origin,o=r(t.origin,Li(Number(t.maximum)),t.inclusive??!1,"smaller");if(o?.verb)return`${St(n??t.origin??"reikšmė")} ${o.verb} ${t.maximum.toString()} ${o.unit??"elementų"}`;const s=t.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${St(n??t.origin??"reikšmė")} turi būti ${s} ${t.maximum.toString()} ${o?.unit}`}case"too_small":{const n=a[t.origin]??t.origin,o=r(t.origin,Li(Number(t.minimum)),t.inclusive??!1,"bigger");if(o?.verb)return`${St(n??t.origin??"reikšmė")} ${o.verb} ${t.minimum.toString()} ${o.unit??"elementų"}`;const s=t.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${St(n??t.origin??"reikšmė")} turi būti ${s} ${t.minimum.toString()} ${o?.unit}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Eilutė privalo prasidėti "${n.prefix}"`:n.format==="ends_with"?`Eilutė privalo pasibaigti "${n.suffix}"`:n.format==="includes"?`Eilutė privalo įtraukti "${n.includes}"`:n.format==="regex"?`Eilutė privalo atitikti ${n.pattern}`:`Neteisingas ${i[n.format]??t.format}`}case"not_multiple_of":return`Skaičius privalo būti ${t.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${t.keys.length>1?"i":"as"} rakt${t.keys.length>1?"ai":"as"}: ${w(t.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const n=a[t.origin]??t.origin;return`${St(n??t.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Mg(){return{localeError:Bg()}}const qg=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function r(t){return e[t]??null}const i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},a={nan:"NaN",number:"број",array:"низа"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Грешен внес: се очекува instanceof ${t.expected}, примено ${s}`:`Грешен внес: се очекува ${n}, примено ${s}`}case"invalid_value":return t.values.length===1?`Invalid input: expected ${T(t.values[0])}`:`Грешана опција: се очекува една ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Премногу голем: се очекува ${t.origin??"вредноста"} да има ${n}${t.maximum.toString()} ${o.unit??"елементи"}`:`Премногу голем: се очекува ${t.origin??"вредноста"} да биде ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Премногу мал: се очекува ${t.origin} да има ${n}${t.minimum.toString()} ${o.unit}`:`Премногу мал: се очекува ${t.origin} да биде ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Неважечка низа: мора да започнува со "${n.prefix}"`:n.format==="ends_with"?`Неважечка низа: мора да завршува со "${n.suffix}"`:n.format==="includes"?`Неважечка низа: мора да вклучува "${n.includes}"`:n.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${n.pattern}`:`Invalid ${i[n.format]??t.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${w(t.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${t.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${t.origin}`;default:return"Грешен внес"}}};function Fg(){return{localeError:qg()}}const Zg=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function r(t){return e[t]??null}const i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},a={nan:"NaN",number:"nombor"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Input tidak sah: dijangka instanceof ${t.expected}, diterima ${s}`:`Input tidak sah: dijangka ${n}, diterima ${s}`}case"invalid_value":return t.values.length===1?`Input tidak sah: dijangka ${T(t.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Terlalu besar: dijangka ${t.origin??"nilai"} ${o.verb} ${n}${t.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: dijangka ${t.origin??"nilai"} adalah ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Terlalu kecil: dijangka ${t.origin} ${o.verb} ${n}${t.minimum.toString()} ${o.unit}`:`Terlalu kecil: dijangka ${t.origin} adalah ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`String tidak sah: mesti bermula dengan "${n.prefix}"`:n.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${n.suffix}"`:n.format==="includes"?`String tidak sah: mesti mengandungi "${n.includes}"`:n.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${n.pattern}`:`${i[n.format]??t.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(t.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${t.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${t.origin}`;default:return"Input tidak sah"}}};function Gg(){return{localeError:Zg()}}const Qg=()=>{const e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function r(t){return e[t]??null}const i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},a={nan:"NaN",number:"getal"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ongeldige invoer: verwacht instanceof ${t.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${n}, ontving ${s}`}case"invalid_value":return t.values.length===1?`Ongeldige invoer: verwacht ${T(t.values[0])}`:`Ongeldige optie: verwacht één van ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin),s=t.origin==="date"?"laat":t.origin==="string"?"lang":"groot";return o?`Te ${s}: verwacht dat ${t.origin??"waarde"} ${n}${t.maximum.toString()} ${o.unit??"elementen"} ${o.verb}`:`Te ${s}: verwacht dat ${t.origin??"waarde"} ${n}${t.maximum.toString()} is`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin),s=t.origin==="date"?"vroeg":t.origin==="string"?"kort":"klein";return o?`Te ${s}: verwacht dat ${t.origin} ${n}${t.minimum.toString()} ${o.unit} ${o.verb}`:`Te ${s}: verwacht dat ${t.origin} ${n}${t.minimum.toString()} is`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ongeldige tekst: moet met "${n.prefix}" beginnen`:n.format==="ends_with"?`Ongeldige tekst: moet op "${n.suffix}" eindigen`:n.format==="includes"?`Ongeldige tekst: moet "${n.includes}" bevatten`:n.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${n.pattern}`:`Ongeldig: ${i[n.format]??t.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${t.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${t.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${t.origin}`;default:return"Ongeldige invoer"}}};function Xg(){return{localeError:Qg()}}const Yg=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function r(t){return e[t]??null}const i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},a={nan:"NaN",number:"tall",array:"liste"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ugyldig input: forventet instanceof ${t.expected}, fikk ${s}`:`Ugyldig input: forventet ${n}, fikk ${s}`}case"invalid_value":return t.values.length===1?`Ugyldig verdi: forventet ${T(t.values[0])}`:`Ugyldig valg: forventet en av ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`For stor(t): forventet ${t.origin??"value"} til å ha ${n}${t.maximum.toString()} ${o.unit??"elementer"}`:`For stor(t): forventet ${t.origin??"value"} til å ha ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`For lite(n): forventet ${t.origin} til å ha ${n}${t.minimum.toString()} ${o.unit}`:`For lite(n): forventet ${t.origin} til å ha ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ugyldig streng: må starte med "${n.prefix}"`:n.format==="ends_with"?`Ugyldig streng: må ende med "${n.suffix}"`:n.format==="includes"?`Ugyldig streng: må inneholde "${n.includes}"`:n.format==="regex"?`Ugyldig streng: må matche mønsteret ${n.pattern}`:`Ugyldig ${i[n.format]??t.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${w(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function ey(){return{localeError:Yg()}}const ty=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function r(t){return e[t]??null}const i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},a={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Fâsit giren: umulan instanceof ${t.expected}, alınan ${s}`:`Fâsit giren: umulan ${n}, alınan ${s}`}case"invalid_value":return t.values.length===1?`Fâsit giren: umulan ${T(t.values[0])}`:`Fâsit tercih: mûteberler ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Fazla büyük: ${t.origin??"value"}, ${n}${t.maximum.toString()} ${o.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${t.origin??"value"}, ${n}${t.maximum.toString()} olmalıydı.`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Fazla küçük: ${t.origin}, ${n}${t.minimum.toString()} ${o.unit} sahip olmalıydı.`:`Fazla küçük: ${t.origin}, ${n}${t.minimum.toString()} olmalıydı.`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Fâsit metin: "${n.prefix}" ile başlamalı.`:n.format==="ends_with"?`Fâsit metin: "${n.suffix}" ile bitmeli.`:n.format==="includes"?`Fâsit metin: "${n.includes}" ihtivâ etmeli.`:n.format==="regex"?`Fâsit metin: ${n.pattern} nakşına uymalı.`:`Fâsit ${i[n.format]??t.format}`}case"not_multiple_of":return`Fâsit sayı: ${t.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${t.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function ry(){return{localeError:ty()}}const ny=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function r(t){return e[t]??null}const i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},a={nan:"NaN",number:"عدد",array:"ارې"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`ناسم ورودي: باید instanceof ${t.expected} وای, مګر ${s} ترلاسه شو`:`ناسم ورودي: باید ${n} وای, مګر ${s} ترلاسه شو`}case"invalid_value":return t.values.length===1?`ناسم ورودي: باید ${T(t.values[0])} وای`:`ناسم انتخاب: باید یو له ${w(t.values,"|")} څخه وای`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`ډیر لوی: ${t.origin??"ارزښت"} باید ${n}${t.maximum.toString()} ${o.unit??"عنصرونه"} ولري`:`ډیر لوی: ${t.origin??"ارزښت"} باید ${n}${t.maximum.toString()} وي`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`ډیر کوچنی: ${t.origin} باید ${n}${t.minimum.toString()} ${o.unit} ولري`:`ډیر کوچنی: ${t.origin} باید ${n}${t.minimum.toString()} وي`}case"invalid_format":{const n=t;return n.format==="starts_with"?`ناسم متن: باید د "${n.prefix}" سره پیل شي`:n.format==="ends_with"?`ناسم متن: باید د "${n.suffix}" سره پای ته ورسيږي`:n.format==="includes"?`ناسم متن: باید "${n.includes}" ولري`:n.format==="regex"?`ناسم متن: باید د ${n.pattern} سره مطابقت ولري`:`${i[n.format]??t.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${t.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${t.keys.length>1?"کلیډونه":"کلیډ"}: ${w(t.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${t.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${t.origin} کې`;default:return"ناسمه ورودي"}}};function iy(){return{localeError:ny()}}const ay=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function r(t){return e[t]??null}const i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},a={nan:"NaN",number:"liczba",array:"tablica"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${t.expected}, otrzymano ${s}`:`Nieprawidłowe dane wejściowe: oczekiwano ${n}, otrzymano ${s}`}case"invalid_value":return t.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${T(t.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Za duża wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${n}${t.maximum.toString()} ${o.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Za mała wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${n}${t.minimum.toString()} ${o.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${n.prefix}"`:n.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${n.suffix}"`:n.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${n.includes}"`:n.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${n.pattern}`:`Nieprawidłow(y/a/e) ${i[n.format]??t.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${t.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${t.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${t.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function oy(){return{localeError:ay()}}const sy=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function r(t){return e[t]??null}const i={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},a={nan:"NaN",number:"número",null:"nulo"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Tipo inválido: esperado instanceof ${t.expected}, recebido ${s}`:`Tipo inválido: esperado ${n}, recebido ${s}`}case"invalid_value":return t.values.length===1?`Entrada inválida: esperado ${T(t.values[0])}`:`Opção inválida: esperada uma das ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Muito grande: esperado que ${t.origin??"valor"} tivesse ${n}${t.maximum.toString()} ${o.unit??"elementos"}`:`Muito grande: esperado que ${t.origin??"valor"} fosse ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Muito pequeno: esperado que ${t.origin} tivesse ${n}${t.minimum.toString()} ${o.unit}`:`Muito pequeno: esperado que ${t.origin} fosse ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Texto inválido: deve começar com "${n.prefix}"`:n.format==="ends_with"?`Texto inválido: deve terminar com "${n.suffix}"`:n.format==="includes"?`Texto inválido: deve incluir "${n.includes}"`:n.format==="regex"?`Texto inválido: deve corresponder ao padrão ${n.pattern}`:`${i[n.format]??t.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Chave${t.keys.length>
11?"s":""} desconhecida${t.keys.length>1?"s":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Chave inválida em ${t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${t.origin}`;default:return"Campo inválido"}}};function cy(){return{localeError:sy()}}function Ni(e,r,i,a){const t=Math.abs(e),n=t%10,o=t%100;return o>=11&&o<=19?a:n===1?r:n>=2&&n<=4?i:a}const dy=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function r(t){return e[t]??null}const i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},a={nan:"NaN",number:"число",array:"массив"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Неверный ввод: ожидалось instanceof ${t.expected}, получено ${s}`:`Неверный ввод: ожидалось ${n}, получено ${s}`}case"invalid_value":return t.values.length===1?`Неверный ввод: ожидалось ${T(t.values[0])}`:`Неверный вариант: ожидалось одно из ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);if(o){const s=Number(t.maximum),c=Ni(s,o.unit.one,o.unit.few,o.unit.many);return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет иметь ${n}${t.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);if(o){const s=Number(t.minimum),c=Ni(s,o.unit.one,o.unit.few,o.unit.many);return`Слишком маленькое значение: ожидалось, что ${t.origin} будет иметь ${n}${t.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${t.origin} будет ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Неверная строка: должна начинаться с "${n.prefix}"`:n.format==="ends_with"?`Неверная строка: должна заканчиваться на "${n.suffix}"`:n.format==="includes"?`Неверная строка: должна содержать "${n.includes}"`:n.format==="regex"?`Неверная строка: должна соответствовать шаблону ${n.pattern}`:`Неверный ${i[n.format]??t.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспознанн${t.keys.length>1?"ые":"ый"} ключ${t.keys.length>1?"и":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${t.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${t.origin}`;default:return"Неверные входные данные"}}};function uy(){return{localeError:dy()}}const ly=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function r(t){return e[t]??null}const i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},a={nan:"NaN",number:"število",array:"tabela"};return t=>
vendor: 8,214 bytes, line 1
1{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Neveljaven vnos: pričakovano instanceof ${t.expected}, prejeto ${s}`:`Neveljaven vnos: pričakovano ${n}, prejeto ${s}`}case"invalid_value":return t.values.length===1?`Neveljaven vnos: pričakovano ${T(t.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} imelo ${n}${t.maximum.toString()} ${o.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Premajhno: pričakovano, da bo ${t.origin} imelo ${n}${t.minimum.toString()} ${o.unit}`:`Premajhno: pričakovano, da bo ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Neveljaven niz: mora se začeti z "${n.prefix}"`:n.format==="ends_with"?`Neveljaven niz: mora se končati z "${n.suffix}"`:n.format==="includes"?`Neveljaven niz: mora vsebovati "${n.includes}"`:n.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${n.pattern}`:`Neveljaven ${i[n.format]??t.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${t.divisor}`;case"unrecognized_keys":return`Neprepoznan${t.keys.length>1?"i ključi":" ključ"}: ${w(t.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${t.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${t.origin}`;default:return"Neveljaven vnos"}}};function fy(){return{localeError:ly()}}const my=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function r(t){return e[t]??null}const i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},a={nan:"NaN",number:"antal",array:"lista"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ogiltig inmatning: förväntat instanceof ${t.expected}, fick ${s}`:`Ogiltig inmatning: förväntat ${n}, fick ${s}`}case"invalid_value":return t.values.length===1?`Ogiltig inmatning: förväntat ${T(t.values[0])}`:`Ogiltigt val: förväntade en av ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`För stor(t): förväntade ${t.origin??"värdet"} att ha ${n}${t.maximum.toString()} ${o.unit??"element"}`:`För stor(t): förväntat ${t.origin??"värdet"} att ha ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`För lite(t): förväntade ${t.origin??"värdet"} att ha ${n}${t.minimum.toString()} ${o.unit}`:`För lite(t): förväntade ${t.origin??"värdet"} att ha ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Ogiltig sträng: måste börja med "${n.prefix}"`:n.format==="ends_with"?`Ogiltig sträng: måste sluta med "${n.suffix}"`:n.format==="includes"?`Ogiltig sträng: måste innehålla "${n.includes}"`:n.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${n.pattern}"`:`Ogiltig(t) ${i[n.format]??t.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${w(t.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${t.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${t.origin??"värdet"}`;default:return"Ogiltig input"}}};function py(){return{localeError:my()}}const hy=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function r(t){return e[t]??null}const i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},a={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${t.expected}, பெறப்பட்டது ${s}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n}, பெறப்பட்டது ${s}`}case"invalid_value":return t.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${T(t.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${w(t.values,"|")} இல் ஒன்று`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${n}${t.maximum.toString()} ${o.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${n}${t.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${n}${t.minimum.toString()} ${o.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${n}${t.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const n=t;return n.format==="starts_with"?`தவறான சரம்: "${n.prefix}" இல் தொடங்க வேண்டும்`:n.format==="ends_with"?`தவறான சரம்: "${n.suffix}" இல் முடிவடைய வேண்டும்`:n.format==="includes"?`தவறான சரம்: "${n.includes}" ஐ உள்ளடக்க வேண்டும்`:n.format==="regex"?`தவறான சரம்: ${n.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[n.format]??t.format}`}case"not_multiple_of":return`தவறான எண்: ${t.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${t.keys.length>1?"கள்":""}: ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin}
1 இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${t.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function gy(){return{localeError:hy()}}const yy=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function r(t){return e[t]??null}const i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},a={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${t.expected} แต่ได้รับ ${s}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n} แต่ได้รับ ${s}`}case"invalid_value":return t.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${T(t.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"ไม่เกิน":"น้อยกว่า",o=r(t.origin);return o?`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${n} ${t.maximum.toString()} ${o.unit??"รายการ"}`:`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${n} ${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?"อย่างน้อย":"มากกว่า",o=r(t.origin);return o?`น้อยกว่ากำหนด: ${t.origin} ควรมี${n} ${t.minimum.toString()} ${o.unit}`:`น้อยกว่ากำหนด: ${t.origin} ควรมี${n} ${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${n.prefix}"`:n.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${n.suffix}"`:n.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${n.includes}" อยู่ในข้อความ`:n.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${n.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[n.format]??t.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${t.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${w(t.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${t.origin}`;
vendor: 21,163 bytes, line 1
1case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${t.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function vy(){return{localeError:yy()}}const wy=()=>{const e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function r(t){return e[t]??null}const i={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Geçersiz değer: beklenen instanceof ${t.expected}, alınan ${s}`:`Geçersiz değer: beklenen ${n}, alınan ${s}`}case"invalid_value":return t.values.length===1?`Geçersiz değer: beklenen ${T(t.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Çok büyük: beklenen ${t.origin??"değer"} ${n}${t.maximum.toString()} ${o.unit??"öğe"}`:`Çok büyük: beklenen ${t.origin??"değer"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Çok küçük: beklenen ${t.origin} ${n}${t.minimum.toString()} ${o.unit}`:`Çok küçük: beklenen ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${i[n.format]??t.format}`}case"not_multiple_of":return`Geçersiz sayı: ${t.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${t.keys.length>1?"lar":""}: ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${t.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function by(){return{localeError:wy()}}const $y=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function r(t){return e[t]??null}const i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},a={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Неправильні вхідні дані: очікується instanceof ${t.expected}, отримано ${s}`:`Неправильні вхідні дані: очікується ${n}, отримано ${s}`}case"invalid_value":return t.values.length===1?`Неправильні вхідні дані: очікується ${T(t.values[0])}`:`Неправильна опція: очікується одне з ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Занадто велике: очікується, що ${t.origin??"значення"} ${o.verb} ${n}${t.maximum.toString()} ${o.unit??"елементів"}`:`Занадто велике: очікується, що ${t.origin??"значення"} буде ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Занадто мале: очікується, що ${t.origin} ${o.verb} ${n}${t.minimum.toString()} ${o.unit}`:`Занадто мале: очікується, що ${t.origin} буде ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Неправильний рядок: повинен починатися з "${n.prefix}"`:n.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${n.suffix}"`:n.format==="includes"?`Неправильний рядок: повинен містити "${n.includes}"`:n.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${n.pattern}`:`Неправильний ${i[n.format]??t.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${t.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${t.keys.length>1?"і":""}: ${w(t.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${t.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${t.origin}`;default:return"Неправильні вхідні дані"}}};function nd(){return{localeError:$y()}}function ky(){return nd()}const Sy=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function r(t){return e[t]??null}const i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},a={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`غلط ان پٹ: instanceof ${t.expected} متوقع تھا، ${s} موصول ہوا`:`غلط ان پٹ: ${n} متوقع تھا، ${s} موصول ہوا`}case"invalid_value":return t.values.length===1?`غلط ان پٹ: ${T(t.values[0])} متوقع تھا`:`غلط آپشن: ${w(t.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`بہت بڑا: ${t.origin??"ویلیو"} کے ${n}${t.maximum.toString()} ${o.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${t.origin??"ویلیو"} کا ${n}${t.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`بہت چھوٹا: ${t.origin} کے ${n}${t.minimum.toString()} ${o.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${t.origin} کا ${n}${t.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const n=t;return n.format==="starts_with"?`غلط سٹرنگ: "${n.prefix}" سے شروع ہونا چاہیے`:n.format==="ends_with"?`غلط سٹرنگ: "${n.suffix}" پر ختم ہونا چاہیے`:n.format==="includes"?`غلط سٹرنگ: "${n.includes}" شامل ہونا چاہیے`:n.format==="regex"?`غلط سٹرنگ: پیٹرن ${n.pattern} سے میچ ہونا چاہیے`:`غلط ${i[n.format]??t.format}`}case"not_multiple_of":return`غلط نمبر: ${t.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${t.keys.length>1?"ز":""}: ${w(t.keys,"، ")}`;case"invalid_key":return`${t.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${t.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Iy(){return{localeError:Sy()}}const _y=()=>{const e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function r(t){return e[t]??null}const i={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},a={nan:"NaN",number:"raqam",array:"massiv"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${t.expected}, qabul qilingan ${s}`:`Noto‘g‘ri kirish: kutilgan ${n}, qabul qilingan ${s}`}case"invalid_value":return t.values.length===1?`Noto‘g‘ri kirish: kutilgan ${T(t.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Juda katta: kutilgan ${t.origin??"qiymat"} ${n}${t.maximum.toString()} ${o.unit} ${o.verb}`:`Juda katta: kutilgan ${t.origin??"qiymat"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Juda kichik: kutilgan ${t.origin} ${n}${t.minimum.toString()} ${o.unit} ${o.verb}`:`Juda kichik: kutilgan ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Noto‘g‘ri satr: "${n.prefix}" bilan boshlanishi kerak`:n.format==="ends_with"?`Noto‘g‘ri satr: "${n.suffix}" bilan tugashi kerak`:n.format==="includes"?`Noto‘g‘ri satr: "${n.includes}" ni o‘z ichiga olishi kerak`:n.format==="regex"?`Noto‘g‘ri satr: ${n.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${i[n.format]??t.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${t.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${t.keys.length>1?"lar":""}: ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${t.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function Ay(){return{localeError:_y()}}const Uy=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function r(t){return e[t]??null}const i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},a={nan:"NaN",number:"số",array:"mảng"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${t.expected}, nhận được ${s}`:`Đầu vào không hợp lệ: mong đợi ${n}, nhận được ${s}`}case"invalid_value":return t.values.length===1?`Đầu vào không hợp lệ: mong đợi ${T(t.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Quá lớn: mong đợi ${t.origin??"giá trị"} ${o.verb} ${n}${t.maximum.toString()} ${o.unit??"phần tử"}`:`Quá lớn: mong đợi ${t.origin??"giá trị"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Quá nhỏ: mong đợi ${t.origin} ${o.verb} ${n}${t.minimum.toString()} ${o.unit}`:`Quá nhỏ: mong đợi ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${n.prefix}"`:n.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${n.suffix}"`:n.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${n.includes}"`:n.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${n.pattern}`:`${i[n.format]??t.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${t.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${w(t.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${t.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${t.origin}`;default:return"Đầu vào không hợp lệ"}}};function Ey(){return{localeError:Uy()}}const xy=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function r(t){return e[t]??null}const i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},a={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`无效输入:期望 instanceof ${t.expected},实际接收 ${s}`:`无效输入:期望 ${n},实际接收 ${s}`}case"invalid_value":return t.values.length===1?`无效输入:期望 ${T(t.values[0])}`:`无效选项:期望以下之一 ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`数值过大:期望 ${t.origin??"值"} ${n}${t.maximum.toString()} ${o.unit??"个元素"}`:`数值过大:期望 ${t.origin??"值"} ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`数值过小:期望 ${t.origin} ${n}${t.minimum.toString()} ${o.unit}`:`数值过小:期望 ${t.origin} ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`无效字符串:必须以 "${n.prefix}" 开头`:n.format==="ends_with"?`无效字符串:必须以 "${n.suffix}" 结尾`:n.format==="includes"?`无效字符串:必须包含 "${n.includes}"`:n.format==="regex"?`无效字符串:必须满足正则表达式 ${n.pattern}`:`无效${i[n.format]??t.format}`}case"not_multiple_of":return`无效数字:必须是 ${t.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${w(t.keys,", ")}`;case"invalid_key":return`${t.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${t.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Ty(){return{localeError:xy()}}const Dy=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function r(t){return e[t]??null}const i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},a={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`無效的輸入值:預期為 instanceof ${t.expected},但收到 ${s}`:`無效的輸入值:預期為 ${n},但收到 ${s}`}case"invalid_value":return t.values.length===1?`無效的輸入值:預期為 ${T(t.values[0])}`:`無效的選項:預期為以下其中之一 ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`數值過大:預期 ${t.origin??"值"} 應為 ${n}${t.maximum.toString()} ${o.unit??"個元素"}`:`數值過大:預期 ${t.origin??"值"} 應為 ${n}${t.maximum.toString()}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`數值過小:預期 ${t.origin} 應為 ${n}${t.minimum.toString()} ${o.unit}`:`數值過小:預期 ${t.origin} 應為 ${n}${t.minimum.toString()}`}case"invalid_format":{const n=t;return n.format==="starts_with"?`無效的字串:必須以 "${n.prefix}" 開頭`:n.format==="ends_with"?`無效的字串:必須以 "${n.suffix}" 結尾`:n.format==="includes"?`無效的字串:必須包含 "${n.includes}"`:n.format==="regex"?`無效的字串:必須符合格式 ${n.pattern}`:`無效的 ${i[n.format]??t.format}`}case"not_multiple_of":return`無效的數字:必須為 ${t.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${t.keys.length>1?"們":""}:${w(t.keys,"、")}`;case"invalid_key":return`${t.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${t.origin} 中有無效的值`;default:return"無效的輸入值"}}};function Ry(){return{localeError:Dy()}}const Oy=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function r(t){return e[t]??null}const i={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},a={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return t=>{switch(t.code){case"invalid_type":{const n=a[t.expected]??t.expected,o=R(t.input),s=a[o]??o;return/^[A-Z]/.test(t.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${t.expected}, àmọ̀ a rí ${s}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${n}, àmọ̀ a rí ${s}`}case"invalid_value":return t.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${T(t.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${w(t.values,"|")}`;case"too_big":{const n=t.inclusive?"<=":"<",o=r(t.origin);return o?`Tó pọ̀ jù: a ní láti jẹ́ pé ${t.origin??"iye"} ${o.verb} ${n}${t.maximum} ${o.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${t.maximum}`}case"too_small":{const n=t.inclusive?">=":">",o=r(t.origin);return o?`Kéré ju: a ní láti jẹ́ pé ${t.origin} ${o.verb} ${n}${t.minimum} ${o.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${t.minimum}`}
1case"invalid_format":{const n=t;return n.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${n.prefix}"`:n.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${n.suffix}"`:n.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${n.includes}"`:n.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${n.pattern}`:`Aṣìṣe: ${i[n.format]??t.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${t.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${w(t.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${t.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${t.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function Cy(){return{localeError:Oy()}}const ii=Object.freeze(Object.defineProperty({__proto__:null,ar:Qh,az:Yh,be:tg,bg:ng,ca:ag,cs:sg,da:dg,de:lg,en:td,eo:pg,es:gg,fa:vg,fi:bg,fr:kg,frCA:Ig,he:Ag,hu:Eg,hy:Tg,id:Rg,is:Cg,it:Lg,ja:zg,ka:Kg,kh:Wg,km:rd,ko:Jg,lt:Mg,mk:Fg,ms:Gg,nl:Xg,no:ey,ota:ry,pl:oy,ps:iy,pt:cy,ru:uy,sl:fy,sv:py,ta:gy,th:vy,tr:by,ua:ky,uk:nd,ur:Iy,uz:Ay,vi:Ey,yo:Cy,zhCN:Ty,zhTW:Ry},Symbol.toStringTag,{value:"Module"}));class Py{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=Yi({processors:zd,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return ea(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),ta(this.ctx,r);const a=ra(this.ctx,r),{"~standard":t,...n}=a;return n}}const Ly=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),id=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:jd,$ZodArray:Kd,$ZodAsyncError:Hd,$ZodBase64:Wd,$ZodBase64URL:Vd,$ZodBigInt:Jd,$ZodBigIntFormat:Bd,$ZodBoolean:Md,$ZodCIDRv4:qd,$ZodCIDRv6:Fd,$ZodCUID:Zd,$ZodCUID2:Gd,$ZodCatch:Qd,$ZodCheck:Xd,$ZodCheckBigIntFormat:Yd,$ZodCheckEndsWith:eu,$ZodCheckGreaterThan:tu,$ZodCheckIncludes:ru,$ZodCheckLengthEquals:nu,$ZodCheckLessThan:iu,$ZodCheckLowerCase:au,$ZodCheckMaxLength:ou,$ZodCheckMaxSize:su,$ZodCheckMimeType:cu,$ZodCheckMinLength:du,$ZodCheckMinSize:uu,$ZodCheckMultipleOf:lu,$ZodCheckNumberFormat:fu,$ZodCheckOverwrite:mu,$ZodCheckProperty:pu,$ZodCheckRegex:hu,$ZodCheckSizeEquals:gu,$ZodCheckStartsWith:yu,$ZodCheckStringFormat:vu,$ZodCheckUpperCase:wu,$ZodCodec:bu,$ZodCustom:$u,$ZodCustomStringFormat:ku,$ZodDate:Su,$ZodDefault:Iu,$ZodDiscriminatedUnion:_u,$ZodE164:Au,$ZodEmail:Uu,$ZodEmoji:Eu,$ZodEncodeError:xu,$ZodEnum:Tu,$ZodError:Du,$ZodExactOptional:Ru,$ZodFile:Ou,$ZodFunction:Cu,$ZodGUID:Pu,$ZodIPv4:Lu,$ZodIPv6:Nu,$ZodISODate:zu,$ZodISODateTime:ju,$ZodISODuration:Ku,$ZodISOTime:Hu,$ZodIntersection:Wu,$ZodJWT:Vu,$ZodKSUID:Ju,$ZodLazy:Bu,$ZodLiteral:Mu,$ZodMAC:qu,$ZodMap:Fu,$ZodNaN:Zu,$ZodNanoID:Gu,$ZodNever:Qu,$ZodNonOptional:Xu,$ZodNull:Yu,$ZodNullable:el,$ZodNumber:tl,$ZodNumberFormat:rl,$ZodObject:nl,$ZodObjectJIT:il,$ZodOptional:al,$ZodPipe:ol,$ZodPrefault:sl,$ZodPromise:cl,$ZodReadonly:dl,$ZodRealError:ul,$ZodRecord:ll,$ZodRegistry:fl,$ZodSet:ml,$ZodString:pl,$ZodStringFormat:hl,$ZodSuccess:gl,$ZodSymbol:yl,$ZodTemplateLiteral:vl,$ZodTransform:wl,$ZodTuple:bl,$ZodType:$l,$ZodULID:kl,$ZodURL:Sl,$ZodUUID:Il,$ZodUndefined:_l,$ZodUnion:Al,$ZodUnknown:Ul,$ZodVoid:El,$ZodXID:xl,$ZodXor:Tl,$brand:An,$constructor:Dl,$input:Un,$output:En,Doc:Rl,JSONSchema:Ly,JSONSchemaGenerator:Py,NEVER:xn,TimePrecision:Tn,_any:Ol,_array:Cl,_base64:Pl,_base64url:Ll,_bigint:Nl,_boolean:zl,_catch:jl,_check:Kl,_cidrv4:Hl,_cidrv6:Wl,_coercedBigint:na,_coercedBoolean:ia,_coercedDate:aa,_coercedNumber:oa,_coercedString:sa,_cuid:Vl,_cuid2:Jl,_custom:Bl,_date:Ml,_decode:ql,_decodeAsync:Fl,_default:Zl,_discriminatedUnion:Gl,_e164:Ql,_email:Xl,_emoji:Yl,_encode:ef,_encodeAsync:tf,_endsWith:cr,_enum:rf,_file:nf,_float32:af,_float64:of,_gt:dr,_gte:Dt,_guid:sf,_includes:ur,_int:cf,_int32:df,_int64:uf,_intersection:lf,_ipv4:ff,_ipv6:mf,_isoDate:pf,_isoDateTime:hf,_isoDuration:gf,_isoTime:yf,_jwt:vf,_ksuid:wf,_lazy:bf,_length:lr,_literal:$f,_lowercase:fr,_lt:mr,_lte:Rt,_mac:kf,_map:Sf,_max:Rt,_maxLength:pr,_maxSize:hr,_mime:gr,_min:Dt,_minLength:yr,_minSize:vr,_multipleOf:wr,_nan:If,_nanoid:_f,_nativeEnum:Af,_negative:br,_never:Uf,_nonnegative:$r,_nonoptional:Ef,_nonpositive:kr,_normalize:Sr,_null:xf,_nullable:Tf,_number:Df,_optional:Rf,_overwrite:Ir,_parse:Of,_parseAsync:Cf,_pipe:Pf,_positive:_r,_promise:Lf,_property:Ar,_readonly:Nf,_record:zf,_refine:jf,_regex:Ur,_safeDecode:Kf,_safeDecodeAsync:Hf,_safeEncode:Wf,_safeEncodeAsync:Vf,_safeParse:Jf,_safeParseAsync:Bf,_set:Mf,_size:Er,_slugify:xr,_startsWith:Tr,_string:qf,_stringFormat:Ff,_stringbool:Zf,_success:Gf,_superRefine:Qf,_symbol:Xf,_templateLiteral
1:Yf,_toLowerCase:Dr,_toUpperCase:Rr,_transform:em,_trim:Or,_tuple:tm,_uint32:rm,_uint64:nm,_ulid:im,_undefined:am,_union:om,_unknown:sm,_uppercase:Cr,_url:cm,_uuid:dm,_uuidv4:um,_uuidv6:lm,_uuidv7:fm,_void:mm,_xid:pm,_xor:hm,clone:Dn,config:vt,createStandardJSONSchemaMethod:gm,createToJSONSchemaMethod:ym,decode:vm,decodeAsync:wm,describe:bm,encode:$m,encodeAsync:km,extractDefs:ta,finalize:ra,flattenError:Rn,formatError:On,globalConfig:Sm,globalRegistry:Pr,initializeContext:Yi,isValidBase64:Im,isValidBase64URL:_m,isValidJWT:Am,locales:ii,meta:Um,parse:Em,parseAsync:xm,prettifyError:Cn,process:ea,regexes:Pn,registry:Ln,safeDecode:Tm,safeDecodeAsync:Dm,safeEncode:Rm,safeEncodeAsync:Om,safeParse:Cm,safeParseAsync:Pm,toDotPath:Lm,toJSONSchema:Nn,treeifyError:zn,util:jn,version:Nm},Symbol.toStringTag,{value:"Module"})),Ny=Object.freeze(Object.defineProperty({__proto__:null,endsWith:cr,gt:dr,gte:Dt,includes:ur,length:lr,lowercase:fr,lt:mr,lte:Rt,maxLength:pr,maxSize:hr,mime:gr,minLength:yr,minSize:vr,multipleOf:wr,negative:br,nonnegative:$r,nonpositive:kr,normalize:Sr,overwrite:Ir,positive:_r,property:Ar,regex:Ur,size:Er,slugify:xr,startsWith:Tr,toLowerCase:Dr,toUpperCase:Rr,trim:Or,uppercase:Cr},Symbol.toStringTag,{value:"Module"})),ad={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function od(e){vt({customError:e})}function sd(){return vt().customError}var or;or||(or={});const S={...zm,...Ny,iso:Kn},zy=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function jy(e,r){const i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}function Ky(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;const a=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===a){const t=i[1];if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}function cd(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return S.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return S.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);const n=Ky(t,r),o=de(n,r);return r.refs.set(t,o),r.processing.delete(t),o}if(e.enum!==void 0){const t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return S.null();if(t.length===0)return S.never();if(t.length===1)return S.literal(t[0]);if(t.every(o=>
vendor: 4,796 bytes, line 1
1typeof o=="string"))return S.enum(t);const n=t.map(o=>S.literal(o));return n.length<2?n[0]:S.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return S.literal(e.const);const i=e.type;if(Array.isArray(i)){const t=i.map(n=>{const o={...e,type:n};return cd(o,r)});return t.length===0?S.never():t.length===1?t[0]:S.union(t)}if(!i)return S.any();let a;switch(i){case"string":{let t=S.string();if(e.format){const n=e.format;n==="email"?t=t.check(S.email()):n==="uri"||n==="uri-reference"?t=t.check(S.url()):n==="uuid"||n==="guid"?t=t.check(S.uuid()):n==="date-time"?t=t.check(S.iso.datetime()):n==="date"?t=t.check(S.iso.date()):n==="time"?t=t.check(S.iso.time()):n==="duration"?t=t.check(S.iso.duration()):n==="ipv4"?t=t.check(S.ipv4()):n==="ipv6"?t=t.check(S.ipv6()):n==="mac"?t=t.check(S.mac()):n==="cidr"?t=t.check(S.cidrv4()):n==="cidr-v6"?t=t.check(S.cidrv6()):n==="base64"?t=t.check(S.base64()):n==="base64url"?t=t.check(S.base64url()):n==="e164"?t=t.check(S.e164()):n==="jwt"?t=t.check(S.jwt()):n==="emoji"?t=t.check(S.emoji()):n==="nanoid"?t=t.check(S.nanoid()):n==="cuid"?t=t.check(S.cuid()):n==="cuid2"?t=t.check(S.cuid2()):n==="ulid"?t=t.check(S.ulid()):n==="xid"?t=t.check(S.xid()):n==="ksuid"&&(t=t.check(S.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),a=t;break}case"number":case"integer":{let t=i==="integer"?S.number().int():S.number();typeof e.minimum=="number"&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),a=t;break}case"boolean":{a=S.boolean();break}case"null":{a=S.null();break}case"object":{const t={},n=e.properties||{},o=new Set(e.required||[]);for(const[c,d]of Object.entries(n)){const u=de(d,r);t[c]=o.has(c)?u:u.optional()}if(e.propertyNames){const c=de(e.propertyNames,r),d=e.additionalProperties&&typeof e.additionalProperties=="object"?de(e.additionalProperties,r):S.any();if(Object.keys(t).length===0){a=S.record(c,d);break}const u=S.object(t).passthrough(),f=S.looseRecord(c,d);a=S.intersection(u,f);break}if(e.patternProperties){const c=e.patternProperties,d=Object.keys(c),u=[];for(const l of d){const m=de(c[l],r),h=S.string().regex(new RegExp(l));u.push(S.looseRecord(h,m))}const f=[];if(Object.keys(t).length>0&&f.push(S.object(t).passthrough()),f.push(...u),f.length===0)a=S.object({}).passthrough();else if(f.length===1)a=f[0];else{let l=S.intersection(f[0],f[1]);for(let m=2;m<f.length;m++)l=S.intersection(l,f[m]);a=l}break}const s=S.object(t);e.additionalProperties===!1?a=s.strict():typeof e.additionalProperties=="object"?a=s.catchall(de(e.additionalProperties,r)):a=s.passthrough();break}case"array":{const t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){const o=t.map(c=>de(c,r)),s=n&&typeof n=="object"&&!Array.isArray(n)?de(n,r):void 0;s?a=S.tuple(o).rest(s):a=S.tuple(o),typeof e.minItems=="number"&&(a=a.check(S.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(S.maxLength(e.maxItems)))}else if(Array.isArray(n)){const o=n.map(c=>de(c,r)),s=e.additionalItems&&typeof e.additionalItems=="object"?de(e.additionalItems,r):void 0;s?a=S.tuple(o).rest(s):a=S.tuple(o),typeof e.minItems=="number"&&(a=a.check(S.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(S.maxLength(e.maxItems)))}else if(n!==void 0){const o=de(n,r);let s=S.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),a=s}else a=S.array(S.any());break}default:throw new Error(`Unsupported type: ${i}`)}return e.description&&(a=a.describe(e.description)),e.default!==void 0&&(a=a.default(e.default)),a}function de(e,r){if(typeof e=="boolean")return e?S.any():S.never();let i=cd(e,r);const a=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const s=e.anyOf.map(d=>de(d,r)),c=S.union(s);i=a?S.intersection(i,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){const s=e.oneOf.map(d=>de(d,r)),c=S.xor(s);i=a?S.intersection(i,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=a?i:S.any();else{let s=a?i:de(e.allOf[0],r);const c=a?0:1;for(let d=c;d<e.allOf.length;d++)s=S.intersection(s,de(e.allOf[d],r));i=s}e.nullable===!0&&r.version==="openapi-3.0"&&(i=S.nullable(i)),e.readOnly===!0&&(i=S.readonly(i));const t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(const s of n)s in e&&(t[s]=e[s]);const o=["contentEncoding","contentMediaType","contentSchema"];
1for(const s of o)s in e&&(t[s]=e[s]);for(const s of Object.keys(e))zy.has(s)||(t[s]=e[s]);return Object.keys(t).length>0&&r.registry.add(i,t),i}function dd(e,r){if(typeof e=="boolean")return e?S.any():S.never();const i=jy(e,r?.defaultTarget),a=e.$defs||e.definitions||{},t={version:i,defs:a,refs:new Map,processing:new Set,rootSchema:e,registry:r?.registry??Pr};return de(e,t)}function Wr(e){return sa(Hn,e)}function Hy(e){return oa(Vn,e)}function yn(e){return ia(Wn,e)}function Wy(e){return na(Jn,e)}function Vy(e){return aa(Bn,e)}const ud=Object.freeze(Object.defineProperty({__proto__:null,bigint:Wy,boolean:yn,date:Vy,number:Hy,string:Wr},Symbol.toStringTag,{value:"Module"}));vt(td());const zi=Object.freeze(Object.defineProperty({__proto__:null,$brand:An,$input:Un,$output:En,NEVER:xn,TimePrecision:Tn,ZodAny:ca,ZodArray:da,ZodBase64:ua,ZodBase64URL:la,ZodBigInt:Jn,ZodBigIntFormat:fa,ZodBoolean:Wn,ZodCIDRv4:ma,ZodCIDRv6:pa,ZodCUID:ha,ZodCUID2:ga,ZodCatch:ya,ZodCodec:va,ZodCustom:wa,ZodCustomStringFormat:ba,ZodDate:Bn,ZodDefault:$a,ZodDiscriminatedUnion:ka,ZodE164:Sa,ZodEmail:Ia,ZodEmoji:_a,ZodEnum:Aa,ZodError:Ua,ZodExactOptional:Ea,ZodFile:xa,get ZodFirstPartyTypeKind(){return or},ZodFunction:Ta,ZodGUID:Da,ZodIPv4:Ra,ZodIPv6:Oa,ZodISODate:Ca,ZodISODateTime:Pa,ZodISODuration:La,ZodISOTime:Na,ZodIntersection:za,ZodIssueCode:ad,ZodJWT:ja,ZodKSUID:Ka,ZodLazy:Ha,ZodLiteral:Wa,ZodMAC:Va,ZodMap:Ja,ZodNaN:Ba,ZodNanoID:Ma,ZodNever:qa,ZodNonOptional:Fa,ZodNull:Za,ZodNullable:Ga,ZodNumber:Vn,ZodNumberFormat:Qa,ZodObject:Xa,ZodOptional:Ya,ZodPipe:eo,ZodPrefault:to,ZodPromise:ro,ZodReadonly:no,ZodRealError:io,ZodRecord:ao,ZodSet:oo,ZodString:Hn,ZodStringFormat:so,ZodSuccess:co,ZodSymbol:uo,ZodTemplateLiteral:lo,ZodTransform:fo,ZodTuple:mo,ZodType:po,ZodULID:ho,ZodURL:go,ZodUUID:yo,ZodUndefined:vo,ZodUnion:wo,ZodUnknown:bo,ZodVoid:$o,ZodXID:ko,ZodXor:So,_ZodString:Io,_default:_o,_function:Xt,any:De,array:pt,base64:Ao,base64url:Uo,bigint:Eo,boolean:Ae,catch:xo,check:To,cidrv4:Do,cidrv6:Ro,clone:Dn,codec:Oo,coerce:ud,config:vt,core:id,cuid:Co,cuid2:Po,custom:Lo,date:Ke,decode:No,decodeAsync:zo,describe:jo,discriminatedUnion:Ko,e164:Ho,email:Ge,emoji:Wo,encode:Vo,encodeAsync:Jo,endsWith:cr,enum:Mn,exactOptional:Bo,file:Mo,flattenError:Rn,float32:qo,float64:Fo,formatError:On,fromJSONSchema:dd,function:Xt,getErrorMap:sd,globalRegistry:Pr,gt:dr,gte:Dt,guid:Zo,hash:Go,hex:Qo,hostname:Xo,httpUrl:Yo,includes:ur,instanceof:es,int:ts,int32:rs,int64:ns,intersection:is,ipv4:ht,ipv6:Lr,iso:Kn,json:Yt,jwt:as,keyof:os,ksuid:ss,lazy:cs,length:lr,literal:ds,locales:ii,looseObject:qn,looseRecord:us,lowercase:fr,lt:mr,lte:Rt,mac:ls,map:fs,maxLength:pr,maxSize:hr,meta:ms,mime:gr,minLength:yr,minSize:vr,multipleOf:wr,nan:ps,nanoid:hs,nativeEnum:gs,negative:br,never:ys,nonnegative:$r,nonoptional:vs,nonpositive:kr,normalize:Sr,null:ws,nullable:bs,nullish:$s,number:Ze,object:W,optional:Nt,overwrite:Ir,parse:ks,parseAsync:Ss,partialRecord:Is,pipe:_s,positive:_r,prefault:As,preprocess:Us,prettifyError:Cn,promise:Es,property:Ar,readonly:xs,record:Qe,refine:Ts,regex:Ur,regexes:Pn,registry:Ln,safeDecode:Ds,safeDecodeAsync:Rs,safeEncode:Os,safeEncodeAsync:Cs,safeParse:Ps,safeParseAsync:Ls,set:Ns,setErrorMap:od,size:Er,slugify:xr,startsWith:Tr,strictObject:zs,string:b,stringFormat:js,stringbool:Ks,success:Hs,superRefine:Ws,symbol:Vs,templateLiteral:Js,toJSONSchema:Nn,toLowerCase:Dr,toUpperCase:Rr,transform:Bs,treeifyError:zn,trim:Or,tuple:Ms,uint32:qs,uint64:Fs,ulid:Zs,undefined:Gs,union:Qs,unknown:Xs,uppercase:Cr,url:Ys,util:jn,uuid:ec,uuidv4:tc,uuidv6:rc,uuidv7:nc,void:ic,xid:ac,xor:oc},Symbol.toStringTag,{value:"Module"})),Jy=Object.freeze(Object.defineProperty({__proto__:null,$brand:An,$input:Un,$output:En,NEVER:xn,TimePrecision:Tn,ZodAny:ca,ZodArray:da,ZodBase64:ua,ZodBase64URL:la,ZodBigInt:Jn,ZodBigIntFormat:fa,ZodBoolean:Wn,ZodCIDRv4:ma,ZodCIDRv6:pa,ZodCUID:ha,ZodCUID2:ga,ZodCatch:ya,ZodCodec:va,ZodCustom:wa,ZodCustomStringFormat:ba,ZodDate:Bn,ZodDefault:$a,ZodDiscriminatedUnion:ka,ZodE164:Sa,ZodEmail:Ia,ZodEmoji:_a,ZodEnum:Aa,ZodError:Ua,ZodExactOptional:Ea,ZodFile:xa,get ZodFirstPartyTypeKind(){return or},ZodFunction:Ta,ZodGUID:Da,ZodIPv4:Ra,ZodIPv6:Oa,ZodISODate:Ca,ZodISODateTime:Pa,ZodISODuration:La,ZodISOTime:Na,ZodIntersection:za,ZodIssueCode:ad,ZodJWT:ja,ZodKSUID:Ka,ZodLazy:Ha,ZodLiteral:Wa,ZodMAC:Va,ZodMap:Ja,ZodNaN:Ba,ZodNanoID:Ma,ZodNever:qa,ZodNonOptional:Fa,ZodNull:Za,ZodNullable:Ga,ZodNumber:Vn,ZodNumberFormat:Qa,ZodObject:Xa,ZodOptional:Ya,ZodPipe:eo,ZodPrefault:to,ZodPromise:ro,ZodReadonly:no,ZodRealError:io,ZodRecord:ao,ZodSet:oo,ZodString:Hn,ZodStringFormat:so,ZodSuccess:co,ZodSymbol:uo,ZodTemplateLiteral
1:lo,ZodTransform:fo,ZodTuple:mo,ZodType:po,ZodULID:ho,ZodURL:go,ZodUUID:yo,ZodUndefined:vo,ZodUnion:wo,ZodUnknown:bo,ZodVoid:$o,ZodXID:ko,ZodXor:So,_ZodString:Io,_default:_o,_function:Xt,any:De,array:pt,base64:Ao,base64url:Uo,bigint:Eo,boolean:Ae,catch:xo,check:To,cidrv4:Do,cidrv6:Ro,clone:Dn,codec:Oo,coerce:ud,config:vt,core:id,cuid:Co,cuid2:Po,custom:Lo,date:Ke,decode:No,decodeAsync:zo,default:zi,describe:jo,discriminatedUnion:Ko,e164:Ho,email:Ge,emoji:Wo,encode:Vo,encodeAsync:Jo,endsWith:cr,enum:Mn,exactOptional:Bo,file:Mo,flattenError:Rn,float32:qo,float64:Fo,formatError:On,fromJSONSchema:dd,function:Xt,getErrorMap:sd,globalRegistry:Pr,gt:dr,gte:Dt,guid:Zo,hash:Go,hex:Qo,hostname:Xo,httpUrl:Yo,includes:ur,instanceof:es,int:ts,int32:rs,int64:ns,intersection:is,ipv4:ht,ipv6:Lr,iso:Kn,json:Yt,jwt:as,keyof:os,ksuid:ss,lazy:cs,length:lr,literal:ds,locales:ii,looseObject:qn,looseRecord:us,lowercase:fr,lt:mr,lte:Rt,mac:ls,map:fs,maxLength:pr,maxSize:hr,meta:ms,mime:gr,minLength:yr,minSize:vr,multipleOf:wr,nan:ps,nanoid:hs,nativeEnum:gs,negative:br,never:ys,nonnegative:$r,nonoptional:vs,nonpositive:kr,normalize:Sr,null:ws,nullable:bs,nullish:$s,number:Ze,object:W,optional:Nt,overwrite:Ir,parse:ks,parseAsync:Ss,partialRecord:Is,pipe:_s,positive:_r,prefault:As,preprocess:Us,prettifyError:Cn,promise:Es,property:Ar,readonly:xs,record:Qe,refine:Ts,regex:Ur,regexes:Pn,registry:Ln,safeDecode:Ds,safeDecodeAsync:Rs,safeEncode:Os,safeEncodeAsync:Cs,safeParse:Ps,safeParseAsync:Ls,set:Ns,setErrorMap:od,size:Er,slugify:xr,startsWith:Tr,strictObject:zs,string:b,stringFormat:js,stringbool:Ks,success:Hs,superRefine:Ws,symbol:Vs,templateLiteral:Js,toJSONSchema:Nn,toLowerCase:Dr,toUpperCase:Rr,transform:Bs,treeifyError:zn,trim:Or,tuple:Ms,uint32:qs,uint64:Fs,ulid:Zs,undefined:Gs,union:Qs,unknown:Xs,uppercase:Cr,url:Ys,util:jn,uuid:ec,uuidv4:tc,uuidv6:rc,uuidv7:nc,void:ic,xid:ac,xor:oc,z:zi},Symbol.toStringTag,{value:"Module"})),Ht=W({id:b(),createdAt:Ke().default(()=>new Date),updatedAt:Ke().default(()=>new Date)}),By=Ht.extend({providerId:b(),accountId:b(),userId:Wr(),accessToken:b().nullish(),refreshToken:b().nullish(),idToken:b().nullish(),accessTokenExpiresAt:Ke().nullish(),refreshTokenExpiresAt:Ke().nullish(),scope:b().nullish(),password:b().nullish()}),My=W({key:b(),count:Ze(),lastRequest:Ze()}),qy=Ht.extend({userId:Wr(),expiresAt:Ke(),token:b(),ipAddress:b().nullish(),userAgent:b().nullish()}),Fy=Ht.extend({email:b().transform(e=>e.toLowerCase()),emailVerified:Ae().default(!1),name:b(),image:b().nullish()}),Zy=Ht.extend({value:b(),expiresAt:Ke(),identifier:b()}),Gy=Object.freeze(Object.defineProperty({__proto__:null,accountSchema:By,coreSchema:Ht,getAuthTables:ni,rateLimitSchema:My,sessionSchema:qy,userSchema:Fy,verificationSchema:Zy},Symbol.toStringTag,{value:"Module"}));function Vr(e,r){if(!e||!r)return e;const i=Object.entries(r).filter(([,{returned:a}])=>a===!1).map(([a])=>a);return Object.entries(structuredClone(e)).filter(([a])=>!i.includes(a)).reduce((a,[t,n])=>({...a,[t]:n}),{})}const Qr=new WeakMap;function Ve(e,r,i){const a=`${r}:${i}`;Qr.has(e)||Qr.set(e,new Map);const t=Qr.get(e);if(t.has(a))return t.get(a);const n=i==="output"?ni(e)[r]?.fields??{}:{},o=r==="user"||r==="session"||r==="account"?e[r]?.additionalFields:void 0;let s={...n,...o??{}};for(const c of e.plugins||[])c.schema&&c.schema[r]&&(s={...s,...c.schema[r].fields});return t.set(a,s),s}function he(e,r){return Vr(r,Ve(e,"user","output"))}function ye(e,r){return Vr(r,Ve(e,"session","output"))}function ld(e,r){const{accessToken:i,refreshToken:a,idToken:t,accessTokenExpiresAt:n,refreshTokenExpiresAt:o,password:s,...c}=Vr(r,Ve(e,"account","output"));return c}function Wt(e,r){const i=r.action||"create",a=r.fields,t=Object.create(null);for(const n in a){if(n in e){if(a[n].input===!1){if(a[n].defaultValue!==void 0&&i!=="update"){t[n]=a[n].defaultValue;continue}if(e[n])throw $.from("BAD_REQUEST",{..._.FIELD_NOT_ALLOWED,message:`${n} is not allowed to be set`});continue}if(a[n].validator?.input&&e[n]!==void 0){const o=a[n].validator.input["~standard"].validate(e[n]);if(o instanceof Promise)throw $.from("INTERNAL_SERVER_ERROR",_.ASYNC_VALIDATION_NOT_SUPPORTED);if("issues"in o&&o.issues)throw $.from("BAD_REQUEST",{..._.VALIDATION_ERROR,message:o.issues[0]?.message||"Validation Error"});t[n]=o.value;continue}if(a[n].transform?.input&&e[n]!==void 0){t[n]=a[n].transform?.input(e[n]);continue}t[n]=e[n];continue}if(a[n].defaultValue!==void 0&&i==="create"){if(typeof a[n].defaultValue=="function"){t[n]=a[n].defaultValue();continue}t[n]=a[n].defaultValue;continue}if(a[n].required&&i==="create")throw $.from("BAD_REQUEST",{..._.MISSING_FIELD,message:`${n} is required`})}return t}function Qy(e,r={},i){return Wt(r,{fields:Ve(e,"user","input"),action:i})}function Xy(e,r){const i=Ve(e,"user","input");return Wt(r||{},{fields:i})}
1function Yy(e,r){return Wt(r,{fields:Ve(e,"account","input")})}function ev(e,r,i){return Wt(r,{fields:Ve(e,"session","input"),action:i})}function fd(e){const r=Ve(e,"session","input"),i={};for(const a in r)r[a].defaultValue!==void 0&&(i[a]=typeof r[a].defaultValue=="function"?r[a].defaultValue():r[a].defaultValue);return i}function tv(e,r){if(!r)return e;for(const i in r){const a=r[i]?.modelName;a&&(e[i].modelName=a);for(const t in e[i].fields){const n=r[i]?.fields?.[t];n&&(e[i].fields[t].fieldName=n)}}return e}function rv(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}const nv=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;function md(e){if(typeof e=="string"&&nv.test(e)){const r=new Date(e);if(!isNaN(r.getTime()))return r}return e}function vn(e){if(e==null)return e;if(typeof e=="string")return md(e);if(e instanceof Date)return e;if(Array.isArray(e))return e.map(vn);if(typeof e=="object"){const r={};for(const i of Object.keys(e))r[i]=vn(e[i]);return r}return e}function ce(e){try{return typeof e!="string"?e==null?null:vn(e):JSON.parse(e,(r,i)=>md(i))}catch(r){return K.error("Error parsing JSON",{error:r}),null}}const ai=4096,wn=200,Xr=ai-wn;function iv(e){const r=e.headers?.get("cookie");if(!r)return{};const i={},a=r.split("; ");for(const t of a){const[n,...o]=t.split("=");n&&o.length>0&&(i[n]=o.join("="))}return i}function ji(e){const r=e.split("."),i=r[r.length-1],a=parseInt(i||"0",10);return isNaN(a)?0:a}function av(e,r){const i={},a=iv(r);for(const[t,n]of Object.entries(a))t.startsWith(e)&&(i[t]=n);return i}function ov(e){return Object.keys(e).sort((r,i)=>ji(r)-ji(i)).map(r=>e[r]).join("")}function sv(e,r,i,a){const t=Math.ceil(r.value.length/Xr);if(t===1)return i[r.name]=r.value,[r];const n=[];for(let o=0;o<t;o++){const s=`${r.name}.${o}`,c=o*Xr,d=r.value.substring(c,c+Xr);n.push({...r,name:s,value:d}),i[s]=d}return a.debug(`CHUNKING_${e.toUpperCase()}_COOKIE`,{message:`${e} cookie exceeds allowed ${ai} bytes.`,emptyCookieSize:wn,valueSize:r.value.length,chunkCount:t,chunks:n.map(o=>o.value.length+wn)}),n}function Ki(e,r){const i={};for(const a in e)i[a]={name:a,value:"",attributes:{...r,maxAge:0}};return i}const pd=e=>(r,i,a)=>{const t=av(r,a),n=a.context.logger;return{getValue(){return ov(t)},hasChunks(){return Object.keys(t).length>0},chunk(o,s){const c=Ki(t,i);for(const f in t)delete t[f];const d=c,u=sv(e,{name:r,value:o,attributes:{...i,...s}},t,n);for(const f of u)d[f.name]=f;return Object.values(d)},clean(){const o=Ki(t,i);for(const s in t)delete t[s];return Object.values(o)},setCookies(o){for(const s of o)a.setCookie(s.name,s.value,s.attributes)}}},bn=pd("Session"),$n=pd("Account");function hd(e,r){const i=e.getCookie(r);if(i)return i;const a=[],t=e.headers?.get("cookie");if(!t)return null;const n={},o=t.split("; ");for(const s of o){const[c,...d]=s.split("=");c&&d.length>0&&(n[c]=d.join("="))}for(const[s,c]of Object.entries(n))if(s.startsWith(r+".")){const d=s.split(".").at(-1),u=parseInt(d||"0",10);isNaN(u)||a.push({index:u,value:c})}return a.length>0?(a.sort((s,c)=>s.index-c.index),a.map(s=>s.value).join("")):null}async function Pt(e,r){const i=e.context.authCookies.accountData,a={maxAge:300,...i.attributes},t=await Vc(r,e.context.secretConfig,"better-auth-account",a.maxAge);if(t.length>ai){const n=$n(i.name,a,e),o=n.chunk(t,a);n.setCookies(o)}else{const n=$n(i.name,a,e);if(n.hasChunks()){const o=n.clean();
1n.setCookies(o)}e.setCookie(i.name,t,a)}}async function Jr(e){const r=hd(e,e.context.authCookies.accountData.name);if(r){const i=ce(await Jc(r,e.context.secretConfig,"better-auth-account"));if(i)return i}return null}const cv=Nt(W({disableCookieCache:yn().meta({description:"Disable cookie cache and fetch session from database"}).optional(),disableRefresh:yn().meta({description:"Disable session refresh. Useful for checking session status, without updating the session"}).optional()})),Yr=new Map,dv=new TextEncoder,uv={decode:(e,r="utf-8")=>(Yr.has(r)||Yr.set(r,new TextDecoder(r)),Yr.get(r).decode(e)),encode:dv.encode},gd=(e="SHA-256",r="none")=>{const i={importKey:async(a,t)=>Fe().importKey("raw",typeof a=="string"?new TextEncoder().encode(a):a,{name:"HMAC",hash:{name:e}},!1,[t]),sign:async(a,t)=>{typeof a=="string"&&(a=await i.importKey(a,"sign"));const n=await Fe().sign("HMAC",a,typeof t=="string"?new TextEncoder().encode(t):t);return r==="hex"?Ai.encode(n):r==="base64"||r==="base64url"||r==="base64urlnopad"?Kt.encode(n,{padding:r!=="base64urlnopad"}):n},verify:async(a,t,n)=>(typeof a=="string"&&(a=await i.importKey(a,"verify")),r==="hex"&&(n=Ai.decode(n)),(r==="base64"||r==="base64url"||r==="base64urlnopad")&&(n=await We.decode(n)),Fe().verify("HMAC",a,typeof n=="string"?new TextEncoder().encode(n):n,typeof t=="string"?new TextEncoder().encode(t):t))};return i};async function Qt(e,r,i){if(!e.context.options.session?.cookieCache?.enabled)return;const a=Vr(r.session,e.context.options.session?.additionalFields),t=he(e.context.options,r.user),n=e.context.options.session?.cookieCache?.version;let o="1";if(n){if(typeof n=="string")o=n;else if(typeof n=="function"){const l=n(r.session,r.user);o=rv(l)?await l:l}}const s={session:a,user:t,updatedAt:Date.now(),version:o},c={...e.context.authCookies.sessionData.attributes,maxAge:i?void 0:e.context.authCookies.sessionData.attributes.maxAge},d=yt(c.maxAge||60,"sec").getTime(),u=e.context.options.session?.cookieCache?.strategy||"compact";let f;if(u==="jwe"?f=await Vc(s,e.context.secretConfig,"better-auth-session",c.maxAge||300):u==="jwt"?f=await Kc(s,e.context.secret,c.maxAge||300):f=Kt.encode(JSON.stringify({session:s,expiresAt:d,signature:await gd("SHA-256","base64urlnopad").sign(e.context.secret,JSON.stringify({...s,expiresAt:d}))}),{padding:!1}),f.length>4093){const l=bn(e.context.authCookies.sessionData.name,c,e),m=l.chunk(f,c);l.setCookies(m)}else{const l=bn(e.context.authCookies.sessionData.name,c,e);if(l.hasChunks()){const m=l.clean();l.setCookies(m)}e.setCookie(e.context.authCookies.sessionData.name,f,c)}if(e.context.options.account?.storeAccountCookie){const l=await Jr(e);l&&await Pt(e,l)}}async function ze(e,r,i,a){const t=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);i=i!==void 0?i:!!t;const n=e.context.authCookies.sessionToken.attributes,o=i?void 0:e.context.sessionConfig.expiresIn;await e.setSignedCookie(e.context.authCookies.sessionToken.name,r.session.token,e.context.secret,{...n,maxAge:o,...a}),i&&await e.setSignedCookie(e.context.authCookies.dontRememberToken.name,"true",e.context.secret,e.context.authCookies.dontRememberToken.attributes),await Qt(e,r,i),e.context.setNewSession(r)}function be(e,r){e.setCookie(r.name,"",{...r.attributes,maxAge:0})}function Lt(e,r){if(be(e,e.context.authCookies.sessionToken),be(e,e.context.authCookies.sessionData),e.context.options.account?.storeAccountCookie){be(e,e.context.authCookies.accountData);const t=$n(e.context.authCookies.accountData.name,e.context.authCookies.accountData.attributes,e),n=t.clean();t.setCookies(n)}e.context.oauthConfig.storeStateStrategy==="cookie"&&be(e,e.context.createAuthCookie("oauth_state"));const i=bn(e.context.authCookies.sessionData.name,e.context.authCookies.sessionData.attributes,e),a=i.clean();i.setCookies(a),be(e,e.context.authCookies.dontRememberToken)}const Hi=qn({callbackURL:b(),codeVerifier:b(),errorURL:b().optional(),newUserURL:b().optional(),expiresAt:Ze(),link:W({email:b(),userId:Wr()}).optional(),requestSignUp:Ae().optional()});var qe=class extends ie{code;details;constructor(e,r){super(e,r),this.code=r.code,this.details=r.details}};async function lv(e,r,i){const a=Fn(32);if(e.context.oauthConfig.storeStateStrategy==="cookie"){const s=await Yc({ke
1y:e.context.secretConfig,data:JSON.stringify(r)}),c=e.context.createAuthCookie("oauth_state",{maxAge:600});return e.setCookie(c.name,s,c.attributes),{state:a,codeVerifier:r.codeVerifier}}const t=e.context.createAuthCookie("state",{maxAge:300});await e.setSignedCookie(t.name,a,e.context.secret,t.attributes);const n=new Date;n.setMinutes(n.getMinutes()+10);const o=await e.context.internalAdapter.createVerificationValue({value:JSON.stringify(r),identifier:a,expiresAt:n});if(!o)throw new qe("Unable to create verification. Make sure the database adapter is properly working and there is a verification table in the database",{code:"state_generation_error"});return{state:o.identifier,codeVerifier:r.codeVerifier}}async function fv(e,r,i){const a=e.context.oauthConfig.storeStateStrategy;let t;if(a==="cookie"){const n=e.context.createAuthCookie("oauth_state"),o=e.getCookie(n.name);if(!o)throw new qe("State mismatch: auth state cookie not found",{code:"state_mismatch",details:{state:r}});try{const s=await ed({key:e.context.secretConfig,data:o});t=Hi.parse(JSON.parse(s))}catch(s){throw new qe("State invalid: Failed to decrypt or parse auth state",{code:"state_invalid",details:{state:r},cause:s})}be(e,n)}else{const n=await e.context.internalAdapter.findVerificationValue(r);if(!n)throw new qe("State mismatch: verification not found",{code:"state_mismatch",details:{state:r}});t=Hi.parse(JSON.parse(n.value));const o=e.context.createAuthCookie("state"),s=await e.getSignedCookie(o.name,e.context.secret);if(!e.context.oauthConfig.skipStateCookieCheck&&(!s||s!==r))throw new qe("State mismatch: State not persisted correctly",{code:"state_security_mismatch",details:{state:r}});be(e,o),await e.context.internalAdapter.deleteVerificationByIdentifier(r)}if(t.expiresAt<Date.now())throw new qe("Invalid state: request expired",{code:"state_mismatch",details:{expiresAt:t.expiresAt}});return t}const It=Symbol.for("better-auth:global");let _t=null;const mv={},en="1.5.5";function oi(){return globalThis[It]||(globalThis[It]={version:en,epoch:1,context:mv},_t=globalThis[It]),_t=globalThis[It],_t.version!==en&&(_t.version=en,_t.epoch++),globalThis[It]}var pv=class{#e=void 0;run(e,r){const i=this.#e;this.#e=e;const a=r();return a instanceof Promise?a.finally(()=>{this.#e=i}):(this.#e=i,a)}getStore(){return this.#e}};const hv=Promise.resolve().then(()=>"AsyncLocalStorage"in globalThis?globalThis.AsyncLocalStorage:pv);async function si(){const e=await hv;if(e===null)throw new Error("getAsyncLocalStorage is only available in server code");return e}const yd=async()=>{const e=oi();if(!e.context.endpointContextAsyncStorage){const r=await si();e.context.endpointContextAsyncStorage=new r}return e.context.endpointContextAsyncStorage};async function lt(){const e=(await yd()).getStore();if(!e)throw new Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");return e}async function Wi(e,r){return(await yd()).run(e,r)}const gv=async()=>{const e=oi();if(!e.context.requestStateAsyncStorage){const r=await si();e.context.requestStateAsyncStorage=new r}return e.context.requestStateAsyncStorage};async function Vi(){const e=(await gv()).getStore();if(!e)throw new Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");return e}function vd(e){const r=Object.freeze({});return{get ref(){return r},async get(){const i=await Vi();if(!i.has(r)){const a=await e();return i.set(r,a),a}return i.get(r)},async set(i){(await Vi()).set(r,i)}}}const ci=async()=>{const e=oi();if(!e.context.adapterAsyncStorage){const r=await si();e.context.adapterAsyncStorage=new r}return e.context.adapterAsyncStorage},Y=async e=>ci().then(r=>r.getStore()?.adapter||e).catch(()=>e),yv=async(e,r)=>{let i=!0;return ci().then(async a=>{i=!0;const t=[];let n,o,s=!1;try{n=await e.transaction(async c=>a.run({adapter:c,pendingHooks:t},r))}catch(c){s=!0,o=c}for(const c of t)await c();if(s)throw o;return n}).catch(a=>{if(!i)return r();throw a})},At=async e=>ci().then(r=>{const i=r.getStore();if(i)i.pendingHooks.push(e);else return e()}).catch(()=>e()),{set:wd}=vd(()=>null);async function vv(e,r,i){const a=e.body?.callbackURL||e.context.options.baseURL;if(!a)throw $.from("BAD_REQUEST",_.CALLBACK_URL_REQUIRED);const t=Fn(128),n={...i||{},callbackURL:a,codeVerifier:t,errorURL:e.body?.errorCallbackURL,newUserURL:e.body?.newUserCallbackURL,link:r,expiresAt:Date.now()+600*1e3,requestSignUp:e.body?.requestSignUp};await wd(n);try{return lv(e,n)}catch(o){throw e.context.logger.error("Failed to create verification",o),new $("INTERNAL_SERVER_ERROR",{message:"Unable to create verification",cause:o})}}async function wv(e){const r=e.query.state||e.body.state,i=e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`;let a;try{a=await fv(e,r)}catch(t){throw e.context.logger.error("Failed to parse state",t),t instanceof qe&&t.code==="state_security_mismatch"?e.redirect(`${i}?error=state_mismatch`):e.redirect(`${i}?error=please_restart_the_process`)}return a.errorURL||(a.errorURL=i),a&&await wd(a),a}const di={scope:"server"};function ui(e){return e instanceof Tt||e?.name==="APIError"}
1function bv(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}async function $v(e){try{return{data:await e,error:null}}catch(r){return{data:null,error:r}}}function kv(e){return e instanceof Request||Object.prototype.toString.call(e)==="[object Request]"}function Sv(e){if(e===void 0)return!1;const r=typeof e;return r==="string"||r==="number"||r==="boolean"||r===null?!0:r!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Iv(e,r,i){let a=0;const t=new WeakMap;return JSON.stringify(e,(o,s)=>{if(typeof s=="bigint")return s.toString();if(typeof s=="object"&&s!==null){if(t.has(s))return`[Circular ref-${t.get(s)}]`;t.set(s,a++)}return s},i)}function _v(e){return!e||typeof e!="object"?!1:"_flag"in e&&e._flag==="json"}function bd(e,r){if(e instanceof Response)return r?.headers instanceof Headers&&r.headers.forEach((t,n)=>{e.headers.set(n,t)}),e;if(_v(e)){const t=e.body,n=e.routerResponse;if(n instanceof Response)return n;const o=new Headers;if(n?.headers){const s=new Headers(n.headers);for(const[c,d]of s.entries())s.set(c,d)}if(e.headers)for(const[s,c]of new Headers(e.headers).entries())o.set(s,c);if(r?.headers)for(const[s,c]of new Headers(r.headers).entries())o.set(s,c);return o.set("Content-Type","application/json"),new Response(JSON.stringify(t),{...n,headers:o,status:e.status??r?.status??n?.status,statusText:r?.statusText??n?.statusText})}if(ui(e))return bd(e.body,{status:r?.status??e.statusCode,statusText:e.status.toString(),headers:r?.headers||e.headers});let i=e,a=new Headers(r?.headers);return e?typeof e=="string"?(i=e,a.set("Content-Type","text/plain")):e instanceof ArrayBuffer||ArrayBuffer.isView(e)?(i=e,a.set("Content-Type","application/octet-stream")):e instanceof Blob?(i=e,a.set("Content-Type",e.type||"application/octet-stream")):e instanceof FormData?i=e:e instanceof URLSearchParams?(i=e,a.set("Content-Type","application/x-www-form-urlencoded")):e instanceof ReadableStream?(i=e,a.set("Content-Type","application/octet-stream")):Sv(e)&&(i=Iv(e),a.set("Content-Type","application/json")):(e===null&&(i=JSON.stringify(null)),a.set("content-type","application/json")),new Response(i,{...r,headers:a})}const li={name:"HMAC",hash:"SHA-256"},$d=async e=>{const r=typeof e=="string"?new TextEncoder().encode(e):e;return await Fe().importKey("raw",r,li,!1,["sign","verify"])},Av=async(e,r,i)=>{try{const a=atob(e),t=new Uint8Array(a.length);for(let n=0,o=a.length;n<o;n++)t[n]=a.charCodeAt(n);return await Fe().verify(li,i,t,new TextEncoder().encode(r))}catch{return!1}},Uv=async(e,r)=>{const i=await $d(r),a=await Fe().sign(li.name,i,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(a)))},Ev=async(e,r)=>{const i=await Uv(e,r);return e=`${e}.${i}`,e=encodeURIComponent(e),e},Ji=(e,r)=>{let i=e;if(r)if(r==="secure")i="__Secure-"+e;else if(r==="host")i="__Host-"+e;else return;return i};function xv(e){if(typeof e!="string")throw new TypeError("argument str must be a string");const r=new Map;let i=0;for(;i<e.length;){const a=e.indexOf("=",i);if(a===-1)break;let t=e.indexOf(";",i);if(t===-1)t=e.length;else if(t<a){i=e.lastIndexOf(";",a-1)+1;continue}const n=e.slice(i,a).trim();if(!r.has(n)){let o=e.slice(a+1,t).trim();o.codePointAt(0)===34&&(o=o.slice(1,-1)),r.set(n,bv(o))}i=t+1}return r}const kd=(e,r,i={})=>{let a;if(i?.prefix==="secure"?a=`${`__Secure-${e}`}=${r}`:i?.prefix==="host"?a=`${`__Host-${e}`}=${r}`:a=`${e}=${r}`,e.startsWith("__Secure-")&&!i.secure&&(i.secure=!0),e.startsWith("__Host-")&&(i.secure||(i.secure=!0),i.path!=="/"&&(i.path="/"),i.domain&&(i.domain=void 0)),i&&typeof i.maxAge=="number"&&i.maxAge>=0){if(i.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");a+=`; Max-Age=${Math.floor(i.maxAge)}`}if(i.domain&&i.prefix!=="host"&&(a+=`; Domain=${i.domain}`),i.path&&(a+=`; Path=${i.path}`),i.expires){if(i.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");a+=`; Expires=${i.expires.toUTCString()}`}return i.httpOnly&&(a+="; HttpOnly"),i.secure&&(a+="; Secure"),i.sameSite&&(a+=`; SameSite=${i.sameSite.charAt(0).toUpperCase()+i.sameSite.slice(1)}`),i.partitioned&&(i.secure||(i.secure=!0),a+="; Partitioned"),a},Tv=(e,r,i)=>
1(r=encodeURIComponent(r),kd(e,r,i)),Dv=async(e,r,i,a)=>(r=await Ev(r,i),kd(e,r,a));async function Rv(e,r={}){let i={body:r.body,query:r.query};if(e.body){const a=await e.body["~standard"].validate(r.body);if(a.issues)return{data:null,error:Bi(a.issues,"body")};i.body=a.value}if(e.query){const a=await e.query["~standard"].validate(r.query);if(a.issues)return{data:null,error:Bi(a.issues,"query")};i.query=a.value}return e.requireHeaders&&!r.headers?{data:null,error:{message:"Headers is required",issues:[]}}:e.requireRequest&&!r.request?{data:null,error:{message:"Request is required",issues:[]}}:{data:i,error:null}}function Bi(e,r){return{message:e.map(i=>`[${i.path?.length?`${r}.`+i.path.map(a=>typeof a=="object"?a.key:a).join("."):r}] ${i.message}`).join("; "),issues:e}}const Sd=async(e,{options:r,path:i})=>{const a=new Headers;let t;const{data:n,error:o}=await Rv(r,e);if(o)throw new Qi(o.message,o.issues);const s="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&kv(e.request)?e.request.headers:null,c=s?.get("cookie"),d=c?xv(c):void 0,u={...e,body:n.body,query:n.query,path:e.path||i||"virtual:",context:"context"in e&&e.context?e.context:{},returned:void 0,headers:e?.headers,request:e?.request,params:"params"in e?e.params:void 0,method:e.method??(Array.isArray(r.method)?r.method[0]:r.method==="*"?"GET":r.method),setHeader:(f,l)=>{a.set(f,l)},getHeader:f=>s?s.get(f):null,getCookie:(f,l)=>{const m=Ji(f,l);return m&&d?.get(m)||null},getSignedCookie:async(f,l,m)=>{const h=Ji(f,m);if(!h)return null;const g=d?.get(h);if(!g)return null;const p=g.lastIndexOf(".");if(p<1)return null;const y=g.substring(0,p),v=g.substring(p+1);return v.length!==44||!v.endsWith("=")?null:await Av(v,y,await $d(l))?y:!1},setCookie:(f,l,m)=>{const h=Tv(f,l,m);return a.append("set-cookie",h),h},setSignedCookie:async(f,l,m,h)=>{const g=await Dv(f,l,m,h);return a.append("set-cookie",g),g},redirect:f=>(a.set("location",f),new Tt("FOUND",void 0,a)),error:(f,l,m)=>new Tt(f,l,m),setStatus:f=>{t=f},json:(f,l)=>e.asResponse?{body:l?.body||f,routerResponse:l,_flag:"json"}:f,responseHeaders:a,get responseStatus(){return t}};for(const f of r.use||[]){const l=await f({...u,returnHeaders:!0,asResponse:!1});l.response&&Object.assign(u.context,l.response),l.headers&&l.headers.forEach((m,h)=>{u.responseHeaders.set(h,m)})}return u};function sr(e,r,i){const a=typeof e=="string"?e:void 0,t=typeof r=="object"?r:e,n=typeof r=="function"?r:i;if((t.method==="GET"||t.method==="HEAD")&&t.body)throw new pi("Body is not allowed with GET or HEAD methods");if(a&&/\/{2,}/.test(a))throw new pi("Path cannot contain consecutive slashes");const o=async(...s)=>{const c=s[0]||{},{data:d,error:u}=await $v(Sd(c,{options:t,path:a}));if(u)throw u instanceof Qi?(t.onValidationError&&await t.onValidationError({message:u.message,issues:u.issues}),new Tt(400,{message:u.message,code:"VALIDATION_ERROR"})):u;const f=await n(d).catch(async h=>{if(ui(h)){const g=t.onAPIError;if(g&&await g(h),c.asResponse)return h}throw h}),l=d.responseHeaders,m=d.responseStatus;return c.asResponse?bd(f,{headers:l,status:m}):c.returnHeaders?c.returnStatus?{headers:l,response:f,status:m}:{headers:l,response:f}:c.returnStatus?{response:f,status:m}:f};return o.options=t,o.path=a,o}sr.create=e=>(r,i,a)=>sr(r,{...i,use:[...i?.use||[],...e?.use||[]]},a);function mt(e,r){const i=async a=>{const t=a,n=typeof e=="function"?e:r,o=await Sd(t,{options:typeof e=="function"?{}:e,path:"/"});if(!n)throw new Error("handler must be defined");try{const s=await n(o),c=o.responseHeaders;return t.returnHeaders?{headers:c,response:s}:s}catch(s){throw ui(s)&&Object.defineProperty(s,Od,{enumerable:!1,configurable:!1,get(){return o.responseHeaders}}),s}};return i.options=typeof e=="function"?{}:e,i}mt.create=e=>{function r(i,a){if(typeof i=="function")return mt({use:e?.use},i);if(!a)throw new Error("Middleware handler is required");return mt({...i,method:"*",use:[...e?.use||[],...i.use||[]]},a)}return r};function Id(e){return e instanceof Tt||e instanceof $||e?.name==="APIError"}const Ov=(e,r,i)=>{if(e.startsWith("/"))return!1;if(r.includes("*")||r.includes("?")){if(r.includes("://"))return gi(r)(hi(e)||e);const t=Cd(e);return t?gi(r)(t):!1}const a=Pd(e);return a==="http:"||a==="https:"||!a?r===hi(e):e.startsWith(r)};function Cv(e,r){let i;try{i=new URL(e).pathname.replace(/\/+$/,"")||"/"}catch{return"/"}
1return r==="/"||r===""?i:i===r?"/":i.startsWith(r+"/")?i.slice(r.length).replace(/\/+$/,"")||"/":i}const _d=mt(async()=>({})),et=mt.create({use:[_d,mt(async()=>({}))]}),Mi=[_d];function Z(e,r,i){const a=typeof e=="string"?e:void 0,t=typeof r=="object"?r:e,n=typeof r=="function"?r:i;return a?sr(a,{...t,use:[...t?.use||[],...Mi]},async o=>Wi(o,()=>n(o))):sr({...t,use:[...t?.use||[],...Mi]},async o=>Wi(o,()=>n(o)))}function Pv(e,r,i){let a=!1;return function(...t){return a||((0,console.warn)(`[Deprecation] ${r}`),a=!0),e.apply(this,t)}}function Ad(e){return e.context.skipOriginCheck===!0&&e.context.options.advanced?.disableCSRFCheck===void 0}const Lv=Pv(function(){},"disableOriginCheck: true currently also disables CSRF checks. In a future version, disableOriginCheck will ONLY disable URL validation. To keep CSRF disabled, add disableCSRFCheck: true to your config.");et(async e=>{if(e.request?.method==="GET"||e.request?.method==="OPTIONS"||e.request?.method==="HEAD"||!e.request||(await kn(e),e.context.skipOriginCheck))return;const{body:r,query:i}=e,a=r?.callbackURL||i?.callbackURL,t=r?.redirectTo,n=r?.errorCallbackURL,o=r?.newUserCallbackURL,s=(c,d)=>{if(c&&!e.context.isTrustedOrigin(c,{allowRelativePaths:d!=="origin"}))throw e.context.logger.error(`Invalid ${d}: ${c}`),e.context.logger.info(`If it's a valid URL, please add ${c} to trustedOrigins in your auth config
2`,`Current list of trustedOrigins: ${e.context.trustedOrigins}`),d==="origin"?$.from("FORBIDDEN",_.INVALID_ORIGIN):d==="callbackURL"?$.from("FORBIDDEN",_.INVALID_CALLBACK_URL):d==="redirectURL"?$.from("FORBIDDEN",_.INVALID_REDIRECT_URL):d==="errorCallbackURL"?$.from("FORBIDDEN",_.INVALID_ERROR_CALLBACK_URL):d==="newUserCallbackURL"?$.from("FORBIDDEN",_.INVALID_
2NEW_USER_CALLBACK_URL):$.fromStatus("FORBIDDEN",{message:`Invalid ${d}`})};a&&s(a,"callbackURL"),t&&s(t,"redirectURL"),n&&s(n,"errorCallbackURL"),o&&s(o,"newUserCallbackURL")});const Br=e=>et(async r=>{if(!r.request||r.context.skipOriginCheck)return;const i=e(r),a=(n,o)=>{if(n&&!r.context.isTrustedOrigin(n,{allowRelativePaths:o!=="origin"}))throw r.context.logger.error(`Invalid ${o}: ${n}`),r.context.logger.info(`If it's a valid URL, please add ${n} to trustedOrigins in your auth config
3`,`Current list of trustedOrigins: ${r.context.trustedOrigins}`),$.from("FORBIDDEN",_.INVALID_CALLBACK_URL)},t=Array.isArray(i)?i:[i];for(const n of t)a(n,"callbackURL")});async function kn(e,r=!1){const i=e.request?.headers;if(!i||!e.request)return;const a=i.get("origin")||i.get("referer")||"",t=i.has("cookie");if(e.context.skipCSRFCheck)return;if(Ad(e)){e.context.options.advanced?.disableOriginCheck===!0&&Lv();return}const n=e.context.skipOriginCheck;if(Array.isArray(n))try{const s=new URL(e.context.baseURL).pathname,c=Cv(e.request.url,s);if(n.some(d=>c.startsWith(d)))return}catch{}if(!(r||t))return;if(!a||a==="null")throw $.from("FORBIDDEN",_.MISSING_OR_NULL_ORIGIN);const o=Array.isArray(e.context.options.trustedOrigins)?e.context.trustedOrigins:[...e.context.trustedOrigins,...(await e.context.options.trustedOrigins?.(e.request))?.filter(s=>!!s)||[]];if(!o.some(s=>Ov(a,s)))throw e.context.logger.error(`Invalid origin: ${a}`),e.context.logger.info(`If it's a valid URL, please add ${a} to trustedOrigins in your auth config
4`,`Current list of trustedOrigins: ${o}`),$.from("FORBIDDEN",_.INVALID_ORIGIN)}et(async e=>{e.request&&await Nv(e)});async function Nv(e){const r=e.request;if(!r||e.context.skipCSRFCheck||Ad(e))return;const i=r.headers;if(i.has("cookie"))return await kn(e);const a=i.get("Sec-Fetch-Site"),t=i.get("Sec-Fetch-Mode"),n=i.get("Sec-Fetch-Dest");if(a&&a.trim()||t&&t.trim()||n&&n.trim()){if(a==="cross-site"&&t==="navigate")throw e.context.logger.error("Blocked cross-site navigation login attempt (CSRF protection)",{secFetchSite:a,secFetchMode:t,secFetchDest:n}),$.from("FORBIDDEN",_.CROSS_SITE_NAVIGATION_LOGIN_BLOCKED);return await kn(e,!0)}}function zv(e){return ht().safeParse(e).success||Lr().safeParse(e).success}function jv(e){return Lr().safeParse(e).success}function Kv(e){const r=e.toLowerCase();if(r.startsWith("::ffff:")){const a=r.substring(7);if(ht().safeParse(a).success)return a}const i=e.split(":");if(i.length===7&&i[5]?.toLowerCase()==="ffff"){const a=i[6];if(a&&ht().safeParse(a).success)return a}if(r.includes("::ffff:")||r.includes(":ffff:")){const a=Ud(e);if(a.length===8&&a[0]==="0000"&&a[1]==="0000"&&a[2]==="0000"&&a[3]==="0000"&&a[4]==="0000"&&a[5]==="ffff"&&a[6]&&a[7])return`${Number.parseInt(a[6].substring(0,2),16)}.${Number.parseInt(a[6].substring(2,4),16)}.${Number.parseInt(a[7].substring(0,2),16)}.${Number.parseInt(a[7].substring(2,4),16)}`}return null}function Ud(e){if(e.includes("::")){const r=e.split("::"),i=r[0]?r[0].split(":"):[],a=r[1]?r[1].split(":"):[],t=8-i.length-a.length,n=Array(t).fill("0000"),o=i.map(c=>c.padStart(4,"0")),s=a.map(c=>c.padStart(4,"0"));return[...o,...n,...s]}return e.split(":").map(r=>r.padStart(4,"0"))}function Hv(e,r){const i=Ud(e);if(r<128){let a=r;return i.map(t=>{if(a<=0)return"0000";if(a>=16)return a-=16,t;const n=Number.parseInt(t,16)&(65535<<16-a&65535);return a=0,n.toString(16).padStart(4,"0")}).join(":").toLowerCase()}return i.join(":").toLowerCase()}function Wv(e,r={}){if(ht().safeParse(e).success||!jv(e))return e.toLowerCase();const i=Kv(e);return i?i.toLowerCase():Hv(e,r.ipv6Subnet||64)}const Vv="127.0.0.1";function Jv(e,r){if(r.advanced?.ipAddress?.disableIpTracking)return null;const i="headers"in e?e.headers:e,a=r.advanced?.ipAddress?.ipAddressHeaders||["x-forwarded-for"];for(const t of a){const n="get"in i?i.get(t):i[t];if(typeof n=="string"){const o=n.split(",")[0].trim();if(zv(o))return Wv(o,{ipv6Subnet:r.advanced?.ipAddress?.ipv6Subnet})}}return Ld()||Xi()?Vv:null}const{get:qi}=vd(()=>!1);var Sn=Object.defineProperty,Bv=Object.getOwnPropertyDescriptor,Mv=Object.getOwnPropertyNames,qv=Object.prototype.hasOwnProperty,Fv=(e,r)=>{let i={};for(var a in e)Sn(i,a,{get:e[a],enumerable:!0});return Sn(i,Symbol.toStringTag,{value:"Module"}),i},Zv=(e,r,i,a)=>
4{if(r&&typeof r=="object"||typeof r=="function")for(var t=Mv(r),n=0,o=t.length,s;n<o;n++)s=t[n],!qv.call(e,s)&&s!==i&&Sn(e,s,{get:(c=>r[c]).bind(null,s),enumerable:!(a=Bv(r,s))||a.enumerable});return e},Gv=(e,r,i)=>(Zv(e,r,"default"),i);function Qv(e){const r=ni(e),i={};for(const a in r){const t=r[a],n=t.fields,o={};if(Object.entries(n).forEach(([s,c])=>{if(o[c.fieldName||s]=c,c.references){const d=r[c.references.model];d&&(o[c.fieldName||s].references={...c.references,model:d.modelName,field:c.references.field})}}),i[t.modelName]){i[t.modelName].fields={...i[t.modelName].fields,...o};continue}i[t.modelName]={fields:o,order:t.order||1/0}}return i}function Xv(e,r){const i=r.id?{id:r.id}:{};for(const a in e){const t=e[a],n=r[a];n!==void 0&&(i[t.fieldName||a]=n)}return i}function Yv(e,r){if(!r)return null;const i={id:r.id};for(const[a,t]of Object.entries(e))i[a]=r[t.fieldName||a];return i}function Ed(e,r){const i=r.hooks;async function a(c,d,u){const f=await lt().catch(()=>null);let l=c;for(const h of i||[]){const g=h[d]?.create?.before;if(g){const p=await g(l,f);if(p===!1)return null;typeof p=="object"&&"data"in p&&(l={...l,...p.data})}}let m=null;(!u||u.executeMainFn)&&(m=await(await Y(e)).create({model:d,data:l,forceAllowId:!0})),u?.fn&&(m=await u.fn(m??l));for(const h of i||[]){const g=h[d]?.create?.after;g&&await At(async()=>{await g(m,f)})}return m}async function t(c,d,u,f){const l=await lt().catch(()=>null);let m=c;for(const p of i||[]){const y=p[u]?.update?.before;if(y){const v=await y(c,l);if(v===!1)return null;typeof v=="object"&&"data"in v&&(m={...m,...v.data})}}const h=f?await f.fn(m):null,g=!f||f.executeMainFn?await(await Y(e)).update({model:u,update:m,where:d}):h;for(const p of i||[]){const y=p[u]?.update?.after;y&&await At(async()=>{await y(g,l)})}return g}async function n(c,d,u,f){const l=await lt().catch(()=>null);let m=c;for(const p of i||[]){const y=p[u]?.update?.before;if(y){const v=await y(c,l);if(v===!1)return null;typeof v=="object"&&"data"in v&&(m={...m,...v.data})}}const h=f?await f.fn(m):null,g=!f||f.executeMainFn?await(await Y(e)).updateMany({model:u,update:m,where:d}):h;for(const p of i||[]){const y=p[u]?.update?.after;y&&await At(async()=>{await y(g,l)})}return g}async function o(c,d,u){const f=await lt().catch(()=>null);let l=null;try{l=(await(await Y(e)).findMany({model:d,where:c,limit:1}))[0]||null}catch{}if(l)for(const g of i||[]){const p=g[d]?.delete?.before;if(p&&await p(l,f)===!1)return null}const m=u?await u.fn(c):null,h=(!u||u.executeMainFn)&&l?await(await Y(e)).delete({model:d,where:c}):m;if(l)for(const g of i||[]){const p=g[d]?.delete?.after;p&&await At(async()=>{await p(l,f)})}return h}async function s(c,d,u){const f=await lt().catch(()=>null);let l=[];try{l=await(await Y(e)).findMany({model:d,where:c})}catch{}for(const g of l)for(const p of i||[]){const y=p[d]?.delete?.before;if(y&&await y(g,f)===!1)return null}const m=u?await u.fn(c):null,h=!u||u.executeMainFn?await(await Y(e)).deleteMany({model:d,where:c}):m;for(const g of l)for(const p of i||[]){const y=p[d]?.delete?.after;y&&await At(async()=>{await y(g,f)})}return h}return{createWithHooks:a,updateWithHooks:t,updateManyWithHooks:n,deleteWithHooks:o,deleteManyWithHooks:s}}const ew=async e=>{const r=await ri("SHA-256").digest(new TextEncoder().encode(e));return Kt.encode(new Uint8Array(r),{padding:!1})};async function Mt(e,r){return!r||r==="plain"?e:r==="hashed"?ew(e):typeof r=="object"&&"hash"in r?r.hash(e):e}function qt(e,r){if(r){if(typeof r=="object"&&"default"in r){if(r.overrides){for(const[i,a]of Object.entries(r.overrides))if(e.startsWith(i))return a}return r.default}return r}}const In=e=>cc("a-z","A-Z","0-9")(e||32);function Le(e,r=Date.now()){const i=typeof e=="number"?e:e.getTime();return Math.max(Math.floor((i-r)/1e3),0)}const tw=(e,r)=>{const i=r.logger,a=r.options,t=a.secondaryStorage,n=a.session?.expiresIn||3600*24*7,{createWithHooks:o,updateWithHooks:s,updateManyWithHooks:c,deleteWithHooks:d,deleteManyWithHooks:u}=Ed(e,r);async function f(l){if(!t)return;const m=await t.get(`active-sessions-${l.id}`);if(!m)return;const h=Date.now(),g=(ce(m)||[]).filter(p=>p.expiresAt>h);await Promise.all(g.map(async({token:p})=>{const y=await t.get(p);if(!y)return;const v=ce(y);if(!v)return;const k=Le(v.session.expiresAt,h);await t.set(p,JSON.stringify({session:v.session,user:l}),Math.floor(k))}))}return{createOAuthUser:async(l,m)=>yv(e,async()=>{const h=await o({createdAt:new Date,updatedAt:new Date,...l},"user",void 0);return{user:h,account:await o({...m,userId:h.id,createdAt:new Date,updatedAt:new Date},"account",void 0)}}),createUser:async l=>await o({createdAt:new Date,updatedAt:new Date,...l,email:l.email?.toLowerCase()},"user",void 0),createAccount:async l=>await o({createdAt:new Date,updatedAt:new Date,...l},"account",void 0),listSessions:async(l,m)=>{if(t){const h=await t.get(`active-sessions-${l}`);if(!h)return[];const g=ce(h)||[],p=Date.now(),y=new Set,v=[];for(const{token:k,expiresAt:A}of g){if(A<=p||y.has(k))continue;y.add(k);const C=await t.get(k);if(C)try{const L=typeof C=="string"?JSON.parse(C):C;if(!L?.session)continue;v.push(ye(r.options,{...L.session,expiresAt:new Date(L.session.expiresAt)}))}catch{continue}}return v}return await(await Y(e)).findMany({model:"session",where:[{field:"userId",value:l},...m?.onlyActiveSessions?[{field:"expiresAt",value:new Date,operator:"gt"}]:[]]})},listUsers:async(l,m,h,g)=>await(await Y(e)).findMany({model:"user",limit:l,offset:m,sortBy:h,where:g}),countTotalUsers:async l=>{const m=await(await Y(e)).count({model:"user",where:l});return typeof m=="string"?parseInt(m):m},deleteUser:async l=>{(!t||a.session?.storeSessionInDatabase)&&await u([{field:"userId",value:l}],"session",void 0),await u([{field:"userId",value:l}],"account",void 0),await d([{field:"id",value:l}],"user",void 0)},createSession:async(l,m,h,g)=>{const p=await(async()=>{const L=await lt().catch(()=>null);return L?.headers||L?.request?.headers})(),y=a.session?.storeSessionInDatabase,{id:v,...k}=h||{},A=fd(a),C={ipAddress:p&&Jv(p,a)||"",userAgent:p?.get("user-agent")||"",...k,expiresAt:yt(m?3600*24:n,"sec"),userId:l,token:In(32),createdAt:new Date,updatedAt:new Date,...A,...g?k:{}};return await o(C,"session",t?{fn:async L=>{const q=await t.get(`active-sessions-${l}`);let J=[];const x=Date.now();q&&(J=ce(q)||[],J=J.filter(j=>j.expiresAt>x&&j.token!==C.token));const O=[...J,{token:C.token,expiresAt:C.expiresAt.getTime()}].sort((j,H)=>j.expiresAt-H.expiresAt),D=Le(O.at(-1)?.expiresAt??C.expiresAt.getTime(),x);D>0&&await t.set(`active-sessions-${l}`,JSON.stringify(O),D);const N=await(await Y(e)).findOne({model:"user",where:[{field:"id",value:l}]}),z=Le(C.expiresAt,x);return z>0&&await t.set(C.token,JSON.stringify({session:L,user:N}),z),L},executeMainFn:y}:void 0)},findSession:async l=>{if(t){const p=await t.get(l);if(!p&&!a.session?.storeSessionInDatabase)return null;if(p){const y=ce(p);return y?{session:ye(r.options,{...y.session,expiresAt:new Date(y.session.expiresAt),createdAt:new Date(y.session.createdAt),updatedAt:new Date(y.session.updatedAt)}),user:he(r.options,{...y.user,createdAt:new Date(y.user.createdAt),updatedAt:new Date(y.user.updatedAt)})}:null}}const m=await(await Y(e)).findOne({model:"session",where:[{value:l,field:"token"}],join:{user:!0}});if(!m)return null;const{user:h,...g}=m;return h?{session:ye(r.options,g),user:he(r.options,h)}:null},findSessions:async(l,m)=>{if(t){const g=[];for(const p of l){const y=await t.get(p);if(y)try{const v=typeof y=="string"?JSON.parse(y):y;if(!v)return[];const k=new Date(v.session.expiresAt);if(m?.onlyActiveSessions&&k<=new Date)continue;const A={session:{...v.session,expiresAt:new Date(v.session.expiresAt)},user:{...v.user,createdAt:new Date(v.user.createdAt),updatedAt:new Date(v.user.updatedAt)}};g.push(A)}catch{continue}}return g}const h=await(await Y(e)).findMany({model:"session",where:[{field:"token",value:l,operator:"in"},...m?.onlyActiveSessions?[{field:"expiresAt",value:new Date,operator:"gt"}]:[]],join:{user:!0}});return h.length?h.some(g=>!g.user)?[]:h.map(g=>{const{user:p,...y}=g;return{session:y,user:p}}):[]},updateSession:async(l,m)=>await s(m,[{field:"token",value:l}],"session",t?{async fn(h){const g=await t.get(l);if(!g)return null;const p=ce(g);if(!p)return null;const y={...p.session,...h,expiresAt:new Date(h.expiresAt??p.session.expiresAt),createdAt:new Date(p.session.createdAt),updatedAt:new Date(h.updatedAt??p.session.updatedAt)},v=ye(r.options,y),k=Date.now(),A=new Date(v.expiresAt).getTime(),C=Le(A,k);if(C>0){await t.set(l,JSON.stringify({session:v,user:p.user}),C);const L=`active-sessions-${v.userId}`,q=await t.get(L),J=(q?ce(q)||[]:[]).filter(O=>O.token!==l&&O.expiresAt>k).concat([{token:l,expiresAt:A}]).sort((O,D)=>O.expiresAt-D.expiresAt),x=J.at(-1)?.expiresAt;x&&x>k?await t.set(L,JSON.stringify(J),Le(x,k)):await t.delete(L)}return v},executeMainFn:a.session?.storeSessionInDatabase}:void 0),deleteSession:async l=>{if(t){const m=await t.get(l);if(m){const{session:h}=ce(m)??{};if(!h){i.error("Session not found in secondary storage");return}const g=h.userId,p=await t.get(`active-sessions-${g}`);if(p){const y=ce(p)||[],v=Date.now(),k=y.filter(C=>C.expiresAt>v&&C.token!==l),A=k.sort((C,L)=>C.expiresAt-L.expiresAt).at(-1)?.expiresAt;k.length>0&&A&&A>Date.now()?await t.set(`active-sessions-${g}`,JSON.stringify(k),Le(A,v)):await t.delete(`active-sessions-${g}`)}else i.error("Active sessions list not found in secondary storage")}if(await t.delete(l),!a.session?.storeSessionInDatabase||r.options.session?.preserveSessionInDatabase)return}await d([{field:"token",value:l}],"session",void 0)},deleteAccounts:async l=>{await u([{field:"userId",value:l}],"account",void 0)},deleteAccount:async l=>{await d([{field:"id",value:l}],"account",void 0)},deleteSessions:async l=>{if(t){if(typeof l=="string"){const m=await t.get(`active-sessions-${l}`),h=m?ce(m):[];if(!h)return;for(const g of h)await t.delete(g.token);await t.delete(`active-sessions-${l}`)}else for(const m of l)await t.get(m)&&await t.delete(m);if(!a.session?.storeSessionInDatabase||r.options.session?.preserveSessionInDatabase)return}await u([{field:Array.isArray(l)?"token":"userId",value:l,operator:Array.isArray(l)?"in":void 0}],"session",void 0)},findOAuthUser:async(l,m,h)=>{const g=await(await Y(e)).findOne({model:"account",where:[{value:m,field:"accountId"},{value:h,field:"providerId"}],join:{user:!0}});if(g){if(g.user)return{user:g.user,linkedAccount:g,accounts:[g]};{const p=await(await Y(e)).findOne({model:"user",where:[{value:l.toLowerCase(),field:"email"}]});return p?{user:p,linkedAccount:g,accounts:[g]}:null}}else{const p=await(await Y(e)).findOne({model:"user",where:[{value:l.toLowerCase(),field:"email"}]});return p?{user:p,linkedAccount:null,accounts:await(await Y(e)).findMany({model:"account",where:[{value:p.id,field:"userId"}]})||[]}:null}},findUserByEmail:async(l,m)=>{const h=await(await Y(e)).findOne({model:"user",where:[{value:l.toLowerCase(),field:"email"}],join:{...m?.includeAccounts?{account:!0}:{}}});if(!h)return null;const{account:g,...p}=h;return{user:p,accounts:g??[]}},findUserById:async l=>l?await(await Y(e)).findOne({model:"user",where:[{field:"id",value:l}]}):null,linkAccount:async l=>await o({createdAt:new Date,updatedAt:new Date,...l},"account",void 0),updateUser:async(l,m)=>{const h=await s(m,[{field:"id",value:l}],"user",void 0);return await f(h),h},updateUserByEmail:async(l,m)=>{const h=await s(m,[{field:"email",value:l.toLowerCase()}],"user",void 0);return await f(h),h},updatePassword:async(l,m)=>{await c({password:m},[{field:"userId",value:l},{field:"providerId",value:"credential"}],"account",void 0)},findAccounts:async l=>await(await Y(e)).findMany({model:"account",where:[{field:"userId",value:l}]}),findAccount:async l=>await(await Y(e)).findOne({model:"account",where:[{field:"accountId",value:l}]}),findAccountByProviderId:async(l,m)=>await(await Y(e)).findOne({model:"account",where:[{field:"accountId",value:l},{field:"providerId",value:m}]}),findAccountByUserId:async l=>await(await Y(e)).findMany({model:"account",where:[{field:"userId",value:l}]}),updateAccount:async(l,m)=>await s(m,[{field:"id",value:l}],"account",void 0),createVerificationValue:async l=>{const m=qt(l.identifier,a.verification?.storeIdentifier),h=await Mt(l.identifier,m);return await o({createdAt:new Date,updatedAt:new Date,...l,identifier:h},"verification",t?{async fn(g){const p=Le(g.expiresAt);return p>0&&await t.set(`verification:${h}`,JSON.stringify(g),p),g},executeMainFn:a.verification?.storeInDatabase}:void 0)},findVerificationValue:async l=>{const m=qt(l,a.verification?.storeIdentifier),h=await Mt(l,m);if(t){const v=await t.get(`verification:${h}`);
4if(v){const k=ce(v);if(k)return k}if(m&&m!=="plain"){const k=await t.get(`verification:${l}`);if(k){const A=ce(k);if(A)return A}}if(!a.verification?.storeInDatabase)return null}const g=await Y(e);async function p(v){return g.findMany({model:"verification",where:[{field:"identifier",value:v}],sortBy:{field:"createdAt",direction:"desc"},limit:1})}let y=await p(h);return!y.length&&m&&m!=="plain"&&(y=await p(l)),a.verification?.disableCleanup||await u([{field:"expiresAt",value:new Date,operator:"lt"}],"verification",void 0),y[0]||null},deleteVerificationByIdentifier:async l=>{const m=await Mt(l,qt(l,a.verification?.storeIdentifier));t&&await t.delete(`verification:${m}`),(!t||a.verification?.storeInDatabase)&&await d([{field:"identifier",value:m}],"verification",void 0)},updateVerificationByIdentifier:async(l,m)=>{const h=await Mt(l,qt(l,a.verification?.storeIdentifier));if(t){const g=await t.get(`verification:${h}`);if(g){const p=ce(g);if(p){const y={...p,...m},v=y.expiresAt??p.expiresAt,k=Le(v instanceof Date?v:new Date(v));if(k>0&&await t.set(`verification:${h}`,JSON.stringify(y),k),!a.verification?.storeInDatabase)return y}}}return!t||a.verification?.storeInDatabase?await s(m,[{field:"identifier",value:h}],"verification",void 0):m}}};function rw({fields:e,isClientSide:r}){const i=Object.keys(e).reduce((a,t)=>{const n=e[t];if(!n||r&&n.input===!1)return a;let o;return n.type==="json"?o=Yt?Yt():De():n.type==="string[]"||n.type==="number[]"?o=pt(n.type==="string[]"?b():Ze()):Array.isArray(n.type)?o=De():o=Jy[n.type](),n?.required===!1&&(o=o.optional()),!r&&n?.returned===!1?a:{...a,[t]:o}},{});return W(i)}var nw=Fv({convertFromDB:()=>Yv,convertToDB:()=>Xv,createInternalAdapter:()=>tw,getSchema:()=>Qv,getSessionDefaultFields:()=>fd,getWithHooks:()=>Ed,mergeSchema:()=>tv,parseAccountInput:()=>Yy,parseAccountOutput:()=>ld,parseAdditionalUserInput:()=>Xy,parseInputData:()=>Wt,parseSessionInput:()=>ev,parseSessionOutput:()=>ye,parseUserInput:()=>Qy,parseUserOutput:()=>he,toZodSchema:()=>rw});Gv(nw,Gy);const iw=()=>Z("/get-session",{method:["GET","POST"],operationId:"getSession",query:cv,requireHeaders:!0,metadata:{openapi:{operationId:"getSession",description:"Get the current session",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",nullable:!0,properties:{session:{$ref:"#/components/schemas/Session"},user:{$ref:"#/components/schemas/User"}},required:["session","user"]}}}}}}}},async e=>{const r=e.context.options.session?.deferSessionRefresh,i=e.method==="POST";if(i&&!r)throw $.from("METHOD_NOT_ALLOWED",_.METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED);try{const a=await e.getSignedCookie(e.context.authCookies.sessionToken.name,e.context.secret);if(!a)return null;const t=hd(e,e.context.authCookies.sessionData.name);let n=null;if(t){const p=e.context.options.session?.cookieCache?.strategy||"compact";if(p==="jwe"){const y=await Jc(t,e.context.secretConfig,"better-auth-session");if(y&&y.session&&y.user)n={session:{session:y.session,user:y.user,updatedAt:y.updatedAt,version:y.version},expiresAt:y.exp?y.exp*1e3:Date.now()};else return be(e,e.context.authCookies.sessionData),e.json(null)}else if(p==="jwt"){const y=await fh(t,e.context.secret);if(y&&y.session&&y.user)n={session:{session:y.session,user:y.user,updatedAt:y.updatedAt,version:y.version},expiresAt:y.exp?y.exp*1e3:Date.now()};else return be(e,e.context.authCookies.sessionData),e.json(null)}else{const y=ce(uv.decode(Kt.decode(t)));if(y)if(await gd("SHA-256","base64urlnopad").verify(e.context.secret,JSON.stringify({...y.session,expiresAt:y.expiresAt}),y.signature))n=y;else return be(e,e.context.authCookies.sessionData),e.json(null)}}const o=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);if(n?.session&&e.context.options.session?.cookieCache?.enabled&&!e.query?.disableCookieCache){const p=n.session,y=e.context.options.session?.cookieCache?.version;let v="1";if(y){if(typeof y=="string")v=y;else if(typeof y=="function"){const k=y(p.session,p.user);v=k instanceof Promise?await k:k}}if((p.version||"1")!==v)be(e,e.context.authCookies.sessionData);
4else{const k=new Date(p.session.expiresAt);if(n.expiresAt<Date.now()||k<new Date)be(e,e.context.authCookies.sessionData);else{const A=e.context.sessionConfig.cookieRefreshCache;if(A===!1){e.context.session=p;const O=ye(e.context.options,{...p.session,expiresAt:new Date(p.session.expiresAt),createdAt:new Date(p.session.createdAt),updatedAt:new Date(p.session.updatedAt)}),D=he(e.context.options,{...p.user,createdAt:new Date(p.user.createdAt),updatedAt:new Date(p.user.updatedAt)});return e.json({session:O,user:D})}const C=n.expiresAt-Date.now(),L=A.updateAge*1e3,q=await qi();if(C<L&&!q){const O=yt(e.context.options.session?.cookieCache?.maxAge||300,"sec"),D={session:{...p.session,expiresAt:O},user:p.user,updatedAt:Date.now()};await Qt(e,D,!1);const N=e.context.authCookies.sessionToken.attributes,z=o?void 0:e.context.sessionConfig.expiresIn;await e.setSignedCookie(e.context.authCookies.sessionToken.name,p.session.token,e.context.secret,{...N,maxAge:z});const j=ye(e.context.options,{...D.session,expiresAt:new Date(D.session.expiresAt),createdAt:new Date(D.session.createdAt),updatedAt:new Date(D.session.updatedAt)}),H=he(e.context.options,{...D.user,createdAt:new Date(D.user.createdAt),updatedAt:new Date(D.user.updatedAt)});return e.context.session={session:j,user:H},e.json({session:j,user:H})}const J=ye(e.context.options,{...p.session,expiresAt:new Date(p.session.expiresAt),createdAt:new Date(p.session.createdAt),updatedAt:new Date(p.session.updatedAt)}),x=he(e.context.options,{...p.user,createdAt:new Date(p.user.createdAt),updatedAt:new Date(p.user.updatedAt)});return e.context.session={session:J,user:x},e.json({session:J,user:x})}}}const s=await e.context.internalAdapter.findSession(a);if(e.context.session=s,!s||s.session.expiresAt<new Date)return Lt(e),s&&(!r||i)&&await e.context.internalAdapter.deleteSession(s.session.token),e.json(null);if(o||e.query?.disableRefresh){const p=ye(e.context.options,s.session),y=he(e.context.options,s.user);return e.json({session:p,user:y})}const c=e.context.sessionConfig.expiresIn,d=e.context.sessionConfig.updateAge,u=s.session.expiresAt.valueOf()-c*1e3+d*1e3<=Date.now(),f=e.query?.disableRefresh||e.context.options.session?.disableSessionRefresh,l=await qi(),m=u&&!f&&!l;if(r&&!i){await Qt(e,s,!!o);const p=ye(e.context.options,s.session),y=he(e.context.options,s.user);return e.json({session:p,user:y,needsRefresh:m})}if(m){const p=await e.context.internalAdapter.updateSession(s.session.token,{expiresAt:yt(e.context.sessionConfig.expiresIn,"sec"),updatedAt:new Date});if(!p)throw Lt(e),$.from("UNAUTHORIZED",_.FAILED_TO_GET_SESSION);const y=(p.expiresAt.valueOf()-Date.now())/1e3;await ze(e,{session:p,user:s.user},!1,{maxAge:y});const v=ye(e.context.options,p),k=he(e.context.options,s.user);return e.json({session:v,user:k})}await Qt(e,s,!!o);const h=ye(e.context.options,s.session),g=he(e.context.options,s.user);return e.json({session:h,user:g})}catch(a){throw Id(a)?a:(e.context.logger.error("INTERNAL_SERVER_ERROR",a),$.from("INTERNAL_SERVER_ERROR",_.FAILED_TO_GET_SESSION))}}),Ue=async(e,r)=>{if(e.context.session)return e.context.session;const i=await iw()({...e,method:"GET",asResponse:!1,headers:e.headers,returnHeaders:!1,returnStatus:!1,query:{...r,...e.query}}).catch(a=>null);return e.context.session=i,i},fi=et(async e=>{const r=await Ue(e);if(!r?.session)throw $.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:r}}),Je=et(async e=>{const r=await Ue(e,{disableCookieCache:!0});if(!r?.session)throw $.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:r}});et(async e=>{const r=await Ue(e);if(!r?.session&&(e.request||e.headers))throw $.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:r}});const aw=et(async e=>{const r=await Ue(e);if(!r?.session)throw $.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});if(e.context.sessionConfig.freshAge===0)return{session:r};const i=e.context.sessionConfig.freshAge,a=new Date(r.session.updatedAt||r.session.createdAt).getTime();if(!(Date.now()-a<i*1e3))throw $.from("FORBIDDEN",_.SESSION_NOT_FRESH);return{session:r}});Z("/revoke-session",{method:"POST",body:W({token:b().meta({description:"The token to revoke"})}),use:[Je],requireHeaders:!0,metadata:{openapi:{description:"Revoke a single session",requestBody:{content:{"application/json":{schema:{type:"object",properties:{token:{type:"string",description:"The token to revoke"}},required:["token"]}}}},responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if the session was revoked successfully"}},required:["status"]}}}}}}}},async e=>{const r=e.body.token;
4if((await e.context.internalAdapter.findSession(r))?.session.userId===e.context.session.user.id)try{await e.context.internalAdapter.deleteSession(r)}catch(i){throw e.context.logger.error(i&&typeof i=="object"&&"name"in i?i.name:"",i),$.from("INTERNAL_SERVER_ERROR",{message:"Internal Server Error",code:"INTERNAL_SERVER_ERROR"})}return e.json({status:!0})});Z("/revoke-sessions",{method:"POST",use:[Je],requireHeaders:!0,metadata:{openapi:{description:"Revoke all sessions for the user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if all sessions were revoked successfully"}},required:["status"]}}}}}}}},async e=>{try{await e.context.internalAdapter.deleteSessions(e.context.session.user.id)}catch(r){throw e.context.logger.error(r&&typeof r=="object"&&"name"in r?r.name:"",r),$.from("INTERNAL_SERVER_ERROR",{message:"Internal Server Error",code:"INTERNAL_SERVER_ERROR"})}return e.json({status:!0})});Z("/revoke-other-sessions",{method:"POST",requireHeaders:!0,use:[Je],metadata:{openapi:{description:"Revoke all other sessions for the user except the current one",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if all other sessions were revoked successfully"}},required:["status"]}}}}}}}},async e=>{const r=e.context.session;if(!r.user)throw $.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});const i=(await e.context.internalAdapter.listSessions(r.user.id)).filter(a=>a.expiresAt>new Date).filter(a=>a.token!==e.context.session.session.token);return await Promise.all(i.map(a=>e.context.internalAdapter.deleteSession(a.token))),e.json({status:!0})});async function Vt(e,r){if(e)for(const i of e){const a=typeof i=="function"?await i():i;if(a[r.field??"id"]===r.value)return a}}function ow(e){return e.startsWith("$ba$")?!0:e.length%2===0&&/^[0-9a-f]+$/i.test(e)}function _n(e,r){return e&&(r.options.account?.encryptOAuthTokens&&ow(e)?ed({key:r.secretConfig,data:e}):e)}function fe(e,r){return r.options.account?.encryptOAuthTokens&&e?Yc({key:r.secretConfig,data:e}):e}function mi(e){const r=i=>{const a=new Date;return new Date(a.getTime()+i*1e3)};return{tokenType:e.token_type,accessToken:e.access_token,refreshToken:e.refresh_token,accessTokenExpiresAt:e.expires_in?r(e.expires_in):void 0,refreshTokenExpiresAt:e.refresh_token_expires_in?r(e.refresh_token_expires_in):void 0,scopes:e?.scope?typeof e.scope=="string"?e.scope.split(" "):e.scope:[],idToken:e.id_token,raw:e}}async function xd(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Kt.encode(new Uint8Array(i),{padding:!1})}async function M({id:e,options:r,authorizationEndpoint:i,state:a,codeVerifier:t,scopes:n,claims:o,redirectURI:s,duration:c,prompt:d,accessType:u,responseType:f,display:l,loginHint:m,hd:h,responseMode:g,additionalParams:p,scopeJoiner:y}){r=typeof r=="function"?await r():r;const v=new URL(r.authorizationEndpoint||i);v.searchParams.set("response_type",f||"code");const k=Array.isArray(r.clientId)?r.clientId[0]:r.clientId;if(v.searchParams.set("client_id",k),v.searchParams.set("state",a),n&&v.searchParams.set("scope",n.join(y||" ")),v.searchParams.set("redirect_uri",r.redirectURI||s),c&&v.searchParams.set("duration",c),l&&v.searchParams.set("display",l),m&&v.searchParams.set("login_hint",m),d&&v.searchParams.set("prompt",d),h&&v.searchParams.set("hd",h),u&&v.searchParams.set("access_type",u),g&&v.searchParams.set("response_mode",g),t){const A=await xd(t);v.searchParams.set("code_challenge_method","S256"),v.searchParams.set("code_challenge",A)}if(o){const A=o.reduce((C,L)=>(C[L]=null,C),{});v.searchParams.set("claims",JSON.stringify({id_token:{email:null,email_verified:null,...A}}))}return p&&Object.entries(p).forEach(([A,C])=>{v.searchParams.set(A,C)}),v}function sw({refreshToken:e,options:r,authentication:i,extraParams:a,resource:t}){const n=new URLSearchParams,o={"content-type":"application/x-www-form-urlencoded",accept:"application/json"};if(n.set("grant_type","refresh_token"),n.set("refresh_token",e),i==="basic"){const s=Array.isArray(r.clientId)?r.clientId[0]:r.clientId;s?o.authorization="Basic "+We.encode(`${s}:${r.clientSecret??""}`):o.authorization="Basic "+We.encode(`:${r.clientSecret??""}`)}else{const s=Array.isArray(r.clientId)?r.clientId[0]:r.clientId;n.set("client_id",s),r.clientSecret&&n.set("client_secret",r.clientSecret)}if(t)if(typeof t=="string")n.append("resource",t);else for(const s of t)n.append("resource",s);if(a)for(const[s,c]of Object.entries(a))n.set(s,c);return{body:n,headers:o}}async function V({refreshToken:e,options:r,tokenEndpoint:i,authentication:a,extraParams:t}){const{body:n,headers:o}=await sw({refreshToken:e,options:r,authentication:a,extraParams:t}),{data:s,error:c}=await P(i,{method:"POST",body:n,headers:o});if(c)throw c;const d={accessToken:s.access_token,refreshToken:s.refresh_token,tokenType:s.token_type,scopes:s.scope?.split(" "),idToken:s.id_token};if(s.expires_in){const u=new Date;d.accessTokenExpiresAt=new Date(u.getTime()+s.expires_in*1e3)}if(s.refresh_token_expires_in){const u=new Date;d.refreshTokenExpiresAt=new Date(u.getTime()+s.refresh_token_expires_in*1e3)}return d}async function cw({code:e,codeVerifier:r,redirectURI:i,options:a,authentication:t,deviceId:n,headers:o,additionalParams:s={},resource:c}){return a=typeof a=="function"?await a():a,Td({code:e,codeVerifier:r,redirectURI:i,options:a,authentication:t,deviceId:n,headers:o,additionalParams:s,resource:c})}function Td({code:e,codeVerifier:r,redirectURI:i,options:a,authentication:t,deviceId:n,headers:o,additionalParams:s={},resource:c}){const d=new URLSearchParams,u={"content-type":"application/x-www-form-urlencoded",accept:"application/json",...o};
4if(d.set("grant_type","authorization_code"),d.set("code",e),r&&d.set("code_verifier",r),a.clientKey&&d.set("client_key",a.clientKey),n&&d.set("device_id",n),d.set("redirect_uri",a.redirectURI||i),c)if(typeof c=="string")d.append("resource",c);else for(const f of c)d.append("resource",f);if(t==="basic"){const f=Array.isArray(a.clientId)?a.clientId[0]:a.clientId;u.authorization=`Basic ${We.encode(`${f}:${a.clientSecret??""}`)}`}else{const f=Array.isArray(a.clientId)?a.clientId[0]:a.clientId;d.set("client_id",f),a.clientSecret&&d.set("client_secret",a.clientSecret)}for(const[f,l]of Object.entries(s))d.has(f)||d.append(f,l);return{body:d,headers:u}}async function B({code:e,codeVerifier:r,redirectURI:i,options:a,tokenEndpoint:t,authentication:n,deviceId:o,headers:s,additionalParams:c={},resource:d}){const{body:u,headers:f}=await cw({code:e,codeVerifier:r,redirectURI:i,options:a,authentication:n,deviceId:o,headers:s,additionalParams:c,resource:d}),{data:l,error:m}=await P(t,{method:"POST",body:u,headers:f});if(m)throw m;return mi(l)}const dw=e=>{const r="https://appleid.apple.com/auth/token";return{id:"apple",name:"Apple",async createAuthorizationURL({state:i,scopes:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["email","name"];return e.scope&&n.push(...e.scope),a&&n.push(...a),await M({id:"apple",options:e,authorizationEndpoint:"https://appleid.apple.com/auth/authorize",scopes:n,state:i,redirectURI:t,responseMode:"form_post",responseType:"code id_token"})},validateAuthorizationCode:async({code:i,codeVerifier:a,redirectURI:t})=>B({code:i,codeVerifier:a,redirectURI:t,options:e,tokenEndpoint:r}),async verifyIdToken(i,a){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(i,a);try{const{kid:t,alg:n}=jt(i);if(!t||!n)return!1;const{payload:o}=await Ye(i,await uw(t),{algorithms:[n],issuer:"https://appleid.apple.com",audience:e.audience&&e.audience.length?e.audience:e.appBundleIdentifier?e.appBundleIdentifier:e.clientId,maxTokenAge:"1h"});return["email_verified","is_private_email"].forEach(s=>{o[s]!==void 0&&(o[s]=!!o[s])}),a&&o.nonce!==a?!1:!!o}catch{return!1}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async i=>V({refreshToken:i,options:e,tokenEndpoint:"https://appleid.apple.com/auth/token"}),async getUserInfo(i){if(e.getUserInfo)return e.getUserInfo(i);if(!i.idToken)return null;const a=Oe(i.idToken);if(!a)return null;let t;i.user?.name?t=`${i.user.name.firstName||""} ${i.user.name.lastName||""}`.trim():t=a.name||"";const n=typeof a.email_verified=="boolean"?a.email_verified:a.email_verified==="true",o={...a,name:t},s=await e.mapProfileToUser?.(o);return{user:{id:a.sub,name:o.name,emailVerified:n,email:a.email,...s},data:o}},options:e}},uw=async e=>{const{data:r}=await P("https://appleid.apple.com/auth/keys");if(!r?.keys)throw new $("BAD_REQUEST",{message:"Keys not found"});const i=r.keys.find(a=>a.kid===e);if(!i)throw new Error(`JWK with kid ${e} not found`);return await $t(i,i.alg)},lw=e=>({id:"atlassian",name:"Atlassian",async createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Secret are required for Atlassian"),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(!a)throw new ie("codeVerifier is required for Atlassian");const n=e.disableDefaultScope?[]:["read:jira-user","offline_access"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"atlassian",options:e,authorizationEndpoint:"https://auth.atlassian.com/authorize",scopes:n,state:r,codeVerifier:a,redirectURI:t,additionalParams:{audience:"api.atlassian.com"},prompt:e.prompt})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://auth.atlassian.com/oauth/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:"https://auth.atlassian.com/oauth/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);if(!r.accessToken)return null;try{const{data:i}=await P("https://api.atlassian.com/me",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(!i)return null;const a=await e.mapProfileToUser?.(i);return{user:{id:i.account_id,name:i.name,email:i.email,image:i.picture,emailVerified:!1,...a},data:i}}catch(i){return K.error("Failed to fetch user info from Figma:",i),null}},options:e}),fw=e=>{if(!e.domain||!e.region||!e.userPoolId)throw K.error("Domain, region and userPoolId are required for Amazon Cognito. Make sure to provide them in the options."),new ie("DOMAIN_AND_REGION_REQUIRED");const r=e.domain.replace(/^https?:\/\//,""),i=`https://${r}/oauth2/authorize`,a=`https://${r}/oauth2/token`,t=`https://${r}/oauth2/userinfo`;return{id:"cognito",name:"Cognito",async createAuthorizationURL({state:n,scopes:o,codeVerifier:s,redirectURI:c}){if(!e.clientId)throw K.error("ClientId is required for Amazon Cognito. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(e.requireClientSecret&&!e.clientSecret)throw K.error("Client Secret is required when requireClientSecret is true. Make sure to provide it in the options."),new ie("CLIENT_SECRET_REQUIRED");const d=e.disableDefaultScope?[]:["openid","profile","email"];e.scope&&d.push(...e.scope),o&&d.push(...o);
4const u=await M({id:"cognito",options:{...e},authorizationEndpoint:i,scopes:d,state:n,codeVerifier:s,redirectURI:c,prompt:e.prompt}),f=u.searchParams.get("scope");if(f){u.searchParams.delete("scope");const l=encodeURIComponent(f),m=u.toString(),h=m.includes("?")?"&":"?";return new URL(`${m}${h}scope=${l}`)}return u},validateAuthorizationCode:async({code:n,codeVerifier:o,redirectURI:s})=>B({code:n,codeVerifier:o,redirectURI:s,options:e,tokenEndpoint:a}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>V({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:a}),async verifyIdToken(n,o){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(n,o);try{const{kid:s,alg:c}=jt(n);if(!s||!c)return!1;const d=await mw(s,e.region,e.userPoolId),u=`https://cognito-idp.${e.region}.amazonaws.com/${e.userPoolId}`,{payload:f}=await Ye(n,d,{algorithms:[c],issuer:u,audience:e.clientId,maxTokenAge:"1h"});return!(o&&f.nonce!==o)}catch(s){return K.error("Failed to verify ID token:",s),!1}},async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);if(n.idToken)try{const o=Oe(n.idToken);if(!o)return null;const s=o.name||o.given_name||o.username||"",c={...o,name:s},d=await e.mapProfileToUser?.(c);return{user:{id:o.sub,name:c.name,email:o.email,image:o.picture,emailVerified:o.email_verified,...d},data:c}}catch(o){K.error("Failed to decode ID token:",o)}if(n.accessToken)try{const{data:o}=await P(t,{headers:{Authorization:`Bearer ${n.accessToken}`}});if(o){const s=await e.mapProfileToUser?.(o);return{user:{id:o.sub,name:o.name||o.given_name||o.username||"",email:o.email,image:o.picture,emailVerified:o.email_verified,...s},data:o}}}catch(o){K.error("Failed to fetch user info from Cognito:",o)}return null},options:e}},mw=async(e,r,i)=>{const a=`https://cognito-idp.${r}.amazonaws.com/${i}/.well-known/jwks.json`;try{const{data:t}=await P(a);if(!t?.keys)throw new $("BAD_REQUEST",{message:"Keys not found"});const n=t.keys.find(o=>o.kid===e);if(!n)throw new Error(`JWK with kid ${e} not found`);return await $t(n,n.alg)}catch(t){throw K.error("Failed to fetch Cognito public key:",t),t}},pw=e=>
4({id:"discord",name:"Discord",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["identify","email"];i&&t.push(...i),e.scope&&t.push(...e.scope);const n=t.includes("bot")&&e.permissions!==void 0?`&permissions=${e.permissions}`:"";return new URL(`https://discord.com/api/oauth2/authorize?scope=${t.join("+")}&response_type=code&client_id=${e.clientId}&redirect_uri=${encodeURIComponent(e.redirectURI||a)}&state=${r}&prompt=${e.prompt||"none"}${n}`)},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://discord.com/api/oauth2/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://discord.com/api/oauth2/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://discord.com/api/users/@me",{headers:{authorization:`Bearer ${r.accessToken}`}});if(a)return null;if(i.avatar===null)i.image_url=`https://cdn.discordapp.com/embed/avatars/${i.discriminator==="0"?Number(BigInt(i.id)>>BigInt(22))%6:parseInt(i.discriminator)%5}.png`;else{const n=i.avatar.startsWith("a_")?"gif":"png";i.image_url=`https://cdn.discordapp.com/avatars/${i.id}/${i.avatar}.${n}`}const t=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.global_name||i.username||"",email:i.email,emailVerified:i.verified,image:i.image_url,...t},data:i}},options:e}),hw=e=>{const r="https://api.dropboxapi.com/oauth2/token";return{id:"dropbox",name:"Dropbox",createAuthorizationURL:async({state:i,scopes:a,codeVerifier:t,redirectURI:n})=>{const o=e.disableDefaultScope?[]:["account_info.read"];e.scope&&o.push(...e.scope),a&&o.push(...a);const s={};return e.accessType&&(s.token_access_type=e.accessType),await M({id:"dropbox",options:e,authorizationEndpoint:"https://www.dropbox.com/oauth2/authorize",scopes:o,state:i,redirectURI:n,codeVerifier:t,additionalParams:s})},validateAuthorizationCode:async({code:i,codeVerifier:a,redirectURI:t})=>await B({code:i,codeVerifier:a,redirectURI:t,options:e,tokenEndpoint:r}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async i=>V({refreshToken:i,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:r}),async getUserInfo(i){if(e.getUserInfo)return e.getUserInfo(i);const{data:a,error:t}=await P("https://api.dropboxapi.com/2/users/get_current_account",{method:"POST",headers:{Authorization:`Bearer ${i.accessToken}`}});if(t)return null;const n=await e.mapProfileToUser?.(a);return{user:{id:a.account_id,name:a.name?.display_name,email:a.email,emailVerified:a.email_verified||!1,image:a.profile_photo_url,...n},data:a}},options:e}},gw=e=>({id:"facebook",name:"Facebook",async createAuthorizationURL({state:r,scopes:i,redirectURI:a,loginHint:t}){const n=e.disableDefaultScope?[]:["email","public_profile"];return e.scope&&n.push(...e.scope),i&&n.push(...i),await M({id:"facebook",options:e,authorizationEndpoint:"https://www.facebook.com/v24.0/dialog/oauth",scopes:n,state:r,redirectURI:a,loginHint:t,additionalParams:e.configId?{config_id:e.configId}:{}})},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://graph.facebook.com/v24.0/oauth/access_token"}),async verifyIdToken(r,i){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(r,i);if(r.split(".").length===3)try{const{payload:a}=await Ye(r,lh(new URL("https://limited.facebook.com/.well-known/oauth/openid/jwks/")),{algorithms:["RS256"],audience:e.clientId,issuer:"https://www.facebook.com"});return i&&a.nonce!==i?!1:!!a}catch{return!1}return!0},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://graph.facebook.com/v24.0/oauth/access_token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);if(r.idToken&&r.idToken.split(".").length===3){const n=Oe(r.idToken),o={id:n.sub,name:n.name,email:n.email,picture:{data:{url:n.picture,height:100,width:100,is_silhouette:!1}}},s=await e.mapProfileToUser?.({...o,email_verified:!1});return{user:{...o,emailVerified:!1,...s},data:n}}const{data:i,error:a}=await P("https://graph.facebook.com/me?fields="+["id","name","email","picture",...e?.fields||[]].join(","),{auth:{type:"Bearer",token:r.accessToken}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.name,email:i.email,image:i.picture.data.url,emailVerified:i.email_verified,...t},data:i}},options:e}),yw=e=>({id:"figma",name:"Figma",async createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Client Secret are required for Figma. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(!a)throw new ie("codeVerifier is required for Figma");const n=e.disableDefaultScope?[]:["current_user:read"];return e.scope&&n.push(...e.scope),i&&n.push(...i),await M({id:"figma",options:e,authorizationEndpoint:"https://www.figma.com/oauth",scopes:n,state:r,codeVerifier:a,redirectURI:t})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://api.figma.com/v1/oauth/token",authentication:"basic"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://api.figma.com/v1/oauth/token",authentication:"basic"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);try{const{data:i}=await P("https://api.figma.com/v1/me",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(!i)return K.error("Failed to fetch user from Figma"),null;const a=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.handle,email:i.email,image:i.img_url,emailVerified:!1,...a},data:i}}catch(i){return K.error("Failed to fetch user info from Figma:",i),null}},options:e}),vw=e=>{const r="https://github.com/login/oauth/access_token";return{id:"github",name:"GitHub",createAuthorizationURL({state:i,scopes:a,loginHint:t,codeVerifier:n,redirectURI:o}){const s=e.disableDefaultScope?[]:["read:user","user:email"];return e.scope&&s.push(...e.scope),a&&s.push(...a),M({id:"github",options:e,authorizationEndpoint:"https://github.com/login/oauth/authorize",scopes:s,state:i,codeVerifier:n,redirectURI:o,loginHint:t,prompt:e.prompt})},validateAuthorizationCode:async({code:i,codeVerifier:a,redirectURI:t})=>{const{body:n,headers:o}=Td({code:i,codeVerifier:a,redirectURI:t,options:e}),{data:s,error:c}=await P(r,{method:"POST",body:n,headers:o});return c?(K.error("GitHub OAuth token exchange failed:",c),null):"error"in s?(K.error("GitHub OAuth token exchange failed:",s),null):mi(s)},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async i=>V({refreshToken:i,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://github.com/login/oauth/access_token"}),async getUserInfo(i){if(e.getUserInfo)return e.getUserInfo(i);const{data:a,error:t}=await P("https://api.github.com/user",{headers:{"User-Agent":"better-auth",authorization:`Bearer ${i.accessToken}`}});if(t)return null;const{data:n}=await P("https://api.github.com/user/emails",{headers:{Authorization:`Bearer ${i.accessToken}`,"User-Agent":"better-auth"}});!a.email&&n&&(a.email=(n.find(c=>c.primary)??n[0])?.email);const o=n?.find(c=>c.email===a.email)?.verified??!1,s=await e.mapProfileToUser?.(a);return{user:{id:a.id,name:a.name||a.login||"",email:a.email,image:a.avatar_url,emailVerified:o,...s},data:a}},options:e}},tn=(e="")=>e.split("://").map(r=>r.replace(/\/{2,}/g,"/")).join("://"),ww=e=>{const r=e||"https://gitlab.com";return{authorizationEndpoint:tn(`${r}/oauth/authorize`),tokenEndpoint:tn(`${r}/oauth/token`),userinfoEndpoint:tn(`${r}/api/v4/user`)}},bw=e=>{const{authorizationEndpoint:r,tokenEndpoint:i,userinfoEndpoint:a}=ww(e.issuer),t="gitlab";return{id:t,name:"Gitlab",createAuthorizationURL:async({state:n,scopes:o,codeVerifier:s,loginHint:c,redirectURI:d})=>{const u=e.disableDefaultScope?[]:["read_user"];return e.scope&&u.push(...e.scope),o&&u.push(...o),await M({id:t,options:e,authorizationEndpoint:r,scopes:u,state:n,redirectURI:d,codeVerifier:s,loginHint:c})},validateAuthorizationCode:async({code:n,redirectURI:o,codeVerifier:s})=>B({code:n,redirectURI:o,options:e,codeVerifier:s,tokenEndpoint:i}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>V({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:i}),async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);const{data:o,error:s}=await P(a,{headers:{authorization:`Bearer ${n.accessToken}`}});if(s||o.state!=="active"||o.locked)return null;const c=await e.mapProfileToUser?.(o);return{user:{id:o.id,name:o.name??o.username??"",email:o.email,image:o.avatar_url,emailVerified:o.email_verified??!1,...c},data:o}},options:e}},$w=e=>({id:"google",name:"Google",async createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t,loginHint:n,display:o}
4){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Client Secret is required for Google. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(!a)throw new ie("codeVerifier is required for Google");const s=e.disableDefaultScope?[]:["email","profile","openid"];return e.scope&&s.push(...e.scope),i&&s.push(...i),await M({id:"google",options:e,authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",scopes:s,state:r,codeVerifier:a,redirectURI:t,prompt:e.prompt,accessType:e.accessType,display:o||e.display,loginHint:n,hd:e.hd,additionalParams:{include_granted_scopes:"true"}})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://oauth2.googleapis.com/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://oauth2.googleapis.com/token"}),async verifyIdToken(r,i){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(r,i);try{const{kid:a,alg:t}=jt(r);if(!a||!t)return!1;const{payload:n}=await Ye(r,await kw(a),{algorithms:[t],issuer:["https://accounts.google.com","accounts.google.com"],audience:e.clientId,maxTokenAge:"1h"});return!(i&&n.nonce!==i)}catch{return!1}},async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);if(!r.idToken)return null;const i=Oe(r.idToken),a=await e.mapProfileToUser?.(i);return{user:{id:i.sub,name:i.name,email:i.email,image:i.picture,emailVerified:i.email_verified,...a},data:i}},options:e}),kw=async e=>{const{data:r}=await P("https://www.googleapis.com/oauth2/v3/certs");if(!r?.keys)throw new $("BAD_REQUEST",{message:"Keys not found"});const i=r.keys.find(a=>a.kid===e);if(!i)throw new Error(`JWK with kid ${e} not found`);return await $t(i,i.alg)},Sw=e=>({id:"huggingface",name:"Hugging Face",createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["openid","profile","email"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"huggingface",options:e,authorizationEndpoint:"https://huggingface.co/oauth/authorize",scopes:n,state:r,codeVerifier:a,redirectURI:t})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://huggingface.co/oauth/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://huggingface.co/oauth/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://huggingface.co/oauth/userinfo",{method:"GET",headers:{Authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.sub,name:i.name||i.preferred_username||"",email:i.email,image:i.picture,emailVerified:i.email_verified??!1,...t},data:i}},options:e}),Iw=e=>({id:"kakao",name:"Kakao",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["account_email","profile_image","profile_nickname"];return e.scope&&t.push(...e.scope),i&&t.push(...i),M({id:"kakao",options:e,authorizationEndpoint:"https://kauth.kakao.com/oauth/authorize",scopes:t,state:r,redirectURI:a})},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://kauth.kakao.com/oauth/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://kauth.kakao.com/oauth/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://kapi.kakao.com/v2/user/me",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(a||!i)return null;const t=await e.mapProfileToUser?.(i),n=i.kakao_account||{},o=n.profile||{};return{user:{id:String(i.id),name:o.nickname||n.name||"",email:n.email,image:o.profile_image_url||o.thumbnail_image_url,emailVerified:!!n.is_email_valid&&!!n.is_email_verified,...t},data:i}},options:e}),_w=e=>({id:"kick",name:"Kick",createAuthorizationURL({state:r,scopes:i,redirectURI:a,codeVerifier:t}){const n=e.disableDefaultScope?[]:["user:read"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"kick",redirectURI:a,options:e,authorizationEndpoint:"https://id.kick.com/oauth/authorize",scopes:n,codeVerifier:t,state:r})},async validateAuthorizationCode({code:r,redirectURI:i,codeVerifier:a}){return B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://id.kick.com/oauth/token",codeVerifier:a})},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:"https://id.kick.com/oauth/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://api.kick.com/public/v1/users",{method:"GET",headers:{Authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=i.data[0],n=await e.mapProfileToUser?.(t);return{user:{id:t.user_id,name:t.name,email:t.email,image:t.profile_picture,emailVerified:!1,...n},data:t}},options:e}),Aw=e=>{const r="https://access.line.me/oauth2/v2.1/authorize",i="https://api.line.me/oauth2/v2.1/token",a="https://api.line.me/oauth2/v2.1/userinfo",t="https://api.line.me/oauth2/v2.1/verify";return{id:"line",name:"LINE",async createAuthorizationURL({state:n,scopes:o,codeVerifier:s,redirectURI:c,loginHint:d}){const u=e.disableDefaultScope?[]:["openid","profile","email"];return e.scope&&u.push(...e.scope),o&&u.push(...o),await M({id:"line",options:e,authorizationEndpoint:r,scopes:u,state:n,codeVerifier:s,redirectURI:c,loginHint:d})},validateAuthorizationCode:async({code:n,codeVerifier:o,redirectURI:s})=>B({code:n,codeVerifier:o,redirectURI:s,options:e,tokenEndpoint:i}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>V({refreshToken:n,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:i}),async verifyIdToken(n,o){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(n,o);const s=new URLSearchParams;s.set("id_token",n),s.set("client_id",e.clientId),o&&s.set("nonce",o);const{data:c,error:d}=await P(t,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s});return!(d||!c||c.aud!==e.clientId||c.nonce&&c.nonce!==o)},async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);let o=null;if(n.idToken)try{o=Oe(n.idToken)}catch{}if(!o){const{data:f}=await P(a,{headers:{authorization:`Bearer ${n.accessToken}`}});o=f||null}if(!o)return null;const s=await e.mapProfileToUser?.(o),c=o.sub||o.userId,d=o.name||o.displayName||"",u=o.picture||o.pictureUrl||void 0;return{user:{id:c,name:d,email:o.email,image:u,emailVerified:!1,...s},data:o}},options:e}},Uw=e=>{const r="https://api.linear.app/oauth/token";return{id:"linear",name:"Linear",createAuthorizationURL({state:i,scopes:a,loginHint:t,redirectURI:n}){const o=e.disableDefaultScope?[]:["read"];return e.scope&&o.push(...e.scope),a&&o.push(...a),M({id:"linear",options:e,authorizationEndpoint:"https://linear.app/oauth/authorize",scopes:o,state:i,redirectURI:n,loginHint:t})},validateAuthorizationCode:async({code:i,redirectURI:a})=>B({code:i,redirectURI:a,options:e,tokenEndpoint:r}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async i=>V({refreshToken:i,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:r}),async getUserInfo(i){if(e.getUserInfo)return e.getUserInfo(i);const{data:a,error:t}=await P("https://api.linear.app/graphql",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i.accessToken}`},body:JSON.stringify({query:`
5							query {
6								viewer {
7									id
8									name
9									email
10									avatarUrl
11									active
12									createdAt
13									updatedAt
14								}
15							}
16						`})});if(t||!a?.data?.viewer)return null;const n=a.data.viewer,o=await e.mapProfileToUser?.(n);return{user:{id:a.data.viewer.id,name:a.data.viewer.name,email:a.data.viewer.email,image:a.data.viewer.avatarUrl,emailVerified:!1,...o},data:n}},options:e}},Ew=e=>{const r="https://www.linkedin.com/oauth/v2/authorization",i="https://www.linkedin.com/oauth/v2/accessToken";return{id:"linkedin",name:"Linkedin",createAuthorizationURL:async({state:a,scopes:t,redirectURI:n,loginHint:o})=>{const s=e.disableDefaultScope?[]:["profile","email","openid"];return e.scope&&s.push(...e.scope),t&&s.push(...t),await M({id:"linkedin",options:e,authorizationEndpoint:r,scopes:s,state:a,loginHint:o,redirectURI:n})},validateAuthorizationCode:async({code:a,redirectURI:t})=>await B({code:a,redirectURI:t,options:e,tokenEndpoint:i}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async a=>V({refreshToken:a,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:i}
16),async getUserInfo(a){if(e.getUserInfo)return e.getUserInfo(a);const{data:t,error:n}=await P("https://api.linkedin.com/v2/userinfo",{method:"GET",headers:{Authorization:`Bearer ${a.accessToken}`}});if(n)return null;const o=await e.mapProfileToUser?.(t);return{user:{id:t.sub,name:t.name,email:t.email,emailVerified:t.email_verified||!1,image:t.picture,...o},data:t}},options:e}},xw=e=>{const r=e.tenantId||"common",i=e.authority||"https://login.microsoftonline.com",a=`${i}/${r}/oauth2/v2.0/authorize`,t=`${i}/${r}/oauth2/v2.0/token`;return{id:"microsoft",name:"Microsoft EntraID",createAuthorizationURL(n){const o=e.disableDefaultScope?[]:["openid","profile","email","User.Read","offline_access"];return e.scope&&o.push(...e.scope),n.scopes&&o.push(...n.scopes),M({id:"microsoft",options:e,authorizationEndpoint:a,state:n.state,codeVerifier:n.codeVerifier,scopes:o,redirectURI:n.redirectURI,prompt:e.prompt,loginHint:n.loginHint})},validateAuthorizationCode({code:n,codeVerifier:o,redirectURI:s}){return B({code:n,codeVerifier:o,redirectURI:s,options:e,tokenEndpoint:t})},async verifyIdToken(n,o){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(n,o);try{const{kid:s,alg:c}=jt(n);if(!s||!c)return!1;const d=await Tw(s,r,i),u={algorithms:[c],audience:e.clientId,maxTokenAge:"1h"};r!=="common"&&r!=="organizations"&&r!=="consumers"&&(u.issuer=`${i}/${r}/v2.0`);const{payload:f}=await Ye(n,d,u);return!(o&&f.nonce!==o)}catch(s){return K.error("Failed to verify ID token:",s),!1}},async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);if(!n.idToken)return null;const o=Oe(n.idToken),s=e.profilePhotoSize||48;await P(`https://graph.microsoft.com/v1.0/me/photos/${s}x${s}/$value`,{headers:{Authorization:`Bearer ${n.accessToken}`},async onResponse(u){if(!(e.disableProfilePhoto||!u.response.ok))try{const f=await u.response.clone().arrayBuffer();o.picture=`data:image/jpeg;base64, ${We.encode(f)}`}catch(f){K.error(f&&typeof f=="object"&&"name"in f?f.name:"",f)}}});const c=await e.mapProfileToUser?.(o),d=o.email_verified!==void 0?o.email_verified:!!(o.email&&(o.verified_primary_email?.includes(o.email)||o.verified_secondary_email?.includes(o.email)));return{user:{id:o.sub,name:o.name,email:o.email,image:o.picture,emailVerified:d,...c},data:o}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>{const o=e.disableDefaultScope?[]:["openid","profile","email","User.Read","offline_access"];return e.scope&&o.push(...e.scope),V({refreshToken:n,options:{clientId:e.clientId,clientSecret:e.clientSecret},extraParams:{scope:o.join(" ")},tokenEndpoint:t})},options:e}},Tw=async(e,r,i)=>{const{data:a}=await P(`${i}/${r}/discovery/v2.0/keys`);if(!a?.keys)throw new $("BAD_REQUEST",{message:"Keys not found"});const t=a.keys.find(n=>n.kid===e);if(!t)throw new Error(`JWK with kid ${e} not found`);return await $t(t,t.alg)},Dw=e=>({id:"naver",name:"Naver",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["profile","email"];return e.scope&&t.push(...e.scope),i&&t.push(...i),M({id:"naver",options:e,authorizationEndpoint:"https://nid.naver.com/oauth2.0/authorize",scopes:t,state:r,redirectURI:a})},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://nid.naver.com/oauth2.0/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://nid.naver.com/oauth2.0/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://openapi.naver.com/v1/nid/me",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(a||!i||i.resultcode!=="00")return null;const t=await e.mapProfileToUser?.(i),n=i.response||{};return{user:{id:n.id,name:n.name||n.nickname||"",email:n.email,image:n.profile_image,emailVerified:!1,...t},data:i}},options:e}),Rw=e=>{const r="https://api.notion.com/v1/oauth/token";return{id:"notion",name:"Notion",createAuthorizationURL({state:i,scopes:a,loginHint:t,redirectURI:n}){const o=e.disableDefaultScope?[]:[];return e.scope&&o.push(...e.scope),a&&o.push(...a),M({id:"notion",options:e,authorizationEndpoint:"https://api.notion.com/v1/oauth/authorize",scopes:o,state:i,redirectURI:n,loginHint:t,additionalParams:{owner:"user"}})},validateAuthorizationCode:async({code:i,redirectURI:a})=>B({code:i,redirectURI:a,options:e,tokenEndpoint:r,authentication:"basic"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async i=>V({refreshToken:i,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:r}),async getUserInfo(i){if(e.getUserInfo)return e.getUserInfo(i);const{data:a,error:t}=await P("https://api.notion.com/v1/users/me",{headers:{Authorization:`Bearer ${i.accessToken}`,"Notion-Version":"2022-06-28"}});if(t||!a)return null;const n=a.bot?.owner?.user;if(!n)return null;const o=await e.mapProfileToUser?.(n);return{user:{id:n.id,name:n.name||"",email:n.person?.email||null,image:n.avatar_url,emailVerified:!1,...o},data:n}},options:e}},Ow=e=>{const r=e.issuer||"https://idp.paybin.io",i=`${r}/oauth2/authorize`,a=`${r}/oauth2/token`;return{id:"paybin",name:"Paybin",async createAuthorizationURL({state:t,scopes:n,codeVerifier:o,redirectURI:s,loginHint:c}){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Client Secret is required for Paybin. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(!o)throw new ie("codeVerifier is required for Paybin");const d=e.disableDefaultScope?[]:["openid","email","profile"];return e.scope&&d.push(...e.scope),n&&d.push(...n),await M({id:"paybin",options:e,authorizationEndpoint:i,scopes:d,state:t,codeVerifier:o,redirectURI:s,prompt:e.prompt,loginHint:c})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:o})=>B({code:t,codeVerifier:n,redirectURI:o,options:e,tokenEndpoint:a}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>V({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:a}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.idToken)return null;const n=Oe(t.idToken),o=await e.mapProfileToUser?.(n);return{user:{id:n.sub,name:n.name||n.preferred_username||"",email:n.email,image:n.picture,emailVerified:n.email_verified||!1,...o},data:n}},options:e}},Cw=e=>{const r=(e.environment||"sandbox")==="sandbox",i=r?"https://www.sandbox.paypal.com/signin/authorize":"https://www.paypal.com/signin/authorize",a=r?"https://api-m.sandbox.paypal.com/v1/oauth2/token":"https://api-m.paypal.com/v1/oauth2/token",t=r?"https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo":"https://api-m.paypal.com/v1/identity/oauth2/userinfo";return{id:"paypal",name:"PayPal",async createAuthorizationURL({state:n,codeVerifier:o,redirectURI:s}){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Client Secret is required for PayPal. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");return await M({id:"paypal",options:e,authorizationEndpoint:i,scopes:[],state:n,codeVerifier:o,redirectURI:s,prompt:e.prompt})},validateAuthorizationCode:async({code:n,redirectURI:o})=>{const s=We.encode(`${e.clientId}:${e.clientSecret}`);try{const c=await P(a,{method:"POST",headers:{Authorization:`Basic ${s}`,Accept:"application/json","Accept-Language":"en_US","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:o}).toString()});if(!c.data)throw new ie("FAILED_TO_GET_ACCESS_TOKEN");const d=c.data;return{accessToken:d.access_token,refreshToken:d.refresh_token,accessTokenExpiresAt:d.expires_in?new Date(Date.now()+d.expires_in*1e3):void 0,idToken:d.id_token}}catch(c){throw K.error("PayPal token exchange failed:",c),new ie("FAILED_TO_GET_ACCESS_TOKEN")}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>{const o=We.encode(`${e.clientId}:${e.clientSecret}`);try{const s=await P(a,{method:"POST",headers:{Authorization:`Basic ${o}`,Accept:"application/json","Accept-Language":"en_US","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:n}).toString()});if(!s.data)throw new ie("FAILED_TO_REFRESH_ACCESS_TOKEN");const c=s.data;return{accessToken:c.access_token,refreshToken:c.refresh_token,accessTokenExpiresAt:c.expires_in?new Date(Date.now()+c.expires_in*1e3):void 0}}catch(s){throw K.error("PayPal token refresh failed:",s),new ie("FAILED_TO_REFRESH_ACCESS_TOKEN")}},async verifyIdToken(n,o){if(e.disableIdTokenSignIn)return!1;if(e.verifyIdToken)return e.verifyIdToken(n,o);try{return!!Oe(n).sub}
16catch(s){return K.error("Failed to verify PayPal ID token:",s),!1}},async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);if(!n.accessToken)return K.error("Access token is required to fetch PayPal user info"),null;try{const o=await P(`${t}?schema=paypalv1.1`,{headers:{Authorization:`Bearer ${n.accessToken}`,Accept:"application/json"}});if(!o.data)return K.error("Failed to fetch user info from PayPal"),null;const s=o.data,c=await e.mapProfileToUser?.(s);return{user:{id:s.user_id,name:s.name,email:s.email,image:s.picture,emailVerified:s.email_verified,...c},data:s}}catch(o){return K.error("Failed to fetch user info from PayPal:",o),null}},options:e}},Pw=e=>({id:"polar",name:"Polar",createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["openid","profile","email"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"polar",options:e,authorizationEndpoint:"https://polar.sh/oauth2/authorize",scopes:n,state:r,codeVerifier:a,redirectURI:t,prompt:e.prompt})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://api.polar.sh/v1/oauth2/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://api.polar.sh/v1/oauth2/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://api.polar.sh/v1/oauth2/userinfo",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.public_name||i.username||"",email:i.email,image:i.avatar_url,emailVerified:i.email_verified??!1,...t},data:i}},options:e}),Lw="https://backboard.railway.com/oauth/auth",Fi="https://backboard.railway.com/oauth/token",Nw="https://backboard.railway.com/oauth/me",zw=e=>({id:"railway",name:"Railway",createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["openid","email","profile"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"railway",options:e,authorizationEndpoint:Lw,scopes:n,state:r,codeVerifier:a,redirectURI:t})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:Fi,authentication:"basic"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:Fi,authentication:"basic"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P(Nw,{headers:{authorization:`Bearer ${r.accessToken}`}});if(a||!i)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.sub,name:i.name,email:i.email,image:i.picture,emailVerified:!1,...t},data:i}},options:e}),jw=e=>({id:"reddit",name:"Reddit",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["identity"];return e.scope&&t.push(...e.scope),i&&t.push(...i),M({id:"reddit",options:e,authorizationEndpoint:"https://www.reddit.com/api/v1/authorize",scopes:t,state:r,redirectURI:a,duration:e.duration})},validateAuthorizationCode:async({code:r,redirectURI:i})=>{const a=new URLSearchParams({grant_type:"authorization_code",code:r,redirect_uri:e.redirectURI||i}),{data:t,error:n}=await P("https://www.reddit.com/api/v1/access_token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded",accept:"text/plain","user-agent":"better-auth",Authorization:`Basic ${We.encode(`${e.clientId}:${e.clientSecret}`)}`},body:a.toString()});if(n)throw n;return mi(t)},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},authentication:"basic",tokenEndpoint:"https://www.reddit.com/api/v1/access_token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://oauth.reddit.com/api/v1/me",{headers:{Authorization:`Bearer ${r.accessToken}`,"User-Agent":"better-auth"}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.name,email:i.oauth_client_id,emailVerified:i.has_verified_email,image:i.icon_img?.split("?")[0],...t},data:i}},options:e}),Kw=e=>({id:"roblox",name:"Roblox",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["openid","profile"];return e.scope&&t.push(...e.scope),i&&t.push(...i),new URL(`https://apis.roblox.com/oauth/v1/authorize?scope=${t.join("+")}&response_type=code&client_id=${e.clientId}&redirect_uri=${encodeURIComponent(e.redirectURI||a)}&state=${r}&prompt=${e.prompt||"select_account consent"}`)},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:e.redirectURI||i,options:e,tokenEndpoint:"https://apis.roblox.com/oauth/v1/token",authentication:"post"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://apis.roblox.com/oauth/v1/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://apis.roblox.com/oauth/v1/userinfo",{headers:{authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.sub,name:i.nickname||i.preferred_username||"",image:i.picture,email:i.preferred_username||null,emailVerified:!1,...t},data:{...i}}},options:e}),Hw=e=>{const r=(e.environment??"production")==="sandbox",i=e.loginUrl?`https://${e.loginUrl}/services/oauth2/authorize`:r?"https://test.salesforce.com/services/oauth2/authorize":"https://login.salesforce.com/services/oauth2/authorize",a=e.loginUrl?`https://${e.loginUrl}/services/oauth2/token`:r?"https://test.salesforce.com/services/oauth2/token":"https://login.salesforce.com/services/oauth2/token",t=e.loginUrl?`https://${e.loginUrl}/services/oauth2/userinfo`:r?"https://test.salesforce.com/services/oauth2/userinfo":"https://login.salesforce.com/services/oauth2/userinfo";return{id:"salesforce",name:"Salesforce",async createAuthorizationURL({state:n,scopes:o,codeVerifier:s,redirectURI:c}){if(!e.clientId||!e.clientSecret)throw K.error("Client Id and Client Secret are required for Salesforce. Make sure to provide them in the options."),new ie("CLIENT_ID_AND_SECRET_REQUIRED");if(!s)throw new ie("codeVerifier is required for Salesforce");const d=e.disableDefaultScope?[]:["openid","email","profile"];return e.scope&&d.push(...e.scope),o&&d.push(...o),M({id:"salesforce",options:e,authorizationEndpoint:i,scopes:d,state:n,codeVerifier:s,redirectURI:e.redirectURI||c})},validateAuthorizationCode:async({code:n,codeVerifier:o,redirectURI:s})=>B({code:n,codeVerifier:o,redirectURI:e.redirectURI||s,options:e,tokenEndpoint:a}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>V({refreshToken:n,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:a}),async getUserInfo(n){if(e.getUserInfo)return e.getUserInfo(n);try{const{data:o}=await P(t,{headers:{Authorization:`Bearer ${n.accessToken}`}});if(!o)return K.error("Failed to fetch user info from Salesforce"),null;const s=await e.mapProfileToUser?.(o);
16return{user:{id:o.user_id,name:o.name,email:o.email,image:o.photos?.picture||o.photos?.thumbnail,emailVerified:o.email_verified??!1,...s},data:o}}catch(o){return K.error("Failed to fetch user info from Salesforce:",o),null}},options:e}},Ww=e=>({id:"slack",name:"Slack",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["openid","profile","email"];i&&t.push(...i),e.scope&&t.push(...e.scope);const n=new URL("https://slack.com/openid/connect/authorize");return n.searchParams.set("scope",t.join(" ")),n.searchParams.set("response_type","code"),n.searchParams.set("client_id",e.clientId),n.searchParams.set("redirect_uri",e.redirectURI||a),n.searchParams.set("state",r),n},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://slack.com/api/openid.connect.token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://slack.com/api/openid.connect.token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://slack.com/api/openid.connect.userInfo",{headers:{authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i["https://slack.com/user_id"],name:i.name||"",email:i.email,emailVerified:i.email_verified,image:i.picture||i["https://slack.com/user_image_512"],...t},data:i}},options:e}),Vw=e=>({id:"spotify",name:"Spotify",createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["user-read-email"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"spotify",options:e,authorizationEndpoint:"https://accounts.spotify.com/authorize",scopes:n,state:r,codeVerifier:a,redirectURI:t})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://accounts.spotify.com/api/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://accounts.spotify.com/api/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://api.spotify.com/v1/me",{method:"GET",headers:{Authorization:`Bearer ${r.accessToken}`}});if(a)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.id,name:i.display_name,email:i.email,image:i.images[0]?.url,emailVerified:!1,...t},data:i}},options:e}),Jw=e=>
16({id:"tiktok",name:"TikTok",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["user.info.profile"];return e.scope&&t.push(...e.scope),i&&t.push(...i),new URL(`https://www.tiktok.com/v2/auth/authorize?scope=${t.join(",")}&response_type=code&client_key=${e.clientKey}&redirect_uri=${encodeURIComponent(e.redirectURI||a)}&state=${r}`)},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:e.redirectURI||i,options:{clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://open.tiktokapis.com/v2/oauth/token/"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientSecret:e.clientSecret},tokenEndpoint:"https://open.tiktokapis.com/v2/oauth/token/",authentication:"post",extraParams:{client_key:e.clientKey}}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P(`https://open.tiktokapis.com/v2/user/info/?fields=${["open_id","avatar_large_url","display_name","username"].join(",")}`,{headers:{authorization:`Bearer ${r.accessToken}`}});return a?null:{user:{email:i.data.user.email||i.data.user.username,id:i.data.user.open_id,name:i.data.user.display_name||i.data.user.username||"",image:i.data.user.avatar_large_url,emailVerified:!1},data:i}},options:e}),Bw=e=>({id:"twitch",name:"Twitch",createAuthorizationURL({state:r,scopes:i,redirectURI:a}){const t=e.disableDefaultScope?[]:["user:read:email","openid"];return e.scope&&t.push(...e.scope),i&&t.push(...i),M({id:"twitch",redirectURI:a,options:e,authorizationEndpoint:"https://id.twitch.tv/oauth2/authorize",scopes:t,state:r,claims:e.claims||["email","email_verified","preferred_username","picture"]})},validateAuthorizationCode:async({code:r,redirectURI:i})=>B({code:r,redirectURI:i,options:e,tokenEndpoint:"https://id.twitch.tv/oauth2/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://id.twitch.tv/oauth2/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const i=r.idToken;if(!i)return K.error("No idToken found in token"),null;const a=Oe(i),t=await e.mapProfileToUser?.(a);return{user:{id:a.sub,name:a.preferred_username,email:a.email,image:a.picture,emailVerified:a.email_verified,...t},data:a}},options:e}),Mw=e=>({id:"twitter",name:"Twitter",createAuthorizationURL(r){const i=e.disableDefaultScope?[]:["users.read","tweet.read","offline.access","users.email"];return e.scope&&i.push(...e.scope),r.scopes&&i.push(...r.scopes),M({id:"twitter",options:e,authorizationEndpoint:"https://x.com/i/oauth2/authorize",scopes:i,state:r.state,codeVerifier:r.codeVerifier,redirectURI:r.redirectURI})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,authentication:"basic",redirectURI:a,options:e,tokenEndpoint:"https://api.x.com/2/oauth2/token"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},authentication:"basic",tokenEndpoint:"https://api.x.com/2/oauth2/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://api.x.com/2/users/me?user.fields=profile_image_url",{method:"GET",headers:{Authorization:`Bearer ${r.accessToken}`}});if(a)return null;const{data:t,error:n}=await P("https://api.x.com/2/users/me?user.fields=confirmed_email",{method:"GET",headers:{Authorization:`Bearer ${r.accessToken}`}});let o=!1;!n&&t?.data?.confirmed_email&&(i.data.email=t.data.confirmed_email,o=!0);const s=await e.mapProfileToUser?.(i);return{user:{id:i.data.id,name:i.data.name,email:i.data.email||i.data.username||null,image:i.data.profile_image_url,emailVerified:o,...s},data:i}},options:e}),qw=e=>({id:"vercel",name:"Vercel",createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){if(!a)throw new ie("codeVerifier is required for Vercel");let n;return(e.scope!==void 0||i!==void 0)&&(n=[],e.scope&&n.push(...e.scope),i&&n.push(...i)),M({id:"vercel",options:e,authorizationEndpoint:"https://vercel.com/oauth/authorize",scopes:n,state:r,codeVerifier:a,redirectURI:t})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>B({code:r,codeVerifier:i,redirectURI:a,options:e,tokenEndpoint:"https://api.vercel.com/login/oauth/token"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);const{data:i,error:a}=await P("https://api.vercel.com/login/oauth/userinfo",{headers:{Authorization:`Bearer ${r.accessToken}`}});if(a||!i)return null;const t=await e.mapProfileToUser?.(i);return{user:{id:i.sub,name:i.name??i.preferred_username??"",email:i.email,image:i.picture,emailVerified:i.email_verified??!1,...t},data:i}},options:e}
16),Fw=e=>({id:"vk",name:"VK",async createAuthorizationURL({state:r,scopes:i,codeVerifier:a,redirectURI:t}){const n=e.disableDefaultScope?[]:["email","phone"];return e.scope&&n.push(...e.scope),i&&n.push(...i),M({id:"vk",options:e,authorizationEndpoint:"https://id.vk.com/authorize",scopes:n,state:r,redirectURI:t,codeVerifier:a})},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a,deviceId:t})=>B({code:r,codeVerifier:i,redirectURI:e.redirectURI||a,options:e,deviceId:t,tokenEndpoint:"https://id.vk.com/oauth2/auth"}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async r=>V({refreshToken:r,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:"https://id.vk.com/oauth2/auth"}),async getUserInfo(r){if(e.getUserInfo)return e.getUserInfo(r);if(!r.accessToken)return null;const i=new URLSearchParams({access_token:r.accessToken,client_id:e.clientId}).toString(),{data:a,error:t}=await P("https://id.vk.com/oauth2/user_info",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i});if(t)return null;const n=await e.mapProfileToUser?.(a);return!a.user.email&&!n?.email?null:{user:{id:a.user.user_id,first_name:a.user.first_name,last_name:a.user.last_name,email:a.user.email,image:a.user.avatar,emailVerified:!1,birthday:a.user.birthday,sex:a.user.sex,name:`${a.user.first_name} ${a.user.last_name}`,...n},data:a}},options:e}),Zw=e=>{const r={pkce:!0,...e};return{id:"zoom",name:"Zoom",createAuthorizationURL:async({state:i,redirectURI:a,codeVerifier:t})=>{const n=new URLSearchParams({response_type:"code",redirect_uri:r.redirectURI?r.redirectURI:a,client_id:r.clientId,state:i});if(r.pkce){const s=await xd(t);n.set("code_challenge_method","S256"),n.set("code_challenge",s)}const o=new URL("https://zoom.us/oauth/authorize");return o.search=n.toString(),o},validateAuthorizationCode:async({code:i,redirectURI:a,codeVerifier:t})=>B({code:i,redirectURI:r.redirectURI||a,codeVerifier:t,options:r,tokenEndpoint:"https://zoom.us/oauth/token",authentication:"post"}),refreshAccessToken:r.refreshAccessToken?r.refreshAccessToken:async i=>V({refreshToken:i,options:{clientId:r.clientId,clientKey:r.clientKey,clientSecret:r.clientSecret},tokenEndpoint:"https://zoom.us/oauth/token"}),async getUserInfo(i){if(r.getUserInfo)return r.getUserInfo(i);const{data:a,error:t}=await P("https://api.zoom.us/v2/users/me",{headers:{authorization:`Bearer ${i.accessToken}`}});if(t)return null;const n=await r.mapProfileToUser?.(a);return{user:{id:a.id,name:a.display_name,image:a.pic_url,email:a.email,emailVerified:!!a.verified,...n},data:{...a}}}}},Gw={apple:dw,atlassian:lw,cognito:fw,discord:pw,facebook:gw,figma:yw,github:vw,microsoft:xw,google:$w,huggingface:Sw,slack:Ww,spotify:Vw,twitch:Bw,twitter:Mw,dropbox:hw,kick:_w,linear:Uw,linkedin:Ew,gitlab:bw,tiktok:Jw,reddit:jw,roblox:Kw,salesforce:Hw,vk:Fw,zoom:Zw,notion:Rw,kakao:Iw,naver:Dw,line:Aw,paybin:Ow,paypal:Cw,polar:Pw,railway:zw,vercel:qw},Qw=Object.keys(Gw),Dd=Mn(Qw).or(b());Z("/list-accounts",{method:"GET",use:[fi],metadata:{openapi:{operationId:"listUserAccounts",description:"List all accounts linked to the user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"array",items:{type:"object",properties:{id:{type:"string"},providerId:{type:"string"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},accountId:{type:"string"},userId:{type:"string"},scopes:{type:"array",items:{type:"string"}}},required:["id","providerId","createdAt","updatedAt","accountId","userId","scopes"]}}}}}}}}},async e=>{const r=e.context.session,i=await e.context.internalAdapter.findAccounts(r.user.id);return e.json(i.map(a=>{const{scope:t,...n}=ld(e.context.options,a);return{...n,scopes:t?.split(",")||[]}}))});Z("/link-social",{method:"POST",requireHeaders:!0,body:W({callbackURL:b().meta({description:"The URL to redirect to after the user has signed in"}).optional(),provider:Dd,idToken:W({token:b(),nonce:b().optional(),accessToken:b().optional(),refreshToken:b().optional(),scopes:pt(b()).optional()}).optional(),requestSignUp:Ae().optional(),scopes:pt(b()).meta({description:"Additional scopes to request from the provider"}).optional(),errorCallbackURL:b().meta({description:"The URL to redirect to if there is an error during the link process"}).optional(),disableRedirect:Ae().meta({description:"Disable automatic redirection to the provider. Useful for handling the redirection yourself"}).optional(),additionalData:Qe(b(),De()).optional()}),use:[fi],metadata:{openapi:{description:"Link a social account to the user",operationId:"linkSocialAccount",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{url:{type:"string",description:"The authorization URL to redirect the user to"},redirect:{type:"boolean",description:"Indicates if the user should be redirected to the authorization URL"},status:{type:"boolean"}},required:["redirect"]}}}}}}}},async e=>{const r=e.context.session,i=await Vt(e.context.socialProviders,{value:e.body.provider});if(!i)throw e.context.logger.error("Provider not found. Make sure to add the provider in your auth config",{provider:e.body.provider}),$.from("NOT_FOUND",_.PROVIDER_NOT_FOUND);if(e.body.idToken){if(!i.verifyIdToken)throw e.context.logger.error("Provider does not support id token verification",{provider:e.body.provider}),$.from("NOT_FOUND",_.ID_TOKEN_NOT_SUPPORTED);const{token:n,nonce:o}=e.body.idToken;if(!await i.verifyIdToken(n,o))throw e.context.logger.error("Invalid id token",{provider:e.body.provider}),$.from("UNAUTHORIZED",_.INVALID_TOKEN);const s=await i.getUserInfo({idToken:n,accessToken:e.body.idToken.accessToken,refreshToken:e.body.idToken.refreshToken});if(!s||!s?.user)throw e.context.logger.error("Failed to get user info",{provider:e.body.provider}),$.from("UNAUTHORIZED",_.FAILED_TO_GET_USER_INFO);const c=String(s.user.id);if(!s.user.email)throw e.context.logger.error("User email not found",{provider:e.body.provider}),$.from("UNAUTHORIZED",_.USER_EMAIL_NOT_FOUND);
16if((await e.context.internalAdapter.findAccounts(r.user.id)).find(d=>d.providerId===i.id&&d.accountId===c))return e.json({url:"",status:!0,redirect:!1});if(!e.context.trustedProviders.includes(i.id)&&!s.user.emailVerified||e.context.options.account?.accountLinking?.enabled===!1)throw $.from("UNAUTHORIZED",{message:"Account not linked - linking not allowed",code:"LINKING_NOT_ALLOWED"});if(s.user.email?.toLowerCase()!==r.user.email.toLowerCase()&&e.context.options.account?.accountLinking?.allowDifferentEmails!==!0)throw $.from("UNAUTHORIZED",{message:"Account not linked - different emails not allowed",code:"LINKING_DIFFERENT_EMAILS_NOT_ALLOWED"});try{await e.context.internalAdapter.createAccount({userId:r.user.id,providerId:i.id,accountId:c,accessToken:e.body.idToken.accessToken,idToken:n,refreshToken:e.body.idToken.refreshToken,scope:e.body.idToken.scopes?.join(",")})}catch{throw $.from("EXPECTATION_FAILED",{message:"Account not linked - unable to create account",code:"LINKING_FAILED"})}if(e.context.options.account?.accountLinking?.updateUserInfoOnLink===!0)try{await e.context.internalAdapter.updateUser(r.user.id,{name:s.user?.name,image:s.user?.image})}catch(d){console.warn("Could not update user - "+d.toString())}return e.json({url:"",status:!0,redirect:!1})}const a=await vv(e,{userId:r.user.id,email:r.user.email},e.body.additionalData),t=await i.createAuthorizationURL({state:a.state,codeVerifier:a.codeVerifier,redirectURI:`${e.context.baseURL}/callback/${i.id}`,scopes:e.body.scopes});return e.body.disableRedirect||e.setHeader("Location",t.toString()),e.json({url:t.toString(),redirect:!e.body.disableRedirect})});Z("/unlink-account",{method:"POST",body:W({providerId:b(),accountId:b().optional()}),use:[aw],metadata:{openapi:{description:"Unlink an account",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean"}}}}}}}}}},async e=>{const{providerId:r,accountId:i}=e.body,a=await e.context.internalAdapter.findAccounts(e.context.session.user.id);if(a.length===1&&!e.context.options.account?.accountLinking?.allowUnlinkingAll)throw $.from("BAD_REQUEST",_.FAILED_TO_UNLINK_LAST_ACCOUNT);const t=a.find(n=>i?n.accountId===i&&n.providerId===r:n.providerId===r);if(!t)throw $.from("BAD_REQUEST",_.ACCOUNT_NOT_FOUND);return await e.context.internalAdapter.deleteAccount(t.id),e.json({status:!0})});const Xw=Z("/get-access-token",{method:"POST",body:W({providerId:b().meta({description:"The provider ID for the OAuth provider"}),accountId:b().meta({description:"The account ID associated with the refresh token"}).optional(),userId:b().meta({description:"The user ID associated with the account"}).optional()}),metadata:{openapi:{description:"Get a valid access token, doing a refresh if needed",responses:{200:{description:"A Valid access token",content:{"application/json":{schema:{type:"object",properties:{tokenType:{type:"string"},idToken:{type:"string"},accessToken:{type:"string"},accessTokenExpiresAt:{type:"string",format:"date-time"}}}}}},400:{description:"Invalid refresh token or provider configuration"}}}}},async e=>{const{providerId:r,accountId:i,userId:a}=e.body||{},t=e.request,n=await Ue(e);if(t&&!n)throw e.error("UNAUTHORIZED");const o=n?.user?.id||a;if(!o)throw e.error("UNAUTHORIZED");const s=await Vt(e.context.socialProviders,{value:r});if(!s)throw $.from("BAD_REQUEST",{message:`Provider ${r} is not supported.`,code:"PROVIDER_NOT_SUPPORTED"});const c=await Jr(e);let d;if(c&&r===c.providerId&&(!i||c.id===i)?d=c:d=(await e.context.internalAdapter.findAccounts(o)).find(u=>i?u.accountId===i&&u.providerId===r:u.providerId===r),!d)throw $.from("BAD_REQUEST",_.ACCOUNT_NOT_FOUND);try{let u=null;const f=d.accessTokenExpiresAt&&new Date(d.accessTokenExpiresAt).getTime()-Date.now()<5e3;if(d.refreshToken&&f&&s.refreshAccessToken){const h=await _n(d.refreshToken,e.context);u=await s.refreshAccessToken(h);const g={accessToken:await fe(u?.accessToken,e.context),accessTokenExpiresAt:u?.accessTokenExpiresAt,refreshToken:u?.refreshToken?await fe(u.refreshToken,e.context):d.refreshToken,refreshTokenExpiresAt:u?.refreshTokenExpiresAt??d.refreshTokenExpiresAt,idToken:u?.idToken||d.idToken};let p=null;
16d.id&&(p=await e.context.internalAdapter.updateAccount(d.id,g)),e.context.options.account?.storeAccountCookie&&await Pt(e,{...d,...p??g})}const l=(()=>{if(u?.accessTokenExpiresAt)return typeof u.accessTokenExpiresAt=="string"?new Date(u.accessTokenExpiresAt):u.accessTokenExpiresAt;if(d.accessTokenExpiresAt)return typeof d.accessTokenExpiresAt=="string"?new Date(d.accessTokenExpiresAt):d.accessTokenExpiresAt})(),m={accessToken:u?.accessToken??await _n(d.accessToken??"",e.context),accessTokenExpiresAt:l,scopes:d.scope?.split(",")??[],idToken:u?.idToken??d.idToken??void 0};return e.json(m)}catch{throw $.from("BAD_REQUEST",{message:"Failed to get a valid access token",code:"FAILED_TO_GET_ACCESS_TOKEN"})}});Z("/refresh-token",{method:"POST",body:W({providerId:b().meta({description:"The provider ID for the OAuth provider"}),accountId:b().meta({description:"The account ID associated with the refresh token"}).optional(),userId:b().meta({description:"The user ID associated with the account"}).optional()}),metadata:{openapi:{description:"Refresh the access token using a refresh token",responses:{200:{description:"Access token refreshed successfully",content:{"application/json":{schema:{type:"object",properties:{tokenType:{type:"string"},idToken:{type:"string"},accessToken:{type:"string"},refreshToken:{type:"string"},accessTokenExpiresAt:{type:"string",format:"date-time"},refreshTokenExpiresAt:{type:"string",format:"date-time"}}}}}},400:{description:"Invalid refresh token or provider configuration"}}}}},async e=>{const{providerId:r,accountId:i,userId:a}=e.body,t=e.request,n=await Ue(e);if(t&&!n)throw e.error("UNAUTHORIZED");const o=n?.user?.id||a;if(!o)throw $.from("BAD_REQUEST",{message:"Either userId or session is required",code:"USER_ID_OR_SESSION_REQUIRED"});const s=await Vt(e.context.socialProviders,{value:r});if(!s)throw $.from("BAD_REQUEST",{message:`Provider ${r} is not supported.`,code:"PROVIDER_NOT_SUPPORTED"});if(!s.refreshAccessToken)throw $.from("BAD_REQUEST",{message:`Provider ${r} does not support token refreshing.`,code:"TOKEN_REFRESH_NOT_SUPPORTED"});let c;const d=await Jr(e);if(d&&(!r||r===d?.providerId)?c=d:c=(await e.context.internalAdapter.findAccounts(o)).find(f=>i?f.accountId===i&&f.providerId===r:f.providerId===r),!c)throw $.from("BAD_REQUEST",_.ACCOUNT_NOT_FOUND);let u;if(d&&r===d.providerId?u=d.refreshToken??void 0:u=c.refreshToken??void 0,!u)throw $.from("BAD_REQUEST",{message:"Refresh token not found",code:"REFRESH_TOKEN_NOT_FOUND"});try{const f=await _n(u,e.context),l=await s.refreshAccessToken(f),m=l.refreshToken?await fe(l.refreshToken,e.context):u,h=l.refreshTokenExpiresAt??c.refreshTokenExpiresAt;if(c.id){const g={...c||{},accessToken:await fe(l.accessToken,e.context),refreshToken:m,accessTokenExpiresAt:l.accessTokenExpiresAt,refreshTokenExpiresAt:h,scope:l.scopes?.join(",")||c.scope,idToken:l.idToken||c.idToken};await e.context.internalAdapter.updateAccount(c.id,g)}return d&&r===d.providerId&&e.context.options.account?.storeAccountCookie&&await Pt(e,{...d,accessToken:await fe(l.accessToken,e.context),refreshToken:m,accessTokenExpiresAt:l.accessTokenExpiresAt,refreshTokenExpiresAt:h,scope:l.scopes?.join(",")||d.scope,idToken:l.idToken||d.idToken}),e.json({accessToken:l.accessToken,refreshToken:l.refreshToken??f,accessTokenExpiresAt:l.accessTokenExpiresAt,refreshTokenExpiresAt:h,scope:l.scopes?.join(",")||c.scope,idToken:l.idToken||c.idToken,providerId:c.providerId,accountId:c.accountId})}catch{throw $.from("BAD_REQUEST",{message:"Failed to refresh access token",code:"FAILED_TO_REFRESH_ACCESS_TOKEN"})}});const Yw=Nt(W({accountId:b().meta({description:"The provider given account id for which to get the account info"}).optional()}));Z("/account-info",{method:"GET",use:[fi],metadata:{openapi:{description:"Get the account info provided by the provider",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{user:{type:"object",properties:{id:{type:"string"},name:{type:"string"},email:{type:"string"},image:{type:"string"},emailVerified:{type:"boolean"}},required:["id","emailVerified"]},data:{type:"object",properties:{},additionalProperties:!0}},required:["user","data"],additionalProperties:!1}}}}}}},query:Yw},async e=>{const r=e.query?.accountId;let i;
16if(r){const o=await e.context.internalAdapter.findAccount(r);o&&(i=o)}else if(e.context.options.account?.storeAccountCookie){const o=await Jr(e);o&&(i=o)}if(!i||i.userId!==e.context.session.user.id)throw $.from("BAD_REQUEST",_.ACCOUNT_NOT_FOUND);const a=await Vt(e.context.socialProviders,{value:i.providerId});if(!a)throw $.from("INTERNAL_SERVER_ERROR",{message:`Provider account provider is ${i.providerId} but it is not configured`,code:"PROVIDER_NOT_CONFIGURED"});const t=await Xw({...e,method:"POST",body:{accountId:i.accountId,providerId:i.providerId},returnHeaders:!1,returnStatus:!1});if(!t.accessToken)throw $.from("BAD_REQUEST",{message:"Access token not found",code:"ACCESS_TOKEN_NOT_FOUND"});const n=await a.getUserInfo({...t,accessToken:t.accessToken});return e.json(n)});async function Te(e,r,i,a=3600,t){return await Kc({email:r.toLowerCase(),updateTo:i,...t},e,a)}async function Zi(e,r){if(!e.context.options.emailVerification?.sendVerificationEmail)throw e.context.logger.error("Verification email isn't enabled."),$.from("BAD_REQUEST",_.VERIFICATION_EMAIL_NOT_ENABLED);const i=await Te(e.context.secret,r.email,void 0,e.context.options.emailVerification?.expiresIn),a=e.body.callbackURL?encodeURIComponent(e.body.callbackURL):encodeURIComponent("/"),t=`${e.context.baseURL}/verify-email?token=${i}&callbackURL=${a}`;await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:r,url:t,token:i},e.request))}Z("/send-verification-email",{method:"POST",operationId:"sendVerificationEmail",body:W({email:Ge().meta({description:"The email to send the verification email to"}),callbackURL:b().meta({description:"The URL to use for email verification callback"}).optional()}),metadata:{openapi:{operationId:"sendVerificationEmail",description:"Send a verification email to the user",requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string",description:"The email to send the verification email to",example:"[email protected]"},callbackURL:{type:"string",description:"The URL to use for email verification callback",example:"https://example.com/callback",nullable:!0}},required:["email"]}}}},responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if the email was sent successfully",example:!0}}}}}},400:{description:"Bad Request",content:{"application/json":{schema:{type:"object",properties:{message:{type:"string",description:"Error message",example:"Verification email isn't enabled"}}}}}}}}}},async e=>{if(!e.context.options.emailVerification?.sendVerificationEmail)throw e.context.logger.error("Verification email isn't enabled."),$.from("BAD_REQUEST",_.VERIFICATION_EMAIL_NOT_ENABLED);const{email:r}=e.body,i=await Ue(e);if(!i){const a=await e.context.internalAdapter.findUserByEmail(r);return!a||a.user.emailVerified?(await Te(e.context.secret,r,void 0,e.context.options.emailVerification?.expiresIn),e.json({status:!0})):(await Zi(e,a.user),e.json({status:!0}))}if(i?.user.email!==r)throw $.from("BAD_REQUEST",_.EMAIL_MISMATCH);if(i?.user.emailVerified)throw $.from("BAD_REQUEST",_.EMAIL_ALREADY_VERIFIED);return await Zi(e,i.user),e.json({status:!0})});Z("/verify-email",{method:"GET",operationId:"verifyEmail",query:W({token:b().meta({description:"The token to verify the email"}),callbackURL:b().meta({description:"The URL to redirect to after email verification"}).optional()}),use:[Br(e=>e.query.callbackURL)],metadata:{openapi:{description:"Verify the email of the user",parameters:[{name:"token",in:"query",description:"The token to verify the email",required:!0,schema:{type:"string"}},{name:"callbackURL",in:"query",description:"The URL to redirect to after email verification",required:!1,schema:{type:"string"}}],responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{user:{type:"object",$ref:"#/components/schemas/User"},status:{type:"boolean",description:"Indicates if the email was verified successfully"}},required:["user","status"]}}}}}}}},async e=>{function r(s){throw e.query.callbackURL?e.query.callbackURL.includes("?")?e.redirect(`${e.query.callbackURL}&error=${s.code}`):e.redirect(`${e.query.callbackURL}?error=${s.code}`):$.from("UNAUTHORIZED",s)}const{token:i}=e.query;let a;try{a=await Ye(i,new TextEncoder().encode(e.context.secret),{algorithms:["HS256"]})}catch(s){return s instanceof sn?r(_.TOKEN_EXPIRED):r(_.INVALID_TOKEN)}const t=W({email:Ge(),updateTo:b().optional(),requestType:b().optional()}
16).parse(a.payload),n=await e.context.internalAdapter.findUserByEmail(t.email);if(!n)return r(_.USER_NOT_FOUND);if(t.updateTo){const s=await Ue(e);if(s&&s.user.email!==t.email)return r(_.INVALID_USER);switch(t.requestType){case"change-email-confirmation":{const c=await Te(e.context.secret,t.email,t.updateTo,e.context.options.emailVerification?.expiresIn,{requestType:"change-email-verification"}),d=e.query.callbackURL?encodeURIComponent(e.query.callbackURL):encodeURIComponent("/"),u=`${e.context.baseURL}/verify-email?token=${c}&callbackURL=${d}`;if(e.context.options.emailVerification?.sendVerificationEmail&&await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:{...n.user,email:t.updateTo},url:u,token:c},e.request)),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0})}case"change-email-verification":{let c=s;if(!c){const u=await e.context.internalAdapter.createSession(n.user.id);if(!u)throw $.from("INTERNAL_SERVER_ERROR",_.FAILED_TO_CREATE_SESSION);c={session:u,user:n.user}}const d=await e.context.internalAdapter.updateUserByEmail(t.email,{email:t.updateTo,emailVerified:!0});if(e.context.options.emailVerification?.afterEmailVerification&&await e.context.options.emailVerification.afterEmailVerification(d,e.request),await ze(e,{session:c.session,user:{...c.user,email:t.updateTo,emailVerified:!0}}),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:he(e.context.options,d)})}default:{let c=s;if(!c){const l=await e.context.internalAdapter.createSession(n.user.id);if(!l)throw $.from("INTERNAL_SERVER_ERROR",_.FAILED_TO_CREATE_SESSION);c={session:l,user:n.user}}const d=await e.context.internalAdapter.updateUserByEmail(t.email,{email:t.updateTo,emailVerified:!1}),u=await Te(e.context.secret,t.updateTo),f=e.query.callbackURL?encodeURIComponent(e.query.callbackURL):encodeURIComponent("/");if(e.context.options.emailVerification?.sendVerificationEmail&&await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:d,url:`${e.context.baseURL}/verify-email?token=${u}&callbackURL=${f}`,token:u},e.request)),await ze(e,{session:c.session,user:{...c.user,email:t.updateTo,emailVerified:!1}}),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:he(e.context.options,d)})}}}if(n.user.emailVerified){if(e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:null})}e.context.options.emailVerification?.beforeEmailVerification&&await e.context.options.emailVerification.beforeEmailVerification(n.user,e.request);const o=await e.context.internalAdapter.updateUserByEmail(t.email,{emailVerified:!0});if(e.context.options.emailVerification?.afterEmailVerification&&await e.context.options.emailVerification.afterEmailVerification(o,e.request),e.context.options.emailVerification?.autoSignInAfterVerification){const s=await Ue(e);if(!s||s.user.email!==t.email){const c=await e.context.internalAdapter.createSession(n.user.id);if(!c)throw $.from("INTERNAL_SERVER_ERROR",_.FAILED_TO_CREATE_SESSION);await ze(e,{session:c,user:{...n.user,emailVerified:!0}})}else await ze(e,{session:s.session,user:{...s.user,emailVerified:!0}})}if(e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:null})});async function eb(e,r){const{userInfo:i,account:a,callbackURL:t,disableSignUp:n,overrideUserInfo:o}=r,s=await e.context.internalAdapter.findOAuthUser(i.email.toLowerCase(),a.accountId,a.providerId).catch(f=>{K.error(`Better auth was unable to query your database.
17Error: `,f);const l=e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`;throw e.redirect(`${l}?error=internal_server_error`)});let c=s?.user;const d=!c;if(s){const f=s.linkedAccount??s.accounts.find(l=>l.providerId===a.providerId&&l.accountId===a.accountId);if(f){const l=e.context.options.account?.updateAccountOnSignIn!==!1?Object.fromEntries(Object.entries({idToken:a.idToken,accessToken:await fe(a.accessToken,e.context),refreshToken:await fe(a.refreshToken,e.context),accessTokenExpiresAt:a.accessTokenExpiresAt,refreshTokenExpiresAt:a.refreshTokenExpiresAt,scope:a.scope}).filter(([m,h])=>h!==void 0)):{};e.context.options.account?.storeAccountCookie&&await Pt(e,{...f,...l}),Object.keys(l).length>
170&&await e.context.internalAdapter.updateAccount(f.id,l),i.emailVerified&&!s.user.emailVerified&&i.email.toLowerCase()===s.user.email&&await e.context.internalAdapter.updateUser(s.user.id,{emailVerified:!0})}else{const l=e.context.options.account?.accountLinking;if(!(r.isTrustedProvider||e.context.trustedProviders.includes(a.providerId))&&!i.emailVerified||l?.enabled===!1||l?.disableImplicitLinking===!0)return Xi()&&K.warn(`User already exist but account isn't linked to ${a.providerId}. To read more about how account linking works in Better Auth see https://www.better-auth.com/docs/concepts/users-accounts#account-linking.`),{error:"account not linked",data:null};try{await e.context.internalAdapter.linkAccount({providerId:a.providerId,accountId:i.id.toString(),userId:s.user.id,accessToken:await fe(a.accessToken,e.context),refreshToken:await fe(a.refreshToken,e.context),idToken:a.idToken,accessTokenExpiresAt:a.accessTokenExpiresAt,refreshTokenExpiresAt:a.refreshTokenExpiresAt,scope:a.scope})}catch(m){return K.error("Unable to link account",m),{error:"unable to link account",data:null}}i.emailVerified&&!s.user.emailVerified&&i.email.toLowerCase()===s.user.email&&await e.context.internalAdapter.updateUser(s.user.id,{emailVerified:!0})}if(o){const{id:l,...m}=i;c=await e.context.internalAdapter.updateUser(s.user.id,{...m,email:i.email.toLowerCase(),emailVerified:i.email.toLowerCase()===s.user.email&&s.user.emailVerified||i.emailVerified})}}else{if(n)return{error:"signup disabled",data:null,isRegister:!1};try{const{id:f,...l}=i,m={accessToken:await fe(a.accessToken,e.context),refreshToken:await fe(a.refreshToken,e.context),idToken:a.idToken,accessTokenExpiresAt:a.accessTokenExpiresAt,refreshTokenExpiresAt:a.refreshTokenExpiresAt,scope:a.scope,providerId:a.providerId,accountId:i.id.toString()},{user:h,account:g}=await e.context.internalAdapter.createOAuthUser({...l,email:i.email.toLowerCase()},m);if(c=h,e.context.options.account?.storeAccountCookie&&await Pt(e,g),!i.emailVerified&&c&&e.context.options.emailVerification?.sendOnSignUp&&e.context.options.emailVerification?.sendVerificationEmail){const p=await Te(e.context.secret,c.email,void 0,e.context.options.emailVerification?.expiresIn),y=`${e.context.baseURL}/verify-email?token=${p}&callbackURL=${t}`;await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:c,url:y,token:p},e.request))}}catch(f){return K.error(f),Id(f)?{error:f.message,data:null,isRegister:!1}:{error:"unable to create user",data:null,isRegister:!1}}}if(!c)return{error:"unable to create user",data:null,isRegister:!1};const u=await e.context.internalAdapter.createSession(c.id);return u?{data:{session:u,user:c},error:null,isRegister:d}:{error:"unable to create session",data:null,isRegister:!1}}const Me=W({code:b().optional(),error:b().optional(),device_id:b().optional(),error_description:b().optional(),state:b().optional(),user:b().optional()});Z("/callback/:id",{method:["GET","POST"],operationId:"handleOAuthCallback",body:Me.optional(),query:Me.optional(),metadata:{...di,allowedMediaTypes:["application/x-www-form-urlencoded","application/json"]}},async e=>{let r;const i=e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`;if(e.method==="POST"){const x=e.body?Me.parse(e.body):{},O=e.query?Me.parse(e.query):{},D=Me.parse({...x,...O}),N=new URLSearchParams;for(const[j,H]of Object.entries(D))H!=null&&N.set(j,String(H));const z=`${e.context.baseURL}/callback/${e.params.id}?${N.toString()}`;throw e.redirect(z)}try{if(e.method==="GET")r=Me.parse(e.query);else if(e.method==="POST")r=Me.parse(e.body);else throw new Error("Unsupported method")}catch(x){throw e.context.logger.error("INVALID_CALLBACK_REQUEST",x),e.redirect(`${i}?error=invalid_callback_request`)}const{code:a,error:t,state:n,error_description:o,device_id:s,user:c}=r;if(!n){e.context.logger.error("State not found",t);const x=`${i}${i.includes("?")?"&":"?"}state=state_not_found`;throw e.redirect(x)}const{codeVerifier:d,callbackURL:u,link:f,errorURL:l,newUserURL:m,requestSignUp:h}=await wv(e);function g(x,O){const D=l??i,N=new URLSearchParams({error:x});O&&N.set("error_description",O);const z=`${D}${D.includes("?")?"&":"?"}${N.toString()}`;throw e.redirect(z)}if(t&&g(t,o),!a)throw e.context.logger.error("Code not found"),g("no_code");const p=await Vt(e.context.socialProviders,{value:e.params.id});
17if(!p)throw e.context.logger.error("Oauth provider with id",e.params.id,"not found"),g("oauth_provider_not_found");let y;try{y=await p.validateAuthorizationCode({code:a,codeVerifier:d,deviceId:s,redirectURI:`${e.context.baseURL}/callback/${p.id}`})}catch(x){throw e.context.logger.error("",x),g("invalid_code")}if(!y)throw g("invalid_code");const v=c?ce(c):null,k=await p.getUserInfo({...y,user:v??void 0}).then(x=>x?.user);if(!k)return e.context.logger.error("Unable to get user info"),g("unable_to_get_user_info");if(!u)throw e.context.logger.error("No callback URL found"),g("no_callback_url");if(f){if(!e.context.trustedProviders.includes(p.id)&&!k.emailVerified||e.context.options.account?.accountLinking?.enabled===!1)return e.context.logger.error("Unable to link account - untrusted provider"),g("unable_to_link_account");if(k.email?.toLowerCase()!==f.email.toLowerCase()&&e.context.options.account?.accountLinking?.allowDifferentEmails!==!0)return g("email_doesn't_match");const x=await e.context.internalAdapter.findAccount(String(k.id));if(x){if(x.userId.toString()!==f.userId.toString())return g("account_already_linked_to_different_user");const D=Object.fromEntries(Object.entries({accessToken:await fe(y.accessToken,e.context),refreshToken:await fe(y.refreshToken,e.context),idToken:y.idToken,accessTokenExpiresAt:y.accessTokenExpiresAt,refreshTokenExpiresAt:y.refreshTokenExpiresAt,scope:y.scopes?.join(",")}).filter(([N,z])=>z!==void 0));await e.context.internalAdapter.updateAccount(x.id,D)}else if(!await e.context.internalAdapter.createAccount({userId:f.userId,providerId:p.id,accountId:String(k.id),...y,accessToken:await fe(y.accessToken,e.context),refreshToken:await fe(y.refreshToken,e.context),scope:y.scopes?.join(",")}))return g("unable_to_link_account");let O;try{O=u.toString()}catch{O=u}throw e.redirect(O)}if(!k.email)return e.context.logger.error("Provider did not return email. This could be due to misconfiguration in the provider settings."),g("email_not_found");const A={providerId:p.id,accountId:String(k.id),...y,scope:y.scopes?.join(",")},C=await eb(e,{userInfo:{...k,id:String(k.id),email:k.email,name:k.name||""},account:A,callbackURL:u,disableSignUp:p.disableImplicitSignUp&&!h||p.options?.disableSignUp,overrideUserInfo:p.options?.overrideUserInfoOnSignIn});if(C.error)return e.context.logger.error(C.error.split(" ").join("_")),g(C.error.split(" ").join("_"));const{session:L,user:q}=C.data;await ze(e,{session:L,user:q});let J;try{J=(C.isRegister&&m||u).toString()}catch{J=C.isRegister&&m||u}throw e.redirect(J)});function Rd(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/&(?!amp;|lt;|gt;|quot;|#39;|#x[0-9a-fA-F]+;|#[0-9]+;)/g,"&amp;")}const tb=(e,r="Unknown",i=null)=>{const a=e.onAPIError?.customizeDefaultErrorPage;return`<!DOCTYPE html>
18<html lang="en">
19  <head>
20    <meta charset="UTF-8" />
21    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
22    <title>Error</title>
23    <style>
24      * {
25        box-sizing: border-box;
26      }
27      body {
28        font-family: ${a?.font?.defaultFamily||"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"};
29        background: ${a?.colors?.background||"var(--background)"};
30        color: var(--foreground);
31        margin: 0;
32      }
33      :root,
34      :host {
35        --spacing: 0.25rem;
36        --container-md: 28rem;
37        --text-sm: ${a?.size?.textSm||"0.875rem"};
38        --text-sm--line-height: calc(1.25 / 0.875);
39        --text-2xl: ${a?.size?.text2xl||"1.5rem"};
40        --text-2xl--line-height: calc(2 / 1.5);
41        --text-4xl: ${a?.size?.text4xl||"2.25rem"};
42        --text-4xl--line-height: calc(2.5 / 2.25);
43        --text-6xl: ${a?.size?.text6xl||"3rem"};
44        --text-6xl--line-height: 1;
45        --font-weight-medium: 500;
46        --font-weight-semibold: 600;
47        --font-weight-bold: 700;
48        --default-transition-duration: 150ms;
49        --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
50        --radius: ${a?.size?.radiusSm||"0.625rem"};
51        --default-mono-font-family: ${a?.font?.monoFamily||"var(--font-geist-mono)"};
52        --primary: ${a?.colors?.primary||"black"};
53        --primary-foreground: ${a?.colors?.primaryForeground||"white"};
54        --background: ${a?.colors?.background||"white"};
55        --foreground: ${a?.colors?.foreground||"oklch(0.271 0 0)"};
56        --border: ${a?.colors?.border||"oklch(0.89 0 0)"};
57        --destructive: ${a?.colors?.destructive||"oklch(0.55 0.15 25.723)"};
58        --muted-foreground: ${a?.colors?.mutedForeground||"oklch(0.545 0 0)"};
59        --corner-border: ${a?.colors?.cornerBorder||"#404040"};
60      }
61
62      button, .btn {
63        cursor: pointer;
64        background: none;
65        border: none;
66        color: inherit;
67        font: inherit;
68        transition: all var(--default-transition-duration)
69          var(--default-transition-timing-function);
70      }
71      button:hover, .btn:hover {
72        opacity: 0.8;
73      }
74
75      @media (prefers-color-scheme: dark) {
76        :root,
77        :host {
78          --primary: ${a?.colors?.primary||"white"};
79          --primary-foreground: ${a?.colors?.primaryForeground||"black"};
80          --background: ${a?.colors?.background||"oklch(0.15 0 0)"};
81          --foreground: ${a?.colors?.foreground||"oklch(0.98 0 0)"};
82          --border: ${a?.colors?.border||"oklch(0.27 0 0)"};
83          --destructive: ${a?.colors?.destructive||"oklch(0.65 0.15 25.723)"};
84          --muted-foreground: ${a?.colors?.mutedForeground||"oklch(0.65 0 0)"};
85          --corner-border: ${a?.colors?.cornerBorder||"#a0a0a0"};
86        }
87      }
88      @media (max-width: 640px) {
89        :root, :host {
90          --text-6xl: 2.5rem;
91          --text-2xl: 1.25rem;
92          --text-sm: 0.8125rem;
93        }
94      }
95      @media (max-width: 480px) {
96        :root, :host {
97          --text-6xl: 2rem;
98          --text-2xl: 1.125rem;
99        }
100      }
101    </style>
102  </head>
103  <body style="width: 100vw; min-height: 100vh; overflow-x: hidden; overflow-y: auto;">
104    <div
105        style="
106            display: flex;
107            flex-direction: column;
108            align-items: center;
109            justify-content: center;
110            gap: 1.5rem;
111            position: relative;
112            width: 100%;
113            min-height: 100vh;
114            padding: 1rem;
115        "
116        >
117${a?.disableBackgroundGrid?"":`
118      <div
119        style="
120          position: absolute;
121          inset: 0;
122          background-image: linear-gradient(to right, ${a?.colors?.gridColor||"var(--border)"} 1px, transparent 1px),
123            linear-gradient(to bottom, ${a?.colors?.gridColor||"var(--border)"} 1px, transparent 1px);
124          background-size: 40px 40px;
125          opacity: 0.6;
126          pointer-events: none;
127          width: 100vw;
128          height: 100vh;
129        "
130      ></div>
131      <div
132        style="
133          position: absolute;
134          inset: 0;
135          display: flex;
136          align-items: center;
137          justify-content: center;
138          background: ${a?.colors?.background||"var(--background)"};
139          mask-image: radial-gradient(ellipse at center, transparent 20%, black);
140          -webkit-mask-image: radial-gradient(ellipse at center, transparent 20%, black);
141          pointer-events: none;
142        "
143      ></div>
144`}
145
146<div
147  style="
148    position: relative;
149    z-index: 10;
150    border: 2px solid var(--border);
151    background: ${a?.colors?.cardBackground||"var(--background)"};
152    padding: 1.5rem;
153    max-width: 42rem;
154    width: 100%;
155  "
156>
157    ${a?.disableCornerDecorations?"":`
158        <!-- Corner decorations -->
159        <div
160          style="
161            position: absolute;
162            top: -2px;
163            left: -2px;
164            width: 2rem;
165            height: 2rem;
166            border-top: 4px solid var(--corner-border);
167            border-left: 4px solid var(--corner-border);
168          "
169        ></div>
170        <div
171          style="
172            position: absolute;
173            top: -2px;
174            right: -2px;
175            width: 2rem;
176            height: 2rem;
177            border-top: 4px solid var(--corner-border);
178            border-right: 4px solid var(--corner-border);
179          "
180        ></div>
181  
182        <div
183          style="
184            position: absolute;
185            bottom: -2px;
186            left: -2px;
187            width: 2rem;
188            height: 2rem;
189            border-bottom: 4px solid var(--corner-border);
190            border-left: 4px solid var(--corner-border);
191          "
192        ></div>
193        <div
194          style="
195            position: absolute;
196            bottom: -2px;
197            right: -2px;
198            width: 2rem;
199            height: 2rem;
200            border-bottom: 4px solid var(--corner-border);
201            border-right: 4px solid var(--corner-border);
202          "
203        ></div>`}
204
205        <div style="text-align: center; margin-bottom: 1.5rem;">
206          <div style="margin-bottom: 1.5rem;">
207            <div
208              style="
209                display: inline-block;
210                border: 2px solid ${a?.disableTitleBorder?"transparent":a?.colors?.titleBorder||"var(--destructive)"};
211                padding: 0.375rem 1rem;
212              "
213            >
214              <h1
215                style="
216                  font-size: var(--text-6xl);
217                  font-weight: var(--font-weight-semibold);
218                  color: ${a?.colors?.titleColor||"var(--foreground)"};
219                  letter-spacing: -0.02em;
220                  margin: 0;
221                "
222              >
223                ERROR
224              </h1>
225            </div>
226            <div
227              style="
228                height: 2px;
229                background-color: var(--border);
230                width: calc(100% + 3rem);
231                margin-left: -1.5rem;
232                margin-top: 1.5rem;
233              "
234            ></div>
235          </div>
236
237          <h2
238            style="
239              font-size: var(--text-2xl);
240              font-weight: var(--font-weight-semibold);
241              color: var(--foreground);
242              margin: 0 0 1rem;
243            "
244          >
245            Something went wrong
246          </h2>
247
248          <div
249            style="
250                display: inline-flex;
251                align-items: center;
252                gap: 0.5rem;
253                border: 2px solid var(--border);
254                background-color: var(--muted);
255                padding: 0.375rem 0.75rem;
256                margin: 0 0 1rem;
257                flex-wrap: wrap;
258                justify-content: center;
259            "
260            >
261            <span
262                style="
263                font-size: 0.75rem;
264                color: var(--muted-foreground);
265                font-weight: var(--font-weight-semibold);
266                "
267            >
268                CODE:
269            </span>
270            <span
271                style="
272                font-size: var(--text-sm);
273                font-family: var(--default-mono-font-family, monospace);
274                color: var(--foreground);
275                word-break: break-all;
276                "
277            >
278                ${Rd(r)}
279            </span>
280            </div>
281
282          <p
283            style="
284              color: var(--muted-foreground);
285              max-width: 28rem;
286              margin: 0 auto;
287              font-size: var(--text-sm);
288              line-height: 1.5;
289              text-wrap: pretty;
290            "
291          >
292            ${i||`We encountered an unexpected error. Please try again or return to the home page. If you're a developer, you can find more information about the error <a href='https://better-auth.com/docs/reference/errors/${encodeURIComponent(r)}' target='_blank' rel="noopener noreferrer" style='color: var(--foreground); text-decoration: underline;'>here</a>.`}
293          </p>
294        </div>
295
296        <div
297          style="
298            display: flex;
299            gap: 0.75rem;
300            margin-top: 1.5rem;
301            justify-content: center;
302            flex-wrap: wrap;
303          "
304        >
305          <a
306            href="/"
307            style="
308              text-decoration: none;
309            "
310          >
311            <div
312              style="
313                border: 2px solid var(--border);
314                background: var(--primary);
315                color: var(--primary-foreground);
316                padding: 0.5rem 1rem;
317                border-radius: 0;
318                white-space: nowrap;
319              "
320              class="btn"
321            >
322              Go Home
323            </div>
324          </a>
325          <a
326            href="https://better-auth.com/docs/reference/errors/${encodeURIComponent(r)}?askai=${encodeURIComponent(`What does the error code ${r} mean?`)}"
327            target="_blank"
328            rel="noopener noreferrer"
329            style="
330              text-decoration: none;
331            "
332          >
333            <div
334              style="
335                border: 2px solid var(--border);
336                background: transparent;
337                color: var(--foreground);
338                padding: 0.5rem 1rem;
339                border-radius: 0;
340                white-space: nowrap;
341              "
342              class="btn"
343            >
344              Ask AI
345            </div>
346          </a>
347        </div>
348      </div>
349    </div>
350  </body>
351</html>`};Z("/error",{method:"GET",metadata:{...di,openapi:{description:"Displays an error page",responses:{200:{description:"Success",content:{"text/html":{schema:{type:"string",description:"The HTML content of the error page"}}}}}}}},async e=>
351{const r=new URL(e.request?.url||""),i=r.searchParams.get("error")||"UNKNOWN",a=r.searchParams.get("error_description")||null,t=/^[\'A-Za-z0-9_-]+$/.test(i)?i:"UNKNOWN",n=a?Rd(a):null,o=new URLSearchParams;o.set("error",t),a&&o.set("error_description",a);const s=e.context.options,c=s.onAPIError?.errorURL;return c?new Response(null,{status:302,headers:{Location:`${c}${c.includes("?")?"&":"?"}${o.toString()}`}}):Nd&&!s.onAPIError?.customizeDefaultErrorPage?new Response(null,{status:302,headers:{Location:`/?${o.toString()}`}}):new Response(tb(e.context.options,t,n),{headers:{"Content-Type":"text/html"}})});Z("/ok",{method:"GET",metadata:{...di,openapi:{description:"Check if the API is working",responses:{200:{description:"API is working",content:{"application/json":{schema:{type:"object",properties:{ok:{type:"boolean",description:"Indicates if the API is working"}},required:["ok"]}}}}}}}},async e=>e.json({ok:!0}));async function rb(e,r){const i=(await e.context.internalAdapter.findAccounts(r.userId))?.find(t=>t.providerId==="credential"),a=i?.password;return!i||!a?!1:await e.context.password.verify({hash:a,password:r.password})}function Gi(e,r,i){const a=r?new URL(r,e.baseURL):new URL(`${e.baseURL}/error`);return i&&Object.entries(i).forEach(([t,n])=>a.searchParams.set(t,n)),a.href}function nb(e,r,i){const a=new URL(r,e.baseURL);return i&&Object.entries(i).forEach(([t,n])=>a.searchParams.set(t,n)),a.href}Z("/request-password-reset",{method:"POST",body:W({email:Ge().meta({description:"The email address of the user to send a password reset email to"}),redirectTo:b().meta({description:"The URL to redirect the user to reset their password. If the token isn't valid or expired, it'll be redirected with a query parameter `?error=INVALID_TOKEN`. If the token is valid, it'll be redirected with a query parameter `?token=VALID_TOKEN"}).optional()}),metadata:{openapi:{operationId:"requestPasswordReset",description:"Send a password reset email to the user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean"},message:{type:"string"}}}}}}}}},use:[Br(e=>e.body.redirectTo)]},async e=>{if(!e.context.options.emailAndPassword?.sendResetPassword)throw e.context.logger.error("Reset password isn't enabled.Please pass an emailAndPassword.sendResetPassword function in your auth config!"),$.from("BAD_REQUEST",{message:"Reset password isn't enabled",code:"RESET_PASSWORD_DISABLED"});const{email:r,redirectTo:i}=e.body,a=await e.context.internalAdapter.findUserByEmail(r,{includeAccounts:!0});if(!a)return In(24),await e.context.internalAdapter.findVerificationValue("dummy-verification-token"),e.context.logger.error("Reset Password: User not found",{email:r}),e.json({status:!0,message:"If this email exists in our system, check your email for the reset link"});const t=yt(e.context.options.emailAndPassword.resetPasswordTokenExpiresIn||3600*1,"sec"),n=In(24);await e.context.internalAdapter.createVerificationValue({value:a.user.id,identifier:`reset-password:${n}`,expiresAt:t});const o=i?encodeURIComponent(i):"",s=`${e.context.baseURL}/reset-password/${n}?callbackURL=${o}`;return await e.context.runInBackgroundOrAwait(e.context.options.emailAndPassword.sendResetPassword({user:a.user,url:s,token:n},e.request)),e.json({status:!0,message:"If this email exists in our system, check your email for the reset link"})});Z("/reset-password/:token",{method:"GET",operationId:"forgetPasswordCallback",query:W({callbackURL:b().meta({description:"The URL to redirect the user to reset their password"})}),use:[Br(e=>e.query.callbackURL)],metadata:{openapi:{operationId:"resetPasswordCallback",description:"Redirects the user to the callback URL with the token",parameters:[{name:"token",in:"path",required:!0,description:"The token to reset the password",schema:{type:"string"}},{name:"callbackURL",in:"query",required:!0,description:"The URL to redirect the user to reset their password",schema:{type:"string"}}],responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{token:{type:"string"}}}}}}}}}},async e=>{const{token:r}=e.params,{callbackURL:i}=e.query;if(!r||!i)throw e.redirect(Gi(e.context,i,{error:"INVALID_TOKEN"}));
351const a=await e.context.internalAdapter.findVerificationValue(`reset-password:${r}`);throw!a||a.expiresAt<new Date?e.redirect(Gi(e.context,i,{error:"INVALID_TOKEN"})):e.redirect(nb(e.context,i,{token:r}))});Z("/reset-password",{method:"POST",operationId:"resetPassword",query:W({token:b().optional()}).optional(),body:W({newPassword:b().meta({description:"The new password to set"}),token:b().meta({description:"The token to reset the password"}).optional()}),metadata:{openapi:{operationId:"resetPassword",description:"Reset the password for a user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean"}}}}}}}}}},async e=>{const r=e.body.token||e.query?.token;if(!r)throw $.from("BAD_REQUEST",_.INVALID_TOKEN);const{newPassword:i}=e.body,a=e.context.password?.config.minPasswordLength,t=e.context.password?.config.maxPasswordLength;if(i.length<a)throw $.from("BAD_REQUEST",_.PASSWORD_TOO_SHORT);if(i.length>t)throw $.from("BAD_REQUEST",_.PASSWORD_TOO_LONG);const n=`reset-password:${r}`,o=await e.context.internalAdapter.findVerificationValue(n);if(!o||o.expiresAt<new Date)throw $.from("BAD_REQUEST",_.INVALID_TOKEN);const s=o.value,c=await e.context.password.hash(i);if((await e.context.internalAdapter.findAccounts(s)).find(d=>d.providerId==="credential")?await e.context.internalAdapter.updatePassword(s,c):await e.context.internalAdapter.createAccount({userId:s,providerId:"credential",password:c,accountId:s}),await e.context.internalAdapter.deleteVerificationByIdentifier(n),e.context.options.emailAndPassword?.onPasswordReset){const d=await e.context.internalAdapter.findUserById(s);d&&await e.context.options.emailAndPassword.onPasswordReset({user:d},e.request)}return e.context.options.emailAndPassword?.revokeSessionsOnPasswordReset&&await e.context.internalAdapter.deleteSessions(s),e.json({status:!0})});Z("/verify-password",{method:"POST",body:W({password:b().meta({description:"The password to verify"})}),metadata:{scope:"server",openapi:{operationId:"verifyPassword",description:"Verify the current user's password",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean"}}}}}}}}},use:[Je]},async e=>{const{password:r}=e.body,i=e.context.session;if(!await rb(e,{password:r,userId:i.user.id}))throw $.from("BAD_REQUEST",_.INVALID_PASSWORD);return e.json({status:!0})});W({callbackURL:b().meta({description:"Callback URL to redirect to after the user has signed in"}).optional(),newUserCallbackURL:b().optional(),errorCallbackURL:b().meta({description:"Callback URL to redirect to if an error happens"}).optional(),provider:Dd,disableRedirect:Ae().meta({description:"Disable automatic redirection to the provider. Useful for handling the redirection yourself"}).optional(),idToken:Nt(W({token:b().meta({description:"ID token from the provider"}),nonce:b().meta({description:"Nonce used to generate the token"}).optional(),accessToken:b().meta({description:"Access token from the provider"}).optional(),refreshToken:b().meta({description:"Refresh token from the provider"}).optional(),expiresAt:Ze().meta({description:"Expiry date of the token"}).optional(),user:W({name:W({firstName:b().optional(),lastName:b().optional()}).optional(),email:b().optional()}).meta({description:"The user object from the provider. Only available for some providers like Apple."}).optional()})),scopes:pt(b()).meta({description:"Array of scopes to request from the provider. This will override the default scopes passed."}).optional(),requestSignUp:Ae().meta({description:"Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider"}).optional(),loginHint:b().meta({description:"The login hint to use for the authorization code request"}).optional(),additionalData:Qe(b(),De()).optional().meta({description:"Additional data to be passed through the OAuth flow"})});Z("/sign-out",{method:"POST",operationId:"signOut",requireHeaders:!0,metadata:{openapi:{operationId:"signOut",description:"Sign out the current user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean"}}}}}}}}}},async e=>{const r=await e.getSignedCookie(e.context.authCookies.sessionToken.name,e.context.secret);
351if(r)try{await e.context.internalAdapter.deleteSession(r)}catch(i){e.context.logger.error("Failed to delete session from database",i)}return Lt(e),e.json({success:!0})});W({name:b(),email:Ge(),password:b().nonempty(),image:b().optional(),callbackURL:b().optional(),rememberMe:Ae().optional()}).and(Qe(b(),De()));Qe(b().meta({description:"Field name must be a string"}),De());Qe(b().meta({description:"Field name must be a string"}),De());Z("/change-password",{method:"POST",operationId:"changePassword",body:W({newPassword:b().meta({description:"The new password to set"}),currentPassword:b().meta({description:"The current password is required"}),revokeOtherSessions:Ae().meta({description:"Must be a boolean value"}).optional()}),use:[Je],metadata:{openapi:{operationId:"changePassword",description:"Change the password of the user",responses:{200:{description:"Password successfully changed",content:{"application/json":{schema:{type:"object",properties:{token:{type:"string",nullable:!0,description:"New session token if other sessions were revoked"},user:{type:"object",properties:{id:{type:"string",description:"The unique identifier of the user"},email:{type:"string",format:"email",description:"The email address of the user"},name:{type:"string",description:"The name of the user"},image:{type:"string",format:"uri",nullable:!0,description:"The profile image URL of the user"},emailVerified:{type:"boolean",description:"Whether the email has been verified"},createdAt:{type:"string",format:"date-time",description:"When the user was created"},updatedAt:{type:"string",format:"date-time",description:"When the user was last updated"}},required:["id","email","name","emailVerified","createdAt","updatedAt"]}},required:["user"]}}}}}}}},async e=>{const{newPassword:r,currentPassword:i,revokeOtherSessions:a}=e.body,t=e.context.session,n=e.context.password.config.minPasswordLength;if(r.length<n)throw e.context.logger.error("Password is too short"),$.from("BAD_REQUEST",_.PASSWORD_TOO_SHORT);const o=e.context.password.config.maxPasswordLength;if(r.length>o)throw e.context.logger.error("Password is too long"),$.from("BAD_REQUEST",_.PASSWORD_TOO_LONG);const s=(await e.context.internalAdapter.findAccounts(t.user.id)).find(u=>u.providerId==="credential"&&u.password);if(!s||!s.password)throw $.from("BAD_REQUEST",_.CREDENTIAL_ACCOUNT_NOT_FOUND);const c=await e.context.password.hash(r);if(!await e.context.password.verify({hash:s.password,password:i}))throw $.from("BAD_REQUEST",_.INVALID_PASSWORD);await e.context.internalAdapter.updateAccount(s.id,{password:c});let d=null;if(a){await e.context.internalAdapter.deleteSessions(t.user.id);const u=await e.context.internalAdapter.createSession(t.user.id);if(!u)throw $.from("INTERNAL_SERVER_ERROR",_.FAILED_TO_GET_SESSION);await ze(e,{session:u,user:t.user}),d=u.token}return e.json({token:d,user:he(e.context.options,t.user)})});Z({method:"POST",body:W({newPassword:b().meta({description:"The new password to set is required"})}),use:[Je]},async e=>{const{newPassword:r}=e.body,i=e.context.session,a=e.context.password.config.minPasswordLength;if(r.length<a)throw e.context.logger.error("Password is too short"),$.from("BAD_REQUEST",_.PASSWORD_TOO_SHORT);const t=e.context.password.config.maxPasswordLength;if(r.length>t)throw e.context.logger.error("Password is too long"),$.from("BAD_REQUEST",_.PASSWORD_TOO_LONG);const n=(await e.context.internalAdapter.findAccounts(i.user.id)).find(s=>s.providerId==="credential"&&s.password),o=await e.context.password.hash(r);if(!n)return await e.context.internalAdapter.linkAccount({userId:i.user.id,providerId:"credential",accountId:i.user.id,password:o}),e.json({status:!0});throw $.from("BAD_REQUEST",_.PASSWORD_ALREADY_SET)});Z("/delete-user",{method:"POST",use:[Je],body:W({callbackURL:b().meta({description:"The callback URL to redirect to after the user is deleted"}).optional(),password:b().meta({description:"The password of the user is required to delete the user"}).optional(),token:b().meta({description:"The token to delete the user is required"}).optional()}),metadata:{openapi:{operationId:"deleteUser",description:"Delete the user",requestBody:{content:{"application/json":{schema:{type:"object",properties:{callbackURL:{type:"string",description:"The callback URL to redirect to after the user is deleted"},password:{type:"string",description:"The user's password. Required if session is not fresh"},token:{type:"string",description:"The deletion verification token"}}}}}},responses:{200:{description:"User deletion processed successfully",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Indicates if the operation was successful"},message:{type:"string",enum:["User deleted","Verification email sent"],description:"Status message of the deletion process"}},required:["success","message"]}}}}}}}},async e=>{if(!e.context.options.user?.deleteUser?.enabled)throw e.context.logger.error("Delete user is disabled. Enable it in the options"),$.fromStatus("NOT_FOUND");const r=e.context.session;
351if(e.body.password){const t=(await e.context.internalAdapter.findAccounts(r.user.id)).find(n=>n.providerId==="credential"&&n.password);if(!t||!t.password)throw $.from("BAD_REQUEST",_.CREDENTIAL_ACCOUNT_NOT_FOUND);if(!await e.context.password.verify({hash:t.password,password:e.body.password}))throw $.from("BAD_REQUEST",_.INVALID_PASSWORD)}if(e.body.token)return await ib({...e,query:{token:e.body.token}}),e.json({success:!0,message:"User deleted"});if(e.context.options.user.deleteUser?.sendDeleteAccountVerification){const t=Fn(32,"0-9","a-z");await e.context.internalAdapter.createVerificationValue({value:r.user.id,identifier:`delete-account-${t}`,expiresAt:new Date(Date.now()+(e.context.options.user.deleteUser?.deleteTokenExpiresIn||3600*24)*1e3)});const n=`${e.context.baseURL}/delete-user/callback?token=${t}&callbackURL=${encodeURIComponent(e.body.callbackURL||"/")}`;return await e.context.runInBackgroundOrAwait(e.context.options.user.deleteUser.sendDeleteAccountVerification({user:r.user,url:n,token:t},e.request)),e.json({success:!0,message:"Verification email sent"})}if(!e.body.password&&e.context.sessionConfig.freshAge!==0){const t=new Date(r.session.createdAt).getTime(),n=e.context.sessionConfig.freshAge*1e3;if(Date.now()-t>n)throw $.from("BAD_REQUEST",_.SESSION_EXPIRED)}const i=e.context.options.user.deleteUser?.beforeDelete;i&&await i(r.user,e.request),await e.context.internalAdapter.deleteUser(r.user.id),await e.context.internalAdapter.deleteSessions(r.user.id),Lt(e);const a=e.context.options.user.deleteUser?.afterDelete;return a&&await a(r.user,e.request),e.json({success:!0,message:"User deleted"})});const ib=Z("/delete-user/callback",{method:"GET",query:W({token:b().meta({description:"The token to verify the deletion request"}),callbackURL:b().meta({description:"The URL to redirect to after deletion"}).optional()}),use:[Br(e=>e.query.callbackURL)],metadata:{openapi:{description:"Callback to complete user deletion with verification token",responses:{200:{description:"User successfully deleted",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Indicates if the deletion was successful"},message:{type:"string",enum:["User deleted"],description:"Confirmation message"}},required:["success","message"]}}}}}}}},async e=>{if(!e.context.options.user?.deleteUser?.enabled)throw e.context.logger.error("Delete user is disabled. Enable it in the options"),$.from("NOT_FOUND",{message:"Not found",code:"NOT_FOUND"});const r=await Ue(e);if(!r)throw $.from("NOT_FOUND",_.FAILED_TO_GET_USER_INFO);const i=await e.context.internalAdapter.findVerificationValue(`delete-account-${e.query.token}`);if(!i||i.expiresAt<new Date)throw $.from("NOT_FOUND",_.INVALID_TOKEN);if(i.value!==r.user.id)throw $.from("NOT_FOUND",_.INVALID_TOKEN);const a=e.context.options.user.deleteUser?.beforeDelete;a&&await a(r.user,e.request),await e.context.internalAdapter.deleteUser(r.user.id),await e.context.internalAdapter.deleteSessions(r.user.id),await e.context.internalAdapter.deleteAccounts(r.user.id),await e.context.internalAdapter.deleteVerificationByIdentifier(`delete-account-${e.query.token}`),Lt(e);const t=e.context.options.user.deleteUser?.afterDelete;if(t&&await t(r.user,e.request),e.query.callbackURL)throw e.redirect(e.query.callbackURL||"/");return e.json({success:!0,message:"User deleted"})});Z("/change-email",{method:"POST",body:W({newEmail:Ge().meta({description:"The new email address to set must be a valid email address"}),callbackURL:b().meta({description:"The URL to redirect to after email verification"}).optional()}),use:[Je],metadata:{openapi:{operationId:"changeEmail",responses:{200:{description:"Email change request processed successfully",content:{"application/json":{schema:{type:"object",properties:{user:{type:"object",$ref:"#/components/schemas/User"},status:{type:"boolean",description:"Indicates if the request was successful"},message:{type:"string",enum:["Email updated","Verification email sent"],description:"Status message of the email change process",nullable:!0}},required:["status"]}}}}}}}},async e=>{if(!e.context.options.user?.changeEmail?.enabled)throw e.context.logger.error("Change email is disabled."),$.fromStatus("BAD_REQUEST",{message:"Change email is disabled"});const r=e.body.newEmail.toLowerCase();if(r===e.context.session.user.email)throw e.context.logger.error("Email is the same"),$.fromStatus("BAD_REQUEST",{message:"Email is the same"});const i=e.context.session.user.emailVerified!==!0&&e.context.options.user.changeEmail.updateEmailWithoutVerification,a=e.context.session.user.emailVerified&&e.context.options.user.changeEmail.sendChangeEmailConfirmation,t=e.context.options.emailVerification?.sendVerificationEmail;if(!i&&!a&&!t)throw e.context.logger.error("Verification email isn't enabled."),$.fromStatus("BAD_REQUEST",{message:"Verification email isn't enabled"});
351if(await e.context.internalAdapter.findUserByEmail(r))return await Te(e.context.secret,e.context.session.user.email,r,e.context.options.emailVerification?.expiresIn),e.context.logger.info("Change email attempt for existing email"),e.json({status:!0});if(i){if(await e.context.internalAdapter.updateUserByEmail(e.context.session.user.email,{email:r}),await ze(e,{session:e.context.session.session,user:{...e.context.session.user,email:r}}),t){const s=await Te(e.context.secret,r,void 0,e.context.options.emailVerification?.expiresIn),c=`${e.context.baseURL}/verify-email?token=${s}&callbackURL=${e.body.callbackURL||"/"}`;await e.context.runInBackgroundOrAwait(t({user:{...e.context.session.user,email:r},url:c,token:s},e.request))}return e.json({status:!0})}if(a){const s=await Te(e.context.secret,e.context.session.user.email,r,e.context.options.emailVerification?.expiresIn,{requestType:"change-email-confirmation"}),c=`${e.context.baseURL}/verify-email?token=${s}&callbackURL=${e.body.callbackURL||"/"}`;return await e.context.runInBackgroundOrAwait(a({user:e.context.session.user,newEmail:r,url:c,token:s},e.request)),e.json({status:!0})}if(!t)throw e.context.logger.error("Verification email isn't enabled."),$.fromStatus("BAD_REQUEST",{message:"Verification email isn't enabled"});const n=await Te(e.context.secret,e.context.session.user.email,r,e.context.options.emailVerification?.expiresIn,{requestType:"change-email-verification"}),o=`${e.context.baseURL}/verify-email?token=${n}&callbackURL=${e.body.callbackURL||"/"}`;return await e.context.runInBackgroundOrAwait(t({user:{...e.context.session.user,email:r},url:o,token:n},e.request)),e.json({status:!0})});const rn="USD",ab=[{id:"free",planType:"free",prices:[]},{id:"pro",planType:"subscription",credit:{amount:100,expireDays:31},prices:[{priceId:"",amount:990,currency:rn,interval:"month"},{priceId:"",amount:9900,currency:rn,interval:"year"}],display:{isRecommended:!0,group:"subscription"}},{id:"lifetime",planType:"lifetime",prices:[{priceId:"",amount:19900,currency:rn}],display:{group:"one-time"}}],cb="USD";function db(){return ab??[]}export{cb as C,db as g};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.