1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-creyt8kZ.js","assets/vendor-web3-x3amP11p.js"])))=>i.map(i=>d[i]); 2import{r as H,j as nn,n as an,i as on,Q as cn,_ as Pe,b as ln,c as J}from"./vendor-web3-x3amP11p.js";var ar=H.createContext(void 0),un=r=>{const e=H.useContext(ar);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Rc=({client:r,children:e})=>(H.useEffect(()=>(r.mount(),()=>{r.unmount()}),[r]),nn.jsx(ar.Provider,{value:r,children:e})),or=H.createContext(!1),dn=()=>H.useContext(or);or.Provider;function hn(){let r=!1;return{clearReset:()=>{r=!1},reset:()=>{r=!0},isReset:()=>r}}var fn=H.createContext(hn()),pn=()=>H.useContext(fn);function mn(r,e){return typeof r=="function"?r(...e):!!r}function Es(){}var gn=(r,e)=>{(r.suspense||r.throwOnError||r.experimental_prefetchInRender)&&(e.isReset()||(r.retryOnMount=!1))},yn=r=>{H.useEffect(()=>{r.clearReset()},[r])},_n=({result:r,errorResetBoundary:e,throwOnError:t,query:s,suspense:n})=>r.isError&&!e.isReset()&&!r.isFetching&&s&&(n&&r.data===void 0||mn(t,[r.error,s])),vn=r=>{const e=r.staleTime;r.suspense&&(r.staleTime=typeof e=="function"?(...t)=>Math.max(e(...t),1e3):Math.max(e??1e3,1e3),typeof r.gcTime=="number"&&(r.gcTime=Math.max(r.gcTime,1e3)))},wn=(r,e)=>r.isLoading&&r.isFetching&&!e,bn=(r,e)=>r?.suspense&&e.isPending,Os=(r,e,t)=>e.fetchOptimistic(r).catch(()=>{t.clearReset()});function kn(r,e,t){const s=un(),n=dn(),i=pn(),a=s.defaultQueryOptions(r);s.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=n?"isRestoring":"optimistic",vn(a),gn(a,i),yn(i);const o=!s.getQueryCache().get(a.queryHash),[c]=H.useState(()=>new e(s,a)),l=c.getOptimisticResult(a),u=!n&&r.subscribed!==!1;if(H.useSyncExternalStore(H.useCallback(d=>{const f=u?c.subscribe(an.batchCalls(d)):Es;return c.updateResult(),f},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),H.useEffect(()=>{c.setOptions(a,{listeners:!1})},[a,c]),bn(a,l))throw Os(a,c,i);if(_n({result:l,errorResetBoundary:i,throwOnError:a.throwOnError,query:s.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw l.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!on&&wn(l,n)&&(o?Os(a,c,i):s.getQueryCache().get(a.queryHash)?.promise)?.catch(Es).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?l:c.trackResult(l)}function Ac(r,e){return kn(r,cn)}const xn=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>Pe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ue);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)};class ps extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class Sn extends ps{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Tn extends ps{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class En extends ps{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Jt;(function(r){r.Any="any",r.ApNortheast1="ap-northeast-1",r.ApNortheast2="ap-northeast-2",r.ApSouth1="ap-south-1",r.ApSoutheast1="ap-southeast-1",r.ApSoutheast2="ap-southeast-2",r.CaCentral1="ca-central-1",r.EuCentral1="eu-central-1",r.EuWest1="eu-west-1",r.EuWest2="eu-west-2",r.EuWest3="eu-west-3",r.SaEast1="sa-east-1",r.UsEast1="us-east-1",r.UsWest1="us-west-1",r.UsWest2="us-west-2"})(Jt||(Jt={}));var On=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};class Rn{constructor(e,{headers:t={},customFetch:s,region:n=Jt.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=xn(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return On(this,void 0,void 0,function*(){try{const{headers:n,method:i,body:a}=t;let o={},{region:c}=t;c||(c=this.region),c&&c!=="any"&&(o["x-region"]=c);let l;a&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)&&(typeof Blob<"u"&&a
2instanceof Blob||a instanceof ArrayBuffer?(o["Content-Type"]="application/octet-stream",l=a):typeof a=="string"?(o["Content-Type"]="text/plain",l=a):typeof FormData<"u"&&a instanceof FormData?l=a:(o["Content-Type"]="application/json",l=JSON.stringify(a)));const u=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},o),this.headers),n),body:l}).catch(m=>{throw new Sn(m)}),d=u.headers.get("x-relay-error");if(d&&d==="true")throw new Tn(u);if(!u.ok)throw new En(u);let f=((s=u.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),_;return f==="application/json"?_=yield u.json():f==="application/octet-stream"?_=yield u.blob():f==="text/event-stream"?_=u:f==="multipart/form-data"?_=yield u.formData():_=yield u.text(),{data:_,error:null}}catch(n){return{data:null,error:n}}})}}var q={},ms={},Et={},Xe={},Ot={},Rt={},An=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},je=An();const Cn=je.fetch,cr=je.fetch.bind(je),lr=je.Headers,Pn=je.Request,jn=je.Response,Ue=Object.freeze(Object.defineProperty({__proto__:null,Headers:lr,Request:Pn,Response:jn,default:cr,fetch:Cn},Symbol.toStringTag,{value:"Module"})),$n=ln(Ue);var At={};Object.defineProperty(At,"__esModule",{value:!0});let In=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
vendor: 8,300 bytes, line 2
2de=e.code}};At.default=In;var ur=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rt,"__esModule",{value:!0});const Nn=ur($n),Ln=ur(At);let Un=class{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=Nn.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const s=this.fetch;let n=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,o,c;let l=null,u=null,d=null,f=i.status,_=i.statusText;if(i.ok){if(this.method!=="HEAD"){const O=await i.text();O===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?u=O:u=JSON.parse(O))}const v=(a=this.headers.Prefer)===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),g=(o=i.headers.get("content-range"))===null||o===void 0?void 0:o.split("/");v&&g&&g.length>1&&(d=parseInt(g[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(u)&&(u.length>1?(l={code:"PGRST116",details:`Results contain ${u.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},u=null,d=null,f=406,_="Not Acceptable"):u.length===1?u=u[0]:u=null)}else{const v=await i.text();try{l=JSON.parse(v),Array.isArray(l)&&i.status===404&&(u=[],l=null,f=200,_="OK")}catch{i.status===404&&v===""?(f=204,_="No Content"):l={message:v}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,_="OK"),l&&this.shouldThrowOnError)throw new Ln.default(l)}return{error:l,data:u,count:d,status:f,statusText:_}});return this.shouldThrowOnError||(n=n.catch(i=>{var a,o,c;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(o=i?.stack)!==null&&o!==void 0?o:""}`,hint:"",code:`${(c=i?.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}};Rt.default=Un;var Dn=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ot,"__esModule",{value:!0});const Bn=Dn(Rt);let Fn=class extends Bn.default{select(e){let t=!1;const s=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:n,referencedTable:i=n}={}){const a=i?`${i}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:n=s}={}){const i=typeof n>"u"?"offset":`${n}.offset`,a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:n=!1,wal:i=!1,format:a="text"}={}){var o;const c=[e?"analyze":null,t?"verbose":null,s?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.Accept)!==null&&o!==void 0?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${a}; for="${l}"; options=${c};`,a==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}};Ot.default=Fn;var Mn=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xe,"__esModule",{value:!0});const qn=Mn(Ot);let zn=class extends qn.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&new RegExp("[,()]").test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");const a=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}};Xe.default=zn;var Vn=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Et,"__esModule",{value:!0});const Me=Vn(Xe);let Zn=class{constructor(e,{headers:t={},schema:s,fetch:n}){this.url=e,this.headers=t,this.schema=s,this.fetch=n}select(e,{head:t=!1,count:s}={}){const n=t?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(o=>/\s/.test(o)&&!i?"":(o==='"'&&(i=!i),o)).join("");return this.url.searchParams.set("select",a),s&&(this.headers.Prefer=`count=${s}`),new Me.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const n="POST",i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push(`count=${t}`),s||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){const a=e.reduce((o,c)=>o.concat(Object.keys(c)),[]);if(a.length>
20){const o=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",o.join(","))}}return new Me.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:n,defaultToNull:i=!0}={}){const a="POST",o=[`resolution=${s?"ignore":"merge"}-duplicates`];if(t!==void 0&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&o.push(this.headers.Prefer),n&&o.push(`count=${n}`),i||o.push("missing=default"),this.headers.Prefer=o.join(","),Array.isArray(e)){const c=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(c.length>0){const l=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new Me.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s="PATCH",n=[];return this.headers.Prefer&&n.push(this.headers.Prefer),t&&n.push(`count=${t}`),this.headers.Prefer=n.join(","),new Me.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t="DELETE",s=[];return e&&s.push(`count=${e}`),this.headers.Prefer&&s.unshift(this.headers.Prefer),this.headers.Prefer=s.join(","),new Me.default({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}};Et.default=Zn;var Ct={},Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.version=void 0;Pt.version="0.0.0-automated";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DEFAULT_HEADERS=void 0;const Hn=Pt;Ct.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${Hn.version}`};var dr=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ms,"__esModule",{value:!0});const Jn=dr(Et),Wn=dr(Xe),Kn=Ct;let Gn=class hr{constructor(e,{headers:t={},schema:s,fetch:n}={}){this.url=e,this.headers=Object.assign(Object.assign({},Kn.DEFAULT_HEADERS),t),this.schemaName=s,this.fetch=n}from(e){const t=new URL(`${this.url}/${e}`);return new Jn.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new hr(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,get:n=!1,count:i}={}){let a;const o=new URL(`${this.url}/rpc/${e}`);let c;s||n?(a=s?"HEAD":"GET",Object.entries(t).filter(([u,d])=>d!==void 0).map(([u,d])=>[u,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([u,d])=>{o.searchParams.append(u,d)})):(a="POST",c=t);const l=Object.assign({},this.headers);return i&&(l.Prefer=`count=${i}`),new Wn.default({method:a,url:o,headers:l,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}};ms.default=Gn;var De=J&&J.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(q,"__esModule",{value:!0});q.PostgrestError=q.PostgrestBuilder=q.PostgrestTransformBuilder=q.PostgrestFilterBuilder=q.PostgrestQueryBuilder=q.PostgrestClient=void 0;const fr=De(ms);q.PostgrestClient=fr.default;const pr=De(Et);q.PostgrestQueryBuilder=pr.default;const mr=De(Xe);q.PostgrestFilterBuilder=mr.default;const gr=De(Ot);q.PostgrestTransformBuilder=gr.default;const yr=De(Rt);q.PostgrestBuilder=yr.default;const _r=De(At);q.PostgrestError=_r.default;var Qn=q.default={PostgrestClient:fr.default,PostgrestQueryBuilder:pr.default,PostgrestFilterBuilder:mr.default,PostgrestTransformBuilder:gr.default,PostgrestBuilder:yr.default,PostgrestError:_r.default};const{PostgrestClient:Xn,PostgrestQueryBuilder:Nc,PostgrestFilterBuilder:Lc,PostgrestTransformBuilder:Uc,PostgrestBuilder:Dc,PostgrestError:Bc}=Qn,Yn="2.11.2",ei={"X-Client-Info":`realtime-js/${Yn}`},ti="1.0.0",vr=1e4,si=1e3;var Ce;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(Ce||(Ce={}));var V;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(V||(V={}));var K;(function(r){r.close="phx_close",r.error="phx_error",r.join="phx_join",r.reply="phx_reply",r.leave="phx_leave",r.access_token="access_token"})(K||(K={}));var Wt;(function(r){r.websocket="websocket"})(Wt||(Wt={}));var ye;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(ye||(ye={}));class ri{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;
2return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const n=t.getUint8(1),i=t.getUint8(2);let a=this.HEADER_LENGTH+2;const o=s.decode(e.slice(a,a+n));a=a+n;const c=s.decode(e.slice(a,a+i));a=a+i;const l=JSON.parse(s.decode(e.slice(a,e.byteLength)));return{ref:null,topic:o,event:c,payload:l}}}class wr{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var I;(function(r){r.abstime="abstime",r.bool="bool",r.date="date",r.daterange="daterange",r.float4="float4",r.float8="float8",r.int2="int2",r.int4="int4",r.int4range="int4range",r.int8="int8",r.int8range="int8range",r.json="json",r.jsonb="jsonb",r.money="money",r.numeric="numeric",r.oid="oid",r.reltime="reltime",r.text="text",r.time="time",r.timestamp="timestamp",r.timestamptz="timestamptz",r.timetz="timetz",r.tsrange="tsrange",r.tstzrange="tstzrange"})(I||(I={}));const Rs=(r,e,t={})=>{var s;const n=(s=t.skipTypes)!==null&&s!==void 0?s:[];return Object.keys(e).reduce((i,a)=>(i[a]=ni(a,r,e,n),i),{})},ni=(r,e,t,s)=>{const n=e.find(o=>o.name===r),i=n?.type,a=t[r];return i&&!s.includes(i)?br(i,a):Kt(a)},br=(r,e)=>{if(r.charAt(0)==="_"){const t=r.slice(1,r.length);return ci(e,t)}switch(r){case I.bool:return ii(e);case I.float4:case I.float8:case I.int2:case I.int4:case I.int8:case I.numeric:case I.oid:return ai(e);case I.json:case I.jsonb:return oi(e);case I.timestamp:return li(e);case I.abstime:case I.date:case I.daterange:case I.int4range:case I.int8range:case I.money:case I.reltime:case I.text:case I.time:case I.timestamptz:case I.timetz:case I.tsrange:case I.tstzrange:return Kt(e);default:return Kt(e)}},Kt=r=>r,ii=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},ai=r=>{if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return e}return r},oi=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(e){return console.log(`JSON parse error: ${e}`),r}return r},ci=(r,e)=>{if(typeof r!="string")return r;const t=r.length-1,s=r[t];if(r[0]==="{"&&s==="}"){let i;const a=r.slice(1,t);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>br(e,o))}return r},li=r=>typeof r=="string"?r.replace(" ","T"):r,kr=r=>{let e=r;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")};class Bt{constructor(e,t,s={},n=vr){this.channel=e,this.event=t,this.payload=s,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var As;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})(As||(As={}));class He{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=t?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},n=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=He.syncState(this.state,n,i,a),this.pendingDiffs.forEac
vendor: 10,764 bytes, lines 2-7
2h(c=>{this.state=He.syncDiff(this.state,c,i,a)}),this.pendingDiffs=[],o()}),this.channel._on(s.diff,{},n=>{const{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=He.syncDiff(this.state,n,i,a),o())}),this.onJoin((n,i,a)=>{this.channel._trigger("presence",{event:"join",key:n,currentPresences:i,newPresences:a})}),this.onLeave((n,i,a)=>{this.channel._trigger("presence",{event:"leave",key:n,currentPresences:i,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,s,n){const i=this.cloneDeep(e),a=this.transformState(t),o={},c={};return this.map(i,(l,u)=>{a[l]||(c[l]=u)}),this.map(a,(l,u)=>{const d=i[l];if(d){const f=u.map(g=>g.presence_ref),_=d.map(g=>g.presence_ref),m=u.filter(g=>_.indexOf(g.presence_ref)<0),v=d.filter(g=>f.indexOf(g.presence_ref)<0);m.length>0&&(o[l]=m),v.length>0&&(c[l]=v)}else o[l]=u}),this.syncDiff(i,{joins:o,leaves:c},s,n)}static syncDiff(e,t,s,n){const{joins:i,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),n||(n=()=>{}),this.map(i,(o,c)=>{var l;const u=(l=e[o])!==null&&l!==void 0?l:[];if(e[o]=this.cloneDeep(c),u.length>0){const d=e[o].map(_=>_.presence_ref),f=u.filter(_=>d.indexOf(_.presence_ref)<0);e[o].unshift(...f)}s(o,u,c)}),this.map(a,(o,c)=>{let l=e[o];if(!l)return;const u=c.map(d=>d.presence_ref);l=l.filter(d=>u.indexOf(d.presence_ref)<0),e[o]=l,n(o,l,c),l.length===0&&delete e[o]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,s)=>{const n=e[s];return"metas"in n?t[s]=n.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[s]=n,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Cs;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(Cs||(Cs={}));var Ps;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(Ps||(Ps={}));var se;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(se||(se={}));class gs{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=V.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Bt(this,K.join,this.params,this.timeout),this.rejoinTimer=new wr(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=V.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=V.closed,this.socket._remove(this)}),this._onError(n=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,n),this.state=V.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=V.errored,this.rejoinTimer.scheduleTimeout())}),this._on(K.reply,{},(n,i)=>{this._trigger(this._replyEventName(i),n)}),this.presence=new He(this),this.broadcastEndpointURL=kr(this.socket.endPoint)+"/api/broadcast",this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var s,n;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:i,presence:a,private:o}}=this.params;this._onError(u=>e?.(se.CHANNEL_ERROR,u)),this._onClose(()=>e?.(se.CLOSED));const c={},l={broadcast:i,presence:a,postgres_changes:(n=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(u=>u.filter))!==null&&n!==void 0?n:[],private:o};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this.updateJoinPayload(Object.assign({config:l},c)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:u})=>{var d;if(this.socket.setAuth(),u===void 0){e?.(se.SUBSCRIBED);return}else{const f=this.bindings.postgres_changes,_=(d=f?.length)!==null&&d!==void 0?d:0,m=[];for(let v=0;v<_;v++){const g=f[v],{filter:{event:O,schema:P,table:j,filter:L}}=g,$=u&&u[v];if($&&$.event===O&&$.schema===P&&$.table===j&&$.filter===L)m.push(Object.assign(Object.assign({},g),{id:$.id}));else{this.unsubscribe(),e?.(se.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=m,e&&e(se.SUBSCRIBED);return}}).receive("error",u=>{e?.(se.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(u).join(", ")||"error")))}).receive("timeout",()=>{e?.(se.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,n;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:a}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const l=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(s=t.timeout)!==null&&s!==void 0?s:this.timeout);return await((n=l.body)===null||n===void 0?void 0:n.cancel()),l.ok?"ok":"error"}catch(l){return l.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,c;const l=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),l.receive("ok",()=>i("ok")),l.receive("error",()=>i("error")),l.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=V.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(K.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(s=>{const n=new Bt(this,K.leave,{},e);n.receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),n.send(),this._canPush()||n.trigger("ok",{})})}async _fetchWithTimeout(e,t,s){const n=new AbortController,i=setTimeout(()=>n.abort(),s),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),a}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Bt(this,e,t,s);return this._canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var n,i;const a=e.toLocaleLowerCase(),{close:o,error:c,leave:l,join:u}=K;if(s&&[o,c,l,u].indexOf(a)>=0&&s!==this._joinRef())return;let f=this._onMessage(a,t,s);if(t&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(n=this.bindings.postgres_changes)===null||n===void 0||n.filter(_=>{var m,v,g;return((m=_.filter)===null||m===void 0?void 0:m.event)==="*"||((g=(v=_.filter)===null||v===void 0?void 0:v.event)===null||g===void 0?void 0:g.toLocaleLowerCase())===a}).map(_=>_.callback(f,s)):(i=this.bindings[a])===null||i===void 0||i.filter(_=>{var m,v,g,O,P,j;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in _){const L=_.id,$=(m=_.filter)===null||m===void 0?void 0:m.event;return L&&((v=t.ids)===null||v===void 0?void 0:v.includes(L))&&($==="*"||$?.toLocaleLowerCase()===((g=t.data)===null||g===void 0?void 0:g.type.toLocaleLowerCase()))}else{const L=(P=(O=_?.filter)===null||O===void 0?void 0:O.event)===null||P===void 0?void 0:P.toLocaleLowerCase();return L==="*"||L===((j=t?.event)===null||j===void 0?void 0:j.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===a}).map(_=>{if(typeof f=="object"&&"ids"in f){const m=f.data,{schema:v,table:g,commit_timestamp:O,type:P,errors:j}=m;f=Object.assign(Object.assign({},{schema:v,table:g,commit_timestamp:O,eventType:P,new:{},old:{},errors:j}),this._getPayloadRecords(m))}_.callback(f,s)})}_isClosed(){return this.state===V.closed}_isJoined(){return this.state===V.joined}_isJoining(){return this.state===V.joining}_isLeaving(){return this.state===V.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:s};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter(n=>{var i;return!(((i=n.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===s&&gs.isEqual(n.filter,t))}),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(K.close,{},e)}_onError(e){this._on(K.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=V.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=Rs(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=Rs(e.columns,e.old_record)),t}}const ui=()=>{},di=typeof WebSocket<"u",hi=` 3 addEventListener("message", (e) => { 4 if (e.data.event === "start") { 5 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 6 } 7 });`;class fi{constructor(e,t){var s;this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=ei,this.params={},this.timeout=vr,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=ui,this.conn=null,this.sendBuffer=[],this.serializer
7=new ri,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._resolveFetch=i=>{let a;return i?a=i:typeof fetch>"u"?a=(...o)=>Pe(async()=>{const{default:c}=await Promise.resolve().then(()=>Ue);return{default:c}},void 0).then(({default:c})=>c(...o)):a=fetch,(...o)=>a(...o)},this.endPoint=`${e}/${Wt.websocket}`,this.httpEndpoint=kr(e),t?.transport?this.transport=t.transport:this.transport=null,t?.params&&(this.params=t.params),t?.headers&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),t?.timeout&&(this.timeout=t.timeout),t?.logger&&(this.logger=t.logger),t?.heartbeatIntervalMs&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const n=(s=t?.params)===null||s===void 0?void 0:s.apikey;if(n&&(this.accessTokenValue=n,this.apiKey=n),this.reconnectAfterMs=t?.reconnectAfterMs?t.reconnectAfterMs:i=>[1e3,2e3,5e3,1e4][i-1]||1e4,this.encode=t?.encode?t.encode:(i,a)=>a(JSON.stringify(i)),this.decode=t?.decode?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new wr(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(t?.fetch),t?.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.worker=t?.worker||!1,this.workerUrl=t?.workerUrl}this.accessToken=t?.accessToken||null}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this.endpointURL(),void 0,{headers:this.headers});return}if(di){this.conn=new WebSocket(this.endpointURL()),this.setupConnection();return}this.conn=new pi(this.endpointURL(),void 0,{close:()=>{this.conn=null}}),Pe(async()=>{const{default:e}=await import("./browser-creyt8kZ.js").then(t=>t.b);return{default:e}},__vite__mapDeps([0,1])).then(({default:e})=>{this.conn=new e(this.endpointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:ti}))}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case Ce.connecting:return ye.Connecting;case Ce.open:return ye.Open;case Ce.closing:return ye.Closing;default:return ye.Closed}}isConnected(){return this.connectionState()===ye.Open}channel(e,t={config:{}}){const s=new gs(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:n,ref:i}=e,a=()=>{this.encode(e,o=>{var c;(c=this.conn)===null||c===void 0||c.send(o)})};this.log("push",`${t} ${s} (${i})`,n),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){let t=e||this.accessToken&&await this.accessToken()||this.accessTokenValue;if(t){let s=null;try{s=JSON.parse(atob(t.split(".")[1]))}catch{}if(s&&s.exp&&!(Math.floor(Date.now()/1e3)-s.exp<0))return this.log("auth",`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${s.exp}`),Promise.reject(`InvalidJWTToken: Invalid value for JWT claim "exp" with value ${s.exp}`);this.accessTokenValue=t,this.channels.forEach(n=>{t&&n.updateJoinPayload({access_token:t}),n.joinedOnce&&n._isJoined()&&n._push(K.access_token,{access_token:t})})}}async sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(si,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth()}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>
7this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:n,payload:i,ref:a}=t;a&&a===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null),this.log("receive",`${i.status||""} ${s} ${n} ${a&&"("+a+")"||""}`,i),this.channels.filter(o=>o._isMember(s)).forEach(o=>o._trigger(n,i,a)),this.stateChangeCallbacks.message.forEach(o=>o(t))})}async _onConnOpen(){if(this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this.reconnectTimer.reset(),!this.worker)this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs);else{this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(K.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const s=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${s}${n}`}_workerObjectUrl(e){let t;if(e)t=e;else{const s=new Blob([hi],{type:"application/javascript"});t=URL.createObjectURL(s)}return t}}class pi{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Ce.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}
7class ys extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function D(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}class mi extends ys{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Gt extends ys{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var gi=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};const xr=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>Pe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ue);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},yi=()=>gi(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Pe(()=>Promise.resolve().then(()=>Ue),void 0)).Response:Response}),Qt=r=>{if(Array.isArray(r))return r.map(t=>Qt(t));if(typeof r=="function"||r!==Object(r))return r;const e={};return Object.entries(r).forEach(([t,s])=>{const n=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=Qt(s)}),e};var Se=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};const Ft=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),_i=(r,e,t)=>Se(void 0,void 0,void 0,function*(){const s=yield yi();r instanceof s&&!t?.noResolveJson?r.json().then(n=>{e(new mi(Ft(n),r.status||500))}).catch(n=>{e(new Gt(Ft(n),n))}):e(new Gt(Ft(r),r))}),vi=(r,e,t,s)=>{const n={method:r,headers:e?.headers||{}};return r==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json"},e?.headers),s&&(n.body=JSON.stringify(s)),Object.assign(Object.assign({},n),t))};function Ye(r,e,t,s,n,i){return Se(this,void 0,void 0,function*(){return new Promise((a,o)=>{r(t,vi(e,s,n,i)).then(c=>{if(!c.ok)throw c;return s?.noResolveJson?c:c.json()}).then(c=>a(c)).catch(c=>_i(c,o,s))})})}function ut(r,e,t,s){return Se(this,void 0,void 0,function*(){return Ye(r,"GET",e,t,s)})}function ue(r,e,t,s,n){return Se(this,void 0,void 0,function*(){return Ye(r,"POST",e,s,n,t)})}function wi(r,e,t,s,n){return Se(this,void 0,void 0,function*(){return Ye(r,"PUT",e,s,n,t)})}function bi(r,e,t,s){return Se(this,void 0,void 0,function*(){return Ye(r,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),s)})}function Sr(r,e,t,s,n){return Se(this,void 0,void 0,function*(){return Ye(r,"DELETE",e,s,n,t)})}var M=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};const ki={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},js={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class xi{constructor(e,t={},s,n){this.url=e,this.headers=t,this.bucketId=s,this.fetch=xr(n)}uploadOrUpdate(e,t,s,n){return M(this,void 0,void 0,function*(){try{let i;const a=Object.assign(Object.assign({},js),n);let o=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.append("cacheControl",a.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=s,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,c&&(o["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),n?.headers&&(o=Object.assign(Object.assign({},o),n.headers));const l=this._removeEmptyFolders(t),u=this._getFinalPath(l),d=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:e,body:i,headers:o},a?.duplex?{duplex:a.duplex}:{})),f=yield d.json();return d.ok?{data:{path:l,id:f.Id,fullPath:f.Key},error:null}:{data:null,error:f}}catch(i){if(D(i))return{data:null,error:i};throw i}})}upload(e,t,s){return M(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,s)})}uploadToSignedUrl(e,t,s,n){return M(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),a=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${a}`);o.searchParams.set("token",t);try{let c;const l=Object.assign({upsert:js.upsert},n),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&s instanceof Blob?(c=new FormData,c.append("cacheControl",l.cacheControl),c.append("",s)):typeof FormData<"u"&&s instanceof FormData?(c=s,c.append("cacheControl",l.cacheControl)):(c=s,u["cache-control"]=`max-age=${l.cacheControl}`,u["content-type"]=l.contentType);const d=yield this.fetch(o.toString(),{method:"PUT",body:c,headers:u}),f=yield d.json();return d.ok?{data:{path:i,fullPath:f.Key},error:null}:{data:null,error:f}}catch(c){if(D(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,t){return M(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const n=Object.assign({},this.headers);t?.upsert&&(n["x-upsert"]="true");const i=yield ue(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:n}),a=new URL(this.url+i.url),o=a.searchParams.get("token");if(!o)throw new ys("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:o},error:null}}catch(s){if(D(s))return{data:null,error:s};throw s}})}
7update(e,t,s){return M(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,s)})}move(e,t,s){return M(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s?.destinationBucket},{headers:this.headers}),error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}})}copy(e,t,s){return M(this,void 0,void 0,function*(){try{return{data:{path:(yield ue(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}})}createSignedUrl(e,t,s){return M(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield ue(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:t},s?.transform?{transform:s.transform}:{}),{headers:this.headers});const a=s?.download?`&download=${s.download===!0?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}})}createSignedUrls(e,t,s){return M(this,void 0,void 0,function*(){try{const n=yield ue(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=s?.download?`&download=${s.download===!0?"":s.download}`:"";return{data:n.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}})}download(e,t){return M(this,void 0,void 0,function*(){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(t?.transform||{}),a=i?`?${i}`:"";try{const o=this._getFinalPath(e);return{data:yield(yield ut(this.fetch,`${this.url}/${n}/${o}${a}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if(D(o))return{data:null,error:o};throw o}})}info(e){return M(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const s=yield ut(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:Qt(s),error:null}}catch(s){if(D(s))return{data:null,error:s};throw s}})}exists(e){return M(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield bi(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(D(s)&&s instanceof Gt){const n=s.originalError;if([400,404].includes(n?.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,t){const s=this._getFinalPath(e),n=[],i=t?.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&n.push(i);const o=typeof t?.transform<"u"?"render/image":"object",c=this.transformOptsToQueryString(t?.transform||{});c!==""&&n.push(c);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${s}${l}`)}}}remove(e){return M(this,void 0,void 0,function*(){try{return{data:yield Sr(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(D(t))return{data:null,error:t};throw t}})}list(e,t,s){return M(this,void 0,void 0,function*(){try{const n=Object.assign(Object.assign(Object.assign({},ki),t),{prefix:e||""});return{data:yield ue(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},s),error:null}}catch(n){if(D(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const Si="2.7.1",Ti={"X-Client-Info":`storage-js/${Si}`};var Ee=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};class Ei{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},Ti),t),this.fetch=xr(s)}listBuckets(){return Ee(this,void 0,void 0,function*(){try{return{data:yield ut(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(D(e))return{data:null,error:e};throw e}})}getBucket(e){return Ee(this,void 0,void 0,function*(){try{return{data:yield ut(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(D(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return Ee(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(D(s))return{data:null,error:s};throw s}})}updateBucket(e,t){return Ee(this,void 0,void 0,function*(){try{return{data:yield wi(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(D(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Ee(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(D(t))return{data:null,error:t};throw t}})}deleteBucket(e){return Ee(this,void 0,void 0,function*(){try{return{data:yield Sr(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(D(t))return{data:null,error:t};throw t}})}}
7class Oi extends Ei{constructor(e,t={},s){super(e,t,s)}from(e){return new xi(this.url,this.headers,e,this.fetch)}}const Ri="2.48.1";let Ve="";typeof Deno<"u"?Ve="deno":typeof document<"u"?Ve="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ve="react-native":Ve="node";const Ai={"X-Client-Info":`supabase-js-${Ve}/${Ri}`},Ci={headers:Ai},Pi={schema:"public"},ji={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},$i={};var Ii=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};const Ni=r=>{let e;return r?e=r:typeof fetch>"u"?e=cr:e=fetch,(...t)=>e(...t)},Li=()=>typeof Headers>"u"?lr:Headers,Ui=(r,e,t)=>{const s=Ni(t),n=Li();return(i,a)=>Ii(void 0,void 0,void 0,function*(){var o;const c=(o=yield e())!==null&&o!==void 0?o:r;let l=new n(a?.headers);return l.has("apikey")||l.set("apikey",r),l.has("Authorization")||l.set("Authorization",`Bearer ${c}`),s(i,Object.assign(Object.assign({},a),{headers:l}))})};var Di=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};function Bi(r){return r.replace(/\/$/,"")}function Fi(r,e){const{db:t,auth:s,realtime:n,global:i}=r,{db:a,auth:o,realtime:c,global:l}=e,u={db:Object.assign(Object.assign({},a),t),auth:Object.assign(Object.assign({},o),s),realtime:Object.assign(Object.assign({},c),n),global:Object.assign(Object.assign({},l),i),accessToken:()=>Di(this,void 0,void 0,function*(){return""})};return r.accessToken?u.accessToken=r.accessToken:delete u.accessToken,u}const Tr="2.67.3",Mi="http://localhost:9999",qi="supabase.auth.token",zi={"X-Client-Info":`gotrue-js/${Tr}`},$s=10,Xt="X-Supabase-Api-Version",Er={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function Vi(r){return Math.round(Date.now()/1e3)+r}function Zi(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}const X=()=>typeof window<"u"&&typeof document<"u",me={tested:!1,writable:!1},Je=()=>{if(!X())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(me.tested)return me.writable;const r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),me.tested=!0,me.writable=!0}catch{me.tested=!0,me.writable=!1}return me.writable};function Hi(r){const e={},t=new URL(r);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return t.searchParams.forEach((s,n)=>{e[n]=s}),e}const Or=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>Pe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ue);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},Ji=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",Rr=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},rt=async(r,e)=>{const t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},nt=async(r,e)=>{await r.removeItem(e)};function Wi(r){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let t="",s,n,i,a,o,c,l,u=0;for(r=r.replace("-","+").replace("_","/");u<r.length;)a=e.indexOf(r.charAt(u++)),o=e.indexOf(r.charAt(u++)),c=e.indexOf(r.charAt(u++)),l=e.indexOf(r.charAt(u++)),s=a<<2|o>>4,n=(o&15)<<4|c>>2,i=(c&3)<<6|l,t=t+String.fromCharCode(s),c!=64&&n!=0&&(t=t+String.fromCharCode(n)),l!=64&&i!=0&&(t=t+String.fromCharCode(i));return t}class jt{constructor(){this.promise=new jt.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}jt.promiseConstructor=Promise;function Is(r){const e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,t=r.split(".");
7if(t.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(Wi(s))}async function Ki(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function Gi(r,e){return new Promise((s,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await r(i);if(!e(i,null,a)){s(a);return}}catch(a){if(!e(i,a)){n(a);return}}})()})}function Qi(r){return("0"+r.toString(16)).substr(-2)}function Xi(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=t.length;let n="";for(let i=0;i<56;i++)n+=t.charAt(Math.floor(Math.random()*s));return n}return crypto.getRandomValues(e),Array.from(e,Qi).join("")}async function Yi(r){const t=new TextEncoder().encode(r),s=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(s);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}function ea(r){return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ta(r){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),r;const t=await Yi(r);return ea(t)}async function Oe(r,e,t=!1){const s=Xi();let n=s;t&&(n+="/PASSWORD_RECOVERY"),await Rr(r,`${e}-code-verifier`,n);const i=await ta(s);return[i,s===i?"plain":"s256"]}const sa=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function ra(r){const e=r.headers.get(Xt);if(!e||!e.match(sa))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}class _s extends Error{constructor(e,t,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=s}}function E(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}class na extends _s{constructor(e,t,s){super(e,t,s),this.name="AuthApiError",this.status=t,this.code=s}}function ia(r){return E(r)&&r.name==="AuthApiError"}class Ar extends _s{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Te extends _s{constructor(e,t,s,n){super(e,s,n),this.name=t,this.status=s}}class ce extends Te{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function aa(r){return E(r)&&r.name==="AuthSessionMissingError"}class Mt extends Te{constructor(){super("Auth session or user missing","AuthInvalidToken
7ResponseError",500,void 0)}}class it extends Te{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class at extends Te{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function oa(r){return E(r)&&r.name==="AuthImplicitGrantRedirectError"}class Ns extends Te{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Yt extends Te{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function qt(r){return E(r)&&r.name==="AuthRetryableFetchError"}class Ls extends Te{constructor(e,t,s){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=s}}var ca=function(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t};const ge=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),la=[502,503,504];async function Us(r){var e;if(!Ji(r))throw new Yt(ge(r),0);if(la.includes(r.status))throw new Yt(ge(r),r.status);let t;try{t=await r.json()}catch(i){throw new Ar(ge(i),i)}let s;const n=ra(r);if(n&&n.getTime()>=Er["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?s=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(s=t.error_code),s){if(s==="weak_password")throw new Ls(ge(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ce}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0))throw new Ls(ge(t),r.status,t.weak_password.reasons);throw new na(ge(t),r.status||500,s)}const ua=(r,e,t,s)=>{const n={method:r,headers:e?.headers||{}};return r==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),t))};async function A(r,e,t,s){var n;const i=Object.assign({},s?.headers);i[Xt]||(i[Xt]=Er["2024-01-01"].name),s?.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const a=(n=s?.query)!==null&&n!==void 0?n:{};s?.redirectTo&&(a.redirect_to=s.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await da(r,e,t+o,{headers:i,noResolveJson:s?.noResolveJson},{},s?.body);return s?.xform?s?.xform(c):{data:Object.assign({},c),error:null}}async function da(r,e,t,s,n,i){const a=ua(e,s,n,i);let o;try{o=await r(t,Object.assign({},a))}catch(c){throw console.error(c),new Yt(ge(c),0)}if(o.ok||await Us(o),s?.noResolveJson)return o;try{return await o.json()}catch(c){await Us(c)}}function le(r){var e;let t=null;ma(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=Vi(r.expires_in)));const s=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:s},error:null}}function Ds(r){const e=le(r);return!e.error&&r.weak_password&&typeof r.weak_password=="object"&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.message&&typeof r.weak_password.message=="string"&&r.weak_password.reasons.reduce((t,s)=>t&&typeof s=="string",!0)&&(e.data.weak_password=r.weak_password),e}function he(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function ha(r){return{data:r,error:null}}function fa(r){const{action_link:e,email_otp:t,hashed_token:s,redirect_to:n,verification_type:i}=r,a=ca(r,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:t,hashed_token:s,redirect_to:n,verification_type:i},c=Object.assign({},a);return{data:{properties:o,user:c},error:null}}function pa(r){return r}function ma(r){return r.access_token&&r.refresh_token&&r.expires_in}var ga=function(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t};class ya{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Or(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await A(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(E(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,t={}){try{return await A(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:he})}catch(s){if(E(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:t}=e,s=ga(e,["options"]),n=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(n.new_email=s?.newEmail,delete n.newEmail),await A(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:fa,redirectTo:t?.redirectTo})}catch(t){if(E(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await A(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:he})}catch(t){if(E(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,s,n,i,a,o,c;try{const l={nextPage:null,lastPage:0,total:0},u=await A(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(t=e?.page)===null||t===void 0?void 0:t.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e?.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,_=(c=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&c!==void 0?c:[];return _.length>0&&(_.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(m.split(";")[1].split("=")[1]);l[`${g}Page`]=v}),l.total=parseInt(f)),{data:Object.assign(Object.assign({},d),l),error:null}}catch(l){if(E(l))return{data:{users:[]},error:l};throw l}}async getUserById(e){try{return await A(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:he})}catch(t){if(E(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){try{return await A(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:he})}catch(s){if(E(s))return{data:{user:null},error:s};throw s}}
vendor: 16,384 bytes, line 7
7async deleteUser(e,t=!1){try{return await A(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:he})}catch(s){if(E(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){try{const{data:t,error:s}=await A(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:t,error:s}}catch(t){if(E(t))return{data:null,error:t};throw t}}async _deleteFactor(e){try{return{data:await A(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(E(t))return{data:null,error:t};throw t}}}const _a={getItem:r=>Je()?globalThis.localStorage.getItem(r):null,setItem:(r,e)=>{Je()&&globalThis.localStorage.setItem(r,e)},removeItem:r=>{Je()&&globalThis.localStorage.removeItem(r)}};function Bs(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}function va(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Re={debug:!!(globalThis&&Je()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Cr extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class wa extends Cr{}async function ba(r,e,t){Re.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),Re.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async n=>{if(n){Re.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,n.name);try{return await t()}finally{Re.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,n.name)}}else{if(e===0)throw Re.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new wa(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(Re.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}}))}va();const ka={url:Mi,storageKey:qi,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:zi,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},qe=30*1e3,Fs=3;async function Ms(r,e,t){return await t()}class We{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=We.nextInstanceID,We.nextInstanceID+=1,this.instanceID>0&&X()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const n=Object.assign(Object.assign({},ka),e);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new ya({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=Or(n.fetch),this.lock=n.lock||Ms,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:X()&&(!((t=globalThis?.navigator)===null||t===void 0)&&t.locks)?this.lock=ba:this.lock=Ms,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?n.storage?this.storage=n.storage:Je()?this.storage=_a:(this.memoryStorage={},this.storage=Bs(this.memoryStorage)):(this.memoryStorage={},this.storage=Bs(this.memoryStorage)),X()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Tr}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const t=Hi(window.location.href);let s="none";if(this._isImplicitGrantCallback(t)?s="implicit":await this._isPKCECallback(t)&&(s="pkce"),X()&&this.detectSessionInUrl&&s!=="none"){const{data:n,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),oa(i)){const c=(e=i.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:a,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return E(t)?{error:t}:{error:new Ar("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,s,n;try{const i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(t=e?.options)===null||t===void 0?void 0:t.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(n=e?.options)===null||n===void 0?void 0:n.captchaToken}},xform:le}),{data:a,error:o}=i;if(o||!a)return{data:{user:null,session:null},error:o};const c=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:l,session:c},error:null}}catch(i){if(E(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var t,s,n;try{let i;if("email"in e){const{email:u,password:d,options:f}=e;let _=null,m=null;this.flowType==="pkce"&&([_,m]=await Oe(this.storage,this.storageKey)),i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f?.emailRedirectTo,body:{email:u,password:d,data:(t=f?.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:f?.captchaToken},code_challenge:_,code_challenge_method:m},xform:le})}else if("phone"in e){const{phone:u,password:d,options:f}=e;i=await A(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(s=f?.data)!==null&&s!==void 0?s:{},channel:(n=f?.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:le})}else throw new it("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return{data:{user:null,session:null},error:o};const c=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:l,session:c},error:null}}catch(i){if(E(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:a,options:o}=e;t=await A(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:Ds})}else if("phone"in e){const{phone:i,password:a,options:o}=e;t=await A(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:Ds})}else throw new it("You must provide either an email or phone number and a password");const{data:s,error:n}=t;return n?{data:{user:null,session:null},error:n}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new Mt}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:n})}catch(t){if(E(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,s,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){const t=await rt(this.storage,`${this.storageKey}-code-verifier`),[s,n]=(t??"").split("/");try{const{data:i,error:a}=await A(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:le});if(await nt(this.storage,`${this.storageKey}-code-verifier`),a)throw a;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new Mt}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:a})}catch(i){if(E(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:t,provider:s,token:n,access_token:i,nonce:a}=e,o=await A(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:n,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:t?.captchaToken}},xform:le}),{data:c,error:l}=o;return l?{data:{user:null,session:null},error:l}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new Mt}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:l})}catch(t){if(E(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,s,n,i,a;try{if("email"in e){const{email:o,options:c}=e;let l=null,u=null;this.flowType==="pkce"&&([l,u]=await Oe(this.storage,this.storageKey));const{error:d}=await A(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(t=c?.data)!==null&&t!==void 0?t:{},create_user:(s=c?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},code_challenge:l,code_challenge_method:u},redirectTo:c?.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in e){const{phone:o,options:c}=e,{data:l,error:u}=await A(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=c?.data)!==null&&n!==void 0?n:{},create_user:(i=c?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},channel:(a=c?.channel)!==null&&a!==void 0?a:"sms"}});return{data:{user:null,session:null,messageId:l?.message_id},error:u}}throw new it("You must provide either an email or phone number.")}catch(o){if(E(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(e){var t,s;try{let n,i;"options"in e&&(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:a,error:o}=await A(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:le});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const c=a.session,l=a.user;return c?.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:l,session:c},error:null}}catch(n){if(E(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(e){var t,s,n;try{let i=null,a=null;return this.flowType==="pkce"&&([i,a]=await Oe(this.storage,this.storageKey)),await A(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&s!==void 0?s:void 0}),!((n=e?.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:a}),headers:this.headers,xform:ha})}catch(i){if(E(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new ce;const{error:n}=await A(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(E(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:s,type:n,options:i}=e,{error:a}=await A(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:n,gotrue_meta_security:{captcha_token:i?.captchaToken}},redirectTo:i?.emailRedirectTo});return{data:{user:null,session:null},error:a}}else if("phone"in e){const{phone:s,type:n,options:i}=e,{data:a,error:o}=await A(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:n,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return{data:{user:null,session:null,messageId:a?.message_id},error:o}}throw new it("You must provide either an email or phone number and a type")}catch(t){if(E(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await s,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=t();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin
7"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await rt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.storage.isServer){let a=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,l,u)=>(!a&&l==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),a=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,l,u))})}return{data:{session:e},error:null}}const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await A(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:he}):await this._useSession(async t=>{var s,n,i;const{data:a,error:o}=t;if(o)throw o;return!(!((s=a.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ce}:await A(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:he})})}catch(t){if(E(t))return aa(t)&&(await this._removeSession(),await nt(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:n,error:i}=s;if(i)throw i;if(!n.session)throw new ce;const a=n.session;let o=null,c=null;this.flowType==="pkce"&&e.email!=null&&([o,c]=await Oe(this.storage,this.storageKey));const{data:l,error:u}=await A(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:c}),jwt:a.access_token,xform:he});if(u)throw u;return a.user=l.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(s){if(E(s))return{data:{user:null},error:s};throw s}}_decodeJWT(e){return Is(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ce;const t=Date.now()/1e3;let s=t,n=!0,i=null;const a=Is(e.access_token);if(a.exp&&(s=a.exp,n=s<=t),n){const{session:o,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:c}=await this._getUser(e.access_token);if(c)throw c;i={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(t){if(E(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:a,error:o}=t;if(o)throw o;e=(s=a.session)!==null&&s!==void 0?s:void 0}if(!e?.refresh_token)throw new ce;const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(E(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!X())throw new at("No browser detected.");
7if(e.error||e.error_description||e.error_code)throw new at(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new Ns("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new at("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ns("No code detected.");const{data:P,error:j}=await this._exchangeCodeForSession(e.code);if(j)throw j;const L=new URL(window.location.href);return L.searchParams.delete("code"),window.history.replaceState(window.history.state,"",L.toString()),{data:{session:P.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:n,access_token:i,refresh_token:a,expires_in:o,expires_at:c,token_type:l}=e;if(!i||!o||!a||!l)throw new at("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(o);let f=u+d;c&&(f=parseInt(c));const _=f-u;_*1e3<=qe&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${d}s`);const m=f-d;u-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,u):u-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,u);const{data:v,error:g}=await this._getUser(i);if(g)throw g;const O={provider_token:s,provider_refresh_token:n,access_token:i,expires_in:d,expires_at:f,refresh_token:a,token_type:l,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:O,redirectType:e.type},error:null}}catch(s){if(E(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await rt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var s;const{data:n,error:i}=t;if(i)return{error:i};const a=(s=n.session)===null||s===void 0?void 0:s.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);if(o&&!(ia(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return e!=="others"&&(await this._removeSession(),await nt(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=Zi(),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,n;try{const{data:{session:i},error:a}=t;if(a)throw a;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,t={}){let s=null,n=null;this.flowType==="pkce"&&([s,n]=await Oe(this.storage,this.storageKey,!0));try{return await A(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(E(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(E(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:s,error:n}=await this._useSession(async i=>{var a,o,c,l,u;const{data:d,error:f}=i;if(f)throw f;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await A(this.fetch,"GET",_,{headers:this.headers,jwt:(u=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return X()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(s?.url),{data:{provider:e.provider,url:s?.url},error:null}}catch(s){if(E(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,n;const{data:i,error:a}=t;if(a)throw a;
vendor: 6,136 bytes, line 7
7return await A(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&n!==void 0?n:void 0})})}catch(t){if(E(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await Gi(async n=>(n>0&&await Ki(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await A(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:le})),(n,i)=>{const a=200*Math.pow(2,n);return i&&qt(i)&&Date.now()+a-s<qe})}catch(s){if(this._debug(t,"error",s),E(s))return{data:{session:null,user:null},error:s};throw s}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),X()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e;const t="#_recoverAndRefresh()";this._debug(t,"begin");try{const s=await rt(this.storage,this.storageKey);if(this._debug(t,"session from storage",s),!this._isValidSession(s)){this._debug(t,"session is not valid"),s!==null&&await this._removeSession();return}const n=Math.round(Date.now()/1e3),i=((e=s.expires_at)!==null&&e!==void 0?e:1/0)<n+$s;if(this._debug(t,`session has${i?"":" not"} expired with margin of ${$s}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),qt(a)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(t,"error",s),console.error(s);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new ce;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new jt;const{data:i,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!i.session)throw new ce;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={session:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(n,"error",i),E(i)){const a={session:null,error:i};return qt(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(a),a}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,s=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,t)}catch(c){i.push(c)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Rr(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await nt(this.storage,this.storageKey),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&X()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),qe);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/qe);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${qe}ms, refresh threshold is ${Fs} ticks`),n<=Fs&&await this._callRefreshToken(s.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof Cr)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!X()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(
7await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const n=[`provider=${encodeURIComponent(t)}`];if(s?.redirectTo&&n.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s?.scopes&&n.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,a]=await Oe(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});n.push(o.toString())}if(s?.queryParams){const i=new URLSearchParams(s.queryParams);n.push(i.toString())}return s?.skipBrowserRedirect&&n.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;return i?{data:null,error:i}:await A(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=n?.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(E(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var s,n;const{data:i,error:a}=t;if(a)return{data:null,error:a};const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:c,error:l}=await A(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(s=i?.session)===null||s===void 0?void 0:s.access_token});return l?{data:null,error:l}:(e.factorType==="totp"&&(!((n=c?.totp)===null||n===void 0)&&n.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(t){if(E(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;if(i)return{data:null,error:i};const{data:a,error:o}=await A(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(s=n?.session)===null||s===void 0?void 0:s.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:o})})}catch(t){if(E(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;return i?{data:null,error:i}:await A(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(s=n?.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(E(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=e?.factors||[],n=s.filter(a=>a.factor_type==="totp"&&a.status==="verified"),i=s.filter(a=>a.factor_type==="phone"&&a.status==="verified");return{data:{all:s,totp:n,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,s;const{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const a=this._decodeJWT(n.access_token);let o=null;a.aal&&(o=a.aal);let c=o;((s=(t=n.user.factors)===null||t===void 0?void 0:t.filter(d=>d.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(c="aal2");const u=a.amr||[];return{data:{currentLevel:o,nextLevel:c,currentAuthenticationMethods:u},error:null}}))}}We.nextInstanceID=0;const xa=We;class Sa extends xa{constructor(e){super(e)}}var Ta=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{l(s.next(u))}catch(d){a(d)}}function c(u){try{l(s.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):n(u.value).then(o,c)}l((s=s.apply(r,e||[])).next())})};class Ea{constructor(e,t,s){var n,i,a;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");
7if(!t)throw new Error("supabaseKey is required.");const o=Bi(e);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;const c=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l={db:Pi,realtime:$i,auth:Object.assign(Object.assign({},ji),{storageKey:c}),global:Ci},u=Fi(s??{},l);this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=u.auth)!==null&&a!==void 0?a:{},this.headers,u.global.fetch),this.fetch=Ui(t,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new Xn(`${o}/rest/v1`,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),u.accessToken||this._listenForAuthEvents()}get functions(){return new Rn(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new Oi(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return Ta(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:s}=yield this.auth.getSession();return(t=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,storageKey:i,flowType:a,lock:o,debug:c},l,u){const d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Sa({url:this.authUrl,headers:Object.assign(Object.assign({},d),l),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,flowType:a,lock:o,debug:c,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new fi(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,s)=>{this._handleTokenChanged(t,"CLIENT",s?.access_token)})}_handleTokenChanged(e,t,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?this.changedAccessToken=s:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Fc=(r,e,t)=>new Ea(r,e,t);function Pr(r,e){return function(){return r.apply(e,arguments)}}const{toString:Oa}=Object.prototype,{getPrototypeOf:vs}=Object,$t=(r=>e=>{const t=Oa.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),G=r=>(r=r.toLowerCase(),e=>$t(e)===r),It=r=>e=>typeof e===r,{isArray:Be}=Array,Ke=It("undefined");function Ra(r){return r!==null&&!Ke(r)&&r.constructor!==null&&!Ke(r.constructor)&&Z(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const jr=G("ArrayBuffer");function Aa(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&jr(r.buffer),e}const Ca=It("string"),Z=It("function"),$r=It("number"),Nt=r=>r!==null&&typeof r=="object",Pa=r=>r===!0||r===!1,ot=r=>{if($t(r)!=="object")return!1;const e=vs(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},ja=G("Date"),$a=G("File"),Ia=G("Blob"),Na=G("FileList"),La=r=>Nt(r)&&Z(r.pipe),Ua=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Z(r.append)&&((e=$t(r))==="formdata"||e==="object"&&Z(r.toString)&&r.toString()==="[object FormData]"))},Da=G("URLSearchParams"),[Ba,Fa,Ma,qa]=["ReadableStream","Request","Response","Headers"].map(G),za=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function et(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,n;if(typeof r!="object"&&(r=[r]),Be(r))for(s=0,n=r.length;s<n;s++)e.call(null,r[s],s,r);else{const i=t?Object.getOwnPropertyNames(r):Object.keys(r),a=i.length;let o;for(s=0;s<a;s++)o=i[s],e.call(null,r[o],o,r)}}function Ir(r,e){e=e.toLowerCase();const t=Object.keys(r);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}const _e=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Nr=r=>!Ke(r)&&r!==_e;function es(){const{caseless:r}=Nr(this)&&this||{},e={},t=(s,n)=>{const i=r&&Ir(e,n)||n;ot(e[i])&&ot(s)?e[i]=es(e[i],s):ot(s)?e[i]=es({},s):Be(s)?e[i]=s.slice():e[i]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&et(arguments[s],t);return e}const Va=(r,e,t,{allOwnKeys:s}={})=>(et(e,(n,i)=>{t&&Z(n)?r[i]=Pr(n,t):r[i]=n},{allOwnKeys:s}),r),Za=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Ha=(r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Ja=(r,e,t,s)=>{let n,i,a;const o={};if(e=e||{},r==null)return e;do{for(n=Object.getOwnPropertyNames(r),i=n.length;i-- >0;)a=n[i],(!s||s(a,r,e))&&!o[a]&&(e[a]=r[a],o[a]=!0);r=t!==!1&&vs(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Wa=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},Ka=r=>
vendor: 5,607 bytes, line 7
7{if(!r)return null;if(Be(r))return r;let e=r.length;if(!$r(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Ga=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&vs(Uint8Array)),Qa=(r,e)=>{const s=(r&&r[Symbol.iterator]).call(r);let n;for(;(n=s.next())&&!n.done;){const i=n.value;e.call(r,i[0],i[1])}},Xa=(r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},Ya=G("HTMLFormElement"),eo=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,n){return s.toUpperCase()+n}),qs=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),to=G("RegExp"),Lr=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};et(t,(n,i)=>{let a;(a=e(n,i,r))!==!1&&(s[i]=a||n)}),Object.defineProperties(r,s)},so=r=>{Lr(r,(e,t)=>{if(Z(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=r[t];if(Z(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},ro=(r,e)=>{const t={},s=n=>{n.forEach(i=>{t[i]=!0})};return Be(r)?s(r):s(String(r).split(e)),t},no=()=>{},io=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function ao(r){return!!(r&&Z(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const oo=r=>{const e=new Array(10),t=(s,n)=>{if(Nt(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[n]=s;const i=Be(s)?[]:{};return et(s,(a,o)=>{const c=t(a,n+1);!Ke(c)&&(i[o]=c)}),e[n]=void 0,i}}return s};return t(r,0)},co=G("AsyncFunction"),lo=r=>r&&(Nt(r)||Z(r))&&Z(r.then)&&Z(r.catch),Ur=((r,e)=>r?setImmediate:e?((t,s)=>(_e.addEventListener("message",({source:n,data:i})=>{n===_e&&i===t&&s.length&&s.shift()()},!1),n=>{s.push(n),_e.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Z(_e.postMessage)),uo=typeof queueMicrotask<"u"?queueMicrotask.bind(_e):typeof process<"u"&&process.nextTick||Ur,h={isArray:Be,isArrayBuffer:jr,isBuffer:Ra,isFormData:Ua,isArrayBufferView:Aa,isString:Ca,isNumber:$r,isBoolean:Pa,isObject:Nt,isPlainObject:ot,isReadableStream:Ba,isRequest:Fa,isResponse:Ma,isHeaders:qa,isUndefined:Ke,isDate:ja,isFile:$a,isBlob:Ia,isRegExp:to,isFunction:Z,isStream:La,isURLSearchParams:Da,isTypedArray:Ga,isFileList:Na,forEach:et,merge:es,extend:Va,trim:za,stripBOM:Za,inherits:Ha,toFlatObject:Ja,kindOf:$t,kindOfTest:G,endsWith:Wa,toArray:Ka,forEachEntry:Qa,matchAll:Xa,isHTMLForm:Ya,hasOwnProperty:qs,hasOwnProp:qs,reduceDescriptors:Lr,freezeMethods:so,toObjectSet:ro,toCamelCase:eo,noop:no,toFiniteNumber:io,findKey:Ir,global:_e,isContextDefined:Nr,isSpecCompliantForm:ao,toJSONObject:oo,isAsyncFn:co,isThenable:lo,setImmediate:Ur,asap:uo};function S(r,e,t,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}h.inherits(S,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:h.toJSONObject(this.config),code:this.code,status:this.status}}});const Dr=S.prototype,Br={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Br[r]={value:r}});Object.defineProperties(S,Br);Object.defineProperty(Dr,"isAxiosError",{value:!0});S.from=(r,e,t,s,n,i)=>{const a=Object.create(Dr);return h.toFlatObject(r,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),S.call(a,r.message,e,t,s,n),a.cause=r,a.name=r.name,i&&Object.assign(a,i),a};const ho=null;function ts(r){return h.isPlainObject(r)||h.isArray(r)}function Fr(r){return h.endsWith(r,"[]")?r.slice(0,-2):r}function zs(r,e,t){return r?r.concat(e).map(function(n,i){return n=Fr(n),!t&&i?"["+n+"]":n}).join(t?".":""):e}function fo(r){return h.isArray(r)&&!r.some(ts)}const po=h.toFlatObject(h,{},null,function(e){return/^is[A-Z]/.test(e)});function Lt(r,e,t){if(!h.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=h.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,g){return!h.isUndefined(g[v])});const s=t.metaTokens,n=t.visitor||u,i=t.dots,a=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&h.isSpecCompliantForm(e);if(!h.isFunction(n))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(h.isDate(m))return m.toISOString();if(!c&&h.isBlob(m))throw new S("Blob is not supported. Use a Buffer instead.");return h.isArrayBuffer(m)||h.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,v,g){let O=m;if(m&&!g&&typeof m=="object"){if(h.endsWith(v,"{}"))v=s?v:v.slice(0,-2),m=JSON.stringify(m);else if(h.isArray(m)&&fo(m)||(h.isFileList(m)||h.endsWith(v,"[]"))&&(O=h.toArray(m)))return v=Fr(v),O.forEach(function(j,L){!(h.isUndefined(j)||j===null)&&e.append(a===!0?zs([v],L,i):a===null?v:v+"[]",l(j))}),!1}return ts(m)?!0:(e.append(zs(g,v,i),l(m)),!1)}const d=[],f=Object.assign(po,{defaultVisitor:u,convertValue:l,isVisitable:ts});function _(m,v){if(!h.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+v.join("."));d.push(m),h.forEach(m,function(O,P){(!(h.isUndefined(O)||O===null)&&n.call(e,O,h.isString(P)?P.trim():P,v,f))===!0&&_(O,v?v.concat(P):[P])}),d.pop()}}if(!h.isObject(r))throw new TypeError("data must be an object");return _(r),e}
vendor: 16,273 bytes, lines 7-9
7function Vs(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function ws(r,e){this._pairs=[],r&&Lt(r,this,e)}const Mr=ws.prototype;Mr.append=function(e,t){this._pairs.push([e,t])};Mr.toString=function(e){const t=e?function(s){return e.call(this,s,Vs)}:Vs;return this._pairs.map(function(n){return t(n[0])+"="+t(n[1])},"").join("&")};function mo(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qr(r,e,t){if(!e)return r;const s=t&&t.encode||mo;h.isFunction(t)&&(t={serialize:t});const n=t&&t.serialize;let i;if(n?i=n(e,t):i=h.isURLSearchParams(e)?e.toString():new ws(e,t).toString(s),i){const a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}class Zs{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){h.forEach(this.handlers,function(s){s!==null&&e(s)})}}const zr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},go=typeof URLSearchParams<"u"?URLSearchParams:ws,yo=typeof FormData<"u"?FormData:null,_o=typeof Blob<"u"?Blob:null,vo={isBrowser:!0,classes:{URLSearchParams:go,FormData:yo,Blob:_o},protocols:["http","https","file","blob","url","data"]},bs=typeof window<"u"&&typeof document<"u",ss=typeof navigator=="object"&&navigator||void 0,wo=bs&&(!ss||["ReactNative","NativeScript","NS"].indexOf(ss.product)<0),bo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ko=bs&&window.location.href||"http://localhost",xo=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bs,hasStandardBrowserEnv:wo,hasStandardBrowserWebWorkerEnv:bo,navigator:ss,origin:ko},Symbol.toStringTag,{value:"Module"})),B={...xo,...vo};function So(r,e){return Lt(r,new B.classes.URLSearchParams,Object.assign({visitor:function(t,s,n,i){return B.isNode&&h.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function To(r){return h.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Eo(r){const e={},t=Object.keys(r);let s;const n=t.length;let i;for(s=0;s<n;s++)i=t[s],e[i]=r[i];return e}function Vr(r){function e(t,s,n,i){let a=t[i++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),c=i>=t.length;return a=!a&&h.isArray(n)?n.length:a,c?(h.hasOwnProp(n,a)?n[a]=[n[a],s]:n[a]=s,!o):((!n[a]||!h.isObject(n[a]))&&(n[a]=[]),e(t,s,n[a],i)&&h.isArray(n[a])&&(n[a]=Eo(n[a])),!o)}if(h.isFormData(r)&&h.isFunction(r.entries)){const t={};return h.forEachEntry(r,(s,n)=>{e(To(s),n,t,0)}),t}return null}function Oo(r,e,t){if(h.isString(r))try{return(e||JSON.parse)(r),h.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(0,JSON.stringify)(r)}const tt={transitional:zr,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,i=h.isObject(e);if(i&&h.isHTMLForm(e)&&(e=new FormData(e)),h.isFormData(e))return n?JSON.stringify(Vr(e)):e;if(h.isArrayBuffer(e)||h.isBuffer(e)||h.isStream(e)||h.isFile(e)||h.isBlob(e)||h.isReadableStream(e))return e;if(h.isArrayBufferView(e))return e.buffer;if(h.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return So(e,this.formSerializer).toString();if((o=h.isFileList(e))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Lt(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),Oo(e)):e}],transformResponse:[function(e){const t=this.transitional||tt.transitional,s=t&&t.forcedJSONParsing,n=this.responseType==="json";if(h.isResponse(e)||h.isReadableStream(e))return e;if(e&&h.isString(e)&&(s&&!this.responseType||n)){const a=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?S.from(o,S.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:B.classes.FormData,Blob:B.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};h.forEach(["delete","get","head","post","put","patch"],r=>{tt.headers[r]={}});const Ro=h.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ao=r=>{const e={};let t,s,n;return r&&r.split(` 8`).forEach(function(a){n=a.indexOf(":"),t=a.substring(0,n).trim().toLowerCase(),s=a.substring(n+1).trim(),!(!t||e[t]&&Ro[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Hs=Symbol("internals");function ze(r){return r&&String(r).trim().toLowerCase()}function ct(r){return r===!1||r==null?r:h.isArray(r)?r.map(ct):String(r)}function Co(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}const Po=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function zt(r,e,t,s,n){if(h.isFunction(s))return s.call(this,e,t);if(n&&(e=t),!!h.isString(e)){if(h.isString(s))return e.indexOf(s)!==-1;if(h.isRegExp(s))return s.test(e)}}function jo(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function $o(r,e){const t=h.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{value:function(n,i,a){return this[s].call(this,e,n,i,a)},configurable:!0})})}class z{constructor(e){e&&this.set(e)}set(e,t,s){const n=this;function i(o,c,l){const u=ze(c);if(!u)throw new Error("header name must be a non-empty string");const d=h.findKey(n,u);(!d||n[d]===void 0||l===!0||l===void 0&&n[d]!==!1)&&(n[d||c]=ct(o))}const a=(o,c)=>h.forEach(o,(l,u)=>i(l,u,c));if(h.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(h.isString(e)&&(e=e.trim())&&!Po(e))a(Ao(e),t);else if(h.isHeaders(e))for(const[o,c]of e.entries())i(c,o,s);else e!=null&&i(t,e,s);return this}get(e,t){if(e=ze(e),e){const s=h.findKey(this,e);if(s){const n=this[s];if(!t)return n;if(t===!0)return Co(n);if(h.isFunction(t))return t.call(this,n,s);if(h.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ze(e),e){const s=h.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||zt(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let n=!1;function i(a){if(a=ze(a),a){const o=h.findKey(s,a);o&&(!t||zt(s,s[o],o,t))&&(delete s[o],n=!0)}}return h.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let s=t.length,n=!1;for(;s--;){const i=t[s];(!e||zt(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){const t=this,s={};return h.forEach(this,(n,i)=>{const a=h.findKey(s,i);if(a){t[a]=ct(n),delete t[i];return}const o=e?jo(i):String(i).trim();o!==i&&delete t[i],t[o]=ct(n),s[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return h.forEach(this,(s,n)=>{s!=null&&s!==!1&&(t[n]=e&&h.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` 9`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[Hs]=this[Hs]={accessors:{}}).accessors,n=this.prototype;function i(a){const o=ze(a);s[o]||($o(n,a),s[o]=!0)}return h.isArray(e)?e.forEach(i):i(e),this}}z.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);h.reduceDescriptors(z.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(s){this[t]=s}}});h.freezeMethods(z);function Vt(r,e){const t=this||tt,s=e||t,n=z.from(s.headers);let i=s.data;return h.forEach(r,function(o){i=o.call(t,i,n.normalize(),e?e.status:void 0)}),n.normalize(),i}function Zr(r){return!!(r&&r.__CANCEL__)}function Fe(r,e,t){S.call(this,r??"canceled",S.ERR_CANCELED,e,t),this.name="CanceledError"}h.inherits(Fe,S,{__CANCEL__:!0});function Hr(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new S("Request failed with status code "+t.status,[S.ERR_BAD_REQUEST,S.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Io(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function No(r,e){r=r||10;const t=new Array(r),s=new Array(r);let n=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=s[i];a||(a=l),t[n]=c,s[n]=l;let d=i,f=0;for(;d!==n;)f+=t[d++],d=d%r;if(n=(n+1)%r,n===i&&(i=(i+1)%r),l-a<e)return;const _=u&&l-u;return _?Math.round(f*1e3/_):void 0}}function Lo(r,e){let t=0,s=1e3/e,n,i;const a=(l,u=Date.now())=>{t=u,n=null,i&&(clearTimeout(i),i=null),r.apply(null,l)};return[(...l)=>{const u=Date.now(),d=u-t;d>=s?a(l,u):(n=l,i||(i=setTimeout(()=>{i=null,a(n)},s-d)))},()=>n&&a(n)]}const dt=(r,e,t=3)=>{let s=0;const n=No(50,250);return Lo(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,c=a-s,l=n(c),u=a<=o;s=a;const d={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o&&u?(o-a)/l:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(d)},t)},Js=(r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},Ws=r=>(...e)=>h.asap(()=>r(...e)),Uo=B.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,B.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(B.origin),B.navigator&&/(msie|trident)/i.test(B.navigator.userAgent)):()=>!0,Do=B.hasStandardBrowserEnv?{write(r,e,t,s,n,i){const a=[r+"="+encodeURIComponent(e)];h.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),h.isString(s)&&a.push("path="+s),h.isString(n)&&a.push("domain="+n),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Bo(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Fo(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Jr(r,e,t){let s=!Bo(e);return r&&s||t==!1?Fo(r,e):e}const Ks=r=>r instanceof z?{...r}:r;function we(r,e){e=e||{};const t={};function s(l,u,d,f){return h.isPlainObject(l)&&h.isPlainObject(u)?h.merge.call({caseless:f},l,u):h.isPlainObject(u)?h.merge({},u):h.isArray(u)?u.slice():u}function n(l,u,d,f){if(h.isUndefined(u)){if(!h.isUndefined(l))return s(void 0,l,d,f)}else return s(l,u,d,f)}function i(l,u){if(!h.isUndefined(u))return s(void 0,u)}function a(l,u){if(h.isUndefined(u)){if(!h.isUndefined(l))return s(void 0,l)}else return s(void 0,u)}function o(l,u,d){if(d in e)return s(l,u);if(d in r)return s(void 0,l)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,u,d)=>n(Ks(l),Ks(u),d,!0)};return h.forEach(Object.keys(Object.assign({},r,e)),function(u){const d=c[u]||n,f=d(r[u],e[u],u);h.isUndefined(f)&&d!==o||(t[u]=f)}),t}const Wr=r=>{const e=we({},r);let{data:t,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:i,headers:a,auth:o}=e;e.headers=a=z.from(a),e.url=qr(Jr(e.baseURL,e.url),r.params,r.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let c;if(h.isFormData(t)){if(B.hasStandardBrowserEnv||B.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[l,...u]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];a.setContentType([l||"multipart/form-data",...u].join("; "))}}if(B.hasStandardBrowserEnv&&(s&&h.isFunction(s)&&(s=s(e)),s||s!==!1&&Uo(e.url))){const l=n&&i&&Do.read(i);l&&a.set(n,l)}return e},Mo=typeof XMLHttpRequest<"u",qo=Mo&&function(r){return new Promise(function(t,s){const n=Wr(r);let i=n.data;const a=z.from(n.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:l}=n,u,d,f,_,m;function v(){_&&_(),m&&m(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout;function O(){if(!g)return;const j=z.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),$={data:!o||o==="text"||o==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:j,config:r,request:g};Hr(function(pe){t(pe),v()},function(pe){s(pe),v()},$),g=null}"onloadend"in g?g.onloadend=O:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(O)},g.onabort=function(){g&&(s(new S("Request aborted",S.ECONNABORTED,r,g)),g=null)},g.onerror=function(){s(new S("Network Error",S.ERR_NETWORK,r,g)),g=null},g.ontimeout=function(){let L=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const $=n.transitional||zr;n.timeoutErrorMessage&&(L=n.timeoutErrorMessage),s(new S(L,$.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,r,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&h.forEach(a.toJSON(),function(L,$){g.setRequestHeader($,L)}),h.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),o&&o!=="json"&&(g.responseType=n.responseType),l&&([f,m]=dt(l,!0),g.addEventListener("progress",f)),c&&g.upload&&([d,_]=dt(c),g.upload.addEventListener("progress",d),g.upload.addEventListener("loadend",_)),(n.cancelToken||n.signal)&&(u=j=>{g&&(s(!j||j.type?new Fe(null,r,g):j),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));const P=Io(n.url);if(P&&B.protocols.indexOf(P)===-1){s(new S("Unsupported protocol "+P+":",S.ERR_BAD_REQUEST,r));return}g.send(i||null)})},zo=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let s=new AbortController,n;const i=function(l){if(!n){n=!0,o();const u=l instanceof Error?l:this.reason;s.abort(u instanceof S?u:new Fe(u instanceof Error?u.message:u))}};let a=e&&setTimeout(()=>{a=null,i(new S(`timeout ${e} of ms exceeded`,S.ETIMEDOUT))},e);const o=()=>{r&&(a&&clearTimeout(a),a=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),r=null)};r.forEach(l=>l.addEventListener("abort",i));const{signal:c}=s;return c.unsubscribe=()=>h.asap(o),c}},Vo=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,n;for(;s<t;)n=s+e,yield r.slice(s,n),s=n},Zo=async function*(r,e){for await(const t of Ho(r))yield*Vo(t,e)},Ho=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},Gs=(r,e,t,s)=>{const n=Zo(r,e);let i=0,a,o=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await n.next();if(l){o(),c.close();return}let d=u.byteLength;if(t){let f=i+=d;t(f)}c.enqueue(new Uint8Array(u))}catch(l){throw o(l),l}},cancel(c){return o(c),n.return()}},{highWaterMark:2})},Ut=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Kr=Ut&&typeof ReadableStream=="function",Jo=Ut&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),Gr=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Wo=Kr&&Gr(()=>{let r=!1;
vendor: 4,165 bytes, lines 9-11
9const e=new Request(B.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),Qs=64*1024,rs=Kr&&Gr(()=>h.isReadableStream(new Response("").body)),ht={stream:rs&&(r=>r.body)};Ut&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!ht[e]&&(ht[e]=h.isFunction(r[e])?t=>t[e]():(t,s)=>{throw new S(`Response type '${e}' is not supported`,S.ERR_NOT_SUPPORT,s)})})})(new Response);const Ko=async r=>{if(r==null)return 0;if(h.isBlob(r))return r.size;if(h.isSpecCompliantForm(r))return(await new Request(B.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(h.isArrayBufferView(r)||h.isArrayBuffer(r))return r.byteLength;if(h.isURLSearchParams(r)&&(r=r+""),h.isString(r))return(await Jo(r)).byteLength},Go=async(r,e)=>{const t=h.toFiniteNumber(r.getContentLength());return t??Ko(e)},Qo=Ut&&(async r=>{let{url:e,method:t,data:s,signal:n,cancelToken:i,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:f}=Wr(r);l=l?(l+"").toLowerCase():"text";let _=zo([n,i&&i.toAbortSignal()],a),m;const v=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let g;try{if(c&&Wo&&t!=="get"&&t!=="head"&&(g=await Go(u,s))!==0){let $=new Request(e,{method:"POST",body:s,duplex:"half"}),oe;if(h.isFormData(s)&&(oe=$.headers.get("content-type"))&&u.setContentType(oe),$.body){const[pe,st]=Js(g,dt(Ws(c)));s=Gs($.body,Qs,pe,st)}}h.isString(d)||(d=d?"include":"omit");const O="credentials"in Request.prototype;m=new Request(e,{...f,signal:_,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:s,duplex:"half",credentials:O?d:void 0});let P=await fetch(m);const j=rs&&(l==="stream"||l==="response");if(rs&&(o||j&&v)){const $={};["status","statusText","headers"].forEach(Ts=>{$[Ts]=P[Ts]});const oe=h.toFiniteNumber(P.headers.get("content-length")),[pe,st]=o&&Js(oe,dt(Ws(o),!0))||[];P=new Response(Gs(P.body,Qs,pe,()=>{st&&st(),v&&v()}),$)}l=l||"text";let L=await ht[h.findKey(ht,l)||"text"](P,r);return!j&&v&&v(),await new Promise(($,oe)=>{Hr($,oe,{data:L,headers:z.from(P.headers),status:P.status,statusText:P.statusText,config:r,request:m})})}catch(O){throw v&&v(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,r,m),{cause:O.cause||O}):S.from(O,O&&O.code,r,m)}}),ns={http:ho,xhr:qo,fetch:Qo};h.forEach(ns,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const Xs=r=>`- ${r}`,Xo=r=>h.isFunction(r)||r===null||r===!1,Qr={getAdapter:r=>{r=h.isArray(r)?r:[r];const{length:e}=r;let t,s;const n={};for(let i=0;i<e;i++){t=r[i];let a;if(s=t,!Xo(t)&&(s=ns[(a=String(t)).toLowerCase()],s===void 0))throw new S(`Unknown adapter '${a}'`);if(s)break;n[a||"#"+i]=s}if(!s){const i=Object.entries(n).map(([o,c])=>`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=e?i.length>1?`since : 10`+i.map(Xs).join(` 11`):" "+Xs(i[0]):"as no adapter specified";throw new S("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:ns};function Zt(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Fe(null,r)}function Ys(r){return Zt(r),r.headers=z.from(r.headers),r.data=Vt.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Qr.getAdapter(r.adapter||tt.adapter)(r).then(function(s){return Zt(r),s.data=Vt.call(r,r.transformResponse,s),s.headers=z.from(s.headers),s},function(s){return Zr(s)||(Zt(r),s&&s.response&&(s.response.data=Vt.call(r,r.transformResponse,s.response),s.response.headers=z.from(s.response.headers))),Promise.reject(s)})}const Xr="1.8.1",Dt={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Dt[r]=function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r}});const er={};Dt.transitional=function(e,t,s){function n(i,a){return"[Axios v"+Xr+"] Transitional option '"+i+"'"+a+(s?". "+s:"")}return(i,a,o)=>{if(e===!1)throw new S(n(a," has been removed"+(t?" in "+t:"")),S.ERR_DEPRECATED);
vendor: 2,709 bytes, lines 11-12
11return t&&!er[a]&&(er[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,a,o):!0}};Dt.spelling=function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function Yo(r,e,t){if(typeof r!="object")throw new S("options must be an object",S.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let n=s.length;for(;n-- >0;){const i=s[n],a=e[i];if(a){const o=r[i],c=o===void 0||a(o,i,r);if(c!==!0)throw new S("option "+i+" must be "+c,S.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new S("Unknown option "+i,S.ERR_BAD_OPTION)}}const lt={assertOptions:Yo,validators:Dt},Q=lt.validators;class ve{constructor(e){this.defaults=e,this.interceptors={request:new Zs,response:new Zs}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const i=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=` 12`+i):s.stack=i}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=we(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:i}=t;s!==void 0&<.assertOptions(s,{silentJSONParsing:Q.transitional(Q.boolean),forcedJSONParsing:Q.transitional(Q.boolean),clarifyTimeoutError:Q.transitional(Q.boolean)},!1),n!=null&&(h.isFunction(n)?t.paramsSerializer={serialize:n}:lt.assertOptions(n,{encode:Q.function,serialize:Q.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),lt.assertOptions(t,{baseUrl:Q.spelling("baseURL"),withXsrfToken:Q.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&h.merge(i.common,i[t.method]);i&&h.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),t.headers=z.concat(a,i);const o=[];let c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(t)===!1||(c=c&&v.synchronous,o.unshift(v.fulfilled,v.rejected))});const l=[];this.interceptors.response.forEach(function(v){l.push(v.fulfilled,v.rejected)});let u,d=0,f;if(!c){const m=[Ys.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,l),f=m.length,u=Promise.resolve(t);d<f;)u=u.then(m[d++],m[d++]);return u}f=o.length;let _=t;for(d=0;d<f;){const m=o[d++],v=o[d++];try{_=m(_)}catch(g){v.call(this,g);break}}try{u=Ys.call(this,_)}catch(m){return Promise.reject(m)}for(d=0,f=l.length;d<f;)u=u.then(l[d++],l[d++]);return u}getUri(e){e=we(this.defaults,e);const t=Jr(e.baseURL,e.url,e.allowAbsoluteUrls);return qr(t,e.params,e.paramsSerializer)}}
vendor: 1,657 bytes, line 12
12h.forEach(["delete","get","head","options"],function(e){ve.prototype[e]=function(t,s){return this.request(we(s||{},{method:e,url:t,data:(s||{}).data}))}});h.forEach(["post","put","patch"],function(e){function t(s){return function(i,a,o){return this.request(we(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}ve.prototype[e]=t(),ve.prototype[e+"Form"]=t(!0)});class ks{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const a=new Promise(o=>{s.subscribe(o),i=o}).then(n);return a.cancel=function(){s.unsubscribe(i)},a},e(function(i,a,o){s.reason||(s.reason=new Fe(i,a,o),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=s=>{e.abort(s)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ks(function(n){e=n}),cancel:e}}}function ec(r){return function(t){return r.apply(null,t)}}function tc(r){return h.isObject(r)&&r.isAxiosError===!0}const is={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
12alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(is).forEach(([r,e])=>{is[e]=r});function Yr(r){const e=new ve(r),t=Pr(ve.prototype.request,e);return h.extend(t,ve.prototype,e,{allOwnKeys:!0}),h.extend(t,e,null,{allOwnKeys:!0}),t.create=function(n){return Yr(we(r,n))},t}const U=Yr(tt);U.Axios=ve;U.CanceledError=Fe;U.CancelToken=ks;U.isCancel=Zr;U.VERSION=Xr;U.toFormData=Lt;U.AxiosError=S;U.Cancel=U.CanceledError;U.all=function(e){return Promise.all(e)};U.spread=ec;U.isAxiosError=tc;U.mergeConfig=we;U.AxiosHeaders=z;U.formToJSON=r=>Vr(h.isHTMLForm(r)?new FormData(r):r);U.getAdapter=Qr.getAdapter;U.HttpStatusCode=is;U.default=U;var C;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const i={};for(const a of n)i[a]=a;return i},r.getValidEnumValues=n=>{const i=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(const o of i)a[o]=n[o];return r.objectValues(a)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const i=[];for(const a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},r.find=(n,i)=>{for(const a of n)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=s,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(C||(C={}));var tr;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(tr||(tr={}));const w=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),de=r=>{switch(typeof r){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(r)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(r)?w.array:r===null?w.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?w.promise:typeof Map<"u"&&r instanceof Map?w.map:typeof Set<"u"&&r instanceof Set?w.set:typeof Date<"u"&&r instanceof Date?w.date:w.object;default:return w.unknown}}
vendor: 39,469 bytes, line 12
12,p=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ie extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},s={_errors:[]},n=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),s}static assert(e){if(!(e instanceof ie))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}ie.create=r=>new ie(r);const as=(r,e)=>{let t;switch(r.code){case p.invalid_type:r.received===w.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case p.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,C.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:t=`Unrecognized key(s) in object: ${C.joinValues(r.keys,", ")}`;break;case p.invalid_union:t="Invalid input";break;case p.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${C.joinValues(r.options)}`;break;case p.invalid_enum_value:t=`Invalid enum value. Expected ${C.joinValues(r.options)}, received '${r.received}'`;break;case p.invalid_arguments:t="Invalid function arguments";break;case p.invalid_return_type:t="Invalid function return type";break;case p.invalid_date:t="Invalid date";break;case p.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:C.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case p.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case p.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case p.custom:t="Invalid input";break;case p.invalid_intersection_types:t="Intersection results could not be merged";break;case p.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case p.not_finite:t="Number must be finite";break;default:t=e.defaultError,C.assertNever(r)}return{message:t}};let sc=as;function rc(){return sc}const nc=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,i=[...t,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="";const c=s.filter(l=>!!l).slice().reverse();for(const l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:i,message:o}};function y(r,e){const t=rc(),s=nc({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===as?void 0:as].filter(n=>!!n)});r.common.issues.push(s)}class F{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return k;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const i=await n.key,a=await n.value;s.push({key:i,value:a})}return F.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return k;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(s[i.value]=a.value)}return{status:e.value,value:s}}}const k=Object.freeze({status:"aborted"}),Ze=r=>({status:"dirty",value:r}),W=r=>({status:"valid",value:r}),sr=r=>r.status==="aborted",rr=r=>r.status==="dirty",$e=r=>r.status==="valid",ft=r=>typeof Promise<"u"&&r instanceof Promise;var b;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(b||(b={}));class ee{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nr=(r,e)=>{if($e(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ie(r.common.issues);return this._error=t,this._error}}};function T(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,o)=>{const{message:c}=r;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}class R{get description(){return this._def.description}_getType(e){return de(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new F,ctx:{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ft(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)},n=this._parseSync({data:e,path:s.path,parent:s});return nr(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return $e(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>$e(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(ft(n)?n:Promise.resolve(n));return nr(s,i)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{const a=e(n),o=()=>i.addIssue({code:p.custom,...s(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new ae({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ne.create(this,this._def)}nullable(){return xe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this)}promise(){return kt.create(this,this._def)}or(e){return gt.create([this,e],this._def)}and(e){return yt.create(this,e,this._def)}transform(e){return new ae({...T(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new xt({...T(this._def),innerType:this,defaultValue:t,typeName:x.ZodDefault})}brand(){return new rn({typeName:x.ZodBranded,type:this,...T(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new St({...T(this._def),innerType:this,catchValue:t,typeName:x.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ss.create(this,e)}readonly(){return Tt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ic=/^c[^\s-]{8,}$/i,ac=/^[0-9a-z]+$/,oc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,lc=/^[a-z0-9_-]{21}$/i,uc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,hc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ht;const pc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,gc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_c=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,en="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wc=new RegExp(`^${en}$`);function tn(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function bc(r){return new RegExp(`^${tn(r)}$`)}function kc(r){let e=`${en}T${tn(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function xc(r,e){return!!((e==="v4"||!e)&&pc.test(r)||(e==="v6"||!e)&&gc.test(r))}function Sc(r,e){if(!uc.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Tc(r,e){return!!((e==="v4"||!e)&&mc.test(r)||(e==="v6"||!e)&&yc.test(r))}class re extends R{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){const i=this._getOrReturnCtx(e);return y(i,{code:p.invalid_type,expected:w.string,received:i.parsedType}),k}const s=new F;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:p.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:p.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(n=this._getOrReturnCtx(e,n),a?y(n,{code:p.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&y(n,{code:p.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")hc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"email",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")Ht||(Ht=new RegExp(fc,"u")),Ht.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"emoji",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")cc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"uuid",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")lc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"nanoid",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")ic.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")ac.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid2",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")oc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ulid",code:p.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),y(n,{validation:"url",code:p.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"regex",code:p.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?kc(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?wc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?bc(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:p.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?dc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"duration",code:p.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?xc(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ip",code:p.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Sc(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"jwt",code:p.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Tc(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cidr",code:p.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?_c.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64",code:p.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?vc.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64url",code:p.invalid_string,message:i.message}),s.dirty()):C.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:p.invalid_string,...b.errToObj(s)})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...b.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...b.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new re({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}re.create=r=>new re({checks:[],typeName:x.ZodString,coerce:r?.coerce??!1,...T(r)});function Ec(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,i=Number.parseInt(r.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return i%a/10**n}class Ie extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){const i=this._getOrReturnCtx(e);return y(i,{code:p.invalid_type,expected:w.number,received:i.parsedType}),k}let s;const n=new F;for(const i of this._def.checks)i.kind==="int"?C.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:p.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Ec(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:p.not_finite,message:i.message}),n.dirty()):C.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new Ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Ie.create=r=>new Ie({checks:[],typeName:x.ZodNumber,coerce:r?.coerce||!1,...T(r)});class Ne extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let s;const n=new F;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),y(s,{code:p.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):C.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:p.invalid_type,expected:w.bigint,received:t.parsedType}),k}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new Ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new Ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ne.create=r=>new Ne({checks:[],typeName:x.ZodBigInt,coerce:r?.coerce??!1,...T(r)});class os extends R{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.boolean,received:s.parsedType}),k}return W(e.data)}}os.create=r=>new os({typeName:x.ZodBoolean,coerce:r?.coerce||!1,...T(r)});class Ge extends R{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){const i=this._getOrReturnCtx(e);return y(i,{code:p.invalid_type,expected:w.date,received:i.parsedType}),k}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return y(i,{code:p.invalid_date}),k}const s=new F;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:p.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:p.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):C.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ge({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Ge.create=r=>new Ge({checks:[],coerce:r?.coerce||!1,typeName:x.ZodDate,...T(r)});class cs extends R{_parse(e){if(this._getType(e)!==w.symbol){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.symbol,received:s.parsedType}),k}return W(e.data)}}cs.create=r=>new cs({typeName:x.ZodSymbol,...T(r)});class pt extends R{_parse(e){if(this._getType(e)!==w.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.undefined,received:s.parsedType}),k}return W(e.data)}}pt.create=r=>new pt({typeName:x.ZodUndefined,...T(r)});class mt extends R{_parse(e){if(this._getType(e)!==w.null){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.null,received:s.parsedType}),k}return W(e.data)}}mt.create=r=>new mt({typeName:x.ZodNull,...T(r)});class Qe extends R{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}Qe.create=r=>new Qe({typeName:x.ZodAny,...T(r)});class ls extends R{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}ls.create=r=>new ls({typeName:x.ZodUnknown,...T(r)});class fe extends R{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:p.invalid_type,expected:w.never,received:t.parsedType}),k}}fe.create=r=>new fe({typeName:x.ZodNever,...T(r)});class us extends R{_parse(e){if(this._getType(e)!==w.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.void,received:s.parsedType}),k}return W(e.data)}}us.create=r=>new us({typeName:x.ZodVoid,...T(r)});class Y extends R{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==w.array)return y(t,{code:p.invalid_type,expected:w.array,received:t.parsedType}),k;if(n.exactLength!==null){const a=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(a||o)&&(y(t,{code:a?p.too_big:p.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(y(t,{code:p.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(y(t,{code:p.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>n.type._parseAsync(new ee(t,a,t.path,o)))).then(a=>F.mergeArray(s,a));const i=[...t.data].map((a,o)=>n.type._parseSync(new ee(t,a,t.path,o)));return F.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new Y({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new Y({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new Y({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}Y.create=(r,e)=>new Y({type:r,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...T(e)});function Ae(r){if(r instanceof N){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=ne.create(Ae(s))}return new N({...r._def,shape:()=>e})}else return r instanceof Y?new Y({...r._def,type:Ae(r.element)}):r instanceof ne?ne.create(Ae(r.unwrap())):r instanceof xe?xe.create(Ae(r.unwrap())):r instanceof be?be.create(r.items.map(e=>Ae(e))):r}class N extends R{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=C.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==w.object){const l=this._getOrReturnCtx(e);return y(l,{code:p.invalid_type,expected:w.object,received:l.parsedType}),k}const{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(const l in n.data)a.includes(l)||o.push(l);const c=[];for(const l of a){const u=i[l],d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ee(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof fe){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&(y(n,{code:p.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ee(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>F.mergeObjectSync(s,l)):F.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:b.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new N({...this._def,catchall:e})}pick(e){const t={};for(const s of C.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new N({...this._def,shape:()=>t})}omit(e){const t={};for(const s of C.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new N({...this._def,shape:()=>t})}deepPartial(){return Ae(this)}partial(e){const t={};for(const s of C.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new N({...this._def,shape:()=>t})}required(e){const t={};for(const s of C.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof ne;)i=i._def.innerType;t[s]=i}return new N({...this._def,shape:()=>t})}keyof(){return sn(C.objectKeys(this.shape))}}N.create=(r,e)=>new N({shape:()=>r,unknownKeys:"strip",catchall:fe.create(),typeName:x.ZodObject,...T(e)});N.strictCreate=(r,e)=>new N({shape:()=>r,unknownKeys:"strict",catchall:fe.create(),typeName:x.ZodObject,...T(e)});N.lazycreate=(r,e)=>new N({shape:r,unknownKeys:"strip",catchall:fe.create(),typeName:x.ZodObject,...T(e)});class gt extends R{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new ie(o.ctx.common.issues));return y(t,{code:p.invalid_union,unionErrors:a}),k}if(t.common.async)return Promise.all(s.map(async i=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i;const a=[];for(const c of s){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(c=>new ie(c));return y(t,{code:p.invalid_union,unionErrors:o}),k}}get options(){return this._def.options}}gt.create=(r,e)=>new gt({options:r,typeName:x.ZodUnion,...T(e)});const te=r=>r instanceof vt?te(r.schema):r instanceof ae?te(r.innerType()):r instanceof wt?[r.value]:r instanceof ke?r.options:r instanceof bt?C.objectValues(r.enum):r instanceof xt?te(r._def.innerType):r instanceof pt?[void 0]:r instanceof mt?[null]:r instanceof ne?[void 0,...te(r.unwrap())]:r instanceof xe?[null,...te(r.unwrap())]:r instanceof rn||r instanceof Tt?te(r.unwrap()):r instanceof St?te(r._def.innerType):[];class xs extends R{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.object)return y(t,{code:p.invalid_type,expected:w.object,received:t.parsedType}),k;const s=this.discriminator,n=t.data[s],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}
vendor: 5,957 bytes, line 12
12static create(e,t,s){const n=new Map;for(const i of t){const a=te(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new xs({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...T(s)})}}function ds(r,e){const t=de(r),s=de(e);if(r===e)return{valid:!0,data:r};if(t===w.object&&s===w.object){const n=C.objectKeys(e),i=C.objectKeys(r).filter(o=>n.indexOf(o)!==-1),a={...r,...e};for(const o of i){const c=ds(r[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===w.array&&s===w.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let i=0;i<r.length;i++){const a=r[i],o=e[i],c=ds(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===w.date&&s===w.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class yt extends R{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(i,a)=>{if(sr(i)||sr(a))return k;const o=ds(i.value,a.value);return o.valid?((rr(i)||rr(a))&&t.dirty(),{status:t.value,value:o.data}):(y(s,{code:p.invalid_intersection_types}),k)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}yt.create=(r,e,t)=>new yt({left:r,right:e,typeName:x.ZodIntersection,...T(t)});class be extends R{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.array)return y(s,{code:p.invalid_type,expected:w.array,received:s.parsedType}),k;if(s.data.length<this._def.items.length)return y(s,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...s.data].map((a,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ee(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(i).then(a=>F.mergeArray(t,a)):F.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:r,typeName:x.ZodTuple,rest:null,...T(e)})};class _t extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.object)return y(s,{code:p.invalid_type,expected:w.object,received:s.parsedType}),k;const n=[],i=this._def.keyType,a=this._def.valueType;for(const o in s.data)n.push({key:i._parse(new ee(s,o,s.path,o)),value:a._parse(new ee(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?F.mergeObjectAsync(t,n):F.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof R?new _t({keyType:e,valueType:t,typeName:x.ZodRecord,...T(s)}):new _t({keyType:re.create(),valueType:e,typeName:x.ZodRecord,...T(t)})}}class hs extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.map)return y(s,{code:p.invalid_type,expected:w.map,received:s.parsedType}),k;const n=this._def.keyType,i=this._def.valueType,a=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new ee(s,o,s.path,[l,"key"])),value:i._parse(new ee(s,c,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return k;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of a){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return k;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}}hs.create=(r,e,t)=>new hs({valueType:e,keyType:r,typeName:x.ZodMap,...T(t)});class Le extends R{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==w.set)return y(s,{code:p.invalid_type,expected:w.set,received:s.parsedType}),k;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(y(s,{code:p.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(y(s,{code:p.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function a(c){const l=new Set;for(const u of c){if(u.status==="aborted")return k;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const o=[...s.data.values()].map((c,l)=>i._parse(new ee(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new Le({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new Le({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Le.create=(r,e)=>new Le({valueType:r,minSize:null,maxSize:null,typeName:x.ZodSet,...T(e)});class vt extends R{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}vt.create=(r,e)=>new vt({getter:r,typeName:x.ZodLazy,...T(e)});class wt extends R{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),k}
vendor: 4,306 bytes, line 12
12return{status:"valid",value:e.data}}get value(){return this._def.value}}wt.create=(r,e)=>new wt({value:r,typeName:x.ZodLiteral,...T(e)});function sn(r,e){return new ke({values:r,typeName:x.ZodEnum,...T(e)})}class ke extends R{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return y(t,{expected:C.joinValues(s),received:t.parsedType,code:p.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return y(t,{received:t.data,code:p.invalid_enum_value,options:s}),k}return W(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ke.create(e,{...this._def,...t})}exclude(e,t=this._def){return ke.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}ke.create=sn;class bt extends R{_parse(e){const t=C.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==w.string&&s.parsedType!==w.number){const n=C.objectValues(t);return y(s,{expected:C.joinValues(n),received:s.parsedType,code:p.invalid_type}),k}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=C.objectValues(t);return y(s,{received:s.data,code:p.invalid_enum_value,options:n}),k}return W(e.data)}get enum(){return this._def.values}}bt.create=(r,e)=>new bt({values:r,typeName:x.ZodNativeEnum,...T(e)});class kt extends R{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.promise&&t.common.async===!1)return y(t,{code:p.invalid_type,expected:w.promise,received:t.parsedType}),k;const s=t.parsedType===w.promise?t.data:Promise.resolve(t.data);return W(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}kt.create=(r,e)=>new kt({type:r,typeName:x.ZodPromise,...T(e)});class ae extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:a=>{y(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){const a=n.transform(s.data,i);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return k;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?k:c.status==="dirty"||t.value==="dirty"?Ze(c.value):c});{if(t.value==="aborted")return k;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?k:o.status==="dirty"||t.value==="dirty"?Ze(o.value):o}}if(n.type==="refinement"){const a=o=>{const c=n.refinement(o,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?k:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?k:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!$e(a))return k;const o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>$e(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):k);C.assertNever(n)}}ae.create=(r,e,t)=>new ae({schema:r,typeName:x.ZodEffects,effect:e,...T(t)});ae.createWithPreprocess=(r,e,t)=>new ae({schema:e,effect:{type:"preprocess",transform:r},typeName:x.ZodEffects,...T(t)});
vendor: 4,627 bytes, line 12
12class ne extends R{_parse(e){return this._getType(e)===w.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ne.create=(r,e)=>new ne({innerType:r,typeName:x.ZodOptional,...T(e)});class xe extends R{_parse(e){return this._getType(e)===w.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xe.create=(r,e)=>new xe({innerType:r,typeName:x.ZodNullable,...T(e)});class xt extends R{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===w.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}xt.create=(r,e)=>new xt({innerType:r,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});class St extends R{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ft(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ie(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ie(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}St.create=(r,e)=>new St({innerType:r,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});class fs extends R{_parse(e){if(this._getType(e)!==w.nan){const s=this._getOrReturnCtx(e);return y(s,{code:p.invalid_type,expected:w.nan,received:s.parsedType}),k}return{status:"valid",value:e.data}}}fs.create=r=>new fs({typeName:x.ZodNaN,...T(r)});class rn extends R{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ss extends R{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?k:i.status==="dirty"?(t.dirty(),Ze(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?k:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Ss({in:e,out:t,typeName:x.ZodPipeline})}}class Tt extends R{_parse(e){const t=this._def.innerType._parse(e),s=n=>($e(n)&&(n.value=Object.freeze(n.value)),n);return ft(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Tt.create=(r,e)=>new Tt({innerType:r,typeName:x.ZodReadonly,...T(e)});function ir(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Mc(r,e={},t){return r?Qe.create().superRefine((s,n)=>{const i=r(s);if(i instanceof Promise)return i.then(a=>{if(!a){const o=ir(e,s),c=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){const a=ir(e,s),o=a.fatal??t??!0;n.addIssue({code:"custom",...a,fatal:o})}}):Qe.create()}N.lazycreate;var x;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(x||(x={}));const qc=re.create,zc=Ie.create;fs.create;Ne.create;const Vc=os.create;Ge.create;cs.create;pt.create;mt.create;Qe.create;const Zc=ls.create;fe.create;us.create;const Hc=Y.create,Jc=N.create;N.strictCreate;const Wc=gt.create,Kc=xs.create;yt.create;be.create;const Gc=_t.create;hs.create;Le.create;vt.create;const Qc=wt.create;ke.create;bt.create;kt.create;ae.create;ne.create;xe.create;ae.createWithPreprocess;export{Rc as Q,U as a,Zc as b,Fc as c,Wc as d,Hc as e,Kc as f,Vc as g,Mc as h,Qc as l,zc as n,Jc as o,Gc as r,qc as
12s,Ac as u};
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.